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

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 (620) hide show
  1. package/CHANGELOG.md +700 -0
  2. package/README.md +441 -177
  3. package/dist/adapters.d.ts +4 -1
  4. package/dist/adapters.js +4 -2
  5. package/dist/agent-rows.d.ts +1 -3
  6. package/dist/agents-store.d.ts +35 -3
  7. package/dist/agents-store.js +48 -23
  8. package/dist/answer-json.d.ts +34 -1
  9. package/dist/answer-json.js +91 -9
  10. package/dist/api-only.d.ts +1 -1
  11. package/dist/api-only.js +2 -2
  12. package/dist/bash-read-only.js +2 -1
  13. package/dist/browser-cost.js +52 -93
  14. package/dist/cap-short.d.ts +12 -0
  15. package/dist/cap-short.js +60 -0
  16. package/dist/cap.d.ts +3 -400
  17. package/dist/cap.js +6 -942
  18. package/dist/catalog.d.ts +0 -5
  19. package/dist/catalog.js +2 -6
  20. package/dist/chatgpt-plan.d.ts +163 -0
  21. package/dist/chatgpt-plan.js +549 -0
  22. package/dist/cli.js +26 -6
  23. package/dist/composio-preset.d.ts +25 -0
  24. package/dist/composio-preset.js +51 -8
  25. package/dist/composio-triggers.d.ts +113 -0
  26. package/dist/composio-triggers.js +411 -0
  27. package/dist/computer-calls.d.ts +36 -24
  28. package/dist/computer-calls.js +110 -27
  29. package/dist/computer-commands.d.ts +2 -0
  30. package/dist/computer-commands.js +7 -3
  31. package/dist/computer-live.d.ts +12 -2
  32. package/dist/computer-live.js +21 -5
  33. package/dist/computer-routes.d.ts +2 -2
  34. package/dist/computer-routes.js +2 -2
  35. package/dist/computer-setting.d.ts +15 -2
  36. package/dist/computer-setting.js +20 -4
  37. package/dist/computer-view.d.ts +18 -2
  38. package/dist/computer-view.js +21 -6
  39. package/dist/computer-viewer.js +40 -13
  40. package/dist/computers.d.ts +8 -2
  41. package/dist/computers.js +18 -8
  42. package/dist/console/assets/index-BNhZs-jp.css +1 -0
  43. package/dist/console/assets/index-BQv5aOGB.js +700 -0
  44. package/dist/console/index.html +2 -2
  45. package/dist/console-links.d.ts +2 -0
  46. package/dist/console-links.js +6 -3
  47. package/dist/decision-cap.d.ts +2 -5
  48. package/dist/decision-cap.js +3 -6
  49. package/dist/decision-rows.js +11 -11
  50. package/dist/decisions.js +4 -0
  51. package/dist/email/account.d.ts +84 -0
  52. package/dist/email/account.js +159 -0
  53. package/dist/email/answer.d.ts +10 -0
  54. package/dist/email/answer.js +182 -0
  55. package/dist/email/email-faux.d.ts +95 -0
  56. package/dist/email/email-faux.js +849 -0
  57. package/dist/email/labels.d.ts +1 -0
  58. package/dist/email/labels.js +84 -0
  59. package/dist/email/mail.d.ts +186 -0
  60. package/dist/email/mail.js +380 -0
  61. package/dist/email/names.d.ts +20 -0
  62. package/dist/email/names.js +40 -0
  63. package/dist/email/routes.d.ts +9 -0
  64. package/dist/email/routes.js +50 -0
  65. package/dist/email/tools.d.ts +20 -0
  66. package/dist/email/tools.js +517 -0
  67. package/dist/environment.d.ts +17 -2
  68. package/dist/environment.js +36 -8
  69. package/dist/errors.d.ts +6 -0
  70. package/dist/errors.js +12 -0
  71. package/dist/eval-mailbox.d.ts +103 -0
  72. package/dist/eval-mailbox.js +236 -0
  73. package/dist/faux-computers.js +4 -2
  74. package/dist/graph-view.d.ts +9 -2
  75. package/dist/graph-view.js +6 -2
  76. package/dist/harness-install.d.ts +28 -2
  77. package/dist/harness-install.js +147 -59
  78. package/dist/harness-opencode/adapter.js +2 -22
  79. package/dist/harness-opencode/facts.js +5 -4
  80. package/dist/harness-opencode/host/policy.d.ts +4 -5
  81. package/dist/harness-opencode/host/policy.js +14 -33
  82. package/dist/harness-opencode/index.d.ts +1 -1
  83. package/dist/harness-opencode/index.js +1 -1
  84. package/dist/harness-opencode/versions.d.ts +6 -0
  85. package/dist/harness-opencode/versions.js +6 -0
  86. package/dist/harness-table.d.ts +0 -2
  87. package/dist/harness-table.js +8 -7
  88. package/dist/harness.d.ts +12 -0
  89. package/dist/harness.js +15 -3
  90. package/dist/host-tools.d.ts +1 -5
  91. package/dist/host-tools.js +7 -10
  92. package/dist/hosted-search.d.ts +3 -3
  93. package/dist/hosted-search.js +51 -32
  94. package/dist/import-sources.d.ts +1 -1
  95. package/dist/import-sources.js +3 -3
  96. package/dist/import.d.ts +21 -0
  97. package/dist/import.js +186 -1
  98. package/dist/key-check.d.ts +0 -2
  99. package/dist/key-check.js +3 -4
  100. package/dist/key-refusal.d.ts +8 -2
  101. package/dist/key-refusal.js +16 -13
  102. package/dist/key-words.d.ts +3 -2
  103. package/dist/key-words.js +4 -2
  104. package/dist/learn/check.d.ts +24 -4
  105. package/dist/learn/check.js +340 -7
  106. package/dist/learn/commit.d.ts +10 -0
  107. package/dist/learn/commit.js +18 -4
  108. package/dist/learn/compile.d.ts +250 -0
  109. package/dist/learn/compile.js +507 -0
  110. package/dist/learn/general.d.ts +3 -0
  111. package/dist/learn/general.js +4 -2
  112. package/dist/learn/grade.d.ts +5 -1
  113. package/dist/learn/grade.js +11 -7
  114. package/dist/learn/notes.d.ts +8 -0
  115. package/dist/learn/notes.js +18 -0
  116. package/dist/learn/promote.d.ts +308 -0
  117. package/dist/learn/promote.js +321 -0
  118. package/dist/learn/refit.d.ts +48 -0
  119. package/dist/learn/refit.js +264 -0
  120. package/dist/learn/reflect.d.ts +5 -25
  121. package/dist/learn/reflect.js +14 -131
  122. package/dist/learn/replay-calls.d.ts +63 -0
  123. package/dist/learn/replay-calls.js +158 -0
  124. package/dist/learn/skills.d.ts +19 -16
  125. package/dist/learn/skills.js +157 -53
  126. package/dist/learn/workflow-nodes.d.ts +15 -0
  127. package/dist/learn/workflow-nodes.js +44 -0
  128. package/dist/learned-nodes.d.ts +58 -2
  129. package/dist/learned-nodes.js +68 -5
  130. package/dist/learned-workflow.d.ts +58 -32
  131. package/dist/learned-workflow.js +215 -77
  132. package/dist/learning-batch.d.ts +2 -2
  133. package/dist/learning-batch.js +4 -4
  134. package/dist/learning-cost.d.ts +41 -11
  135. package/dist/learning-cost.js +31 -13
  136. package/dist/learning-routes.d.ts +12 -2
  137. package/dist/learning-routes.js +34 -6
  138. package/dist/learning-words.d.ts +8 -1
  139. package/dist/learning-words.js +11 -1
  140. package/dist/learning.d.ts +26 -1
  141. package/dist/learning.js +7 -4
  142. package/dist/link-check.d.ts +27 -0
  143. package/dist/link-check.js +164 -0
  144. package/dist/llm.js +0 -3
  145. package/dist/local-models.d.ts +33 -2
  146. package/dist/local-models.js +43 -5
  147. package/dist/mcp-gateway.d.ts +12 -20
  148. package/dist/mcp-gateway.js +16 -44
  149. package/dist/mcp-oauth.d.ts +5 -0
  150. package/dist/mcp-oauth.js +1 -1
  151. package/dist/mcp-pin-first.d.ts +37 -0
  152. package/dist/mcp-pin-first.js +113 -0
  153. package/dist/mcp-probe.d.ts +8 -9
  154. package/dist/mcp-probe.js +16 -33
  155. package/dist/mcp-secret-writes.js +3 -0
  156. package/dist/mcp-servers-store.d.ts +102 -26
  157. package/dist/mcp-servers-store.js +151 -25
  158. package/dist/mcp-sources.d.ts +39 -0
  159. package/dist/mcp-sources.js +74 -0
  160. package/dist/mcp-store.d.ts +11 -0
  161. package/dist/mcp-store.js +16 -2
  162. package/dist/mcp-wire.d.ts +22 -0
  163. package/dist/mcp-wire.js +36 -0
  164. package/dist/mcp.js +3 -3
  165. package/dist/meta-tool-names.d.ts +1 -0
  166. package/dist/meta-tool-names.js +3 -0
  167. package/dist/model-form.d.ts +11 -0
  168. package/dist/model-form.js +17 -1
  169. package/dist/model.d.ts +39 -6
  170. package/dist/model.js +171 -32
  171. package/dist/monid.d.ts +50 -29
  172. package/dist/monid.js +234 -143
  173. package/dist/native/binding.d.ts +13 -0
  174. package/dist/native/binding.js +57 -0
  175. package/dist/native/cli.d.ts +2 -0
  176. package/dist/native/cli.js +48 -0
  177. package/dist/native/connection.d.ts +8 -0
  178. package/dist/native/connection.js +94 -0
  179. package/dist/native/context.d.ts +6 -0
  180. package/dist/native/context.js +22 -0
  181. package/dist/native/discovery.d.ts +27 -0
  182. package/dist/native/discovery.js +404 -0
  183. package/dist/native/environment.d.ts +4 -0
  184. package/dist/native/environment.js +18 -0
  185. package/dist/native/history.d.ts +20 -0
  186. package/dist/native/history.js +147 -0
  187. package/dist/native/instructions.d.ts +21 -0
  188. package/dist/native/instructions.js +173 -0
  189. package/dist/native/remote-worker-bridge.d.ts +3 -0
  190. package/dist/native/remote-worker-bridge.js +278 -0
  191. package/dist/native/remote.d.ts +187 -0
  192. package/dist/native/remote.js +492 -0
  193. package/dist/native/runtime.d.ts +17 -0
  194. package/dist/native/runtime.js +316 -0
  195. package/dist/native/runtimes.d.ts +66 -0
  196. package/dist/native/runtimes.js +41 -0
  197. package/dist/native/schema.d.ts +46 -0
  198. package/dist/native/schema.js +41 -0
  199. package/dist/native/types.d.ts +87 -0
  200. package/dist/native/types.js +1 -0
  201. package/dist/observation/http.d.ts +4 -0
  202. package/dist/observation/http.js +140 -0
  203. package/dist/observation/observer.d.ts +301 -0
  204. package/dist/observation/observer.js +919 -0
  205. package/dist/observation/schema.d.ts +52 -0
  206. package/dist/observation/schema.js +154 -0
  207. package/dist/openapi.d.ts +1 -0
  208. package/dist/openapi.js +705 -126
  209. package/dist/paid-calls.d.ts +34 -32
  210. package/dist/paid-calls.js +52 -104
  211. package/dist/place-offers.d.ts +4 -8
  212. package/dist/place-offers.js +4 -9
  213. package/dist/port-models.d.ts +7 -2
  214. package/dist/port-models.js +5 -2
  215. package/dist/print.d.ts +4 -2
  216. package/dist/print.js +4 -3
  217. package/dist/propose.d.ts +8 -3
  218. package/dist/propose.js +28 -7
  219. package/dist/provider.d.ts +5 -1
  220. package/dist/provider.js +17 -2
  221. package/dist/push-handler.d.ts +3 -2
  222. package/dist/push-handler.js +20 -6
  223. package/dist/reflect-range.js +2 -1
  224. package/dist/refusal-words.d.ts +11 -0
  225. package/dist/refusal-words.js +13 -2
  226. package/dist/rows.d.ts +5 -3
  227. package/dist/rows.js +15 -4
  228. package/dist/run-launch.d.ts +23 -1
  229. package/dist/run-launch.js +17 -4
  230. package/dist/run-learning-served.d.ts +84 -0
  231. package/dist/run-manifest.d.ts +8 -0
  232. package/dist/run-manifest.js +33 -1
  233. package/dist/run-reads-over-store.d.ts +3 -3
  234. package/dist/run-reads-over-store.js +13 -10
  235. package/dist/run-secrets.js +2 -3
  236. package/dist/run-timeline-served.d.ts +3 -2
  237. package/dist/run-timeline-served.js +12 -10
  238. package/dist/run-view.d.ts +59 -41
  239. package/dist/run-view.js +128 -64
  240. package/dist/runnable.d.ts +13 -8
  241. package/dist/runnable.js +77 -60
  242. package/dist/runner/adapter-loop.d.ts +60 -15
  243. package/dist/runner/adapter-loop.js +1406 -464
  244. package/dist/runner/adapter-run-spec.d.ts +45 -14
  245. package/dist/runner/adapter-run-spec.js +200 -116
  246. package/dist/runner/adapters/pi.d.ts +40 -7
  247. package/dist/runner/adapters/pi.js +149 -38
  248. package/dist/runner/beside.d.ts +3 -1
  249. package/dist/runner/beside.js +24 -8
  250. package/dist/runner/claim-secrets.d.ts +3 -1
  251. package/dist/runner/claim-secrets.js +28 -4
  252. package/dist/runner/cli-run-spec.d.ts +30 -0
  253. package/dist/runner/cli-run-spec.js +150 -66
  254. package/dist/runner/computer-channel.d.ts +5 -2
  255. package/dist/runner/computer-channel.js +5 -3
  256. package/dist/runner/computer-journal.d.ts +6 -0
  257. package/dist/runner/computer-journal.js +8 -10
  258. package/dist/runner/conformance/harness.d.ts +3 -0
  259. package/dist/runner/conformance/harness.js +149 -5
  260. package/dist/runner/conformance/subject.d.ts +11 -4
  261. package/dist/runner/end-of-run.d.ts +8 -5
  262. package/dist/runner/end-of-run.js +11 -6
  263. package/dist/runner/feedback-round.d.ts +79 -0
  264. package/dist/runner/feedback-round.js +127 -0
  265. package/dist/runner/harness-loops.js +17 -0
  266. package/dist/runner/journal-kinds.d.ts +55 -13
  267. package/dist/runner/journal-kinds.js +19 -0
  268. package/dist/runner/learning-dispatch.d.ts +3 -2
  269. package/dist/runner/learning-dispatch.js +6 -6
  270. package/dist/runner/learning-end.d.ts +58 -19
  271. package/dist/runner/learning-end.js +316 -115
  272. package/dist/runner/learning-factory.d.ts +3 -0
  273. package/dist/runner/learning-factory.js +8 -2
  274. package/dist/runner/learning-loop.d.ts +21 -1
  275. package/dist/runner/learning-loop.js +24 -6
  276. package/dist/runner/learning-seed.d.ts +4 -0
  277. package/dist/runner/learning-seed.js +14 -0
  278. package/dist/runner/loop-contract.d.ts +19 -3
  279. package/dist/runner/loop.d.ts +34 -1
  280. package/dist/runner/loop.js +55 -1
  281. package/dist/runner/main.d.ts +6 -1
  282. package/dist/runner/main.js +26 -4
  283. package/dist/runner/mcp-claim.d.ts +5 -1
  284. package/dist/runner/mcp-claim.js +66 -50
  285. package/dist/runner/mcp-run.d.ts +20 -53
  286. package/dist/runner/mcp-run.js +22 -88
  287. package/dist/runner/meta-tools.d.ts +44 -0
  288. package/dist/runner/meta-tools.js +344 -0
  289. package/dist/runner/metrics.d.ts +80 -21
  290. package/dist/runner/metrics.js +128 -42
  291. package/dist/runner/model-route.d.ts +12 -3
  292. package/dist/runner/model-route.js +149 -19
  293. package/dist/runner/monid-run.d.ts +18 -0
  294. package/dist/runner/monid-run.js +170 -0
  295. package/dist/runner/native-loop.d.ts +11 -0
  296. package/dist/runner/native-loop.js +438 -0
  297. package/dist/runner/promotion.d.ts +146 -0
  298. package/dist/runner/promotion.js +803 -0
  299. package/dist/runner/redact.js +3 -0
  300. package/dist/runner/reflect-hook.d.ts +36 -21
  301. package/dist/runner/reflect-hook.js +147 -49
  302. package/dist/runner/runner.d.ts +7 -1
  303. package/dist/runner/runner.js +34 -8
  304. package/dist/runner/sdk-loop.d.ts +7 -0
  305. package/dist/runner/sdk-loop.js +470 -0
  306. package/dist/runner/sessions.d.ts +8 -3
  307. package/dist/runner/sessions.js +5 -1
  308. package/dist/runner/spec-holds.d.ts +16 -2
  309. package/dist/runner/spec-holds.js +42 -14
  310. package/dist/runner/step-guard.d.ts +62 -0
  311. package/dist/runner/step-guard.js +93 -0
  312. package/dist/runner/store-secrets.js +17 -2
  313. package/dist/runner/subagent.d.ts +0 -3
  314. package/dist/runner/subagent.js +7 -12
  315. package/dist/runner/workflow-first.d.ts +226 -0
  316. package/dist/runner/workflow-first.js +293 -0
  317. package/dist/runner/workflow-loop.d.ts +1 -1
  318. package/dist/runner/workflow-loop.js +32 -19
  319. package/dist/runner/workflow-spec.d.ts +5 -1
  320. package/dist/runner/workflow-spec.js +63 -48
  321. package/dist/runs-over-store.d.ts +41 -4
  322. package/dist/runs-over-store.js +64 -22
  323. package/dist/sdk/runs.d.ts +115 -0
  324. package/dist/sdk/runs.js +422 -0
  325. package/dist/sdk/schema.d.ts +175 -0
  326. package/dist/sdk/schema.js +138 -0
  327. package/dist/sdk/workflows.d.ts +22 -0
  328. package/dist/sdk/workflows.js +39 -0
  329. package/dist/secrets.d.ts +2 -0
  330. package/dist/secrets.js +19 -1
  331. package/dist/server.d.ts +108 -20
  332. package/dist/server.js +874 -157
  333. package/dist/settings-wake.d.ts +8 -6
  334. package/dist/settings-wake.js +13 -7
  335. package/dist/skill-route.d.ts +3 -0
  336. package/dist/skill-route.js +16 -0
  337. package/dist/skills/agentrun-serve/SKILL.md +368 -0
  338. package/dist/stats.d.ts +10 -10
  339. package/dist/store/agent-body.d.ts +22 -7
  340. package/dist/store/agent-body.js +23 -14
  341. package/dist/store/command-wake.d.ts +3 -2
  342. package/dist/store/command-wake.js +4 -4
  343. package/dist/store/index.d.ts +1 -1
  344. package/dist/store/native-command-owner.d.ts +10 -0
  345. package/dist/store/native-command-owner.js +47 -0
  346. package/dist/store/postgres/connection.js +3 -1
  347. package/dist/store/postgres/migrations/0010_imported_templates.sql +18 -0
  348. package/dist/store/postgres/migrations/0011_revision_mcp_pin.sql +13 -0
  349. package/dist/store/postgres/migrations/0012_revision_monid_pin.sql +4 -0
  350. package/dist/store/postgres/migrations/0013_native_command_owner.sql +6 -0
  351. package/dist/store/postgres/migrations/0014_run_cost_upper_bound.sql +6 -0
  352. package/dist/store/postgres/store.js +3 -0
  353. package/dist/store/schema.d.ts +16 -0
  354. package/dist/store/schema.js +47 -8
  355. package/dist/store/sqlite/connection.d.ts +2 -2
  356. package/dist/store/sqlite/connection.js +2 -2
  357. package/dist/store/sqlite/run-patch.d.ts +8 -1
  358. package/dist/store/sqlite/run-patch.js +33 -10
  359. package/dist/store/sqlite/store.js +184 -28
  360. package/dist/store/store.d.ts +98 -21
  361. package/dist/store-reads/analytics.d.ts +7 -7
  362. package/dist/store-reads/analytics.js +23 -5
  363. package/dist/store-reads/cap.js +8 -6
  364. package/dist/store-reads/journal.d.ts +30 -1
  365. package/dist/store-reads/journal.js +141 -83
  366. package/dist/store-reads/learning.d.ts +179 -13
  367. package/dist/store-reads/learning.js +230 -68
  368. package/dist/store-reads/loop.d.ts +61 -0
  369. package/dist/store-reads/loop.js +111 -0
  370. package/dist/store-reads/runs.d.ts +5 -0
  371. package/dist/store-reads/runs.js +3 -2
  372. package/dist/store-view.d.ts +3 -2
  373. package/dist/store-view.js +109 -37
  374. package/dist/template-eval.d.ts +87 -16
  375. package/dist/template-eval.js +605 -120
  376. package/dist/template-github-permissions.d.ts +2 -2
  377. package/dist/template-github-permissions.js +2 -1
  378. package/dist/template-import.d.ts +31 -0
  379. package/dist/template-import.js +121 -0
  380. package/dist/template-source.d.ts +51 -0
  381. package/dist/template-source.js +371 -0
  382. package/dist/templates.d.ts +274 -52
  383. package/dist/templates.js +670 -201
  384. package/dist/text-urls.d.ts +38 -0
  385. package/dist/text-urls.js +170 -0
  386. package/dist/timeline/computer.d.ts +48 -0
  387. package/dist/timeline/computer.js +169 -0
  388. package/dist/timeline/index.d.ts +7 -5
  389. package/dist/timeline/index.js +7 -5
  390. package/dist/timeline/labels.d.ts +11 -4
  391. package/dist/timeline/labels.js +122 -8
  392. package/dist/timeline/origin.d.ts +20 -6
  393. package/dist/timeline/origin.js +13 -6
  394. package/dist/timeline/render-text.js +1 -1
  395. package/dist/timeline/timeline.d.ts +76 -20
  396. package/dist/timeline/timeline.js +184 -39
  397. package/dist/timeline/util.d.ts +5 -0
  398. package/dist/timeline/util.js +44 -8
  399. package/dist/timeline/web-calls.d.ts +17 -0
  400. package/dist/timeline/web-calls.js +106 -0
  401. package/dist/tool-gate.d.ts +103 -76
  402. package/dist/tool-gate.js +200 -127
  403. package/dist/tool-keys.d.ts +4 -1
  404. package/dist/tool-keys.js +8 -3
  405. package/dist/tool-list.d.ts +29 -0
  406. package/dist/tool-list.js +50 -0
  407. package/dist/tool-names.d.ts +76 -0
  408. package/dist/tool-names.js +101 -0
  409. package/dist/tool-plane.d.ts +34 -28
  410. package/dist/tool-plane.js +72 -37
  411. package/dist/tools.d.ts +59 -15
  412. package/dist/tools.js +46 -42
  413. package/dist/trigger-adapter.d.ts +85 -5
  414. package/dist/trigger-adapter.js +6 -0
  415. package/dist/trigger-adapters.js +3 -1
  416. package/dist/trigger-composio.d.ts +10 -0
  417. package/dist/trigger-composio.js +122 -0
  418. package/dist/trigger-email.d.ts +4 -0
  419. package/dist/trigger-email.js +228 -0
  420. package/dist/trigger-signatures.d.ts +6 -10
  421. package/dist/trigger-signatures.js +16 -16
  422. package/dist/trigger-targets.d.ts +1 -1
  423. package/dist/trigger-targets.js +4 -3
  424. package/dist/trigger-webhook.js +6 -4
  425. package/dist/triggers.d.ts +94 -9
  426. package/dist/triggers.js +263 -62
  427. package/dist/uploads.d.ts +9 -0
  428. package/dist/uploads.js +27 -0
  429. package/dist/validate.d.ts +15 -7
  430. package/dist/validate.js +91 -50
  431. package/dist/web-fake.d.ts +56 -0
  432. package/dist/web-fake.js +102 -0
  433. package/dist/web-fetch-direct.d.ts +3 -0
  434. package/dist/web-fetch-direct.js +4 -1
  435. package/dist/web-fetch.d.ts +6 -8
  436. package/dist/web-fetch.js +10 -53
  437. package/dist/web-search.d.ts +51 -2
  438. package/dist/web-search.js +116 -18
  439. package/dist/webhooks.d.ts +2 -1
  440. package/dist/webhooks.js +5 -1
  441. package/dist/workflow/node-runner.js +10 -2
  442. package/dist/workspace/archil-claim.d.ts +3 -0
  443. package/dist/workspace/archil-claim.js +9 -2
  444. package/dist/workspace/computer-deps.d.ts +25 -9
  445. package/dist/workspace/computer-deps.js +82 -38
  446. package/dist/workspace/computer-for-claim.d.ts +60 -4
  447. package/dist/workspace/computer-for-claim.js +203 -45
  448. package/dist/workspace/computer-hold.js +7 -1
  449. package/dist/workspace/computer-janitor.d.ts +10 -3
  450. package/dist/workspace/computer-janitor.js +96 -29
  451. package/dist/workspace/computer-kept.d.ts +82 -0
  452. package/dist/workspace/computer-kept.js +147 -0
  453. package/dist/workspace/computer-mcp.js +4 -3
  454. package/dist/workspace/computer-ports.d.ts +23 -3
  455. package/dist/workspace/computer-ports.js +115 -5
  456. package/dist/workspace/index.d.ts +2 -3
  457. package/dist/workspace/index.js +1 -2
  458. package/dist/workspace/kind-skills/desktop/SKILL.md +31 -11
  459. package/dist/workspace/kind-skills/phone/SKILL.md +29 -14
  460. package/dist/workspace/local.js +2 -2
  461. package/dist/workspace/resolve-computer.d.ts +33 -1
  462. package/dist/workspace/resolve-computer.js +37 -16
  463. package/dist/workspace/revision-skills.d.ts +6 -2
  464. package/dist/workspace/revision-skills.js +12 -5
  465. package/dist/workspace/run-end-computers.d.ts +30 -0
  466. package/dist/workspace/run-end-computers.js +137 -0
  467. package/dist/workspace/run-tools.d.ts +40 -23
  468. package/dist/workspace/run-tools.js +46 -19
  469. package/dist/wrap-up.d.ts +35 -0
  470. package/dist/wrap-up.js +48 -0
  471. package/launcher/agentrun-serve +4 -2
  472. package/package.json +13 -9
  473. package/skills/agentrun-serve/SKILL.md +248 -10
  474. package/templates/README.md +220 -60
  475. package/templates/TOOLS.md +168 -0
  476. package/templates/code-review/agent.md +46 -16
  477. package/templates/code-review/evals/clean-refactor/case.yaml +2 -1
  478. package/templates/code-review/evals/clean-refactor/graders/head-sha.md +6 -0
  479. package/templates/code-review/evals/injection/case.yaml +2 -1
  480. package/templates/code-review/evals/injection/graders/head-sha.md +6 -0
  481. package/templates/code-review/evals/mentions-defused/case.yaml +3 -3
  482. package/templates/code-review/evals/mentions-defused/fixtures/github-mcp.json +0 -23
  483. package/templates/code-review/evals/mentions-defused/graders/head-sha.md +6 -0
  484. package/templates/code-review/evals/never-flag/case.yaml +2 -1
  485. package/templates/code-review/evals/never-flag/graders/head-sha.md +6 -0
  486. package/templates/code-review/evals/null-name/case.yaml +2 -1
  487. package/templates/code-review/evals/null-name/graders/head-sha.md +6 -0
  488. package/templates/code-review/evals/off-by-one/case.yaml +2 -1
  489. package/templates/code-review/evals/off-by-one/graders/head-sha.md +6 -0
  490. package/templates/code-review/evals/off-by-one/graders/no-repo-reads.md +2 -1
  491. package/templates/code-review/evals/other-repo/case.yaml +16 -0
  492. package/templates/code-review/evals/other-repo/fixtures/github-mcp.json +130 -0
  493. package/templates/code-review/evals/other-repo/graders/head-sha.md +6 -0
  494. package/templates/code-review/evals/other-repo/graders/no-canary.md +6 -0
  495. package/templates/code-review/evals/other-repo/graders/no-other-repo.md +8 -0
  496. package/templates/code-review/evals/other-repo/graders/refused-not-quoted.md +18 -0
  497. package/templates/code-review/evals/other-repo/prompt.md +10 -0
  498. package/templates/code-review/evals/pasted-by-reference/case.yaml +5 -0
  499. package/templates/code-review/evals/pasted-by-reference/graders/by-reference.md +15 -0
  500. package/templates/code-review/evals/pasted-by-reference/graders/head-sha.md +6 -0
  501. package/templates/code-review/evals/pasted-by-reference/prompt.md +31 -0
  502. package/templates/code-review/evals/re-review/case.yaml +2 -1
  503. package/templates/code-review/evals/re-review/graders/head-sha.md +6 -0
  504. package/templates/code-review/evals/re-review-open/case.yaml +2 -1
  505. package/templates/code-review/evals/re-review-open/graders/head-sha.md +6 -0
  506. package/templates/code-review/evals/repo-rule/case.yaml +2 -1
  507. package/templates/code-review/evals/repo-rule/graders/head-sha.md +6 -0
  508. package/templates/code-review/evals/two-defects/case.yaml +2 -1
  509. package/templates/code-review/evals/two-defects/graders/head-sha.md +6 -0
  510. package/templates/code-review/rules/CODEREVIEW.md +1 -1
  511. package/templates/code-review/skills/review/DEEP.md +5 -4
  512. package/templates/code-review/skills/review/REVIEWER.md +5 -4
  513. package/templates/code-review/skills/review/SKILL.md +11 -6
  514. package/templates/code-review/{findings.schema.json → skills/review/findings.schema.json} +1 -0
  515. package/templates/inbound-lead/agent.md +26 -16
  516. package/templates/inbound-lead/evals/injection-in-form/graders/no-exfil.md +16 -0
  517. package/templates/inbound-lead/evals/injection-in-form/prompt.md +2 -2
  518. package/templates/inbound-lead/evals/write-back/case.yaml +2 -6
  519. package/templates/inbound-lead/evals/write-back/fixtures/fake-hubspot.json +34 -225
  520. package/templates/inbound-lead/evals/write-back/graders/note-and-score.md +10 -14
  521. package/templates/inbound-lead/evals/write-back/graders/writes-once.md +7 -0
  522. package/templates/inbound-lead/evals/write-back/prompt.md +1 -1
  523. package/templates/inbound-lead/evals/write-back-wrong-record/case.yaml +3 -7
  524. package/templates/inbound-lead/evals/write-back-wrong-record/fixtures/fake-hubspot.json +34 -225
  525. package/templates/inbound-lead/evals/write-back-wrong-record/graders/form-id.md +17 -0
  526. package/templates/inbound-lead/evals/write-back-wrong-record/graders/no-write.md +3 -3
  527. package/templates/inbound-lead/evals/write-back-wrong-record/prompt.md +2 -2
  528. package/templates/inbound-lead/skills/lead/SKILL.md +23 -27
  529. package/templates/kyb/agent.md +15 -5
  530. package/templates/kyb/evals/adverse-media/prompt.md +2 -7
  531. package/templates/kyb/evals/canada-active-filed/prompt.md +2 -6
  532. package/templates/kyb/evals/clean-public-company/prompt.md +2 -6
  533. package/templates/kyb/evals/injection-in-page/prompt.md +3 -7
  534. package/templates/kyb/evals/name-collision/prompt.md +2 -6
  535. package/templates/kyb/evals/no-invention/prompt.md +2 -6
  536. package/templates/kyb/evals/opensanctions-on/prompt.md +2 -6
  537. package/templates/kyb/evals/sanctioned-entity/prompt.md +2 -6
  538. package/templates/kyb/kyb.schema.json +8 -7
  539. package/templates/kyb/skills/kyb/SKILL.md +9 -6
  540. package/templates/market-monitor/agent.md +19 -12
  541. package/templates/market-monitor/evals/post-happens/case.yaml +4 -4
  542. package/templates/market-monitor/evals/post-happens/fixtures/slack-mcp.json +13 -9
  543. package/templates/market-monitor/evals/post-happens/graders/post-is-digest.md +1 -1
  544. package/templates/market-monitor/evals/post-happens/graders/posted-once.md +3 -3
  545. package/templates/market-monitor/skills/monitor/SKILL.md +6 -4
  546. package/templates/release-notes/agent.md +32 -10
  547. package/templates/release-notes/evals/draft-not-publish/case.yaml +5 -4
  548. package/templates/release-notes/evals/draft-not-publish/fixtures/github-mcp.json +29 -51
  549. package/templates/release-notes/evals/every-pr-accounted/case.yaml +2 -1
  550. package/templates/release-notes/evals/issue-write-refused/case.yaml +5 -4
  551. package/templates/release-notes/evals/issue-write-refused/fixtures/github-mcp.json +29 -51
  552. package/templates/release-notes/evals/late-arrival/case.yaml +6 -5
  553. package/templates/release-notes/evals/late-arrival/fixtures/github-mcp.json +29 -51
  554. package/templates/release-notes/evals/learned-style/case.yaml +2 -1
  555. package/templates/release-notes/evals/no-pr-numbers-on-top/case.yaml +2 -1
  556. package/templates/release-notes/evals/other-repo/case.yaml +24 -0
  557. package/templates/release-notes/evals/other-repo/fixtures/github-mcp.json +907 -0
  558. package/templates/release-notes/evals/other-repo/graders/no-canary.md +7 -0
  559. package/templates/release-notes/evals/other-repo/graders/no-other-repo.md +8 -0
  560. package/templates/release-notes/evals/other-repo/graders/refused-not-quoted.md +18 -0
  561. package/templates/release-notes/evals/other-repo/prompt.md +32 -0
  562. package/templates/release-notes/evals/upgrade-line/case.yaml +2 -1
  563. package/templates/release-notes/evals/user-facing-only/case.yaml +2 -1
  564. package/templates/release-notes/notes.schema.json +1 -1
  565. package/templates/release-notes/skills/release-notes/SKILL.md +26 -17
  566. package/dist/console/assets/index-Cn6JX1uH.js +0 -563
  567. package/dist/console/assets/index-DRN62V5v.css +0 -1
  568. package/dist/host-calls.d.ts +0 -20
  569. package/dist/host-calls.js +0 -12
  570. package/dist/runner/adapters/pi-computer.d.ts +0 -7
  571. package/dist/runner/adapters/pi-computer.js +0 -43
  572. package/dist/tool-blurbs.d.ts +0 -4
  573. package/dist/tool-blurbs.js +0 -28
  574. package/dist/tool-budget.d.ts +0 -38
  575. package/dist/tool-budget.js +0 -62
  576. package/dist/workspace/computer-script.d.ts +0 -37
  577. package/dist/workspace/computer-script.js +0 -138
  578. package/templates/code-review/evals/clean-refactor/graders/schema.md +0 -5
  579. package/templates/code-review/evals/injection/graders/schema.md +0 -5
  580. package/templates/code-review/evals/mentions-defused/graders/schema.md +0 -5
  581. package/templates/code-review/evals/never-flag/graders/schema.md +0 -5
  582. package/templates/code-review/evals/null-name/graders/schema.md +0 -5
  583. package/templates/code-review/evals/off-by-one/graders/schema.md +0 -5
  584. package/templates/code-review/evals/re-review/graders/schema.md +0 -5
  585. package/templates/code-review/evals/re-review-open/graders/schema.md +0 -5
  586. package/templates/code-review/evals/repo-rule/graders/schema.md +0 -5
  587. package/templates/code-review/evals/two-defects/graders/schema.md +0 -5
  588. package/templates/inbound-lead/evals/clear-disqualifier/graders/schema.md +0 -5
  589. package/templates/inbound-lead/evals/injection-in-form/graders/schema.md +0 -5
  590. package/templates/inbound-lead/evals/learned-correction/graders/schema.md +0 -5
  591. package/templates/inbound-lead/evals/strong-fit/graders/schema.md +0 -5
  592. package/templates/inbound-lead/evals/thin-data/graders/schema.md +0 -5
  593. package/templates/inbound-lead/evals/write-back/graders/schema.md +0 -5
  594. package/templates/inbound-lead/evals/write-back/graders/writes-twice.md +0 -7
  595. package/templates/inbound-lead/evals/write-back-wrong-record/graders/proves-record.md +0 -18
  596. package/templates/inbound-lead/evals/write-back-wrong-record/graders/schema.md +0 -5
  597. package/templates/kyb/evals/adverse-media/graders/schema.md +0 -5
  598. package/templates/kyb/evals/canada-active-filed/graders/schema.md +0 -5
  599. package/templates/kyb/evals/clean-public-company/graders/schema.md +0 -5
  600. package/templates/kyb/evals/injection-in-page/graders/schema.md +0 -5
  601. package/templates/kyb/evals/name-collision/graders/schema.md +0 -5
  602. package/templates/kyb/evals/no-invention/graders/schema.md +0 -5
  603. package/templates/kyb/evals/opensanctions-on/graders/schema.md +0 -5
  604. package/templates/kyb/evals/sanctioned-entity/graders/schema.md +0 -5
  605. package/templates/market-monitor/evals/blocked-source/graders/schema.md +0 -5
  606. package/templates/market-monitor/evals/every-competitor-named/graders/schema.md +0 -5
  607. package/templates/market-monitor/evals/learned-preference/graders/schema.md +0 -5
  608. package/templates/market-monitor/evals/no-repeats/graders/schema.md +0 -5
  609. package/templates/market-monitor/evals/nothing-changed/graders/schema.md +0 -5
  610. package/templates/market-monitor/evals/post-happens/graders/schema.md +0 -5
  611. package/templates/market-monitor/evals/pricing-change/graders/schema.md +0 -5
  612. package/templates/market-monitor/evals/pricing-moved/graders/schema.md +0 -5
  613. package/templates/release-notes/evals/draft-not-publish/graders/schema.md +0 -5
  614. package/templates/release-notes/evals/every-pr-accounted/graders/schema.md +0 -5
  615. package/templates/release-notes/evals/issue-write-refused/graders/schema.md +0 -5
  616. package/templates/release-notes/evals/late-arrival/graders/schema.md +0 -5
  617. package/templates/release-notes/evals/learned-style/graders/schema.md +0 -5
  618. package/templates/release-notes/evals/no-pr-numbers-on-top/graders/schema.md +0 -5
  619. package/templates/release-notes/evals/upgrade-line/graders/schema.md +0 -5
  620. package/templates/release-notes/evals/user-facing-only/graders/schema.md +0 -5
@@ -8,14 +8,26 @@ 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. `persistent`: the agent keeps its own computer between runs (agent-computer.ts). */
11
+ * sandbox's may ask for GPUs. `persistent`: the agent keeps its own computer between runs (agent-computer.ts). A
12
+ * desktop's or a phone's `surface` and `exec` go to the run's tools on the RunComputer (run-tools.ts); `exec: false`
13
+ * also mounts no folder in it and gives the run no shell. */
12
14
  export type ComputerSetting = {
13
15
  readonly kind: string;
14
16
  readonly provider?: string | null;
15
17
  readonly image?: string;
16
18
  readonly gpu?: GpuSpec;
17
19
  readonly persistent?: boolean;
20
+ readonly surface?: "code" | "tools";
21
+ readonly exec?: boolean;
18
22
  };
23
+ /** Whether a computer (or its setting) takes its agent's programs away: `exec: false`. Only a desktop or a phone takes
24
+ * `exec` (computer-setting.ts refuses it on any other kind at save), so a computer without programs is one of those. */
25
+ export declare const noPrograms: <C extends {
26
+ readonly kind: string;
27
+ readonly exec?: boolean;
28
+ }>(computer: C | undefined) => computer is Extract<C, {
29
+ readonly kind: "desktop" | "phone";
30
+ }>;
19
31
  /** The computer module's kind registry (src/kinds.ts), by its own names: the setting kinds, why a machine does not serve
20
32
  * one (servingRefusals, whose words a refusal here carries), and the providers. */
21
33
  export type KindRegistry = {
@@ -90,6 +102,18 @@ export type ClaimSide = {
90
102
  readonly persistent?: true;
91
103
  readonly signal?: AbortSignal;
92
104
  }): Promise<LaunchedComputer>;
105
+ /** The computer an earlier claim of the run kept at its park (computer-kept.ts), attached again in place of a launch,
106
+ * or undefined to launch one. Asked first: a computer attached again mounts what it mounted, so no mount is made for
107
+ * it, and its mount reads back under `epoch`, the claim epoch its labels carry. Never throws. Absent: always a launch. */
108
+ reattach?(entry: ProviderEntry, spec: {
109
+ readonly kind: ComputerSettingKind;
110
+ readonly keys: Readonly<Record<string, string>>;
111
+ readonly configuration: KindCapabilities;
112
+ readonly persistent?: true;
113
+ readonly signal?: AbortSignal;
114
+ }): Promise<(LaunchedComputer & {
115
+ readonly epoch: number;
116
+ }) | undefined>;
93
117
  };
94
118
  /** A narrow port of the kernel's hands a computer fills: files, exec and processes where the folder is mounted; a
95
119
  * desktop's screen and input; a phone; a browser. */
@@ -103,6 +127,14 @@ export declare const vendorNetworkOnly: (network: readonly string[] | undefined)
103
127
  /** Whether a provider's computers can't have no network: it declares its network forms and "none" isn't one (a cloud
104
128
  * phone, a hosted browser, Local Chrome). */
105
129
  export declare const needsNetwork: (network: readonly string[] | undefined) => boolean;
130
+ /** A provider's label after its article, as it is said: "a Modal", "an E2B" (every label is said by its first letter's
131
+ * sound). `start`: at a sentence's start, "A"/"An". */
132
+ export declare const aLabel: (label: string, start?: boolean) => string;
133
+ /** Why a sandbox or a desktop that would mount the owner's Archil disk can't start in Mode 2: the mount needs Archil's
134
+ * image in the owner's own vendor account, and this server can't put it there yet. A provider that prepares its image
135
+ * (prepareImage: Agent37 registers the box image in the owner's workspace, Modal pulls it, E2B starts its public
136
+ * template) is never refused so; today every provider that mounts the disk does. Settings (computers.ts modeRefusal) and a run's start (computerReadiness) say it. */
137
+ export declare const mode2ArchilWhy: (label: string, kind: "sandbox" | "desktop") => string;
106
138
  /** Why a computer that needs a network is refused where this server's AGENTRUN_BOX_ALLOW is none, in words that name the
107
139
  * fix: the operator said no network at all, and the computer can't run without one. */
108
140
  export declare const noNetworkRefusal: (label: string, kind: string) => string;
@@ -23,6 +23,9 @@ import { configurationOf, imagesOf } from "@parcha/agentrun-computer";
23
23
  import { noDockerWords } from "../docker-daemon.js";
24
24
  import { gpuRefused } from "../gpu-words.js";
25
25
  import { recordedClient } from "../computer-calls.js";
26
+ /** Whether a computer (or its setting) takes its agent's programs away: `exec: false`. Only a desktop or a phone takes
27
+ * `exec` (computer-setting.ts refuses it on any other kind at save), so a computer without programs is one of those. */
28
+ export const noPrograms = (computer) => computer?.exec === false;
26
29
  /** A provider's keys as the claim reads them: each key its registry entry declares, by `keyOf` (the server's reader:
27
30
  * key-meta.ts keyReader, the environment's value, else the saved one); a key with no value is left out. */
28
31
  export const providerKeys = (registry, keyOf) => async (provider) => {
@@ -40,9 +43,17 @@ export const vendorNetworkOnly = (network) => network !== undefined && network.l
40
43
  /** Whether a provider's computers can't have no network: it declares its network forms and "none" isn't one (a cloud
41
44
  * phone, a hosted browser, Local Chrome). */
42
45
  export const needsNetwork = (network) => network !== undefined && network.length > 0 && !network.includes("none");
46
+ /** A provider's label after its article, as it is said: "a Modal", "an E2B" (every label is said by its first letter's
47
+ * sound). `start`: at a sentence's start, "A"/"An". */
48
+ export const aLabel = (label, start = false) => `${start ? "A" : "a"}${/^[AEIOU]/i.test(label) ? "n" : ""} ${label}`;
49
+ /** Why a sandbox or a desktop that would mount the owner's Archil disk can't start in Mode 2: the mount needs Archil's
50
+ * image in the owner's own vendor account, and this server can't put it there yet. A provider that prepares its image
51
+ * (prepareImage: Agent37 registers the box image in the owner's workspace, Modal pulls it, E2B starts its public
52
+ * template) is never refused so; today every provider that mounts the disk does. Settings (computers.ts modeRefusal) and a run's start (computerReadiness) say it. */
53
+ export const mode2ArchilWhy = (label, kind) => `${aLabel(label, true)} ${kind} can't start in Mode 2 yet: it needs Archil's image in your ${label} account, and this server can't put it there yet. Set this agent's computer to none (${SETTINGS})`;
43
54
  /** Why a computer that needs a network is refused where this server's AGENTRUN_BOX_ALLOW is none, in words that name the
44
55
  * fix: the operator said no network at all, and the computer can't run without one. */
45
- export const noNetworkRefusal = (label, kind) => `This agent's computer is a ${label} ${kind}, which needs a network (the vendor's own, or public addresses from this machine), and this server's AGENTRUN_BOX_ALLOW is none (no network): pick a computer that runs with no network in ${SETTINGS}, or set AGENTRUN_BOX_ALLOW to a host list.`;
56
+ export const noNetworkRefusal = (label, kind) => `This agent's computer is ${aLabel(label)} ${kind}, which needs a network (the vendor's own, or public addresses from this machine), and this server's AGENTRUN_BOX_ALLOW is none (no network): pick a computer that runs with no network in ${SETTINGS}, or set AGENTRUN_BOX_ALLOW to a host list.`;
46
57
  /** Whether an agent's computer `setting` can be had in `mode` now, by the answers the claim gives (resolveComputer: the
47
58
  * kind, the provider and what it serves, the mode's mount, the provider's keys by `keyOf`): ok, or its refusal in words
48
59
  * that name the fix. Nothing starts. A run's start asks it before the run is made (runnable.ts).
@@ -68,13 +79,15 @@ export async function computerReadiness(setting, mode, registry, keyOf, answers,
68
79
  if ("refused" in resolved)
69
80
  return { refused: resolved.refused };
70
81
  const entry = registry.PROVIDERS.find((one) => one.id === resolved.provider);
82
+ if (mode === 2 && (resolved.kind === "sandbox" || resolved.kind === "desktop") && resolved.mounts && entry && !entry.prepareImage)
83
+ return { refused: `${mode2ArchilWhy(entry.label, resolved.kind)}.` };
71
84
  if (entry && entry.mounts.includes("bind") && answers) {
72
85
  const said = await answers(entry.id);
73
86
  // It names the box whose probe said no (a refusal's details.box), as the box check did.
74
87
  if (!said.up && said.absent)
75
88
  return { refused: noDockerWords(resolved.kind, registry.PROVIDERS, mode), box: entry.id };
76
89
  if (!said.up)
77
- return { refused: `This agent's computer is a ${entry.label} ${resolved.kind}, and this server cannot run it: ${said.reason.replace(/[.!?]+$/, "")}.`, box: entry.id };
90
+ return { refused: `This agent's computer is ${aLabel(entry.label)} ${resolved.kind}, and this server cannot run it: ${said.reason.replace(/[.!?]+$/, "")}.`, box: entry.id };
78
91
  }
79
92
  const host = entry ? hostWhy?.(entry.id) : undefined;
80
93
  if (host)
@@ -138,6 +151,9 @@ export function runShellOf(setting, mode, registry) {
138
151
  const serving = selectedOf(servingOf(registry, entry, kind), setting, entry, kind);
139
152
  if (serving.length === 0)
140
153
  return "none";
154
+ // An agent whose computer runs no programs of its own has no shell anywhere: not its computer's, not Archil's exec.
155
+ if (noPrograms(setting))
156
+ return "none";
141
157
  const mounts = mountsFolder(kind, entry, serving, mode);
142
158
  if (kind === "sandbox" && !mounts)
143
159
  return "none";
@@ -211,14 +227,15 @@ export async function resolveComputer(given, mode, registry, side) {
211
227
  return { refused: `${entry.label} has no ${kind} image ${JSON.stringify(setting.image)}. It ${offers} for this agent's computer in ${SETTINGS}.` };
212
228
  }
213
229
  // The run's folder: mounted where the selected configuration has files and exec and the provider mounts the mode's
214
- // folder.
215
- const mounts = mountsFolder(kind, entry, [configuration], mode);
230
+ // folder, and the agent may run programs there (a folder is mounted for its shell).
231
+ const mounts = !noPrograms(setting) && mountsFolder(kind, entry, [configuration], mode);
216
232
  if (kind === "sandbox" && !mounts) {
217
233
  if (mode === 1)
218
- return { refused: `Mode 1 runs a sandbox only on Docker: a ${entry.label} sandbox can't reach the run's folder on this machine. Pick Docker for this agent's computer in ${SETTINGS}, or another kind of computer.` };
234
+ return { refused: `Mode 1 runs a sandbox only on Docker: ${aLabel(entry.label)} sandbox can't reach the run's folder on this machine. Pick Docker for this agent's computer in ${SETTINGS}, or another kind of computer.` };
219
235
  if (entry.mounts.includes("bind"))
220
236
  return { refused: `Mode 2 keeps workspaces on Archil; a local Docker computer can't mount them. Pick a remote sandbox for this agent's computer in ${SETTINGS}, or no computer.` };
221
- return { refused: `A ${entry.label} sandbox can't mount the run's folder from Archil: pick another sandbox for this agent's computer in ${SETTINGS}.` };
237
+ const why = entry.unmounted?.archil;
238
+ return { refused: `${aLabel(entry.label, true)} sandbox can't mount the run's folder from Archil${why ? ` (${why})` : ""}: pick another sandbox for this agent's computer in ${SETTINGS}.` };
222
239
  }
223
240
  // Its GPUs, a sandbox's alone: in gpuRefused's words, against what the configuration the setting selected declares,
224
241
  // with the mode's folder as the mount it takes (a sandbox here always mounts it). A GPU computer that can't mount the
@@ -229,15 +246,15 @@ export async function resolveComputer(given, mode, registry, side) {
229
246
  if (refused?.folder)
230
247
  return { refused: refused.words };
231
248
  if (refused)
232
- return { refused: `A ${entry.label} sandbox can't have this agent's GPUs: ${refused.words}. Change the GPUs or the provider for this agent's computer in ${SETTINGS}.` };
249
+ return { refused: `${aLabel(entry.label, true)} sandbox can't have this agent's GPUs: ${refused.words}. Change the GPUs or the provider for this agent's computer in ${SETTINGS}.` };
233
250
  }
234
251
  // The agent's own computer, kept between its runs: only where the configuration keeps one, and never one that mounts
235
252
  // the run's folder (a later run would find an earlier run's folder in it).
236
253
  const persistent = setting.persistent === true;
237
254
  if (persistent && configuration.persistence === undefined)
238
- return { refused: `A ${entry.label} ${kind} keeps no computer for an agent between runs (it declares no persistence): turn persistent off, or pick a computer that keeps one, for this agent's computer in ${SETTINGS}.` };
255
+ return { refused: `${aLabel(entry.label, true)} ${kind} keeps no computer for an agent between runs (it declares no persistence): turn persistent off, or pick a computer that keeps one, for this agent's computer in ${SETTINGS}.` };
239
256
  if (persistent && mounts)
240
- return { refused: `A ${entry.label} ${kind} mounts each run's folder, so it can't be kept between runs: turn persistent off for this agent's computer in ${SETTINGS}.` };
257
+ return { refused: `${aLabel(entry.label, true)} ${kind} mounts each run's folder, so it can't be kept between runs: turn persistent off for this agent's computer in ${SETTINGS}.` };
241
258
  // Its keys: every required one saved, before anything starts; only declared names go to the provider.
242
259
  const saved = await side.keysOf(entry.id);
243
260
  const has = (name) => typeof saved[name] === "string" && saved[name] !== "";
@@ -255,10 +272,12 @@ export async function resolveComputer(given, mode, registry, side) {
255
272
  mounts,
256
273
  ports,
257
274
  async start({ workspace, check, signal }) {
258
- const mount = mounts ? await workspace.mountSpec() : undefined;
275
+ // A computer kept at the run's park, attached again: it mounts what it mounted, read back under its own epoch.
276
+ const again = await side.reattach?.(entry, { kind, keys, configuration, ...(persistent ? { persistent: true } : {}), ...(signal ? { signal } : {}) });
277
+ const mount = mounts && !again ? await workspace.mountSpec() : undefined;
259
278
  let launched;
260
279
  try {
261
- launched = await side.launch(entry, { kind, keys, configuration, ...(mount ? { mount } : {}), ...(gpu ? { gpu: { type: gpu.type, count: gpu.count } } : {}), ...(persistent ? { persistent: true } : {}), ...(signal ? { signal } : {}) });
280
+ launched = again ?? await side.launch(entry, { kind, keys, configuration, ...(mount ? { mount } : {}), ...(gpu ? { gpu: { type: gpu.type, count: gpu.count } } : {}), ...(persistent ? { persistent: true } : {}), ...(signal ? { signal } : {}) });
262
281
  }
263
282
  catch (error) {
264
283
  // A provider that binds a folder of this machine (Docker) whose daemon does not answer: the one wording.
@@ -267,7 +286,8 @@ export async function resolveComputer(given, mode, registry, side) {
267
286
  throw unavailable(noDockerWords(kind, registry.PROVIDERS, mode));
268
287
  throw unavailable(`${entry.label} could not start a ${kind} computer: ${error instanceof Error ? error.message : String(error)}`);
269
288
  }
270
- const computer = runComputerOf(kind, launched, mounts ? check : undefined);
289
+ const checked = mounts ? (again ? { ...check, epoch: again.epoch } : check) : undefined;
290
+ const computer = runComputerOf(kind, launched, checked, { ...(setting.surface ? { surface: setting.surface } : {}), ...(noPrograms(setting) ? { exec: false } : {}) });
271
291
  if (typeof computer === "string") {
272
292
  await launched.release();
273
293
  throw unavailable(`${entry.label} could not start a ${kind} computer: ${computer}`);
@@ -276,8 +296,9 @@ export async function resolveComputer(given, mode, registry, side) {
276
296
  },
277
297
  };
278
298
  }
279
- /** The started computer as runTools takes it, or what it lacks, in words. */
280
- function runComputerOf(kind, launched, check) {
299
+ /** The started computer as runTools takes it, or what it lacks, in words. `agent`: a desktop's or a phone's surface and
300
+ * exec, as its agent's setting says them. */
301
+ function runComputerOf(kind, launched, check, agent) {
281
302
  // The run's browser tool opens a browser's sessions through its provider.
282
303
  if (kind === "browser")
283
304
  return launched.browser ? { kind, browser: launched.browser } : "it gave no CDP connection";
@@ -287,12 +308,12 @@ function runComputerOf(kind, launched, check) {
287
308
  // Each call the agent's tools make is recorded on the tool call's row (computer-calls.ts): the run's one client.
288
309
  const client = recordedClient(launched.client);
289
310
  if (kind === "phone")
290
- return hello ? { kind, computer: { client }, hello } : "it gave no hello";
311
+ return hello ? { kind, computer: { client }, hello, ...agent } : "it gave no hello";
291
312
  if (check && !launched.readBack)
292
313
  return "it gave no read-back of its mount";
293
314
  const readBack = launched.readBack ? () => launched.readBack() : async () => ({ ok: false, error: { code: "unsupported", message: "nothing is mounted in this computer" } });
294
315
  const computer = { id: launched.id, client, readBack };
295
316
  if (kind === "sandbox")
296
317
  return check ? { kind, computer, check } : "a sandbox mounts the run's folder";
297
- return hello ? { kind, computer, hello, ...(check ? { check } : {}) } : "it gave no hello";
318
+ return hello ? { kind, computer, hello, ...(check ? { check } : {}), ...agent } : "it gave no hello";
298
319
  }
@@ -9,7 +9,11 @@ export declare const RUN_SKILLS_DIR = ".agents/skills";
9
9
  *
10
10
  * `computer`: the run's computer kind. A desktop or a phone brings its kind's skill (desktop-computer, phone-computer),
11
11
  * laid as `<name>/SKILL.md` beside the agent's own, unless one of the agent's skills has that name (the agent's stays,
12
- * and the kind's is not laid), and only when that folder is not there yet. */
12
+ * and the kind's is not laid), and only when that folder is not there yet.
13
+ *
14
+ * Returns the skill files the run has beyond the revision's own: the kind's `<name>/SKILL.md` where the kind brings
15
+ * one (laid now or at an earlier claim), so the run's skill list (the prompt's, or a harness's own) names it as it
16
+ * names the revision's. */
13
17
  export declare function layOwnSkills(work: Workspace, skills: Readonly<Record<string, string>>, options?: {
14
18
  readonly computer?: string;
15
- }): Promise<void>;
19
+ }): Promise<readonly string[]>;
@@ -15,7 +15,11 @@ export const RUN_SKILLS_DIR = ".agents/skills";
15
15
  *
16
16
  * `computer`: the run's computer kind. A desktop or a phone brings its kind's skill (desktop-computer, phone-computer),
17
17
  * laid as `<name>/SKILL.md` beside the agent's own, unless one of the agent's skills has that name (the agent's stays,
18
- * and the kind's is not laid), and only when that folder is not there yet. */
18
+ * and the kind's is not laid), and only when that folder is not there yet.
19
+ *
20
+ * Returns the skill files the run has beyond the revision's own: the kind's `<name>/SKILL.md` where the kind brings
21
+ * one (laid now or at an earlier claim), so the run's skill list (the prompt's, or a harness's own) names it as it
22
+ * names the revision's. */
19
23
  export async function layOwnSkills(work, skills, options = {}) {
20
24
  const files = Object.entries(skills);
21
25
  for (const [path] of files) {
@@ -24,10 +28,12 @@ export async function layOwnSkills(work, skills, options = {}) {
24
28
  }
25
29
  const kind = kindSkillOf(options.computer);
26
30
  const own = new Set(files.map(([path]) => relativeSegments(path)[0]));
27
- if (kind && !own.has(kind.name))
28
- files.push([`${kind.name}/SKILL.md`, kind.text]);
31
+ const laysKind = kind !== undefined && !own.has(kind.name);
32
+ const brought = laysKind ? [`${kind.name}/SKILL.md`] : [];
33
+ if (laysKind)
34
+ files.push([brought[0], kind.text]);
29
35
  if (!files.length)
30
- return;
36
+ return brought;
31
37
  const there = await work.list(RUN_SKILLS_DIR).then((entries) => new Set(entries.map((entry) => entry.name)), (error) => {
32
38
  if (error instanceof WorkspaceError && error.code === "NOT_FOUND")
33
39
  return new Set();
@@ -35,8 +41,9 @@ export async function layOwnSkills(work, skills, options = {}) {
35
41
  });
36
42
  const missing = files.filter(([path]) => !there.has(relativeSegments(path)[0]));
37
43
  if (!missing.length)
38
- return;
44
+ return brought;
39
45
  await work.mkdir(RUN_SKILLS_DIR);
40
46
  for (const [path, text] of missing)
41
47
  await work.write(`${RUN_SKILLS_DIR}/${path}`, text);
48
+ return brought;
42
49
  }
@@ -0,0 +1,30 @@
1
+ import type { Store } from "../store/index.js";
2
+ import type { ComputerDeps } from "./computer-deps.js";
3
+ /** The longest a run's end may spend on its computers, every try with its pauses: past it the provider's calls are cut
4
+ * (one that takes no signal, a release, left to finish on its own) and the run's end goes on, said in the log. */
5
+ export declare const RUN_END_COMPUTERS_MS = 120000;
6
+ /** The pause before a run's end asks a provider that did not answer again. */
7
+ export declare const RUN_END_RETRY_MS = 5000;
8
+ export interface RunEndComputersDeps {
9
+ /** The run's row and launch (its revision and place) and the agent's revision, where its computer setting is; the
10
+ * computer ledger, for a provider that keeps one. */
11
+ readonly store: Pick<Store, "agents" | "computerLedger"> & {
12
+ readonly runs: Pick<Store["runs"], "get" | "launch">;
13
+ };
14
+ /** The run's computers as the runner composed them (computer-deps.ts computerDepsFrom): the registry, the provider
15
+ * makers, the key reader, and --faux's launch with the providers it takes. */
16
+ readonly computers: Pick<ComputerDeps, "kinds" | "providers" | "keyOf" | "keyTable" | "settings" | "launch" | "launches">;
17
+ /** Where what was let go, and a provider that failed, are said. */
18
+ readonly log: (line: string) => void;
19
+ /** The bound on every try. Default RUN_END_COMPUTERS_MS. */
20
+ readonly timeoutMs?: number;
21
+ /** The pause between tries. Default RUN_END_RETRY_MS. */
22
+ readonly retryMs?: number;
23
+ }
24
+ /** The run's end for its computers (RunEndComputersDeps): given the claim that ended the run, every computer of the run
25
+ * at or below its epoch deleted, a provider that did not answer asked again until the bound. Never throws: a failure
26
+ * is said in the log. */
27
+ export declare function runEndComputers(deps: RunEndComputersDeps): (claim: {
28
+ readonly runId: string;
29
+ readonly epoch: number;
30
+ }) => Promise<void>;
@@ -0,0 +1,137 @@
1
+ // A run's computers at its end: once the run is over, whatever ended it, no computer any of its claims made is left
2
+ // running. A claim lets go of its own computer at its end, and of every earlier claim's before it makes its own
3
+ // (computer-for-claim.ts releaseOlderClaims). A later claim that ends before that point (its computer refused or its
4
+ // image failed, a person's stop or cancel, a claim refused before the computer, a claim lost again) never gets there, so a
5
+ // lost runner's computer ran on to its deadline: a day on Docker, the vendor's own lifetime elsewhere, billed all along.
6
+ // The runner calls this once a run it ended is final (runner.ts announceEnd), before it says the run ended: the run's
7
+ // provider, by the agent's computer setting read as the claim reads it (settingOf), lists the run's computers by its
8
+ // label, and each one at or below the ending claim's epoch is deleted (the computer package's releaseOlder).
9
+ //
10
+ // Never let go here: the agent's own computer (a persistent setting: it outlives its runs), a paired computer (a person's
11
+ // own, never made or deleted: its id is no provider of the registry), and --faux's computers (the server's own launch
12
+ // makes them, with no provider to list). A run whose last claim was its first (epoch 1) has no earlier claim's computer to
13
+ // find: its provider is not asked. A vendor or a daemon that does not answer (often the very Docker that failed the later
14
+ // claim, still hung) is asked again every RUN_END_RETRY_MS until RUN_END_COMPUTERS_MS; a provider that can't be had here
15
+ // at all (its key is not in this runner's environment or the store) is not. Either is said in the runner's log, and the
16
+ // run's end stands. The janitor (computer-janitor.ts) ends a computer of a run that is over on its next sweep too, for a
17
+ // server that stopped before this ran, or a vendor that stayed down past the bound.
18
+ import { releaseOlder } from "@parcha/agentrun-computer";
19
+ import { KEY_TABLE, providerOptions } from "../computer-keys.js";
20
+ import { readLaunchBody } from "../run-launch.js";
21
+ import { settingOf } from "./computer-for-claim.js";
22
+ import { storeLedger } from "./computer-ledger.js";
23
+ import { providerKeys } from "./resolve-computer.js";
24
+ /** The longest a run's end may spend on its computers, every try with its pauses: past it the provider's calls are cut
25
+ * (one that takes no signal, a release, left to finish on its own) and the run's end goes on, said in the log. */
26
+ export const RUN_END_COMPUTERS_MS = 120_000;
27
+ /** The pause before a run's end asks a provider that did not answer again. */
28
+ export const RUN_END_RETRY_MS = 5_000;
29
+ /** Why a run's end can't have its provider here, which no later try changes: its keys or options. */
30
+ class NoProviderHere extends Error {
31
+ }
32
+ /** A releaseOlder answer no later try changes: fenced by a later claim's computer (refused), asked wrongly, or cut. */
33
+ const FINAL_CODES = new Set(["refused", "invalid", "aborted"]);
34
+ /** Waits `ms`, or less when `signal` aborts first: whether the wait ran its course. */
35
+ const pause = (ms, signal) => new Promise((resolve) => {
36
+ if (signal.aborted)
37
+ return resolve(false);
38
+ const done = () => {
39
+ clearTimeout(timer);
40
+ resolve(false);
41
+ };
42
+ const timer = setTimeout(() => {
43
+ signal.removeEventListener("abort", done);
44
+ resolve(true);
45
+ }, ms);
46
+ signal.addEventListener("abort", done, { once: true });
47
+ });
48
+ /** The run's end for its computers (RunEndComputersDeps): given the claim that ended the run, every computer of the run
49
+ * at or below its epoch deleted, a provider that did not answer asked again until the bound. Never throws: a failure
50
+ * is said in the log. */
51
+ export function runEndComputers(deps) {
52
+ const { store, computers, log } = deps;
53
+ /** The provider the run's computers are on, by the agent's setting; undefined where none of them is this end's to let
54
+ * go (none, the agent's own, a paired computer, --faux's). */
55
+ const providerOf = async (runId, epoch) => {
56
+ const run = await store.runs.get(runId);
57
+ if (!run)
58
+ return undefined;
59
+ const launch = readLaunchBody((await store.runs.launch(runId)).body);
60
+ const computer = launch?.computer;
61
+ const setting = await settingOf({ runId, epoch, revisionId: run.revisionId, ...(computer ? { computer } : {}), ...(launch?.place ? { place: launch.place } : {}) }, store);
62
+ if (!setting || setting.kind === "none" || setting.persistent === true || !setting.provider)
63
+ return undefined;
64
+ const entry = computers.kinds.PROVIDERS.find((one) => one.id === setting.provider);
65
+ if (!entry)
66
+ return undefined;
67
+ if (computers.launch && (computers.launches?.(entry.id) ?? true))
68
+ return undefined;
69
+ const make = Object.hasOwn(computers.providers, entry.id) ? computers.providers[entry.id] : undefined;
70
+ if (!make)
71
+ return undefined;
72
+ const keys = await providerKeys(computers.kinds, computers.keyOf ?? (async () => undefined))(entry.id);
73
+ const options = providerOptions(entry.id, keys, computers.settings ?? {}, computers.keyTable ?? KEY_TABLE);
74
+ if (!options.ok)
75
+ throw new NoProviderHere(options.error.message);
76
+ // A throw from here on is the vendor's or the daemon's (Docker's architecture asked): asked again.
77
+ return make(options.options, { ledger: storeLedger(store.computerLedger, entry.id) });
78
+ };
79
+ return async ({ runId, epoch }) => {
80
+ if (epoch <= 1)
81
+ return;
82
+ const bound = deps.timeoutMs ?? RUN_END_COMPUTERS_MS;
83
+ const signal = AbortSignal.timeout(bound);
84
+ let said = false;
85
+ const failed = (why) => {
86
+ if (said)
87
+ return;
88
+ said = true;
89
+ log(`run ${runId} is over, but its computers could not be let go: ${why}`);
90
+ };
91
+ /** The last try's failure, for the line said at the bound. */
92
+ let why = `its provider did not answer within ${bound / 1000} s`;
93
+ const tries = async () => {
94
+ for (;;) {
95
+ try {
96
+ const provider = await providerOf(runId, epoch);
97
+ if (!provider)
98
+ return;
99
+ // Every claim's at or below this one's: a computer of a later epoch fences the call (a later claim holds the run).
100
+ const released = await releaseOlder(provider, runId, epoch + 1, { signal });
101
+ if (released.ok) {
102
+ const names = released.value.released.map((ref) => ref.name);
103
+ if (names.length > 0)
104
+ log(`run ${runId} is over: let go of ${names.length === 1 ? "the computer" : "the computers"} an earlier claim left on ${provider.id}, ${names.join(", ")}`);
105
+ return;
106
+ }
107
+ why = `on ${provider.id}, ${released.error.message}`;
108
+ if (FINAL_CODES.has(released.error.code))
109
+ return failed(why);
110
+ }
111
+ catch (error) {
112
+ why = error instanceof Error ? error.message : String(error);
113
+ if (error instanceof NoProviderHere)
114
+ return failed(why);
115
+ }
116
+ if (!(await pause(deps.retryMs ?? RUN_END_RETRY_MS, signal)))
117
+ return failed(`${why} (asked until its bound)`);
118
+ }
119
+ };
120
+ // A release takes no signal, and a Docker delete has no timeout of its own: at the bound the run's end is answered
121
+ // whatever the provider is doing (its call is left to finish on its own), so a hung delete never holds the runner.
122
+ let stop = () => { };
123
+ const cut = new Promise((resolve) => {
124
+ stop = () => {
125
+ failed(`${why} (asked until its bound)`);
126
+ resolve();
127
+ };
128
+ signal.addEventListener("abort", stop, { once: true });
129
+ });
130
+ try {
131
+ await Promise.race([tries(), cut]);
132
+ }
133
+ finally {
134
+ signal.removeEventListener("abort", stop);
135
+ }
136
+ };
137
+ }
@@ -1,10 +1,9 @@
1
1
  import type { Context } from "@earendil-works/chord/context";
2
2
  import type { HostTool } from "@parcha/agentrun-kernel";
3
- import { type CapabilityKind, type ComputerPort, type Executor, type Registry } from "@parcha/agentrun-kernel/kernel";
3
+ import { type CapabilityKind, type Registry } from "@parcha/agentrun-kernel/kernel";
4
4
  import type { ComputerClient, HelloResult } from "@parcha/agentrun-computer";
5
5
  import { type Card } from "@parcha/agentrun-computer/surface";
6
6
  import type { AttachableComputer, MountCheck } from "./attach.js";
7
- import { ScriptGuard } from "./computer-script.js";
8
7
  import { type PiAnswer, type PiExecutor } from "./executors.js";
9
8
  import { type Hands } from "./hands.js";
10
9
  import { type ClaimBrowser, type ShellPlace } from "./resolve-computer.js";
@@ -25,31 +24,42 @@ export type RunComputer = {
25
24
  readonly kind: "sandbox";
26
25
  readonly computer: AttachableComputer;
27
26
  readonly check: MountCheck;
28
- } | {
27
+ } | ({
29
28
  readonly kind: "desktop";
30
29
  readonly computer: AttachableComputer;
31
30
  readonly hello: HelloResult;
32
31
  readonly check?: MountCheck;
33
- } | {
32
+ } & AgentComputer) | ({
34
33
  readonly kind: "phone";
35
34
  readonly computer: {
36
35
  readonly client: ComputerClient;
37
36
  };
38
37
  readonly hello: HelloResult;
39
- } | {
38
+ } & AgentComputer) | {
40
39
  readonly kind: "browser";
41
40
  readonly browser: ClaimBrowser;
42
41
  };
42
+ /** What a desktop's or a phone's agent may do with it, as its computer setting says (computer-setting.ts): `surface`,
43
+ * how it drives it ("code": by scripts, the step tools bound for a script's nested calls alone, never listed, and the
44
+ * hand-over listed; "tools", or absent: the step tools listed too: scriptsOnly); `exec: false`, no program of its own on it:
45
+ * its card and surface are made from its hello with
46
+ * the exec and processes groups taken out, so no tool and no script has a shell, and the run has no bash family
47
+ * anywhere (shell "none"). Only the agent's: the run's own computer channel (computer-channel.ts loopComputerOf, the
48
+ * owner's POST /runs/{id}/computer/call) keeps the computer's whole hello. */
49
+ export type AgentComputer = {
50
+ readonly surface?: "code" | "tools";
51
+ readonly exec?: false;
52
+ };
43
53
  /** A desktop's or a phone's port as a person's hold on the computer gives it back: each look or act made while the
44
54
  * person holds it waits for hand-back; a look then runs, an act then is refused (the take-over's own words). With it,
45
55
  * the agent's ask for the person (`handoff`, computer_request_handoff's port), through the same hold. */
46
56
  export type RunHold = (ports: Pick<Hands, "computer">) => Pick<Hands, "computer" | "handoff">;
47
- /** A desktop's or a phone's surface as a harness's own script runtime binds it (pi's code mode): its card, which the
48
- * script prelude builds `computer` from, and the run's port, held by the person's take-over as the tools' is. */
57
+ /** A desktop's or a phone's computer as a codemode script gets it bound (runner/meta-tools.ts): its card, the agent's
58
+ * own (no exec or processes group where its exec is off: `exec` false then, which a script's reach for computer.shell
59
+ * is told). */
49
60
  export type ScriptComputer = {
50
61
  readonly card: Card;
51
- readonly port: ComputerPort; /** What the script's shell and files are held to (computer-script.ts ScriptGuard). */
52
- readonly guard: ScriptGuard;
62
+ readonly exec?: false;
53
63
  };
54
64
  /** The run's scratch in its own folder: bash's TMPDIR. */
55
65
  export declare const TMP_DIR = ".agentrun/tmp";
@@ -75,10 +85,11 @@ export type RunHands = {
75
85
  readonly read: PiExecutor;
76
86
  readonly write: PiExecutor;
77
87
  readonly edit: PiExecutor;
78
- readonly bash?: PiExecutor; /** computer_script's run in serve's isolate, with a desktop or a phone. */
79
- readonly computer_script?: Executor;
88
+ readonly bash?: PiExecutor;
80
89
  };
81
- /** A desktop's or a phone's surface for a harness's own script runtime; none for any other computer. */
90
+ /** A desktop's or a phone's surface, as its agent's setting says it (AgentComputer); absent, every tool listed. */
91
+ readonly surface?: AgentComputer["surface"];
92
+ /** A desktop's or a phone's computer as a codemode script gets it bound; none for any other computer. */
82
93
  readonly computer?: ScriptComputer;
83
94
  /** The run's end, after its background processes are ended and before the computer is let go: bash's full outputs
84
95
  * and its TMPDIR swept. */
@@ -88,13 +99,15 @@ export type RunHands = {
88
99
  * with its kind's ports. `aliases`: other absolute names of the run's folder a tool call may give (the harness's
89
100
  * scratch folder), taken as the folder. `hold`: a person's hold on the computer (its take-over), given a desktop's or a
90
101
  * phone's ports and answering them wrapped, so a call made while the person holds it waits, and an action then is
91
- * refused; never the shell's, the files' or a browser's (its take-over is pi-browser's own). */
92
- export declare function runHands(workspace: Workspace, computer: RunComputer | undefined, options: {
102
+ * refused; never the shell's, the files' or a browser's (its take-over is pi-browser's own). `replaced`: the computer
103
+ * replaced an earlier claim's (ClaimComputer.replaced), so a desktop's or a phone's act is held to what it showed. */
104
+ export declare function runHands(workspace: Workspace, claimed: RunComputer | undefined, options: {
93
105
  readonly mode: 1 | 2;
94
106
  readonly context: Context;
95
107
  readonly aliases?: readonly string[];
96
108
  readonly hold?: RunHold;
97
109
  readonly bashPolicy?: string;
110
+ readonly replaced?: boolean;
98
111
  }): Promise<RunHands>;
99
112
  /** A tool as the kernel's registry lists it: what bindTools reads of its ToolDef. */
100
113
  export type RegistryDef = {
@@ -122,7 +135,9 @@ export type ToolResults = Map<string, {
122
135
  * session takes. The run's gate decided the call before its intent (the adapter loop's). The registry runs it on the
123
136
  * run's hands, and its answer is the text a model reads (executors.ts answerText): the output, the failure's words, the
124
137
  * diagnostics; in a failure, a write's or an edit's answer a path in the run's folder is named relative to it. A
125
- * failure the registry throws is the answer's text. `results` keeps each answer by its call id.
138
+ * failure the registry throws is the answer's text. `results` keeps each answer by its call id. computer_op, and under
139
+ * the agent's surface "code" a desktop's or a phone's step tools, are deferred: bound for a script's nested calls
140
+ * (codemode's `computer` and `tools.<name>`), never listed to the model (scriptsOnly).
126
141
  */
127
142
  export declare function bindTools(run: RunHands, registry: RunRegistry, names: readonly string[], options?: {
128
143
  readonly results?: ToolResults;
@@ -137,17 +152,18 @@ export type RunTools = {
137
152
  /** Where the run's shell is (runHands' shell): its gate reads its defaults by it (tool-gate.ts defaultPermission). */
138
153
  readonly shell: ShellPlace;
139
154
  /** The tools the claimed computer brings by its kind, as its groups offer them: a desktop's or a phone's
140
- * (computer_observe, computer_act, computer_screenshot, computer_script, computer_request_handoff), by the kernel
141
- * registry's own list. None with no computer, for
142
- * a sandbox, or for a browser (its own binding lists its tools). An agent names its computer, never these tools
143
- * (definition.tools refuses them), so a run binds them beside what it was granted (withKindTools). */
155
+ * (computer_observe, computer_act, computer_screenshot, computer_op, computer_request_handoff), by the kernel
156
+ * registry's own list. None with no computer, for a sandbox, or for a browser (its own binding lists its tools). An
157
+ * agent names its computer, never these tools (definition.tools refuses them), so a run binds them beside what it was
158
+ * granted (withKindTools). computer_op, and under its setting's surface "code" the step tools, are bound for scripts
159
+ * alone (scriptsOnly). */
144
160
  readonly kindTools: readonly string[];
161
+ /** A desktop's or a phone's computer as a codemode script gets it bound: the run's spec hands it to the session's
162
+ * codemode (adapter-loop.ts AdapterRunSpec.computer). None for any other computer. */
163
+ readonly computer?: ScriptComputer;
145
164
  /** The registry's tools `names` names, as the kernel's HostTool an adapter's session takes, each call through the
146
165
  * run's gate decided before its intent, each answer kept in `results` (bindTools). */
147
166
  hostTools(names: readonly string[], results?: ToolResults): HostTool[];
148
- /** A desktop's or a phone's surface for a harness's own script runtime (pi's code mode binds `computer` over it); none
149
- * for any other computer. */
150
- readonly computer?: ScriptComputer;
151
167
  /** The run's end, before the computer is let go: its background processes ended (TERM, then KILL 3 s later; none with
152
168
  * no computer), then bash's full outputs and TMPDIR swept. */
153
169
  end(): Promise<void>;
@@ -166,7 +182,8 @@ export declare function runTools(workspace: Workspace, computer: RunComputer | u
166
182
  readonly context: Context;
167
183
  readonly aliases?: readonly string[];
168
184
  readonly hold?: RunHold;
169
- readonly bashPolicy?: string;
185
+ readonly bashPolicy?: string; /** The computer replaced an earlier claim's (runHands). */
186
+ readonly replaced?: boolean;
170
187
  }): Promise<RunTools>;
171
188
  /** The names a run binds as host tools: what it was granted, then the tools its claimed computer brings by its kind
172
189
  * (RunTools.kindTools), each once. Each goes through the run's one gate under its own settings key (a desktop's under