Files
openchamber-android-native/third_party/mygo/internal/mobile/wire/gen/spec.go
T
OpenChamber 6c0ee61750 feat: port the client to MyGo native UI (0.3.0)
Switch from Asuka to MyGo, keeping the API client and the feature set:

- servers: saved servers, passwordless and password login, proxy,
  self-signed certificates, per-server device tokens (Keystore), connect
  form, instance list sheet with switch/disconnect
- sessions: virtualized list, search, new session, rename/archive/delete,
  running indicator, event stream keeps it live
- chat: pushed window with system back bar, streaming Markdown via
  ui/markdown, reasoning and tool rows with image previews, footer menu
  (read aloud via a Kotlin TTS plugin, copy, fork), user message menu
  (copy, revert, fork), context usage ring and detail sheet, attachments
  (photos/files via the document picker), permissions
- release builds allow plain http:// LAN servers (Go's net/http dials
  directly, no cleartext manifest needed)
- a local fork of MyGo (third_party/mygo) lowers the Android host's
  minSdk to 24 (Android 7.0); Go 1.27.4 via mise

Version 0.3.0.
2026-11-18 13:22:59 +08:00

273 lines
24 KiB
Go

package main
// field is a field of a message: its name, in Go's form, and its type:
// int, float, bool, string, bytes or strings.
type field struct{ name, typ string }
// msg is a message. A call goes from Go to the host, which runs it on the
// UI thread; an event from the host to Go, which handles it on its main
// thread. reply lists what the receiver answers: a message without one
// is not waited for (wait false), so that a call or an event costs its
// sender nothing; one with wait set is, even with no fields to answer.
type msg struct {
name string
doc string
args []field
reply []field
wait bool
}
func f(name, typ string) field { return field{name, typ} }
// calls go from Go to the host.
var calls = []msg{
{name: "AppInfo", doc: "the app's bundle and the system's settings, asked once at start", wait: true, reply: []field{
f("Name", "string"), f("Version", "string"), f("Identifier", "string"),
f("FilesDir", "string"), f("CacheDir", "string"), f("TempDir", "string"), f("DocumentsDir", "string"),
f("ResourcesDir", "string"),
f("Languages", "strings"), f("RegionLocale", "string"), f("FirstWeekday", "int"), f("HourCycle", "int"),
f("System", "string"), f("SystemVersion", "string"), f("Model", "string"), f("Restoring", "bool"), f("Background", "bool"),
}},
{name: "TimeZone", doc: "the name of the system's time zone; any thread", wait: true, reply: []field{f("ID", "string")}},
{name: "Theme", doc: "the appearance and the accessibility preferences", wait: true, reply: []field{
f("Dark", "bool"), f("Accent", "int"), f("ReduceMotion", "bool"), f("ReduceTransparency", "bool"),
f("IncreaseContrast", "bool"), f("TextScale", "float"),
}},
{name: "SetAppearance", doc: `the appearance the app asks for: "light", "dark" or "system"`, args: []field{f("Source", "string")}},
{name: "Screen", doc: "the screen's size in DIPs and scale", wait: true, reply: []field{
f("Width", "float"), f("Height", "float"), f("Scale", "float"),
}},
{name: "Log", doc: "a line the app wrote to its standard output or error", args: []field{f("Error", "bool"), f("Line", "string")}},
{name: "CreateWindow", doc: "the screen's content: a web view, or a surface for native UI", wait: true,
args: []field{
f("ID", "int"), f("Surface", "bool"), f("OwnScene", "bool"), f("Background", "int"), f("HasBackground", "bool"),
f("Schemes", "strings"), f("Scripts", "strings"), f("ScriptFlags", "strings"),
f("UserAgent", "string"), f("UserAgentSuffix", "string"), f("Inspectable", "bool"),
f("Autoplay", "bool"), f("SwipeNavigation", "bool"), f("PinchZoom", "bool"),
f("Parent", "int"), f("ViewType", "string"), f("ViewArgs", "string"),
},
reply: []field{f("Error", "string"), f("Layer", "int")}},
{name: "FirstFrame", doc: "the window's content presented its first frame", args: []field{f("ID", "int")}},
{name: "PlaceViews", doc: "where a surface shows the windows it holds (Parent), under it, in the order painted; the others hide. Places: encoded by Go (encodePlaces)",
args: []field{f("ID", "int"), f("Places", "bytes")}},
{name: "ShowWindow", args: []field{f("ID", "int")}},
{name: "HideWindow", args: []field{f("ID", "int")}},
{name: "CloseWindow", args: []field{f("ID", "int")}},
{name: "SetBackground", args: []field{f("ID", "int"), f("Color", "int")}},
{name: "Focus", args: []field{f("ID", "int")}},
{name: "SetTitle", doc: "the window's title, which a navigation bar shows", args: []field{f("ID", "int"), f("Title", "string")}},
{name: "CreateTabs", doc: "a bar of tabs, whose tabs AddTab adds before ShowTabs shows it", args: []field{f("ID", "int")}},
{name: "AddTab", args: []field{f("ID", "int"), f("Window", "int"), f("Title", "string"), f("Symbol", "string"), f("Icon", "bytes")}},
{name: "ShowTabs", args: []field{f("ID", "int")}},
{name: "SelectTab", args: []field{f("ID", "int"), f("Index", "int")}},
{name: "SetTabBadge", args: []field{f("ID", "int"), f("Index", "int"), f("Badge", "string")}},
{name: "CloseTabs", args: []field{f("ID", "int")}},
{name: "PushWindow", doc: "shows Child over Parent in Parent's stack, under a bar with its Title and a back button",
args: []field{f("Parent", "int"), f("Child", "int"), f("Title", "string"), f("Animated", "bool")}},
{name: "PopWindow", args: []field{f("ID", "int"), f("Animated", "bool")}},
{name: "SetStack", doc: "a router's pages as the window's stack of screens, its first page and those deeper (Titles, told apart by Keys): the screens of the keys the stack shows stay, the others are pushed, popped or replaced; none take the stack away. Answered once the screen going out of sight holds what the surface shows, as the surface is about to show the page coming",
wait: true, args: []field{f("ID", "int"), f("Titles", "strings"), f("Keys", "strings")}},
{name: "StackShown", doc: "the surface shows the page of the stack's last screen, after SetStack or StackPopped", args: []field{f("ID", "int")}},
{name: "LoadURL", args: []field{f("ID", "int"), f("URL", "string")}},
{name: "LoadHTML", args: []field{f("ID", "int"), f("HTML", "string"), f("BaseURL", "string")}},
{name: "Reload", args: []field{f("ID", "int"), f("IgnoreCache", "bool")}},
{name: "StopLoading", args: []field{f("ID", "int")}},
{name: "GoBack", args: []field{f("ID", "int")}},
{name: "GoForward", args: []field{f("ID", "int")}},
{name: "Eval", args: []field{f("ID", "int"), f("JS", "string")}},
{name: "CallAsync", doc: "runs Body as an async function's; AsyncResult answers", args: []field{f("ID", "int"), f("Req", "int"), f("Body", "string")}},
{name: "SetZoom", args: []field{f("ID", "int"), f("Factor", "float")}},
{name: "SetUserAgent", args: []field{f("ID", "int"), f("UserAgent", "string")}},
{name: "SetUserScripts", args: []field{f("ID", "int"), f("Scripts", "strings"), f("ScriptFlags", "strings")}},
{name: "CapturePage", doc: "a PNG of the page; Captured answers", args: []field{f("ID", "int"), f("Req", "int")}},
{name: "UserAgent", wait: true, args: []field{f("ID", "int")}, reply: []field{f("UserAgent", "string")}},
{name: "SchemeRespond", doc: "the status and headers of a SchemeRequest (Header: names and values in turn)",
args: []field{f("Req", "int"), f("Status", "int"), f("Header", "strings")}},
{name: "SchemeData", args: []field{f("Req", "int"), f("Data", "bytes")}},
{name: "SchemeFinish", args: []field{f("Req", "int")}},
{name: "SchemeFail", args: []field{f("Req", "int"), f("Message", "string")}},
{name: "MessageBox", doc: "an alert; MessageBoxResult answers",
args: []field{f("Req", "int"), f("Type", "string"), f("Title", "string"), f("Message", "string"),
f("Detail", "string"), f("Buttons", "strings"), f("DefaultID", "int"), f("CancelID", "int")}},
{name: "OpenFiles", doc: "the system's picker of documents; FilesResult answers with copies the app may read",
args: []field{f("Req", "int"), f("Multiple", "bool"), f("Directories", "bool"), f("Extensions", "strings")}},
{name: "ShareFile", doc: "the share sheet of a file, as the place to save it", args: []field{f("Path", "string")}},
{name: "ClipboardText", wait: true, reply: []field{f("Text", "string"), f("OK", "bool")}},
{name: "SetClipboardText", args: []field{f("Text", "string")}},
{name: "OpenURL", doc: "opens a URL in the app the system has for it", wait: true, args: []field{f("URL", "string")}, reply: []field{f("OK", "bool")}},
{name: "SecretGet", wait: true, args: []field{f("Service", "string"), f("Account", "string")},
reply: []field{f("Value", "bytes"), f("Found", "bool"), f("Error", "string")}},
{name: "SecretSet", wait: true, args: []field{f("Service", "string"), f("Account", "string"), f("Value", "bytes")},
reply: []field{f("Error", "string")}},
{name: "SecretDelete", wait: true, args: []field{f("Service", "string"), f("Account", "string")},
reply: []field{f("Error", "string")}},
{name: "Notify", doc: "a local notification; NotifyDone answers once the system has it",
args: []field{f("Req", "int"), f("NotificationID", "string"), f("Title", "string"), f("Subtitle", "string"),
f("Body", "string"), f("Group", "string"), f("Silent", "bool")}},
{name: "RemoveNotification", args: []field{f("NotificationID", "string")}},
{name: "RemoveAllNotifications"},
{name: "KeepAwake", doc: "keeps the screen on while the app shows", args: []field{f("On", "bool")}},
{name: "NetworkStatus", wait: true, reply: []field{f("Online", "bool"), f("Metered", "bool")}},
{name: "WatchNetwork", doc: "starts NetworkChanged"},
{name: "Battery", wait: true, reply: []field{f("Level", "float"), f("Charging", "bool"), f("LowPower", "bool")}},
{name: "SetSystemBars", doc: `the icons of the system's bars ("auto", "light" or "dark"), and whether the bars hide`,
args: []field{f("Style", "string"), f("Hidden", "bool")}},
{name: "SetOrientations", doc: "the orientations the screen may take: 1 portrait, 2 upside down, 4 landscape left, 8 landscape right; 0 any",
args: []field{f("Mask", "int")}},
{name: "Share", doc: "the share sheet of text, a link and files; ShareResult answers", args: []field{f("Req", "int"), f("Text", "string"),
f("URL", "string"), f("Paths", "strings"), f("X", "float"), f("Y", "float")}},
{name: "SaveFile", doc: "the system's picker of where to keep a copy of Path under Name; FilesResult answers with the place, empty when dismissed",
args: []field{f("Req", "int"), f("Path", "string"), f("Name", "string")}},
{name: "ClipboardImage", wait: true, reply: []field{f("PNG", "bytes")}},
{name: "SetClipboardImage", args: []field{f("PNG", "bytes")}},
{name: "PopupMenu", doc: "the system's menu at a point of the window: Items are encoded by Go (encodeMenu); MenuPicked answers with the item's ID, 0 when dismissed",
args: []field{f("ID", "int"), f("Req", "int"), f("X", "float"), f("Y", "float"), f("Items", "bytes")}},
{name: "SetBarItems", doc: "the buttons at the end of the window's navigation bar; BarItemClicked tells which: titles, symbols and icons by index",
args: []field{f("ID", "int"), f("Titles", "strings"), f("Symbols", "strings"), f("Icons", "strings")}},
{name: "PluginCall", doc: "a call of a plugin's native code: Args and PluginResult's Result are JSON", args: []field{f("Req", "int"),
f("Plugin", "string"), f("Method", "string"), f("Args", "string")}},
{name: "AudioOpen", doc: "opens the sound's output: stereo at Rate frames a second, holding about Ahead milliseconds; on the caller's thread", wait: true,
args: []field{f("Rate", "int"), f("Ahead", "int")}, reply: []field{f("Error", "string")}},
{name: "AudioWrite", doc: "plays interleaved stereo float32 samples after those written, waiting while the output holds enough; on the caller's thread", wait: true,
args: []field{f("Samples", "bytes")}, reply: []field{f("Error", "string")}},
{name: "AudioClose", wait: true},
{name: "Haptic", doc: `"selection", "light", "medium", "heavy", "success", "warning" or "error"`, args: []field{f("Kind", "string")}},
// Native UI.
{name: "RequestFrame", doc: "asks for a Frame at the next refresh of the display", args: []field{f("ID", "int")}},
{name: "SetTextInput", doc: "whether the keyboard shows and what for: the input's traits (platform.TextTraits), and its text. Show counts the requests to show the keyboard again. Offsets are UTF-16 units of the document, of which Text is the part around the selection, from Base; MarkStart is -1 without marked text. A window without Document takes text without one, as a terminal: the keyboard sees none",
args: []field{f("ID", "int"), f("Active", "bool"), f("Show", "int"), f("Serial", "int"), f("X", "float"), f("Y", "float"), f("Width", "float"), f("Height", "float"),
f("Document", "bool"), f("Multiline", "bool"), f("Secure", "bool"), f("Keyboard", "string"), f("ReturnKey", "string"),
f("Capitalize", "string"), f("Autocorrect", "string"), f("Autofill", "string"),
f("Text", "string"), f("Base", "int"), f("Length", "int"), f("SelStart", "int"), f("SelEnd", "int"), f("MarkStart", "int"), f("MarkEnd", "int")}},
{name: "SetCursor", doc: "the pointer's shape, for a mouse or a trackpad", args: []field{f("ID", "int"), f("Cursor", "string")}},
{name: "AccessibilityChanged", doc: "the tree of accessible elements changed; Focus names the one with the focus",
args: []field{f("ID", "int"), f("Focus", "int")}},
{name: "Announce", args: []field{f("Text", "string")}},
{name: "ShowMenu", doc: "the system's edit menu at a point, with the actions given (cut, copy, paste, selectAll); TextCommand answers",
args: []field{f("ID", "int"), f("X", "float"), f("Y", "float"), f("Actions", "strings")}},
{name: "SetBackAvailable", doc: "whether the content takes the system's back", args: []field{f("ID", "int"), f("On", "bool")}},
{name: "ShowMagnifier", doc: "the system's magnifier of what is at a point", args: []field{f("ID", "int"), f("X", "float"), f("Y", "float")}},
{name: "HideMagnifier", args: []field{f("ID", "int")}},
{name: "TextMetrics", doc: "the metrics of a font (Android's Paint): ascent and descent, x-height, underline and strikethrough", wait: true,
args: []field{f("Family", "string"), f("Size", "float"), f("Weight", "int"), f("Italic", "bool")},
reply: []field{f("Ascent", "float"), f("Descent", "float"), f("XHeight", "float"), f("UnderlinePosition", "float"),
f("UnderlineThickness", "float"), f("StrikePosition", "float")}},
{name: "MeasureText", doc: "how wide each of Texts is in a font, kerned unless NoKern", wait: true,
args: []field{f("Family", "string"), f("Size", "float"), f("Weight", "int"), f("Italic", "bool"), f("NoKern", "bool"),
f("Texts", "strings")},
reply: []field{f("Widths", "floats")}},
{name: "TextAdvances", doc: "the advance of each UTF-16 unit of Text laid out as a whole (getTextRunAdvances)", wait: true,
args: []field{f("Family", "string"), f("Size", "float"), f("Weight", "int"), f("Italic", "bool"), f("NoKern", "bool"),
f("Text", "string"), f("RTL", "bool")},
reply: []field{f("Advances", "floats")}},
{name: "DrawText", doc: "draws Text in white at Scale pixels per DIP, its pen DX pixels right of a pixel's edge: its ink's box from the pen and its pixels, a byte of coverage each, or premultiplied RGBA when Color", wait: true,
args: []field{f("Family", "string"), f("Size", "float"), f("Weight", "int"), f("Italic", "bool"), f("Text", "string"),
f("Scale", "float"), f("DX", "float")},
reply: []field{f("Left", "int"), f("Top", "int"), f("Width", "int"), f("Height", "int"), f("Color", "bool"), f("Pixels", "bytes")}},
{name: "RegisterFont", doc: "adds a font file under Family, or its own family when empty", wait: true,
args: []field{f("Data", "bytes"), f("Family", "string")}, reply: []field{f("Family", "string"), f("Error", "string")}},
}
// events go from the host to Go.
var events = []msg{
{name: "Ready", doc: "the app finished launching"},
{name: "Active", doc: "the app is in front, or no longer", args: []field{f("Active", "bool")}},
{name: "Background", doc: "the app goes to the background (true) or came back. The host waits: iOS ends apps that use the GPU in the background, so that frames stop before it returns", wait: true, args: []field{f("Background", "bool")}},
{name: "ThemeChanged"},
{name: "LocaleChanged"},
{name: "TimeZoneChanged", args: []field{f("ID", "string")}},
{name: "OpenURLs", args: []field{f("URLs", "strings")}},
{name: "MemoryWarning"},
{name: "Terminating", doc: "the process ends once Go answers", wait: true},
{name: "Resized", doc: "the window's size in DIPs, the scale, and the insets of what covers it: the system's bars, the cutout, the keyboard",
args: []field{f("ID", "int"), f("Width", "float"), f("Height", "float"), f("Scale", "float"),
f("SafeTop", "float"), f("SafeLeft", "float"), f("SafeBottom", "float"), f("SafeRight", "float"), f("Keyboard", "float")}},
{name: "BackGesture", doc: `the system's gesture of going back, as it goes: Phase is "started", "progress" or "cancelled"`,
args: []field{f("ID", "int"), f("Phase", "string"), f("Progress", "float")}},
{name: "StatusBarTapped", doc: "a tap on iOS's status bar"},
{name: "ViewPressed", doc: "a finger went down on a view a surface holds, which takes it", args: []field{f("ID", "int"), f("X", "float"), f("Y", "float")}},
{name: "PluginResult", args: []field{f("Req", "int"), f("Result", "string"), f("Error", "string"), f("Code", "string")}},
{name: "PluginEvent", doc: "an event of a plugin's native code: Data is JSON", args: []field{f("Plugin", "string"), f("Name", "string"), f("Data", "string")}},
{name: "NetworkChanged", args: []field{f("Online", "bool"), f("Metered", "bool")}},
{name: "ShareResult", args: []field{f("Req", "int"), f("Error", "string")}},
{name: "MenuPicked", args: []field{f("Req", "int"), f("Item", "int")}},
{name: "BarItemClicked", args: []field{f("ID", "int"), f("Index", "int")}},
{name: "TabSelected", doc: "the user chose tab Index", args: []field{f("ID", "int"), f("Index", "int")}},
{name: "StackPopped", doc: "the user took screens off a window's stack (SetStack): Depth stay", args: []field{f("ID", "int"), f("Depth", "int")}},
{name: "Popped", doc: "the window left its stack: the back button, a swipe, Android's back, or PopWindow", args: []field{f("ID", "int")}},
{name: "BackPressed", doc: "Android's back: whether the app took it", wait: true, args: []field{f("ID", "int")}, reply: []field{f("Handled", "bool")}},
{name: "Message", doc: "a message the page's bridge posted", args: []field{f("ID", "int"), f("Text", "string")}},
{name: "WillNavigate", wait: true,
args: []field{f("ID", "int"), f("URL", "string"), f("MainFrame", "bool"), f("UserInitiated", "bool"), f("Unasked", "bool"), f("Reload", "bool")},
reply: []field{f("Allow", "bool")}},
{name: "NewWindow", doc: "window.open or a link to _blank: whether the app opened it", wait: true,
args: []field{f("ID", "int"), f("URL", "string"), f("UserInitiated", "bool")}, reply: []field{f("Handled", "bool")}},
{name: "PageState", doc: "what the page is at, after any change of it",
args: []field{f("ID", "int"), f("URL", "string"), f("Title", "string"), f("Loading", "bool"), f("CanGoBack", "bool"), f("CanGoForward", "bool")}},
{name: "NavigationStarted", args: []field{f("ID", "int"), f("URL", "string")}},
{name: "NavigationCommitted", args: []field{f("ID", "int"), f("URL", "string")}},
{name: "LoadFinished", args: []field{f("ID", "int")}},
{name: "LoadFailed", args: []field{f("ID", "int"), f("URL", "string"), f("Code", "int"), f("Description", "string")}},
{name: "ClosedByPage", args: []field{f("ID", "int")}},
{name: "WindowFront", doc: "the user went to a window of its own scene, or (0) to the app's first", args: []field{f("ID", "int")}},
{name: "ProcessGone", args: []field{f("ID", "int"), f("Reason", "string")}},
{name: "PermissionRequested", wait: true, args: []field{f("ID", "int"), f("Kinds", "strings"), f("Origin", "string")}, reply: []field{f("Allow", "bool")}},
{name: "SchemeRequest", doc: "a request of one of the app's schemes (Header: names and values in turn)",
args: []field{f("ID", "int"), f("Req", "int"), f("Method", "string"), f("URL", "string"), f("Header", "strings"),
f("Body", "bytes"), f("HasBody", "bool")}},
{name: "SchemeCancel", args: []field{f("Req", "int")}},
{name: "AsyncResult", args: []field{f("Req", "int"), f("Result", "string"), f("Error", "string")}},
{name: "Captured", args: []field{f("Req", "int"), f("PNG", "bytes"), f("Error", "string")}},
{name: "MessageBoxResult", args: []field{f("Req", "int"), f("Response", "int")}},
{name: "FilesResult", args: []field{f("Req", "int"), f("Paths", "strings"), f("Error", "string")}},
{name: "NotifyDone", args: []field{f("Req", "int"), f("Error", "string")}},
{name: "NotificationClicked", args: []field{f("NotificationID", "string")}},
// Native UI.
{name: "Frame", doc: "the display refreshes: draw a frame if one was asked for", args: []field{f("ID", "int")}},
{name: "SurfaceChanged", doc: "the native surface to draw on (a CAMetalLayer, an ANativeWindow), 0 when gone",
args: []field{f("ID", "int"), f("Handle", "int"), f("Width", "float"), f("Height", "float"), f("Scale", "float"), f("Refresh", "float")}},
{name: "SurfaceDestroyed", doc: "the native surface goes: the host waits for Go to let go of it", wait: true, args: []field{f("ID", "int")}},
{name: "Touch", doc: `a finger, a pen or a mouse: Phase is "down", "move", "up" or "cancel", Kind "touch", "pen" or "mouse"`,
args: []field{f("ID", "int"), f("Pointer", "int"), f("Phase", "string"), f("Kind", "string"), f("X", "float"), f("Y", "float"),
f("Pressure", "float"), f("Buttons", "int"), f("Time", "float")}},
{name: "Scroll", doc: "a mouse's or a trackpad's scrolling, in DIPs", args: []field{f("ID", "int"), f("X", "float"), f("Y", "float"),
f("DX", "float"), f("DY", "float"), f("Precise", "bool"), f("Phase", "string")}},
{name: "Key", doc: "a hardware keyboard's key: Down, its name (as ui names keys) and the text it types",
args: []field{f("ID", "int"), f("Down", "bool"), f("Key", "string"), f("Text", "string"), f("Mods", "int"), f("Repeated", "bool")},
reply: []field{f("Handled", "bool")}, wait: true},
{name: "TextReplace", doc: "the keyboard put Text in Start to End of the document, or with no range in place of the marked text or the selection; answers TextStateReply", wait: true,
args: []field{f("ID", "int"), f("HasRange", "bool"), f("Start", "int"), f("End", "int"), f("Text", "string")}},
{name: "TextMark", doc: "the input method composes Text over Start to End, or with no range over the marked text or the selection; SelStart and SelEnd are in Text; answers TextStateReply", wait: true,
args: []field{f("ID", "int"), f("HasRange", "bool"), f("Start", "int"), f("End", "int"), f("Text", "string"), f("SelStart", "int"), f("SelEnd", "int")}},
{name: "TextUnmark", doc: "the marked text stays as text; answers TextStateReply", wait: true, args: []field{f("ID", "int")}},
{name: "TextDelete", doc: "the keyboard deleted Before units before the selection and After after it; answers TextStateReply", wait: true,
args: []field{f("ID", "int"), f("Before", "int"), f("After", "int")}},
{name: "TextSelect", doc: "the keyboard moved the selection; answers TextStateReply", wait: true, args: []field{f("ID", "int"), f("Start", "int"), f("End", "int")}},
{name: "TextCommand", doc: `an editing action of the keyboard or the edit menu: "newline", "tab", "deleteBackward", "deleteForward", "cut", "copy", "paste", "selectAll", "left", …; answers TextStateReply`, wait: true,
args: []field{f("ID", "int"), f("Command", "string")}},
{name: "TextState", doc: "the text around the selection, and the selection", wait: true,
args: []field{f("ID", "int")}, reply: []field{f("Text", "string"), f("Base", "int"), f("Length", "int"), f("SelStart", "int"), f("SelEnd", "int"),
f("MarkStart", "int"), f("MarkEnd", "int"), f("X", "float"), f("Y", "float"), f("Width", "float"), f("Height", "float")}},
{name: "TextRange", doc: "a part of the document outside the text the host has", wait: true,
args: []field{f("ID", "int"), f("Start", "int"), f("End", "int")}, reply: []field{f("Text", "string"), f("Start", "int"), f("End", "int")}},
{name: "TextBounds", doc: "where the range is on screen: its first line's rectangle", wait: true,
args: []field{f("ID", "int"), f("Start", "int"), f("End", "int")}, reply: []field{f("OK", "bool"), f("X", "float"), f("Y", "float"), f("Width", "float"), f("Height", "float"), f("End", "int")}},
{name: "TextIndexAt", doc: "the offset nearest a point of the window", wait: true,
args: []field{f("ID", "int"), f("X", "float"), f("Y", "float")}, reply: []field{f("OK", "bool"), f("Index", "int")}},
{name: "TextInputEnded", doc: "the keyboard went away", args: []field{f("ID", "int")}},
{name: "AccessibilityTree", doc: "the accessible elements, encoded as Nodes: for each, its ID, parent, role, label, value, hint, frame and actions", wait: true,
args: []field{f("ID", "int")}, reply: []field{f("Nodes", "bytes")}},
{name: "AccessibilityAction", doc: `an assistive technology's action on an element: "press", "increment", "decrement", "focus", "scrollForward", …`, wait: true,
args: []field{f("ID", "int"), f("Node", "int"), f("Action", "string")}, reply: []field{f("Handled", "bool")}},
}