@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,359 @@
1
+ /**
2
+ * iOS computer-use bridge — Capacitor JS↔Swift contract.
3
+ *
4
+ * iOS does not let third-party apps drive other apps. The only surfaces
5
+ * available to us are:
6
+ *
7
+ * 1. ReplayKit foreground capture — own-app screen frames
8
+ * 2. ReplayKit broadcast extension — system-wide capture (~50MB ceiling,
9
+ * iOS 26/26.1 beta regression noted)
10
+ * 3. Apple Vision OCR — VNRecognizeTextRequest, on-device
11
+ * 4. App Intents — invoke other apps' Shortcuts-style
12
+ * intents (the only sanctioned UI driver)
13
+ * 5. UIAccessibility (own app only)
14
+ * 6. Apple Foundation Models (iOS 26) — opportunistic on-device LLM
15
+ *
16
+ * What is NOT exposed (and never will be on stock iOS):
17
+ * - Cross-app input or pixel scraping
18
+ * - Process listing of other running apps
19
+ * - Background inference past ~30s outside `BGProcessingTask`
20
+ *
21
+ * See `eliza/plugins/plugin-computeruse/docs/IOS_CONSTRAINTS.md` for the
22
+ * honest scope discussion and per-method validation checklist.
23
+ *
24
+ * The Swift counterpart lives at
25
+ * `apps/app/ios/App/App/ComputerUseBridge.swift`. The `// MARK: - Contract`
26
+ * block in that file mirrors the signatures below verbatim — keep them in
27
+ * lock-step or the bridge silently drifts.
28
+ */
29
+ /**
30
+ * Standard result envelope for every bridge call.
31
+ *
32
+ * `ok=true` means the native side completed successfully and `data` is shaped
33
+ * to the per-method type. `ok=false` carries a `code` (machine-readable) and
34
+ * `message` (human-readable). No fallbacks, no silent defaults — if the call
35
+ * failed, the JS caller sees it.
36
+ */
37
+ export type IosBridgeResult<T> = {
38
+ ok: true;
39
+ data: T;
40
+ } | {
41
+ ok: false;
42
+ code: IosBridgeErrorCode;
43
+ message: string;
44
+ };
45
+ export type IosBridgeErrorCode = "unsupported_platform" | "permission_denied" | "permission_pending" | "extension_unavailable" | "extension_died" | "memory_pressure" | "intent_not_found" | "intent_invocation_failed" | "vision_no_text" | "foundation_model_unavailable" | "internal_error";
46
+ /**
47
+ * Configures `RPScreenRecorder.shared().startCapture(handler:completionHandler:)`.
48
+ *
49
+ * `frameRate` caps how often the Swift side forwards frames to JS — Apple
50
+ * delivers at display refresh rate, we throttle. `maxDurationSec` is a
51
+ * hard upper bound; anything past 30s requires `BGProcessingTask` and is
52
+ * not supported by this method.
53
+ */
54
+ export interface ReplayKitForegroundOptions {
55
+ /** Hard cap, default 1. Apple delivers at display refresh; we drop frames. */
56
+ readonly frameRate?: number;
57
+ /** Max session duration in seconds, default 30. Capped at 30 server-side. */
58
+ readonly maxDurationSec?: number;
59
+ /** Include audio sample buffers (mic). Default false. */
60
+ readonly includeAudio?: boolean;
61
+ }
62
+ export interface ReplayKitForegroundFrame {
63
+ /** Monotonic capture timestamp from CMSampleBuffer presentation time, ns. */
64
+ readonly timestampNs: number;
65
+ /** Pixel width in image-buffer coordinates. */
66
+ readonly width: number;
67
+ /** Pixel height. */
68
+ readonly height: number;
69
+ /** Base64-encoded JPEG of the frame at quality 0.7. */
70
+ readonly jpegBase64: string;
71
+ }
72
+ export interface ReplayKitForegroundHandle {
73
+ /** Opaque session id; pass to `replayKitForegroundStop`. */
74
+ readonly sessionId: string;
75
+ /** Echoed effective options after server-side clamping. */
76
+ readonly effective: Required<ReplayKitForegroundOptions>;
77
+ }
78
+ /**
79
+ * Handshake with the broadcast extension. Returns whether the extension is
80
+ * registered, the App Group container path used to stream frames, and a
81
+ * pre-flight memory headroom check.
82
+ *
83
+ * The extension itself runs in a separate process with a ~50MB ceiling. The
84
+ * main app cannot start the extension programmatically — the user must tap
85
+ * the system share-sheet broadcast picker. This call only verifies the
86
+ * pipeline is wired and the App Group container is writable.
87
+ *
88
+ * iOS 26 / 26.1 beta regression: extensions are killed within ~3 seconds even
89
+ * when memory is well under the limit. The bridge surfaces this as
90
+ * `extension_died` with `details.regressionFB` referencing the Apple feedback
91
+ * id when known. The caller should fall back to foreground capture.
92
+ */
93
+ export interface BroadcastHandshakeResult {
94
+ /** True if the broadcast extension target is bundled with this build. */
95
+ readonly extensionInstalled: boolean;
96
+ /** App Group identifier (e.g. `group.com.elizaai.eliza`). */
97
+ readonly appGroupId: string;
98
+ /** Absolute path to the App Group container used for IPC frames. */
99
+ readonly sharedContainerPath: string;
100
+ /** Available memory in MB the extension would have at start time. */
101
+ readonly availableMemoryMb: number;
102
+ /** True if iOS reports an active broadcast session. */
103
+ readonly broadcastActive: boolean;
104
+ /** Last known iOS-26-beta regression status, if observed. */
105
+ readonly regression?: {
106
+ readonly observed: boolean;
107
+ readonly note: string;
108
+ };
109
+ }
110
+ export interface VisionOcrOptions {
111
+ /**
112
+ * ISO 639-1 language hints. Vision falls back to autodetect when omitted.
113
+ * Examples: ["en-US"], ["zh-Hans","en-US"].
114
+ */
115
+ readonly languages?: readonly string[];
116
+ /**
117
+ * "fast" uses a smaller model with lower latency (~80ms typical),
118
+ * "accurate" runs the higher-quality model (~250ms typical).
119
+ */
120
+ readonly recognitionLevel?: "fast" | "accurate";
121
+ /** Minimum text height as a fraction of image height. Default 0.0 (off). */
122
+ readonly minimumTextHeight?: number;
123
+ /**
124
+ * Whether to use language-correction post-pass. Default true on iOS 16+.
125
+ * Adds ~30ms but materially improves CJK and handwriting accuracy.
126
+ */
127
+ readonly usesLanguageCorrection?: boolean;
128
+ }
129
+ export interface VisionOcrLine {
130
+ readonly text: string;
131
+ readonly confidence: number;
132
+ /** Normalized 0..1 origin-bottom-left rect, matching VNRectangleObservation. */
133
+ readonly boundingBox: {
134
+ readonly x: number;
135
+ readonly y: number;
136
+ readonly width: number;
137
+ readonly height: number;
138
+ };
139
+ }
140
+ export interface VisionOcrResult {
141
+ readonly lines: readonly VisionOcrLine[];
142
+ readonly fullText: string;
143
+ /** Total time spent in VNImageRequestHandler.perform, ms. */
144
+ readonly elapsedMs: number;
145
+ /** Languages Vision actually used. */
146
+ readonly languagesUsed: readonly string[];
147
+ }
148
+ /**
149
+ * Parameter spec for an AppIntent. Mirrors the subset of `IntentParameter`
150
+ * shapes we can portably express across iOS 16+ AppIntent and the legacy
151
+ * Intents framework. The Swift side validates and rejects extras.
152
+ */
153
+ export interface IntentParameterSpec {
154
+ readonly name: string;
155
+ readonly type: "string" | "number" | "boolean" | "date" | "url" | "enum";
156
+ readonly required: boolean;
157
+ /** Present when type === "enum". */
158
+ readonly enumValues?: readonly string[];
159
+ /** Human-readable description for the planner. */
160
+ readonly description?: string;
161
+ }
162
+ export interface IntentSpec {
163
+ /** Bundle id of the owning app, e.g. `com.apple.mobilenotes`. */
164
+ readonly bundleId: string;
165
+ /** Reverse-DNS intent identifier, e.g. `com.apple.mobilenotes.create-note`. */
166
+ readonly id: string;
167
+ /** Display name surfaced in the planner. */
168
+ readonly displayName: string;
169
+ /** Free-form summary used as planner context. */
170
+ readonly summary: string;
171
+ readonly parameters: readonly IntentParameterSpec[];
172
+ /**
173
+ * `donated` means the app has run at least once and donated this intent to
174
+ * Shortcuts on this device. `system` is a known-stable Apple intent that
175
+ * ships with the OS.
176
+ */
177
+ readonly source: "donated" | "system";
178
+ }
179
+ export interface IntentInvocationRequest {
180
+ readonly intentId: string;
181
+ readonly parameters: Readonly<Record<string, IntentParameterValue>>;
182
+ }
183
+ export type IntentParameterValue = string | number | boolean | {
184
+ readonly kind: "date";
185
+ readonly iso: string;
186
+ } | {
187
+ readonly kind: "url";
188
+ readonly url: string;
189
+ };
190
+ export interface IntentInvocationResult {
191
+ readonly intentId: string;
192
+ /** Whether iOS reported the intent ran end-to-end. */
193
+ readonly success: boolean;
194
+ /** Optional structured response payload from the intent. */
195
+ readonly response?: Readonly<Record<string, unknown>>;
196
+ /** Time from invocation to completion, ms. */
197
+ readonly elapsedMs: number;
198
+ }
199
+ export interface AccessibilitySnapshotNode {
200
+ readonly id: string;
201
+ readonly role: string;
202
+ readonly label?: string;
203
+ readonly value?: string;
204
+ readonly isFocused: boolean;
205
+ readonly children: readonly AccessibilitySnapshotNode[];
206
+ }
207
+ export interface AccessibilitySnapshotResult {
208
+ readonly screenName: string;
209
+ readonly tree: AccessibilitySnapshotNode;
210
+ readonly capturedAt: number;
211
+ }
212
+ export interface FoundationModelOptions {
213
+ /** Sampling temperature in [0,1]. Default 0.2 for deterministic-ish output. */
214
+ readonly temperature?: number;
215
+ /** Max generated tokens. Default 256. */
216
+ readonly maxTokens?: number;
217
+ /** System-style instruction; mapped to the iOS 26 system role. */
218
+ readonly instruction?: string;
219
+ }
220
+ export interface FoundationModelResult {
221
+ readonly text: string;
222
+ readonly tokensIn: number;
223
+ readonly tokensOut: number;
224
+ readonly elapsedMs: number;
225
+ }
226
+ /**
227
+ * Strict TS interface for the Capacitor plugin. Every method returns an
228
+ * `IosBridgeResult<T>` — Swift never throws across the bridge.
229
+ *
230
+ * The Capacitor plugin name on the Swift side is `ComputerUseBridge`. The
231
+ * `jsName` is `ComputerUse`. Method names below are the exact strings
232
+ * registered with `CAPPluginMethod`.
233
+ */
234
+ export interface IosComputerUseBridge {
235
+ /** `{ available: true }` if iOS 26+ with all four targets bundled. */
236
+ readonly probe: () => Promise<IosBridgeResult<IosBridgeProbe>>;
237
+ readonly replayKitForegroundStart: (options?: ReplayKitForegroundOptions) => Promise<IosBridgeResult<ReplayKitForegroundHandle>>;
238
+ /** Stops capture and discards the in-flight buffer. */
239
+ readonly replayKitForegroundStop: (args: {
240
+ readonly sessionId: string;
241
+ }) => Promise<IosBridgeResult<{
242
+ readonly sessionId: string;
243
+ }>>;
244
+ /**
245
+ * Drains the next batch of frames since last drain. Returns up to `max`
246
+ * frames. The Swift side ring-buffers at most 30 frames; older ones drop.
247
+ */
248
+ readonly replayKitForegroundDrain: (args: {
249
+ readonly sessionId: string;
250
+ readonly max?: number;
251
+ }) => Promise<IosBridgeResult<{
252
+ readonly frames: readonly ReplayKitForegroundFrame[];
253
+ }>>;
254
+ readonly broadcastExtensionHandshake: () => Promise<IosBridgeResult<BroadcastHandshakeResult>>;
255
+ readonly visionOcr: (args: {
256
+ /** Base64-encoded image (PNG or JPEG), no data URI prefix. */
257
+ readonly imageBase64: string;
258
+ readonly options?: VisionOcrOptions;
259
+ }) => Promise<IosBridgeResult<VisionOcrResult>>;
260
+ /** Lists intents iOS knows about for the given bundle ids (or all donated). */
261
+ readonly appIntentList: (args: {
262
+ readonly bundleIds?: readonly string[];
263
+ }) => Promise<IosBridgeResult<{
264
+ readonly intents: readonly IntentSpec[];
265
+ }>>;
266
+ readonly appIntentInvoke: (request: IntentInvocationRequest) => Promise<IosBridgeResult<IntentInvocationResult>>;
267
+ readonly accessibilitySnapshot: () => Promise<IosBridgeResult<AccessibilitySnapshotResult>>;
268
+ readonly foundationModelGenerate: (args: {
269
+ readonly prompt: string;
270
+ readonly options?: FoundationModelOptions;
271
+ }) => Promise<IosBridgeResult<FoundationModelResult>>;
272
+ /**
273
+ * One-shot read of `os_proc_available_memory()` plus a digest of recent
274
+ * `UIApplicationDidReceiveMemoryWarningNotification` events. The arbiter
275
+ * also subscribes to push events via `addPressureListener`.
276
+ */
277
+ readonly memoryPressureProbe: () => Promise<IosBridgeResult<MemoryPressureSample>>;
278
+ }
279
+ export interface IosBridgeProbe {
280
+ readonly platform: "ios";
281
+ /** e.g. "26.1" — `UIDevice.current.systemVersion`. */
282
+ readonly osVersion: string;
283
+ /** Capability matrix discovered at probe time. */
284
+ readonly capabilities: {
285
+ readonly replayKitForeground: boolean;
286
+ readonly broadcastExtension: boolean;
287
+ readonly visionOcr: boolean;
288
+ readonly appIntents: boolean;
289
+ readonly accessibilityRead: boolean;
290
+ readonly foundationModel: boolean;
291
+ };
292
+ }
293
+ /**
294
+ * Thin contract WS1 owns. The iOS bridge implements the producer side; WS1's
295
+ * arbiter consumes via this shape. Defined here so plugin-computeruse can
296
+ * publish samples without taking a runtime dep on the arbiter package.
297
+ */
298
+ export interface IPressureSignal {
299
+ readonly source: "ios-uikit" | "android-low-memory" | "host-os" | "synthetic";
300
+ readonly capturedAt: number;
301
+ /** 0 = nominal, 1 = critical. iOS warning notification → 0.7. */
302
+ readonly severity: number;
303
+ /** Available process memory in MB, when the source can report it. */
304
+ readonly availableMb?: number;
305
+ /** Free-form details for diagnostics. Never load-bearing for arbiter logic. */
306
+ readonly details?: Readonly<Record<string, string | number | boolean>>;
307
+ }
308
+ export interface MemoryPressureSample extends IPressureSignal {
309
+ readonly source: "ios-uikit";
310
+ /** Last received `UIApplicationDidReceiveMemoryWarningNotification`, ms epoch. */
311
+ readonly lastWarningAt?: number;
312
+ /** Available process memory in MB from `os_proc_available_memory`. */
313
+ readonly availableMb: number;
314
+ /** True if the broadcast extension is currently active. */
315
+ readonly broadcastActive: boolean;
316
+ }
317
+ /** App Group identifier — must match the canonical
318
+ * `eliza/packages/app-core/platforms/ios/App/App/App.entitlements`. */
319
+ export declare const IOS_APP_GROUP_ID: "group.ai.elizaos.app";
320
+ /** Capacitor plugin jsName (Capacitor injects `Capacitor.Plugins.ComputerUse`). */
321
+ export declare const IOS_BRIDGE_JS_NAME: "ComputerUse";
322
+ /** Maximum frames buffered server-side for ReplayKit foreground draining. */
323
+ export declare const REPLAYKIT_FOREGROUND_MAX_BUFFER: 30;
324
+ /** Hard cap on session duration; anything beyond requires BGProcessingTask. */
325
+ export declare const REPLAYKIT_FOREGROUND_MAX_SESSION_SEC: 30;
326
+ /**
327
+ * Result of `featureCheck()`. Callers use this to decide whether to invoke
328
+ * any other method on the bridge — when `supported` is false they should fall
329
+ * back to OCR / external orchestration instead of letting the call throw.
330
+ */
331
+ export interface IosFeatureCheckResult {
332
+ readonly supported: boolean;
333
+ readonly reason?: string;
334
+ }
335
+ /**
336
+ * Runtime feature-detect for the iOS bridge. Synchronous and side-effect-free
337
+ * so it can run during planner setup. Returns `{supported:false}` whenever
338
+ * the JS↔Swift bridge cannot be reached:
339
+ *
340
+ * - Running on a non-iOS host (desktop, Android, browser).
341
+ * - Capacitor is not initialized (no `globalThis.Capacitor`).
342
+ * - The Swift `ComputerUseBridge` plugin is not registered.
343
+ *
344
+ * This does NOT call `bridge.probe()` — that is async and may prompt the user
345
+ * for permissions. Callers that need the per-capability matrix should `await
346
+ * bridge.probe()` after `featureCheck().supported === true`.
347
+ *
348
+ * PARITY: untested on hardware — the lookup path mirrors what the Capacitor
349
+ * runtime does, but has not been validated against a real iOS build.
350
+ */
351
+ export declare function featureCheck(): IosFeatureCheckResult;
352
+ /**
353
+ * Resolve the live bridge handle, or `null` when unavailable. Pairs with
354
+ * `featureCheck()` for callers that want a typed handle in one step.
355
+ *
356
+ * PARITY: untested on hardware — feature-detect at runtime.
357
+ */
358
+ export declare function getIosBridge(): IosComputerUseBridge | null;
359
+ //# sourceMappingURL=ios-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qB,CAgBpD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,IAAI,oBAAoB,GAAG,IAAI,CAK1D"}
@@ -0,0 +1,160 @@
1
+ /**
2
+ * WS7 ↔ WS9 — `IosComputerInterface` adapts the WS7 `ComputerInterface`
3
+ * port to the iOS Capacitor `ComputerUse` plugin.
4
+ *
5
+ * iOS is fundamentally NOT a click-and-keyboard surface for third-party
6
+ * apps. The only sanctioned UI driver is App Intents (Shortcuts-style
7
+ * invocations). The mapping below reflects that — cascade dispatch
8
+ * primitives that exist on Android (tap / swipe / type) throw a clear
9
+ * "use invokeAppIntent" message on iOS.
10
+ *
11
+ * What *is* supported:
12
+ *
13
+ * screenshot() → drain one frame from `replayKitForegroundDrain`
14
+ * (caller is responsible for having started a
15
+ * session via `replayKitForegroundStart`).
16
+ * getScreenSize, coord → metadata, no bridge call.
17
+ * getAccessibilityTree() → scene-provided tree from WS6; iOS itself
18
+ * cannot read cross-app AX, so this is
19
+ * own-app only (`accessibilitySnapshot`).
20
+ * invokeAppIntent(...) → the canonical iOS "action" — planner picks
21
+ * an intent id + parameters, this method calls
22
+ * `bridge.appIntentInvoke(...)`.
23
+ *
24
+ * What is NOT supported (and throws with a redirect message):
25
+ *
26
+ * leftClick / rightClick / doubleClick / dragTo / drag / mouseDown /
27
+ * mouseUp / keyDown / keyUp / typeText / pressKey / hotkey / scroll
28
+ *
29
+ * The cascade detects iOS via the platform-capabilities probe and is
30
+ * expected to plan in terms of `invokeAppIntent`, not synthetic taps. The
31
+ * `IosComputerInterface.invokeAppIntent` accessor surfaces that contract
32
+ * cleanly so callers don't have to reach into the raw Capacitor bridge.
33
+ */
34
+ import type { ComputerInterface, CursorPosition, DisplayPoint, DragPath, MouseButton, ScreenshotResult, ScrollDelta } from "../actor/computer-interface.js";
35
+ import type { Scene, SceneAxNode } from "../scene/scene-types.js";
36
+ import type { DisplayDescriptor } from "../types.js";
37
+ import type { IntentInvocationRequest, IntentInvocationResult, IosComputerUseBridge } from "./ios-bridge.js";
38
+ /**
39
+ * Stable logical display id for the iOS phone screen. Mirrors the
40
+ * Android convention (`ANDROID_LOGICAL_DISPLAY_ID = 0`) so the cascade
41
+ * doesn't branch on platform for display selection — there's exactly
42
+ * one logical display on iOS.
43
+ */
44
+ export declare const IOS_LOGICAL_DISPLAY_ID: 0;
45
+ export interface IosComputerInterfaceDeps {
46
+ /** Capacitor plugin handle (null when off-platform). */
47
+ getBridge: () => IosComputerUseBridge | null;
48
+ /** Latest scene accessor — used for `getAccessibilityTree`. */
49
+ getScene?: () => Scene | null;
50
+ /**
51
+ * Active ReplayKit session id. The arbiter / scene-builder owns the
52
+ * session lifecycle (start before cascade tick, stop when idle); this
53
+ * interface only drains frames from it.
54
+ */
55
+ getReplayKitSessionId?: () => string | null;
56
+ /** Display descriptor; iOS has exactly one logical display. */
57
+ getDisplay?: () => DisplayDescriptor;
58
+ /** Internal cursor-position state, mostly for tests. */
59
+ cursorState?: {
60
+ current: CursorPosition;
61
+ };
62
+ /** Override JPEG decode (defaults to base64 → Buffer). */
63
+ decodeJpeg?: (b64: string) => Buffer;
64
+ }
65
+ /**
66
+ * iOS adapter implementing the WS7 `ComputerInterface`. All input-bearing
67
+ * methods throw with a "use invokeAppIntent" redirect; metadata + the
68
+ * screenshot path are functional.
69
+ */
70
+ export declare class IosComputerInterface implements ComputerInterface {
71
+ private readonly deps;
72
+ private readonly cursorState;
73
+ constructor(deps: IosComputerInterfaceDeps);
74
+ screenshot(opts?: {
75
+ displayId?: number;
76
+ }): Promise<ScreenshotResult>;
77
+ mouseDown(point: DisplayPoint & {
78
+ button?: MouseButton;
79
+ }): Promise<void>;
80
+ mouseUp(point: DisplayPoint & {
81
+ button?: MouseButton;
82
+ }): Promise<void>;
83
+ leftClick(point: DisplayPoint): Promise<void>;
84
+ rightClick(point: DisplayPoint): Promise<void>;
85
+ doubleClick(point: DisplayPoint): Promise<void>;
86
+ moveCursor(point: DisplayPoint): Promise<void>;
87
+ dragTo(point: DisplayPoint): Promise<void>;
88
+ drag(path: DragPath): Promise<void>;
89
+ keyDown(args: {
90
+ key: string;
91
+ }): Promise<void>;
92
+ keyUp(args: {
93
+ key: string;
94
+ }): Promise<void>;
95
+ typeText(args: {
96
+ text: string;
97
+ }): Promise<void>;
98
+ pressKey(args: {
99
+ key: string;
100
+ }): Promise<void>;
101
+ hotkey(args: {
102
+ keys: string[];
103
+ }): Promise<void>;
104
+ scroll(delta: ScrollDelta): Promise<void>;
105
+ scrollUp(args: {
106
+ displayId: number;
107
+ clicks: number;
108
+ }): Promise<void>;
109
+ scrollDown(args: {
110
+ displayId: number;
111
+ clicks: number;
112
+ }): Promise<void>;
113
+ getScreenSize(_args: {
114
+ displayId: number;
115
+ }): {
116
+ w: number;
117
+ h: number;
118
+ };
119
+ getCursorPosition(): CursorPosition;
120
+ toScreenCoordinates(args: {
121
+ displayId: number;
122
+ imgX: number;
123
+ imgY: number;
124
+ imgW: number;
125
+ imgH: number;
126
+ }): {
127
+ x: number;
128
+ y: number;
129
+ };
130
+ toScreenshotCoordinates(args: {
131
+ displayId: number;
132
+ x: number;
133
+ y: number;
134
+ imgW: number;
135
+ imgH: number;
136
+ }): {
137
+ imgX: number;
138
+ imgY: number;
139
+ };
140
+ getAccessibilityTree(args: {
141
+ displayId?: number;
142
+ }): SceneAxNode[];
143
+ /**
144
+ * Invoke an AppIntent through the bridge. This is the iOS-only addition
145
+ * to the WS7 surface — it does not exist on Android/desktop because
146
+ * those platforms have direct input. Cascade planners that detect iOS
147
+ * via the platform-capabilities probe should plan in `invokeAppIntent`
148
+ * terms (intent id + parameters) instead of `leftClick`.
149
+ */
150
+ invokeAppIntent(request: IntentInvocationRequest): Promise<IntentInvocationResult>;
151
+ private refuseInput;
152
+ private refuseKeyboard;
153
+ private requireBridge;
154
+ private requireDisplayId;
155
+ private requireFiniteCoords;
156
+ private getDisplay;
157
+ }
158
+ /** Convenience factory mirroring the Android side. */
159
+ export declare function makeIosComputerInterface(deps: IosComputerInterfaceDeps): IosComputerInterface;
160
+ //# sourceMappingURL=ios-computer-interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ios-computer-interface.d.ts","sourceRoot":"","sources":["../../src/mobile/ios-computer-interface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAGH,OAAO,KAAK,EACV,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,gBAAgB,EAChB,WAAW,EACZ,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,KAAK,EACV,uBAAuB,EACvB,sBAAsB,EAEtB,oBAAoB,EAErB,MAAM,iBAAiB,CAAC;AAEzB;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,EAAG,CAAU,CAAC;AAUjD,MAAM,WAAW,wBAAwB;IACvC,wDAAwD;IACxD,SAAS,EAAE,MAAM,oBAAoB,GAAG,IAAI,CAAC;IAC7C,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,MAAM,KAAK,GAAG,IAAI,CAAC;IAC9B;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IAC5C,+DAA+D;IAC/D,UAAU,CAAC,EAAE,MAAM,iBAAiB,CAAC;IACrC,wDAAwD;IACxD,WAAW,CAAC,EAAE;QAAE,OAAO,EAAE,cAAc,CAAA;KAAE,CAAC;IAC1C,0DAA0D;IAC1D,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;CACtC;AAED;;;;GAIG;AACH,qBAAa,oBAAqB,YAAW,iBAAiB;IAC5D,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA2B;IAChD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA8B;gBAE9C,IAAI,EAAE,wB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