@elizaos/plugin-computeruse 2.0.0-beta.1 → 2.0.3-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (176) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +80 -0
  3. package/dist/actions/clipboard.d.ts +22 -0
  4. package/dist/actions/clipboard.d.ts.map +1 -0
  5. package/dist/actions/progress.d.ts +26 -0
  6. package/dist/actions/progress.d.ts.map +1 -0
  7. package/dist/actions/use-computer-agent.d.ts +113 -0
  8. package/dist/actions/use-computer-agent.d.ts.map +1 -0
  9. package/dist/actions/use-computer.d.ts.map +1 -1
  10. package/dist/actions/window-handlers.d.ts +11 -0
  11. package/dist/actions/window-handlers.d.ts.map +1 -0
  12. package/dist/actions/window.d.ts +11 -0
  13. package/dist/actions/window.d.ts.map +1 -0
  14. package/dist/actor/actor.d.ts +84 -0
  15. package/dist/actor/actor.d.ts.map +1 -0
  16. package/dist/actor/agent-callbacks.d.ts +128 -0
  17. package/dist/actor/agent-callbacks.d.ts.map +1 -0
  18. package/dist/actor/agent-loop.d.ts +134 -0
  19. package/dist/actor/agent-loop.d.ts.map +1 -0
  20. package/dist/actor/aosp-input-actor.d.ts +87 -0
  21. package/dist/actor/aosp-input-actor.d.ts.map +1 -0
  22. package/dist/actor/brain.d.ts +195 -0
  23. package/dist/actor/brain.d.ts.map +1 -0
  24. package/dist/actor/cascade.d.ts +92 -0
  25. package/dist/actor/cascade.d.ts.map +1 -0
  26. package/dist/actor/computer-interface.d.ts +276 -0
  27. package/dist/actor/computer-interface.d.ts.map +1 -0
  28. package/dist/actor/dispatch.d.ts +24 -0
  29. package/dist/actor/dispatch.d.ts.map +1 -0
  30. package/dist/actor/index.d.ts +12 -0
  31. package/dist/actor/index.d.ts.map +1 -0
  32. package/dist/actor/types.d.ts +94 -0
  33. package/dist/actor/types.d.ts.map +1 -0
  34. package/dist/approval-manager.d.ts.map +1 -1
  35. package/dist/index.d.ts +19 -6
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js +12001 -5484
  38. package/dist/index.js.map +59 -25
  39. package/dist/mcp/index.d.ts +8 -0
  40. package/dist/mcp/index.d.ts.map +1 -0
  41. package/dist/mcp/server.d.ts +42 -0
  42. package/dist/mcp/server.d.ts.map +1 -0
  43. package/dist/mcp/tools.d.ts +53 -0
  44. package/dist/mcp/tools.d.ts.map +1 -0
  45. package/dist/mobile/android-bridge.d.ts +263 -0
  46. package/dist/mobile/android-bridge.d.ts.map +1 -0
  47. package/dist/mobile/android-scene.d.ts +52 -0
  48. package/dist/mobile/android-scene.d.ts.map +1 -0
  49. package/dist/mobile/android-trajectory.d.ts +66 -0
  50. package/dist/mobile/android-trajectory.d.ts.map +1 -0
  51. package/dist/mobile/index.d.ts +19 -0
  52. package/dist/mobile/index.d.ts.map +1 -0
  53. package/dist/mobile/ios-app-intent-registry.d.ts +20 -0
  54. package/dist/mobile/ios-app-intent-registry.d.ts.map +1 -0
  55. package/dist/mobile/ios-bridge.d.ts +359 -0
  56. package/dist/mobile/ios-bridge.d.ts.map +1 -0
  57. package/dist/mobile/ios-computer-interface.d.ts +160 -0
  58. package/dist/mobile/ios-computer-interface.d.ts.map +1 -0
  59. package/dist/mobile/mobile-computer-interface.d.ts +142 -0
  60. package/dist/mobile/mobile-computer-interface.d.ts.map +1 -0
  61. package/dist/mobile/mobile-screen-capture.d.ts +64 -0
  62. package/dist/mobile/mobile-screen-capture.d.ts.map +1 -0
  63. package/dist/mobile/ocr-provider.d.ts +187 -0
  64. package/dist/mobile/ocr-provider.d.ts.map +1 -0
  65. package/dist/mobile/ocr-provider.js +111 -0
  66. package/dist/mobile/ocr-provider.js.map +10 -0
  67. package/dist/osworld/action-converter.d.ts +4 -1
  68. package/dist/osworld/action-converter.d.ts.map +1 -1
  69. package/dist/osworld/adapter.d.ts +1 -0
  70. package/dist/osworld/adapter.d.ts.map +1 -1
  71. package/dist/parity/index.d.ts +9 -0
  72. package/dist/parity/index.d.ts.map +1 -0
  73. package/dist/parity/parity-matrix.d.ts +82 -0
  74. package/dist/parity/parity-matrix.d.ts.map +1 -0
  75. package/dist/parity/screenspot.d.ts +56 -0
  76. package/dist/parity/screenspot.d.ts.map +1 -0
  77. package/dist/platform/a11y.d.ts +29 -1
  78. package/dist/platform/a11y.d.ts.map +1 -1
  79. package/dist/platform/browser.d.ts +1 -1
  80. package/dist/platform/browser.d.ts.map +1 -1
  81. package/dist/platform/capabilities.d.ts +23 -0
  82. package/dist/platform/capabilities.d.ts.map +1 -1
  83. package/dist/platform/capture.d.ts +65 -0
  84. package/dist/platform/capture.d.ts.map +1 -0
  85. package/dist/platform/clipboard.d.ts +24 -0
  86. package/dist/platform/clipboard.d.ts.map +1 -0
  87. package/dist/platform/coords.d.ts +73 -0
  88. package/dist/platform/coords.d.ts.map +1 -0
  89. package/dist/platform/desktop.d.ts +23 -0
  90. package/dist/platform/desktop.d.ts.map +1 -1
  91. package/dist/platform/displays.d.ts +97 -0
  92. package/dist/platform/displays.d.ts.map +1 -0
  93. package/dist/platform/driver.d.ts +22 -0
  94. package/dist/platform/driver.d.ts.map +1 -1
  95. package/dist/platform/file-ops.d.ts +17 -0
  96. package/dist/platform/file-ops.d.ts.map +1 -1
  97. package/dist/platform/helpers.d.ts +2 -3
  98. package/dist/platform/helpers.d.ts.map +1 -1
  99. package/dist/platform/launch.d.ts +54 -0
  100. package/dist/platform/launch.d.ts.map +1 -0
  101. package/dist/platform/normalized-coords.d.ts +46 -0
  102. package/dist/platform/normalized-coords.d.ts.map +1 -0
  103. package/dist/platform/nut-driver.d.ts +67 -0
  104. package/dist/platform/nut-driver.d.ts.map +1 -1
  105. package/dist/platform/permissions.d.ts +12 -0
  106. package/dist/platform/permissions.d.ts.map +1 -1
  107. package/dist/platform/process-list.d.ts +32 -0
  108. package/dist/platform/process-list.d.ts.map +1 -0
  109. package/dist/platform/ps-host.d.ts +77 -0
  110. package/dist/platform/ps-host.d.ts.map +1 -0
  111. package/dist/platform/screenshot-errors.d.ts +54 -0
  112. package/dist/platform/screenshot-errors.d.ts.map +1 -0
  113. package/dist/platform/screenshot-quality.d.ts +11 -0
  114. package/dist/platform/screenshot-quality.d.ts.map +1 -0
  115. package/dist/platform/screenshot.d.ts.map +1 -1
  116. package/dist/platform/security.d.ts +8 -0
  117. package/dist/platform/security.d.ts.map +1 -1
  118. package/dist/platform/wayland-portal.d.ts +25 -0
  119. package/dist/platform/wayland-portal.d.ts.map +1 -0
  120. package/dist/platform/windows-list.d.ts +43 -1
  121. package/dist/platform/windows-list.d.ts.map +1 -1
  122. package/dist/providers/computer-state.d.ts.map +1 -1
  123. package/dist/providers/scene.d.ts +21 -0
  124. package/dist/providers/scene.d.ts.map +1 -0
  125. package/dist/register-routes.js +11715 -4990
  126. package/dist/register-routes.js.map +61 -24
  127. package/dist/routes/computer-use-compat-routes.d.ts +1 -1
  128. package/dist/routes/computer-use-compat-routes.d.ts.map +1 -1
  129. package/dist/sandbox/docker-backend.d.ts +69 -0
  130. package/dist/sandbox/docker-backend.d.ts.map +1 -0
  131. package/dist/sandbox/index.d.ts +62 -0
  132. package/dist/sandbox/index.d.ts.map +1 -0
  133. package/dist/sandbox/qemu-backend.d.ts +48 -0
  134. package/dist/sandbox/qemu-backend.d.ts.map +1 -0
  135. package/dist/sandbox/remote-guest.d.ts +72 -0
  136. package/dist/sandbox/remote-guest.d.ts.map +1 -0
  137. package/dist/sandbox/sandbox-driver.d.ts +41 -0
  138. package/dist/sandbox/sandbox-driver.d.ts.map +1 -0
  139. package/dist/sandbox/surface-types.d.ts +17 -0
  140. package/dist/sandbox/surface-types.d.ts.map +1 -0
  141. package/dist/sandbox/types.d.ts +138 -0
  142. package/dist/sandbox/types.d.ts.map +1 -0
  143. package/dist/sandbox/wsb-backend.d.ts +48 -0
  144. package/dist/sandbox/wsb-backend.d.ts.map +1 -0
  145. package/dist/scene/a11y-provider.d.ts +83 -0
  146. package/dist/scene/a11y-provider.d.ts.map +1 -0
  147. package/dist/scene/apps.d.ts +39 -0
  148. package/dist/scene/apps.d.ts.map +1 -0
  149. package/dist/scene/dhash.d.ts +105 -0
  150. package/dist/scene/dhash.d.ts.map +1 -0
  151. package/dist/scene/ocr-adapter.d.ts +64 -0
  152. package/dist/scene/ocr-adapter.d.ts.map +1 -0
  153. package/dist/scene/scene-builder.d.ts +107 -0
  154. package/dist/scene/scene-builder.d.ts.map +1 -0
  155. package/dist/scene/scene-types.d.ts +70 -0
  156. package/dist/scene/scene-types.d.ts.map +1 -0
  157. package/dist/scene/screen-state.d.ts +105 -0
  158. package/dist/scene/screen-state.d.ts.map +1 -0
  159. package/dist/scene/serialize.d.ts +28 -0
  160. package/dist/scene/serialize.d.ts.map +1 -0
  161. package/dist/security/browser-script-policy.d.ts +9 -0
  162. package/dist/security/browser-script-policy.d.ts.map +1 -0
  163. package/dist/services/computer-use-service.d.ts +78 -2
  164. package/dist/services/computer-use-service.d.ts.map +1 -1
  165. package/dist/services/index.d.ts +7 -0
  166. package/dist/services/index.d.ts.map +1 -0
  167. package/dist/services/vision-context-provider.d.ts +32 -0
  168. package/dist/services/vision-context-provider.d.ts.map +1 -0
  169. package/dist/types.d.ts +115 -5
  170. package/dist/types.d.ts.map +1 -1
  171. package/package.json +47 -10
  172. package/registry-entry.json +74 -0
  173. package/dist/actions/desktop-handlers.d.ts +0 -20
  174. package/dist/actions/desktop-handlers.d.ts.map +0 -1
  175. package/dist/actions/desktop.d.ts +0 -11
  176. package/dist/actions/desktop.d.ts.map +0 -1
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Computer-use MCP server seam (#9170). Public surface:
3
+ * - the pure tool catalog + dispatch (`tools.ts`),
4
+ * - the optional-SDK transport wiring (`server.ts`).
5
+ */
6
+ export { COMPUTERUSE_MCP_TOOLS, type ComputerUseCommandRunner, type ComputerUseMcpTool, dispatchComputerUseMcpTool, findComputerUseMcpTool, } from "./tools.js";
7
+ export { connectComputerUseMcpStdio, createComputerUseMcpServer, } from "./server.js";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mcp/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,qBAAqB,EACrB,KAAK,wBAAwB,EAC7B,KAAK,kBAAkB,EACvB,0BAA0B,EAC1B,sBAAsB,GACvB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,aAAa,CAAC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * MCP server wiring for computer-use (#9170 — optional MCP server seam).
3
+ *
4
+ * Builds an MCP server that exposes {@link COMPUTERUSE_MCP_TOOLS} so an external
5
+ * MCP client can drive this machine. The `@modelcontextprotocol/sdk` is an
6
+ * OPTIONAL dependency (declared in package.json `optionalDependencies`) — it is
7
+ * imported dynamically so the plugin builds/loads without it; only operators who
8
+ * actually run the MCP server need it installed. The pure catalog + dispatch in
9
+ * `tools.ts` carry the logic and are unit-tested; this file is the thin transport
10
+ * glue.
11
+ */
12
+ import { type ComputerUseCommandRunner } from "./tools.js";
13
+ /** The subset of the MCP SDK `McpServer` we use (locally typed so this file
14
+ * type-checks whether or not the optional SDK is installed). */
15
+ interface McpServerLike {
16
+ registerTool(name: string, config: {
17
+ description?: string;
18
+ inputSchema?: Record<string, unknown>;
19
+ }, handler: (args: Record<string, unknown>) => Promise<{
20
+ content: Array<{
21
+ type: "text";
22
+ text: string;
23
+ }>;
24
+ }>): unknown;
25
+ connect(transport: unknown): Promise<void>;
26
+ }
27
+ /**
28
+ * Create an MCP server exposing the computer-use tools, dispatching each call to
29
+ * `runner.executeCommand`. Dynamically imports the SDK; throws a clear error if
30
+ * the optional dependency is not installed.
31
+ */
32
+ export declare function createComputerUseMcpServer(runner: ComputerUseCommandRunner, options?: {
33
+ name?: string;
34
+ version?: string;
35
+ }): Promise<McpServerLike>;
36
+ /**
37
+ * Connect the server over stdio (for `claude_desktop_config.json` style
38
+ * launches). Dynamically imports the stdio transport from the optional SDK.
39
+ */
40
+ export declare function connectComputerUseMcpStdio(runner: ComputerUseCommandRunner): Promise<McpServerLike>;
41
+ export {};
42
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAEL,KAAK,wBAAwB,EAE9B,MAAM,YAAY,CAAC;AAEpB;gEACgE;AAChE,UAAU,aAAa;IACrB,YAAY,CACV,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE;QACN,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACvC,EACD,OAAO,EAAE,CACP,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC1B,OAAO,CAAC;QAAE,OAAO,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE,CAAC,GAC/D,OAAO,CAAC;IACX,OAAO,CAAC,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5C;AAcD;;;;GAIG;AACH,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,wBAAwB,EAChC,OAAO,GAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAO,GAChD,OAAO,CAAC,aAAa,CAAC,CA2CxB;AAED;;;GAGG;AACH,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,wBAAwB,GAC/B,OAAO,CAAC,aAAa,CAAC,CAQxB"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * MCP tool catalog for computer-use (#9170 — trycua/cua parity: optional MCP
3
+ * server seam). Exposes the desktop computer-use verbs as Model Context Protocol
4
+ * tools so an external MCP client (Claude Desktop, Cursor, Cline, …) can drive
5
+ * this machine — the same surface domdomegg/computer-use-mcp offers, but backed
6
+ * by our full driver + approval stack.
7
+ *
8
+ * This module is PURE (no MCP SDK import): it defines the tool catalog and the
9
+ * dispatch mapping (MCP tool name → `ComputerUseService.executeCommand` command),
10
+ * so it is unit-testable without the SDK or a live desktop. `server.ts` wires
11
+ * this catalog into an actual MCP server transport.
12
+ */
13
+ import type { ComputerUseResult } from "../types.js";
14
+ /** Minimal surface of ComputerUseService that the MCP dispatch needs. */
15
+ export interface ComputerUseCommandRunner {
16
+ executeCommand(command: string, parameters?: Record<string, unknown>): Promise<ComputerUseResult>;
17
+ }
18
+ /** JSON-schema-ish property descriptor for an MCP tool input. */
19
+ export interface McpToolProperty {
20
+ type: "string" | "number" | "boolean" | "array" | "object";
21
+ description: string;
22
+ items?: {
23
+ type: string;
24
+ };
25
+ }
26
+ export interface ComputerUseMcpTool {
27
+ /** MCP tool name exposed to clients (cua-style, snake_case). */
28
+ name: string;
29
+ description: string;
30
+ /** ComputerUseService.executeCommand command this tool dispatches to. */
31
+ command: string;
32
+ /** Whether the verb mutates the host (→ goes through the approval manager). */
33
+ destructive: boolean;
34
+ /** Declared inputs (for the MCP inputSchema). */
35
+ properties: Record<string, McpToolProperty>;
36
+ required?: string[];
37
+ }
38
+ /**
39
+ * The catalog. Every `command` here is a real desktop verb accepted by
40
+ * `ComputerUseService.executeCommand` (kept in sync with that switch + the
41
+ * parity matrix). Read-only verbs (`destructive: false`) auto-approve under
42
+ * smart_approve; the rest are approval-gated.
43
+ */
44
+ export declare const COMPUTERUSE_MCP_TOOLS: readonly ComputerUseMcpTool[];
45
+ /** Look up a tool by its MCP name. */
46
+ export declare function findComputerUseMcpTool(name: string): ComputerUseMcpTool | undefined;
47
+ /**
48
+ * Dispatch an MCP tool call to the computer-use service. Pure routing:
49
+ * resolves the tool → `executeCommand(tool.command, args)`. Throws on an unknown
50
+ * tool name. The service applies the approval policy + returns a DTO.
51
+ */
52
+ export declare function dispatchComputerUseMcpTool(runner: ComputerUseCommandRunner, toolName: string, args?: Record<string, unknown>): Promise<ComputerUseResult>;
53
+ //# sourceMappingURL=tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/mcp/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,yEAAyE;AACzE,MAAM,WAAW,wBAAwB;IACvC,cAAc,CACZ,OAAO,EAAE,MAAM,EACf,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACnC,OAAO,CAAC,iBAAiB,CAAC,CAAC;CAC/B;AAED,iEAAiE;AACjE,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC;IAC3D,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CAC1B;AAED,MAAM,WAAW,kBAAkB;IACjC,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,yEAAyE;IACzE,OAAO,EAAE,MAAM,CAAC;IAChB,+EAA+E;IAC/E,WAAW,EAAE,OAAO,CAAC;IACrB,iDAAiD;IACjD,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAC5C,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAYD;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,EAAE,SAAS,kBAAkB,EAoMrD,CAAC;AAEX,sCAAsC;AACtC,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,GACX,kBAAkB,GAAG,SAAS,CAEhC;AAED;;;;GAIG;AACH,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,wBAAwB,EAChC,QAAQ,EAAE,MAAM,EAChB,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GACjC,OAAO,CAAC,iBAAiB,CAAC,CAM5B"}
@@ -0,0 +1,263 @@
1
+ /**
2
+ * Android computer-use bridge — Capacitor JS↔Kotlin contract.
3
+ *
4
+ * Android allows more cross-app surface than iOS, but the consumer-app
5
+ * path still requires explicit permissions:
6
+ *
7
+ * 1. AccessibilityService (BIND_ACCESSIBILITY_SERVICE) — walk and drive
8
+ * the active window's view hierarchy, dispatch gestures.
9
+ * 2. MediaProjection — user-consent screen capture at 1–2 Hz.
10
+ * 3. UsageStatsManager (PACKAGE_USAGE_STATS) — app history; manually
11
+ * granted in Settings > Usage Access.
12
+ * 4. Camera2 — CAMERA permission; service-friendly (no Activity).
13
+ * 5. onTrimMemory → MemoryArbiter pressure (ComponentCallbacks2).
14
+ *
15
+ * The AOSP system-app path (SurfaceControl.captureDisplay, injectInputEvent,
16
+ * IActivityManager) is documented separately in AOSP_SYSTEM_APP.md but is
17
+ * never compiled into the consumer build.
18
+ *
19
+ * The Kotlin counterpart is:
20
+ * plugin-capacitor-bridge/android/src/main/java/ai/elizaos/computeruse/ComputerUsePlugin.kt
21
+ *
22
+ * The Capacitor plugin jsName is "ComputerUse" — same as iOS. Both platforms
23
+ * resolve through `Capacitor.Plugins.ComputerUse` so the planner layer can
24
+ * dispatch without a platform branch at the call site.
25
+ *
26
+ * MARK: - Contract
27
+ * Every method in AndroidComputerUseBridge below has a matching @PluginMethod
28
+ * in ComputerUsePlugin.kt. Keep them in lock-step or the bridge silently drifts.
29
+ */
30
+ /**
31
+ * Standard result envelope mirroring IosBridgeResult<T> from ios-bridge.ts.
32
+ * `ok=true` means the native side completed and `data` is shaped per-method.
33
+ * `ok=false` carries a machine-readable `code` and human-readable `message`.
34
+ */
35
+ export type AndroidBridgeResult<T> = {
36
+ readonly ok: true;
37
+ readonly data: T;
38
+ } | {
39
+ readonly ok: false;
40
+ readonly code: AndroidBridgeErrorCode;
41
+ readonly message: string;
42
+ };
43
+ export type AndroidBridgeErrorCode = "unsupported_platform" | "permission_denied" | "permission_pending" | "accessibility_unavailable" | "capture_unavailable" | "camera_not_open" | "invalid_argument" | "internal_error";
44
+ export interface MediaProjectionStartOptions {
45
+ /** Capture frame rate, Hz. Default 1. */
46
+ readonly fps?: number;
47
+ }
48
+ export interface MediaProjectionHandle {
49
+ readonly running: boolean;
50
+ }
51
+ export interface CapturedScreenFrame {
52
+ /** Base64-encoded JPEG at quality 75. */
53
+ readonly jpegBase64: string;
54
+ readonly width: number;
55
+ readonly height: number;
56
+ /** Wall-clock ms when the frame was committed to the ImageReader. */
57
+ readonly timestampMs: number;
58
+ }
59
+ /**
60
+ * Compact node shape matching WS6 Scene.ax:
61
+ * [{ id, role, label, bbox, actions }]
62
+ *
63
+ * `id` — integer cast to string; stable within a single snapshot,
64
+ * not across snapshots (AccessibilityNodeInfo has no stable ids).
65
+ * `role` — Android class name, e.g. "android.widget.Button".
66
+ * `label` — contentDescription or text, whichever is non-null.
67
+ * `bbox` — screen-coordinates rectangle {x, y, w, h}.
68
+ * `actions` — subset of {"click","longClick","scroll","type","focus"}.
69
+ */
70
+ export interface AndroidAxNode {
71
+ readonly id: string;
72
+ readonly role: string;
73
+ readonly label: string | null;
74
+ readonly bbox: {
75
+ readonly x: number;
76
+ readonly y: number;
77
+ readonly w: number;
78
+ readonly h: number;
79
+ };
80
+ readonly actions: readonly string[];
81
+ }
82
+ export interface AccessibilityTreeResult {
83
+ /** JSON-serialized AndroidAxNode[]. Parsed by the JS caller. */
84
+ readonly nodes: string;
85
+ }
86
+ export type GestureType = "tap" | "swipe";
87
+ export interface TapGestureArgs {
88
+ readonly type: "tap";
89
+ readonly x: number;
90
+ readonly y: number;
91
+ }
92
+ export interface SwipeGestureArgs {
93
+ readonly type: "swipe";
94
+ readonly x: number;
95
+ readonly y: number;
96
+ readonly x2: number;
97
+ readonly y2: number;
98
+ /** Swipe duration in ms. Minimum 50ms enforced on native side. Default 300. */
99
+ readonly durationMs?: number;
100
+ }
101
+ export type GestureArgs = TapGestureArgs | SwipeGestureArgs;
102
+ export interface GestureResult {
103
+ readonly ok: boolean;
104
+ }
105
+ export type GlobalAction = "back" | "home" | "recents" | "notifications";
106
+ export interface GlobalActionResult {
107
+ readonly ok: boolean;
108
+ }
109
+ export interface SetTextArgs {
110
+ readonly text: string;
111
+ }
112
+ export interface SetTextResult {
113
+ readonly ok: boolean;
114
+ }
115
+ /**
116
+ * Mirrors WS6's `enumerateApps()` interface.
117
+ * `isForeground` is true when the package appears as the last
118
+ * MOVE_TO_FOREGROUND event in the past 5 minutes.
119
+ */
120
+ export interface AppUsageEntry {
121
+ readonly packageName: string;
122
+ readonly label: string;
123
+ readonly lastUsedMs: number;
124
+ readonly totalForegroundMs: number;
125
+ readonly isForeground: boolean;
126
+ }
127
+ export interface EnumerateAppsResult {
128
+ /** JSON-serialized AppUsageEntry[]. Parsed by the JS caller. */
129
+ readonly apps: string;
130
+ }
131
+ export type AndroidPressureLevel = "nominal" | "low" | "critical";
132
+ /**
133
+ * Snapshot of the Android process memory state.
134
+ * Aligns with IPressureSignal from ios-bridge.ts (source = "android-low-memory").
135
+ */
136
+ export interface AndroidMemoryPressureSnapshot {
137
+ readonly level: AndroidPressureLevel;
138
+ readonly freeMb: number;
139
+ readonly maxMb: number;
140
+ readonly usedMb: number;
141
+ readonly source: "android-runtime";
142
+ }
143
+ export interface AndroidCameraOpenOptions {
144
+ readonly cameraId?: string;
145
+ readonly width?: number;
146
+ readonly height?: number;
147
+ readonly fps?: number;
148
+ }
149
+ export interface AndroidCameraOpenResult {
150
+ /** JSON-serialized CameraEntry[]. */
151
+ readonly cameras: string;
152
+ }
153
+ export interface AndroidCameraEntry {
154
+ readonly id: string;
155
+ readonly label: string;
156
+ readonly position: "back" | "front" | "external";
157
+ }
158
+ export interface AndroidCameraFrameResult {
159
+ /** Base64-encoded JPEG. */
160
+ readonly jpegBase64: string;
161
+ }
162
+ export interface AndroidBridgeProbe {
163
+ readonly platform: "android";
164
+ /** e.g. "14" — Build.VERSION.RELEASE. */
165
+ readonly osVersion: string;
166
+ /** SDK integer, e.g. 34. */
167
+ readonly sdkInt: number;
168
+ readonly capabilities: {
169
+ readonly mediaProjection: boolean;
170
+ readonly accessibilityService: boolean;
171
+ readonly usageStats: boolean;
172
+ readonly camera: boolean;
173
+ readonly aospPrivileged: boolean;
174
+ };
175
+ }
176
+ /**
177
+ * Strict TS interface for the Capacitor Android plugin. Every method returns
178
+ * AndroidBridgeResult<T> — Kotlin never throws across the bridge.
179
+ *
180
+ * The Capacitor plugin name on the Kotlin side is "ComputerUse". The jsName
181
+ * resolves to `Capacitor.Plugins.ComputerUse` on Android and iOS alike.
182
+ */
183
+ export interface AndroidComputerUseBridge {
184
+ readonly probe: () => Promise<AndroidBridgeResult<AndroidBridgeProbe>>;
185
+ /** Triggers the system screen-capture consent dialog, then starts the service. */
186
+ readonly startMediaProjection: (options?: MediaProjectionStartOptions) => Promise<AndroidBridgeResult<MediaProjectionHandle>>;
187
+ readonly stopMediaProjection: () => Promise<AndroidBridgeResult<{
188
+ readonly stopped: boolean;
189
+ }>>;
190
+ /** Drain the latest frame from the ImageReader ring-buffer. */
191
+ readonly captureFrame: () => Promise<AndroidBridgeResult<CapturedScreenFrame>>;
192
+ /** Walk getRootInActiveWindow() and return compact JSON node array. */
193
+ readonly getAccessibilityTree: () => Promise<AndroidBridgeResult<AccessibilityTreeResult>>;
194
+ readonly dispatchGesture: (args: GestureArgs) => Promise<AndroidBridgeResult<GestureResult>>;
195
+ readonly performGlobalAction: (args: {
196
+ readonly action: GlobalAction;
197
+ }) => Promise<AndroidBridgeResult<GlobalActionResult>>;
198
+ readonly setText: (args: SetTextArgs) => Promise<AndroidBridgeResult<SetTextResult>>;
199
+ readonly enumerateApps: () => Promise<AndroidBridgeResult<EnumerateAppsResult>>;
200
+ readonly getMemoryPressureSnapshot: () => Promise<AndroidBridgeResult<AndroidMemoryPressureSnapshot>>;
201
+ /**
202
+ * Called from the onTrimMemory ComponentCallbacks2 listener to propagate
203
+ * the pressure level to the JS-side WS1 MemoryArbiter.
204
+ *
205
+ * Call chain:
206
+ * Kotlin ComponentCallbacks2.onTrimMemory(level)
207
+ * → notifyListeners("memoryPressure", { level, freeMb })
208
+ * → JS capacitorPressureSource.dispatch(level, freeMb)
209
+ * → MemoryArbiter pressure listener
210
+ */
211
+ readonly dispatchMemoryPressure: (args: {
212
+ readonly level: AndroidPressureLevel;
213
+ readonly freeMb?: number;
214
+ }) => Promise<AndroidBridgeResult<{
215
+ readonly ok: boolean;
216
+ }>>;
217
+ readonly startCamera: (options?: AndroidCameraOpenOptions) => Promise<AndroidBridgeResult<AndroidCameraOpenResult>>;
218
+ readonly stopCamera: () => Promise<AndroidBridgeResult<{
219
+ readonly ok: boolean;
220
+ }>>;
221
+ readonly captureFrameCamera: () => Promise<AndroidBridgeResult<AndroidCameraFrameResult>>;
222
+ }
223
+ /** Capacitor plugin jsName — resolves to `Capacitor.Plugins.ComputerUse` on both platforms. */
224
+ export declare const ANDROID_BRIDGE_JS_NAME: "ComputerUse";
225
+ /** Default MediaProjection frame rate. Higher values drain battery significantly. */
226
+ export declare const ANDROID_DEFAULT_FPS: 1;
227
+ /** Default Camera2 capture resolution. */
228
+ export declare const ANDROID_DEFAULT_CAMERA_WIDTH: 640;
229
+ export declare const ANDROID_DEFAULT_CAMERA_HEIGHT: 480;
230
+ /**
231
+ * Result of `featureCheck()`. Callers use this to decide whether to invoke
232
+ * any other method on the bridge — when `supported` is false they should
233
+ * fall back to OCR / external orchestration instead of letting the call throw.
234
+ */
235
+ export interface AndroidFeatureCheckResult {
236
+ readonly supported: boolean;
237
+ readonly reason?: string;
238
+ }
239
+ /**
240
+ * Runtime feature-detect for the Android bridge. Synchronous and
241
+ * side-effect-free so it can run during planner setup. Returns
242
+ * `{supported:false}` whenever the JS↔Kotlin bridge cannot be reached:
243
+ *
244
+ * - Running on a non-Android host (desktop, iOS, browser).
245
+ * - Capacitor is not initialized (no `globalThis.Capacitor`).
246
+ * - The Kotlin `ComputerUsePlugin` is not registered.
247
+ *
248
+ * This does NOT call `bridge.probe()` — that is async and may surface a
249
+ * permission dialog. Callers that need the per-capability matrix should
250
+ * `await bridge.probe()` after `featureCheck().supported === true`.
251
+ *
252
+ * PARITY: untested on hardware — the lookup path mirrors what the Capacitor
253
+ * runtime does, but has not been validated against a real Android build.
254
+ */
255
+ export declare function featureCheck(): AndroidFeatureCheckResult;
256
+ /**
257
+ * Resolve the live bridge handle, or `null` when unavailable. Pairs with
258
+ * `featureCheck()` for callers that want a typed handle in one step.
259
+ *
260
+ * PARITY: untested on hardware — feature-detect at runtime.
261
+ */
262
+ export declare function getAndroidBridge(): AndroidComputerUseBridge | null;
263
+ //# sourceMappingURL=android-bridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"android-bridge.d.ts","sourceRoot":"","sources":["../../src/mobile/android-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAIH;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAC7B;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAA;CAAE,GACvC;IACE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IACnB,QAAQ,CAAC,IAAI,EAAE,sBAAsB,CAAC;IACtC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEN,MAAM,MAAM,sBAAsB,GAC9B,sBAAsB,GACtB,mBAAmB,GACnB,oBAAoB,GACpB,2BAA2B,GAC3B,qBAAqB,GACrB,iBAAiB,GACjB,kBAAkB,GAClB,gBAAgB,CAAC;AAIrB,MAAM,WAAW,2BAA2B;IAC1C,yCAAyC;IACzC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WA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,OAAO,CAAC,mBAAmB,CAAC;QAAE,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC,CAAC;IAG7D,QAAQ,CAAC,WAAW,EAAE,CACpB,OAAO,CAAC,EAAE,wBAAwB,KAC/B,OAAO,CAAC,mBAAmB,CAAC,uBAAuB,CAAC,CAAC,CAAC;IAC3D,QAAQ,CAAC,UAAU,EAAE,MAAM,OAAO,CAChC,mBAAmB,CAAC;QAAE,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAA;KAAE,CAAC,CAC9C,CAAC;IACF,QAAQ,CAAC,kBAAkB,EAAE,MAAM,OAAO,CACxC,mBAAmB,CAAC,wBAAwB,CAAC,CAC9C,CAAC;CACH;AAID,+FAA+F;AAC/F,eAAO,MAAM,sBAAsB,EAAG,aAAsB,CAAC;AAE7D,qFAAqF;AACrF,eAAO,MAAM,mBAAmB,EAAG,CAAU,CAAC;AAE9C,0CAA0C;AAC1C,eAAO,MAAM,4BAA4B,EAAG,GAAY,CAAC;AACzD,eAAO,MAAM,6BAA6B,EAAG,GAAY,CAAC;AAI1D;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAYD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,IAAI,yBAAyB,CAgBxD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,IAAI,wBAAwB,GAAG,IAAI,CAKlE"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * WS8 — Normalize Android accessibility-tree output into the WS6 `Scene.ax`
3
+ * shape that the WS7 cascade consumes.
4
+ *
5
+ * The Kotlin side (`ElizaAccessibilityService.getAccessibilityTreeJson()`)
6
+ * emits JSON with this shape per node:
7
+ *
8
+ * { id: string, role: string, label: string|null,
9
+ * bbox: { x, y, w, h },
10
+ * actions: string[] }
11
+ *
12
+ * WS6's `SceneAxNode` (see `scene/scene-types.ts`) is:
13
+ *
14
+ * { id: string, role: string, label?: string,
15
+ * bbox: [x, y, w, h],
16
+ * actions: string[], displayId: number }
17
+ *
18
+ * The only real differences are bbox object↔tuple and the addition of a
19
+ * `displayId` (Android phones always run as a single logical display from the
20
+ * scene-builder's perspective; multi-display Android is out of scope).
21
+ *
22
+ * `androidAxIdToSceneId(id, displayId)` rewrites the Kotlin-side integer id
23
+ * into the cascade's stable `a<displayId>-<seq>` form so `resolveReference`
24
+ * picks it up exactly like a desktop AX node.
25
+ */
26
+ import type { SceneAxNode } from "../scene/scene-types.js";
27
+ import type { AndroidAxNode } from "./android-bridge.js";
28
+ /** Stable scene-ax id for an Android node. Matches the desktop format. */
29
+ export declare function androidAxIdToSceneId(rawId: string, displayId: number): string;
30
+ /**
31
+ * Parse the JSON payload emitted by `ElizaAccessibilityService.getAccessibilityTreeJson()`
32
+ * and normalize it into `SceneAxNode[]`. Invalid entries are dropped, not
33
+ * thrown — the cascade prefers a partial tree to an unrecoverable error
34
+ * when (e.g.) one rogue node is missing a field.
35
+ *
36
+ * Throws only when the top-level payload is not a JSON array. The Kotlin
37
+ * side guarantees array output (or `"[]"` on internal failure) so this is
38
+ * a planner-side contract check.
39
+ */
40
+ export declare function parseAndroidAxTree(nodesJson: string, displayId: number): SceneAxNode[];
41
+ /**
42
+ * Normalize a single AndroidAxNode-shaped value into SceneAxNode. Returns
43
+ * null when the value is missing required fields — the caller decides
44
+ * whether to surface the partial parse.
45
+ */
46
+ export declare function normalizeAndroidAxNode(raw: unknown, displayId: number): SceneAxNode | null;
47
+ /**
48
+ * Inverse helper — produce a Kotlin-shaped `AndroidAxNode` from a `SceneAxNode`.
49
+ * Primarily for tests and trajectory replay.
50
+ */
51
+ export declare function sceneAxToAndroidAxNode(node: SceneAxNode): AndroidAxNode;
52
+ //# sourceMappingURL=android-scene.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"android-scene.d.ts","sourceRoot":"","sources":["../../src/mobile/android-scene.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,0EAA0E;AAC1E,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAE7E;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAChB,WAAW,EAAE,CAoBf;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,OAAO,EACZ,SAAS,EAAE,MAAM,GAChB,WAAW,GAAG,IAAI,CA+BpB;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,WAAW,GAAG,aAAa,CAavE"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * WS8 — Trajectory event emission for Android actions.
3
+ *
4
+ * The WS7 `use-computer-agent` action emits `computeruse.agent.step`
5
+ * structured-log entries for every Brain→dispatch step. We re-use the same
6
+ * event name on Android so the eliza-1 trajectory logger sees a uniform
7
+ * shape across platforms — the only delta is a `platform: "android"` tag
8
+ * the logger can use for per-platform breakdowns.
9
+ *
10
+ * Two flavors of event are surfaced from the Android surface:
11
+ *
12
+ * - `computeruse.agent.step` — emitted by the agent loop (already in
13
+ * use-computer-agent.ts). On Android we
14
+ * add `platform: "android"` to the
15
+ * payload via this helper.
16
+ * - `computeruse.android.action` — emitted for direct
17
+ * `dispatchGesture` / `performGlobalAction`
18
+ * invocations not going through the agent
19
+ * loop (e.g. when the planner picks a
20
+ * lower-level action explicitly).
21
+ *
22
+ * We do not depend on `@elizaos/plugin-trajectory-logger` here — like the
23
+ * desktop side, we publish via `logger.info({ evt, ... })` and rely on the
24
+ * log-capture pipeline.
25
+ */
26
+ export type AndroidActionKind = "tap" | "swipe" | "back" | "home" | "recents" | "notifications" | "capture" | "screenshot";
27
+ export interface AndroidTrajectoryActionEvent {
28
+ kind: AndroidActionKind;
29
+ success: boolean;
30
+ /** Bridge error code (only on failure). */
31
+ errorCode?: string;
32
+ /** Free-form error message; trimmed for log hygiene. */
33
+ errorMessage?: string;
34
+ /** Display-local pixel coords for tap/swipe (optional). */
35
+ x?: number;
36
+ y?: number;
37
+ x2?: number;
38
+ y2?: number;
39
+ durationMs?: number;
40
+ /** Stable AX/OCR id the action targeted, when known. */
41
+ ref?: string;
42
+ /** Free-form rationale from the planner. */
43
+ rationale?: string;
44
+ }
45
+ export interface AndroidTrajectoryStepEvent {
46
+ step: number;
47
+ goal: string;
48
+ actionKind: string;
49
+ displayId: number;
50
+ rois: number;
51
+ success: boolean;
52
+ error?: string;
53
+ rationale: string;
54
+ }
55
+ /**
56
+ * Emit a `computeruse.android.action` log entry. Returns the payload so
57
+ * callers can also forward it elsewhere (e.g. in-memory replay buffer).
58
+ */
59
+ export declare function emitAndroidAction(event: AndroidTrajectoryActionEvent): AndroidTrajectoryActionEvent;
60
+ /**
61
+ * Emit a `computeruse.agent.step` log entry tagged with `platform:"android"`.
62
+ * The shape mirrors what the desktop loop emits in `use-computer-agent.ts`
63
+ * so the trajectory logger can union the two streams.
64
+ */
65
+ export declare function emitAndroidAgentStep(event: AndroidTrajectoryStepEvent): AndroidTrajectoryStepEvent;
66
+ //# sourceMappingURL=android-trajectory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"android-trajectory.d.ts","sourceRoot":"","sources":["../../src/mobile/android-trajectory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAIH,MAAM,MAAM,iBAAiB,GACzB,KAAK,GACL,OAAO,GACP,MAAM,GACN,MAAM,GACN,SAAS,GACT,eAAe,GACf,SAAS,GACT,YAAY,CAAC;AAEjB,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,iBAAiB,CAAC;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,2CAA2C;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wDAAwD;IACxD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,2DAA2D;IAC3D,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wDAAwD;IACxD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AAID;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,4BAA4B,GAClC,4BAA4B,CAc9B;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,0BAA0B,GAChC,0BAA0B,CAiB5B"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Mobile computer-use surface — iOS and Android.
3
+ *
4
+ * Apple does not let third-party apps drive other apps. The exports here are
5
+ * the small set of capabilities that *are* possible on iOS, plus the
6
+ * AppIntent registry, the OCR provider chain, and the WS1 pressure-signal
7
+ * contract. See `docs/IOS_CONSTRAINTS.md` for what is and isn't on the table.
8
+ *
9
+ * Android surfaces (WS8): AccessibilityService, MediaProjection, UsageStats,
10
+ * Camera2, onTrimMemory pressure. See `docs/ANDROID_CONSTRAINTS.md`.
11
+ */
12
+ export type { AndroidAxNode, AndroidBridgeErrorCode, AndroidBridgeProbe, AndroidBridgeResult, AndroidCameraEntry, AndroidCameraFrameResult, AndroidCameraOpenOptions, AndroidCameraOpenResult, AndroidComputerUseBridge, AndroidFeatureCheckResult, AndroidMemoryPressureSnapshot, AndroidPressureLevel, AppUsageEntry, CapturedScreenFrame, EnumerateAppsResult, GestureArgs, GlobalAction, MediaProjectionHandle, MediaProjectionStartOptions, SwipeGestureArgs, TapGestureArgs, } from "./android-bridge.js";
13
+ export { ANDROID_BRIDGE_JS_NAME, ANDROID_DEFAULT_FPS, featureCheck as androidFeatureCheck, getAndroidBridge, } from "./android-bridge.js";
14
+ export { findIosAppIntent, findIosAppIntentsForBundle, IOS_APP_INTENT_BUNDLE_IDS, IOS_APP_INTENT_REGISTRY, listIosAppIntents, } from "./ios-app-intent-registry.js";
15
+ export type { AccessibilitySnapshotNode, AccessibilitySnapshotResult, BroadcastHandshakeResult, FoundationModelOptions, FoundationModelResult, IntentInvocationRequest, IntentInvocationResult, IntentParameterSpec, IntentParameterValue, IntentSpec, IosBridgeErrorCode, IosBridgeProbe, IosBridgeResult, IosComputerUseBridge, IosFeatureCheckResult, IPressureSignal, MemoryPressureSample, ReplayKitForegroundFrame, ReplayKitForegroundHandle, ReplayKitForegroundOptions, VisionOcrLine, VisionOcrOptions, VisionOcrResult, } from "./ios-bridge.js";
16
+ export { featureCheck as iosFeatureCheck, getIosBridge, IOS_APP_GROUP_ID, IOS_BRIDGE_JS_NAME, REPLAYKIT_FOREGROUND_MAX_BUFFER, REPLAYKIT_FOREGROUND_MAX_SESSION_SEC, } from "./ios-bridge.js";
17
+ export { IOS_LOGICAL_DISPLAY_ID, IosComputerInterface, type IosComputerInterfaceDeps, makeIosComputerInterface, } from "./ios-computer-interface.js";
18
+ export { _resetOcrProvidersForTests, createIosVisionOcrProvider, listOcrProviders, type OcrInput, type OcrLine, type OcrProvider, type OcrRecognizeOptions, type OcrResult, registerOcrProvider, selectOcrProvider, unregisterOcrProvider, } from "./ocr-provider.js";
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mobile/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,YAAY,EACV,aAAa,EACb,sBAAsB,EACtB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,wBAAwB,EACxB,wBAAwB,EACxB,uBAAuB,EACvB,wBAAwB,EACxB,yBAAyB,EACzB,6BAA6B,EAC7B,oBAAoB,EACpB,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACnB,WAAW,EACX,YAAY,EACZ,qBAAqB,EACrB,2BAA2B,EAC3B,gBAAgB,EAChB,cAAc,GACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,YAAY,IAAI,mBAAmB,EACnC,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,gBAAgB,EAChB,0BAA0B,EAC1B,yBAAyB,EACzB,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,8BAA8B,CAAC;AACtC,YAAY,EACV,yBAAyB,EACzB,2BAA2B,EAC3B,wBAAwB,EACxB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,qBAAqB,EACrB,eAAe,EACf,oBAAoB,EACpB,wBAAwB,EACxB,yBAAyB,EACzB,0BAA0B,EAC1B,aAAa,EACb,gBAAgB,EAChB,eAAe,GAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,YAAY,IAAI,eAAe,EAC/B,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EAClB,+BAA+B,EAC/B,oCAAoC,GACrC,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,KAAK,wBAAwB,EAC7B,wBAAwB,GACzB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,0BAA0B,EAC1B,0BAA0B,EAC1B,gBAAgB,EAChB,KAAK,QAAQ,EACb,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACxB,KAAK,SAAS,EACd,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * AppIntent registry — per-app inventory of the intents we know about
3
+ * statically. Every entry is something Apple has either shipped as a
4
+ * documented system intent or a Shortcuts action with a stable identifier.
5
+ *
6
+ * The Swift bridge calls `appIntentList({ bundleIds })` to discover what is
7
+ * actually donated on the device at runtime. This registry is the planner's
8
+ * a-priori catalog: it lets the agent reason about Mail/Notes/etc. before
9
+ * the user has ever opened those apps.
10
+ *
11
+ * Sources for each entry are linked in a comment block above the entry; do
12
+ * not invent intents that Apple has not documented.
13
+ */
14
+ import type { IntentSpec } from "./ios-bridge.js";
15
+ export declare const IOS_APP_INTENT_REGISTRY: Readonly<Record<string, readonly IntentSpec[]>>;
16
+ export declare const IOS_APP_INTENT_BUNDLE_IDS: readonly string[];
17
+ export declare function listIosAppIntents(): readonly IntentSpec[];
18
+ export declare function findIosAppIntent(intentId: string): IntentSpec | undefined;
19
+ export declare function findIosAppIntentsForBundle(bundleId: string): readonly IntentSpec[];
20
+ //# sourceMappingURL=ios-app-intent-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ios-app-intent-registry.d.ts","sourceRoot":"","sources":["../../src/mobile/ios-app-intent-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAuB,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAwPvE,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAC5C,MAAM,CAAC,MAAM,EAAE,SAAS,UAAU,EAAE,CAAC,CASrC,CAAC;AAEH,eAAO,MAAM,yBAAyB,EAAE,SAAS,MAAM,EAEtD,CAAC;AAEF,wBAAgB,iBAAiB,IAAI,SAAS,UAAU,EAAE,CAEzD;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAEzE;AAED,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,MAAM,GACf,SAAS,UAAU,EAAE,CAEvB"}