@moxxy/plugin-computer-control 0.41.2 → 0.42.0

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 (269) hide show
  1. package/bin/win32-x64/moxxy-computer.exe +0 -0
  2. package/bin/win32-x64/moxxy-computer.exe.json +1 -1
  3. package/dist/backend/access.d.ts +129 -0
  4. package/dist/backend/access.d.ts.map +1 -0
  5. package/dist/backend/access.js +158 -0
  6. package/dist/backend/access.js.map +1 -0
  7. package/dist/backend/app-hints.d.ts +14 -0
  8. package/dist/backend/app-hints.d.ts.map +1 -0
  9. package/dist/backend/app-hints.js +30 -0
  10. package/dist/backend/app-hints.js.map +1 -0
  11. package/dist/backend/backend.d.ts +70 -0
  12. package/dist/backend/backend.d.ts.map +1 -0
  13. package/dist/backend/backend.js +466 -0
  14. package/dist/backend/backend.js.map +1 -0
  15. package/dist/backend/rpc.d.ts +1438 -0
  16. package/dist/backend/rpc.d.ts.map +1 -0
  17. package/dist/backend/rpc.js +75 -0
  18. package/dist/backend/rpc.js.map +1 -0
  19. package/dist/backend/turn-controls.d.ts +20 -0
  20. package/dist/backend/turn-controls.d.ts.map +1 -0
  21. package/dist/backend/turn-controls.js +115 -0
  22. package/dist/backend/turn-controls.js.map +1 -0
  23. package/dist/contract/guidance.d.ts +12 -0
  24. package/dist/contract/guidance.d.ts.map +1 -0
  25. package/dist/contract/guidance.js +42 -0
  26. package/dist/contract/guidance.js.map +1 -0
  27. package/dist/contract/image.d.ts +29 -0
  28. package/dist/contract/image.d.ts.map +1 -0
  29. package/dist/contract/image.js +46 -0
  30. package/dist/contract/image.js.map +1 -0
  31. package/dist/contract/keys.d.ts +15 -0
  32. package/dist/contract/keys.d.ts.map +1 -0
  33. package/dist/contract/keys.js +118 -0
  34. package/dist/contract/keys.js.map +1 -0
  35. package/dist/contract/outcome.d.ts +61 -0
  36. package/dist/contract/outcome.d.ts.map +1 -0
  37. package/dist/contract/outcome.js +63 -0
  38. package/dist/contract/outcome.js.map +1 -0
  39. package/dist/contract/progress.d.ts +27 -0
  40. package/dist/contract/progress.d.ts.map +1 -0
  41. package/dist/contract/progress.js +36 -0
  42. package/dist/contract/progress.js.map +1 -0
  43. package/dist/contract/tools.d.ts +338 -0
  44. package/dist/contract/tools.d.ts.map +1 -0
  45. package/dist/contract/tools.js +195 -0
  46. package/dist/contract/tools.js.map +1 -0
  47. package/dist/contract/untrusted.d.ts +3 -0
  48. package/dist/contract/untrusted.d.ts.map +1 -0
  49. package/dist/contract/untrusted.js +8 -0
  50. package/dist/contract/untrusted.js.map +1 -0
  51. package/dist/helper/artifact.d.ts +41 -0
  52. package/dist/helper/artifact.d.ts.map +1 -0
  53. package/dist/helper/artifact.js +189 -0
  54. package/dist/helper/artifact.js.map +1 -0
  55. package/dist/helper/protocol.d.ts +80 -0
  56. package/dist/helper/protocol.d.ts.map +1 -0
  57. package/dist/helper/protocol.js +49 -0
  58. package/dist/helper/protocol.js.map +1 -0
  59. package/dist/helper/transport.d.ts +43 -0
  60. package/dist/helper/transport.d.ts.map +1 -0
  61. package/dist/{windows → helper}/transport.js +45 -19
  62. package/dist/helper/transport.js.map +1 -0
  63. package/dist/index.d.ts +9 -22
  64. package/dist/index.d.ts.map +1 -1
  65. package/dist/index.js +35 -42
  66. package/dist/index.js.map +1 -1
  67. package/dist/jev/ladder.d.ts +32 -0
  68. package/dist/jev/ladder.d.ts.map +1 -0
  69. package/dist/jev/ladder.js +66 -0
  70. package/dist/jev/ladder.js.map +1 -0
  71. package/dist/jev/memory.d.ts +11 -0
  72. package/dist/jev/memory.d.ts.map +1 -0
  73. package/dist/jev/memory.js +16 -0
  74. package/dist/jev/memory.js.map +1 -0
  75. package/dist/jev/run.d.ts +93 -0
  76. package/dist/jev/run.d.ts.map +1 -0
  77. package/dist/jev/run.js +403 -0
  78. package/dist/jev/run.js.map +1 -0
  79. package/dist/jev/train.d.ts +97 -0
  80. package/dist/jev/train.d.ts.map +1 -0
  81. package/dist/jev/train.js +28 -0
  82. package/dist/jev/train.js.map +1 -0
  83. package/dist/linux/profile.d.ts +6 -0
  84. package/dist/linux/profile.d.ts.map +1 -0
  85. package/dist/linux/profile.js +21 -0
  86. package/dist/linux/profile.js.map +1 -0
  87. package/dist/macos/profile.d.ts +5 -0
  88. package/dist/macos/profile.d.ts.map +1 -0
  89. package/dist/macos/profile.js +17 -0
  90. package/dist/macos/profile.js.map +1 -0
  91. package/dist/preview/controller.d.ts +127 -0
  92. package/dist/preview/controller.d.ts.map +1 -0
  93. package/dist/preview/controller.js +203 -0
  94. package/dist/preview/controller.js.map +1 -0
  95. package/dist/preview/surface.d.ts +9 -0
  96. package/dist/preview/surface.d.ts.map +1 -0
  97. package/dist/preview/surface.js +50 -0
  98. package/dist/preview/surface.js.map +1 -0
  99. package/dist/windows/maintenance.d.ts +1 -1
  100. package/dist/windows/maintenance.d.ts.map +1 -1
  101. package/dist/windows/maintenance.js +6 -5
  102. package/dist/windows/maintenance.js.map +1 -1
  103. package/dist/windows/profile.d.ts +5 -0
  104. package/dist/windows/profile.d.ts.map +1 -0
  105. package/dist/windows/profile.js +17 -0
  106. package/dist/windows/profile.js.map +1 -0
  107. package/learned/README.md +26 -0
  108. package/learned/cases/com.apple.calculator.json +395 -0
  109. package/learned/cases/com.apple.finder.json +115 -0
  110. package/learned/cases/com.apple.safari.json +112 -0
  111. package/learned/cases/com.apple.systempreferences.json +255 -0
  112. package/learned/com.apple.calculator-eace95fc.json +334 -0
  113. package/learned/com.apple.finder-27cf6ce8.json +260 -0
  114. package/learned/com.apple.safari-7cd9df4f.json +143 -0
  115. package/learned/com.apple.systempreferences-02cf0b8b.json +535 -0
  116. package/package.json +13 -7
  117. package/scripts/promote-learned.mjs +8 -0
  118. package/scripts/summarize-trial.mjs +68 -0
  119. package/scripts/train-learned.mjs +64 -0
  120. package/skills/computer-apps/blender.md +29 -0
  121. package/skills/computer-apps/browsers.md +50 -0
  122. package/skills/computer-apps/design-tools.md +37 -0
  123. package/skills/computer-apps/finder.md +23 -0
  124. package/skills/computer-apps/office.md +46 -0
  125. package/skills/computer-apps/video-editors.md +44 -0
  126. package/skills/computer-control.md +154 -191
  127. package/src/backend/access.test.ts +158 -0
  128. package/src/backend/access.ts +168 -0
  129. package/src/backend/app-hints.test.ts +59 -0
  130. package/src/backend/app-hints.ts +39 -0
  131. package/src/backend/backend.test.ts +725 -0
  132. package/src/backend/backend.ts +482 -0
  133. package/src/backend/contract-helper.fixture.mjs +138 -0
  134. package/src/backend/helper.fixture.ts +38 -0
  135. package/src/backend/rpc.ts +90 -0
  136. package/src/backend/turn-controls.test.ts +178 -0
  137. package/src/backend/turn-controls.ts +120 -0
  138. package/src/contract/guidance.test.ts +75 -0
  139. package/src/contract/guidance.ts +48 -0
  140. package/src/contract/image.test.ts +74 -0
  141. package/src/contract/image.ts +54 -0
  142. package/src/contract/keys.test.ts +103 -0
  143. package/src/contract/keys.ts +117 -0
  144. package/src/contract/outcome.test.ts +71 -0
  145. package/src/contract/outcome.ts +72 -0
  146. package/src/contract/progress.test.ts +56 -0
  147. package/src/contract/progress.ts +43 -0
  148. package/src/contract/tools.test.ts +210 -0
  149. package/src/contract/tools.ts +212 -0
  150. package/src/contract/untrusted.test.ts +20 -0
  151. package/src/contract/untrusted.ts +8 -0
  152. package/src/helper/artifact.test.ts +131 -0
  153. package/src/helper/artifact.ts +182 -0
  154. package/src/helper/protocol.test.ts +29 -0
  155. package/src/helper/protocol.ts +50 -0
  156. package/src/{windows → helper}/transport.test.ts +76 -19
  157. package/src/{windows → helper}/transport.ts +54 -16
  158. package/src/index.test.ts +112 -0
  159. package/src/index.ts +36 -53
  160. package/src/jev/ladder.test.ts +113 -0
  161. package/src/jev/ladder.ts +88 -0
  162. package/src/jev/memory.ts +20 -0
  163. package/src/jev/run.test.ts +700 -0
  164. package/src/jev/run.ts +443 -0
  165. package/src/jev/train.test.ts +40 -0
  166. package/src/jev/train.ts +41 -0
  167. package/src/linux/helper.test.ts +481 -0
  168. package/src/linux/profile.ts +25 -0
  169. package/src/macos/helper.test.ts +988 -0
  170. package/src/macos/profile.ts +19 -0
  171. package/src/preview/controller.test.ts +308 -0
  172. package/src/preview/controller.ts +262 -0
  173. package/src/preview/surface.test.ts +68 -0
  174. package/src/preview/surface.ts +45 -0
  175. package/src/skill.test.ts +34 -0
  176. package/src/windows/maintenance.ts +8 -7
  177. package/src/windows/profile.ts +19 -0
  178. package/dist/shell.d.ts +0 -56
  179. package/dist/shell.d.ts.map +0 -1
  180. package/dist/shell.js +0 -189
  181. package/dist/shell.js.map +0 -1
  182. package/dist/temporary-files.d.ts +0 -2
  183. package/dist/temporary-files.d.ts.map +0 -1
  184. package/dist/temporary-files.js +0 -10
  185. package/dist/temporary-files.js.map +0 -1
  186. package/dist/tools/applescript.d.ts +0 -2
  187. package/dist/tools/applescript.d.ts.map +0 -1
  188. package/dist/tools/applescript.js +0 -50
  189. package/dist/tools/applescript.js.map +0 -1
  190. package/dist/tools/click.d.ts +0 -2
  191. package/dist/tools/click.d.ts.map +0 -1
  192. package/dist/tools/click.js +0 -58
  193. package/dist/tools/click.js.map +0 -1
  194. package/dist/tools/clipboard.d.ts +0 -2
  195. package/dist/tools/clipboard.d.ts.map +0 -1
  196. package/dist/tools/clipboard.js +0 -71
  197. package/dist/tools/clipboard.js.map +0 -1
  198. package/dist/tools/key.d.ts +0 -11
  199. package/dist/tools/key.d.ts.map +0 -1
  200. package/dist/tools/key.js +0 -143
  201. package/dist/tools/key.js.map +0 -1
  202. package/dist/tools/open.d.ts +0 -2
  203. package/dist/tools/open.d.ts.map +0 -1
  204. package/dist/tools/open.js +0 -91
  205. package/dist/tools/open.js.map +0 -1
  206. package/dist/tools/screenshot.d.ts +0 -2
  207. package/dist/tools/screenshot.d.ts.map +0 -1
  208. package/dist/tools/screenshot.js +0 -162
  209. package/dist/tools/screenshot.js.map +0 -1
  210. package/dist/tools/type.d.ts +0 -8
  211. package/dist/tools/type.d.ts.map +0 -1
  212. package/dist/tools/type.js +0 -65
  213. package/dist/tools/type.js.map +0 -1
  214. package/dist/windows/artifact.d.ts +0 -3
  215. package/dist/windows/artifact.d.ts.map +0 -1
  216. package/dist/windows/artifact.js +0 -57
  217. package/dist/windows/artifact.js.map +0 -1
  218. package/dist/windows/backend.d.ts +0 -11
  219. package/dist/windows/backend.d.ts.map +0 -1
  220. package/dist/windows/backend.js +0 -122
  221. package/dist/windows/backend.js.map +0 -1
  222. package/dist/windows/contracts.d.ts +0 -1627
  223. package/dist/windows/contracts.d.ts.map +0 -1
  224. package/dist/windows/contracts.js +0 -137
  225. package/dist/windows/contracts.js.map +0 -1
  226. package/dist/windows/control-service.d.ts +0 -12
  227. package/dist/windows/control-service.d.ts.map +0 -1
  228. package/dist/windows/control-service.js +0 -65
  229. package/dist/windows/control-service.js.map +0 -1
  230. package/dist/windows/guidance.d.ts +0 -3
  231. package/dist/windows/guidance.d.ts.map +0 -1
  232. package/dist/windows/guidance.js +0 -20
  233. package/dist/windows/guidance.js.map +0 -1
  234. package/dist/windows/protocol.d.ts +0 -9
  235. package/dist/windows/protocol.d.ts.map +0 -1
  236. package/dist/windows/protocol.js +0 -32
  237. package/dist/windows/protocol.js.map +0 -1
  238. package/dist/windows/transport.d.ts +0 -23
  239. package/dist/windows/transport.d.ts.map +0 -1
  240. package/dist/windows/transport.js.map +0 -1
  241. package/src/shell.test.ts +0 -186
  242. package/src/shell.ts +0 -213
  243. package/src/temporary-files.test.ts +0 -18
  244. package/src/temporary-files.ts +0 -9
  245. package/src/tools/applescript-serialize.test.ts +0 -74
  246. package/src/tools/applescript.ts +0 -53
  247. package/src/tools/click.ts +0 -60
  248. package/src/tools/clipboard.ts +0 -72
  249. package/src/tools/key.ts +0 -155
  250. package/src/tools/open.ts +0 -96
  251. package/src/tools/screenshot.test.ts +0 -137
  252. package/src/tools/screenshot.ts +0 -180
  253. package/src/tools/type.ts +0 -68
  254. package/src/tools.test.ts +0 -94
  255. package/src/windows/action-contracts.test.ts +0 -13
  256. package/src/windows/artifact.test.ts +0 -16
  257. package/src/windows/artifact.ts +0 -57
  258. package/src/windows/backend.test.ts +0 -41
  259. package/src/windows/backend.ts +0 -122
  260. package/src/windows/contracts.test.ts +0 -81
  261. package/src/windows/contracts.ts +0 -143
  262. package/src/windows/control-service.test.ts +0 -58
  263. package/src/windows/control-service.ts +0 -68
  264. package/src/windows/guidance.test.ts +0 -29
  265. package/src/windows/guidance.ts +0 -21
  266. package/src/windows/model-contract.test.ts +0 -37
  267. package/src/windows/protocol.ts +0 -27
  268. package/src/windows/text-contracts.test.ts +0 -14
  269. package/src/windows/window-typing.test.ts +0 -14
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../src/helper/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,4DAA4D;AAC5D,MAAM,CAAC,MAAM,eAAe,GAAG,SAAS,CAAC;AACzC,MAAM,QAAQ,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAE5C,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;AACpF,+FAA+F;AAC/F,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAC3C,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,YAAY,EAAE,SAAS,EAAE,QAAQ,CAAU,CAAC;AAErJ,oGAAoG;AACpG,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,OAAe,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;IACjE,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,OAAO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C7B,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;YAC1C,MAAM,GAAG,GAAG,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;YACjD,MAAM,IAAI,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;YACzC,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK;gBAAE,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;YAClH,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;YACnD,IAAI,OAAO,GAAG,CAAC;gBAAE,MAAM;YACvB,MAAM,IAAI,GAAG,IAAI,WAAW,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC5E,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;YAC9B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC/B,MAAM,GAAG,OAAO,GAAG,CAAC,CAAC;QACvB,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM;QACJ,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM;YAAE,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;IACrF,CAAC;CACF"}
@@ -0,0 +1,43 @@
1
+ import { z } from 'zod';
2
+ /** A validated frame the helper emitted on its own (state changes, cursor moves, preview frames). */
3
+ export interface HelperEvent {
4
+ readonly event: string;
5
+ readonly [field: string]: unknown;
6
+ }
7
+ export interface HelperTransportOptions {
8
+ readonly protocolVersion: number;
9
+ readonly timeoutMs?: number;
10
+ /** Schemas for uncorrelated events by name. `control_state` is built in; any other name fails closed. */
11
+ readonly events?: Readonly<Record<string, z.ZodType<HelperEvent>>>;
12
+ readonly onEvent?: (event: HelperEvent) => void;
13
+ }
14
+ /** A request the helper refused; `code` is the helper's machine-readable reason. */
15
+ export declare class HelperError extends Error {
16
+ readonly code: string;
17
+ readonly detail: string;
18
+ constructor(code: string, detail: string);
19
+ }
20
+ /** One serial, non-retrying connection to a disposable native helper. */
21
+ export declare class HelperTransport {
22
+ private readonly child;
23
+ private readonly exited;
24
+ private pending;
25
+ private stopped;
26
+ private userStopped;
27
+ private queue;
28
+ private stderrBytes;
29
+ get closed(): boolean;
30
+ get stoppedByUser(): boolean;
31
+ /** Settles once the helper process has exited, whatever the reason. */
32
+ get done(): Promise<void>;
33
+ private readonly version;
34
+ private readonly timeoutMs;
35
+ constructor(command: string, args: string[], options: HelperTransportOptions);
36
+ request(method: string, params: unknown, signal: AbortSignal): Promise<unknown>;
37
+ /** Control uses the reader side of the helper, never its blocked request queue. */
38
+ control(command: 'pause' | 'resume' | 'stop' | 'takeover'): void;
39
+ private send;
40
+ private fail;
41
+ close(): Promise<void>;
42
+ }
43
+ //# sourceMappingURL=transport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/helper/transport.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,qGAAqG;AACrG,MAAM,WAAW,WAAW;IAAG,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE;AAE1F,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,yGAAyG;IACzG,QAAQ,CAAC,M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I;IAaN,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAI7B"}
@@ -1,11 +1,21 @@
1
1
  import { spawn } from 'node:child_process';
2
2
  import { randomUUID } from 'node:crypto';
3
- import { JsonLineDecoder } from './protocol.js';
4
- import { MAX_FRAME_BYTES, PROTOCOL_VERSION, responseSchema, controlStateSchema, controlCommandSchema } from './contracts.js';
3
+ import { z } from 'zod';
4
+ import { JsonLineDecoder, MAX_FRAME_BYTES, TAKEOVER_PROTOCOL_VERSION, controlCommandSchema, controlStateSchemaFor, responseSchemaFor } from './protocol.js';
5
+ const eventFrame = z.object({ event: z.string() }).passthrough();
6
+ /** A request the helper refused; `code` is the helper's machine-readable reason. */
7
+ export class HelperError extends Error {
8
+ code;
9
+ detail;
10
+ constructor(code, detail) {
11
+ super(`${code}: ${detail}`);
12
+ this.code = code;
13
+ this.detail = detail;
14
+ this.name = 'HelperError';
15
+ }
16
+ }
5
17
  /** One serial, non-retrying connection to a disposable native helper. */
6
18
  export class HelperTransport {
7
- timeoutMs;
8
- onState;
9
19
  child;
10
20
  exited;
11
21
  pending;
@@ -15,9 +25,16 @@ export class HelperTransport {
15
25
  stderrBytes = 0;
16
26
  get closed() { return this.stopped; }
17
27
  get stoppedByUser() { return this.userStopped; }
18
- constructor(command, args, timeoutMs = 15_000, onState = () => undefined) {
19
- this.timeoutMs = timeoutMs;
20
- this.onState = onState;
28
+ /** Settles once the helper process has exited, whatever the reason. */
29
+ get done() { return this.exited; }
30
+ version;
31
+ timeoutMs;
32
+ constructor(command, args, options) {
33
+ this.version = options.protocolVersion;
34
+ this.timeoutMs = options.timeoutMs ?? 15_000;
35
+ const onEvent = options.onEvent ?? (() => undefined);
36
+ const controlState = controlStateSchemaFor(this.version);
37
+ const response = responseSchemaFor(this.version);
21
38
  this.child = spawn(command, args, { shell: false, windowsHide: true, stdio: ['pipe', 'pipe', 'pipe'] });
22
39
  this.exited = new Promise((resolve) => this.child.once('close', () => resolve()));
23
40
  const decoder = new JsonLineDecoder(MAX_FRAME_BYTES);
@@ -33,25 +50,33 @@ export class HelperTransport {
33
50
  this.child.stdout.on('data', (bytes) => {
34
51
  try {
35
52
  for (const frame of decoder.push(bytes)) {
36
- const event = controlStateSchema.safeParse(frame);
37
- if (event.success) {
53
+ const tagged = eventFrame.safeParse(frame);
54
+ if (tagged.success && tagged.data.event === 'control_state') {
55
+ const state = controlState.parse(frame);
38
56
  const pending = this.pending;
39
- if (!pending || event.data.id !== pending.id)
57
+ if (!pending || state.id !== pending.id)
40
58
  throw new Error('Unmatched control state');
41
- pending.waiting(event.data.state === 'waiting_for_focus' || event.data.state === 'paused_by_user');
42
- this.onState(event.data);
59
+ pending.waiting(state.state === 'waiting_for_focus' || state.state === 'paused_by_user');
60
+ onEvent(state);
61
+ continue;
62
+ }
63
+ if (tagged.success) {
64
+ const schema = options.events?.[tagged.data.event];
65
+ if (!schema)
66
+ throw new Error('Unregistered helper event');
67
+ onEvent(schema.parse(frame));
43
68
  continue;
44
69
  }
45
- const response = responseSchema.parse(frame);
70
+ const reply = response.parse(frame);
46
71
  const pending = this.pending;
47
- if (!pending || pending.id !== response.id)
72
+ if (!pending || pending.id !== reply.id)
48
73
  throw new Error('Unmatched response');
49
74
  this.pending = undefined;
50
75
  pending.dispose();
51
- if (response.ok)
52
- pending.resolve(response.result);
76
+ if (reply.ok)
77
+ pending.resolve(reply.result);
53
78
  else
54
- pending.reject(new Error(`${response.error.code}: ${response.error.message}`));
79
+ pending.reject(new HelperError(reply.error.code, reply.error.message));
55
80
  }
56
81
  }
57
82
  catch {
@@ -88,7 +113,8 @@ export class HelperTransport {
88
113
  this.fail(new Error('Computer Use stopped by user; action not retried.'));
89
114
  return;
90
115
  }
91
- this.child.stdin.write(JSON.stringify({ version: PROTOCOL_VERSION, control: command }) + '\n');
116
+ const sent = command === 'takeover' && this.version < TAKEOVER_PROTOCOL_VERSION ? 'pause' : command;
117
+ this.child.stdin.write(JSON.stringify({ version: this.version, control: sent }) + '\n');
92
118
  }
93
119
  send(method, params, signal) {
94
120
  if (this.stopped)
@@ -96,7 +122,7 @@ export class HelperTransport {
96
122
  if (signal.aborted)
97
123
  return Promise.reject(new Error('Computer Use cancelled'));
98
124
  const id = randomUUID();
99
- const frame = JSON.stringify({ version: PROTOCOL_VERSION, id, method, params }) + '\n';
125
+ const frame = JSON.stringify({ version: this.version, id, method, params }) + '\n';
100
126
  if (Buffer.byteLength(frame) > MAX_FRAME_BYTES)
101
127
  return Promise.reject(new Error('Computer Use request limit exceeded'));
102
128
  return new Promise((resolve, reject) => {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transport.js","sourceRoot":"","sources":["../../src/helper/transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAuC,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAa5J,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;AAEjE,oFAAoF;AACpF,MAAM,OAAO,WAAY,SAAQ,KAAK;IACf;IAAuB;IAA5C,YAAqB,IAAY,EAAW,MAAc;QACxD,KAAK,CAAC,GAAG,IAAI,KAAK,MAAM,EAAE,CAAC,CAAC;QADT,SAAI,GAAJ,IAAI,CAAQ;QAAW,WAAM,GAAN,MAAM,CAAQ;QAExD,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;IAC5B,CAAC;CACF;AAUD,yEAAyE;AACzE,MAAM,OAAO,eAAe;IACT,KAAK,CAAiC;IACtC,MAAM,CAAgB;IAC/B,OAAO,CAAsB;IAC7B,OAAO,GAAG,KAAK,CAAC;IAChB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C;QACzB,IAAI,OAAO,EAAE,CAAC;YAAC,OAAO,CAAC,OAAO,EAAE,CAAC;YAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAAC,CAAC;QAC1D,kFAAkF;QAClF,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;QACvB,MAAM,IAAI,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,CAAC,CAAC;QAC/D,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,KAAK,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;IAClD,CAAC;IAED,KAAK,CAAC,KAAK;QACT,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC,CAAC;QACvD,MAAM,IAAI,CAAC,MAAM,CAAC;IACpB,CAAC;CACF"}
package/dist/index.d.ts CHANGED
@@ -1,28 +1,15 @@
1
- import { type Plugin, type ToolDef } from '@moxxy/sdk';
2
- import { IS_DARWIN } from './shell.js';
3
- import { applescriptTool } from './tools/applescript.js';
4
- import { clickTool } from './tools/click.js';
5
- import { clipboardTool } from './tools/clipboard.js';
6
- import { keyTool } from './tools/key.js';
7
- import { openTool } from './tools/open.js';
8
- import { screenshotTool } from './tools/screenshot.js';
9
- import { typeTool } from './tools/type.js';
10
- export { applescriptTool, clickTool, clipboardTool, keyTool, openTool, screenshotTool, typeTool, };
11
- export declare const computerControlTools: ReadonlyArray<ToolDef>;
1
+ import { type Plugin } from '@moxxy/sdk';
2
+ import { type PlatformProfile } from './backend/backend.js';
12
3
  /**
13
- * `@moxxy/plugin-computer-control` — programmatic control of the host
14
- * computer (mouse, keyboard, screenshot, clipboard, app launching,
15
- * AppleScript escape hatch).
4
+ * `@moxxy/plugin-computer-control` — operates the user's desktop applications
5
+ * through a bundled native helper: macOS (universal), Windows x64 and Linux
6
+ * (x64, arm64; X11 sessions). Other
7
+ * hosts, and a host whose helper is missing, expose `computer_status` only.
16
8
  *
17
- * macOS retains its system-binary backend; Windows x64 uses our bundled
18
- * native helper. Unsupported hosts expose status only.
19
- *
20
- * Every tool is `permission: 'prompt'`. There is intentionally no
21
- * "allow always" shortcut for these — granting blanket permission to
22
- * drive the user's screen + keyboard is exactly the wrong default.
9
+ * Every tool is `permission: 'prompt'`; which apps may be controlled, and how
10
+ * far, is a separate grant recorded in the session log.
23
11
  */
24
- export declare function createComputerControlPlugin(platform?: NodeJS.Platform, arch?: string): Plugin;
12
+ export declare function createComputerControlPlugin(platform?: NodeJS.Platform, arch?: string, profile?: PlatformProfile | undefined): Plugin;
25
13
  export declare const computerControlPlugin: Plugin;
26
14
  export default computerControlPlugin;
27
- export { IS_DARWIN };
28
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,MAAM,EAAE,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAEpF,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,OAAO,EACL,eAAe,EACf,SAAS,EACT,aAAa,EACb,OAAO,EACP,QAAQ,EACR,cAAc,EACd,QAAQ,GACT,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,aAAa,CAAC,OAAO,CAQvD,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,wBAAgB,2BAA2B,CAAC,QAAQ,GAAE,MAAM,CAAC,QAA2B,EAAE,IAAI,GAAE,MAAqB,GAAG,MAAM,CAa7H;AAED,eAAO,MAAM,qBAAqB,QAAgC,CAAC;AAEnE,eAAe,qBAAqB,CAAC;AAGrC,OAAO,EAAE,SAAS,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,MAAM,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,EAAmB,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAwB7E;;;;;;;;GAQG;AACH,wBAAgB,2BAA2B,CACzC,QAAQ,GAAE,MAAM,CAAC,QAA2B,EAAE,IAAI,GAAE,MAAqB,EAAE,OAAO,GAAE,eAAe,GAAG,SAAsC,GAC3I,MAAM,CAMR;AAED,eAAO,MAAM,qBAAqB,QAAgC,CAAC;AAEnE,eAAe,qBAAqB,CAAC"}
package/dist/index.js CHANGED
@@ -1,51 +1,44 @@
1
1
  import { definePlugin, defineTool, z } from '@moxxy/sdk';
2
- import { WindowsBackend } from './windows/backend.js';
3
- import { IS_DARWIN } from './shell.js';
4
- import { applescriptTool } from './tools/applescript.js';
5
- import { clickTool } from './tools/click.js';
6
- import { clipboardTool } from './tools/clipboard.js';
7
- import { keyTool } from './tools/key.js';
8
- import { openTool } from './tools/open.js';
9
- import { screenshotTool } from './tools/screenshot.js';
10
- import { typeTool } from './tools/type.js';
11
- export { applescriptTool, clickTool, clipboardTool, keyTool, openTool, screenshotTool, typeTool, };
12
- export const computerControlTools = [
13
- screenshotTool,
14
- clickTool,
15
- typeTool,
16
- keyTool,
17
- openTool,
18
- clipboardTool,
19
- applescriptTool,
20
- ];
21
- /**
22
- * `@moxxy/plugin-computer-control` — programmatic control of the host
23
- * computer (mouse, keyboard, screenshot, clipboard, app launching,
24
- * AppleScript escape hatch).
25
- *
26
- * macOS retains its system-binary backend; Windows x64 uses our bundled
27
- * native helper. Unsupported hosts expose status only.
28
- *
29
- * Every tool is `permission: 'prompt'`. There is intentionally no
30
- * "allow always" shortcut for these — granting blanket permission to
31
- * drive the user's screen + keyboard is exactly the wrong default.
32
- */
33
- export function createComputerControlPlugin(platform = process.platform, arch = process.arch) {
34
- const backend = platform === 'win32' && arch === 'x64' ? new WindowsBackend() : undefined;
2
+ import { ComputerBackend } from './backend/backend.js';
3
+ import { helperProblem } from './helper/artifact.js';
4
+ import { linuxProfile } from './linux/profile.js';
5
+ import { macosProfile } from './macos/profile.js';
6
+ import { windowsProfile } from './windows/profile.js';
7
+ const name = '@moxxy/plugin-computer-control';
8
+ /** The only tool of a host that cannot run Computer Use: it says why. */
9
+ function statusOnly(platform, architecture, limitation) {
35
10
  const status = defineTool({
36
11
  name: 'computer_status', description: 'Report Computer Use platform capabilities and limitations.',
37
12
  inputSchema: z.object({}).strict(), permission: { action: 'prompt' },
38
- handler: () => ({ platform, architecture: arch, ready: platform === 'darwin',
39
- limitations: platform === 'darwin' ? ['Requires Screen Recording and Accessibility permissions'] : ['Unsupported platform or architecture'] }),
40
- });
41
- return definePlugin({
42
- name: '@moxxy/plugin-computer-control', version: '0.0.0',
43
- tools: backend ? backend.tools() : platform === 'darwin' ? [...computerControlTools, status] : [status],
44
- ...(backend ? { hooks: backend.hooks } : {}),
13
+ handler: () => ({ platform, architecture, ready: false, limitations: [limitation] }),
45
14
  });
15
+ return definePlugin({ name, version: '0.0.0', tools: [status] });
16
+ }
17
+ function profileFor(platform, arch) {
18
+ if (platform === 'darwin')
19
+ return macosProfile;
20
+ if (platform === 'linux')
21
+ return arch === 'x64' || arch === 'arm64' ? linuxProfile(arch) : undefined;
22
+ return platform === 'win32' && arch === 'x64' ? windowsProfile : undefined;
23
+ }
24
+ /**
25
+ * `@moxxy/plugin-computer-control` — operates the user's desktop applications
26
+ * through a bundled native helper: macOS (universal), Windows x64 and Linux
27
+ * (x64, arm64; X11 sessions). Other
28
+ * hosts, and a host whose helper is missing, expose `computer_status` only.
29
+ *
30
+ * Every tool is `permission: 'prompt'`; which apps may be controlled, and how
31
+ * far, is a separate grant recorded in the session log.
32
+ */
33
+ export function createComputerControlPlugin(platform = process.platform, arch = process.arch, profile = profileFor(platform, arch)) {
34
+ if (!profile)
35
+ return statusOnly(platform, arch, 'Unsupported platform or architecture');
36
+ const problem = helperProblem(profile.helperPath, profile.protocolVersion);
37
+ if (problem)
38
+ return statusOnly(platform, arch, `${problem} ${profile.unavailableMessage}`);
39
+ const backend = new ComputerBackend(profile);
40
+ return definePlugin({ name, version: '0.0.0', tools: backend.tools(), hooks: backend.hooks, surfaces: backend.surfaces() });
46
41
  }
47
42
  export const computerControlPlugin = createComputerControlPlugin();
48
43
  export default computerControlPlugin;
49
- // Re-export for callers that want a runtime gate.
50
- export { IS_DARWIN };
51
44
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC,EAA6B,MAAM,YAAY,CAAC;AACpF,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,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,CAAC;AAEnE,eAAe,qBAAqB,CAAC"}
@@ -0,0 +1,32 @@
1
+ import type { ActionResult } from '../contract/outcome.js';
2
+ import type { ComputerAction, RunStep } from '../contract/tools.js';
3
+ import type { AppElement } from '@moxxy/jev';
4
+ /** The ways to carry out a step on its element, best first. Each way is a short run of actions. */
5
+ export declare function rungs(step: RunStep, element: AppElement | undefined, selectAll: string): ComputerAction[][];
6
+ export type Verdict = {
7
+ readonly verdict: 'done';
8
+ readonly verified: boolean;
9
+ } | {
10
+ readonly verdict: 'retry';
11
+ readonly why: string;
12
+ } | {
13
+ readonly verdict: 'stop';
14
+ readonly why: string;
15
+ };
16
+ export interface Attempt {
17
+ readonly step: RunStep;
18
+ readonly result: ActionResult;
19
+ /** Whether the window looks different than before the attempt. */
20
+ readonly changed: boolean;
21
+ /** Jev's probability that `step.expect` holds now; absent when the step expects nothing. */
22
+ readonly expected?: number;
23
+ /** A click at a point changed the screenshot and no element: what it did is outside what Jev is shown. */
24
+ readonly unseen?: boolean;
25
+ /** A type step's text shows in its element now: typing it again would append it once more. */
26
+ readonly typed?: boolean;
27
+ /** Another window is in front than before the attempt. */
28
+ readonly moved?: boolean;
29
+ }
30
+ /** What one attempt at a step means for the run. */
31
+ export declare function judge({ step, result, changed, expected, unseen, typed, moved }: Attempt): Verdict;
32
+ //# sourceMappingURL=ladder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ladder.d.ts","sourceRoot":"","sources":["../../src/jev/ladder.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAa,MAAM,wBAAwB,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAc7C,mGAAmG;AACnG,wBAAgB,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,GAAG,SAAS,EAAE,SAAS,EAAE,MAAM,GAAG,cAAc,EAAE,EAAE,CAwB3G;AAED,MAAM,MAAM,OAAO,GACf;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,GACxD;IAAE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GACnD;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvD,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,kEAAkE;IAClE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,4FAA4F;IAC5F,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,0GAA0G;IAC1G,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,8FAA8F;IAC9F,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,0DAA0D;IAC1D,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAC1B;AAMD,oDAAoD;AACpD,wBAAgB,KAAK,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,OAAO,GAAG,OAAO,CAkBjG"}
@@ -0,0 +1,66 @@
1
+ import { assertDefined } from '@moxxy/sdk';
2
+ /** How sure Jev must be that the expected result shows, and below what it certainly does not. */
3
+ const HOLDS = 0.6;
4
+ const FAILS = 0.3;
5
+ /** What only the user or the main model can resolve; trying another way would not help. */
6
+ const FINAL = new Set([
7
+ 'user_stopped', 'user_intervened', 'screen_locked', 'permissions_not_granted', 'permissions_pending', 'tier_insufficient',
8
+ 'app_not_allowed', 'protected_path', 'system_key_combo', 'clipboard_not_granted', 'own_window',
9
+ ]);
10
+ const click = (target) => ({ action: 'click', ...target, mouse_button: 'left', click_count: 1 });
11
+ /** The ways to carry out a step on its element, best first. Each way is a short run of actions. */
12
+ export function rungs(step, element, selectAll) {
13
+ const { key, text, direction } = step;
14
+ if (step.do === 'key') {
15
+ assertDefined(key, 'a key step has a key');
16
+ return [[{ action: 'press_key', key, repeat: 1 }]];
17
+ }
18
+ if (step.do === 'type' && !element) {
19
+ assertDefined(text, 'a type step has text');
20
+ return [[{ action: 'type_text', text }]];
21
+ }
22
+ assertDefined(element, `a ${step.do} step has an element`);
23
+ const { index, frame } = element;
24
+ const onElement = click({ element_index: index });
25
+ if (step.do === 'click') {
26
+ return [[onElement], ...(frame ? [[click({ x: Math.round(frame.x + frame.width / 2), y: Math.round(frame.y + frame.height / 2) })]] : [])];
27
+ }
28
+ if (step.do === 'scroll') {
29
+ assertDefined(direction, 'a scroll step has a direction');
30
+ return [[{ action: 'scroll', element_index: index, direction, pages: 1 }]];
31
+ }
32
+ assertDefined(text, `a ${step.do} step has text`);
33
+ if (step.do === 'type')
34
+ return [[{ action: 'type_text', element_index: index, text }], [onElement, { action: 'type_text', text }]];
35
+ const typed = text === '' ? { action: 'press_key', key: 'BackSpace', repeat: 1 } : { action: 'type_text', text };
36
+ return [[{ action: 'set_value', element_index: index, value: text }], [onElement, { action: 'press_key', key: selectAll, repeat: 1 }, typed]];
37
+ }
38
+ const UNSEEN = 'the click changed the screenshot but no element, so its result cannot be checked here and it was not clicked again (another click may undo it). Read the screenshot: when it shows the result, continue with the single tools by x and y';
39
+ const LOADING = 'the click followed a link and the new page is still loading, so it was not clicked again (a second click can start the same thing twice). Look at the window again before the next action';
40
+ /** What one attempt at a step means for the run. */
41
+ export function judge({ step, result, changed, expected, unseen, typed, moved }) {
42
+ if (result.outcome !== 'delivered') {
43
+ const why = `${result.outcome}${result.code ? ` (${result.code})` : ''}`;
44
+ return result.code && FINAL.has(result.code) ? { verdict: 'stop', why } : { verdict: 'retry', why };
45
+ }
46
+ // Doing these again would do them twice. A key that brought another window forward opened or switched one, which Jev,
47
+ // reading a single window, cannot tell from one that was there before.
48
+ if (typed || (moved && step.do === 'key'))
49
+ return { verdict: 'done', verified: expected !== undefined && expected >= HOLDS };
50
+ if (expected !== undefined && expected >= HOLDS)
51
+ return { verdict: 'done', verified: true };
52
+ if (result.code === 'page_loading')
53
+ return { verdict: 'stop', why: LOADING };
54
+ if (expected !== undefined) {
55
+ if (unseen)
56
+ return { verdict: 'stop', why: UNSEEN };
57
+ if (expected <= FAILS || !changed)
58
+ return { verdict: 'retry', why: 'the expected result does not show' };
59
+ return { verdict: 'done', verified: false };
60
+ }
61
+ // A key or a scroll can be right and still change nothing visible; a click or a value cannot.
62
+ if (!changed && step.do !== 'key' && step.do !== 'scroll')
63
+ return { verdict: 'retry', why: 'nothing changed' };
64
+ return { verdict: 'done', verified: false };
65
+ }
66
+ //# sourceMappingURL=ladder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ladder.js","sourceRoot":"","sources":["../../src/jev/ladder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAK3C,iGAAiG;AACjG,MAAM,KAAK,GAAG,GAAG,CAAC;AAClB,MAAM,KAAK,GAAG,GAAG,CAAC;AAElB,2FAA2F;AAC3F,MAAM,KAAK,GAA2B,IAAI,GAAG,CAAY;IACvD,cAAc,EAAE,iBAAiB,EAAE,eAAe,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,mBAAmB;IACzH,iBAAiB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,YAAY;CAC/F,CAAC,CAAC;AAEH,MAAM,KAAK,GAAG,CAAC,MAA4D,EAAkB,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,EAAE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AAE,KAAK,EAAE,CAAC;IAC9C,CAAC;IACD,8FAA8F;IAC9F,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,EAAE,KAAK,KAAK,IAAI,IAAI,CAAC,EAAE,KAAK,QAAQ;QAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,iBAAiB,EAAE,CAAC;IAC/G,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AAC9C,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { RunMemory as SharedMemory, type AppMemory } from '@moxxy/jev';
2
+ export { guess, labelOf, recall, sameWords, targetOf, type AppMemory, type LearnedRoute, type LearnedTarget, type Lesson } from '@moxxy/jev';
3
+ /** What the moxxy team learned and ships with the plugin, so a new install does not start from nothing. */
4
+ export declare const shippedLearned: string;
5
+ /** Computer Use's lessons: one file per app under `~/.moxxy/computer-use/learned`, routes of computer_run steps. */
6
+ export declare class RunMemory extends SharedMemory {
7
+ constructor(directory?: string, now?: () => number, shipped?: string);
8
+ }
9
+ export declare const describeRoutes: (memory: AppMemory) => string | undefined;
10
+ export declare const promote: (from: string, to: string) => Promise<string[]>;
11
+ //# sourceMappingURL=memory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../src/jev/memory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,IAAI,YAAY,EAA8D,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAInI,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,SAAS,EAAE,KAAK,YAAY,EAAE,KAAK,aAAa,EAAE,KAAK,MAAM,EAAE,MAAM,YAAY,CAAC;AAE7I,2GAA2G;AAC3G,eAAO,MAAM,cAAc,QAA2D,CAAC;AAEvF,oHAAoH;AACpH,qBAAa,SAAU,SAAQ,YAAY;gBAC7B,SAAS,GAAE,MAA6C,EAAE,GAAG,GAAE,MAAM,MAAiB,EAAE,OAAO,CAAC,EAAE,MAAM;CAGrH;AAED,eAAO,MAAM,cAAc,GAAI,QAAQ,SAAS,KAAG,MAAM,GAAG,SAAmD,CAAC;AAEhH,eAAO,MAAM,OAAO,GAAI,MAAM,MAAM,EAAE,IAAI,MAAM,KAAG,OAAO,CAAC,MAAM,EAAE,CAA0C,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { fileURLToPath } from 'node:url';
2
+ import { RunMemory as SharedMemory, describeRoutes as describeShared, promote as promoteShared } from '@moxxy/jev';
3
+ import { moxxyPath } from '@moxxy/sdk/server';
4
+ import { runStepShape } from '../contract/tools.js';
5
+ export { guess, labelOf, recall, sameWords, targetOf } from '@moxxy/jev';
6
+ /** What the moxxy team learned and ships with the plugin, so a new install does not start from nothing. */
7
+ export const shippedLearned = fileURLToPath(new URL('../../learned', import.meta.url));
8
+ /** Computer Use's lessons: one file per app under `~/.moxxy/computer-use/learned`, routes of computer_run steps. */
9
+ export class RunMemory extends SharedMemory {
10
+ constructor(directory = moxxyPath('computer-use', 'learned'), now = Date.now, shipped) {
11
+ super(directory, now, shipped, runStepShape);
12
+ }
13
+ }
14
+ export const describeRoutes = (memory) => describeShared(memory, 'computer_run');
15
+ export const promote = (from, to) => promoteShared(from, to, runStepShape);
16
+ //# sourceMappingURL=memory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory.js","sourceRoot":"","sources":["../../src/jev/memory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,SAAS,IAAI,YAAY,EAAE,cAAc,IAAI,cAAc,EAAE,OAAO,IAAI,aAAa,EAAkB,MAAM,YAAY,CAAC;AACnI,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAsE,MAAM,YAAY,CAAC;AAE7I,2GAA2G;AAC3G,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,eAAe,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAEvF,oHAAoH;AACpH,MAAM,OAAO,SAAU,SAAQ,YAAY;IACzC,YAAY,YAAoB,SAAS,CAAC,cAAc,EAAE,SAAS,CAAC,EAAE,MAAoB,IAAI,CAAC,GAAG,EAAE,OAAgB;QAClH,KAAK,CAAC,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;IAC/C,CAAC;CACF;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAAiB,EAAsB,EAAE,CAAC,cAAc,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;AAEhH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,IAAY,EAAE,EAAU,EAAqB,EAAE,CAAC,aAAa,CAAC,IAAI,EAAE,EAAE,EAAE,YAAY,CAAC,CAAC"}
@@ -0,0 +1,93 @@
1
+ import type { AppState, ShownText } from '../backend/rpc.js';
2
+ import { type ActionResult } from '../contract/outcome.js';
3
+ import type { ComputerAction, RunStep } from '../contract/tools.js';
4
+ import { type AppElement, type AppTree } from '@moxxy/jev';
5
+ import { type AskJev } from '@moxxy/jev';
6
+ /** A step's element from an earlier run, the way that worked, and the labels that appeared when it did. */
7
+ /** `element` is absent for a key, which is remembered only by what it made appear. */
8
+ export interface Recalled {
9
+ readonly element?: AppElement;
10
+ readonly way: number;
11
+ readonly effect?: readonly string[];
12
+ }
13
+ export interface ActWait {
14
+ /** What the window showed when this step last worked: the action may return as soon as it shows again. */
15
+ readonly until?: readonly string[];
16
+ /** The state after the action comes with a screenshot. */
17
+ readonly picture: boolean;
18
+ }
19
+ export interface RunDeps {
20
+ readonly ask: AskJev;
21
+ /** A fresh look at the window, once it has settled; with a picture only when `picture` says so. */
22
+ readonly observe: (picture?: boolean) => Promise<AppState>;
23
+ /** One action, then the window's state once it settled, or as soon as what `wait` names shows. */
24
+ readonly act: (action: ComputerAction, wait: ActWait) => Promise<{
25
+ result: ActionResult;
26
+ state?: AppState;
27
+ }>;
28
+ /** The chord that selects everything in a text field on this platform. */
29
+ readonly selectAll: string;
30
+ readonly signal: AbortSignal;
31
+ /** The element a step's target was in an earlier run, when the window still has it, and the way that worked. */
32
+ readonly known?: (step: RunStep, tree: AppTree) => Recalled | undefined;
33
+ /** The lesson a step worded differently is probably about; used only once Jev agrees it is the same element. */
34
+ readonly guess?: (step: RunStep, tree: AppTree) => Recalled | undefined;
35
+ /**
36
+ * Several actions in one request, settling briefly between them and fully once at the end; it stops at the first
37
+ * one not delivered. Absent where the helper has none: each action then goes on its own.
38
+ */
39
+ readonly batch?: (actions: readonly ComputerAction[], picture: boolean) => Promise<{
40
+ results: readonly ActionResult[];
41
+ state?: AppState;
42
+ }>;
43
+ /** The lines of text recognized in the window's latest screenshot: a click's last resort when no element is named so. */
44
+ readonly readText?: () => Promise<readonly ShownText[]>;
45
+ }
46
+ export interface StepOutcome {
47
+ readonly status: 'done' | 'verified' | 'skipped' | 'failed';
48
+ /** The element the step was carried out on, as its line in the tree. */
49
+ readonly element?: string;
50
+ readonly attempts: number;
51
+ readonly why?: string;
52
+ /** When no element matched: the lines that came closest. */
53
+ readonly closest?: readonly string[];
54
+ /** What a verified step worked on and which of its ways did it: worth remembering. */
55
+ readonly used?: {
56
+ readonly key: string;
57
+ readonly label: string;
58
+ readonly way: number;
59
+ readonly effect?: readonly string[];
60
+ };
61
+ /** The same for a step that checked nothing itself; kept only when a later step vouches for it. */
62
+ readonly tried?: StepOutcome['used'];
63
+ /** The element came from memory, without asking Jev. */
64
+ readonly recalled?: true;
65
+ /** A remembered element was tried and did not do the step. */
66
+ readonly stale?: true;
67
+ }
68
+ export interface RunReport {
69
+ /** One outcome per step that was started; the run ends at the first failed one. */
70
+ readonly outcomes: readonly StepOutcome[];
71
+ readonly state: AppState;
72
+ readonly asks: number;
73
+ readonly ms: number;
74
+ /** Milliseconds of `ms` spent waiting for Jev, for actions (with their settling) and for looks at the window. */
75
+ readonly time: {
76
+ readonly jev: number;
77
+ readonly act: number;
78
+ readonly look: number;
79
+ };
80
+ }
81
+ /**
82
+ * Steps judged by pixels as well as elements, so the states before and after them come with a picture: a click,
83
+ * which may change only pixels, and a key that expects something, such as selecting text.
84
+ */
85
+ export declare const pictured: (step: RunStep | undefined) => boolean;
86
+ /**
87
+ * Carries out `steps` on one window. Jev finds each element and checks each expectation; code chooses the way to
88
+ * act and the next way when one fails. The run ends at the first step that cannot be done.
89
+ */
90
+ export declare function runSteps(goal: string, steps: readonly RunStep[], initial: AppState, deps: RunDeps): Promise<RunReport>;
91
+ /** The run for the main model: what was done to which element, and where it stopped and why. */
92
+ export declare function describeRun(report: RunReport, steps: readonly RunStep[]): string;
93
+ //# sourceMappingURL=run.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/jev/run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE7D,OAAO,EAAoB,KAAK,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE7E,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAuD,KAAK,UAAU,EAAE,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAChH,OAAO,EAAY,KAAK,MAAM,EAAqC,MAAM,YAAY,CAAC;AA6BtF,2GAA2G;AAC3G,sFAAsF;AACtF,MAAM,WAAW,QAAQ;IAAG,QAAQ,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;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