diff --git a/internal/driver/ioscompanion/transport/transport.go b/internal/driver/ioscompanion/transport/transport.go index 9e229f3..6a678bb 100644 --- a/internal/driver/ioscompanion/transport/transport.go +++ b/internal/driver/ioscompanion/transport/transport.go @@ -5,6 +5,7 @@ package transport import ( "context" + "errors" pb "github.com/priyanshujain/sanderling/internal/driver/ioscompanion/companionpb" ) @@ -47,6 +48,24 @@ type Companion interface { Close() error } +// TextEditor is an optional companion capability: the transport edits text +// natively on the device instead of the driver composing keyboard HID streams. +// The driver routes text input through it when the companion implements it. +type TextEditor interface { + // InputText replaces the focused field's content with text. + InputText(ctx context.Context, text string) error + + // EraseText deletes characterCount characters from the focused field. + EraseText(ctx context.Context, characterCount int) error + + // PressKey presses the named logical key (currently only return/enter). + PressKey(ctx context.Context, key string) error +} + +// ErrCompanionUnavailable marks a connection-level failure that a companion +// restart can recover from. Transports wrap dropped-connection errors with it. +var ErrCompanionUnavailable = errors.New("companion connection unavailable") + // ScreenDescription carries the target screen geometry. Width and Height are // in points (the coordinate space HID events and the accessibility frames use). // Scale is the pixel-per-point density, or 0 when the companion did not report