feat: LTL operators, sampling, and default generators (#17)

* feat(ltl): add Now/Next/Eventually/Implies/Or/And/Not formulas

Replace the fold-with-latch evaluator with a residual-formula reducer.
Each Observe() instantiates a fresh obligation from the root (stripping
an outer Always), reduces each pending obligation against current state,
latches Violated on first failure, and surfaces Pending verdicts for
deferred obligations. Existing Always/Pure/Thunk tests continue to pass.

* feat(ltl): support relative duration for eventually().within()

* feat(proto): add Swipe, PressKey, RecentLogs RPCs

* feat(verifier,runner): formula handles, new action kinds, rich state

- verifier: add formula-spec registry; bindNow/bindNext/bindEventually with
  chainable .implies/.or/.and/.not and .within(n,unit) on eventually; bindFrom
  for uniform sampling. bindAlways keeps accepting plain predicates.
- verifier: store lastTree, lastAction, step time, logs, exceptions on the
  Verifier; SnapshotInput replaces the (snapshots, tree) pair. stateObject now
  produces state.lastAction/time/logs/exceptions matching the TS State type.
- verifier: make taps/swipes/waitOnce/pressKey built-in generators actually
  fire; taps picks a clickable, enabled element from the last hierarchy.
- agent: add exceptions field to Message wire format.
- driver: add Swipe/PressKey/RecentLogs to Driver interface; wire maestro
  client and mock driver. LogEntry exposed for runner consumption.
- runner: apply Swipe/PressKey/Wait actions; collect logcat and exceptions;
  pass lastAction and step time into PushSnapshot.

* feat(spec-api): LTL operators, new actions, richer State

- ltl.ts exports now/next/eventually; always overload accepts a Formula
- types.ts: Formula gains implies/or/and/not; EventuallyFormula adds .within;
  State gains lastAction/time/logs/exceptions; Swipe/PressKey/Wait action types
- actions.ts: Swipe/PressKey/Wait/from constructors; waitOnce + pressKey
  default generators
- tests exercise the chaining, sampling, and new actions through a recorded
  fake runtime

* feat(sidecar): add swipe, pressKey, recentLogs RPC handlers

* feat(sdk-android): capture uncaught exceptions

Install a default uncaught handler on Uatu.start, chained with any
existing handler so Android's crash reporter still runs. Expose
Uatu.reportError for callers to forward caught throwables. A bounded
circular buffer (default 50) drains into each STATE message's new
exceptions field. Protocol.kt serializes/deserializes the field,
matching the Go wire format added to internal/agent/protocol.go.

* feat(spec-api): add @uatu/spec/defaults/properties bundle

* feat(sample-app): exercise new LTL operators + defaults

spec.ts now imports eventually/next/now/from from @uatu/spec and
noUncaughtExceptions from @uatu/spec/defaults/properties. It declares
three properties that exercise the new surface:

- accountCountNonNegative: plain always() safety
- addAccountAdvances: always(now(x).implies(next(y)))
- eventuallyLoggedIn: eventually(p).within(30, "seconds")
- noUncaughtExceptions: imported default

The weighted actions root uses from() for random phone/name sampling
and entries for taps/swipes/waitOnce/pressKey built-ins.

SampleApplication gains a debug hook gated on the system property
uatu.inject_error so the e2e run can synthesize an Uatu.reportError and
verify noUncaughtExceptions violates.

cmd/uatu/test_run.go adds a subpath alias so specs importing
"@uatu/spec/defaults/properties" resolve against the in-tree source
when running from the uatu checkout. The spec-integration tests swap
the old click-counter fixtures for the new login hierarchy.

* feat(trace): record swipe/key/wait details + exceptions

trace.Step gains an Exceptions array so the trace captures the
class/message/stackTrace for each SDK-reported throwable in a step.
trace.Action gains FromX/FromY/ToX/ToY/Key/DurationMillis so the full
payload of Swipe/PressKey/Wait actions is visible in trace.jsonl.

sample-app's debug error hook now gates on ApplicationInfo.DEBUGGABLE
instead of a system property (adb setprop fails on non-rooted
emulators).
This commit is contained in:
pj authored and GitHub committed 2026-04-20 02:19:39 +07:00
1 parent 5b5594ee05
commit 7493945251
40 files changed
+2980 -262

No files matched your search

+346 -37
View File
@@ -468,6 +468,279 @@ func (x *HealthStatus) GetPlatform() string {
return ""
}
type SwipeRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
From *Point `protobuf:"bytes,1,opt,name=from,proto3" json:"from,omitempty"`
To *Point `protobuf:"bytes,2,opt,name=to,proto3" json:"to,omitempty"`
DurationMillis int64 `protobuf:"varint,3,opt,name=duration_millis,json=durationMillis,proto3" json:"duration_millis,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *SwipeRequest) Reset() {
*x = SwipeRequest{}
mi := &file_driverpb_driver_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *SwipeRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SwipeRequest) ProtoMessage() {}
func (x *SwipeRequest) ProtoReflect() protoreflect.Message {
mi := &file_driverpb_driver_proto_msgTypes[9]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use SwipeRequest.ProtoReflect.Descriptor instead.
func (*SwipeRequest) Descriptor() ([]byte, []int) {
return file_driverpb_driver_proto_rawDescGZIP(), []int{9}
}
func (x *SwipeRequest) GetFrom() *Point {
if x != nil {
return x.From
}
return nil
}
func (x *SwipeRequest) GetTo() *Point {
if x != nil {
return x.To
}
return nil
}
func (x *SwipeRequest) GetDurationMillis() int64 {
if x != nil {
return x.DurationMillis
}
return 0
}
type PressKeyRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
// Logical key name. Supported: "back", "home", "enter", "tab", "up",
// "down", "left", "right".
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *PressKeyRequest) Reset() {
*x = PressKeyRequest{}
mi := &file_driverpb_driver_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *PressKeyRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*PressKeyRequest) ProtoMessage() {}
func (x *PressKeyRequest) ProtoReflect() protoreflect.Message {
mi := &file_driverpb_driver_proto_msgTypes[10]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use PressKeyRequest.ProtoReflect.Descriptor instead.
func (*PressKeyRequest) Descriptor() ([]byte, []int) {
return file_driverpb_driver_proto_rawDescGZIP(), []int{10}
}
func (x *PressKeyRequest) GetKey() string {
if x != nil {
return x.Key
}
return ""
}
type RecentLogsRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
// Lower bound as unix-epoch milliseconds; entries at or after this are
// returned.
SinceUnixMillis int64 `protobuf:"varint,1,opt,name=since_unix_millis,json=sinceUnixMillis,proto3" json:"since_unix_millis,omitempty"`
// Minimum level: "E", "W", or "I". Empty defaults to "E".
LevelAtLeast string `protobuf:"bytes,2,opt,name=level_at_least,json=levelAtLeast,proto3" json:"level_at_least,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *RecentLogsRequest) Reset() {
*x = RecentLogsRequest{}
mi := &file_driverpb_driver_proto_msgTypes[11]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *RecentLogsRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*RecentLogsRequest) ProtoMessage() {}
func (x *RecentLogsRequest) ProtoReflect() protoreflect.Message {
mi := &file_driverpb_driver_proto_msgTypes[11]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use RecentLogsRequest.ProtoReflect.Descriptor instead.
func (*RecentLogsRequest) Descriptor() ([]byte, []int) {
return file_driverpb_driver_proto_rawDescGZIP(), []int{11}
}
func (x *RecentLogsRequest) GetSinceUnixMillis() int64 {
if x != nil {
return x.SinceUnixMillis
}
return 0
}
func (x *RecentLogsRequest) GetLevelAtLeast() string {
if x != nil {
return x.LevelAtLeast
}
return ""
}
type LogEntries struct {
state protoimpl.MessageState `protogen:"open.v1"`
Entries []*LogEntry `protobuf:"bytes,1,rep,name=entries,proto3" json:"entries,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *LogEntries) Reset() {
*x = LogEntries{}
mi := &file_driverpb_driver_proto_msgTypes[12]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *LogEntries) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*LogEntries) ProtoMessage() {}
func (x *LogEntries) ProtoReflect() protoreflect.Message {
mi := &file_driverpb_driver_proto_msgTypes[12]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use LogEntries.ProtoReflect.Descriptor instead.
func (*LogEntries) Descriptor() ([]byte, []int) {
return file_driverpb_driver_proto_rawDescGZIP(), []int{12}
}
func (x *LogEntries) GetEntries() []*LogEntry {
if x != nil {
return x.Entries
}
return nil
}
type LogEntry struct {
state protoimpl.MessageState `protogen:"open.v1"`
UnixMillis int64 `protobuf:"varint,1,opt,name=unix_millis,json=unixMillis,proto3" json:"unix_millis,omitempty"`
Level string `protobuf:"bytes,2,opt,name=level,proto3" json:"level,omitempty"`
Tag string `protobuf:"bytes,3,opt,name=tag,proto3" json:"tag,omitempty"`
Message string `protobuf:"bytes,4,opt,name=message,proto3" json:"message,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *LogEntry) Reset() {
*x = LogEntry{}
mi := &file_driverpb_driver_proto_msgTypes[13]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *LogEntry) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*LogEntry) ProtoMessage() {}
func (x *LogEntry) ProtoReflect() protoreflect.Message {
mi := &file_driverpb_driver_proto_msgTypes[13]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use LogEntry.ProtoReflect.Descriptor instead.
func (*LogEntry) Descriptor() ([]byte, []int) {
return file_driverpb_driver_proto_rawDescGZIP(), []int{13}
}
func (x *LogEntry) GetUnixMillis() int64 {
if x != nil {
return x.UnixMillis
}
return 0
}
func (x *LogEntry) GetLevel() string {
if x != nil {
return x.Level
}
return ""
}
func (x *LogEntry) GetTag() string {
if x != nil {
return x.Tag
}
return ""
}
func (x *LogEntry) GetMessage() string {
if x != nil {
return x.Message
}
return ""
}
var File_driverpb_driver_proto protoreflect.FileDescriptor
const file_driverpb_driver_proto_rawDesc = "" +
@@ -497,16 +770,38 @@ const file_driverpb_driver_proto_rawDesc = "" +
"\fHealthStatus\x12\x14\n" +
"\x05ready\x18\x01 \x01(\bR\x05ready\x12\x18\n" +
"\aversion\x18\x02 \x01(\tR\aversion\x12\x1a\n" +
"\bplatform\x18\x03 \x01(\tR\bplatform2\xb0\x04\n" +
"\bplatform\x18\x03 \x01(\tR\bplatform\"\x89\x01\n" +
"\fSwipeRequest\x12)\n" +
"\x04from\x18\x01 \x01(\v2\x15.uatu.driver.v1.PointR\x04from\x12%\n" +
"\x02to\x18\x02 \x01(\v2\x15.uatu.driver.v1.PointR\x02to\x12'\n" +
"\x0fduration_millis\x18\x03 \x01(\x03R\x0edurationMillis\"#\n" +
"\x0fPressKeyRequest\x12\x10\n" +
"\x03key\x18\x01 \x01(\tR\x03key\"e\n" +
"\x11RecentLogsRequest\x12*\n" +
"\x11since_unix_millis\x18\x01 \x01(\x03R\x0fsinceUnixMillis\x12$\n" +
"\x0elevel_at_least\x18\x02 \x01(\tR\flevelAtLeast\"@\n" +
"\n" +
"LogEntries\x122\n" +
"\aentries\x18\x01 \x03(\v2\x18.uatu.driver.v1.LogEntryR\aentries\"m\n" +
"\bLogEntry\x12\x1f\n" +
"\vunix_millis\x18\x01 \x01(\x03R\n" +
"unixMillis\x12\x14\n" +
"\x05level\x18\x02 \x01(\tR\x05level\x12\x10\n" +
"\x03tag\x18\x03 \x01(\tR\x03tag\x12\x18\n" +
"\amessage\x18\x04 \x01(\tR\amessage2\xff\x05\n" +
"\x06Driver\x12>\n" +
"\x06Launch\x12\x1d.uatu.driver.v1.LaunchRequest\x1a\x15.uatu.driver.v1.Empty\x129\n" +
"\tTerminate\x12\x15.uatu.driver.v1.Empty\x1a\x15.uatu.driver.v1.Empty\x123\n" +
"\x03Tap\x12\x15.uatu.driver.v1.Point\x1a\x15.uatu.driver.v1.Empty\x12>\n" +
"\vTapSelector\x12\x18.uatu.driver.v1.Selector\x1a\x15.uatu.driver.v1.Empty\x128\n" +
"\tInputText\x12\x14.uatu.driver.v1.Text\x1a\x15.uatu.driver.v1.Empty\x12:\n" +
"\tInputText\x12\x14.uatu.driver.v1.Text\x1a\x15.uatu.driver.v1.Empty\x12<\n" +
"\x05Swipe\x12\x1c.uatu.driver.v1.SwipeRequest\x1a\x15.uatu.driver.v1.Empty\x12B\n" +
"\bPressKey\x12\x1f.uatu.driver.v1.PressKeyRequest\x1a\x15.uatu.driver.v1.Empty\x12:\n" +
"\n" +
"Screenshot\x12\x15.uatu.driver.v1.Empty\x1a\x15.uatu.driver.v1.Image\x12A\n" +
"\tHierarchy\x12\x15.uatu.driver.v1.Empty\x1a\x1d.uatu.driver.v1.HierarchyJSON\x12>\n" +
"\tHierarchy\x12\x15.uatu.driver.v1.Empty\x1a\x1d.uatu.driver.v1.HierarchyJSON\x12K\n" +
"\n" +
"RecentLogs\x12!.uatu.driver.v1.RecentLogsRequest\x1a\x1a.uatu.driver.v1.LogEntries\x12>\n" +
"\vWaitForIdle\x12\x18.uatu.driver.v1.Duration\x1a\x15.uatu.driver.v1.Empty\x12=\n" +
"\x06Health\x12\x15.uatu.driver.v1.Empty\x1a\x1c.uatu.driver.v1.HealthStatusBM\n" +
"\x12dev.uatu.driver.v1P\x01Z5github.com/priyanshujain/uatu/proto/driverpb;driverpbb\x06proto3"
@@ -523,42 +818,56 @@ func file_driverpb_driver_proto_rawDescGZIP() []byte {
return file_driverpb_driver_proto_rawDescData
}
var file_driverpb_driver_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
var file_driverpb_driver_proto_msgTypes = make([]protoimpl.MessageInfo, 14)
var file_driverpb_driver_proto_goTypes = []any{
(*Empty)(nil), // 0: uatu.driver.v1.Empty
(*LaunchRequest)(nil), // 1: uatu.driver.v1.LaunchRequest
(*Point)(nil), // 2: uatu.driver.v1.Point
(*Text)(nil), // 3: uatu.driver.v1.Text
(*Selector)(nil), // 4: uatu.driver.v1.Selector
(*Image)(nil), // 5: uatu.driver.v1.Image
(*HierarchyJSON)(nil), // 6: uatu.driver.v1.HierarchyJSON
(*Duration)(nil), // 7: uatu.driver.v1.Duration
(*HealthStatus)(nil), // 8: uatu.driver.v1.HealthStatus
(*Empty)(nil), // 0: uatu.driver.v1.Empty
(*LaunchRequest)(nil), // 1: uatu.driver.v1.LaunchRequest
(*Point)(nil), // 2: uatu.driver.v1.Point
(*Text)(nil), // 3: uatu.driver.v1.Text
(*Selector)(nil), // 4: uatu.driver.v1.Selector
(*Image)(nil), // 5: uatu.driver.v1.Image
(*HierarchyJSON)(nil), // 6: uatu.driver.v1.HierarchyJSON
(*Duration)(nil), // 7: uatu.driver.v1.Duration
(*HealthStatus)(nil), // 8: uatu.driver.v1.HealthStatus
(*SwipeRequest)(nil), // 9: uatu.driver.v1.SwipeRequest
(*PressKeyRequest)(nil), // 10: uatu.driver.v1.PressKeyRequest
(*RecentLogsRequest)(nil), // 11: uatu.driver.v1.RecentLogsRequest
(*LogEntries)(nil), // 12: uatu.driver.v1.LogEntries
(*LogEntry)(nil), // 13: uatu.driver.v1.LogEntry
}
var file_driverpb_driver_proto_depIdxs = []int32{
1, // 0: uatu.driver.v1.Driver.Launch:input_type -> uatu.driver.v1.LaunchRequest
0, // 1: uatu.driver.v1.Driver.Terminate:input_type -> uatu.driver.v1.Empty
2, // 2: uatu.driver.v1.Driver.Tap:input_type -> uatu.driver.v1.Point
4, // 3: uatu.driver.v1.Driver.TapSelector:input_type -> uatu.driver.v1.Selector
3, // 4: uatu.driver.v1.Driver.InputText:input_type -> uatu.driver.v1.Text
0, // 5: uatu.driver.v1.Driver.Screenshot:input_type -> uatu.driver.v1.Empty
0, // 6: uatu.driver.v1.Driver.Hierarchy:input_type -> uatu.driver.v1.Empty
7, // 7: uatu.driver.v1.Driver.WaitForIdle:input_type -> uatu.driver.v1.Duration
0, // 8: uatu.driver.v1.Driver.Health:input_type -> uatu.driver.v1.Empty
0, // 9: uatu.driver.v1.Driver.Launch:output_type -> uatu.driver.v1.Empty
0, // 10: uatu.driver.v1.Driver.Terminate:output_type -> uatu.driver.v1.Empty
0, // 11: uatu.driver.v1.Driver.Tap:output_type -> uatu.driver.v1.Empty
0, // 12: uatu.driver.v1.Driver.TapSelector:output_type -> uatu.driver.v1.Empty
0, // 13: uatu.driver.v1.Driver.InputText:output_type -> uatu.driver.v1.Empty
5, // 14: uatu.driver.v1.Driver.Screenshot:output_type -> uatu.driver.v1.Image
6, // 15: uatu.driver.v1.Driver.Hierarchy:output_type -> uatu.driver.v1.HierarchyJSON
0, // 16: uatu.driver.v1.Driver.WaitForIdle:output_type -> uatu.driver.v1.Empty
8, // 17: uatu.driver.v1.Driver.Health:output_type -> uatu.driver.v1.HealthStatus
9, // [9:18] is the sub-list for method output_type
0, // [0:9] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
2, // 0: uatu.driver.v1.SwipeRequest.from:type_name -> uatu.driver.v1.Point
2, // 1: uatu.driver.v1.SwipeRequest.to:type_name -> uatu.driver.v1.Point
13, // 2: uatu.driver.v1.LogEntries.entries:type_name -> uatu.driver.v1.LogEntry
1, // 3: uatu.driver.v1.Driver.Launch:input_type -> uatu.driver.v1.LaunchRequest
0, // 4: uatu.driver.v1.Driver.Terminate:input_type -> uatu.driver.v1.Empty
2, // 5: uatu.driver.v1.Driver.Tap:input_type -> uatu.driver.v1.Point
4, // 6: uatu.driver.v1.Driver.TapSelector:input_type -> uatu.driver.v1.Selector
3, // 7: uatu.driver.v1.Driver.InputText:input_type -> uatu.driver.v1.Text
9, // 8: uatu.driver.v1.Driver.Swipe:input_type -> uatu.driver.v1.SwipeRequest
10, // 9: uatu.driver.v1.Driver.PressKey:input_type -> uatu.driver.v1.PressKeyRequest
0, // 10: uatu.driver.v1.Driver.Screenshot:input_type -> uatu.driver.v1.Empty
0, // 11: uatu.driver.v1.Driver.Hierarchy:input_type -> uatu.driver.v1.Empty
11, // 12: uatu.driver.v1.Driver.RecentLogs:input_type -> uatu.driver.v1.RecentLogsRequest
7, // 13: uatu.driver.v1.Driver.WaitForIdle:input_type -> uatu.driver.v1.Duration
0, // 14: uatu.driver.v1.Driver.Health:input_type -> uatu.driver.v1.Empty
0, // 15: uatu.driver.v1.Driver.Launch:output_type -> uatu.driver.v1.Empty
0, // 16: uatu.driver.v1.Driver.Terminate:output_type -> uatu.driver.v1.Empty
0, // 17: uatu.driver.v1.Driver.Tap:output_type -> uatu.driver.v1.Empty
0, // 18: uatu.driver.v1.Driver.TapSelector:output_type -> uatu.driver.v1.Empty
0, // 19: uatu.driver.v1.Driver.InputText:output_type -> uatu.driver.v1.Empty
0, // 20: uatu.driver.v1.Driver.Swipe:output_type -> uatu.driver.v1.Empty
0, // 21: uatu.driver.v1.Driver.PressKey:output_type -> uatu.driver.v1.Empty
5, // 22: uatu.driver.v1.Driver.Screenshot:output_type -> uatu.driver.v1.Image
6, // 23: uatu.driver.v1.Driver.Hierarchy:output_type -> uatu.driver.v1.HierarchyJSON
12, // 24: uatu.driver.v1.Driver.RecentLogs:output_type -> uatu.driver.v1.LogEntries
0, // 25: uatu.driver.v1.Driver.WaitForIdle:output_type -> uatu.driver.v1.Empty
8, // 26: uatu.driver.v1.Driver.Health:output_type -> uatu.driver.v1.HealthStatus
15, // [15:27] is the sub-list for method output_type
3, // [3:15] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
}
func init() { file_driverpb_driver_proto_init() }
@@ -572,7 +881,7 @@ func file_driverpb_driver_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_driverpb_driver_proto_rawDesc), len(file_driverpb_driver_proto_rawDesc)),
NumEnums: 0,
NumMessages: 9,
NumMessages: 14,
NumExtensions: 0,
NumServices: 1,
},
+34
View File
@@ -13,9 +13,12 @@ service Driver {
rpc Tap(Point) returns (Empty);
rpc TapSelector(Selector) returns (Empty);
rpc InputText(Text) returns (Empty);
rpc Swipe(SwipeRequest) returns (Empty);
rpc PressKey(PressKeyRequest) returns (Empty);
rpc Screenshot(Empty) returns (Image);
rpc Hierarchy(Empty) returns (HierarchyJSON);
rpc RecentLogs(RecentLogsRequest) returns (LogEntries);
rpc WaitForIdle(Duration) returns (Empty);
rpc Health(Empty) returns (HealthStatus);
@@ -64,3 +67,34 @@ message HealthStatus {
string version = 2;
string platform = 3;
}
message SwipeRequest {
Point from = 1;
Point to = 2;
int64 duration_millis = 3;
}
message PressKeyRequest {
// Logical key name. Supported: "back", "home", "enter", "tab", "up",
// "down", "left", "right".
string key = 1;
}
message RecentLogsRequest {
// Lower bound as unix-epoch milliseconds; entries at or after this are
// returned.
int64 since_unix_millis = 1;
// Minimum level: "E", "W", or "I". Empty defaults to "E".
string level_at_least = 2;
}
message LogEntries {
repeated LogEntry entries = 1;
}
message LogEntry {
int64 unix_millis = 1;
string level = 2;
string tag = 3;
string message = 4;
}
+114
View File
@@ -24,8 +24,11 @@ const (
Driver_Tap_FullMethodName = "/uatu.driver.v1.Driver/Tap"
Driver_TapSelector_FullMethodName = "/uatu.driver.v1.Driver/TapSelector"
Driver_InputText_FullMethodName = "/uatu.driver.v1.Driver/InputText"
Driver_Swipe_FullMethodName = "/uatu.driver.v1.Driver/Swipe"
Driver_PressKey_FullMethodName = "/uatu.driver.v1.Driver/PressKey"
Driver_Screenshot_FullMethodName = "/uatu.driver.v1.Driver/Screenshot"
Driver_Hierarchy_FullMethodName = "/uatu.driver.v1.Driver/Hierarchy"
Driver_RecentLogs_FullMethodName = "/uatu.driver.v1.Driver/RecentLogs"
Driver_WaitForIdle_FullMethodName = "/uatu.driver.v1.Driver/WaitForIdle"
Driver_Health_FullMethodName = "/uatu.driver.v1.Driver/Health"
)
@@ -39,8 +42,11 @@ type DriverClient interface {
Tap(ctx context.Context, in *Point, opts ...grpc.CallOption) (*Empty, error)
TapSelector(ctx context.Context, in *Selector, opts ...grpc.CallOption) (*Empty, error)
InputText(ctx context.Context, in *Text, opts ...grpc.CallOption) (*Empty, error)
Swipe(ctx context.Context, in *SwipeRequest, opts ...grpc.CallOption) (*Empty, error)
PressKey(ctx context.Context, in *PressKeyRequest, opts ...grpc.CallOption) (*Empty, error)
Screenshot(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Image, error)
Hierarchy(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*HierarchyJSON, error)
RecentLogs(ctx context.Context, in *RecentLogsRequest, opts ...grpc.CallOption) (*LogEntries, error)
WaitForIdle(ctx context.Context, in *Duration, opts ...grpc.CallOption) (*Empty, error)
Health(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*HealthStatus, error)
}
@@ -103,6 +109,26 @@ func (c *driverClient) InputText(ctx context.Context, in *Text, opts ...grpc.Cal
return out, nil
}
func (c *driverClient) Swipe(ctx context.Context, in *SwipeRequest, opts ...grpc.CallOption) (*Empty, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Empty)
err := c.cc.Invoke(ctx, Driver_Swipe_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *driverClient) PressKey(ctx context.Context, in *PressKeyRequest, opts ...grpc.CallOption) (*Empty, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Empty)
err := c.cc.Invoke(ctx, Driver_PressKey_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *driverClient) Screenshot(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Image, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Image)
@@ -123,6 +149,16 @@ func (c *driverClient) Hierarchy(ctx context.Context, in *Empty, opts ...grpc.Ca
return out, nil
}
func (c *driverClient) RecentLogs(ctx context.Context, in *RecentLogsRequest, opts ...grpc.CallOption) (*LogEntries, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(LogEntries)
err := c.cc.Invoke(ctx, Driver_RecentLogs_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *driverClient) WaitForIdle(ctx context.Context, in *Duration, opts ...grpc.CallOption) (*Empty, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Empty)
@@ -152,8 +188,11 @@ type DriverServer interface {
Tap(context.Context, *Point) (*Empty, error)
TapSelector(context.Context, *Selector) (*Empty, error)
InputText(context.Context, *Text) (*Empty, error)
Swipe(context.Context, *SwipeRequest) (*Empty, error)
PressKey(context.Context, *PressKeyRequest) (*Empty, error)
Screenshot(context.Context, *Empty) (*Image, error)
Hierarchy(context.Context, *Empty) (*HierarchyJSON, error)
RecentLogs(context.Context, *RecentLogsRequest) (*LogEntries, error)
WaitForIdle(context.Context, *Duration) (*Empty, error)
Health(context.Context, *Empty) (*HealthStatus, error)
mustEmbedUnimplementedDriverServer()
@@ -181,12 +220,21 @@ func (UnimplementedDriverServer) TapSelector(context.Context, *Selector) (*Empty
func (UnimplementedDriverServer) InputText(context.Context, *Text) (*Empty, error) {
return nil, status.Error(codes.Unimplemented, "method InputText not implemented")
}
func (UnimplementedDriverServer) Swipe(context.Context, *SwipeRequest) (*Empty, error) {
return nil, status.Error(codes.Unimplemented, "method Swipe not implemented")
}
func (UnimplementedDriverServer) PressKey(context.Context, *PressKeyRequest) (*Empty, error) {
return nil, status.Error(codes.Unimplemented, "method PressKey not implemented")
}
func (UnimplementedDriverServer) Screenshot(context.Context, *Empty) (*Image, error) {
return nil, status.Error(codes.Unimplemented, "method Screenshot not implemented")
}
func (UnimplementedDriverServer) Hierarchy(context.Context, *Empty) (*HierarchyJSON, error) {
return nil, status.Error(codes.Unimplemented, "method Hierarchy not implemented")
}
func (UnimplementedDriverServer) RecentLogs(context.Context, *RecentLogsRequest) (*LogEntries, error) {
return nil, status.Error(codes.Unimplemented, "method RecentLogs not implemented")
}
func (UnimplementedDriverServer) WaitForIdle(context.Context, *Duration) (*Empty, error) {
return nil, status.Error(codes.Unimplemented, "method WaitForIdle not implemented")
}
@@ -304,6 +352,42 @@ func _Driver_InputText_Handler(srv interface{}, ctx context.Context, dec func(in
return interceptor(ctx, in, info, handler)
}
func _Driver_Swipe_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SwipeRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(DriverServer).Swipe(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Driver_Swipe_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DriverServer).Swipe(ctx, req.(*SwipeRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Driver_PressKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PressKeyRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(DriverServer).PressKey(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Driver_PressKey_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DriverServer).PressKey(ctx, req.(*PressKeyRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Driver_Screenshot_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(Empty)
if err := dec(in); err != nil {
@@ -340,6 +424,24 @@ func _Driver_Hierarchy_Handler(srv interface{}, ctx context.Context, dec func(in
return interceptor(ctx, in, info, handler)
}
func _Driver_RecentLogs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(RecentLogsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(DriverServer).RecentLogs(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Driver_RecentLogs_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DriverServer).RecentLogs(ctx, req.(*RecentLogsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Driver_WaitForIdle_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(Duration)
if err := dec(in); err != nil {
@@ -403,6 +505,14 @@ var Driver_ServiceDesc = grpc.ServiceDesc{
MethodName: "InputText",
Handler: _Driver_InputText_Handler,
},
{
MethodName: "Swipe",
Handler: _Driver_Swipe_Handler,
},
{
MethodName: "PressKey",
Handler: _Driver_PressKey_Handler,
},
{
MethodName: "Screenshot",
Handler: _Driver_Screenshot_Handler,
@@ -411,6 +521,10 @@ var Driver_ServiceDesc = grpc.ServiceDesc{
MethodName: "Hierarchy",
Handler: _Driver_Hierarchy_Handler,
},
{
MethodName: "RecentLogs",
Handler: _Driver_RecentLogs_Handler,
},
{
MethodName: "WaitForIdle",
Handler: _Driver_WaitForIdle_Handler,
+3
View File
@@ -18,8 +18,11 @@ func TestDriverServiceDescriptor(t *testing.T) {
"Tap": true,
"TapSelector": true,
"InputText": true,
"Swipe": true,
"PressKey": true,
"Screenshot": true,
"Hierarchy": true,
"RecentLogs": true,
"WaitForIdle": true,
"Health": true,
}