@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
@@ -12,16 +12,20 @@
12
12
  import { randomBytes } from "node:crypto";
13
13
  import { externalKey, getAgent } from "./agents-store.js";
14
14
  import { CAP_TOLERANCE, money } from "./cap.js";
15
+ import { holdOf } from "./computer-held.js";
16
+ import { computerOfPlace, settingOfDefinition } from "./computer-setting.js";
15
17
  import { ApiError, invalid, unsupported } from "./errors.js";
16
18
  import { harnessOfBody } from "./harness.js";
17
19
  import { redacted, redactedOutput } from "./key-refusal.js";
18
- import { chooseWorkflows, LEARNING_BUDGET, learnedParts } from "./learning.js";
20
+ import { chooseWorkflows, LEARNING_BUDGET, learnedParts, learnsOf, RUN_LEARNING_USE } from "./learning.js";
19
21
  import { thinkingLevel } from "./model.js";
20
22
  import { resolvePlace } from "./place.js";
23
+ import { githubTargetOf } from "./github.js";
24
+ import { repoOf } from "./run-repo.js";
21
25
  import { launchBody } from "./run-launch.js";
22
26
  import { raiseFollowUpId } from "./run-view.js";
23
27
  import { sendCommand } from "./runner/commands.js";
24
- import { ExternalBodyConflict, RunFinal, StoreConstraint } from "./store/index.js";
28
+ import { AnswerTaken, ExternalBodyConflict, RunFinal, StoreConstraint } from "./store/index.js";
25
29
  import { toolingOf } from "./tools.js";
26
30
  import { planeFor } from "./tool-plane.js";
27
31
  import { clip } from "./web-fetch-direct.js";
@@ -38,6 +42,19 @@ function importedRefusal(moment) {
38
42
  next_action: { type: "request", method: "POST", path: `/agents/${moment.agentId}/runs`, caller_supplies: ["input", "Idempotency-Key"] },
39
43
  });
40
44
  }
45
+ /** An archived run, or a run of an archived agent, takes no message: archiving closes it. Said as archived, never as
46
+ * finished, with the way back: unarchive it (or its agent), or start a new run. */
47
+ function archivedRefusal(moment) {
48
+ const own = moment.archived === "run";
49
+ const why = own ? "This run is archived" : "This run's agent is archived";
50
+ const back = own ? `unarchive it (POST /runs/${moment.id}/unarchive)` : `unarchive the agent (POST /agents/${moment.agentId}/unarchive)`;
51
+ return new ApiError("not_continuable", `${why}, so it takes no message: ${back} to go on, or start a new run of the agent.`, {
52
+ details: { reason: "archived", archived: moment.archived },
53
+ next_action: own
54
+ ? { type: "request", method: "POST", path: `/runs/${moment.id}/unarchive`, caller_supplies: [] }
55
+ : { type: "request", method: "POST", path: `/agents/${moment.agentId}/unarchive`, caller_supplies: [] },
56
+ });
57
+ }
41
58
  /** A run that has ended takes no further act: start a new run (runs.ts finished). */
42
59
  function finished(moment) {
43
60
  const status = moment.cancelled ? "cancelled" : moment.terminalKind;
@@ -113,9 +130,12 @@ export const resume = (store, moment) => pauseOrResume(store, moment, false);
113
130
  * and never a deny of an approval. The mode is the label the v2 answer reports, from the run's moment. `queue`: the steer's
114
131
  * write when it is not this run's own (a trigger's: its firing marked with it, within its bound, store.triggers.message),
115
132
  * which may skip it, in words. */
116
- export async function message(store, moment, content, { requestId, answers = true, origin, queue } = {}) {
133
+ export async function message(store, moment, content, { requestId, answers = true, origin, queue, launchSealed, beforeSubmit } = {}) {
117
134
  if (moment.importedSource !== undefined)
118
135
  throw importedRefusal(moment);
136
+ // Archiving closes a run: it, or a run of its archived agent, takes no message, said as archived (never as finished).
137
+ if (moment.archived !== undefined)
138
+ throw archivedRefusal(moment);
119
139
  // A cancelled run takes no message, whether or not its end is written yet.
120
140
  if (moment.cancelled)
121
141
  throw finished(moment);
@@ -130,15 +150,17 @@ export async function message(store, moment, content, { requestId, answers = tru
130
150
  // approval): the message is then a message like any other, below.
131
151
  if (answers && moment.kind === "agentic" && moment.waitingApprovalId !== undefined) {
132
152
  const messageId = newMessageId();
133
- const declined = await sendCommand(store, moment.id, { kind: "deny", body: { approval: moment.waitingApprovalId, note: content, by: "message" } }).then(() => true, (error) => {
134
- if (error instanceof StoreConstraint)
153
+ const declined = await sendCommand(store, moment.id, { kind: "deny", body: { approval: moment.waitingApprovalId, note: content, by: "message" } }, launchSealed ? { launchSealed } : undefined).then(() => true, (error) => {
154
+ if (error instanceof AnswerTaken)
135
155
  return false;
136
156
  throw error;
137
157
  });
138
158
  if (declined)
139
159
  return { mode: "answer", messageId };
140
160
  }
141
- if (moment.terminal)
161
+ // A person's message puts no check of the run's end in front of its steer: the store's reopen alone says whether an ended
162
+ // run opens again with it (steerOrReopen). A trigger's message to an ended run is refused here, as before.
163
+ if (queue && moment.terminal)
142
164
  throw finished(moment);
143
165
  // Paused at its cap: a message would be refused for the same room, so the cap is raised first.
144
166
  if (moment.pausedWords !== undefined) {
@@ -150,13 +172,50 @@ export async function message(store, moment, content, { requestId, answers = tru
150
172
  throw waitingRefusal();
151
173
  const messageId = requestId ?? newMessageId();
152
174
  const body = { text: content, ...(answers ? {} : { answers: false }), ...(origin !== undefined ? { origin } : {}) };
175
+ // A test's seam (ServeOptions.beforeSubmit): every check above read `moment`; the write below is the run's door.
176
+ await beforeSubmit?.(moment.id, content);
153
177
  if (queue) {
154
178
  const queued = await queue({ kind: "steer", body });
155
179
  return { mode, messageId, ...(queued ? { skipped: queued.skipped } : {}) };
156
180
  }
157
- await sendCommand(store, moment.id, { kind: "steer", body });
181
+ await steerOrReopen(store, moment, { kind: "steer", body }, launchSealed);
158
182
  return { mode, messageId };
159
183
  }
184
+ /** The message's steer row: one door. A run the store holds final takes no new row (RunFinal); the message then goes
185
+ * through runs.reopen, which opens the run again with the steer in one transaction when the store says it may
186
+ * (reopenableWhere: an agentic run that completed, or that a person stopped, as the console offers a follow-up to both).
187
+ * Any other (cancelled, failed, a workflow's, an imported or a learning run) answers 409 finished, nothing written. */
188
+ async function steerOrReopen(store, moment, command, launchSealed) {
189
+ // The message's launch secrets (its mcp_auth, sealed) ride in the same write as its steer, whichever door takes it.
190
+ const sealed = launchSealed ? { launchSealed } : undefined;
191
+ try {
192
+ await sendCommand(store, moment.id, command, sealed);
193
+ }
194
+ catch (error) {
195
+ if (!(error instanceof RunFinal))
196
+ throw error;
197
+ try {
198
+ await store.runs.reopen(moment.id, command, sealed);
199
+ }
200
+ catch (again) {
201
+ if (!(again instanceof RunFinal))
202
+ throw again;
203
+ // Refused: another message may have opened the run again meanwhile, so the steer is sent once more, to the run now
204
+ // running. Refused that too, the run takes no message.
205
+ try {
206
+ await sendCommand(store, moment.id, command, sealed);
207
+ }
208
+ catch (last) {
209
+ if (!(last instanceof RunFinal))
210
+ throw last;
211
+ // Worded by the run's end as the store holds it now: the moment may have been read before that end (a race).
212
+ const state = (await store.runs.get(moment.id))?.state;
213
+ const terminalKind = state === "failed" ? "failed" : state === "stopped" ? "cancelled" : "completed";
214
+ throw finished({ ...moment, terminal: true, terminalKind });
215
+ }
216
+ }
217
+ }
218
+ }
160
219
  /** The raise command rows this run already has, newest last: the cap each names, and whether its runner has taken it. */
161
220
  async function raiseRows(store, runId) {
162
221
  return (await store.commands(runId, 0))
@@ -219,7 +278,7 @@ function alreadyAnswered(id, decision, ended = false) {
219
278
  * run could not resume) answers nothing, so the person may answer again. */
220
279
  async function sentAnswer(store, runId, id) {
221
280
  const row = (await store.commands(runId, 0)).find((command) => (command.kind === "approve" || command.kind === "deny") && command.refused === null && isObject(command.body) && command.body.approval === id);
222
- return row && { decision: row.kind === "approve" ? "allow" : "deny" };
281
+ return row && { decision: row.kind === "approve" ? "allow" : "deny", at: row.id };
223
282
  }
224
283
  /** How a stop or cancel written to run `runId` before `before` (a command id; absent, any) answers every call still waiting:
225
284
  * the runner reads commands in the order they were written, so it applies the stop first and withdraws (or, on a cancel,
@@ -242,9 +301,18 @@ export async function approve(store, moment, id, decision, note) {
242
301
  if (given.decision !== decision)
243
302
  throw alreadyAnswered(id, given.decision, given.ended === true);
244
303
  };
245
- const given = moment.answeredApprovals?.[id] ?? (await sentAnswer(store, moment.id, id));
246
- if (given)
304
+ const answered = moment.answeredApprovals?.[id];
305
+ if (answered)
306
+ return settle(answered);
307
+ const given = await sentAnswer(store, moment.id, id);
308
+ if (given) {
309
+ // The answer written before (this one's retry, or another) sits behind a stop or cancel the runner has not taken yet:
310
+ // it never runs, so it is told as any answer behind that stop is, never settled as taken.
311
+ const behind = await endBefore(store, moment.id, { before: given.at });
312
+ if (behind)
313
+ throw alreadyAnswered(id, behind.decision);
247
314
  return settle(given);
315
+ }
248
316
  if (!(moment.approvalIds?.has(id) ?? false))
249
317
  throw new ApiError("not_found", `The run ${moment.id} has no tool call ${id} waiting for approval.`);
250
318
  const ending = await endBefore(store, moment.id);
@@ -262,7 +330,8 @@ export async function approve(store, moment, id, decision, note) {
262
330
  const end = await endBefore(store, moment.id, { taken: true });
263
331
  throw alreadyAnswered(id, end?.decision ?? "withdrawn", end === undefined);
264
332
  }
265
- const won = error instanceof StoreConstraint ? await sentAnswer(store, moment.id, id) : undefined;
333
+ // Lost to an answer written first (the store's AnswerTaken, from its one-answer index alone): read the winner.
334
+ const won = error instanceof AnswerTaken ? await sentAnswer(store, moment.id, id) : undefined;
266
335
  if (!won)
267
336
  throw error;
268
337
  return settle(won);
@@ -272,6 +341,14 @@ export async function approve(store, moment, id, decision, note) {
272
341
  const raced = await endBefore(store, moment.id, { before: sent.id });
273
342
  if (raced)
274
343
  throw alreadyAnswered(id, raced.decision);
344
+ // That stop's end may already be written by this read: its runner took the stop and refused this answer in the same
345
+ // commit. Read the answer back: refused behind a stop or cancel, it never runs either.
346
+ const mine = (await store.commands(moment.id, 0)).find((command) => command.id === sent.id);
347
+ if (mine?.refused != null) {
348
+ const end = await endBefore(store, moment.id, { before: sent.id, taken: true });
349
+ if (end)
350
+ throw alreadyAnswered(id, end.decision);
351
+ }
275
352
  }
276
353
  // ---- start -----------------------------------------------------------------------------------------------------------
277
354
  /** A UUIDv7 run id: time-ordered, so a listing by start time is stable, and unique per run. */
@@ -289,35 +366,42 @@ const noShown = { text: (text) => text, name: (name) => name, holds: () => false
289
366
  * server's learning off, a workflow revision, or its revision does not say learning), else the notes its # Learned section
290
367
  * names and the # Learned text (learnedParts, the one decision the runner puts in the prompt), the seed sha it starts
291
368
  * from and the count of all the seed's notes before the budget picked `given` (seedNotes) — or given empty, seed null and no
292
- * seedNotes when its seed cannot be read (a learning fault never refuses a run). */
293
- async function learningStartFor(deps, entry, revision, rbody, input) {
294
- const learns = deps.learning !== undefined && deps.learning !== "off" && revision.kind === "agentic" && rbody.learning === true;
369
+ * seedNotes when its seed cannot be read (a learning fault never refuses a run). `use`: the run's start said `learning:
370
+ * "use"`, so it starts from what its agent learned, its revision's own learning aside, and keeps nothing. */
371
+ async function learningStartFor(deps, entry, revision, rbody, input, use) {
372
+ // A run started with `learning: "use"` starts from what its agent learned whatever its revision says, and keeps nothing
373
+ // (no grade model: nothing is graded); the server's learning off still gives it nothing.
374
+ const learns = deps.learning !== undefined && deps.learning !== "off" && revision.kind === "agentic" && (learnsOf(rbody.learning) || use);
375
+ // `learning: "notes"`: its notes and skills, never a learned workflow (none offered, none asked for at its end).
376
+ const notesOnly = rbody.learning === "notes" ? { notesOnly: true } : {};
295
377
  if (!learns || !deps.seedFor)
296
378
  return undefined;
297
- const grade = deps.gradeModel ? { gradeModel: deps.gradeModel } : {};
379
+ const grade = use ? { use: true } : deps.gradeModel ? { gradeModel: deps.gradeModel } : {};
298
380
  const seeded = await deps.seedFor(entry.agent.id);
299
381
  // The folder could not be read (main's STOPPED.unreadable), or what it read could not be made into the start (main's
300
382
  // copy that threw, STOPPED.notCopied): the run starts with nothing learned, and its learning end says which.
301
383
  if (!("seed" in seeded))
302
- return { given: [], seed: null, section: "", seedFailed: "unreadable", ...grade };
384
+ return { given: [], seed: null, section: "", seedFailed: "unreadable", ...notesOnly, ...grade };
303
385
  try {
304
386
  // The run's input goes to the note selector (learning.ts NoteSelector; byRelevance, the default, scores the notes by it).
305
387
  const options = { budget: deps.learningBudget ?? LEARNING_BUDGET, read: Array.isArray(rbody.tools) && rbody.tools.includes("read"), shown: deps.shown ? deps.shown() : noShown, run: { input } };
306
388
  // The notes and the # Learned text are the old start's one decision (learnedParts: one choice of the note selector), so
307
389
  // the runner lays exactly this section for exactly these notes and reads no learning folder. seedNotes is the whole
308
390
  // seed's note count, before the budget narrowed `given` (as the old seed_notes was).
309
- const { section, given } = learnedParts(seeded.seed, options);
391
+ const { section, given, left } = learnedParts(seeded.seed, options);
392
+ // The notes the section names in no way, over the budget: the claim says them in the run's log (learning-seed.ts).
393
+ const notesLeftOut = left.map((note) => options.shown.name(note.file));
310
394
  // The learned skills the seed offers the run, by name: each with its files (one over a run's skill budget at all is held
311
395
  // by its size and never laid) and no host secret in it, as chooseSkills leaves them out. The claim lays them; the
312
396
  // end-of-run turn counts the runs each served (runner/learning-end.ts draftForOf).
313
397
  const skills = (seeded.seed.skills ?? []).flatMap(({ name, files }) => (files && !options.shown.holds(name) && !Object.entries(files).some(([path, text]) => options.shown.holds(path) || options.shown.holds(text)) ? [name] : []));
314
398
  // The learned workflows its learned_workflow tool runs, by name, as the claim chooses them (chooseWorkflows): what the
315
399
  // agent's impact counts a run as started from, beside its notes and skills.
316
- const workflows = chooseWorkflows(seeded.seed, options.shown).flows.map(({ name }) => name);
317
- return { given: given.map(({ file, name }) => ({ file, name })), seed: seeded.seed.sha, section: section ?? "", seedNotes: Object.keys(seeded.seed.notes).length, ...(skills.length ? { skills } : {}), ...(workflows.length ? { workflows } : {}), ...grade };
400
+ const workflows = notesOnly.notesOnly ? [] : chooseWorkflows(seeded.seed, options.shown).flows.map(({ name }) => name);
401
+ return { given: given.map(({ file, name }) => ({ file, name })), seed: seeded.seed.sha, section: section ?? "", seedNotes: Object.keys(seeded.seed.notes).length, ...(notesLeftOut.length ? { notesLeftOut } : {}), ...(skills.length ? { skills } : {}), ...(workflows.length ? { workflows } : {}), ...notesOnly, ...grade };
318
402
  }
319
403
  catch {
320
- return { given: [], seed: null, section: "", seedFailed: "not_copied", ...grade };
404
+ return { given: [], seed: null, section: "", seedFailed: "not_copied", ...notesOnly, ...grade };
321
405
  }
322
406
  }
323
407
  /** Starts a run of `entry`'s agent from a create body, as POST /agents/{id}/runs starts it: every check the old start made
@@ -325,11 +409,11 @@ async function learningStartFor(deps, entry, revision, rbody, input) {
325
409
  * (store.runs.create), which a runner reads at its claim. No process, no door, no setup file: where the run runs is the
326
410
  * runner's. Under `origin`, a key that already started a run gets that run (the store's one-run-per-key), so a retry never
327
411
  * starts a second. */
328
- export async function startRun(store, deps, entry, body, { trigger, origin, capped = false, from, title } = {}) {
412
+ export async function startRun(store, deps, entry, body, { trigger, origin, capped = false, from, title, sealed } = {}) {
329
413
  const { launch, revision } = await prepareLaunch(deps, entry, body, { ...(trigger ? { trigger } : {}), capped, ...(from ? { from } : {}), ...(title !== undefined ? { title } : {}) });
330
414
  const runId = (deps.newRunId ?? uuidv7)();
331
415
  try {
332
- return await withHeldFiles(deps, runId, launch, () => store.runs.create({ id: runId, agentId: entry.agent.id, revisionId: revision.id, ...(origin ? { origin } : {}) }, { body: launchBody(launch) }));
416
+ return await withHeldFiles(deps, runId, launch, () => store.runs.create({ id: runId, agentId: entry.agent.id, revisionId: revision.id, ...(origin ? { origin } : {}) }, { body: launchBody(launch), ...(sealed ? { sealed: sealed(runId) } : {}) }));
333
417
  }
334
418
  catch (error) {
335
419
  // Only another writer of the store got here first under the same origin key: its run is the one asked for.
@@ -366,14 +450,21 @@ async function withHeldFiles(deps, runId, launch, write) {
366
450
  * agent already mapped to the reference is the run's (its id, its learning), so a run of a later version learns from the
367
451
  * earlier ones. A different definition under a version already run is 409 external_body_conflict, nothing written; under
368
452
  * `origin`, a key that already started a run gets that run, as startRun's. */
369
- export async function startInline(store, deps, inline, body, { origin } = {}) {
453
+ export async function startInline(store, deps, inline, body, { origin, sealed } = {}) {
370
454
  const { external, revision } = inline;
371
455
  const ref = externalKey(external);
372
456
  const mapped = await store.agents.byExternal(ref);
373
- const entry = (mapped && (await getAgent(store, mapped.id))) || {
374
- agent: { id: uuidv7(), name: inline.name, description: inline.description, currentRevision: null, createdAt: Date.now(), archivedAt: null, externalRef: ref },
375
- revision: null, version: 0, revisions: 0, sizes: new Map(),
376
- };
457
+ const stored = mapped ? await getAgent(store, mapped.id) : null;
458
+ // A version's first run brings the agent's name and description up to it, in the start's own transaction (createInline),
459
+ // so its launch is prepared under them: a workflow run's title names the version it runs. A run of a version already
460
+ // stored keeps the agent's as they are, as a run of any agent's earlier revision does.
461
+ const firstOfVersion = !stored || !(await store.agents.hasExternalVersion(stored.agent.id, external.version));
462
+ const entry = stored
463
+ ? firstOfVersion ? { ...stored, agent: { ...stored.agent, name: inline.name, description: inline.description } } : stored
464
+ : {
465
+ agent: { id: uuidv7(), name: inline.name, description: inline.description, currentRevision: null, createdAt: Date.now(), archivedAt: null, externalRef: ref },
466
+ revision: null, version: 0, revisions: 0, sizes: new Map(),
467
+ };
377
468
  // A store revision is the revision the run path reads as a pi Revision (its body is the revision body), as pinnedOf hands
378
469
  // one across.
379
470
  const { launch } = await prepareLaunch(deps, entry, body, { revision: revision });
@@ -383,7 +474,7 @@ export async function startInline(store, deps, inline, body, { origin } = {}) {
383
474
  agent: { id: entry.agent.id, name: inline.name, description: inline.description, ref },
384
475
  revision: { id: revision.id, version: external.version, kind: revision.kind, body: revision.body, skills: revision.skills, ...(revision.note !== undefined ? { note: revision.note } : {}) },
385
476
  run: { id: runId, ...(origin ? { origin } : {}) },
386
- launch: { body: launchBody(launch) },
477
+ launch: { body: launchBody(launch), ...(sealed ? { sealed: sealed(runId) } : {}) },
387
478
  }));
388
479
  }
389
480
  catch (error) {
@@ -441,6 +532,14 @@ export async function prepareLaunch(deps, entry, body, { trigger, capped = false
441
532
  const capMode = cap === undefined ? undefined : typeof body.cap_mode === "string" ? body.cap_mode : rbody.capMode;
442
533
  const place = resolvePlace(rbody.place, deps.fallbackPlace(revision.kind, revision.kind === "agentic" ? (rbody.tools ?? []) : []));
443
534
  await deps.runnable(revision, place, { capped: cap !== undefined });
535
+ // A held computer (computer-held.ts): only one that speaks the protocol, its kind as the claim reads it (the
536
+ // revision's computer, else its place's).
537
+ const hold = holdOf(body, (settingOfDefinition(rbody)?.computer ?? computerOfPlace(place)).kind);
538
+ if (hold !== undefined && "field" in hold)
539
+ throw invalid([hold]);
540
+ // A workflow's loop opens no held computer and takes no start or release: its run holds nothing.
541
+ if (hold !== undefined && revision.kind === "workflow")
542
+ throw invalid([{ field: "hold", reason: "not_an_option", message: "hold is for an agent's run: a workflow run does not hold its computer for its owner." }]);
444
543
  // The title shows on the run's page, the runs list and Mission Control: built from its input as shown, each held value
445
544
  // redacted before a long one is cut (a cut key could no longer be found).
446
545
  const shown = redactedOutput(input, deps.serverSecrets());
@@ -456,13 +555,28 @@ export async function prepareLaunch(deps, entry, body, { trigger, capped = false
456
555
  // learning is on and its revision says so; then its seed is read now and the notes its # Learned section names (learnedParts,
457
556
  // the one decision) are pinned in the launch for the runner to put in the prompt. A seed that cannot be read starts it with
458
557
  // nothing (given empty, seed null); the end state is the runner's.
459
- const learning = await learningStartFor(deps, entry, revision, rbody, input);
558
+ const learning = await learningStartFor(deps, entry, revision, rbody, input, body.learning === RUN_LEARNING_USE);
559
+ // The run's Archil disk, chosen now and kept in its launch (run-launch.ts archilDisk): the one the body names (a disk per
560
+ // customer), else its agent's when it has one; with neither, its claim makes the agent's.
561
+ const named = isObject(body.archil_disk) && typeof body.archil_disk.disk_id === "string" ? body.archil_disk.disk_id : undefined;
562
+ if (named !== undefined && !deps.launchDiskOf)
563
+ throw invalid([{ field: "archil_disk", reason: "not_allowed", message: "This server keeps no run on an Archil disk." }]);
564
+ const archilDisk = deps.launchDiskOf ? await deps.launchDiskOf(entry.agent.id, named) : undefined;
460
565
  // The run's effort: its own, else its revision's saved thinking, else the host's AGENT_THINKING (each a thinking level,
461
566
  // else none). Nothing set: none, so the run gets no effort note and its harness's own default. Kept in its launch, so
462
567
  // its harness's thinking, its guidance and its metrics all read the one value.
463
568
  const effort = typeof body.effort === "string" ? body.effort : (thinkingLevel(rbody.thinking) ?? thinkingLevel(deps.planeEnv().AGENT_THINKING));
569
+ // The repository a person's run reaches (run-repo.ts): the one the body names when the agent is bound to it, else the
570
+ // agent's one repository when the first message names none. A trigger's run takes its repository from its event.
571
+ const namedRepo = typeof body.repo === "string" ? body.repo : undefined;
572
+ if (trigger && namedRepo !== undefined)
573
+ throw invalid([{ field: "repo", reason: "not_allowed", message: "A run a trigger starts takes its repository from the event that fired it.", fix: "Remove repo." }]);
574
+ const picked = trigger ? {} : repoOf(await (deps.boundRepos?.(entry.agent.id) ?? { repos: [], open: false }), namedRepo, githubTargetOf(typeof input.content === "string" ? input.content : undefined) !== undefined);
575
+ if (picked.refused)
576
+ throw invalid([{ field: "repo", reason: "not_allowed", message: picked.refused }]);
464
577
  const launch = {
465
578
  input,
579
+ ...(picked.repo !== undefined ? { repo: picked.repo } : {}),
466
580
  title: clip(redacted(title.trim().replace(/\s+/g, " "), deps.serverSecrets()), 80),
467
581
  place,
468
582
  harness: harnessOfBody(revision.body),
@@ -479,6 +593,8 @@ export async function prepareLaunch(deps, entry, body, { trigger, capped = false
479
593
  ...(trigger ? { trigger } : {}),
480
594
  ...(from ? { inputOrigin: from } : {}),
481
595
  ...(model ? { model } : {}),
596
+ ...(archilDisk ? { archilDisk } : {}),
597
+ ...(hold ? { hold } : {}),
482
598
  };
483
599
  return { launch, revision };
484
600
  }
package/dist/seal-key.js CHANGED
@@ -11,7 +11,7 @@
11
11
  // The store records the key's fingerprint (an HMAC of a fixed label under the key: never the key, nor a hash of it alone),
12
12
  // and every process that opens the store (the server, a runner, the `import` command) checks the key it holds against it
13
13
  // (bootSealKey). A store whose secrets were sealed with another key is refused, in words, and no key is ever made over
14
- // sealed secrets, in the store or beside it in the data directory: a lost key file is not replaced by a new one. A store
14
+ // sealed secrets in the store: a lost key file is not replaced by a new one. A store
15
15
  // with no fingerprint takes a key that opens every value it keeps sealed, or any key when it keeps none. The server's
16
16
  // start makes a key and records it (and the import's, which sets a data directory up as the server does); a runner reads
17
17
  // one and checks it, and never makes or records one. Several data directories in one process each keep their own key.
@@ -170,12 +170,12 @@ function opensUnder(key, sealed, aad) {
170
170
  return false;
171
171
  }
172
172
  }
173
+ /** Every secret is kept in the store (the outbound webhook's too, a trigger_settings row): its sealed values are all. */
173
174
  async function storeSealOf(store) {
174
175
  const fingerprint = recordedIn(await store.settings.get(SEAL_KEY_SETTING));
175
176
  if (fingerprint !== undefined)
176
177
  return { fingerprint, sealed: [] };
177
- const rows = (await store.sealedSecrets.all()).map((row) => (key) => opensUnder(key, row.sealed, row.aad));
178
- return { fingerprint, sealed: rows };
178
+ return { fingerprint, sealed: (await store.sealedSecrets.all()).map((row) => (key) => opensUnder(key, row.sealed, row.aad)) };
179
179
  }
180
180
  const holdsSecrets = (seal) => seal.fingerprint !== undefined || seal.sealed.length > 0;
181
181
  /** Whether `key` is the store's, or why not: the one its fingerprint records; with none recorded, one that opens every
@@ -47,9 +47,10 @@ declare class SealedSettingsOverStore {
47
47
  load(): Promise<void>;
48
48
  /** A new secret for `scope`'s `field` (one the spec mints), written sealed before it is answered: its only showing. */
49
49
  mint(scope: string, field: string): Promise<string>;
50
- /** A given value for `scope`'s `field` (a sender's signing secret, a bot's token), written sealed. One under its field's
50
+ /** A given value for `scope`'s `field` (a sender's signing secret, a bot's token), written sealed; `as: "utf8"` for a
51
+ * signing secret that is no `whsec_` one (its whole string is the key). One under its field's
51
52
  * rules is refused, 422, before anything is written. */
52
- set(scope: string, field: string, value: string): Promise<void>;
53
+ set(scope: string, field: string, value: string, as?: "utf8"): Promise<void>;
53
54
  private put;
54
55
  private write;
55
56
  /** `value`, once `scope`'s `field`, kept sealed in a retired row of its own: scope `retired:<scope>:<n>` (a scope's
@@ -65,6 +66,8 @@ declare class SealedSettingsOverStore {
65
66
  /** Whether `scope`'s `field` is kept here but did not open under this server's seal key (sealed under another): unset
66
67
  * here, and said once at load, until it is set again. */
67
68
  unopenedAt(scope: string, field: string): boolean;
69
+ /** The live scopes this store keeps (never a retired one), those whose values did not open here among them. */
70
+ scopes(): string[];
68
71
  /** A scope's settings gone (a deleted trigger's). Durable before it resolves. */
69
72
  remove(scope: string): Promise<void>;
70
73
  private removeNow;
@@ -85,9 +85,10 @@ class SealedSettingsOverStore {
85
85
  await this.put(scope, field, secret);
86
86
  return secret;
87
87
  }
88
- /** A given value for `scope`'s `field` (a sender's signing secret, a bot's token), written sealed. One under its field's
88
+ /** A given value for `scope`'s `field` (a sender's signing secret, a bot's token), written sealed; `as: "utf8"` for a
89
+ * signing secret that is no `whsec_` one (its whole string is the key). One under its field's
89
90
  * rules is refused, 422, before anything is written. */
90
- async set(scope, field, value) {
91
+ async set(scope, field, value, as) {
91
92
  const spec = this.spec.fields[field];
92
93
  if (!spec)
93
94
  throw new Error(`${this.adapterId}'s settings keep no ${field}`);
@@ -97,9 +98,10 @@ class SealedSettingsOverStore {
97
98
  // PEM key is listed by its lines (pemValues).
98
99
  if (!spec.public && spec.format !== "pem" && (/\s/.test(value) || Buffer.byteLength(value, "utf8") < 8))
99
100
  throw invalid([{ field, reason: "invalid", message: `${field} is at least 8 bytes, with no whitespace` }]);
100
- if (spec.minBytes === MIN_KEY_BYTES && !value.startsWith(SECRET_PREFIX))
101
+ // `utf8`: a sender's own secret, whose whole string is the key (Composio's), not a Standard Webhooks one.
102
+ if (as !== "utf8" && spec.minBytes === MIN_KEY_BYTES && !value.startsWith(SECRET_PREFIX))
101
103
  throw invalid([{ field, reason: "invalid", message: `${field} is a Standard Webhooks secret: whsec_ and its key in base64` }]);
102
- if (spec.minBytes !== undefined && keyBytes(value) < spec.minBytes)
104
+ if (spec.minBytes !== undefined && (as === "utf8" ? Buffer.byteLength(value, "utf8") : keyBytes(value)) < spec.minBytes)
103
105
  throw invalid([{ field, reason: "too_short", message: `${field} holds at least ${spec.minBytes} bytes` }]);
104
106
  await this.put(scope, field, value);
105
107
  }
@@ -153,6 +155,10 @@ class SealedSettingsOverStore {
153
155
  unopenedAt(scope, field) {
154
156
  return this.unopened.has(pair(scope, field));
155
157
  }
158
+ /** The live scopes this store keeps (never a retired one), those whose values did not open here among them. */
159
+ scopes() {
160
+ return [...new Set([...Object.keys(this.opened), ...[...this.unopened].map((key) => key.slice(0, key.indexOf("\0")))])];
161
+ }
156
162
  /** A scope's settings gone (a deleted trigger's). Durable before it resolves. */
157
163
  remove(scope) {
158
164
  return this.serial(scope, () => this.removeNow(scope));
package/dist/sealing.js CHANGED
@@ -1,5 +1,4 @@
1
- // AES-256-GCM sealing, the one primitive every secret this server keeps at rest is sealed with (copied from
2
- // @parcha/pi-durable-agent's vault.ts): the store's sealed columns (store/seal.ts), the
1
+ // AES-256-GCM sealing, the one primitive every secret this server keeps at rest is sealed with (the store's sealed columns (store/seal.ts), the
3
2
  // trigger settings, the outbound webhook's secret, and what a runner opens under the server's seal key.
4
3
  import { createCipheriv, createDecipheriv, randomBytes } from "node:crypto";
5
4
  const IV_BYTES = 12;
@@ -1,7 +1,7 @@
1
1
  import { keyShaped } from "./secret-name.js";
2
2
  /** Whether a name is a secret's, whatever list names it or none does: one of its `_`-separated segments, in any case, is
3
3
  * KEY, TOKEN, SECRET, PASSWORD, PASSWD, PASS, PAT, CREDENTIAL, CREDENTIALS or DSN, or its last is PWD after another.
4
- * The one rule, pi-durable-disk's own: this cut, the harness log's and a run's environment (secrets.ts' withoutSecrets)
4
+ * The one rule: this cut, the harness log's and a run's environment (secrets.ts' withoutSecrets)
5
5
  * take it, so what one leaves out the others do. */
6
6
  export { keyShaped };
7
7
  export declare const REDACTED = "[redacted]";
@@ -9,7 +9,7 @@ secretLintProfiler.setEnabled(false);
9
9
  import { keyShaped } from "./secret-name.js";
10
10
  /** Whether a name is a secret's, whatever list names it or none does: one of its `_`-separated segments, in any case, is
11
11
  * KEY, TOKEN, SECRET, PASSWORD, PASSWD, PASS, PAT, CREDENTIAL, CREDENTIALS or DSN, or its last is PWD after another.
12
- * The one rule, pi-durable-disk's own: this cut, the harness log's and a run's environment (secrets.ts' withoutSecrets)
12
+ * The one rule: this cut, the harness log's and a run's environment (secrets.ts' withoutSecrets)
13
13
  * take it, so what one leaves out the others do. */
14
14
  export { keyShaped };
15
15
  export const REDACTED = "[redacted]";
@@ -2,10 +2,11 @@ import type { IncomingMessage } from "node:http";
2
2
  /** The one refusal a secret write from anything but the owner's session gets (403 forbidden). */
3
3
  export declare const SECRET_WRITE_REFUSAL = "Saving, replacing or removing a secret takes the owner's signed-in session in the console; the API token can't write secrets.";
4
4
  /**
5
- * Whether the console a launcher opened on a loopback-bound server with no accounts (npx agentrun, no password: the
6
- * browser that followed the launch link, its cookie minted from the token by that link, held to this server's own origin
7
- * and a JSON body as every page write is) counts as the owner for a secret write. The owner's ruling (2026-11-09): yes. The
8
- * API token still never writes a secret, loopback included; a server bound off loopback needs accounts on to take a
5
+ * Whether the console a launcher opened on a loopback-bound server with no accounts (no password: the browser that
6
+ * followed the launch link, `/?launch=<code>`, its cookie a session id made at random and kept by the server, never
7
+ * derived from the token, held to this server's own origin and a JSON body as every page write is) counts as the owner
8
+ * for a secret write. The owner's ruling (2026-11-09): yes. The API token never writes a secret, loopback included: it
9
+ * can neither compute a console session nor get one from its own link (page.ts ConsoleSessions); a server bound off loopback needs accounts on to take a
9
10
  * secret at all. This one line is the decision; mayWriteSecrets (the dispatch check, and GET /v2/auth/session's
10
11
  * secrets_writable) follows it.
11
12
  */
@@ -3,10 +3,11 @@ import { byConsoleSession, byOwnerSession } from "./page.js";
3
3
  export const SECRET_WRITE_REFUSAL = "Saving, replacing or removing a secret takes the owner's signed-in session in the console; the API token can't write secrets.";
4
4
  // ---- who may write a secret ------------------------------------------------------------------------------------------
5
5
  /**
6
- * Whether the console a launcher opened on a loopback-bound server with no accounts (npx agentrun, no password: the
7
- * browser that followed the launch link, its cookie minted from the token by that link, held to this server's own origin
8
- * and a JSON body as every page write is) counts as the owner for a secret write. The owner's ruling (2026-11-09): yes. The
9
- * API token still never writes a secret, loopback included; a server bound off loopback needs accounts on to take a
6
+ * Whether the console a launcher opened on a loopback-bound server with no accounts (no password: the browser that
7
+ * followed the launch link, `/?launch=<code>`, its cookie a session id made at random and kept by the server, never
8
+ * derived from the token, held to this server's own origin and a JSON body as every page write is) counts as the owner
9
+ * for a secret write. The owner's ruling (2026-11-09): yes. The API token never writes a secret, loopback included: it
10
+ * can neither compute a console session nor get one from its own link (page.ts ConsoleSessions); a server bound off loopback needs accounts on to take a
10
11
  * secret at all. This one line is the decision; mayWriteSecrets (the dispatch check, and GET /v2/auth/session's
11
12
  * secrets_writable) follows it.
12
13
  */
@@ -7,9 +7,10 @@ type ServerSecretsStore = {
7
7
  readonly triggerSettings: Pick<TriggerSettings, "get" | "put" | "removeScope">;
8
8
  flush(): Promise<void>;
9
9
  };
10
- /** The server's own secrets over the store: what it keeps beside the store (besideTheStore), every adapter's sealed
11
- * settings and the outbound webhook's (OUTBOUND_WEBHOOK, its signing secret), store rows, which are returned too, by id,
12
- * for the server to keep using. Loads each adapter's settings before it answers (awaited once at start), so the redaction
10
+ /** The server's own secrets over the store: what it keeps beside the store (besideTheStore), the outbound webhook's
11
+ * signing secret and each one it held before (adapter webhook-out, retired ones too, so a secret replaced or removed stays
12
+ * on the list across restarts), and every adapter's sealed settings, store rows, which are returned too, by id, for the
13
+ * server to keep using. Loads each adapter's settings before it answers (awaited once at start), so the redaction
13
14
  * list is whole from the first use. A value that does not open is said to `say`. */
14
15
  export declare function openServerSecretsOverStore(store: ServerSecretsStore, data: string, env: NodeJS.ProcessEnv, adapters: readonly Pick<TriggerAdapter, "id" | "settings">[], say?: (fields: Record<string, string>) => void): Promise<{
15
16
  secrets: ServerSecrets;
@@ -1,15 +1,16 @@
1
1
  // The server's own secrets as one redaction list, over the one store: each trigger source's sealed settings and the
2
- // outbound webhook's signing secret are store rows (sealed-settings-store.ts, store.triggerSettings); the owner's API
3
- // token (.token, the CLI reads it) and the sign-in session secret stay beside the store (server-secrets.ts besideTheStore). The list is
4
- // the one the server never shows (server.ts serverSecrets): what a run shows, what learning keeps and what the server
5
- // answers are cut of it.
2
+ // outbound webhook's signing secret are store rows (sealed-settings-store.ts, store.triggerSettings; the webhook's under
3
+ // adapter webhook-out, webhooks.ts); the owner's API token (.token, the CLI reads it) and the sign-in session secret stay
4
+ // beside the store (server-secrets.ts besideTheStore). The list is the one the server never shows (server.ts
5
+ // serverSecrets): what a run shows, what learning keeps and what the server answers are cut of it.
6
6
  import { sealedSettingsOverStore } from "./sealed-settings-store.js";
7
7
  import { besideTheStore } from "./server-secrets.js";
8
8
  import { SEAL_KEY_ENV, sealKeyOf } from "./tool-keys.js";
9
- import { OUTBOUND_WEBHOOK } from "./webhooks.js";
10
- /** The server's own secrets over the store: what it keeps beside the store (besideTheStore), every adapter's sealed
11
- * settings and the outbound webhook's (OUTBOUND_WEBHOOK, its signing secret), store rows, which are returned too, by id,
12
- * for the server to keep using. Loads each adapter's settings before it answers (awaited once at start), so the redaction
9
+ import { WEBHOOK_CHANNEL, WEBHOOK_SECRET_SPEC } from "./webhooks.js";
10
+ /** The server's own secrets over the store: what it keeps beside the store (besideTheStore), the outbound webhook's
11
+ * signing secret and each one it held before (adapter webhook-out, retired ones too, so a secret replaced or removed stays
12
+ * on the list across restarts), and every adapter's sealed settings, store rows, which are returned too, by id, for the
13
+ * server to keep using. Loads each adapter's settings before it answers (awaited once at start), so the redaction
13
14
  * list is whole from the first use. A value that does not open is said to `say`. */
14
15
  export async function openServerSecretsOverStore(store, data, env, adapters, say = () => { }) {
15
16
  // The server always has its seal key (seal-key.ts bootSealKey, at its start): no setting is ever kept in the clear.
@@ -17,8 +18,13 @@ export async function openServerSecretsOverStore(store, data, env, adapters, say
17
18
  if (!key)
18
19
  throw new Error(`the server starts with its seal key (${SEAL_KEY_ENV}), made at the first start when none is handed over`);
19
20
  const secrets = besideTheStore(data);
21
+ // The outbound webhook's secret, and each it held before, kept in the store (webhooks.ts). Its secret not opening under
22
+ // this seal key is said in the webhook's own words, naming the data directory.
23
+ const webhookSettings = sealedSettingsOverStore(store, WEBHOOK_CHANNEL, WEBHOOK_SECRET_SPEC, key, (fields) => fields.condition === "trigger_setting_unopened" ? say({ condition: "unreadable", name: SEAL_KEY_ENV, data, effect: "this server's webhook secret cannot be read under this seal key, so it is not cut" }) : say(fields));
24
+ await webhookSettings.load();
25
+ secrets.add("webhook", () => webhookSettings.values());
20
26
  const settings = new Map();
21
- for (const adapter of [...adapters, OUTBOUND_WEBHOOK]) {
27
+ for (const adapter of adapters) {
22
28
  if (!adapter.settings)
23
29
  continue;
24
30
  const adapterSettings = sealedSettingsOverStore(store, adapter.id, adapter.settings, key, say);
@@ -2,8 +2,9 @@
2
2
  // sealed among its settings (sealed-settings-store.ts): each trigger source's, and the outbound webhook's signing secret. Each source is added as a reader, so a
3
3
  // secret made or rotated since is in the list at once. With the host's, they are the one list a server never shows
4
4
  // (server.ts serverSecrets): what a run shows, what learning keeps, what the server answers and what an import writes are
5
- // cut of it; none of them assembles its own. The trigger settings are store rows (server-secrets-store.ts); what stays
6
- // beside the store in the data directory is read here (besideTheStore), by the server and by a runner that shares it.
5
+ // cut of it; none of them assembles its own. The trigger settings and the outbound webhook's secret are store rows
6
+ // (server-secrets-store.ts); what stays beside the store in the data directory is read here (besideTheStore), by the
7
+ // server and by a runner that shares it.
7
8
  import { readFileSync } from "node:fs";
8
9
  import { join } from "node:path";
9
10
  import { TOKEN_FILE } from "./files.js";