Files
sanderling/proto/driverpb/driver.proto
2026-05-31 18:01:09 +05:30

119 lines
2.5 KiB
Protocol Buffer

syntax = "proto3";
package sanderling.driver.v1;
option go_package = "github.com/priyanshujain/sanderling/proto/driverpb;driverpb";
option java_package = "dev.sanderling.driver.v1";
option java_multiple_files = true;
service Driver {
rpc Launch(LaunchRequest) returns (Empty);
rpc Terminate(Empty) returns (Empty);
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 LongPress(Point) returns (Empty);
rpc Screenshot(Empty) returns (Image);
rpc Hierarchy(Empty) returns (HierarchyJSON);
// Snapshot captures hierarchy and screenshot back-to-back under a
// backend-side mutex so the pair describes the same on-device frame.
// Use this instead of racing Hierarchy and Screenshot from the runner.
rpc Snapshot(Empty) returns (SnapshotResponse);
rpc RecentLogs(RecentLogsRequest) returns (LogEntries);
rpc WaitForIdle(Duration) returns (Empty);
rpc Health(Empty) returns (HealthStatus);
rpc Metrics(MetricsRequest) returns (MetricsResponse);
}
message Empty {}
message LaunchRequest {
string bundle_id = 1;
bool clear_state = 2;
map<string, string> env = 3;
}
message Point {
int32 x = 1;
int32 y = 2;
}
message Text {
string value = 1;
}
message Selector {
string value = 1;
}
message Image {
bytes png = 1;
int32 width = 2;
int32 height = 3;
}
message HierarchyJSON {
string json = 1;
}
message SnapshotResponse {
HierarchyJSON hierarchy = 1;
Image screenshot = 2;
}
message Duration {
int64 millis = 1;
}
message HealthStatus {
bool ready = 1;
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;
}
message MetricsRequest {
string bundle_id = 1;
}
message MetricsResponse {
double cpu_percent = 1;
int64 heap_bytes = 2;
int64 total_memory_bytes = 3;
}