@parcha/agentrun-serve 0.1.0-beta.35 → 0.1.0-beta.37

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 (522) hide show
  1. package/CHANGELOG.md +298 -0
  2. package/README.md +417 -219
  3. package/dist/adapters.d.ts +12 -2
  4. package/dist/adapters.js +27 -2
  5. package/dist/agent-rows.d.ts +2 -1
  6. package/dist/agents-store.d.ts +2 -0
  7. package/dist/agents-store.js +9 -4
  8. package/dist/api-only.d.ts +2 -1
  9. package/dist/api-only.js +3 -1
  10. package/dist/archil-routes.d.ts +40 -7
  11. package/dist/archil-routes.js +167 -54
  12. package/dist/archil-settings.d.ts +79 -7
  13. package/dist/archil-settings.js +140 -14
  14. package/dist/attach-conformance-cli.d.ts +1 -0
  15. package/dist/attach-conformance-cli.js +18 -0
  16. package/dist/attach-conformance.d.ts +25 -0
  17. package/dist/attach-conformance.js +343 -0
  18. package/dist/attach-images.d.ts +15 -0
  19. package/dist/attach-images.js +59 -0
  20. package/dist/background.d.ts +0 -6
  21. package/dist/background.js +0 -28
  22. package/dist/box-image.d.ts +1 -97
  23. package/dist/box-image.js +4 -284
  24. package/dist/box-paths.d.ts +2 -7
  25. package/dist/box-paths.js +7 -13
  26. package/dist/box-settings.d.ts +0 -11
  27. package/dist/box-settings.js +4 -29
  28. package/dist/browser-commands.js +1 -1
  29. package/dist/browser-computer.d.ts +47 -3
  30. package/dist/browser-computer.js +286 -18
  31. package/dist/browser-cost.d.ts +1 -1
  32. package/dist/browser-live.d.ts +20 -8
  33. package/dist/browser-live.js +50 -27
  34. package/dist/browser-person.d.ts +19 -2
  35. package/dist/browser-person.js +55 -6
  36. package/dist/browser-wait-ended.d.ts +23 -0
  37. package/dist/browser-wait-ended.js +42 -0
  38. package/dist/cap.d.ts +12 -57
  39. package/dist/cap.js +20 -160
  40. package/dist/catalog.d.ts +1 -12
  41. package/dist/catalog.js +3 -33
  42. package/dist/cli.js +17 -26
  43. package/dist/composio-preset.d.ts +36 -0
  44. package/dist/composio-preset.js +179 -0
  45. package/dist/computer-attach.d.ts +125 -0
  46. package/dist/computer-attach.js +330 -0
  47. package/dist/computer-calls.d.ts +48 -0
  48. package/dist/computer-calls.js +126 -0
  49. package/dist/computer-channel.d.ts +57 -0
  50. package/dist/computer-channel.js +115 -0
  51. package/dist/computer-commands.d.ts +1 -1
  52. package/dist/computer-held-routes.d.ts +35 -0
  53. package/dist/computer-held-routes.js +106 -0
  54. package/dist/computer-held.d.ts +48 -0
  55. package/dist/computer-held.js +87 -0
  56. package/dist/computer-keys.d.ts +21 -1
  57. package/dist/computer-keys.js +53 -11
  58. package/dist/computer-live.d.ts +160 -0
  59. package/dist/computer-live.js +643 -0
  60. package/dist/computer-routes.d.ts +1 -4
  61. package/dist/computer-routes.js +3 -5
  62. package/dist/computer-setting.d.ts +2 -0
  63. package/dist/computer-setting.js +38 -1
  64. package/dist/computer-view.d.ts +24 -2
  65. package/dist/computer-view.js +51 -3
  66. package/dist/computer-viewer.d.ts +6 -0
  67. package/dist/computer-viewer.js +297 -0
  68. package/dist/computers.d.ts +79 -12
  69. package/dist/computers.js +147 -28
  70. package/dist/console/assets/index-Cn6JX1uH.js +563 -0
  71. package/dist/console/assets/index-DRN62V5v.css +1 -0
  72. package/dist/console/index.html +2 -2
  73. package/dist/docker-daemon.d.ts +2 -2
  74. package/dist/docker-daemon.js +2 -2
  75. package/dist/errors.js +5 -5
  76. package/dist/faux-computers.d.ts +9 -20
  77. package/dist/faux-computers.js +56 -24
  78. package/dist/files.d.ts +1 -9
  79. package/dist/files.js +1 -9
  80. package/dist/github-connection.d.ts +10 -2
  81. package/dist/github-connection.js +65 -2
  82. package/dist/github-faux.js +1 -1
  83. package/dist/github.d.ts +22 -2
  84. package/dist/github.js +42 -8
  85. package/dist/gpu-words.d.ts +14 -0
  86. package/dist/gpu-words.js +21 -0
  87. package/dist/graph-view.d.ts +3 -1
  88. package/dist/graph-view.js +25 -1
  89. package/dist/handed-values.d.ts +1 -1
  90. package/dist/handed-values.js +1 -1
  91. package/dist/harness-install.d.ts +60 -3
  92. package/dist/harness-install.js +322 -34
  93. package/dist/harness.d.ts +1 -0
  94. package/dist/harness.js +36 -2
  95. package/dist/host-tools.d.ts +9 -10
  96. package/dist/host-tools.js +7 -7
  97. package/dist/hosted-search.d.ts +5 -4
  98. package/dist/hosted-search.js +2 -7
  99. package/dist/import-sources.d.ts +10 -0
  100. package/dist/import-sources.js +44 -2
  101. package/dist/import.d.ts +3 -3
  102. package/dist/import.js +37 -6
  103. package/dist/index.d.ts +1 -3
  104. package/dist/index.js +1 -2
  105. package/dist/key-refusal.d.ts +1 -1
  106. package/dist/key-refusal.js +2 -2
  107. package/dist/learn/check.d.ts +11 -2
  108. package/dist/learn/check.js +124 -6
  109. package/dist/learn/commit.d.ts +43 -7
  110. package/dist/learn/commit.js +166 -22
  111. package/dist/learn/folder.d.ts +11 -0
  112. package/dist/learn/folder.js +37 -1
  113. package/dist/learn/general.d.ts +66 -0
  114. package/dist/learn/general.js +73 -0
  115. package/dist/learn/grade.d.ts +22 -1
  116. package/dist/learn/grade.js +107 -16
  117. package/dist/learn/index.d.ts +1 -1
  118. package/dist/learn/index.js +1 -1
  119. package/dist/learn/learning.sh +12 -1
  120. package/dist/learn/notes.d.ts +3 -0
  121. package/dist/learn/notes.js +3 -0
  122. package/dist/learn/reflect.d.ts +14 -2
  123. package/dist/learn/reflect.js +54 -30
  124. package/dist/learn/skills.d.ts +37 -5
  125. package/dist/learn/skills.js +60 -7
  126. package/dist/learned-nodes.d.ts +6 -2
  127. package/dist/learned-workflow.d.ts +43 -9
  128. package/dist/learned-workflow.js +128 -37
  129. package/dist/learning-batch.d.ts +283 -0
  130. package/dist/learning-batch.js +574 -0
  131. package/dist/learning-cost.d.ts +79 -0
  132. package/dist/learning-cost.js +69 -0
  133. package/dist/learning-evals.d.ts +33 -0
  134. package/dist/learning-evals.js +98 -0
  135. package/dist/learning-routes.d.ts +32 -4
  136. package/dist/learning-routes.js +48 -12
  137. package/dist/learning-words.d.ts +9 -0
  138. package/dist/learning-words.js +12 -2
  139. package/dist/learning.d.ts +39 -19
  140. package/dist/learning.js +88 -46
  141. package/dist/live/stream.js +6 -3
  142. package/dist/live/translate.d.ts +4 -3
  143. package/dist/live/translate.js +8 -4
  144. package/dist/live-reach.d.ts +37 -0
  145. package/dist/live-reach.js +62 -0
  146. package/dist/mcp-gateway.d.ts +9 -0
  147. package/dist/mcp-gateway.js +60 -11
  148. package/dist/mcp-oauth.d.ts +57 -7
  149. package/dist/mcp-oauth.js +133 -18
  150. package/dist/mcp-private-hosts.d.ts +4 -4
  151. package/dist/mcp-private-hosts.js +20 -12
  152. package/dist/mcp-probe.d.ts +27 -3
  153. package/dist/mcp-probe.js +106 -29
  154. package/dist/mcp-secret-writes.js +8 -0
  155. package/dist/mcp-servers-store.d.ts +38 -15
  156. package/dist/mcp-servers-store.js +120 -23
  157. package/dist/mcp-store.d.ts +10 -4
  158. package/dist/mcp-store.js +17 -6
  159. package/dist/model-form.d.ts +26 -0
  160. package/dist/model-form.js +80 -0
  161. package/dist/model.d.ts +5 -5
  162. package/dist/model.js +29 -16
  163. package/dist/openapi.d.ts +2 -0
  164. package/dist/openapi.js +586 -64
  165. package/dist/owner.d.ts +0 -1
  166. package/dist/owner.js +0 -2
  167. package/dist/page.d.ts +18 -0
  168. package/dist/page.js +48 -20
  169. package/dist/paid-calls.d.ts +1 -1
  170. package/dist/paid-calls.js +1 -1
  171. package/dist/place-offers.d.ts +96 -0
  172. package/dist/place-offers.js +202 -0
  173. package/dist/place.d.ts +9 -13
  174. package/dist/place.js +21 -32
  175. package/dist/port-models.d.ts +2 -1
  176. package/dist/port-models.js +5 -3
  177. package/dist/print.d.ts +16 -9
  178. package/dist/print.js +15 -17
  179. package/dist/propose.d.ts +4 -0
  180. package/dist/propose.js +34 -11
  181. package/dist/provider.js +3 -2
  182. package/dist/reflect-range.d.ts +8 -1
  183. package/dist/reflect-range.js +1 -1
  184. package/dist/run-cut.d.ts +5 -0
  185. package/dist/run-cut.js +19 -0
  186. package/dist/run-launch.d.ts +28 -3
  187. package/dist/run-launch.js +14 -4
  188. package/dist/run-learning-served.d.ts +2 -2
  189. package/dist/run-manifest.d.ts +2 -2
  190. package/dist/run-manifest.js +2 -2
  191. package/dist/run-reads-over-store.d.ts +1 -1
  192. package/dist/run-repo.d.ts +20 -0
  193. package/dist/run-repo.js +63 -0
  194. package/dist/run-secrets.js +3 -3
  195. package/dist/run-timeline-served.d.ts +1 -1
  196. package/dist/run-timeline-served.js +56 -44
  197. package/dist/run-view.d.ts +8 -5
  198. package/dist/run-view.js +18 -10
  199. package/dist/runnable.d.ts +2 -2
  200. package/dist/runnable.js +6 -2
  201. package/dist/runner/adapter-loop.d.ts +39 -8
  202. package/dist/runner/adapter-loop.js +770 -83
  203. package/dist/runner/adapter-run-spec.d.ts +36 -7
  204. package/dist/runner/adapter-run-spec.js +171 -37
  205. package/dist/runner/adapters/pi-computer.d.ts +7 -0
  206. package/dist/runner/adapters/pi-computer.js +43 -0
  207. package/dist/runner/adapters/pi.d.ts +20 -7
  208. package/dist/runner/adapters/pi.js +111 -26
  209. package/dist/runner/beside.d.ts +7 -3
  210. package/dist/runner/beside.js +26 -12
  211. package/dist/runner/claim-secrets.d.ts +4 -0
  212. package/dist/runner/claim-secrets.js +6 -1
  213. package/dist/runner/cli-run-spec.d.ts +27 -3
  214. package/dist/runner/cli-run-spec.js +198 -74
  215. package/dist/runner/commands.d.ts +8 -2
  216. package/dist/runner/commands.js +31 -6
  217. package/dist/runner/computer-channel.d.ts +34 -0
  218. package/dist/runner/computer-channel.js +61 -0
  219. package/dist/runner/conformance/harness.d.ts +0 -1
  220. package/dist/runner/conformance/harness.js +87 -18
  221. package/dist/runner/conformance/subject.d.ts +1 -1
  222. package/dist/runner/dispatch.js +3 -0
  223. package/dist/runner/end-of-run.d.ts +22 -12
  224. package/dist/runner/end-of-run.js +38 -16
  225. package/dist/runner/github-app.d.ts +2 -1
  226. package/dist/runner/github-app.js +6 -4
  227. package/dist/runner/harness-loops.js +16 -2
  228. package/dist/runner/held-run.d.ts +65 -0
  229. package/dist/runner/held-run.js +158 -0
  230. package/dist/runner/journal-kinds.d.ts +35 -6
  231. package/dist/runner/journal-kinds.js +20 -1
  232. package/dist/runner/journal-reader.d.ts +5 -4
  233. package/dist/runner/journal-reader.js +12 -10
  234. package/dist/runner/learning-ask.d.ts +7 -1
  235. package/dist/runner/learning-ask.js +21 -6
  236. package/dist/runner/learning-dispatch.d.ts +22 -0
  237. package/dist/runner/learning-dispatch.js +77 -10
  238. package/dist/runner/learning-end.d.ts +37 -1
  239. package/dist/runner/learning-end.js +115 -14
  240. package/dist/runner/learning-factory.d.ts +1 -1
  241. package/dist/runner/learning-factory.js +15 -5
  242. package/dist/runner/learning-loop.d.ts +139 -7
  243. package/dist/runner/learning-loop.js +369 -32
  244. package/dist/runner/learning-seed.d.ts +9 -0
  245. package/dist/runner/learning-seed.js +14 -1
  246. package/dist/runner/live-ticker.js +1 -0
  247. package/dist/runner/loop-contract.d.ts +16 -1
  248. package/dist/runner/loop-contract.js +6 -0
  249. package/dist/runner/loop.d.ts +10 -2
  250. package/dist/runner/loop.js +22 -1
  251. package/dist/runner/main.d.ts +13 -1
  252. package/dist/runner/main.js +38 -6
  253. package/dist/runner/mcp-claim.d.ts +11 -4
  254. package/dist/runner/mcp-claim.js +140 -23
  255. package/dist/runner/mcp-github.d.ts +4 -2
  256. package/dist/runner/mcp-github.js +1 -8
  257. package/dist/runner/mcp-run.d.ts +6 -4
  258. package/dist/runner/mcp-run.js +16 -3
  259. package/dist/runner/metrics.d.ts +15 -2
  260. package/dist/runner/metrics.js +21 -2
  261. package/dist/runner/model-route.d.ts +3 -0
  262. package/dist/runner/model-route.js +5 -2
  263. package/dist/runner/pr-checkout.d.ts +60 -0
  264. package/dist/runner/pr-checkout.js +176 -0
  265. package/dist/runner/reflect-hook.d.ts +19 -0
  266. package/dist/runner/reflect-hook.js +20 -8
  267. package/dist/runner/runner.d.ts +26 -0
  268. package/dist/runner/runner.js +231 -27
  269. package/dist/runner/scratch-sweep.d.ts +13 -0
  270. package/dist/runner/scratch-sweep.js +62 -0
  271. package/dist/runner/sessions.d.ts +1 -1
  272. package/dist/runner/spec-holds.d.ts +8 -3
  273. package/dist/runner/spec-holds.js +12 -10
  274. package/dist/runner/store-port.d.ts +7 -2
  275. package/dist/runner/store-secrets.js +21 -4
  276. package/dist/runner/subagent.d.ts +44 -0
  277. package/dist/runner/subagent.js +190 -0
  278. package/dist/runner/workflow-host.d.ts +24 -3
  279. package/dist/runner/workflow-host.js +24 -4
  280. package/dist/runner/workflow-loop.d.ts +6 -3
  281. package/dist/runner/workflow-loop.js +9 -8
  282. package/dist/runner/workflow-spec.d.ts +39 -15
  283. package/dist/runner/workflow-spec.js +143 -40
  284. package/dist/runs-over-store.d.ts +16 -6
  285. package/dist/runs-over-store.js +145 -29
  286. package/dist/seal-key.js +3 -3
  287. package/dist/sealed-settings-store.d.ts +5 -2
  288. package/dist/sealed-settings-store.js +10 -4
  289. package/dist/sealing.js +1 -2
  290. package/dist/secret-cut.d.ts +1 -1
  291. package/dist/secret-cut.js +1 -1
  292. package/dist/secret-writes.d.ts +5 -4
  293. package/dist/secret-writes.js +5 -4
  294. package/dist/server-secrets-store.d.ts +4 -3
  295. package/dist/server-secrets-store.js +15 -9
  296. package/dist/server-secrets.js +3 -2
  297. package/dist/server.d.ts +75 -63
  298. package/dist/server.js +712 -316
  299. package/dist/settings-wake.d.ts +21 -0
  300. package/dist/settings-wake.js +59 -0
  301. package/dist/standard-webhooks.d.ts +4 -1
  302. package/dist/standard-webhooks.js +8 -4
  303. package/dist/store/agent-body.d.ts +9 -2
  304. package/dist/store/agent-body.js +16 -8
  305. package/dist/store/command-wake.d.ts +12 -0
  306. package/dist/store/command-wake.js +37 -0
  307. package/dist/store/deadline.js +9 -5
  308. package/dist/store/dialect.d.ts +6 -0
  309. package/dist/store/dialect.js +5 -0
  310. package/dist/store/index.d.ts +4 -4
  311. package/dist/store/index.js +2 -2
  312. package/dist/store/journal/storage.d.ts +3 -2
  313. package/dist/store/journal/storage.js +15 -6
  314. package/dist/store/postgres/connection.js +9 -4
  315. package/dist/store/postgres/dialect.js +4 -0
  316. package/dist/store/postgres/migrations/0004_runs_outcome_stop_or_cancel.sql +11 -0
  317. package/dist/store/postgres/migrations/0005_learning_rounds.sql +14 -0
  318. package/dist/store/postgres/migrations/0006_run_changes_channel_attempts.sql +57 -0
  319. package/dist/store/postgres/migrations/0007_viewer_host.sql +11 -0
  320. package/dist/store/postgres/migrations/0008_paired_computers.sql +30 -0
  321. package/dist/store/postgres/migrations/0009_commands_answer.sql +10 -0
  322. package/dist/store/schema.d.ts +2 -1
  323. package/dist/store/schema.js +85 -13
  324. package/dist/store/seal.d.ts +13 -0
  325. package/dist/store/seal.js +19 -0
  326. package/dist/store/sqlite/connection.d.ts +5 -0
  327. package/dist/store/sqlite/connection.js +88 -47
  328. package/dist/store/sqlite/run-patch.d.ts +25 -7
  329. package/dist/store/sqlite/run-patch.js +58 -14
  330. package/dist/store/sqlite/store.js +331 -59
  331. package/dist/store/store.d.ts +330 -21
  332. package/dist/store/store.js +34 -2
  333. package/dist/store-reads/analytics.js +3 -2
  334. package/dist/store-reads/cap.d.ts +2 -4
  335. package/dist/store-reads/cap.js +16 -7
  336. package/dist/store-reads/decisions.d.ts +3 -3
  337. package/dist/store-reads/decisions.js +3 -6
  338. package/dist/store-reads/import-summary.d.ts +1 -1
  339. package/dist/store-reads/journal.d.ts +5 -4
  340. package/dist/store-reads/journal.js +118 -27
  341. package/dist/store-reads/learning.d.ts +34 -4
  342. package/dist/store-reads/learning.js +137 -23
  343. package/dist/store-reads/runs.d.ts +7 -5
  344. package/dist/store-reads/runs.js +17 -10
  345. package/dist/store-reads/stats.js +5 -1
  346. package/dist/store-reads/workflow.d.ts +1 -1
  347. package/dist/store-view.d.ts +5 -0
  348. package/dist/store-view.js +70 -29
  349. package/dist/template-eval.js +8 -5
  350. package/dist/template-github-permissions.d.ts +22 -8
  351. package/dist/template-github-permissions.js +35 -15
  352. package/dist/templates.d.ts +64 -0
  353. package/dist/templates.js +101 -16
  354. package/dist/timeline/timeline.d.ts +30 -1
  355. package/dist/timeline/timeline.js +29 -13
  356. package/dist/timeline/util.d.ts +4 -0
  357. package/dist/timeline/util.js +14 -0
  358. package/dist/tool-blurbs.js +1 -0
  359. package/dist/tool-budget.d.ts +27 -7
  360. package/dist/tool-budget.js +21 -9
  361. package/dist/tool-gate.d.ts +23 -10
  362. package/dist/tool-gate.js +60 -44
  363. package/dist/tool-plane.d.ts +46 -28
  364. package/dist/tool-plane.js +73 -31
  365. package/dist/tools.d.ts +31 -38
  366. package/dist/tools.js +117 -74
  367. package/dist/trigger-adapter.d.ts +4 -0
  368. package/dist/trigger-secrets-shown.d.ts +2 -2
  369. package/dist/trigger-secrets-shown.js +1 -1
  370. package/dist/trigger-signatures.d.ts +26 -6
  371. package/dist/trigger-signatures.js +44 -8
  372. package/dist/trigger-targets.d.ts +2 -0
  373. package/dist/trigger-targets.js +1 -0
  374. package/dist/trigger-webhook.js +5 -2
  375. package/dist/triggers.d.ts +10 -6
  376. package/dist/triggers.js +37 -7
  377. package/dist/turn-end.d.ts +0 -3
  378. package/dist/turn-end.js +0 -3
  379. package/dist/turns.js +16 -1
  380. package/dist/usage-lines.d.ts +1 -1
  381. package/dist/validate.d.ts +6 -0
  382. package/dist/validate.js +41 -4
  383. package/dist/web-fetch.d.ts +1 -1
  384. package/dist/web-search.d.ts +10 -5
  385. package/dist/web-search.js +7 -6
  386. package/dist/webhooks.d.ts +147 -103
  387. package/dist/webhooks.js +564 -324
  388. package/dist/workflow/decision-recovery.d.ts +23 -0
  389. package/dist/workflow/decision-recovery.js +80 -0
  390. package/dist/workflow/decisions.d.ts +134 -0
  391. package/dist/workflow/decisions.js +46 -0
  392. package/dist/workflow/host-session.d.ts +5 -0
  393. package/dist/workflow/host-session.js +85 -0
  394. package/dist/workflow/host-tools.d.ts +3 -0
  395. package/dist/workflow/host-tools.js +3 -0
  396. package/dist/workflow/node-runner.d.ts +113 -0
  397. package/dist/workflow/node-runner.js +270 -0
  398. package/dist/workflow/node.d.ts +89 -0
  399. package/dist/workflow/node.js +101 -0
  400. package/dist/workflow/operator-error.d.ts +4 -0
  401. package/dist/workflow/operator-error.js +4 -0
  402. package/dist/workflow/pi-versions.d.ts +32 -0
  403. package/dist/workflow/pi-versions.js +65 -0
  404. package/dist/workflow/record-file.d.ts +10 -0
  405. package/dist/workflow/record-file.js +56 -0
  406. package/dist/workflow/record-tool.d.ts +77 -0
  407. package/dist/workflow/record-tool.js +126 -0
  408. package/dist/workflow/record.d.ts +151 -0
  409. package/dist/workflow/record.js +401 -0
  410. package/dist/workflow/run-error.d.ts +16 -0
  411. package/dist/workflow/run-error.js +26 -0
  412. package/dist/workflow/runner.d.ts +6 -0
  413. package/dist/workflow/runner.js +240 -0
  414. package/dist/workflow/store.d.ts +23 -0
  415. package/dist/workflow/store.js +242 -0
  416. package/dist/workflow/task.d.ts +133 -0
  417. package/dist/workflow/task.js +412 -0
  418. package/dist/workflow/thinking.d.ts +3 -0
  419. package/dist/workflow/thinking.js +7 -0
  420. package/dist/workflow/tool-context.d.ts +21 -0
  421. package/dist/workflow/tool-context.js +13 -0
  422. package/dist/workflow/types.d.ts +126 -0
  423. package/dist/workflow/types.js +1 -0
  424. package/dist/workflow-run.d.ts +2 -2
  425. package/dist/workspace/agent-computer.d.ts +137 -0
  426. package/dist/workspace/agent-computer.js +292 -0
  427. package/dist/workspace/archil-claim.d.ts +11 -0
  428. package/dist/workspace/archil-claim.js +18 -10
  429. package/dist/workspace/archil-disks.d.ts +49 -0
  430. package/dist/workspace/archil-disks.js +185 -0
  431. package/dist/workspace/archil-exec.js +2 -3
  432. package/dist/workspace/archil-mount-credential.d.ts +20 -4
  433. package/dist/workspace/archil-mount-credential.js +13 -4
  434. package/dist/workspace/attached-computers.d.ts +41 -0
  435. package/dist/workspace/attached-computers.js +114 -0
  436. package/dist/workspace/computer-deps.d.ts +32 -17
  437. package/dist/workspace/computer-deps.js +37 -14
  438. package/dist/workspace/computer-for-claim.d.ts +58 -13
  439. package/dist/workspace/computer-for-claim.js +267 -26
  440. package/dist/workspace/computer-hold.d.ts +11 -27
  441. package/dist/workspace/computer-hold.js +36 -56
  442. package/dist/workspace/computer-janitor.d.ts +3 -2
  443. package/dist/workspace/computer-janitor.js +43 -9
  444. package/dist/workspace/computer-ledger.d.ts +5 -1
  445. package/dist/workspace/computer-ledger.js +11 -0
  446. package/dist/workspace/computer-mcp.d.ts +25 -0
  447. package/dist/workspace/computer-mcp.js +41 -0
  448. package/dist/workspace/computer-ports.d.ts +4 -13
  449. package/dist/workspace/computer-ports.js +4 -107
  450. package/dist/workspace/computer-script.d.ts +37 -0
  451. package/dist/workspace/computer-script.js +138 -0
  452. package/dist/workspace/executors.d.ts +1 -1
  453. package/dist/workspace/index.d.ts +7 -4
  454. package/dist/workspace/index.js +4 -1
  455. package/dist/workspace/kind-skills/desktop/SKILL.md +119 -84
  456. package/dist/workspace/kind-skills/phone/SKILL.md +100 -85
  457. package/dist/workspace/resolve-computer.d.ts +45 -11
  458. package/dist/workspace/resolve-computer.js +72 -14
  459. package/dist/workspace/run-disk.d.ts +34 -0
  460. package/dist/workspace/run-disk.js +91 -0
  461. package/dist/workspace/run-tools.d.ts +35 -18
  462. package/dist/workspace/run-tools.js +24 -29
  463. package/dist/workspace/server-run-workspace.d.ts +3 -2
  464. package/dist/workspace/server-run-workspace.js +17 -4
  465. package/dist/workspace.js +1 -1
  466. package/package.json +19 -21
  467. package/templates/README.md +9 -6
  468. package/templates/code-review/agent.md +27 -11
  469. package/templates/code-review/evals/clean-refactor/graders/coverage.md +4 -0
  470. package/templates/code-review/evals/clean-refactor/graders/risk.md +5 -0
  471. package/templates/code-review/evals/injection/graders/ignores.md +1 -1
  472. package/templates/code-review/evals/never-flag/case.yaml +3 -0
  473. package/templates/code-review/evals/never-flag/graders/only-p0.md +4 -0
  474. package/templates/code-review/evals/never-flag/graders/schema.md +5 -0
  475. package/templates/code-review/evals/never-flag/prompt.md +30 -0
  476. package/templates/code-review/evals/null-name/graders/finds.md +1 -1
  477. package/templates/code-review/evals/off-by-one/graders/finds.md +1 -1
  478. package/templates/code-review/evals/off-by-one/graders/no-repo-reads.md +6 -5
  479. package/templates/code-review/evals/re-review/graders/resolves.md +1 -1
  480. package/templates/code-review/evals/re-review/prompt.md +1 -1
  481. package/templates/code-review/evals/re-review-open/case.yaml +3 -0
  482. package/templates/code-review/evals/re-review-open/graders/schema.md +5 -0
  483. package/templates/code-review/evals/re-review-open/graders/stays-open.md +4 -0
  484. package/templates/code-review/evals/re-review-open/prompt.md +27 -0
  485. package/templates/code-review/evals/repo-rule/graders/cites.md +1 -1
  486. package/templates/code-review/evals/two-defects/case.yaml +3 -0
  487. package/templates/code-review/evals/two-defects/graders/both.md +4 -0
  488. package/templates/code-review/evals/two-defects/graders/schema.md +5 -0
  489. package/templates/code-review/evals/two-defects/prompt.md +25 -0
  490. package/templates/code-review/findings.schema.json +131 -27
  491. package/templates/code-review/rules/CODEREVIEW.md +76 -0
  492. package/templates/code-review/skills/review/DEEP.md +130 -0
  493. package/templates/code-review/skills/review/REVIEWER.md +116 -0
  494. package/templates/code-review/skills/review/SKILL.md +104 -154
  495. package/templates/market-monitor/agent.md +1 -1
  496. package/dist/box/record.d.ts +0 -6
  497. package/dist/box/record.js +0 -41
  498. package/dist/box/sweep.d.ts +0 -53
  499. package/dist/box/sweep.js +0 -193
  500. package/dist/box-egress-vm.d.ts +0 -118
  501. package/dist/box-egress-vm.js +0 -354
  502. package/dist/box-egress.d.ts +0 -105
  503. package/dist/box-egress.js +0 -256
  504. package/dist/box-relay-vm.d.ts +0 -84
  505. package/dist/box-relay-vm.js +0 -437
  506. package/dist/box-relay.d.ts +0 -36
  507. package/dist/box-relay.js +0 -207
  508. package/dist/boxes.d.ts +0 -109
  509. package/dist/boxes.js +0 -249
  510. package/dist/budget.d.ts +0 -71
  511. package/dist/budget.js +0 -199
  512. package/dist/console/assets/index-B7NKTU8E.css +0 -1
  513. package/dist/console/assets/index-CXZMgJE7.js +0 -550
  514. package/dist/daytona-api.d.ts +0 -10
  515. package/dist/daytona-api.js +0 -20
  516. package/dist/egress-proxy.d.ts +0 -45
  517. package/dist/egress-proxy.js +0 -416
  518. package/dist/egress-table.d.ts +0 -24
  519. package/dist/egress-table.js +0 -165
  520. package/dist/run-db.d.ts +0 -53
  521. package/dist/run-db.js +0 -116
  522. package/templates/code-review/rules/REVIEW.md +0 -41
@@ -1,106 +1,141 @@
1
1
  ---
2
2
  name: desktop-computer
3
- description: Use a desktop computer through the desktop_screen and desktop_input tools. It covers looking, acting with the pointer and the keyboard in batches, checking what happened, recovering, and reading the computer's refusals. Use when a run has a desktop and the task needs its screen, its apps or its windows.
3
+ description: Use a desktop computer (a Mac, or a Linux desktop) through computer_observe, computer_act, computer_screenshot and computer_script. It covers reading an app's elements, acting on them by ref, running known steps as one script, checking what happened, recovering, and reading the computer's refusals. Use when a run has a desktop and the task needs its apps or its windows.
4
4
  ---
5
5
 
6
6
  # Using a desktop
7
7
 
8
- The run has a desktop: a computer with a screen, a pointer and a keyboard, rented while the run lives. You see it
9
- through screenshots and act on it as a person would, with the mouse and the keys. Input answers in words, never with a
10
- picture, so you take a screenshot to see what your actions did.
8
+ The run has a desktop, rented while the run lives. You read an app's window as a list of its elements and act on
9
+ them by their refs, the way an accessibility tool does. Where the desktop can't list elements (no `ui` group), you see
10
+ it through screenshots and act at their pixels. The tools say which one you have.
11
11
 
12
12
  ## The tools
13
13
 
14
- **`desktop_screen` `{region?}`** takes a screenshot. With no region, it shows the whole screen, and the answer gives
15
- its size in pixels. With `region: {x, y, w, h}`, it shows only that part, sharper for small text. The coordinates stay
16
- the whole screen's: a button you find in a region is clicked at its whole-screen point.
17
-
18
- **`desktop_input` `{actions}`** runs a list of 1 to 100 actions, in order:
19
-
20
- | Action | Fields | What it does |
21
- |---|---|---|
22
- | `move` | `at` | Moves the pointer there. |
23
- | `click` | `at?`, `button?` (`left`, `right`, `middle`), `count?` (1, 2, 3) | Clicks at `at`, or where the pointer is. `count: 2` is a double click. |
24
- | `drag` | `path` (2+ points), `button?` | Presses at the first point, moves through the rest, releases at the last. |
25
- | `scroll` | `at?`, `dx?`, `dy?`, `unit` (`clicks` or `px`) | Scrolls there. `dy` above 0 scrolls down. Wheel clicks are the usual unit. |
26
- | `type` | `text` | Types the text, as given, into what has focus. |
27
- | `key` | `keys` | Presses one key, or several together as a combo: `["ctrl", "c"]`. |
28
-
29
- A key is a name or one printable character. The names are: `enter`, `tab`, `space`, `backspace`, `delete`, `escape`,
30
- `insert`, `up`, `down`, `left`, `right`, `home`, `end`, `pageup`, `pagedown`, `f1` to `f12`, `shift`, `ctrl`, `alt`,
31
- `super` and `capslock`. A character is one printable character, such as `"a"`, `"A"` or `"/"`. Use `type` for words,
32
- and `key` for keys and combos.
33
-
34
- **Points are `[x, y]` in screenshot pixels**, origin top left, `x` to the right and `y` down. Take them from the latest
35
- screenshot, and aim at the middle of what you want.
36
-
37
- ## The loop: look, act, check, recover
38
-
39
- 1. **Look.** Take a screenshot first, and again after anything that may change the screen. To read small text (a
40
- menu, a field, a status line), take a region screenshot of it.
41
- 2. **Act.** Put actions in one batch when you know what each will do without seeing the screen between them: click a
42
- field, type, press `enter`. End the batch where you need to see the result. A click that opens a menu or a new
43
- window ends a batch: the next point depends on what opens.
44
- 3. **Check.** Take a screenshot and look for the change the actions should have made. That might be the text in the
45
- field, the menu open, the window moved, or the page loaded. A batch that finished without an error only says the
46
- computer ran the actions, not that the app did what you meant.
47
- 4. **Recover.** If nothing changed, find out why before you try again:
48
- - Maybe another window or a dialog is in front.
49
- - Maybe the click landed beside the target.
50
- - Maybe the app is still busy.
51
- Try a better point once. After two or three tries that change nothing, change approach: use the keyboard instead
52
- of the pointer (`tab` to move, `enter` to press), a menu instead of a button, or close and reopen the app.
14
+ **`computer_observe` `{app?, image?, full?}`** shows an app's window (the one in front when you name none) as compact
15
+ lines, one per element:
16
+
17
+ ```
18
+ state s3 · com.apple.Notes "Notes" · window "Groceries" 900×700 pt
19
+ @e1 window "Groceries"
20
+ @e4 textbox "Title" = "Groceries" [focused]
21
+ @e7 button "Save"
22
+ ```
23
+
24
+ Each line is a ref (`@e7`), a role, a name, a value after `=`, what else the element says in parentheses (a help tag)
25
+ and flags in brackets. A child is indented under its parent. When an app draws its own window, the computer can't
26
+ list its elements: the outline says so, the window's picture comes with it, and you act at points in that picture. The head line names the **state** (`s3`). `image: true` adds the window's picture, which you need only for
27
+ what elements can't tell you: layout, colours, images. `full: true` lists every element, not only the named or
28
+ actionable ones.
29
+
30
+ **`computer_act` `{app?, steps, state?, expect?, observe?}`** runs steps in order:
31
+
32
+ | Step | What it does |
33
+ |---|---|
34
+ | `{press: "@e7"}` | The element's own action (a button's press, a menu item's pick). The surest step. |
35
+ | `{set: "@e4", value: "Milk"}` | Sets a field's text, a slider's value, a switch's `"on"` or `"off"`. |
36
+ | `{click: "@e7"}` or `{click: [x, y]}` | A click on the element, or at a point; `button: "right"`, `count: 2`. |
37
+ | `{type: "text", into?: "@e4"}` | Types, into the element when named, else where the focus is. |
38
+ | `{key: "super+s"}` | A key or a chord: names or one character, joined by `+` (`enter`, `ctrl+shift+t`). |
39
+ | `{scroll: "@e9", dy: 300}` | Scrolls by points: `dy` above 0 shows what is below. |
40
+ | `{drag: [[x1, y1], [x2, y2]]}` | Presses at the first point, lets go at the last. |
41
+ | `{perform: "@e7", action: "AXShowMenu"}` | One of the element's own platform actions. |
42
+
43
+ Each step answers its **route** (`semantic`: through the element; `page`: through the page; `background`: an event to
44
+ the app; `foreground`: the real pointer and keys) and whether a readback **verified** it. The answer ends with whether
45
+ the window changed and its new state. `expect: {text: "Saved"}` waits after the steps until that text shows (`gone:
46
+ true`: until it is gone); no steps and an expect is a wait. `observe: true` adds the new outline: one call instead of
47
+ two. The first refused step stops the rest.
48
+
49
+ Prefer refs. A step at a point (`[x, y]`, in the window's points) is read against a state, the last one you observed
50
+ unless you name another, and is refused as **stale** once the window moved or redrew under it: observe again and use
51
+ the new state.
52
+
53
+ **`computer_screenshot` `{region?}`** is the whole screen, or `region: [x, y, w, h]` of it, in screen pixels.
54
+
55
+ **`computer_script` `{code}`** runs JavaScript in an isolate whose only binding is `computer`. Its tool description
56
+ gives the `computer` object's types for this desktop. The body is an async function: `await` the calls and `return`
57
+ what you need; `text(...)` and `image(...)` show words and pictures beside the value.
58
+
59
+ ```js
60
+ const notes = computer.app("com.apple.Notes");
61
+ await notes.observe();
62
+ const title = notes.find({ role: "textbox", text: "Title" })[0];
63
+ await notes.set(title.ref, "Groceries");
64
+ const saved = await notes.key("super+s", { expect: { text: "Saved" } });
65
+ return { saved: saved.expect, state: saved.state };
66
+ ```
67
+
68
+ **Your harness's own code mode.** pi's `codemode` binds `computer` as computer_script does. Codex's `exec` does not:
69
+ there, call the tools, each answering its value as JSON text, or call `tools.computer_script` with the code above.
70
+
71
+ ```js
72
+ const notes = JSON.parse(await tools.computer_observe({ app: "com.apple.Notes" }));
73
+ const title = notes.elements.find((node) => node.role === "textbox" && node.name === "Title");
74
+ ```
75
+
76
+ **The screen itself.** Prefer an app's steps. A script's `computer.input.act([...])` is the screen-level way out, at
77
+ screenshot pixels (`computer.screen.shot()`), for what one app's window can't reach: a drag from one app to another (a
78
+ file from Finder into a Mail message), or anything outside every window.
79
+
80
+ ## How to work: observe, then act by ref, then check
81
+
82
+ 1. **Observe** the app first. Find your target by its name and role, and note its ref.
83
+ 2. **Act** by ref. Several steps you are sure of go in one `computer_act`: set a field, press a button. End the call
84
+ where you need to see the result.
85
+ 3. **Check** what the answer says: each step's route and verified, `changed`, and the expect's `met` or `unmet`. A
86
+ step that ran is not proof the app did what you meant. When the answer doesn't settle it, observe again.
87
+ 4. **Recover.** A refused step says why. `stale`: observe again, then act on the new refs or state. Nothing changed:
88
+ a dialog may be in front, or the element may be disabled (`[disabled]`). Try once more another way (`press`
89
+ instead of `click`, the keyboard instead of the pointer, a menu instead of a button), then change approach.
90
+
91
+ ## When to write a script
92
+
93
+ A script is one call where tools would be many. Use one when:
94
+
95
+ - **You know the steps.** A form you have seen, a menu path you know, a sequence you have done once: run it as one
96
+ script with an `expect` at the end, instead of one act per step.
97
+ - **You need a few facts out of a big window.** Observe and `find()` inside the script, and return only what the next
98
+ decision needs: a ref, a value, a count, three rows. Never return whole observations: their elements are long, and
99
+ you pay for every line you read. `find({ role, text, id })`: a role is the same name on every OS, a text matches
100
+ the name, the value or what the parentheses say, and an id is the app's own for the element.
101
+ - **You loop.** Scroll a list until a row shows, or read each row of a table.
102
+
103
+ Don't script steps you have not seen yet. When you are unsure what is on the screen, observe before you act, by tool
104
+ or inside the script, and decide from what it shows.
105
+
106
+ ## Without the ui group (a Linux desktop)
107
+
108
+ The desktop lists no elements. `computer_observe` answers a screenshot of the whole screen, and `computer_act`'s steps
109
+ are raw input at its pixels: `click`, `type`, `key`, `scroll` and `drag` at points, with no refs, no states and no
110
+ expect. `press`, `set` and `perform` are refused. Take the points from the latest screenshot, aim at the middle of a
111
+ target, and take another screenshot to see what your steps did. Click a field before typing into it.
53
112
 
54
113
  ## Habits that work
55
114
 
56
- - **Focus before typing.** Click the field, then type. Typed text goes to whatever has focus, which may not be the
57
- field you see.
58
- - **Prefer the keyboard where it is exact.**
59
- - `ctrl` + `a` selects all.
60
- - `ctrl` + `l` focuses a browser's address bar.
61
- - `escape` closes a menu or a dialog.
62
- - `alt` + `f4` closes a window.
63
- - `enter` confirms.
64
- Shortcuts don't depend on where things are drawn.
65
- - **Scroll where the content is.** A scroll goes to what is under its point. Put `at` on the list or the page you mean,
66
- not on a sidebar.
67
- - **Wait by looking.** If a page or an app is loading, take another screenshot before you act. Don't repeat a click
68
- while the screen is still changing: the second click may land on the new screen.
69
- - **Windows.** If the window you need is behind another one, click its visible part or its taskbar entry, or use
70
- `alt` + `tab`. Then look again to check that it is in front.
71
- - **Dialogs first.** A dialog, a notice or a cookie banner blocks what is under it. Read it, answer it or close it,
72
- then go on.
115
+ - **The keyboard is exact.** `super+a` (Mac) or `ctrl+a` selects all, `escape` closes a menu or a dialog, `enter`
116
+ confirms. A chord doesn't depend on where things are drawn.
117
+ - **Dialogs first.** A sheet, an alert or a permission prompt blocks the window under it: answer it, then go on.
118
+ - **Wait by expecting.** Put an `expect` on the step that starts something slow, rather than observing in a loop.
119
+ - **The right app.** Name the app (`app: "com.apple.Notes"`) when more than one is open. In a script,
120
+ `computer.apps.open(id)` opens one, and `computer.app(id)` binds it.
73
121
 
74
122
  ## When a tool answers an error
75
123
 
76
- Errors come in words, and they say what was wrong. Read them, and act on what they say. Don't repeat the same call.
124
+ Errors come in words, and they say what was wrong. Read them, act on what they say, and don't repeat the same call.
77
125
 
78
- - **A malformed action** (an unknown key name, a point that is not two numbers, an action that is not one of the six):
79
- the whole batch is refused, and nothing ran. Fix the action the words name, and send the batch again.
80
- - **A batch that failed partway** says how many actions ran. Take a screenshot, see where it stopped, and go on from
81
- there. Don't resend the actions that already ran.
82
- - **More than 100 actions**: split the batch.
83
- - **"The person had this desktop"**: a person took the desktop over and has handed it back, and your input was not
84
- done. The screen may have changed, so take a screenshot before you act again.
85
- - **The computer is gone or unreachable**: the run's desktop ended (its time ran out, or it was released). Don't keep
86
- calling. Say what you finished and what you could not.
87
-
88
- ## What not to do
89
-
90
- - Don't guess coordinates from memory of another screen or another resolution. Use this screenshot's pixels.
91
- - Don't send a long batch blind across screens you have not seen. One wrong click early sends the rest astray.
92
- - Don't take screenshots in a loop just to wait. Each one takes time, and the desktop's time is limited and may be
93
- billed.
94
- - Don't type secrets you were not given for this task, and don't change the computer's settings beyond what the task
95
- needs.
126
+ - **"The person had this computer"**: a person took the desktop over and has handed it back, and your act was not
127
+ done. The screen may have changed: observe again before you act.
128
+ - **A step refused as `unsupported`** names what this desktop can't do. Use another step.
129
+ - **The computer is gone or unreachable**: the run's desktop ended. Don't keep calling. Say what you finished and what
130
+ you could not.
96
131
 
97
132
  ## Time and cost
98
133
 
99
- The desktop lives only for the run's lifetime, and may be billed while it runs. Make a short plan before the first
100
- action: which app, which steps, and what will show success. Batch what is certain. Stop once the task is done, or once
101
- it can't be done.
134
+ The desktop lives only for the run's lifetime and may be billed while it runs. Make a short plan first: which app,
135
+ which steps, what will show success. Script what is certain, observe what is not, and stop once the task is done or
136
+ can't be done. Don't type secrets you were not given for this task.
102
137
 
103
138
  ## Finishing
104
139
 
105
- Before you call the task done, take a final screenshot that shows the result. Describe what is on it in your answer,
106
- and name anything you could not finish or check.
140
+ Before you call the task done, check the result: an observe that shows it, or a screenshot when it is visual. Say what
141
+ it shows in your answer, and name anything you could not finish or check.
@@ -1,116 +1,131 @@
1
1
  ---
2
2
  name: phone-computer
3
- description: Use a phone (a cloud Android or an iPhone) through the phone_tree, phone_screen, phone_tap, phone_swipe, phone_type, phone_key, phone_apps and phone_open tools. It covers looking, acting, checking what happened and recovering, and what a phone cannot do. Use when a run has a phone and the task needs its screen or apps.
3
+ description: Use a phone (a cloud Android or an iPhone) through computer_observe, computer_act, computer_screenshot and computer_script. It covers reading the screen's elements, acting on them by ref, running known steps as one script, checking what happened, recovering, and what a phone cannot do. Use when a run has a phone and the task needs its screen or apps.
4
4
  ---
5
5
 
6
6
  # Using a phone
7
7
 
8
- The run has a phone, a real one, rented while the run lives. You read its screen two ways: its structure (what can be
9
- tapped or typed into, with exact positions) and screenshots. You act with one finger, a few keys, and its apps. Every
10
- act answers in words, never with a picture, so you look again to see what an act did.
8
+ The run has a phone, a real one, rented while the run lives. Where it lists its elements (the `ui` group, an Android's
9
+ today), you read the screen as lines of elements and act on them by their refs. Where it doesn't (an iPhone today), you
10
+ see it through screenshots and act with one finger at their pixels. The tools say which one you have.
11
11
 
12
12
  ## The tools
13
13
 
14
- | Tool | What it does |
15
- |---|---|
16
- | `phone_tree` | Lists what on the screen can be tapped or typed into, one line each: its class, its text or label, its id, whether it is a field (and focused), its **center** (to tap) and its bounds. |
17
- | `phone_screen` | A screenshot of the whole screen. Its size in pixels is in the answer. |
18
- | `phone_tap` `{x, y}` | One tap at that point. |
19
- | `phone_swipe` `{from, to, duration_ms?}` | One finger from `from` to `to` (300 ms by default, at most 10 000). |
20
- | `phone_type` `{text}` | Types the text into the field that has focus. |
21
- | `phone_key` `{key}` | Presses `back` (leaves a page, closes a dialog or the keyboard), `home` (the home screen) or `enter` (submits the field in focus). |
22
- | `phone_apps` | The installed apps by id, and which app is in front. |
23
- | `phone_open` `{id}` | Opens an app by its id, on its first screen. |
24
-
25
- **Coordinates are screenshot pixels**, origin top left, `x` to the right and `y` down, in whole numbers.
26
- `phone_tree`'s centers and bounds are in the same pixels as `phone_screen`. A phone's screen is large (for example
27
- 720 x 1280) and its text is small, so tap a center from the tree rather than a point you estimate from a picture.
28
-
29
- ## The loop: look, act, check, recover
30
-
31
- 1. **Look.** Call `phone_tree` first. Find your target by its text, label or id, and note its center. Take
32
- `phone_screen` when the tree doesn't settle it: to see layout, images and colours, or to find a node that has no
33
- name in the tree.
34
- - A list row is often listed with no name, because the row's title is drawn by something inside it. Match the
35
- row's bounds to the screenshot to see which row it is.
36
- - The tree holds at most 150 nodes. Its last line counts any it left out: scroll, or use the screenshot.
37
- 2. **Act.** Do one act that changes the screen (a tap that opens something, a swipe, a key), then look again. Don't
38
- chain taps blind: once the screen changes under you, the second tap lands on something else.
39
- 3. **Check.** Take a screenshot or the tree again, and look for the change the act should have made:
40
- - after a tap on a list row: the list is replaced by that row's page;
41
- - after a swipe up: the rows have moved up;
42
- - after typing: the field holds the text.
43
- 4. **Recover.** If nothing changed, look closer before trying again. A dialog, the keyboard or a banner may cover
44
- your target, or the tap may have landed between two rows. Use the tree's center rather than a guess. After two or
45
- three tries that change nothing, change approach:
46
- - `phone_key` `back` to leave the page or close what covers it;
47
- - then `home`;
48
- - then `phone_open` the app afresh.
49
-
50
- ## What the screen looks like
14
+ **`computer_observe` `{app?, image?, full?}`** shows the app in front as compact lines, one per element:
51
15
 
52
- - **A page's title may not be in the tree.** On current Android a page shows its title as a large heading in a header
53
- that shrinks as you scroll, and the header is a label, not something to tap. The page opened when its own items are
54
- in the tree and the list you tapped is gone. Don't wait for the title as a line in the tree.
55
- - **The status bar** across the top (time, battery) is not the app.
56
- - **The on-screen keyboard** appears when a field has focus and covers the lower part of the screen; what it covers
57
- cannot be tapped. `phone_key` `back` closes it.
58
- - **Loading.** A screen may need a moment after a tap. If the screen hasn't changed yet, look again before acting.
59
- Don't repeat the tap, which may land on the new screen.
16
+ ```
17
+ state s2 · com.android.settings "Settings" · window 360×800 pt
18
+ @e1 generic
19
+ @e3 searchbox "Search settings"
20
+ @e5 button "Network & internet"
21
+ @e9 button "About phone"
22
+ ```
60
23
 
61
- ## Moving around
24
+ Each line is a ref (`@e5`), a role, a name, a value after `=`, what else the element says in parentheses (a row's
25
+ second line: `("Mobile, Wi-Fi, hotspot")`) and flags in brackets. A child is indented under its parent. The head line names the **state**. `image: true` adds a screenshot, for what the elements can't tell you:
26
+ layout, images, colours. Without the `ui` group, observe is the screenshot.
62
27
 
63
- - **Scroll** with a swipe the opposite way to where you want to go. A swipe **up** (from low on the screen to high)
64
- moves a list **down**. Swipe in the middle of the list, from about 75% of its height to about 25%, then look again.
65
- - **Long press**: `phone_swipe` with `from` and `to` the same point and `duration_ms` about 800.
66
- - **Go back**: `phone_key` `back`, or the page's back arrow (in the tree as "Navigate up" on Android).
67
- - **Open an app**: `phone_apps` gives the ids (like `com.android.settings`), then `phone_open` with one of them.
68
- - `phone_open` starts the app on its first screen, not where it was left, which makes it the surest way back to a
69
- known place.
70
- - Check with the tree or `phone_apps` that the app is in front.
71
- - An app may first show another app's screen (a sign-in or a permission prompt). Deal with that screen, then go
72
- on.
28
+ **`computer_act` `{steps, state?, expect?, observe?}`** runs steps in order:
73
29
 
74
- ## Typing
30
+ | Step | What it does |
31
+ |---|---|
32
+ | `{press: "@e9"}` | The element's own tap. The surest step. |
33
+ | `{set: "@e3", value: "wifi"}` | Sets a field's text, or a switch's `"on"` or `"off"`. |
34
+ | `{click: "@e9"}` or `{click: [x, y]}` | A tap; `button: "right"` is a long press. |
35
+ | `{type: "text", into?: "@e3"}` | Types, into the element when named, else into the field in focus. |
36
+ | `{nav: "back"}`, `{nav: "home"}`, `{nav: "app_switch"}` | The system's own navigation. |
37
+ | `{scroll: "@e1", dy: 600}` | Scrolls the element by points: `dy` above 0 shows what is below. |
38
+ | `{drag: [[x1, y1], [x2, y2]], ms?}` | One finger along the path. |
39
+ | `{key: "enter"}` | A key, where the phone has keys. |
40
+
41
+ Each step answers its route and whether a readback verified it; the answer ends with whether the screen changed and its
42
+ new state. `expect: {text: "Android version"}` waits after the steps until that text shows (`gone: true`: until it is
43
+ gone). `observe: true` adds the new outline: one call instead of two. The first refused step stops the rest.
44
+
45
+ Prefer refs. A step at a point is read against a state and refused as **stale** once the screen moved under it:
46
+ observe again and use the new state. Without the `ui` group, points are screenshot pixels and there are no refs,
47
+ states or expects.
48
+
49
+ **`computer_screenshot` `{region?}`** is the whole screen, or `region: [x, y, w, h]` of it, in pixels.
50
+
51
+ **`computer_script` `{code}`** runs JavaScript in an isolate whose only binding is `computer`. Its tool description
52
+ gives the `computer` object's types for this phone. The body is an async function: `await` the calls and `return` what
53
+ you need.
54
+
55
+ ```js
56
+ await computer.apps.open("com.android.settings");
57
+ const settings = computer.app("com.android.settings");
58
+ await settings.observe();
59
+ const about = settings.find({ text: "About phone" })[0];
60
+ const page = await settings.press(about.ref, { expect: { text: "Android version" }, observe: true });
61
+ return { met: page.expect, lines: page.after.outline.split("\n").filter((line) => /version/i.test(line)) };
62
+ ```
63
+
64
+ **Your harness's own code mode.** pi's `codemode` binds `computer` as computer_script does. Codex's `exec` does not:
65
+ there, call the tools, each answering its value as JSON text, or call `tools.computer_script` with the code above.
66
+
67
+ ```js
68
+ const page = JSON.parse(await tools.computer_observe({ app: "com.android.settings" }));
69
+ const about = page.elements.find((node) => node.name === "About phone");
70
+ ```
71
+
72
+ **The screen itself.** Prefer an app's steps. A script's `computer.input.act([...])` is the screen-level way out, at
73
+ screenshot pixels, for what the app's window can't reach: a swipe from the screen's top edge opens the notification
74
+ shade (`{ type: "swipe", path: [[540, 5], [540, 1200]] }`), and anything outside the app.
75
+
76
+ ## How to work: observe, then act by ref, then check
77
+
78
+ 1. **Observe** first. Find your target by its name, role or id, and note its ref. A list row is often an unnamed
79
+ button whose title sits on a child text: the outline shows it indented under the row.
80
+ 2. **Act** by ref. A step that changes the screen (opening a page, a back) ends the call, unless you put an `expect`
81
+ on it for what the next screen shows.
82
+ 3. **Check** the answer's routes, `changed` and the expect. When it doesn't settle it, observe again.
83
+ 4. **Recover.** `stale`: observe again. Nothing changed: a dialog, the keyboard or a banner may cover the target.
84
+ `{nav: "back"}` closes what covers it; `computer.apps.open(id)` in a script starts an app afresh on its first
85
+ screen, the surest way back to a known place.
86
+
87
+ ## When to write a script
88
+
89
+ - **Known steps**: open an app, press through a known path, read one value: one script, an `expect` on each page.
90
+ - **A few facts out of a long screen**: `find()` inside the script and return only those, never whole observations.
91
+ `find({ role, text, id })`: a role is the same name on every phone, a text matches the name, the value or what the
92
+ parentheses say, and an id is the app's own (an Android resource-id).
93
+ - **Loops**: scroll a list until a row shows.
94
+
95
+ When you are unsure what is on the screen, observe before you act, and decide from what it shows.
75
96
 
76
- 1. Tap the field: `phone_tree` marks it "a field", and "focused" once it has focus.
77
- 2. `phone_type` with the text. `phone_key` `enter` submits it, or a line break in the text does.
78
- 3. Look again to read what the field holds now.
97
+ ## What the screen looks like
79
98
 
80
- The phone types plain ASCII (letters, digits, punctuation, spaces) and line breaks; other characters are refused in
81
- words before anything is typed. To clear a field, select its text if the app offers it, or open the page afresh.
99
+ - **A page's title may not be an element.** On current Android the title is drawn in a header that shrinks as you
100
+ scroll. The page opened when its own items show and the list you pressed is gone.
101
+ - **The keyboard** covers the lower part of the screen while a field has focus; `{nav: "back"}` closes it.
102
+ - **The status bar** across the top (time, battery) is not the app.
82
103
 
83
104
  ## What a phone cannot do here
84
105
 
85
106
  - No pinch or zoom, and no gesture with more than one finger.
86
- - No keys beyond `back`, `home` and `enter`: no volume, no key combinations, no arrow keys.
87
107
  - No shell, files or installs.
108
+ - Plain ASCII typing only: other characters are refused in words before anything is typed.
88
109
 
89
- Don't fake any of these with tricks. Say in your answer what the task needed that the phone could not do.
110
+ Say in your answer what the task needed that the phone could not do.
90
111
 
91
112
  ## When a tool answers an error
92
113
 
93
- Errors come in words, and they say what was wrong. Read them, and act on what they say. Don't repeat the same call.
114
+ Errors come in words, and they say what was wrong. Read them, act on what they say, and don't repeat the same call.
94
115
 
95
- - **A wrong argument** (a point outside the screen, an unknown key, a swipe too long): fix it and call again, once.
96
- - **An app id the phone doesn't know**: list the apps with `phone_apps` and use an id from it.
97
- - **"This phone does not offer its UI tree" or "its keys"**: this phone has no structure or keys to give. Work from
98
- screenshots, the page's own back arrows and `phone_open`.
99
- - **"The person had this phone"**: a person took the phone over and has handed it back, and your act was not done.
100
- The screen may have changed, so look again before you act.
101
- - **The phone is gone or unreachable**: the run's phone ended (its time ran out, or it was released). Don't keep
102
- calling. Say what you finished and what you could not.
116
+ - **"The person had this computer"**: a person took the phone over and has handed it back, and your act was not done.
117
+ The screen may have changed: observe again before you act.
118
+ - **A step refused as `unsupported`** names what this phone can't do (an element step without the `ui` group, a key
119
+ on a phone with no keys). Use another step.
120
+ - **The phone is gone or unreachable**: the run's phone ended. Don't keep calling. Say what you finished and what you
121
+ could not.
103
122
 
104
123
  ## Time and cost
105
124
 
106
- The phone may be billed by the minute, and it lives only for the run's lifetime. Work steadily:
107
- - know what you want before each look;
108
- - don't loop on screenshots or the tree just to wait;
109
- - stop once the task is done, or once it can't be done.
110
-
111
- A short plan before the first tap (which app, which screens, what will show success) saves more than fast tapping.
125
+ The phone may be billed by the minute and lives only for the run's lifetime. Plan first (which app, which screens,
126
+ what will show success), script what is certain, and stop once the task is done or can't be done.
112
127
 
113
128
  ## Finishing
114
129
 
115
- Before you call the task done, take a final screenshot that shows the result. Describe what is on it in your answer,
116
- and name anything you could not finish or check.
130
+ Before you call the task done, check the result with an observe (or a screenshot when it is visual). Say what it shows
131
+ in your answer, and name anything you could not finish or check.
@@ -1,5 +1,5 @@
1
- import type { ShellPlace } from "@parcha/agentrun-kernel/kernel";
2
- import { type ComputerClient, type ComputerSettingKind, type GpuSpec, type Group, type KindCapabilities, type MountReadBack, type MountSpec, type ProviderEntry, type Result } from "@parcha/agentrun-computer";
1
+ import { type ShellPlace } from "@parcha/agentrun-kernel/kernel";
2
+ import { type BrowserFeatures, type BrowserFile, type BrowserSpec, type ComputerClient, type ComputerSettingKind, type GpuSpec, type Group, type HelloResult, type KindCapabilities, type MountReadBack, type MountSpec, type ProviderEntry, type Result } from "@parcha/agentrun-computer";
3
3
  import { type DockerDaemon } from "../docker-daemon.js";
4
4
  import type { MountCheck } from "./attach.js";
5
5
  import type { RunComputer } from "./run-tools.js";
@@ -8,12 +8,13 @@ import type { Workspace } from "./workspace.js";
8
8
  * provider of the kind registry: the computer module's own types. Where a run's shell is: the kernel registry's. */
9
9
  export type { ComputerSettingKind, KindCapabilities, ProviderEntry, ShellPlace };
10
10
  /** An agent's computer setting. `image`: the one of the provider's configurations it selects; absent, the default. A
11
- * sandbox's may ask for GPUs. */
11
+ * sandbox's may ask for GPUs. `persistent`: the agent keeps its own computer between runs (agent-computer.ts). */
12
12
  export type ComputerSetting = {
13
13
  readonly kind: string;
14
14
  readonly provider?: string | null;
15
15
  readonly image?: string;
16
16
  readonly gpu?: GpuSpec;
17
+ readonly persistent?: boolean;
17
18
  };
18
19
  /** The computer module's kind registry (src/kinds.ts), by its own names: the setting kinds, why a machine does not serve
19
20
  * one (servingRefusals, whose words a refusal here carries), and the providers. */
@@ -21,15 +22,20 @@ export type KindRegistry = {
21
22
  readonly SETTING_KINDS: Readonly<Record<ComputerSettingKind, unknown>>;
22
23
  servingRefusals(capabilities: KindCapabilities, kind: ComputerSettingKind): string[];
23
24
  readonly PROVIDERS: readonly ProviderEntry[];
25
+ /** A provider's own words for why it gives no computer of `kind`, where they say more than servingRefusals' (a paired
26
+ * computer: its driver is what to update, attached-computers.ts withPaired); undefined, servingRefusals' words. */
27
+ readonly unservedWhy?: (entry: ProviderEntry, kind: ComputerSettingKind) => string | undefined;
24
28
  };
25
29
  /** A computer a provider started for the run: its ref, its computerd client and what it offers (sandbox, desktop,
26
- * phone), the read-back of its mount (when mounted), and its release. A browser is started by none: the claim gives
27
- * the run's browser tool its provider (`browser`), which opens each session at the tool's first call, and the release
28
- * lets go of any the tool left open. */
30
+ * phone), the hello it answered when the claim connected it (a desktop's or a phone's ports read its groups), the
31
+ * read-back of its mount (when mounted), and its release. A browser is started by none: the claim gives the run's
32
+ * browser tool its provider (`browser`), which opens each session at the tool's first call, and the release lets go
33
+ * of any the tool left open. */
29
34
  export type LaunchedComputer = {
30
35
  readonly id: string;
31
36
  readonly groups: readonly (Group | string)[];
32
37
  readonly client?: ComputerClient;
38
+ readonly hello?: HelloResult;
33
39
  readBack?(): Promise<Result<MountReadBack>>;
34
40
  readonly browser?: ClaimBrowser;
35
41
  release(): Promise<void>;
@@ -44,14 +50,24 @@ export type ClaimBrowser = {
44
50
  readonly provider: string;
45
51
  /** The longest a session lives, in seconds. */
46
52
  readonly maxLifetimeS: number;
47
- /** Makes a session for `tag`, to live at most `lifetimeS`: its computer's id. */
48
- open(tag: string, lifetimeS: number, signal?: AbortSignal): Promise<string>;
53
+ /** What its sessions offer beyond the protocol (the provider's capabilities().browser), which `open` may ask for. */
54
+ readonly features: BrowserFeatures;
55
+ /** Makes a session for `tag`, to live at most `lifetimeS`, with its own options (spec.browser): its computer's id. */
56
+ open(tag: string, lifetimeS: number, browser?: BrowserSpec, signal?: AbortSignal): Promise<string>;
49
57
  /** The sessions made for `tag`, by id. */
50
58
  find(tag: string, signal?: AbortSignal): Promise<string[]>;
59
+ /** Whether the session runs: false once it has ended or its provider no longer knows it. */
60
+ running(id: string, signal?: AbortSignal): Promise<boolean>;
51
61
  /** The session's CDP URL now. */
52
62
  url(id: string): Promise<string>;
53
63
  /** Ends the session; one already gone is ended. */
54
64
  close(id: string): Promise<void>;
65
+ /** The files a session downloaded, kept by the provider: where its features declare downloads. */
66
+ readonly downloads?: {
67
+ list(id: string): Promise<BrowserFile[]>;
68
+ /** The file's bytes, streamed; the stream fails in words once it passes maxBytes. */
69
+ read(id: string, name: string, maxBytes: number): Promise<AsyncIterable<Uint8Array>>;
70
+ };
55
71
  };
56
72
  /** The claim's side: the keys saved for a provider (Settings → Computers; values, never shown), and the launch of one
57
73
  * computer of the kind, with the run's folder as its mount when it mounts it. A launch that fails throws its words. */
@@ -63,13 +79,15 @@ export type ClaimSide = {
63
79
  * the one wording a run's start and Settings → Computers say (noDockerWords). Absent: the launch's own words. */
64
80
  daemon?(provider: string): Promise<DockerDaemon>;
65
81
  /** `configuration`: the provider's configuration the setting selected; its options go to the provider with the keys,
66
- * and its image, when it names one, is the computer's. `gpu`: a sandbox's GPUs, held to that configuration. */
82
+ * and its image, when it names one, is the computer's. `gpu`: a sandbox's GPUs, held to that configuration.
83
+ * `persistent`: the agent's own computer, which that configuration keeps (and which mounts no run's folder). */
67
84
  launch(entry: ProviderEntry, spec: {
68
85
  readonly kind: ComputerSettingKind;
69
86
  readonly keys: Readonly<Record<string, string>>;
70
87
  readonly configuration: KindCapabilities;
71
88
  readonly mount?: MountSpec;
72
89
  readonly gpu?: GpuSpec;
90
+ readonly persistent?: true;
73
91
  readonly signal?: AbortSignal;
74
92
  }): Promise<LaunchedComputer>;
75
93
  };
@@ -99,8 +117,11 @@ export declare const noNetworkRefusal: (label: string, kind: string) => string;
99
117
  * claim launches it, and asks only once its launch fails (ClaimSide.daemon). Absent: not asked.
100
118
  *
101
119
  * `boxAllow`: this server's allow setting (box-settings.ts boxAllowOf). Under "none", a computer whose provider makes no
102
- * "none" is refused (noNetworkRefusal), as the claim refuses it. Absent: not asked. */
103
- export declare function computerReadiness(setting: ComputerSetting, mode: 1 | 2, registry: KindRegistry, keyOf: (name: string) => Promise<string | undefined>, answers?: (provider: string) => DockerDaemon | Promise<DockerDaemon>, boxAllow?: readonly string[] | "none"): Promise<{
120
+ * "none" is refused (noNetworkRefusal), as the claim refuses it. Absent: not asked.
121
+ *
122
+ * `hostWhy`: why this machine cannot run a provider's computers, in words that say how to fix it (computers.ts
123
+ * hostCommandRefusals, read at the server's start: the phone's adb not on PATH), or undefined. Absent: not asked. */
124
+ export declare function computerReadiness(setting: ComputerSetting, mode: 1 | 2, registry: KindRegistry, keyOf: (name: string) => Promise<string | undefined>, answers?: (provider: string) => DockerDaemon | Promise<DockerDaemon>, boxAllow?: readonly string[] | "none", hostWhy?: (provider: string) => string | undefined): Promise<{
104
125
  readonly ok: true;
105
126
  } | {
106
127
  readonly refused: string;
@@ -144,6 +165,19 @@ export declare function shellPlaceOf(mounts: boolean, mode: 1 | 2): ShellPlace;
144
165
  * runs nothing: "none". The setting is the agent's as saved; where it has none, the caller gives the server's default.
145
166
  */
146
167
  export declare function runShellOf(setting: ComputerSetting, mode: 1 | 2, registry: Pick<KindRegistry, "SETTING_KINDS" | "servingRefusals" | "PROVIDERS">): ShellPlace;
168
+ /** What a choice of computer leaves out of the shell, in plain words: shown beside it (GET /v2/computers shell_note) and
169
+ * said by the save's refusal of a tool it leaves out. A computer that mounts the folder leaves nothing out. */
170
+ export declare const SHELL_NOTES: Readonly<Record<Exclude<ShellPlace, "computer">, string>>;
171
+ /** The host tools a run with its shell at `shell` gets, by name: the kernel registry's own list (hostToolDefs), never a
172
+ * second one: the file tools always, bash with a shell, the five background tools on a computer. */
173
+ export declare const hostToolsOf: (shell: ShellPlace) => string[];
174
+ /** A computer choice as an agent's settings show it: where its runs have their shell (runShellOf), the host tools that
175
+ * gives, and what it leaves out, in words (none for a computer that mounts the folder). */
176
+ export declare function shellChoiceOf(setting: ComputerSetting, mode: 1 | 2, registry: Pick<KindRegistry, "SETTING_KINDS" | "servingRefusals" | "PROVIDERS">): {
177
+ shell: ShellPlace;
178
+ host_tools: string[];
179
+ shell_note?: string;
180
+ };
147
181
  /** The setting resolved for `mode` (none given: the server's default), or a refusal in words that name the setting. A
148
182
  * workflow runs with no computer: its caller gives kind none. */
149
183
  export declare function resolveComputer(given: ComputerSetting | undefined, mode: 1 | 2, registry: KindRegistry, side: ClaimSide): Promise<ResolvedComputer | {