From d533aef04b785423c8d800cc32e45f199824be2a Mon Sep 17 00:00:00 2001 From: PJ Date: Fri, 17 Apr 2026 23:40:28 +0700 Subject: [PATCH] feat(driver): Driver interface for v0.1 RPC surface Mirrors proto/driverpb/driver.proto: Launch, Terminate, Tap, InputText, Hierarchy, Screenshot, WaitForIdle, Health. Keeps Image/Health as dedicated structs so callers don't depend on generated proto types. --- internal/driver/driver.go | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 internal/driver/driver.go diff --git a/internal/driver/driver.go b/internal/driver/driver.go new file mode 100644 index 0000000..e75bbdc --- /dev/null +++ b/internal/driver/driver.go @@ -0,0 +1,35 @@ +package driver + +import ( + "context" + "time" +) + +// Driver abstracts the platform-specific UI automation backend. v0.1 surface +// matches proto/driverpb/driver.proto. The Maestro sidecar implementation +// lives under driver/maestro; tests use driver/mock. +type Driver interface { + Launch(ctx context.Context, bundleID string, clearState bool) error + Terminate(ctx context.Context) error + + Tap(ctx context.Context, x, y int) error + InputText(ctx context.Context, text string) error + + Hierarchy(ctx context.Context) (string, error) + Screenshot(ctx context.Context) (Image, error) + + WaitForIdle(ctx context.Context, duration time.Duration) error + Health(ctx context.Context) (Health, error) +} + +type Image struct { + PNG []byte + Width int + Height int +} + +type Health struct { + Ready bool + Version string + Platform string +}