@parcha/agentrun-serve 0.1.0-beta.32 → 0.1.0-beta.34

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 (444) hide show
  1. package/CHANGELOG.md +270 -0
  2. package/README.md +343 -246
  3. package/dist/adapters.d.ts +0 -7
  4. package/dist/adapters.js +11 -22
  5. package/dist/agent-rows.d.ts +98 -0
  6. package/dist/agent-rows.js +1 -0
  7. package/dist/agents-store.d.ts +6 -2
  8. package/dist/agents-store.js +60 -25
  9. package/dist/agents.d.ts +9 -125
  10. package/dist/agents.js +15 -305
  11. package/dist/answer-json.d.ts +23 -0
  12. package/dist/answer-json.js +58 -0
  13. package/dist/api-only.d.ts +14 -0
  14. package/dist/api-only.js +33 -0
  15. package/dist/archil-routes.d.ts +1 -1
  16. package/dist/bash-read-only.d.ts +22 -0
  17. package/dist/bash-read-only.js +701 -0
  18. package/dist/box-egress-vm.d.ts +0 -8
  19. package/dist/box-egress-vm.js +0 -10
  20. package/dist/box-egress.d.ts +0 -4
  21. package/dist/box-egress.js +1 -16
  22. package/dist/box-paths.d.ts +25 -2
  23. package/dist/box-paths.js +79 -11
  24. package/dist/box-relay.d.ts +0 -11
  25. package/dist/box-relay.js +0 -20
  26. package/dist/box-settings.d.ts +26 -0
  27. package/dist/box-settings.js +63 -0
  28. package/dist/boxes.d.ts +21 -1
  29. package/dist/boxes.js +27 -20
  30. package/dist/browser-commands.d.ts +5 -2
  31. package/dist/browser-commands.js +4 -4
  32. package/dist/browser-computer.d.ts +5 -0
  33. package/dist/browser-computer.js +21 -0
  34. package/dist/browser-cost.d.ts +9 -6
  35. package/dist/browser-cost.js +94 -51
  36. package/dist/browser-live.d.ts +7 -20
  37. package/dist/browser-live.js +15 -93
  38. package/dist/browser-person.d.ts +18 -53
  39. package/dist/browser-person.js +94 -279
  40. package/dist/budget.d.ts +0 -4
  41. package/dist/budget.js +0 -7
  42. package/dist/cap.d.ts +8 -12
  43. package/dist/cap.js +12 -27
  44. package/dist/cli.js +61 -20
  45. package/dist/closed-pipes.d.ts +2 -0
  46. package/dist/closed-pipes.js +13 -0
  47. package/dist/computer-commands.d.ts +2 -0
  48. package/dist/computer-commands.js +2 -0
  49. package/dist/computer-keys.js +5 -2
  50. package/dist/computer-setting.d.ts +20 -4
  51. package/dist/computer-setting.js +25 -5
  52. package/dist/computers.d.ts +31 -3
  53. package/dist/computers.js +70 -11
  54. package/dist/confine.d.ts +120 -0
  55. package/dist/confine.js +436 -0
  56. package/dist/console/assets/index-RPHGlXmM.js +540 -0
  57. package/dist/console/assets/index-opTN5Naq.css +1 -0
  58. package/dist/console/index.html +2 -2
  59. package/dist/daytona-api.d.ts +0 -11
  60. package/dist/daytona-api.js +1 -82
  61. package/dist/decision-rows.d.ts +1 -1
  62. package/dist/decision-rows.js +1 -1
  63. package/dist/docker-daemon.d.ts +31 -0
  64. package/dist/docker-daemon.js +56 -0
  65. package/dist/docker-host-addresses.d.ts +37 -0
  66. package/dist/docker-host-addresses.js +110 -0
  67. package/dist/effort-guidance.js +4 -3
  68. package/dist/environment.d.ts +0 -3
  69. package/dist/environment.js +3 -5
  70. package/dist/errors.d.ts +0 -2
  71. package/dist/errors.js +6 -9
  72. package/dist/filed-answer.d.ts +32 -0
  73. package/dist/filed-answer.js +160 -0
  74. package/dist/files.d.ts +1 -11
  75. package/dist/files.js +2 -21
  76. package/dist/github-connection.d.ts +2 -2
  77. package/dist/github-connection.js +1 -1
  78. package/dist/graph-view.d.ts +3 -5
  79. package/dist/graph-view.js +4 -14
  80. package/dist/handed-values.d.ts +9 -0
  81. package/dist/handed-values.js +26 -0
  82. package/dist/harness-install.d.ts +22 -5
  83. package/dist/harness-install.js +98 -20
  84. package/dist/harness-opencode/adapter.d.ts +7 -0
  85. package/dist/harness-opencode/adapter.js +23 -6
  86. package/dist/harness-opencode/index.d.ts +1 -1
  87. package/dist/harness-opencode/index.js +1 -1
  88. package/dist/harness-opencode/verify.d.ts +17 -0
  89. package/dist/harness-opencode/verify.js +30 -10
  90. package/dist/harness-table.js +6 -1
  91. package/dist/harness.d.ts +4 -3
  92. package/dist/harness.js +16 -1
  93. package/dist/heard.js +1 -1
  94. package/dist/held-fd.d.ts +5 -0
  95. package/dist/held-fd.js +14 -0
  96. package/dist/host-calls.d.ts +20 -0
  97. package/dist/host-calls.js +12 -0
  98. package/dist/host-tools.d.ts +4 -21
  99. package/dist/host-tools.js +4 -61
  100. package/dist/host.d.ts +2 -4
  101. package/dist/host.js +2 -7
  102. package/dist/import-summary.d.ts +1 -5
  103. package/dist/import-summary.js +0 -21
  104. package/dist/import.d.ts +6 -6
  105. package/dist/import.js +62 -24
  106. package/dist/key-refusal.d.ts +5 -1
  107. package/dist/key-refusal.js +19 -4
  108. package/dist/learn/check.d.ts +6 -2
  109. package/dist/learn/check.js +83 -29
  110. package/dist/learn/folder.d.ts +5 -1
  111. package/dist/learn/folder.js +10 -3
  112. package/dist/learn/grade.d.ts +14 -0
  113. package/dist/learn/grade.js +68 -12
  114. package/dist/learn/index.d.ts +4 -4
  115. package/dist/learn/index.js +4 -4
  116. package/dist/learn/reflect.d.ts +31 -2
  117. package/dist/learn/reflect.js +79 -4
  118. package/dist/learn/relevance.d.ts +24 -0
  119. package/dist/learn/relevance.js +91 -0
  120. package/dist/learn/secrets.d.ts +8 -1
  121. package/dist/learn/secrets.js +95 -15
  122. package/dist/learn/skills.d.ts +112 -14
  123. package/dist/learn/skills.js +556 -52
  124. package/dist/learned-workflow.d.ts +37 -5
  125. package/dist/learned-workflow.js +106 -12
  126. package/dist/learning-routes.d.ts +16 -49
  127. package/dist/learning-routes.js +46 -36
  128. package/dist/learning-run.d.ts +6 -250
  129. package/dist/learning-run.js +11 -665
  130. package/dist/learning-words.d.ts +12 -5
  131. package/dist/learning-words.js +18 -9
  132. package/dist/learning.d.ts +93 -77
  133. package/dist/learning.js +176 -304
  134. package/dist/live/stream.js +1 -1
  135. package/dist/live/translate.js +13 -3
  136. package/dist/local-models.d.ts +11 -5
  137. package/dist/local-models.js +13 -8
  138. package/dist/mcp-gateway.d.ts +11 -52
  139. package/dist/mcp-gateway.js +44 -148
  140. package/dist/mcp-oauth.d.ts +10 -14
  141. package/dist/mcp-oauth.js +14 -32
  142. package/dist/mcp-probe.d.ts +0 -7
  143. package/dist/mcp-probe.js +4 -10
  144. package/dist/mcp-servers-store.d.ts +6 -6
  145. package/dist/mcp-servers-store.js +13 -15
  146. package/dist/mcp-store.js +3 -4
  147. package/dist/mcp.js +4 -3
  148. package/dist/model.d.ts +6 -7
  149. package/dist/model.js +43 -27
  150. package/dist/monid.d.ts +0 -2
  151. package/dist/monid.js +3 -6
  152. package/dist/openapi.d.ts +8 -1
  153. package/dist/openapi.js +124 -50
  154. package/dist/page.d.ts +1 -3
  155. package/dist/page.js +9 -19
  156. package/dist/paid-calls.d.ts +21 -27
  157. package/dist/paid-calls.js +28 -62
  158. package/dist/pause.d.ts +0 -2
  159. package/dist/pause.js +1 -8
  160. package/dist/place.d.ts +0 -5
  161. package/dist/place.js +0 -10
  162. package/dist/print.d.ts +2 -1
  163. package/dist/print.js +4 -2
  164. package/dist/propose.js +83 -39
  165. package/dist/push-handler.d.ts +1 -1
  166. package/dist/reflect-range.d.ts +25 -0
  167. package/dist/reflect-range.js +30 -0
  168. package/dist/refusal-words.d.ts +5 -1
  169. package/dist/refusal-words.js +5 -1
  170. package/dist/rows.d.ts +1 -1
  171. package/dist/run-cut.d.ts +0 -6
  172. package/dist/run-cut.js +0 -6
  173. package/dist/run-db.d.ts +2 -13
  174. package/dist/run-db.js +2 -41
  175. package/dist/run-launch.d.ts +19 -2
  176. package/dist/run-launch.js +13 -5
  177. package/dist/run-learning-served.d.ts +46 -2
  178. package/dist/run-learning-served.js +26 -7
  179. package/dist/run-reads-over-store.d.ts +1 -1
  180. package/dist/run-reads-over-store.js +15 -6
  181. package/dist/run-secrets.d.ts +33 -0
  182. package/dist/run-secrets.js +53 -0
  183. package/dist/run-timeline-served.d.ts +5 -1
  184. package/dist/run-timeline-served.js +19 -5
  185. package/dist/run-view.d.ts +12 -17
  186. package/dist/run-view.js +29 -28
  187. package/dist/runnable.d.ts +18 -10
  188. package/dist/runnable.js +21 -10
  189. package/dist/runner/adapter-loop.d.ts +14 -3
  190. package/dist/runner/adapter-loop.js +464 -62
  191. package/dist/runner/adapter-run-spec.d.ts +29 -8
  192. package/dist/runner/adapter-run-spec.js +96 -37
  193. package/dist/runner/adapters/index.js +11 -1
  194. package/dist/runner/adapters/pi.d.ts +15 -1
  195. package/dist/runner/adapters/pi.js +19 -5
  196. package/dist/runner/beside.d.ts +30 -3
  197. package/dist/runner/beside.js +54 -12
  198. package/dist/runner/claim-secrets.d.ts +10 -1
  199. package/dist/runner/claim-secrets.js +49 -15
  200. package/dist/runner/cli-run-spec.d.ts +2 -0
  201. package/dist/runner/cli-run-spec.js +60 -17
  202. package/dist/runner/commands.js +1 -1
  203. package/dist/runner/computer-journal.d.ts +15 -2
  204. package/dist/runner/computer-journal.js +41 -5
  205. package/dist/runner/conformance/harness.js +118 -8
  206. package/dist/runner/conformance/subject.d.ts +4 -1
  207. package/dist/runner/dispatch.d.ts +8 -1
  208. package/dist/runner/dispatch.js +81 -7
  209. package/dist/runner/end-of-run.d.ts +8 -2
  210. package/dist/runner/end-of-run.js +10 -4
  211. package/dist/runner/github-app.js +1 -1
  212. package/dist/runner/harness-loops.d.ts +9 -1
  213. package/dist/runner/harness-loops.js +15 -2
  214. package/dist/runner/journal-kinds.d.ts +30 -6
  215. package/dist/runner/journal-kinds.js +20 -5
  216. package/dist/runner/journal-reader.d.ts +1 -1
  217. package/dist/runner/journal-reader.js +2 -2
  218. package/dist/runner/learning-ask.d.ts +4 -0
  219. package/dist/runner/learning-ask.js +15 -1
  220. package/dist/runner/learning-end.d.ts +18 -3
  221. package/dist/runner/learning-end.js +113 -11
  222. package/dist/runner/learning-loop.d.ts +5 -0
  223. package/dist/runner/learning-loop.js +26 -6
  224. package/dist/runner/live-ticker.d.ts +1 -1
  225. package/dist/runner/live-ticker.js +28 -4
  226. package/dist/runner/loop-contract.d.ts +3 -2
  227. package/dist/runner/main.d.ts +64 -10
  228. package/dist/runner/main.js +165 -27
  229. package/dist/runner/mcp-claim.d.ts +1 -1
  230. package/dist/runner/mcp-claim.js +2 -3
  231. package/dist/runner/mcp-run.d.ts +2 -0
  232. package/dist/runner/mcp-run.js +15 -5
  233. package/dist/runner/memory-claim.d.ts +9 -0
  234. package/dist/runner/memory-claim.js +25 -0
  235. package/dist/runner/metrics.d.ts +33 -1
  236. package/dist/runner/metrics.js +85 -1
  237. package/dist/runner/model-route.d.ts +13 -0
  238. package/dist/runner/model-route.js +154 -11
  239. package/dist/runner/redact.d.ts +8 -2
  240. package/dist/runner/redact.js +11 -2
  241. package/dist/runner/reflect-hook.d.ts +12 -1
  242. package/dist/runner/reflect-hook.js +33 -3
  243. package/dist/runner/runner.d.ts +20 -0
  244. package/dist/runner/runner.js +56 -10
  245. package/dist/runner/store-port.d.ts +1 -1
  246. package/dist/runner/store-secrets.d.ts +3 -3
  247. package/dist/runner/store-secrets.js +8 -12
  248. package/dist/runner/text-tools.d.ts +44 -0
  249. package/dist/runner/text-tools.js +237 -0
  250. package/dist/runner/workflow-loop.d.ts +6 -0
  251. package/dist/runner/workflow-loop.js +6 -4
  252. package/dist/runner/workflow-spec.d.ts +18 -0
  253. package/dist/runner/workflow-spec.js +68 -26
  254. package/dist/runs-over-store.d.ts +8 -3
  255. package/dist/runs-over-store.js +76 -19
  256. package/dist/seal-key.d.ts +54 -15
  257. package/dist/seal-key.js +232 -82
  258. package/dist/sealed-settings-store.d.ts +19 -4
  259. package/dist/sealed-settings-store.js +9 -9
  260. package/dist/sealing.d.ts +4 -0
  261. package/dist/sealing.js +20 -0
  262. package/dist/secret-cut.d.ts +1 -1
  263. package/dist/secret-cut.js +1 -1
  264. package/dist/secret-name.d.ts +9 -0
  265. package/dist/secret-name.js +15 -0
  266. package/dist/secret-writes.d.ts +0 -1
  267. package/dist/secret-writes.js +0 -1
  268. package/dist/secrets.d.ts +2 -10
  269. package/dist/secrets.js +21 -17
  270. package/dist/server-fs.d.ts +4 -0
  271. package/dist/server-fs.js +8 -2
  272. package/dist/server-lock.d.ts +0 -24
  273. package/dist/server-lock.js +1 -80
  274. package/dist/server-secrets-store.d.ts +4 -4
  275. package/dist/server-secrets-store.js +10 -32
  276. package/dist/server-secrets.d.ts +4 -9
  277. package/dist/server-secrets.js +12 -33
  278. package/dist/server.d.ts +26 -44
  279. package/dist/server.js +229 -142
  280. package/dist/sign-ins-store.d.ts +34 -36
  281. package/dist/sign-ins-store.js +27 -38
  282. package/dist/sign-ins.d.ts +2 -119
  283. package/dist/sign-ins.js +5 -311
  284. package/dist/standard-webhooks.d.ts +1 -1
  285. package/dist/standard-webhooks.js +1 -1
  286. package/dist/stats.d.ts +3 -2
  287. package/dist/stats.js +1 -1
  288. package/dist/store/agent-body.d.ts +8 -2
  289. package/dist/store/agent-body.js +16 -4
  290. package/dist/store/index.d.ts +3 -3
  291. package/dist/store/index.js +3 -3
  292. package/dist/store/open.d.ts +18 -5
  293. package/dist/store/open.js +23 -3
  294. package/dist/store/postgres/connection.d.ts +18 -2
  295. package/dist/store/postgres/connection.js +156 -32
  296. package/dist/store/postgres/migrate.d.ts +4 -0
  297. package/dist/store/postgres/migrate.js +27 -3
  298. package/dist/store/postgres/migrations/0003_commands_one_answer.check.sql +19 -0
  299. package/dist/store/postgres/migrations/0003_commands_one_answer.sql +13 -0
  300. package/dist/store/postgres/store.d.ts +9 -2
  301. package/dist/store/postgres/store.js +9 -0
  302. package/dist/store/schema.js +1 -1
  303. package/dist/store/seal.js +2 -2
  304. package/dist/store/sqlite/connection.js +49 -5
  305. package/dist/store/sqlite/run-patch.d.ts +3 -0
  306. package/dist/store/sqlite/run-patch.js +3 -0
  307. package/dist/store/sqlite/store.js +64 -20
  308. package/dist/store/store.d.ts +38 -6
  309. package/dist/store/store.js +12 -2
  310. package/dist/store-reads/cap.d.ts +1 -1
  311. package/dist/store-reads/cap.js +22 -4
  312. package/dist/store-reads/journal.d.ts +25 -6
  313. package/dist/store-reads/journal.js +173 -21
  314. package/dist/store-reads/learning.d.ts +26 -8
  315. package/dist/store-reads/learning.js +12 -4
  316. package/dist/store-reads/workflow.d.ts +1 -1
  317. package/dist/store-reads/workflow.js +1 -1
  318. package/dist/store-view.d.ts +5 -1
  319. package/dist/store-view.js +91 -23
  320. package/dist/template-eval.d.ts +60 -4
  321. package/dist/template-eval.js +120 -54
  322. package/dist/templates.d.ts +24 -10
  323. package/dist/templates.js +69 -38
  324. package/dist/timeline/group.d.ts +33 -0
  325. package/dist/timeline/group.js +77 -0
  326. package/dist/timeline/index.d.ts +7 -0
  327. package/dist/timeline/index.js +7 -0
  328. package/dist/timeline/labels.d.ts +79 -0
  329. package/dist/timeline/labels.js +150 -0
  330. package/dist/timeline/origin.d.ts +56 -0
  331. package/dist/timeline/origin.js +92 -0
  332. package/dist/timeline/render-text.d.ts +11 -0
  333. package/dist/timeline/render-text.js +62 -0
  334. package/dist/timeline/timeline.d.ts +274 -0
  335. package/dist/timeline/timeline.js +1308 -0
  336. package/dist/timeline/util.d.ts +17 -0
  337. package/dist/timeline/util.js +49 -0
  338. package/dist/tool-gate.d.ts +41 -216
  339. package/dist/tool-gate.js +79 -540
  340. package/dist/tool-keys-store.d.ts +11 -12
  341. package/dist/tool-keys-store.js +24 -31
  342. package/dist/tool-keys.d.ts +9 -104
  343. package/dist/tool-keys.js +15 -271
  344. package/dist/tool-plane.d.ts +14 -42
  345. package/dist/tool-plane.js +23 -81
  346. package/dist/tool-settings-store.d.ts +1 -2
  347. package/dist/tool-settings-store.js +5 -8
  348. package/dist/tools.d.ts +31 -19
  349. package/dist/tools.js +101 -108
  350. package/dist/trigger-adapter.d.ts +2 -2
  351. package/dist/trigger-schedule.js +2 -1
  352. package/dist/trigger-secrets-shown.js +5 -1
  353. package/dist/trigger-targets.d.ts +13 -1
  354. package/dist/trigger-targets.js +31 -1
  355. package/dist/triggers.d.ts +2 -2
  356. package/dist/triggers.js +3 -3
  357. package/dist/turn-end.d.ts +1 -1
  358. package/dist/turn-end.js +1 -1
  359. package/dist/turns.d.ts +0 -6
  360. package/dist/turns.js +0 -19
  361. package/dist/uploads.js +1 -1
  362. package/dist/usage.d.ts +0 -2
  363. package/dist/usage.js +0 -2
  364. package/dist/validate.d.ts +2 -0
  365. package/dist/validate.js +23 -14
  366. package/dist/webhooks.d.ts +102 -76
  367. package/dist/webhooks.js +266 -233
  368. package/dist/workflow-run.d.ts +114 -0
  369. package/dist/workflow-run.js +144 -0
  370. package/dist/workspace/beneath.d.ts +19 -0
  371. package/dist/workspace/beneath.js +106 -0
  372. package/dist/workspace/computer-deps.d.ts +52 -5
  373. package/dist/workspace/computer-deps.js +154 -19
  374. package/dist/workspace/computer-for-claim.d.ts +19 -14
  375. package/dist/workspace/computer-for-claim.js +77 -16
  376. package/dist/workspace/computer-hold.d.ts +6 -1
  377. package/dist/workspace/computer-hold.js +6 -1
  378. package/dist/workspace/computer-janitor.d.ts +47 -0
  379. package/dist/workspace/computer-janitor.js +182 -0
  380. package/dist/workspace/computer-providers.d.ts +6 -2
  381. package/dist/workspace/computer-providers.js +1 -1
  382. package/dist/workspace/grep-worker.d.ts +5 -0
  383. package/dist/workspace/grep-worker.js +9 -6
  384. package/dist/workspace/index.d.ts +4 -3
  385. package/dist/workspace/index.js +4 -4
  386. package/dist/workspace/local.d.ts +11 -2
  387. package/dist/workspace/local.js +161 -43
  388. package/dist/workspace/resolve-computer.d.ts +50 -10
  389. package/dist/workspace/resolve-computer.js +46 -11
  390. package/dist/workspace/run-tools.d.ts +13 -31
  391. package/dist/workspace/run-tools.js +10 -27
  392. package/dist/workspace-paths.d.ts +0 -17
  393. package/dist/workspace-paths.js +1 -41
  394. package/dist/workspace.d.ts +0 -17
  395. package/dist/workspace.js +3 -99
  396. package/launcher/agentrun-serve +6 -33
  397. package/package.json +14 -14
  398. package/templates/README.md +9 -3
  399. package/templates/inbound-lead/agent.md +1 -1
  400. package/templates/kyb/agent.md +1 -1
  401. package/templates/market-monitor/agent.md +2 -2
  402. package/templates/market-monitor/skills/monitor/SKILL.md +6 -4
  403. package/dist/app.d.ts +0 -5
  404. package/dist/app.js +0 -514
  405. package/dist/bound-files.d.ts +0 -4
  406. package/dist/bound-files.js +0 -164
  407. package/dist/bounds.d.ts +0 -26
  408. package/dist/bounds.js +0 -137
  409. package/dist/coding-tools.d.ts +0 -47
  410. package/dist/coding-tools.js +0 -189
  411. package/dist/computer-adb.d.ts +0 -12
  412. package/dist/computer-adb.js +0 -14
  413. package/dist/console/assets/index-35-7aeIZ.js +0 -519
  414. package/dist/console/assets/index-Cejbov-Y.css +0 -1
  415. package/dist/content-filter.d.ts +0 -7
  416. package/dist/content-filter.js +0 -23
  417. package/dist/disk.d.ts +0 -33
  418. package/dist/disk.js +0 -85
  419. package/dist/door-line.d.ts +0 -23
  420. package/dist/door-line.js +0 -83
  421. package/dist/grade.d.ts +0 -63
  422. package/dist/grade.js +0 -150
  423. package/dist/harness-app.d.ts +0 -69
  424. package/dist/harness-app.js +0 -1162
  425. package/dist/mcp-servers.d.ts +0 -269
  426. package/dist/mcp-servers.js +0 -456
  427. package/dist/packs.d.ts +0 -71
  428. package/dist/packs.js +0 -180
  429. package/dist/request-start.d.ts +0 -27
  430. package/dist/request-start.js +0 -381
  431. package/dist/run-box.d.ts +0 -205
  432. package/dist/run-box.js +0 -661
  433. package/dist/run-holder.d.ts +0 -52
  434. package/dist/run-holder.js +0 -139
  435. package/dist/runs.d.ts +0 -1200
  436. package/dist/runs.js +0 -4103
  437. package/dist/sealed-settings.d.ts +0 -60
  438. package/dist/sealed-settings.js +0 -178
  439. package/dist/served-only.d.ts +0 -5
  440. package/dist/served-only.js +0 -12
  441. package/dist/sessions.d.ts +0 -6
  442. package/dist/sessions.js +0 -109
  443. package/dist/workspace/computer-serves.d.ts +0 -12
  444. package/dist/workspace/computer-serves.js +0 -15
package/README.md CHANGED
@@ -1,18 +1,15 @@
1
1
  # @parcha/agentrun-serve
2
2
 
3
- AgentRun Server: the Agentrun v2 API on your own machine, or in one container. `agentrun-serve` serves the same `/v2` contract (`agentrun.v2/0`) as the hosted
4
- API, over one agent store of [`@parcha/pi-durable-agent`](../pi-durable-agent/README.md) in a directory: many agents,
5
- each with revisions written once (an agentic prompt, or an agentrun-dsl workflow), and every run pinned to the revision
6
- it ran. Each run is a [`@parcha/pi-durable-disk`](../pi-durable-disk/README.md) run directory beside the store. An SDK
7
- pointed at it works the way it works against the hosted API; the capabilities document says what this server does not
8
- offer.
3
+ The AgentRun server: the process you deploy to run AgentRun, the open-source platform that supercharges your agents. `agentrun-serve` serves the `/v2` API (`agentrun.v2/0`) and the console over one store (SQLite in its data
4
+ directory, or Postgres): many agents, each with revisions written once (an agentic prompt, or an agentrun-dsl
5
+ workflow), and every run pinned to the revision it ran. Runners claim runs from that store and run them; by default one
6
+ runner starts beside the server. The capabilities document (`GET /v2/capabilities`) says what this server offers.
9
7
 
10
- Published to npm from the next release (`@latest`): `npx @parcha/agentrun-serve` then starts it with nothing else installed, its
11
- console included. Until then, run it from a checkout (below) or the container.
8
+ `npx @parcha/agentrun` starts it, with its console, on your machine; the container image runs it on a server (below).
12
9
 
13
10
  ## Quick start (no key, no network)
14
11
 
15
- Node 22.19 or later on 22, or 24.2 or later. In a checkout of this repository:
12
+ Node 24.11 or later. In a checkout of this repository:
16
13
 
17
14
  ```sh
18
15
  npm ci --ignore-scripts && npm run build
@@ -68,12 +65,12 @@ An edit is a new revision: `PUT $AGENTRUN_BASE_URL/agents/calc/definition` with
68
65
  | `--faux MODULE` | none | Answer every model request from the module's default export (below). |
69
66
  | `--faux-browser MODULE` | none | With `--faux` only: the `browser` tool's provider and driver from the module's default export, a fake browser with no vendor and no key ([below](#the-faux-model)). The console's real-browser tests run on it. |
70
67
  | `--allow-host NAME` | none | Another `Host` name to accept on a loopback address, on any port. Repeat it. |
71
- | `--max-runs N` | `AGENTRUN_MAX_RUNS`, else as many pi runs as fit | The most runs at once, beside the memory each run's harness reserves ([capacity](#capacity-and-health)). Over either, a new run is `429 rate_limited`. |
68
+ | `--max-runs N` | `AGENTRUN_MAX_RUNS`, else as many pi runs as fit | The most runs the runner beside the server holds at once ([capacity](#capacity-and-health)); a run past that waits `queued` until one ends. Capabilities report the same number (`limits.max_concurrent_runs`), capped by each harness's memory. |
72
69
  | `--documents DIR` | `AGENTRUN_SERVE_DOCUMENTS` | A read-only directory of documents a workflow's `pdf_pages` calls read by file name, confined to it. |
73
70
  | `--allow-code-nodes` | off (`AGENTRUN_SERVE_CODE_NODES=1` turns it on) | Run workflows' `code` nodes. They run in the run's process through the DSL's `new Function` transform, which is no sandbox, so only turn it on for workflows you wrote. Off, a workflow with a code node saves with a `not_set_up_here` warning and its runs are `409 agent_not_runnable` with `details.code: true`. A call `via: "shell"` or `"executor"` is refused either way. |
74
71
  | `--learning on\|off` | on (`AGENTRUN_SERVE_LEARNING`) | Whether runs [learn](#learning). On, a run of an agent whose definition says `learning: true` starts from what that agent learned and adds to it; off, no run does, whatever its agent says. Any other value refuses the start. Capabilities report it as `features.learning`. |
75
72
  | `--learning-budget BYTES` | `8000` (`AGENTRUN_SERVE_LEARNING_BUDGET`) | How much of what an agent learned its runs' instructions hold under `# Learned`, in UTF-8 bytes: every note whole while they fit, else the index and the notes changed last, whole, while they fit ([learning](#learning)). `0` gives the index alone. A value that is not a whole number of bytes refuses the start. |
76
- | `--drain-timeout D` | `30s` (the image: `6s`) | How long a busy run may finish its turn when the server stops (`8s`, `500ms`, `1m`). A turn cut off resumes at the next start; its model request is sent again. The server keeps its data directory until its runs' processes have exited (up to this and a second), and says so as it stops; a server started on the same `--data` meanwhile waits for it, saying so, then starts. |
73
+ | `--drain-timeout D` | `30s` (the image: `6s`) | How long the runner beside the server lets each busy run finish its turn when the server stops (`8s`, `500ms`, `1m`): a turn that ends within it keeps its outcome, and its model request is never sent again. A run still busy at the bound is stopped where it can resume, and the next claim carries on from its journal (that turn's model request sent again). The stop says how long it waits and for how many runs. A runner of its own (`agentrun-serve runner`) takes `--drain-timeout` too, default `AGENTRUN_DRAIN_TIMEOUT`, else `6s`. |
77
74
 
78
75
  `AGENTRUN_TOKEN`, when set, is the token (32 characters or more), and the server prints `$AGENTRUN_TOKEN` in its
79
76
  place: a token from the environment stays out of the logs. `DIR/.token`'s token is printed only by the start that made
@@ -157,10 +154,9 @@ once without checking again (a key some harness reads would, with `why=key`).
157
154
 
158
155
  The image is public: `ghcr.io/parcha-ai/agentrun-server` (`:beta`, or an exact version such as `:v0.1.0-beta.27`).
159
156
  `compose.yaml` at the repository's root is the one way to run it: the server, its data on a named volume, and the host's
160
- Docker socket. In this release a server in a container can't start a Docker sandbox yet (its folder and the computer
161
- daemon are mounted by paths only the server's container has, and it sets no host list), so agents there get file tools
162
- and `web_fetch`, no shell. For a sandbox, run the server on the host, or give the agent a Daytona or E2B computer with
163
- workspaces on Archil.
157
+ Docker socket, so each run's Docker sandbox is a container beside the server's, its run's folder mounted from that
158
+ volume ([in the published image](#in-the-published-image)). It takes Docker Engine 26 or later, which mounts a
159
+ volume's subpath.
164
160
 
165
161
  1. Start it (below).
166
162
  2. Open the console and set your password.
@@ -214,16 +210,12 @@ let a service with a disk change that.
214
210
  ## The disk, and earlier data directories
215
211
 
216
212
  The data directory has two parts. Its own files, the control plane, hold the agent store (`DIR/store.sqlite`, where
217
- each run's row keeps its claim: an epoch and its holder), the token and the server's settings; only the server opens
218
- them. Everything the agents make is on the disk, `DIR/disk/`: one folder per agent, `DIR/disk/agents/<agent>/` (its id
213
+ each run's row keeps its claim: an epoch and its holder), the token and the server's settings; only the server and its
214
+ runners open them. Everything the agents make is on the disk, `DIR/disk/`: one folder per agent, `DIR/disk/agents/<agent>/` (its id
219
215
  in lower case, a dash and 16 hex digits of its SHA-256), with its learning folder (`learning/`) and its runs
220
- (`runs/<id>/`, each with `store/run.sqlite`, its log, and `work/`, where its tools work). Nothing is copied in or out of
221
- a run's folder: where it works, it works in that folder.
222
-
223
- A run's own process writes its `run.sqlite` in WAL, under an exclusive lock, with no automatic checkpoint, and ends
224
- with its WAL in place. The server reads it with a fresh read-only open per read, never shows a read older than one
225
- before, and never opens it for writing while the run's process holds it. Once that process is gone the server takes
226
- the run back (its epoch bumped, the server its holder) and checkpoints its WAL into the database file.
216
+ (`runs/<id>/`, each with `work/`, where its tools work). Nothing is copied in or out of a run's folder: where it
217
+ works, it works in that folder. A run's record is not in its folder: its row, its claim and its journal (what the run
218
+ did, in order) are rows of the store.
227
219
 
228
220
  A data directory an earlier version wrote, with its runs under `DIR/runs/` (or a store of store version 1), is refused
229
221
  at start, saying so: this version neither reads nor moves it. Keep it with that version, or start this one on a new data
@@ -248,9 +240,11 @@ through `POST /v2/agents`. Their earlier runs stay readable where you moved them
248
240
 
249
241
  ## Capacity and health
250
242
 
251
- Each run is a process of its own, and how much memory it takes depends on its harness. The server admits runs by
252
- memory: each run that holds a live process (working, or waiting for an answer) reserves its harness's size out of the
253
- container's limit when it has one (cgroup), else the machine's, less the server's own 128 MiB.
243
+ A run is held by a runner, and how much memory it takes depends on its harness. Capabilities size what a host holds by
244
+ memory: each run reserves its harness's size out of the container's limit when it has one (cgroup), else the machine's,
245
+ less the server's own 128 MiB. The server does not refuse a start for memory: a start inserts a `queued` run, and a
246
+ runner claims it when it has a free loop (300 at once by default; `agentrun-serve runner --loops N` sets it for a
247
+ runner you start yourself).
254
248
 
255
249
  | Harness | Reserved per run | Measured per run |
256
250
  | --- | --- | --- |
@@ -262,21 +256,22 @@ container's limit when it has one (cgroup), else the machine's, less the server'
262
256
  The measure is a short task (write a file, read it back, answer) on a real server in a container of its own; the table
263
257
  in `src/harness.ts` says how it was taken. So a 512 MB instance holds 3 pi runs, 2 codex runs or 1 claude-agent run at
264
258
  once (or 1 codex and 1 pi), 1 GB holds 7, 4 or 3, and 8 GB 63, 42 or 28; an opencode run, OpenCode's own process with
265
- it, needs a 1 GB instance for one and 2 GB for two. A start that does not fit in what is left is
266
- `429 rate_limited` with `retry-after`, its message naming the harness and the memory, and nothing starts: there is no
267
- queue, so the client tries again once a run ends. A harness whose one run needs more than all the memory for runs (claude-agent
268
- on a host under 416 MB, opencode under 832 MB) is unavailable: capabilities say why in its `harnesses` entry, and
269
- its runs are `409 agent_not_runnable` with that reason. pi always has one place, however small the host.
270
-
271
- `--max-runs N` or `AGENTRUN_MAX_RUNS` caps the count as well (by default, as many as pi runs fit), and both limits
272
- apply. Capabilities report pi's count in `limits.max_concurrent_runs`, and each harness's own in its `harnesses` entry
273
- (`max_concurrent_runs`, beside `run_memory_mib`). A message to a run already going is never refused for a place, nor is
274
- the relaunch of one whose process went, and a run's process the next server adopts after a restart holds its harness's
275
- memory there. A run whose harness can never fit (the server restarted on a smaller host) is not started again: it fails
276
- with why if it was working, and a message to it is `409 agent_not_runnable`.
277
-
278
- A data directory serves one AgentRun Server at a time: two servers on a shared disk are not supported (each
279
- counts only its own runs, and a run could be relaunched twice).
259
+ it, needs a 1 GB instance for one and 2 GB for two. A runner holds runs by this memory and by `--max-runs` (below): it
260
+ claims a waiting run only while the runs it holds and that run's size fit the host's memory less the server's 128 MB,
261
+ oldest first, so a run that does not fit yet waits `queued`, the runs behind it too, until one ends. A run is never
262
+ refused for a place. A 2 GB host's default count is 15, as many pi runs as fit, but it holds 6 claude-agent runs at
263
+ once, not 15. A harness whose one run
264
+ needs more than all the memory for runs (claude-agent on a host under 416 MB, opencode under 832 MB) is unavailable:
265
+ capabilities say why in its `harnesses` entry. pi always has one place, however small the host.
266
+
267
+ `--max-runs N` or `AGENTRUN_MAX_RUNS` sets that count (by default, as many as pi runs fit): the runner beside the
268
+ server claims at most that many runs at once, of any harness, and the rest wait queued. A runner of its own
269
+ (`agentrun-serve runner`) holds `--loops N`, else the same default. Capabilities report it: pi's in
270
+ `limits.max_concurrent_runs`, and each harness's own, the lower of that and what its memory holds, in its `harnesses`
271
+ entry (`max_concurrent_runs`, beside `run_memory_mib`).
272
+
273
+ A data directory serves one AgentRun Server at a time: a second server on the same data root is refused at start
274
+ (`server.lock`).
280
275
 
281
276
  `GET /v2/health`, with no credential like capabilities, answers `200 {status: "ok", checks: {store: "ok", disk: "ok"}}`
282
277
  when the agent store opens for a read and the data directory's disk has at least 64 MiB free (`AGENTRUN_MIN_FREE_MB`),
@@ -285,12 +280,12 @@ and `503` with `status: "failing"` and which check failed (`store: "does_not_ope
285
280
  It names no path, size or version. One route serves as both liveness and readiness: any answer says the server is up,
286
281
  and a 200 says it can work, and the platforms here take one path.
287
282
 
288
- A run whose end the agent store cannot take (a full disk) still ends: a cancel makes it `cancelled`, with its cost from
289
- its rows, and the server writes the end to the store again every 30 s until it lands; a restart before then reads the
290
- run as the store last had it. A run whose process was killed is opened again on its next message at once: the run's row
291
- names its process (its pid, that process's start and this boot), and a process that is gone holds nothing. One server
292
- serves a data root, and the agent disk under it (`<data>/disk`): a second server on the same root is refused at start
293
- (`server.lock`), so the row's claim never has two servers claiming it at once.
283
+ A run's runner renews its claim on the run every 10 s, for a claim of 30 s. A runner that stops, or cannot renew in
284
+ time, writes nothing more to the run, and the store refuses any write under a claim the run has moved past. Once the
285
+ claim lapses another runner claims the run and resumes it from its journal. `agentrun-serve runner --check --data DIR --name N`
286
+ (or `AGENTRUN_RUNNER_NAME=N` in place of `--name`) says whether the runner named `N` has a fresh heartbeat: it exits 0
287
+ when it does and 1 when it does not, and 2 when no name is given. Name a runner you start yourself with
288
+ `agentrun-serve runner --data DIR --name N`.
294
289
 
295
290
  ## Sandbox
296
291
 
@@ -343,9 +338,11 @@ and `GET /v2/runs/{id}` shows it as `place`. A harness's own tools in the box, w
343
338
  `sandbox` (such as `native_tools: true`), never a third mode.
344
339
 
345
340
  `bash` may be named only by an agentic definition whose place is a sandbox (`422` on a runner, named or by default, with
346
- the sandbox place as its `fix`), and a workflow's place is `runner` or none (`422` on a sandbox, with the runner place as
347
- its `fix`). In `capabilities.tools`, `bash` is `available: false` with a `reason` (`no box is set up on this server: …`,
348
- each box's own reason) when no box this server has can run it.
341
+ the sandbox place as its `fix`), or, in Mode 2, by one on the runner, where `bash` runs on Archil's serverless exec
342
+ ([where `bash` runs](#computers)); the background tools run in a box alone, in either mode. A workflow's place is `runner`
343
+ or none (`422` on a sandbox, with the runner place as its `fix`). In `capabilities.tools`, `bash` is `available: false`
344
+ with a `reason` (`no box is set up on this server: …`, each box's own reason) when no box this server has can run it and
345
+ the server is in Mode 1.
349
346
 
350
347
  `GET /v2/capabilities` lists `places`: the modes, the default, a new agent's place, and each box with `available`, its `state` (`ready`,
351
348
  `preparing` while the server builds or pulls its image, or `unavailable`) and, when it is not ready, the `reason`.
@@ -458,9 +455,9 @@ go through `work/` by path.
458
455
  `LANG=C.UTF-8` and `HOME=/tmp` and the image's own: never this server's, so no key or token is in it. It runs as this
459
456
  server's uid:gid, so what it writes in `work/` stays this server's. It starts from [the box's image](#the-boxs-image).
460
457
  It may use 2 CPUs' time, 4 GiB of memory, swap included, and 1,024 processes and threads (`--cpu-period 100000
461
- --cpu-quota 200000 --memory 4g --memory-swap 4g --pids-limit 1024`), so a runaway build or a fork bomb stops in the
462
- box. `AGENTRUN_BOX_CPUS` (at least `0.01`), `AGENTRUN_BOX_MEMORY` (with its unit, such as `8g`, and at least `6m`) and
463
- `AGENTRUN_BOX_PIDS` (at most 4,194,304) change them; any other value refuses the start. `AGENTRUN_BOX_CPUS` caps CPU
458
+ --cpu-quota 200000 --memory 4096m --memory-swap 4096m --pids-limit 1024`), so a runaway build or a fork bomb stops in
459
+ the box. `AGENTRUN_BOX_CPUS`, `AGENTRUN_BOX_MEMORY` and `AGENTRUN_BOX_PIDS` change them, for Docker computers only
460
+ ([a Docker computer's size](#computers)). `AGENTRUN_BOX_CPUS` caps CPU
464
461
  time, as a CFS quota (the cap `--cpus` sets), so it holds whatever CPU count Docker's VM has, and where the kernel
465
462
  gives Docker no CPU controller (a rootless Docker without one delegated), Docker ignores it with a warning.
466
463
  - `bash` takes pi's `{command, timeout?}`, `timeout` in seconds, 300 when the call names none; a timeout kills the
@@ -630,10 +627,8 @@ is Modal's default sandbox runtime (gVisor), not a virtual machine: the server d
630
627
  show the box's `network` as `none`, with `network_reason`, unless the setting is `none`.
631
628
  - A sandbox that is gone (it ended, or its lifetime ran out) is made again on the run's next tool call and seeded
632
629
  with the run's `work/`. The call that met the gone box fails, saying so.
633
- - Each Modal sandbox reserves 2 CPUs and 4 GiB of memory by default, which the provider bills for while the box lives:
634
- the Docker box's defaults, asked of the provider as the sandbox's CPU and memory. `AGENTRUN_BOX_CPUS` and
635
- `AGENTRUN_BOX_MEMORY` change both boxes alike (such as `AGENTRUN_BOX_CPUS=1 AGENTRUN_BOX_MEMORY=1g`). The provider has
636
- no process limit, so `AGENTRUN_BOX_PIDS` does not apply. Its lifetime is 24 hours, as every box's is.
630
+ - A Modal sandbox is the size Modal makes it, which the provider bills for while the box lives: `AGENTRUN_BOX_CPUS`,
631
+ `AGENTRUN_BOX_MEMORY` and `AGENTRUN_BOX_PIDS` size Docker computers only. Its lifetime is 24 hours, as every box's is.
637
632
  - A start copies back, then ends, the sandbox of every run that has ended or is archived.
638
633
 
639
634
  ### The box's image
@@ -669,8 +664,8 @@ never runs; the box's first process is a `sleep` of its lifetime.
669
664
 
670
665
  ### In the published image
671
666
 
672
- The published image, `ghcr.io/parcha-ai/agentrun-server`, runs Docker boxes on the Docker of the host it runs on, through
673
- that Docker's socket, as `compose.yaml` at the repository's root starts it ([in a container](#in-a-container)). The image
667
+ The published image, `ghcr.io/parcha-ai/agentrun-server`, runs Docker sandboxes on the Docker of the host it runs on,
668
+ through that Docker's socket, as `compose.yaml` at the repository's root starts it ([in a container](#in-a-container)). The image
674
669
  has the Docker client (Debian's `docker-cli`) and no daemon; `group_add` gives the image's `node` user the socket's group
675
670
  (`DOCKER_GID`), so the server never runs as root.
676
671
 
@@ -680,27 +675,32 @@ has the Docker client (Debian's `docker-cli`) and no daemon; `group_add` gives t
680
675
  it root. A box never gets it.
681
676
  - **A box is a container beside the server's.** It is made as on a Linux host (`--network none`, every capability dropped,
682
677
  no new privileges, the server's uid, the box limits).
683
- - **No host list from a container yet.** A Docker sandbox's egress proxy refuses the Docker host's own addresses, so it
684
- must know them, and a provider that runs in a container (`/.dockerenv`, `/run/.containerenv` or a container's cgroup)
685
- can't read them from its own interfaces. The computer package's Docker provider takes them as its
686
- `egress.hostAddresses` option (IP addresses, the host's public ones and any NAT'd or elastic IP;
687
- [its README](../computer/README.md)), but this server sets no such option and has no setting for it. So in a
688
- container, a Docker sandbox asked for a host list (`AGENTRUN_BOX_ALLOW`, whose default is a list) is refused before
689
- anything is made: "this provider runs in a container (…), so this provider's own interfaces are not the Docker
690
- host's, and the egress proxy could not refuse the host's own addresses: pass them as egress.hostAddresses, or ask for
691
- network none or open". With `AGENTRUN_BOX_ALLOW=none` a sandbox asks for no network, which this check does not
692
- refuse.
693
678
  - **Its files.** The daemon has none of the server's paths, only what it mounted into the server's container. At its
694
679
  start the server reads its own container's id from `/proc/self/mountinfo`, asks Docker for that container's mounts
695
- (`docker inspect`), and takes the named volume that holds the data directory. A box mounts that run's `work/` from it,
696
- and the run's egress proxy's directory (`<data>/box-egress/<16 hex>/`, read-only), as the volume's subpaths
697
- (`--mount type=volume,...,volume-subpath=disk/agents/<key>/runs/<run>/work`), never the rest. The run's files and the box's are the same
680
+ (`docker inspect`), and takes the named volume that holds the data directory. A run's sandbox mounts that run's folder
681
+ from it, and the sandbox's own daemon (copied to `<volume mount>/.agentrun/computerd`, read-only), as the volume's
682
+ subpaths (`--mount type=volume,...,volume-subpath=...`), never the rest. The run's files and the sandbox's are the same
698
683
  files, as on a host.
684
+ - **The host's own addresses.** A sandbox's egress proxy refuses the Docker host's own addresses, which the server in a
685
+ container can't see on its interfaces. At its start it reads them once through the socket: one container on the
686
+ host's network (`--network host`, with `host.docker.internal` added for Docker Desktop and OrbStack, whose listing is
687
+ the VM's), from the proxy's own image, as nobody (`65534:65534`), every capability dropped, no new privileges, a
688
+ read-only root, 64 MiB and 32 processes, removed at its exit, bounded to 60 s. To those it adds
689
+ `AGENTRUN_DOCKER_HOST_ADDRESSES` (a comma list of IP addresses, checked at the start), for what no interface shows,
690
+ such as a NAT'd or elastic public address. The union is in capabilities' docker entry (`host_addresses`) and the
691
+ `event=docker_host_addresses` line. With none known under an allow-list (the read failed, nothing set), docker is
692
+ unavailable at the start, saying so and naming the setting or `AGENTRUN_BOX_ALLOW=none`; under `none` nothing is read.
699
693
  - **Any other layout** (the data directory not on a read-write named volume of the server's own container, the socket of
700
694
  another Docker than the one that runs the server, a container whose id `/proc/self/mountinfo` does not name) makes
701
695
  docker unavailable at the start, its reason in capabilities and the `event=box_paths` line: `run AgentRun in a
702
696
  container with docker compose up from compose.yaml (its named data volume is how boxes reach a run's files)`. On an
703
- older engine: `Docker Engine <26 can't mount a named volume's subpath: upgrade to Docker 26+`.
697
+ older engine: `Docker Engine <26 can't mount a named volume's subpath: upgrade to Docker 26+`. A daemon of another
698
+ machine makes it unavailable too, whether `DOCKER_HOST` names it or the current Docker context does (`DOCKER_CONTEXT`,
699
+ else the saved current one, read once with `docker context inspect`): that daemon has none of this machine's paths.
700
+ Another machine's is `ssh://`, or `tcp://` to a host that isn't loopback; `unix://`, `npipe://` (Docker Desktop on
701
+ Windows) and `tcp://` to loopback are this machine's. An agent that
702
+ names a Docker computer is refused at its run's start in those words, and one with no computer runs on the runner,
703
+ with the file tools and no shell.
704
704
  - On a host the server finds no container of its own and asks Docker nothing: a box binds this machine's paths and its
705
705
  proxy's directory is under `/tmp`, as before.
706
706
 
@@ -720,7 +720,12 @@ Settings → Computers. The kind says what the agent is given, and the provider
720
720
  | `browser` | A hosted browser (the browser tools) | `browserbase`, `kernel` |
721
721
 
722
722
  A kind with no provider, a provider that does not serve the kind, or a provider whose required keys are not saved is
723
- refused before anything starts, in words that name the fix in Settings → Computers. `GET /v2/computers` lists each kind,
723
+ refused before anything starts, in words that name the fix in Settings → Computers. A Docker computer needs a Docker
724
+ daemon on this server: where none answers `docker version` (Render and most hosted services run none), Docker is not
725
+ ready and says to use a vendor's computer. The server asks again every 30 s, so a daemon that stops is seen. A daemon
726
+ started after the server is taken at the next restart, since the start's checks of Docker (its host, this server's
727
+ paths and addresses) ran without it.
728
+ `GET /v2/computers` lists each kind,
724
729
  whether this server offers it now, the tools it brings, and each provider with its key names and whether each is saved
725
730
  (never a value). `PUT /v2/computers/{provider}/keys` saves a provider's keys, sealed under the server's seal key, from
726
731
  the owner's signed-in session only (the API token is 403), and `POST /v2/computers/{provider}/test` makes one read at
@@ -731,6 +736,30 @@ the provider with them and starts nothing. A key set in the server's environment
731
736
  computer time. The older [`place`](#place) is this setting's v2 view: `{"mode": "runner"}` is kind `none`, and
732
737
  `{"mode": "sandbox", "box": X}` is a sandbox on provider X. Writing either sets both.
733
738
 
739
+ **A Docker computer's size.** A Docker computer, a sandbox or a desktop, may use 2 CPUs' time, 4 GiB of memory with swap
740
+ included, and 1,024 processes and threads, unless the server's environment says otherwise: `AGENTRUN_BOX_CPUS` (at least
741
+ `0.01`, such as `1.5`), `AGENTRUN_BOX_MEMORY` (a size with its unit, `b`, `k`, `m` or `g`, such as `8g`: at least `6m`,
742
+ a fraction of a MiB dropped) and `AGENTRUN_BOX_PIDS` (from 1 to 4,194,304). The claim puts them on the computer's spec,
743
+ and the Docker provider runs the container with them (`--cpu-quota`, `--memory` and `--memory-swap`, `--pids-limit`).
744
+ They apply to Docker computers only: a vendor's computer (Daytona, Modal, E2B, Orgo, a phone, a hosted browser) is the
745
+ size its provider makes it, and is never given them. A value the Docker provider refuses stops the server's start, in
746
+ the provider's words.
747
+
748
+ **GPUs.** A sandbox may ask for GPUs: `computer: {"kind": "sandbox", "provider": "daytona", "gpu": {"type": "H100",
749
+ "count": 1}}`. `GET /v2/computers` shows each sandbox provider's `gpu`: the types it gives, by the vendor's own names, the
750
+ most one computer gets, and where a GPU computer differs from its others. A provider whose GPU computers cannot hold
751
+ this server's run folder says why there. The save checks the shape, and only a sandbox takes one. The run's start (409)
752
+ and the claim refuse a type or a count the provider does not give, in the computer package's `checkGpu` words, and the
753
+ computer is made with the GPUs asked.
754
+
755
+ - **Daytona** gives `H100`, `H200`, `RTX-PRO-6000`, `RTX-4090`, `RTX-5090` and `MI355X`, up to 8. A GPU sandbox runs
756
+ in region `earth`. Stopping it deletes it: it has no pause and no snapshot, so nothing on it outlives the run. Each GPU
757
+ comes with 16 vCPU, 192 GiB of memory and 512 GiB of disk. A Daytona GPU may be preempted, so a run on one can be
758
+ cut short. The Daytona org needs GPU credits. A Daytona GPU sandbox with the run's folder mounted from Archil, and
759
+ its network allowlist, are not yet proven live.
760
+ - **Modal** declares its GPUs, but a Modal GPU sandbox runs on gVisor, and the Archil mount the run's folder needs is not
761
+ proven there. So this server refuses a Modal sandbox with a `gpu` for now. A Modal GPU is also preemptible.
762
+
734
763
  **Where the run's folder lives.** A server keeps its runs' folders in one of two modes:
735
764
 
736
765
  - **Mode 1** (the default): on this server's own disk. Only a provider that binds a folder of this machine can hold
@@ -770,10 +799,13 @@ Docker sandbox where this server's Docker answers, else no computer; in Mode 2,
770
799
  no computer.
771
800
 
772
801
  **What a computer reaches.** A Docker sandbox reaches the hosts of `AGENTRUN_BOX_ALLOW` (by default the package
773
- registries and GitHub) through its egress proxy, and nothing else; `AGENTRUN_BOX_ALLOW=none` gives it no network. A
774
- server that runs in a container can't start a Docker sandbox yet ([in a container](#in-a-container)). A
775
- Daytona, Modal or E2B sandbox has no network of its own (loopback only). A phone and a browser are on their vendor's
776
- own network, whatever the list says.
802
+ registries and GitHub) through its egress proxy, and nothing else; `AGENTRUN_BOX_ALLOW=none` gives it no network. From a
803
+ server in a container the proxy also refuses the Docker host's own addresses, which the server reads through the socket
804
+ ([in the published image](#in-the-published-image)). A
805
+ Daytona, Modal or E2B sandbox has no network of its own (loopback only). A phone and a hosted browser are on their
806
+ vendor's own network, whatever the list says. Local Chrome is open unless this server sets `AGENTRUN_BOX_ALLOW`; then
807
+ only those hosts (the default list, a sandbox's package registries, is no browsing policy). Under
808
+ `AGENTRUN_BOX_ALLOW=none`, each of these is refused at the run's start, in words that name the setting.
777
809
 
778
810
  **Docker.** A Docker computer runs where this server's Docker answers. With `AGENTRUN_BOXES` not set at all (a plain
779
811
  `npx @parcha/agentrun`), the server probes `docker` at its start (within 5 s) and offers it when Docker answers
@@ -845,7 +877,7 @@ A definition is checked for what keeps it from running here when it is saved, wi
845
877
  it starts:
846
878
 
847
879
  - What no setting of this host fixes refuses the save, `422 input_invalid` by field, and nothing is written: a tool
848
- this host does not bind (`definition.tools[i]`), `bash` on an agent whose place is not a sandbox, a model pi-ai does
880
+ this host does not bind (`definition.tools[i]`), `bash` on an agent whose place is not a sandbox (in Mode 1), a model pi-ai does
849
881
  not know when no gateway is set (`definition.model`, saying why), empty instructions (`definition.instructions`), and a workflow that needs a tool
850
882
  call this host does not run, code, or a node tool other than `read`, `write` and `edit` (`definition.workflow`, one
851
883
  field per need).
@@ -858,11 +890,13 @@ it starts:
858
890
  A run is refused before it starts, `409 agent_not_runnable`, saying which, for any of these: a warning the host has not
859
891
  fixed yet, or a revision saved before these checks. A run needs only the tiers it uses: an agentic one its model or the default, a workflow the tiers its nodes name, so a
860
892
  workflow of fast nodes runs with `AGENT_MODEL_FAST` and no `AGENT_MODEL`. A run thinks at its `effort` (`low`, `medium`,
861
- `high`), else at its agentic revision's `thinking` (`low` to `max`), else at the host's `AGENT_THINKING`, else at medium;
862
- it is never off, and a model node that names its own thinking level keeps it. An agentic run started with an `effort` also
863
- gets a short note on how to work, right after its instructions, on every harness (`src/effort-guidance.ts`): `low`
864
- answers directly, `medium` plans briefly and checks once, `high` plans each part, fills the gaps and reviews. A run
865
- started with none gets no note.
893
+ `high`), else at its agentic revision's `thinking` (`low` to `max`), else at the host's `AGENT_THINKING` (one of those
894
+ levels exactly), else at its harness's own default; it is never off, and a model node that names its own thinking level
895
+ keeps it. The level is fixed in the run's launch when it starts, and its metrics name the level its harness ran at: one
896
+ above the harness's highest runs at that highest (Codex and OpenCode stop at `xhigh`). An agentic run whose level is
897
+ `low`, `medium` or `high` also gets a short note on how to work, right after its instructions, on every harness
898
+ (`src/effort-guidance.ts`): `low` answers directly, `medium` plans briefly and checks once, `high` plans each part, fills
899
+ the gaps and reviews. A run with no level, or one above `high`, gets no note.
866
900
 
867
901
  ## Tools
868
902
 
@@ -879,7 +913,7 @@ agent_not_runnable`, with `details.unbound` and `details.missing`).
879
913
  | `read` | Read a file in the run's `work/`; in a box, also an image (png, jpg, gif, webp, by its bytes) at any absolute path in the box, such as one rendered to `/tmp`, read through the box and never from the host | nothing | yes, no |
880
914
  | `write` | Write a file in the run's `work/` | nothing | yes, no |
881
915
  | `edit` | Edit a file in the run's `work/` | nothing | yes, no |
882
- | `bash` | Run a shell command in the run's box, from its `work/`: pi's `{command, timeout?}`, 120 s when the call names no timeout and at most 600 s (a longer one runs at 600 s and says so; longer work is `bash_background`) | an agentic definition whose place is a sandbox ([Sandbox](#sandbox)) | no, no |
916
+ | `bash` | Run a shell command in the run's box, from its `work/`: pi's `{command, timeout?}`, 120 s when the call names no timeout and at most 600 s (a longer one runs at 600 s and says so; longer work is `bash_background`) | an agentic definition whose place is a sandbox ([Sandbox](#sandbox)), or one on the runner in Mode 2 (Archil's serverless exec, at most 295 s) | no, no |
883
917
  | `bash_background` | Start a shell command in the background in the run's box, from its `work/`, and answer its id at once: `{command, tty?}` in, `tty: true` for a terminal. Its stdout and stderr go to `work/background/<id>/output.log`, the first 16 MiB; at most 8 run at once ([background processes](#background-processes)) | an agentic definition whose place is a sandbox | no, no |
884
918
  | `bash_output` | Read a background process's output from a byte offset: `{id, offset?, max_bytes?}` in (at most 48 KiB a call), its state, exit code, the log's size and the next offset out | an agentic definition whose place is a sandbox | no, no |
885
919
  | `bash_input` | Write to a running background process's stdin: `{id, text, close?}` (at most 64 KiB a call) | an agentic definition whose place is a sandbox | no, no |
@@ -1176,9 +1210,8 @@ picks which one a run gets, never the model.
1176
1210
  (`agentrun-` and 24 hex digits: Kernel's names are its account's, so a name derived from the agent would be any
1177
1211
  server's that shares the key). This
1178
1212
  server keeps only a pointer per agent and vendor, sealed under the seal key (`AGENTRUN_SEAL_KEY`) and bound to its
1179
- agent, in `<data>/homes/<key>/sign-ins/sign-ins.json`. With no seal key nothing is kept and runs start signed out;
1180
- capabilities say `sign_ins: true` only with a seal key and a browser vendor here. A local Chrome keeps none: its
1181
- cookies would sit on this server's disk.
1213
+ agent and vendor, in its store. Capabilities say `sign_ins: true` with a browser vendor here. A local Chrome keeps
1214
+ none: its cookies would sit on this server's disk.
1182
1215
  - **How a run gets it.** Before a run with the `browser` tool is launched, the server makes the agent's context at
1183
1216
  Browserbase (`POST /v1/contexts`, which opens no session; Browserbase bills sessions, not contexts) or its profile at
1184
1217
  Kernel (`POST /profiles`, which starts no browser) if it has none,
@@ -1317,20 +1350,22 @@ another server's by then. Under `--faux` a key is checked only against the fake
1317
1350
  with is checked under `--faux` only against a check's own fake (`fauxBrowserbase`, `fauxMonidCheck`, `fauxKernel`), so the fakes the runs use see the
1318
1351
  runs' calls alone; with none, its `check` stays null.
1319
1352
 
1320
- A saved key is kept only as ciphertext: AES-256-GCM in `DIR/tool-keys.json` (0600), each value bound to its field's
1321
- name, under the seal key `AGENTRUN_SEAL_KEY`, which only the server opens it with. A run's process never gets the seal
1322
- key. With `AGENTRUN_SEAL_KEY` not set, the launcher keeps it in `agentrun/seal.key` under `$XDG_CONFIG_HOME` (or
1323
- `~/.config`), making it the first time: 32 random bytes in base64, 0600 in a 0700 directory, and one another user can
1324
- read is refused, not changed. It is outside the data directory on purpose: a copy or a backup of the data directory
1325
- holds the keys as ciphertext alone, and opens nowhere without the seal key. With no seal key (started with no launcher and
1326
- no `AGENTRUN_SEAL_KEY`, or with no home directory) nothing is saved, never in the clear: `409 no_sealing_key`, and capabilities' `features.tool_keys.at_rest` is
1327
- `unavailable` (`sealed` otherwise).
1353
+ A saved key is kept only as ciphertext: AES-256-GCM in the server's store, each value bound to its field's name, under
1354
+ the seal key `AGENTRUN_SEAL_KEY`, which only the server opens it with. A run's process never gets the seal
1355
+ key. With `AGENTRUN_SEAL_KEY` not set, the server keeps it in `seal/seal.key` in its data directory, beside the store,
1356
+ making it at the first start: 32 random bytes in base64, 0600 in a 0700 directory, and one another user can read is
1357
+ refused, not changed. It lives and dies with the data (a disk, a volume): back it up with the data directory, and keep
1358
+ the two together. The store records the key's fingerprint (an HMAC of a fixed label under the key, never the key), and
1359
+ the server, every runner and `import` check the key they hold against it: a store whose secrets were sealed with another
1360
+ key does not start ("this store's secrets were sealed with another key; hand the server the original
1361
+ AGENTRUN_SEAL_KEY"), and no key is ever made over sealed secrets, so a lost `seal.key` is never replaced by a new one.
1362
+ The same holds on Postgres: a second machine with another key refuses. Only the server's start makes the key; a runner
1363
+ reads it from `AGENTRUN_SEAL_KEY` or the data directory, never makes one, and is refused without one. Set
1364
+ `AGENTRUN_SEAL_KEY` explicitly, the same in every process, and keep it.
1328
1365
 
1329
1366
  A stored value that does not open is never a reason not to start. It reads `set: false, stored_unreadable: true`, and
1330
- `reenter` names those fields with why: `seal_key_missing`, `seal_key_changed` (a lost `seal.key` is made anew, so it
1331
- shows as this) or `file_unreadable`. The log says so once, naming the condition and the file, never a value; a `PUT` of
1332
- the value seals it again under the current key. In a container, `~/.config` is the container's own and goes with it:
1333
- pass `AGENTRUN_SEAL_KEY`, or mount a directory at `XDG_CONFIG_HOME`, so a new container opens the keys the volume holds.
1367
+ `reenter` names those fields with why: `seal_key_changed` (sealed under another key) or `file_unreadable`. The log says
1368
+ so once, naming the condition and the file, never a value; a `PUT` of the value seals it again under the current key.
1334
1369
 
1335
1370
  A saved key is read by name like one the launcher hands over, and the launcher's value wins for a name it holds. A run
1336
1371
  gets the saved keys at its launch, over the pipe its secrets come on (a workflow run's `PARALLEL_API_KEY` on its
@@ -1381,22 +1416,20 @@ naming the limit and how many tools were read.
1381
1416
 
1382
1417
  `PUT /v2/settings/mcp-servers/{name}` previews the same way, then keeps the server: its URL, the tools it listed (the
1383
1418
  snapshot an agent will be shown) and its credential. A name is lowercase letters, digits and dashes, starting with a
1384
- letter, at most 32, with no underscores, so `mcp__<server>__<tool>` splits one way. Each credential header's value is
1385
- sealed like a [tool key](#tool-keys): AES-256-GCM under `AGENTRUN_SEAL_KEY`, bound to the server's name and the header,
1386
- in `DIR/mcp-servers.json` (0600, written whole, synced and renamed), which holds no value in the clear. With no seal key,
1387
- a server that takes a credential is `409 no_sealing_key`, before anything is contacted; one with `auth.type` none is
1388
- kept. A `PUT` that sends no `token` (or no `headers`) keeps the sealed credential, as long as the auth type and the URL's
1389
- origin stay the same: a saved credential never goes to another origin unless you send it again.
1390
-
1391
- `GET /v2/settings/mcp-servers` and `GET .../{name}` show each server with `credential`: `sealed`, `seal_key_missing`
1392
- (no seal key now) or `unreadable` (sealed under another key, or damaged: a `PUT` with the credential seals it again),
1393
- null for `auth.type` none. No read, log line or error shows a credential; a server's error text is cut of the values
1394
- sent before it is shown. `POST .../{name}/refresh` lists the tools again with the saved URL and credential, keeps them,
1395
- and answers `{added, removed, changed, server}`: `changed` names a tool whose title, description, schemas or
1396
- annotations differ. `DELETE .../{name}` forgets the server and its credential. A saved-servers file that does not read (damaged, or
1397
- another format) is never written over: the list answers `servers: []` with `file_unreadable: true`, and every other
1398
- route is `409 store_unreadable` until the file is restored or removed. Capabilities' `features.mcp_client`
1399
- says `transports: ["streamable-http"]`, the `auth` types and `at_rest` (`sealed`, or `unavailable` with no seal key).
1419
+ letter, at most 32, with no underscores, so `mcp__<server>__<tool>` splits one way. The credential is sealed like a
1420
+ [tool key](#tool-keys): AES-256-GCM under `AGENTRUN_SEAL_KEY`, bound to the server's name and its URL's origin, in the
1421
+ data directory's store, which holds no value in the clear. The server does not start without its seal key. A `PUT` that
1422
+ sends no `token` (or no `headers`) keeps the sealed credential, as long as the auth type and the URL's origin stay the
1423
+ same: a saved credential never goes to another origin unless you send it again.
1424
+
1425
+ `GET /v2/settings/mcp-servers` and `GET .../{name}` show each server with `credential`: `sealed`, `unreadable` (sealed
1426
+ under another key, or damaged: a `PUT` with the credential seals it again) or `expired` (an OAuth sign-in whose refresh
1427
+ its authorization server refused: sign in again), null for `auth.type` none. No read, log line or error shows a
1428
+ credential; a server's error text is cut of the values sent before it is shown. `POST .../{name}/refresh` lists the
1429
+ tools again with the saved URL and credential, keeps them, and answers `{added, removed, changed, server}`: `changed`
1430
+ names a tool whose title, description, schemas or annotations differ. `DELETE .../{name}` forgets the server and its
1431
+ credential. Capabilities' `features.mcp_client` says `transports: ["streamable-http"]`, the `auth` types and `at_rest:
1432
+ "sealed"`.
1400
1433
 
1401
1434
  ### Signing in with OAuth
1402
1435
 
@@ -1496,8 +1529,13 @@ asked by default.
1496
1529
  - **A call** goes to the pinned URL alone, the 2026-07-28 revision first and a 2025-era server through its
1497
1530
  `initialize`; on 2026-07-28 each `x-mcp-header` parameter of the pinned tool is sent as its `Mcp-Param-*` header. No
1498
1531
  redirect is followed, at most 4 MiB is read, and it may take 120 s. The
1499
- model reads the text blocks joined; past 60,000 characters, or with blocks that are not text, the whole answer is
1500
- filed under the run's `evidence/mcp/<server>/` and the text says where. A tool's own error (`isError`) reaches the
1532
+ model reads the text blocks and embedded text resources joined (GitHub's `get_file_contents` answers a file as one);
1533
+ past 60,000 characters it reads the answer's first lines, whole, and the rest is filed under the run's
1534
+ `evidence/mcp/<server>/` as lines (JSON laid out a value a line, its indent capped at 32 levels, and filed as
1535
+ written when the layout would pass twice its size and 64 KiB; a line past 10,000 characters broken), the text
1536
+ naming the file and the `read` offset that goes on, so a run with `read` and no shell pages through it. With blocks
1537
+ that are neither (an image, a blob), the whole answer is filed there as JSON and the text says where. On pi, every
1538
+ host tool's answer reaches the model whole within the host's result bound, as each CLI harness is told. A tool's own error (`isError`) reaches the
1501
1539
  model as its error. A refused credential (401, 403) reads "the MCP server <name> refused its credential (its sign-in
1502
1540
  expired or was revoked, or its key changed): sign in again in Settings → MCP servers, or update its credential
1503
1541
  there"; another failure names the server and the HTTP status, never a header. A stop, or a
@@ -1548,19 +1586,19 @@ or `https` address, with no user or password in it. Loopback and private-network
1548
1586
  on your own machine or network works. Two kinds of message are POSTed to it about runs: `run.needs_input` when a run comes to
1549
1587
  need its person (`input_required`: a question, a call held for approval, a pause at its cap, an ask for its person in
1550
1588
  its browser, desktop or phone, or a stopped turn) and `run.ended` when it ends
1551
- (completed, failed or cancelled, once carried back). A [schedule](#schedules) whose firing fails sends a third,
1589
+ (completed, failed or cancelled, once the run's end is written). A [schedule](#schedules) whose firing fails sends a third,
1552
1590
  `trigger.failed`; a server with no triggers never sends one.
1553
1591
 
1554
1592
  A run's end and its `run.ended` are one durable step. The server chooses the end's time once and gives it to the agent
1555
1593
  store, so the row's `ended_at` and the message's `webhook-id` name one time. `run.ended` is queued only once the agent
1556
1594
  store has the end, so a receiver that reads the run back on its message (`GET /v2/runs/{id}`) reads it ended; while the
1557
1595
  store refuses the end (a full disk, a busy store), nothing is sent, until a later try of the write or the next server
1558
- stores it. The outbox (`DIR/webhook-outbox.json`) keeps, in the same write as each message, which end and which wait of
1596
+ stores it. The outbox, in the store with the runs, keeps, in the same write as each message, which end and which wait of
1559
1597
  each run it queued. A server that starts queues any end of the last day that the agent store holds and the outbox does
1560
1598
  not, under the same `webhook-id` (one lost to a kill, or to a crash of the machine), and a server that takes over a run
1561
1599
  queues a wait it stands at that the outbox does not name (one the run came to while no server was up), under its one
1562
1600
  `webhook-id`. An end before the webhook was set is never sent. A run is continued only once its end's
1563
- `run.ended` is in the outbox on disk (`503` meanwhile), so a continued run's next end is its own, under its own id.
1601
+ `run.ended` is in the outbox (`503` meanwhile), so a continued run's next end is its own, under its own id.
1564
1602
 
1565
1603
  ```json
1566
1604
  { "type": "run.needs_input", "timestamp": "2026-11-01T12:00:00.000Z",
@@ -1583,15 +1621,15 @@ with any of its libraries: `webhook-id` (the same on every try of a message, so
1583
1621
  the secret's bytes. A receiver checks the signature against the raw body and refuses a timestamp more than 5 minutes
1584
1622
  from its clock, so a replay does not pass. The first `PUT` makes the secret, `whsec_` and 32 random bytes in base64,
1585
1623
  and answers `201` with it, once; `GET /v2/settings/webhook` never shows it. It is kept like a [tool key](#tool-keys):
1586
- sealed under `AGENTRUN_SEAL_KEY` in `DIR/webhook.json` (0600), so with no seal key no webhook is set
1587
- (`409 no_sealing_key`). A new secret is a `DELETE` and a `PUT`.
1624
+ sealed under `AGENTRUN_SEAL_KEY`, in the store (SQLite or Postgres) with the webhook itself. A new secret is a `DELETE` and a
1625
+ `PUT`; a secret that no longer opens under the server's key (sealed under another) is replaced, and shown once, by the next `PUT`.
1588
1626
 
1589
1627
  A try that is not answered 2xx within 15 s fails; a redirect is not followed. A failed message is tried again on the
1590
1628
  spec's schedule, with jitter: after about 5 s, 5 min, 30 min, 2 h, 5 h and 10 h, then logged as failed
1591
1629
  (`event=webhook condition=delivery_failed`). Each message goes on its own tries, so two queued close together can
1592
1630
  arrive in either order: a receiver orders them by `webhook-timestamp`, or reads the run (`GET /v2/runs/{id}`). A
1593
- `410 Gone` turns the webhook off (`disabled` in `GET`, and the log says why) until a `PUT` sets it again. Pending messages are kept in `DIR/webhook-outbox.json`, so the next server goes on with
1594
- them after a restart; a message can then come twice, under the same `webhook-id`. An outbox file of another version
1631
+ `410 Gone` turns the webhook off (`disabled` in `GET`, and the log says why) until a `PUT` sets it again. Pending messages are kept in the store's outbox, so the next server goes on with
1632
+ them after a restart; a message can then come twice, under the same `webhook-id`. An outbox of another version
1595
1633
  is not read: the server starts with none, and the log says so (`condition=outbox_not_read`). `GET /v2/settings/webhook/deliveries`
1596
1634
  lists the last 50 attempts (`webhook_id`, type, status code, latency, error, when, and the next try's time), and
1597
1635
  `POST /v2/settings/webhook/deliveries/{webhook_id}/redeliver` sends one of those messages again, once, under the same
@@ -1627,7 +1665,7 @@ a restart drives again finds its run. A firing's key stays bound to that run: wh
1627
1665
  run up, the firing reads `failed` ("The server stopped while setting up the run.") with that run's id, it never fires
1628
1666
  again, the next firing goes ahead, and `POST /v2/triggers/{id}/fire` is how a person tries it again. While the trigger's last run is active (working, or waiting on a person), a firing
1629
1667
  is `skipped`, with why (a webhook trigger with `accept` or `max_active_runs` is the exception: [each event it
1630
- takes](#webhook-triggers) starts its own run); a full server (`429`) keeps it due and tries again. Times missed while the server was down are
1668
+ takes](#webhook-triggers) starts its own run); a firing over the run limit starts its run `queued`, and one the server can't take now (busy or unavailable) stays due and is tried again. Times missed while the server was down are
1631
1669
  one `missed` firing with their count, and the schedule goes on from now; the latest of them still fires, once, when it is
1632
1670
  no older than the trigger's `catchup_window_s` (default an hour; 0, never), marked `catch_up`. A
1633
1671
  firing while the last run is active (working, or parked waiting on a person) is skipped with why, never queued,
@@ -1659,8 +1697,7 @@ anything else. A bad signature, a stale timestamp, an unknown trigger, one that
1659
1697
  answer the same `401`, so no trigger id can be found by asking; a body past 256 KiB is `413`.
1660
1698
 
1661
1699
  The secret, `whsec_` and 32 random bytes in base64, is made with the trigger and shown in the `201` once; no `GET`
1662
- shows it. It is kept sealed under `AGENTRUN_SEAL_KEY` in `DIR/trigger-settings-webhook.json` (each trigger source's
1663
- sealed settings have a file of their own), so with no seal key no webhook trigger is made (`409 no_sealing_key`).
1700
+ shows it. It is kept sealed under `AGENTRUN_SEAL_KEY` in the server's store, with each trigger source's other sealed settings.
1664
1701
  `POST /v2/triggers/{id}/secret` makes a new one, shown once, and the old one signs nothing from then on. Like every
1665
1702
  secret this server keeps (its tokens, its outbound webhook's secret), it is cut from what a run shows, from what an
1666
1703
  import keeps and from every learning text. A secret replaced by a rotation, or whose trigger is deleted, is kept too,
@@ -1668,8 +1705,7 @@ sealed in a retired row of its own (scope `retired:<trigger>:<n>`), never a sett
1668
1705
  before is still cut on every later server. Retired rows are kept for good for now; dropping one once no run older than
1669
1706
  it is left is still to come. A secret that does not open under the seal key the server starts with is
1670
1707
  said in its log (`condition=trigger_setting_unopened`, naming the trigger), and its trigger is refused until a new
1671
- secret is made. A `trigger-settings-webhook.json` that does not read is never written over: until it is fixed or moved
1672
- away, no webhook trigger is made or rotated (`409 store_unreadable`) and none fires.
1708
+ secret is made.
1673
1709
 
1674
1710
  The request's `webhook-id`, which its signature covers, is its firing's key: the first answers `202` once the firing is
1675
1711
  recorded, and its run starts after; the same `webhook-id` again, for a day after, answers `200` with that firing and
@@ -1725,15 +1761,15 @@ conditions holding. A verified delivery no rule takes (GitHub's `ping` among the
1725
1761
  `accept`, every verified request fires, as before. A trigger holds at most 20 rules, each at most 20 conditions and 20
1726
1762
  actions; an `in` lists at most 20 values of at most 1024 characters of JSON each, a pointer is at most 512 characters,
1727
1763
  and an event, an action or a prefix at most 200. A trigger with `accept` starts a run for each event it takes, its last
1728
- run active or not, since the events it takes are each their own work (a review per pull request); the server's run
1729
- limit still holds: a start it refuses (`429`) keeps the firing due and tries it again, and past 20 firings due a new
1730
- delivery answers `429`. This holds for every firing of such a trigger, a run now (`POST /v2/triggers/{id}/fire`)
1731
- included. Runs start in the order their events came while the server has room; while one firing waits to be tried
1732
- again after a `429`, a later one can start first.
1733
-
1734
- Such a trigger can take every run this server has room for, starving other triggers and the runs people start. Give it
1735
- `max_active_runs` (1 to 100; `null` clears it): past that many of its runs active, a firing waits due and is tried
1736
- again, as at a full server, and is never skipped. It counts the runs this trigger started while they work, kept apart
1764
+ run active or not, since the events it takes are each their own work (a review per pull request); the run limit still
1765
+ holds on the runner: a run past it waits `queued`. A start the server can't take now keeps the firing due and tries it
1766
+ again, and past 20 firings due a new delivery answers `429`. This holds for every firing of such a trigger, a run now
1767
+ (`POST /v2/triggers/{id}/fire`) included. Runs start in the order their events came; while one firing waits to be
1768
+ tried again, a later one can start first.
1769
+
1770
+ Such a trigger can fill the runner's places and the queue behind them, starving other triggers and the runs people
1771
+ start. Give it `max_active_runs` (1 to 100; `null` clears it): past that many of its runs active, a firing waits due and
1772
+ is tried again, and is never skipped. It counts the runs this trigger started while they work, kept apart
1737
1773
  from its history (so a long run counts however many firings follow it) and read again at each check; a run a person
1738
1774
  opens again after it ended is that person's follow-up, not counted. Any `start_run` trigger of a pushed source (a
1739
1775
  webhook) takes it, with or without `accept`: set, each event starts its own run, never skipped behind the last, up to the
@@ -1877,7 +1913,7 @@ failed, 2 when nothing ran. The runner, the graders and the report are in
1877
1913
  | `GET /health` | Without a credential: whether the store reads and the disk has room ([capacity and health](#capacity-and-health)). |
1878
1914
  | `GET /openapi.json` | Without a credential: this API as an OpenAPI 3.1 document, the `agentrun.v2/0` contract (vendored in `src/openapi/`, its source in `info`) with this server's own routes marked `x-agentrun-serve` the operations it answers `501` marked `x-agentrun-serve-unsupported`, and a contract operation that takes more than the contract gives marked `x-agentrun-serve-changed` with each change named; `links.openapi` in capabilities points at it. |
1879
1915
  | `GET /capabilities` | Without a credential. `backend: local`, every feature flag present and true only when it works; `tools`, the tools an agentic revision may name; `workflows`, what a workflow revision's model nodes get and, in `workflows.decisions.providers`, the decision providers its typed questions run on; `models`, where models come from and the model of each tier. |
1880
- | `POST /agents`, `GET /agents`, `GET /agents/{id}` | `POST` takes `{definition, skills?, note?}` and makes the agent with its first revision, current. A definition has `instructions` (an agentic revision) or `workflow` (a workflow revision, checked by the DSL first), and `name`, `description`, `model` and `thinking` (agentic only), `harness` ([harnesses](#harnesses)), `place` ([place](#place)), `tools`, `tool_settings` ([search and fetch](#search-and-fetch)), `skills` (names; each `<name>/SKILL.md` is in `skills`) and `version`, which is the number the revision gets, and `max_cost_usd`, the agent's default cap (an agentic agent's or a workflow's), kept by an edit that leaves it out and cleared only by 0, and `cap_mode`, how such a cap prices a request, `expected` or `strict` ([spend cap](#spend-cap)). A field the store does not keep (`input_schema`, `output_schema`) is `422 input_invalid` by name, and so is a definition that can never run here; one this host cannot run yet saves with `warnings` ([models](#models)). The ETag (`home_etag`) is the current revision's id. `GET /agents/{id}` adds `tools`, the tools its current revision grants with each one's provider ([search and fetch](#search-and-fetch)). |
1916
+ | `POST /agents`, `GET /agents`, `GET /agents/{id}` | `POST` takes `{definition, skills?, note?}` and makes the agent with its first revision, current. A definition has `instructions` (an agentic revision) or `workflow` (a workflow revision, checked by the DSL first), and `name`, `description`, `model` and `thinking` (agentic only), `harness` ([harnesses](#harnesses)), `place` ([place](#place)), `tools`, `tool_settings` ([search and fetch](#search-and-fetch)), `skills` (names; each `<name>/SKILL.md` is in `skills`) and `version`, which is the number the revision gets, and `max_cost_usd`, the agent's default cap (an agentic agent's or a workflow's), kept by an edit that leaves it out and cleared only by 0, and `cap_mode`, how such a cap prices a request, `expected` or `strict` ([spend cap](#spend-cap)), and `output_schema` (agentic only, at most 64 KiB): the JSON Schema the final answer's last fenced json block meets, which a completed run's `result.output` then holds (null when the answer doesn't meet it), kept by an edit that leaves it out. A template's answer schema is set here at apply, and a run a trigger starts is handed that trigger's last completed `result.output` after its message. A field the store does not keep (`input_schema`) is `422 input_invalid` by name, and so is a definition that can never run here; one this host cannot run yet saves with `warnings` ([models](#models)). The ETag (`home_etag`) is the current revision's id. `GET /agents/{id}` adds `tools`, the tools its current revision grants with each one's provider ([search and fetch](#search-and-fetch)). |
1881
1917
  | `PUT /agents/{id}/definition` | The same body, checked [the same way](#models): a new revision, its parent the current one, made current. Without `skills` the current revision's skill files carry over. A definition that is the current revision already writes nothing, so a PUT sent twice makes one revision. An agent's id, name and description stay those it was made with. `If-Match` that is not the current ETag is `412 precondition_failed`; the store compares it again inside the commit, so of two edits that read the same revision exactly one lands. The contract's body is taken too: the definition itself, with `If-Match` required (`412` without it) and `definition.version` greater than the current one (`422`). Any such version is taken, and always makes a new revision, the same definition included; the revision is numbered as this server numbers them, the next, and the answer says which; the route reads a body holding `definition` as this one, any other as the contract's. |
1882
1918
  | `GET /agents/{id}/revisions` | The agent's revisions, newest first: `revision`, `version`, `parent`, `kind`, `current`, `note`, `created_at` and the `definition`. |
1883
1919
  | `POST /agents/{id}/current` | `{revision}`: one of the agent's revisions becomes current again. |
@@ -1887,7 +1923,7 @@ failed, 2 when nothing ran. The runner, the graders and the report are in
1887
1923
  | `GET /runs` | Every agent's runs, newest first, a page of at most 100; `agent`, `revision` and `status` narrow it, and `archived=true` lists only archived ones. A failed run's summary carries its `error`, and a waiting run's its `pending`. |
1888
1924
  | `GET /runs/{id}` | The run: its revision, kind, status, state, result, error, `pending` (this server's own, `pending/1`: what a waiting run waits on, by `kind`: `{kind: "question", question, asked_at}` for a question it asked a person; `approval` for a tool call held for a person's approval, with the tool, its arguments and its price; `budget` for a run paused at its cap ([a run paused at its cap](#a-run-paused-at-its-cap)); `{kind: "browser", instruction, completion_condition, asked_at, expires_at}` for its agent's ask for the owner in its browser; or `{kind: "computer", computer: "desktop" | "phone", instruction, completion_condition, asked_at, expires_at}` for its agent's ask for the owner on its desktop or phone; else null, a stopped turn's included) and cost (`basis: estimate`; $0 before its first model request, a cancelled run's included). |
1889
1925
  | `GET /runs/{id}/timeline` | JSON pages with the change-number cursor (`after`, `next_after`, `reset`, `drop`, `has_more`, `final`, `wait_ms` long poll, and this server's own `limit`, 1 to 500 rows a page, default 500), or server-sent events with `Accept: text/event-stream` (`id` is the cursor, `Last-Event-ID` resumes). Rows sort by `seq`; the usage row (`Cost so far`), the run's running total, is always the last row, and moves to the end when a row comes after it. |
1890
- | `POST /runs/{id}/messages` | To an agentic run: `steer` while the agent works, `answer` when it asked the person, `follow_up` after a stop or after it completed: a completed run opens again, the same run on its own session and store, takes a place under `--max-runs` (`429` when none is free), and completes again. A failed or cancelled run, an archived run and a run of an archived agent are `409 not_continuable`; a workflow run takes none (`501`). |
1926
+ | `POST /runs/{id}/messages` | To an agentic run: `steer` while the agent works, `answer` when it asked the person, `follow_up` after a stop or after it completed: a completed run opens again, the same run on its own session and store, takes a place under `--max-runs` (it waits for one when none is free), and completes again. A failed or cancelled run, an archived run and a run of an archived agent are `409 not_continuable`; a workflow run takes none (`501`). |
1891
1927
  | `POST /runs/{id}/stop`, `POST /runs/{id}/cancel` | Stop ends an agentic run's turn and leaves the run `input_required` and idle. Cancel ends a run `cancelled` once its process has exited. |
1892
1928
  | `POST /runs/{id}/archive`, `POST /runs/{id}/unarchive` | [Archiving](#archiving) one run. Answers the run, with `archived_at`. |
1893
1929
  | `GET /runs/{id}/files`, `GET /runs/{id}/files/{path}` | The files under the run's `work/`, raw. |
@@ -1909,10 +1945,30 @@ failed, 2 when nothing ran. The runner, the graders and the report are in
1909
1945
  | `POST /mcp` | This server's own route (`x-agentrun-serve: "mcp/1"`): the [MCP endpoint](#for-coding-agents), Streamable HTTP with one JSON-RPC message per POST (`initialize`, `ping`, `tools/list`, `tools/call`), answered as JSON, stateless. Its ten tools call these routes in process with the caller's token. The Bearer token only, never the page's cookie; a browser `Origin` other than this server's own is `403`; any other method is `405`. |
1910
1946
  | `GET /usage` | The runs' cost estimates, by meter, agent, key, day or region (`key` and `region` are one line, `local`). A run of unknown cost adds what it is known to have spent so far (its `so_far_usd`: each priced charge, browser time and paid tools included) and is counted in `unpriced_runs` (in the total and in each line it is unknown on), so no sum is ever null, it never passes as $0, and a total is never below a line of its own: with `unpriced_runs` above 0 the total is a lower bound. |
1911
1947
 
1912
- Home export and import, quotes and `POST /runs/{id}/kill` answer `501 unsupported_here` naming the feature, and
1913
- capabilities declare each one false. No run waits out `input_wait_s` here (`null`). `limits.max_cost_usd` is the highest cap a run may name: `null` here, as any cap
1948
+ Quotes answer `501 unsupported_here` naming the feature. Home export and import (`GET` and `PUT /agents/{id}/home`) and
1949
+ `POST /runs/{id}/kill` are not served here: they answer `404`, and the served document leaves them out (its
1950
+ `info.x-agentrun-serve.not_served` lists them). Capabilities declare each of the four false. No run waits out `input_wait_s` here (`null`). `limits.max_cost_usd` is the highest cap a run may name: `null` here, as any cap
1914
1951
  above $0 is taken; it does not mean caps are unsupported ([spend cap](#spend-cap)).
1915
1952
 
1953
+ ### API only
1954
+
1955
+ `AGENTRUN_API_ONLY=1` is for a server that runs behind its caller's backend and is never opened in a browser. It
1956
+ serves these routes alone:
1957
+
1958
+ - a run's launch (`POST /agents/{id}/runs`, `POST /runs`), read (`GET /runs/{id}`), lists (`GET /agents/{id}/runs`,
1959
+ `GET /runs`), timeline, messages, stop, cancel, kill (`501` here, as above) and cap raise (`PATCH /runs/{id}`);
1960
+ - its files (`GET /runs/{id}/files`, `GET /runs/{id}/files/{path}`) and [uploads](#uploads) (`/files`);
1961
+ - `GET /capabilities`, `GET /health` and `GET /usage`.
1962
+
1963
+ Every other address is `404 not_found`, answered before the request is read further: the console at `/` and its
1964
+ assets, sign-in and setup, every `/settings` route, `POST /mcp`, triggers and their
1965
+ `POST /hooks/{id}`, agents, templates, `/openapi.json`, `/llms.txt` and the live views. It has no accounts: there is no
1966
+ page to sign in to, so no setup code is printed. The token works as it does on every route served. Unset, `0` or
1967
+ `false` serve the whole server, as before; any value other than these and `1` or `true` stops the start, in words.
1968
+
1969
+ Its routes for agents are refused too, so on an API-only server a run is launched inline (`POST /runs` with its
1970
+ definition), or on an agent made before the profile was turned on.
1971
+
1916
1972
  ## Uploads
1917
1973
 
1918
1974
  A run's input files. Send one in one call, its bytes the body and its path in the query:
@@ -1984,7 +2040,7 @@ device and inode), so a disk that takes another spelling for one name is refused
1984
2040
  segments: each its own NFC form, with no default-ignorable code point, or it is `400 invalid_file_path`. An archived agent's home is read and written as
1985
2041
  its definition is. A write is held to its directory through `/proc/self/fd`; where there is none (macOS),
1986
2042
  `capabilities.home.writes` is `false` and `PUT` and `DELETE` are `501 unsupported_here`, as Node has no `openat` to
1987
- write safely by path, while the list and reads still work. `GET` and `PUT /agents/{id}/home`, the contract's packed home, stay `501`.
2043
+ write safely by path, while the list and reads still work. `GET` and `PUT /agents/{id}/home`, the contract's packed home, are not served (`404`).
1988
2044
 
1989
2045
  ## For coding agents
1990
2046
 
@@ -2046,9 +2102,7 @@ into place and made read-only. `node scripts/harness-locks.mjs` makes the locks
2046
2102
  checks them). Every run that needs one waits for that one install, its ready time counted from the install's end, and
2047
2103
  shows a `phase` row, `Installing Claude Code (first use)…` or `Installing Codex (first use)…`, while it does. Each run
2048
2104
  then loads the harness from its own packages inside its install and nowhere else, never from a `node_modules` above it;
2049
- a tree that is not whole is installed again. Claude Code as an earlier build installed it, at the top of `<data>/harnesses`
2050
- itself, is removed before the first install (the server logs `harness_install_removed`), and it installs again; a
2051
- `harnesses` directory that holds anything else is left as it is. Until it is installed, capabilities list the harness with `installs:
2105
+ a tree that is not whole is installed again. Until it is installed, capabilities list the harness with `installs:
2052
2106
  "on_first_use"`. When npm fails, the run fails and its error names the command that installs it by hand, the same locked
2053
2107
  install: the shipped `package.json` and `package-lock.json` copied into a fresh `<data>/harnesses/<harness>.new`, `npm ci
2054
2108
  --ignore-scripts --include=optional` there, then that directory put in place of `<data>/harnesses/<harness>` (made
@@ -2169,15 +2223,12 @@ An agent or a run is archived, never deleted: `DELETE` stays `405`. These routes
2169
2223
  spend happened.
2170
2224
  - A new run of an archived agent is `409 agent_not_runnable`, saying it is archived (`details.archived_at`); a run
2171
2225
  already going when its agent is archived keeps going.
2172
- - The store keeps each change as one row of `archive_changes` in `store.sqlite`, written once
2173
- ([the store](../pi-durable-agent/README.md#agents-in-a-folder-the-agent-store)). A data directory an earlier version
2174
- wrote opens as it is, with nothing archived. Going back to an earlier version keeps every row, but that version does
2175
- not read them: archived agents and runs show as not archived there, and an archived agent's runs start again.
2226
+ - The store keeps an archive as `archived_at` on the agent's or the run's row, null when it is not archived.
2176
2227
 
2177
2228
  ## The console
2178
2229
 
2179
2230
  Open the link the server prints, once, in a browser. `/` is the console (`apps/console` in the repository), on the
2180
- server's own origin, under a CSP that allows that origin only:
2231
+ server's own origin, under a CSP that allows that origin only, but for the provider icons on the Keys page (below):
2181
2232
 
2182
2233
  - **Mission Control**: the store's counts and the latest runs.
2183
2234
  - **Agents**: each agent with its kind and harness, archived ones behind **Archived**. **New agent** and an agent's page:
@@ -2195,15 +2246,13 @@ server's own origin, under a CSP that allows that origin only:
2195
2246
  agent's Tools step lists each saved server's tools; a box ticked grants `mcp:<server>/<tool>`.
2196
2247
 
2197
2248
  Its files (`index.html`, and Vite's hashed files under `/assets/`) are public and hold no data: everything it shows
2198
- comes through `/v2`. The store's read-only JSON stays under `/api/*` (`/api/store`, `/api/agents/{id}`, `/api/runs` and
2199
- the rest of [`@parcha/pi-durable-agent`](../pi-durable-agent/README.md#looking-at-a-store)'s store page's data), for a
2200
- script with the token or a browser with its cookie. With accounts on (the default) the console asks for the owner's password
2249
+ comes through `/v2`. With accounts on (the default) the console asks for the owner's password
2201
2250
  ([your password](#your-password)) and the browser holds the owner's session cookie; a `?token=` link sets no cookie: the
2202
2251
  token is for scripts and the CLI. With `AGENTRUN_ACCOUNTS=0`, the printed link (`/?token=`) sets a cookie (`HttpOnly`,
2203
2252
  `SameSite=Strict`, `Path=/`, and `Secure` when `X-Forwarded-Proto` says https) and sends the browser to the same address
2204
2253
  without the token. The cookie's value is derived from the token, never the token itself, and it lasts until the browser
2205
2254
  closes. Without it, the console says to open the link. Either cookie takes the place of `Authorization: Bearer` on
2206
- `/api/*` and `/v2`: for a `GET`, and for any other method only when the request's `Origin` is the server's own origin
2255
+ `/v2`: for a `GET`, and for any other method only when the request's `Origin` is the server's own origin
2207
2256
  and its body is `application/json`, or, on a `PUT` or `POST` to a route that takes bytes (`PUT /v2/files/{id}`,
2208
2257
  `POST /v2/files`), of any content type. A request that sends an `Authorization` header is checked on that header alone.
2209
2258
 
@@ -2232,8 +2281,13 @@ at once; a new one past that is held by the server's budget only, and no address
2232
2281
  Behind a proxy every visitor would be the proxy's address, so one guesser would hold the owner too: set
2233
2282
  `AGENTRUN_TRUSTED_PROXIES` to the proxy's addresses or ranges (comma-separated, or `loopback`, `linklocal`,
2234
2283
  `uniquelocal`), and a request from one of them counts under the client its `X-Forwarded-For` names (the nearest address
2235
- that is not itself a trusted proxy). Unset, that header is never read. `render.yaml` sets it to `uniquelocal`, the private
2236
- ranges Render's proxy reaches a service from.
2284
+ that is not itself a trusted proxy). Unset, that header is never read. The owner's first sign-in of a start (the
2285
+ right password) that comes with `X-Forwarded-For` from an address the server doesn't trust is logged once, with that
2286
+ address (`event=forwarded_untrusted peer=<address>`; a server from a release after 0.1.0-beta.32). Only the right
2287
+ password logs it, so the address is the one that carried the owner's own request: behind a proxy, the proxy's.
2288
+ `render.yaml` leaves it unset, as Render publishes no address for its proxy: after a deploy, sign in, read the
2289
+ `forwarded_untrusted` line in the service's Logs, and set `AGENTRUN_TRUSTED_PROXIES` to that address (or its range,
2290
+ when Render's proxy reaches the service from more than one; sign in again after a redeploy to see whether it moved).
2237
2291
 
2238
2292
  Forgot it: run
2239
2293
  `agentrun-serve reset-password --data DIR` where the data directory is (`docker exec agentrun node
@@ -2270,18 +2324,22 @@ left out: 2 sessions still being written: they come in next time
2270
2324
 
2271
2325
  ## A run's life
2272
2326
 
2273
- 1. `POST /agents/{id}/runs` starts the run in the store (`startRun`, which pins the revision and seeds
2274
- `DIR/disk/agents/<agent>/runs/<id>/`), then its process: `pi-durable-disk run --dir DIR/disk/agents/<agent>/runs/<id> --app <this package's app> --serve 0` on
2275
- loopback, behind a token of its own (`DIR/.door-token`), with its stderr in `runs/<id>/process.log`. The run's input
2276
- is in `runs/<id>/serve.json`.
2277
- 2. The app reads the run's revision from the store.
2327
+ 1. `POST /agents/{id}/runs` starts the run in the store (`startRun`): one transaction writes a `queued` run, pinned to the
2328
+ agent's revision, with its launch record (the request, checked and resolved once, its model included). No process
2329
+ starts for it.
2330
+ 2. A runner (by default the one beside the server) claims the `queued` run for 30 s and renews the claim every 10 s. At
2331
+ the claim it opens the run's folder (`DIR/disk/agents/<agent>/runs/<id>/work`), reads the launch record and picks
2332
+ the run's loop: a workflow revision runs on the workflow loop, a learning run on the learning loop, and every
2333
+ other harness (pi, claude-agent, codex, opencode) on the adapter loop. Each loop writes the run's journal in the
2334
+ store, behind the claim's fence: a write under a claim the run has moved past is refused. A message, stop, cancel,
2335
+ raise or approval is a command row in the store, which the run's runner reads and applies.
2278
2336
  - An agentic revision runs as the root agent: its instructions and skills, its model, and the tools it names of the
2279
2337
  workspace's `read`, `write` and `edit`, and `ask_person`, which ends the turn; the timeline then shows a `waiting`
2280
- row, and the run is `input_required` and `waiting` until a message answers it. `bash` is bound only where the run
2281
- has a shell ([computers](#computers)): in a computer that mounts the run's folder, or on Archil's serverless exec
2282
- in Mode 2; in Mode 1 a run with no such computer has the file tools alone. The run is `queued` until its first message shows; while the process runs, the
2283
- timeline comes from its door's events through `@parcha/pi-durable-agent/timeline`. Once the run is idle and its
2284
- newest row is the agent's answer, the server sends the process SIGTERM. A model error ends it `failed`
2338
+ row, and the run is `input_required` and `waiting`, with no runner holding it, until a message answers it. `bash`
2339
+ is bound only where the run has a shell ([computers](#computers)): in a computer that mounts the run's folder, or
2340
+ on Archil's serverless exec in Mode 2; in Mode 1 a run with no such computer has the file tools alone. The run is
2341
+ `queued` until its first message shows. The timeline is read from the run's journal. When the turn ends on the
2342
+ agent's answer, the loop writes the run's end and the runner releases the claim. A model error ends it `failed`
2285
2343
  (`run_failed`). A run whose `max_cost_usd` cannot buy its next request is paused, `input_required` and `waiting`
2286
2344
  with `pending.kind` `budget`; one its cap refuses for a reason no cap fixes ends `failed` (`spend_cap_reached`,
2287
2345
  [below](#spend-cap)). A
@@ -2296,28 +2354,23 @@ left out: 2 sessions still being written: they come in next time
2296
2354
  A stopped run can be continued: a follow-up starts a fresh turn on the whole history, and the turn the stop cut is
2297
2355
  not replayed. A cancelled run cannot: a message to it is `409 not_continuable`, and its `next_action` is to start a
2298
2356
  new run of the agent.
2299
- - A workflow revision runs on agentrun-pi's durable workflow task, started by `startWorkflowRevision` of
2300
- `@parcha/pi-durable-agent/workflow` (keyed by the run's id): its model nodes (`agent`, `decide`, `extract`,
2301
- `report`) on the run's model, with the file tools each node names, and its typed questions on Jev or Parallel
2302
- ([decision workflows](#decision-workflows)). A workflow that needs code or a tool call this host does not run is
2303
- not saved here (`422`). The run is `queued` until its process serves, then `working`; when the workflow
2304
- ends, the app writes the run's final status with the outcome and releases it. Nothing is carried back from inside
2305
- the process, which holds the run's store until it exits.
2306
- 3. When the process has exited, the run's rows are read from its released store (an agentic run's conversation, a
2307
- workflow run's model nodes), and the server carries the run back, every run of both kinds: `carryBack` records its
2308
- state, cost and a summary in the store (an agentic run's answer; a workflow run's `workflowCarry`, its completed
2309
- nodes, then where it failed or escalated). Its last
2310
- page says `final`. v2's `cancelled` is the store's `stopped`; a workflow that escalated ends `completed`, its work
2311
- done and waiting for a person's review: `error` is null and `review` is `{kind, node, reason, at}`, in the run and in the
2312
- lists. In this release `kind` and `node` are always null: the store keeps only the escalation's summary (`reason`)
2313
- and the run's end (`at`). Every other run's
2314
- `review` is null. `GET /v2/stats` counts it in `needs_review`, never in `failed`.
2315
- 4. When the server starts, it reads every run the store says is running. A run process an earlier server started and
2316
- that still serves the run is supervised again, by the holder its row names (its pid, its start, its door); a run
2317
- that already ended is carried
2318
- back; a run whose process is gone before it ended is opened again on its directory and resumes from its store (an
2319
- agentic run waiting for an answer waits without one, until a message). A carry back that finds the store held by
2320
- another writer is tried again with backoff, and at the next start.
2357
+ - A workflow revision runs on the workflow loop, which drives the DSL's durable workflow task on the run's journal
2358
+ (keyed by the run's id): its model nodes (`agent`, `decide`, `extract`, `report`) on the run's model, with the file
2359
+ tools each node names, and its typed questions on Jev or Parallel ([decision workflows](#decision-workflows)). A
2360
+ workflow that needs code or a tool call this host does not run is not saved here (`422`). The run is `queued`
2361
+ until a runner claims it, then `working`. When the workflow ends, the loop writes the run's end from its outcome:
2362
+ a complete run ends `ended`, an escalated one `ended` with the outcome `escalated`, a refused or failed one
2363
+ `failed`, a cancelled one `stopped`.
2364
+ 3. The run's end is one commit: the run's state, its cost and a summary (an agentic run's answer; a workflow run's
2365
+ completed nodes, then where it failed or escalated) are written with the journal's end entry, so there is nothing to
2366
+ carry back afterwards. Its last page says `final`. v2's `cancelled` is the store's `stopped`; a workflow that
2367
+ escalated ends `completed`, its work done and waiting for a person's review: `error` is null and `review` is
2368
+ `{kind, node, reason, at}`, in the run and in the lists. In this release `kind` and `node` are always null: the
2369
+ store keeps only the escalation's summary (`reason`) and the run's end (`at`). Every other run's `review` is null.
2370
+ `GET /v2/stats` counts it in `needs_review`, never in `failed`.
2371
+ 4. A server that starts again adopts nothing: runs are claimed, not supervised. A run whose runner stopped or lost its
2372
+ claim writes nothing more; once the claim lapses another runner claims the run and resumes it from its journal,
2373
+ and a model request the stop cut is sent again. A run waiting for an answer has no claim and waits until a message.
2321
2374
 
2322
2375
  An `Idempotency-Key` answer is kept in `DATA/.idempotency.json` for `limits.idempotency_ttl_s` (a day), saved once the
2323
2376
  work is done and before the answer is sent, so a retry after a restart gets the first answer; a server that goes down
@@ -2359,9 +2412,13 @@ Each run of an agent that learns starts from `main` as it is when the run is mad
2359
2412
  not counted toward the budget. Each active note is there whole (its
2360
2413
  `## name (file.md)`, its description, then its text), the one changed last on `main` first (a merge or a person's
2361
2414
  edit; then by name), while they all fit the server's learning budget (`--learning-budget`, 8000 bytes by default).
2362
- Past it, the run reads the first 200 lines of `MEMORY.md` (and no more than 25 KB, as Claude Code loads its own),
2363
- then the notes changed last, whole, while they fit what is left; the rest are named only in the index, and an agent
2364
- with the `read` tool is told they are in `.learning/`, to open one when it applies (one without is not). A line
2415
+ Past it, the run reads the notes that bear on it: each active note is scored against the run's first message by a
2416
+ lexical match (BM25 over its name, description and text; a code review's changed paths weigh three times its prose; no
2417
+ model call), and the run reads the best ones whole while they fit, then one line for each of the rest
2418
+ (`- <name> (<file>): <description>`, at most 200 lines and 25 KB), in place of the index. A first message that shares
2419
+ no word with any note reads the index's first 200 lines, then the notes changed last, whole, while they fit. An agent
2420
+ with the `read` tool is told the notes not given whole are in `.learning/`, to open one when it applies (one without
2421
+ is not). A line
2365
2422
  before them says to follow a note when it applies. `# Learned` opens, for every run that learns, notes or none, with
2366
2423
  what the run is told of learning: that only what it answers when it is asked at the end is kept, never a file it
2367
2424
  writes, so it tells the person it will keep what they ask it to remember, and that a secret is never kept. A run with
@@ -2378,6 +2435,10 @@ Each run of an agent that learns starts from `main` as it is when the run is mad
2378
2435
  revision's (pi and codex read each `SKILL.md` in their prompt, claude-agent loads the ones its adapter takes through
2379
2436
  its Skill tool). A skill named like one of the revision's is the revision's, and only an active skill is served: one
2380
2437
  whose `SKILL.md` front matter says `status: pending` (held for its owner's OK), or any status but `active`, is not.
2438
+ One front-matter reader decides a skill's and a workflow's status everywhere (the checks, the console, the routes and
2439
+ a run's start): front matter that does not read one way (not closed, a key indented under another, a key set twice, a
2440
+ status over more than one line) reads as retired, so no run is given it. A learned skill is served with its `name` and
2441
+ `description` quoted, so a harness reads them as text.
2381
2442
  The learned ones get 256 KiB, every file of each together, and never more than the revision's skills leave of the 1
2382
2443
  MiB an adapter takes of a run's skills in all, so they never push the revision's back into the prompt: the one
2383
2444
  changed last on `main` first, each whole while it fits. One that does not fit, or holds one of the server's secrets,
@@ -2409,6 +2470,10 @@ Each run of an agent that learns starts from `main` as it is when the run is mad
2409
2470
  offered the workflows its pin names. A call a crash cut off is answered interrupted, never run again. The tool gate holds
2410
2471
  `learned_workflow` like any tool: its settings key is `learned_workflow`, allowed by default (the agent's own graded
2411
2472
  workflow, each node checked), and tool settings may set it to ask (the run parks until an owner answers) or deny.
2473
+ When a run's learned workflows name decision providers (Jev, Parallel, OpenRouter), the runner opens those providers'
2474
+ keys as it opens the run's own, from the server's environment first and then its saved keys, for the run's tools alone:
2475
+ never for its model or a CLI harness's own environment. A provider the run's tool gate denies gets no key. Learned
2476
+ workflows can use them once decision nodes land (see Coming).
2412
2477
 
2413
2478
  The server reads the commit with git plumbing, never the working tree. What it holds that is not a regular UTF-8 file of
2414
2479
  1 MiB or less, or a note out of shape, is not read, and the server's stderr names it. A learning fault never blocks a
@@ -2426,27 +2491,41 @@ with each note to keep as one ` ```note <file>.md ` block in the note format, an
2426
2491
  needed, and nothing the run wrote in `work/.learning/`, during the task or the turn, counts. It also says that a memory
2427
2492
  is replaced by a new note with `supersedes: [old.md]` and never by reusing a name, how many index lines are left (200
2428
2493
  less the active notes), that `No notes.` is a fine answer, and what not to keep. The turn runs under the run's own cap,
2429
- with no reserve, and within 5 minutes; its rows are labelled `learning`, and the run's answer stays the job's.
2430
-
2431
- As the run settles, before it reads ended and before a follow-up can open it again, the server keeps what the turn
2432
- answered, the whole text of each of its messages, and what the user said in the run, in `runs/<id>/learning-turn.json`.
2433
- Once the run has ended, in the agent's queue, the server reads the notes from that answer alone (`parseReflection`, in
2494
+ with no reserve, and within 5 minutes; its rows are labelled `learning`, and the run's answer stays the job's. While it
2495
+ runs, the run reads `reflecting` on every harness. A run whose only tool work was its learned workflows, each answering,
2496
+ with nothing said after its first message, is not asked: no request is sent, and its learning ends `dropped` (`empty`),
2497
+ "Nothing new: the run only ran a learned workflow."
2498
+
2499
+ The same turn may give one skill (only when the job completed) and one workflow draft, when the work repeats. Once a
2500
+ learned skill the run was given has been given to 3 earlier runs of its agent, with no learned workflow of that name,
2501
+ the turn also asks for that skill's job as a workflow draft under the skill's name, and says what each tool a draft's
2502
+ call node may run takes and gives. A draft the checks pass is dry-run before it is kept: the workflow language runs it on
2503
+ the run's own input (its block's `example:` line) or one made from its input schema, with every model and tool answer
2504
+ made up from the node's output schema, so nothing is sent, paid or run. One whose wiring breaks is left out, and the
2505
+ turn is asked once more to fix it. [`src/learn/SPEC.md`](src/learn/SPEC.md) has the rules.
2506
+
2507
+ The runner reads the notes from that answer alone (`parseReflection`, in
2434
2508
  `src/learn/reflect.ts`): an answer with no note is `empty`, and one that gives notes out of format (a note outside a
2435
2509
  block, a block with no file name, or one name given twice with other words) is `unparsed`, nothing kept. A block opens
2436
2510
  with the fence asked for (```` ```note ```` or four backticks for a note, four for a skill or a draft) and runs to the
2437
2511
  next line that is that fence; a shorter fence is text, a longer one an example, and an opening never closed is left out
2438
2512
  alone. `checkProposal`
2439
- (`src/learn/check.ts`) then refuses, before anything is written anywhere, a note that reuses an existing note's name, a
2513
+ (`src/learn/check.ts`) then leaves out, before anything is written anywhere, each item that breaks a rule, and the rest
2514
+ goes on: a note that reuses an existing note's name, a
2440
2515
  path that is not a `.md` file at the top, a bad name, front matter out of shape or setting `status`, a `supersedes`
2441
2516
  naming a note that is not active, more than 8 notes superseded, more than 8 new notes or a note over 4068 bytes (4096,
2442
2517
  less the 28 the server's own `origin` and `status` lines may take once it merges the note), an
2443
2518
  index past 200 lines, hidden characters, and text shaped like a secret or holding one of the server's own secrets (the
2444
2519
  launcher's, the keys and tokens in its environment, its API and door tokens, each webhook trigger's signing secret as it
2445
- is now), in a note or its name. A `MEMORY.md` the
2446
- answer gives is ignored. What passes is kept as the run's proposal, `runs/<id>/learning-proposal.json`, with what the
2447
- user said, each message cut of the server's secrets.
2448
-
2449
- Then one grader decides, one grade at a time per agent: `gradePrompt` (`src/learn/grade.ts`), which holds
2520
+ is now), in a note or its name. A cap leaves out the items past it, in the order the answer gave them, and the run's
2521
+ learning names what was left out. The whole answer is refused when it holds a secret or a hidden character (no item of
2522
+ it is trusted), when it writes a path outside the folder or deletes a file, when a text is not UTF-8, when the index
2523
+ would pass 200 lines, or when nothing is left. A `MEMORY.md` the
2524
+ answer gives is ignored. What passes is kept as the run's proposal, with what the user said, each message cut of the
2525
+ server's secrets, in the store in the same write as the run's end, beside what the turn answered. The run's end queues a
2526
+ learning run of its own, which no list of runs shows.
2527
+
2528
+ Then one grader decides, in that learning run: `gradePrompt` (`src/learn/grade.ts`), which holds
2450
2529
  `GRADE_RUBRIC`, the rubric's one statement, bounded (3 minutes), against `main` as it is then, and read by
2451
2530
  `parseVerdict`, which fails closed. It runs on the model the server grades on: `--grade-model` (or
2452
2531
  `AGENTRUN_SERVE_GRADE_MODEL`), else the strong tier (`AGENT_MODEL_STRONG`), named as the strong tier takes one; with
@@ -2455,8 +2534,13 @@ cheap model is a poor grader, so point the strong tier (or `--grade-model`) at a
2455
2534
  note's index line, the whole text only of the notes the proposal supersedes, what the user said in the run (cut of the
2456
2535
  server's secrets, as the proposal keeps it), and the new notes, so its prompt stays under 200,000 characters however
2457
2536
  many notes the folder holds. No injection screen runs before it: a page classifier cannot see where a note came
2458
- from, and read a preference the user stated as a planted instruction; the grader's Planted question decides. What the
2459
- grade spends is in no run's totals: it is kept on the run's learning, and counted once on `GET /usage` under the meter
2537
+ from, and read a preference the user stated as a planted instruction; the grader's Planted question decides: a rule the
2538
+ user states in their own words is theirs, even beside a form or a pasted email in the same message, and a rule found only
2539
+ inside text the run read is planted and dropped, never held for the owner's OK. An item that holds an account number is
2540
+ dropped too, even where the user gave it as where money goes. The Risky question reads one way on every grade model: a
2541
+ limit or threshold that decides whether an approval or a check happens is risky in either direction, as is an exemption
2542
+ from a check, trusting or paying a named site or seller, or naming where money or data goes, whoever asked. What the
2543
+ grade spends is in no run's totals, and is read once its request is booked: it is kept on the run's learning, and counted once on `GET /usage` under the meter
2460
2544
  `learning`, by agent and by day; a call cut off at its bound spent what nobody knows, so its cost is unknown, never $0.
2461
2545
 
2462
2546
  A kept verdict merges as one commit on `main`, made with plumbing: the new notes added, each with its `origin` (`you`
@@ -2511,14 +2595,31 @@ looking back cost, 0 when it did not), after its `serve.json` holds it; a server
2511
2595
  its next start. A run's notes are the one part that moves after its end (a follow-up reads another note): a line
2512
2596
  `{run, agent, notes: true, given, read}` then says them anew, the latest one winning, and counts neither the run nor its
2513
2597
  costs again. `GET /stats` counts the runs that tried to learn under `learning`, over its `from`, `to` and
2514
- `agent`, from that ledger and from the runs the server holds (`in_progress`), never opening a run's files; the
2515
- `learning` meter on `GET /usage` reads the same lines.
2598
+ `agent`, from the store (each run's kept learning and its learning run's journal; `in_progress` while a proposal waits
2599
+ for its grade), never opening a run's files; the `learning` meter on `GET /usage` reads each run's grade from the same.
2516
2600
 
2517
2601
  An eval set of 20 runs and what each proposed, labelled keep or drop (`test/fixtures/learn-eval.json`: lessons the
2518
2602
  agent worked out, user preferences and a "remember" during the task, one-shop facts, secrets, a tool's failure and four
2519
2603
  injections), runs in CI through the parser, the checks and the grader's prompt on a faux grader that answers by label
2520
2604
  (`test/learn-eval.test.mjs`). `scripts/learn-eval.mjs` runs the same set on real models, the grade and the end-of-run
2521
- turn both, and prints keep-precision, keep-recall and the injection-drop rate per model; it spends.
2605
+ turn both, and prints keep-precision, keep-recall and the injection-drop rate per model; it spends. It grades on several
2606
+ models at once (`--grade-models A,B,C`, with how often they agree, note by note), reads the held-out set with
2607
+ `--set heldout`, and lists its plan without calling a model with `--dry`.
2608
+
2609
+ The learning bench, `node scripts/learn-bench.mjs`, runs repeated jobs with learning off and on, on pi and
2610
+ claude-agent, and reports the follow rate on repeat steps, the work cost per run and its trend, how often workflows are
2611
+ proposed and reused, staleness after a rule changes, and wrong keeps after a planted request. Six jobs ship with it, in
2612
+ [`learn-bench/`](learn-bench/README.md); it calls real models and spends, so it runs on demand or nightly.
2613
+
2614
+ ### Coming
2615
+
2616
+ - One copy of each rule: a note that repeats an active note's rule is a duplicate, and a skill re-filed as a note retires the old skill (#2256).
2617
+ - A learned workflow may hold decision nodes (judge, pick, sift), answered by the run's decision provider under the run's cap (#2363).
2618
+ - Consolidation: related notes merged into one, and a skill and its workflow brought back in step (#2335).
2619
+ - A learned workflow's node of a tier runs on the server's model of that tier, at its own price (#2408).
2620
+ - A learned workflow's call node runs an MCP tool through the run's own MCP, under its gate, and the grader holds one that writes for the owner's OK (#2424).
2621
+ - A learned workflow keeps the output format its skill asks for (#2412).
2622
+ - A grade that contradicts itself is asked once more (#2425).
2522
2623
 
2523
2624
  ### What a person sees and controls
2524
2625
 
@@ -2678,6 +2779,9 @@ session (spent before any process could hold it). A session whose release is nev
2678
2779
  (what it ran and its minimum) when the run gives up on it. When the run is let go, its sessions are released and their
2679
2780
  last charges booked before its process exits.
2680
2781
 
2782
+ A computer's minutes (a sandbox's, a desktop's or a phone's) are billed by its provider to your own account there, and
2783
+ AgentRun does not count them yet: they are in no run's cost and are not held against its cap.
2784
+
2681
2785
  Under a cap, whatever cannot be priced is refused, never passed as $0, and the run ends `failed` with
2682
2786
  `spend_cap_reached`, since no cap would send it:
2683
2787
 
@@ -2764,11 +2868,8 @@ follows it. The refusal's words (`said`) keep its own figures. Its timeline show
2764
2868
  ending `:note`, so it is no message) marked `paused` (never an `error` row; it stays once the cap is raised, as the
2765
2869
  run's history), then a waiting row: "Waiting for you to raise the
2766
2870
  cap", and no more: the words are `pending.said`'s, which a client shows once. The
2767
- webhook's `run.needs_input` says `pending.kind: "budget"`. Its process is let go while it waits (SIGTERM: it drains and
2768
- releases the run), so a paused run holds no place; a server started again reads it paused from its store. A paused
2769
- process that does not let go within the drain timeout (`--drain-timeout`, 30 s by default) is killed, and the run ends
2770
- `failed`, as any run whose process is killed does, unless its cap was raised meanwhile: it held nothing, so the raise's
2771
- follow-up goes (below). A message to a
2871
+ webhook's `run.needs_input` says `pending.kind: "budget"`. The run is parked while it waits: no runner holds it,
2872
+ so a paused run holds no place, and a server started again reads it paused from its store. A message to a
2772
2873
  paused run is `409 budget_reached`; a stop does nothing more, and a cancel ends it `cancelled`. Only a refusal for room
2773
2874
  pauses a run: one no cap fixes (above) ends it `failed`, as does a cost found past the cap after a response.
2774
2875
 
@@ -2784,20 +2885,11 @@ still ends the run `failed`.
2784
2885
  `PATCH /runs/{run_id}` with `{max_cost_usd}` raises the cap, and only raises it: the new cap is above the run's current
2785
2886
  cap, its last raise included, by more than a float's tail (1e-9; `422` otherwise, and for a run with no cap;
2786
2887
  `409 not_continuable` for an ended run). A workflow run's raise is [below](#a-workflow-run-under-its-cap). The same raise sent again (a retry), within that tail, changes nothing and
2787
- answers as the first did. The run's serve.json keeps the raise before any answer, with each raise in `cap_raised`, so its
2788
- next process opens under it, as does a server started again; a raise it could not keep is not taken (an error answers it),
2789
- and the same raise again is taken anew. A run paused at its cap goes on: the answer is `{run_id, max_cost_usd, resumed: true,
2790
- message_id, status, state}` at once, and the pause gets one follow-up turn, "The cap was raised to $2; continue the
2791
- task.", under that `message_id`, which the server sends once the process being let go is gone, and which runs under the
2792
- new cap. From the moment the raise is taken, the run reads `queued` (state `working`), in the answer's `status` and in
2793
- every read after it, until the follow-up's turn runs: nothing waits on a person, so it is never `input_required` with no
2794
- `pending` meanwhile. A second raise before it goes raises the cap it names and answers the same `message_id`. It is sent once: a
2795
- server stopped before it went, or between starting its process and sending it, sends it when it starts again. One that
2796
- cannot be sent is tried again (after 1 s, then 3 s); after 3 tries the run ends `failed`, saying the cap was raised but
2797
- the run could not be sent on. The follow-up shows in the run's timeline as the server's, "AgentRun: The cap was raised…", never as the
2798
- person's message (its submit names the server as its origin, `cap_raised`). A working run's
2799
- live process keeps the cap it was opened with until its next one, and the answer's `note` says so. The raise is keyed to
2800
- the refusal's own start mark, so a row shown after the refusal never reads the run paused again.
2888
+ answers as the first did. The raise is a command row in the store, which the run's runner reads. A run paused at its cap goes on: the answer is
2889
+ `{run_id, max_cost_usd, resumed: true, status, state}` at once, and a runner claims the run again and resumes it from its
2890
+ journal under the new cap. A raise for a run a runner holds now takes effect from the run's next step: a step already
2891
+ under way keeps the cap it was admitted at, and the answer's `note` says so. A run a person stopped takes no raise
2892
+ (`409 not_continuable`): send it a message to go on, then raise its cap.
2801
2893
 
2802
2894
  A request carrying a native web search tool reads pages into its input that its body does not hold (the provider bills
2803
2895
  them as input): under a cap its input bound is its body's plus an allowance. Claude's own search, an explicit `native`
@@ -2916,20 +3008,25 @@ carries no cost at all, as from a provider that does not price the model. The te
2916
3008
  It sends no CORS headers, so a page on another origin cannot read an answer.
2917
3009
  - Every route but `GET /capabilities` needs `Authorization: Bearer <the token>`, compared in constant time, or the
2918
3010
  browser's cookie under the rules of [the console](#the-console). The console's own files (its HTML, scripts, styles
2919
- and fonts) hold no data; everything it shows comes through those routes. It loads nothing from the network, and its
2920
- CSP allows this origin only.
2921
- - Each run's door listens on loopback and takes only that run's own door token (`DIR/disk/agents/<agent>/runs/<id>/door-token`, 0600, made
2922
- at its first launch); a run's process an older server started keeps the server-wide one (`DIR/.door-token`).
2923
- - A run's process gets the server's environment (the `AGENT_MODEL` variables among it) without the server's token or any
2924
- key: no `AGENTRUN_TOKEN`, no `AGENTRUN_API_KEY`, no variable whose value is the token, and no variable named like a key
3011
+ and fonts) hold no data; everything it shows comes through those routes. It loads one thing from the network: on
3012
+ Settings → Keys, each provider's icon, from Google's favicon service (`www.google.com/s2/favicons`, which redirects
3013
+ to `t0`-`t3.gstatic.com`). The request names the provider's public site (`chatgpt.com`) and carries no referrer,
3014
+ no cookie of this server's and nothing of yours; Google sees the browser's address and which providers the page
3015
+ lists. Offline, or with those hosts blocked, the page shows a key icon instead. The CSP's `img-src` allows those
3016
+ five hosts; everything else is this origin only.
3017
+ - A run has no door of its own. The server and a run's runner meet in the store: a message, stop or approval is a
3018
+ command row the runner reads, so no port a run listens on takes a token.
3019
+ - A run's tools run under the runner's environment (the `AGENT_MODEL` variables among it) without the server's token or
3020
+ any key: no `AGENTRUN_TOKEN`, no `AGENTRUN_API_KEY`, no variable whose value is the token, and no variable named like a key
2925
3021
  (one of its `_`-separated segments, in any case, is `KEY`, `TOKEN`, `SECRET`, `PASSWORD`, `PASSWD`, `PASS`, `PAT`,
2926
3022
  `CREDENTIAL`, `CREDENTIALS` or `DSN`, or its last is `PWD` after another: `SERVICE_KEY`, `GITHUB_TOKEN_RO`, `DB_PASS`,
2927
3023
  `SENTRY_DSN`, `DB_PWD`; never `PWD` or `OLDPWD`), whether the launcher's list names it or not. The rule is
2928
- pi-durable-disk's (`@parcha/pi-durable-disk/secret-name`), which an import's cut and a harness's log take too. The keys it
2929
- needs come over its pipe. It gets none of the boxes' keys ([Boxes](#boxes)). A tool key reaches it only when its
3024
+ `keyShaped` (`src/secret-cut.ts`), which an import's cut and a harness's log take too. The keys a
3025
+ run needs are read from the store at its claim, opened with the seal key, and are put on that run's environment alone.
3026
+ It gets none of the boxes' keys ([Boxes](#boxes)). A tool key reaches it only when its
2930
3027
  revision names a tool the key unlocks (`MONID_API_KEY` a monid tool, `BROWSERBASE_API_KEY` and `KERNEL_API_KEY` `browser`; a workflow's
2931
3028
  tools are those its model and call nodes name), and a model key only when its model needs it ([Models](#models)), read
2932
- from the revision at each launch, a relaunch or a resume after a restart included.
3029
+ from the revision at each claim, a resume after a restart included.
2933
3030
  - A variable named like a key that is not on the launcher's list (`capabilities.secrets.names`) is left out of every
2934
3031
  run's environment, but the launcher does not take it out of the server's: it stays in the server's own environment
2935
3032
  (`/proc/<pid>/environ`), which any process of the same user can read. Set only the keys the server needs where it
@@ -2942,15 +3039,15 @@ carries no cost at all, as from a provider that does not price the model. The te
2942
3039
  keys or bearer token (held, and handed to a run on Bedrock), an `AWS_PROFILE`, `GOOGLE_CLOUD_API_KEY` or the default
2943
3040
  application credentials file work. A credential file a provider reads by path (`AWS_PROFILE`'s `~/.aws` files, the
2944
3041
  default application credentials) is the host's: a run's process reads it for its model, and its file tools cannot.
2945
- - `TYPESAFE_API_KEY` is a decision key, handed to a workflow run's decision providers on a pipe of their own and never
2946
- with a run's other secrets, so a pi run on a `typesafe/` model does not get it: its process finds no key for that
2947
- model, and the run fails.
3042
+ - `TYPESAFE_API_KEY` is a decision key, given to a workflow run's decision providers alone and never
3043
+ with a run's other secrets, so a pi run on a `typesafe/` model does not get it: it finds no key for that model, and
3044
+ the run fails.
2948
3045
  - A run's file tools (`read`, `write`, `edit`) reach its own `work/`, and two places of its own beside it: `read` also
2949
3046
  reaches the run's `tmp/` (next to `work/`, where a command's spilled output would go), and a write may also land in a
2950
3047
  temporary directory the run's environment made for a tool (`createTempDir`). Every other path, a link inside `work/`
2951
- included, is resolved and refused (`outside the workspace`), so a run reads neither the server's token, the door
2952
- token, `store.sqlite`, another run's files (its `work/` or its `tmp/`) nor `/proc`, and writes nowhere else. This is
2953
- pi-durable-disk's confinement inside the run's process, not an operating-system boundary: the run and the server
3048
+ included, is resolved and refused (`outside the workspace`), so a run reads neither the server's token,
3049
+ `store.sqlite`, another run's files (its `work/` or its `tmp/`) nor `/proc`, and writes nowhere else. This is the
3050
+ Workspace's confinement inside the runner's process, not an operating-system boundary: the runner and the server
2954
3051
  share a user (one uid in the container), so the confinement holds only because the run has no shell on this machine.
2955
3052
  - No path offers a shell on this machine. On the runner `bash` is not bound: a definition that names it is not saved
2956
3053
  here (`422`), one saved before that check is not runnable (`409`), and a model that calls it anyway, as an agent or as
@@ -2986,8 +3083,8 @@ carries no cost at all, as from a provider that does not price the model. The te
2986
3083
  ## Test
2987
3084
 
2988
3085
  ```sh
2989
- npm run build -w @parcha/agentrun-dsl -w @parcha/agentrun-pi -w @parcha/pi-durable-disk -w @parcha/pi-durable-agent -w @parcha/agentrun-serve
3086
+ npm run build -w @parcha/agentrun-dsl -w @parcha/agentrun-pi -w @parcha/pi-durable-agent -w @parcha/agentrun-serve
2990
3087
  npm test -w @parcha/agentrun-serve
2991
3088
  ```
2992
3089
 
2993
- The tests start real run processes on the faux model, both kinds: no key, no network.
3090
+ The tests start a real runner on the faux model, both kinds of run: no key, no network.