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

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 (466) hide show
  1. package/CHANGELOG.md +368 -0
  2. package/README.md +341 -208
  3. package/dist/adapters.d.ts +3 -4
  4. package/dist/adapters.js +18 -15
  5. package/dist/agent-rows.d.ts +99 -0
  6. package/dist/agent-rows.js +1 -0
  7. package/dist/agents-store.d.ts +6 -2
  8. package/dist/agents-store.js +75 -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 +1 -1
  14. package/dist/api-only.js +2 -2
  15. package/dist/archil-settings.d.ts +11 -1
  16. package/dist/archil-settings.js +10 -0
  17. package/dist/bash-read-only.d.ts +35 -0
  18. package/dist/bash-read-only.js +778 -0
  19. package/dist/box-settings.d.ts +3 -23
  20. package/dist/box-settings.js +7 -51
  21. package/dist/boxes.d.ts +17 -0
  22. package/dist/boxes.js +27 -20
  23. package/dist/browser-commands.d.ts +5 -2
  24. package/dist/browser-commands.js +4 -4
  25. package/dist/browser-computer.d.ts +5 -0
  26. package/dist/browser-computer.js +21 -0
  27. package/dist/browser-cost.d.ts +9 -6
  28. package/dist/browser-cost.js +95 -51
  29. package/dist/browser-live.d.ts +7 -20
  30. package/dist/browser-live.js +15 -93
  31. package/dist/browser-person.d.ts +18 -51
  32. package/dist/browser-person.js +94 -277
  33. package/dist/budget.d.ts +0 -5
  34. package/dist/budget.js +0 -5
  35. package/dist/cap.d.ts +14 -8
  36. package/dist/cap.js +19 -9
  37. package/dist/cli.js +71 -18
  38. package/dist/closed-pipes.d.ts +2 -0
  39. package/dist/closed-pipes.js +13 -0
  40. package/dist/computer-commands.d.ts +2 -0
  41. package/dist/computer-commands.js +2 -0
  42. package/dist/computer-keys.d.ts +20 -10
  43. package/dist/computer-keys.js +36 -54
  44. package/dist/computer-setting.d.ts +20 -3
  45. package/dist/computer-setting.js +58 -10
  46. package/dist/computers.d.ts +35 -2
  47. package/dist/computers.js +72 -11
  48. package/dist/confine.d.ts +120 -0
  49. package/dist/confine.js +436 -0
  50. package/dist/console/assets/index-B7NKTU8E.css +1 -0
  51. package/dist/console/assets/index-CXZMgJE7.js +550 -0
  52. package/dist/console/index.html +2 -2
  53. package/dist/content-filter.d.ts +7 -0
  54. package/dist/content-filter.js +23 -0
  55. package/dist/decision-cap.d.ts +7 -29
  56. package/dist/decision-cap.js +3 -94
  57. package/dist/decision-rows.d.ts +1 -1
  58. package/dist/decision-rows.js +1 -1
  59. package/dist/docker-daemon.d.ts +31 -0
  60. package/dist/docker-daemon.js +56 -0
  61. package/dist/effort-guidance.js +4 -3
  62. package/dist/environment.d.ts +0 -3
  63. package/dist/environment.js +3 -5
  64. package/dist/errors.d.ts +1 -2
  65. package/dist/errors.js +9 -9
  66. package/dist/explain.js +3 -1
  67. package/dist/filed-answer.d.ts +32 -0
  68. package/dist/filed-answer.js +160 -0
  69. package/dist/files.d.ts +1 -3
  70. package/dist/files.js +2 -4
  71. package/dist/github-connection.d.ts +1 -1
  72. package/dist/github-connection.js +25 -7
  73. package/dist/github-faux.d.ts +26 -0
  74. package/dist/github-faux.js +76 -0
  75. package/dist/github.d.ts +6 -2
  76. package/dist/github.js +5 -3
  77. package/dist/graph-served.d.ts +5 -3
  78. package/dist/graph-served.js +14 -6
  79. package/dist/graph-view.d.ts +3 -5
  80. package/dist/graph-view.js +9 -16
  81. package/dist/handed-values.d.ts +9 -0
  82. package/dist/handed-values.js +26 -0
  83. package/dist/harness-install.d.ts +1 -7
  84. package/dist/harness-install.js +1 -18
  85. package/dist/harness-opencode/adapter.d.ts +7 -0
  86. package/dist/harness-opencode/adapter.js +23 -6
  87. package/dist/harness-opencode/harness.js +0 -1
  88. package/dist/harness-opencode/host/policy.js +2 -2
  89. package/dist/harness-opencode/index.d.ts +1 -1
  90. package/dist/harness-opencode/index.js +1 -1
  91. package/dist/harness-opencode/verify.d.ts +17 -0
  92. package/dist/harness-opencode/verify.js +30 -10
  93. package/dist/harness-table.js +6 -1
  94. package/dist/heard.js +1 -1
  95. package/dist/held-fd.d.ts +5 -0
  96. package/dist/held-fd.js +14 -0
  97. package/dist/host-calls.d.ts +20 -0
  98. package/dist/host-calls.js +12 -0
  99. package/dist/host-tools.d.ts +4 -21
  100. package/dist/host-tools.js +4 -61
  101. package/dist/host.d.ts +2 -4
  102. package/dist/host.js +2 -7
  103. package/dist/import-summary.d.ts +1 -5
  104. package/dist/import-summary.js +0 -21
  105. package/dist/import.d.ts +6 -6
  106. package/dist/import.js +14 -15
  107. package/dist/index.d.ts +1 -0
  108. package/dist/index.js +1 -0
  109. package/dist/key-refusal.d.ts +5 -1
  110. package/dist/key-refusal.js +19 -4
  111. package/dist/learn/check.d.ts +8 -2
  112. package/dist/learn/check.js +85 -31
  113. package/dist/learn/folder.d.ts +11 -4
  114. package/dist/learn/folder.js +17 -19
  115. package/dist/learn/grade.d.ts +18 -1
  116. package/dist/learn/grade.js +108 -14
  117. package/dist/learn/index.d.ts +5 -5
  118. package/dist/learn/index.js +5 -5
  119. package/dist/learn/learning.sh +1 -14
  120. package/dist/learn/notes.d.ts +14 -3
  121. package/dist/learn/notes.js +16 -6
  122. package/dist/learn/reflect.d.ts +31 -2
  123. package/dist/learn/reflect.js +83 -6
  124. package/dist/learn/relevance.d.ts +24 -0
  125. package/dist/learn/relevance.js +91 -0
  126. package/dist/learn/secrets.d.ts +7 -1
  127. package/dist/learn/secrets.js +86 -19
  128. package/dist/learn/skills.d.ts +159 -18
  129. package/dist/learn/skills.js +644 -64
  130. package/dist/learned-nodes.d.ts +14 -0
  131. package/dist/learned-nodes.js +8 -0
  132. package/dist/learned-workflow.d.ts +41 -6
  133. package/dist/learned-workflow.js +153 -18
  134. package/dist/learning-routes.d.ts +49 -4
  135. package/dist/learning-routes.js +113 -31
  136. package/dist/learning-run.d.ts +16 -31
  137. package/dist/learning-run.js +31 -38
  138. package/dist/learning-words.d.ts +12 -5
  139. package/dist/learning-words.js +18 -9
  140. package/dist/learning.d.ts +91 -97
  141. package/dist/learning.js +176 -320
  142. package/dist/live/stream.js +1 -1
  143. package/dist/live/translate.js +12 -2
  144. package/dist/llm.d.ts +4 -1
  145. package/dist/llm.js +4 -2
  146. package/dist/local-models.d.ts +11 -5
  147. package/dist/local-models.js +13 -8
  148. package/dist/mcp-gateway.d.ts +17 -49
  149. package/dist/mcp-gateway.js +55 -136
  150. package/dist/mcp-oauth.d.ts +10 -14
  151. package/dist/mcp-oauth.js +14 -32
  152. package/dist/mcp-probe.d.ts +0 -7
  153. package/dist/mcp-probe.js +4 -10
  154. package/dist/mcp-servers-store.d.ts +18 -18
  155. package/dist/mcp-servers-store.js +12 -14
  156. package/dist/mcp-store.js +3 -4
  157. package/dist/mcp.js +4 -3
  158. package/dist/model.d.ts +9 -7
  159. package/dist/model.js +51 -27
  160. package/dist/monid.d.ts +0 -2
  161. package/dist/monid.js +3 -6
  162. package/dist/openapi.d.ts +8 -1
  163. package/dist/openapi.js +156 -58
  164. package/dist/page.d.ts +1 -3
  165. package/dist/page.js +6 -18
  166. package/dist/paid-calls.d.ts +21 -27
  167. package/dist/paid-calls.js +26 -61
  168. package/dist/pause.d.ts +2 -19
  169. package/dist/pause.js +5 -74
  170. package/dist/port-models.d.ts +10 -3
  171. package/dist/port-models.js +26 -6
  172. package/dist/propose.d.ts +2 -0
  173. package/dist/propose.js +80 -45
  174. package/dist/push-handler.d.ts +1 -1
  175. package/dist/reflect-range.d.ts +25 -0
  176. package/dist/reflect-range.js +30 -0
  177. package/dist/refusal-words.d.ts +5 -1
  178. package/dist/refusal-words.js +5 -1
  179. package/dist/rows.d.ts +1 -1
  180. package/dist/run-cut.d.ts +0 -6
  181. package/dist/run-cut.js +0 -6
  182. package/dist/run-db.d.ts +2 -11
  183. package/dist/run-db.js +2 -37
  184. package/dist/run-launch.d.ts +21 -2
  185. package/dist/run-launch.js +14 -5
  186. package/dist/run-learning-served.d.ts +21 -4
  187. package/dist/run-learning-served.js +23 -13
  188. package/dist/run-reads-over-store.d.ts +5 -3
  189. package/dist/run-reads-over-store.js +25 -14
  190. package/dist/run-secrets.d.ts +1 -1
  191. package/dist/run-timeline-served.d.ts +5 -1
  192. package/dist/run-timeline-served.js +27 -6
  193. package/dist/run-view.d.ts +37 -22
  194. package/dist/run-view.js +85 -38
  195. package/dist/runnable.d.ts +21 -10
  196. package/dist/runnable.js +35 -12
  197. package/dist/runner/adapter-loop.d.ts +36 -5
  198. package/dist/runner/adapter-loop.js +663 -69
  199. package/dist/runner/adapter-run-spec.d.ts +42 -8
  200. package/dist/runner/adapter-run-spec.js +186 -52
  201. package/dist/runner/adapters/index.js +11 -1
  202. package/dist/runner/adapters/pi.d.ts +40 -2
  203. package/dist/runner/adapters/pi.js +110 -27
  204. package/dist/runner/beside.d.ts +38 -3
  205. package/dist/runner/beside.js +54 -5
  206. package/dist/runner/claim-secrets.d.ts +16 -1
  207. package/dist/runner/claim-secrets.js +62 -14
  208. package/dist/runner/cli-run-spec.d.ts +5 -0
  209. package/dist/runner/cli-run-spec.js +159 -41
  210. package/dist/runner/commands.js +1 -1
  211. package/dist/runner/computer-journal.d.ts +15 -2
  212. package/dist/runner/computer-journal.js +41 -5
  213. package/dist/runner/conformance/harness.d.ts +1 -0
  214. package/dist/runner/conformance/harness.js +123 -13
  215. package/dist/runner/conformance/subject.d.ts +4 -1
  216. package/dist/runner/dispatch.d.ts +8 -1
  217. package/dist/runner/dispatch.js +81 -7
  218. package/dist/runner/end-of-run.d.ts +8 -2
  219. package/dist/runner/end-of-run.js +10 -4
  220. package/dist/runner/github-app.d.ts +7 -2
  221. package/dist/runner/github-app.js +47 -16
  222. package/dist/runner/harness-loops.d.ts +15 -2
  223. package/dist/runner/harness-loops.js +38 -2
  224. package/dist/runner/journal-kinds.d.ts +60 -6
  225. package/dist/runner/journal-kinds.js +43 -5
  226. package/dist/runner/journal-reader.d.ts +1 -1
  227. package/dist/runner/journal-reader.js +2 -2
  228. package/dist/runner/learning-ask.d.ts +4 -0
  229. package/dist/runner/learning-ask.js +15 -1
  230. package/dist/runner/learning-end.d.ts +18 -3
  231. package/dist/runner/learning-end.js +194 -20
  232. package/dist/runner/learning-loop.d.ts +7 -0
  233. package/dist/runner/learning-loop.js +36 -8
  234. package/dist/runner/learning-seed.d.ts +6 -0
  235. package/dist/runner/learning-seed.js +6 -0
  236. package/dist/runner/loop-contract.d.ts +4 -0
  237. package/dist/runner/main.d.ts +61 -9
  238. package/dist/runner/main.js +144 -20
  239. package/dist/runner/mcp-claim.d.ts +3 -0
  240. package/dist/runner/mcp-claim.js +7 -3
  241. package/dist/runner/mcp-github.d.ts +11 -2
  242. package/dist/runner/mcp-github.js +55 -4
  243. package/dist/runner/mcp-run.d.ts +2 -0
  244. package/dist/runner/mcp-run.js +16 -5
  245. package/dist/runner/memory-claim.d.ts +9 -0
  246. package/dist/runner/memory-claim.js +25 -0
  247. package/dist/runner/metrics.d.ts +46 -1
  248. package/dist/runner/metrics.js +156 -1
  249. package/dist/runner/model-route.d.ts +16 -0
  250. package/dist/runner/model-route.js +134 -10
  251. package/dist/runner/reflect-hook.d.ts +12 -1
  252. package/dist/runner/reflect-hook.js +33 -3
  253. package/dist/runner/runner.d.ts +20 -0
  254. package/dist/runner/runner.js +146 -18
  255. package/dist/runner/spec-holds.d.ts +7 -2
  256. package/dist/runner/spec-holds.js +4 -3
  257. package/dist/runner/store-port.d.ts +1 -1
  258. package/dist/runner/store-secrets.d.ts +3 -3
  259. package/dist/runner/store-secrets.js +8 -12
  260. package/dist/runner/text-tools.d.ts +44 -0
  261. package/dist/runner/text-tools.js +237 -0
  262. package/dist/runner/workflow-host.d.ts +7 -2
  263. package/dist/runner/workflow-host.js +3 -1
  264. package/dist/runner/workflow-loop.d.ts +10 -1
  265. package/dist/runner/workflow-loop.js +14 -6
  266. package/dist/runner/workflow-spec.d.ts +21 -0
  267. package/dist/runner/workflow-spec.js +217 -93
  268. package/dist/runs-over-store.d.ts +14 -3
  269. package/dist/runs-over-store.js +100 -23
  270. package/dist/seal-key.d.ts +0 -2
  271. package/dist/seal-key.js +5 -45
  272. package/dist/sealed-settings-store.d.ts +19 -4
  273. package/dist/sealed-settings-store.js +9 -9
  274. package/dist/sealing.d.ts +4 -0
  275. package/dist/sealing.js +20 -0
  276. package/dist/secret-cut.d.ts +1 -1
  277. package/dist/secret-cut.js +1 -1
  278. package/dist/secret-name.d.ts +9 -0
  279. package/dist/secret-name.js +15 -0
  280. package/dist/secret-writes.d.ts +0 -1
  281. package/dist/secret-writes.js +0 -1
  282. package/dist/server-fs.d.ts +4 -0
  283. package/dist/server-fs.js +8 -2
  284. package/dist/server-lock.d.ts +0 -24
  285. package/dist/server-lock.js +5 -85
  286. package/dist/server-secrets-store.d.ts +4 -4
  287. package/dist/server-secrets-store.js +9 -31
  288. package/dist/server-secrets.d.ts +4 -9
  289. package/dist/server-secrets.js +12 -36
  290. package/dist/server.d.ts +37 -56
  291. package/dist/server.js +322 -134
  292. package/dist/sign-ins-store.d.ts +34 -36
  293. package/dist/sign-ins-store.js +27 -38
  294. package/dist/sign-ins.d.ts +2 -119
  295. package/dist/sign-ins.js +5 -311
  296. package/dist/standard-webhooks.d.ts +1 -1
  297. package/dist/standard-webhooks.js +1 -1
  298. package/dist/stats.d.ts +3 -2
  299. package/dist/stats.js +1 -1
  300. package/dist/stop-signals.d.ts +4 -2
  301. package/dist/stop-signals.js +5 -3
  302. package/dist/store/agent-body.d.ts +12 -2
  303. package/dist/store/agent-body.js +22 -4
  304. package/dist/store/deadline.d.ts +18 -0
  305. package/dist/store/deadline.js +45 -0
  306. package/dist/store/index.d.ts +2 -2
  307. package/dist/store/index.js +2 -2
  308. package/dist/store/open.d.ts +6 -3
  309. package/dist/store/open.js +2 -2
  310. package/dist/store/postgres/connection.d.ts +22 -2
  311. package/dist/store/postgres/connection.js +211 -41
  312. package/dist/store/postgres/migrate.d.ts +4 -0
  313. package/dist/store/postgres/migrate.js +9 -2
  314. package/dist/store/postgres/migrations/0003_commands_one_answer.check.sql +19 -0
  315. package/dist/store/postgres/migrations/0003_commands_one_answer.sql +13 -0
  316. package/dist/store/postgres/store.d.ts +9 -2
  317. package/dist/store/postgres/store.js +9 -0
  318. package/dist/store/schema.js +1 -1
  319. package/dist/store/seal.js +2 -2
  320. package/dist/store/sqlite/connection.js +14 -5
  321. package/dist/store/sqlite/run-patch.d.ts +3 -0
  322. package/dist/store/sqlite/run-patch.js +3 -0
  323. package/dist/store/sqlite/store.js +41 -12
  324. package/dist/store/store.d.ts +35 -6
  325. package/dist/store/store.js +12 -2
  326. package/dist/store-reads/cap.d.ts +1 -1
  327. package/dist/store-reads/cap.js +22 -4
  328. package/dist/store-reads/journal.d.ts +9 -6
  329. package/dist/store-reads/journal.js +129 -18
  330. package/dist/store-reads/learning.d.ts +82 -8
  331. package/dist/store-reads/learning.js +184 -11
  332. package/dist/store-reads/workflow.d.ts +1 -1
  333. package/dist/store-reads/workflow.js +1 -1
  334. package/dist/store-view.d.ts +19 -1
  335. package/dist/store-view.js +95 -27
  336. package/dist/template-eval.d.ts +60 -4
  337. package/dist/template-eval.js +120 -54
  338. package/dist/templates.d.ts +33 -14
  339. package/dist/templates.js +82 -46
  340. package/dist/timeline/group.d.ts +33 -0
  341. package/dist/timeline/group.js +77 -0
  342. package/dist/timeline/index.d.ts +7 -0
  343. package/dist/timeline/index.js +7 -0
  344. package/dist/timeline/labels.d.ts +79 -0
  345. package/dist/timeline/labels.js +150 -0
  346. package/dist/timeline/origin.d.ts +56 -0
  347. package/dist/timeline/origin.js +92 -0
  348. package/dist/timeline/render-text.d.ts +11 -0
  349. package/dist/timeline/render-text.js +62 -0
  350. package/dist/timeline/timeline.d.ts +282 -0
  351. package/dist/timeline/timeline.js +1308 -0
  352. package/dist/timeline/util.d.ts +17 -0
  353. package/dist/timeline/util.js +49 -0
  354. package/dist/tool-budget.d.ts +18 -0
  355. package/dist/tool-budget.js +50 -0
  356. package/dist/tool-gate.d.ts +47 -218
  357. package/dist/tool-gate.js +87 -545
  358. package/dist/tool-keys-store.d.ts +11 -12
  359. package/dist/tool-keys-store.js +24 -31
  360. package/dist/tool-keys.d.ts +5 -101
  361. package/dist/tool-keys.js +8 -267
  362. package/dist/tool-plane.d.ts +23 -52
  363. package/dist/tool-plane.js +23 -81
  364. package/dist/tool-settings-store.d.ts +1 -2
  365. package/dist/tool-settings-store.js +5 -8
  366. package/dist/tools.d.ts +67 -25
  367. package/dist/tools.js +170 -119
  368. package/dist/trigger-adapter.d.ts +2 -2
  369. package/dist/trigger-targets.d.ts +13 -1
  370. package/dist/trigger-targets.js +31 -1
  371. package/dist/triggers.d.ts +2 -2
  372. package/dist/triggers.js +3 -3
  373. package/dist/turn-end.d.ts +1 -1
  374. package/dist/turn-end.js +1 -1
  375. package/dist/turns.d.ts +0 -6
  376. package/dist/turns.js +0 -19
  377. package/dist/uploads.d.ts +28 -5
  378. package/dist/uploads.js +83 -10
  379. package/dist/usage.d.ts +1 -49
  380. package/dist/usage.js +3 -84
  381. package/dist/validate.d.ts +4 -0
  382. package/dist/validate.js +33 -14
  383. package/dist/webhooks.d.ts +102 -76
  384. package/dist/webhooks.js +266 -233
  385. package/dist/workflow-run.d.ts +114 -0
  386. package/dist/workflow-run.js +144 -0
  387. package/dist/workspace/archil-claim.d.ts +2 -2
  388. package/dist/workspace/archil-claim.js +4 -3
  389. package/dist/workspace/archil-disk.d.ts +10 -1
  390. package/dist/workspace/archil-disk.js +4 -0
  391. package/dist/workspace/archil-exec.d.ts +12 -2
  392. package/dist/workspace/archil-exec.js +16 -0
  393. package/dist/workspace/archil.d.ts +2 -2
  394. package/dist/workspace/archil.js +25 -5
  395. package/dist/workspace/attach.js +2 -0
  396. package/dist/workspace/beneath.d.ts +19 -0
  397. package/dist/workspace/beneath.js +106 -0
  398. package/dist/workspace/computer-deps.d.ts +26 -9
  399. package/dist/workspace/computer-deps.js +144 -43
  400. package/dist/workspace/computer-for-claim.d.ts +17 -14
  401. package/dist/workspace/computer-for-claim.js +99 -26
  402. package/dist/workspace/computer-hold.d.ts +6 -1
  403. package/dist/workspace/computer-hold.js +6 -1
  404. package/dist/workspace/computer-janitor.d.ts +47 -0
  405. package/dist/workspace/computer-janitor.js +182 -0
  406. package/dist/workspace/computer-ledger.d.ts +1 -8
  407. package/dist/workspace/computer-ledger.js +0 -3
  408. package/dist/workspace/computer-providers.d.ts +5 -3
  409. package/dist/workspace/computer-providers.js +11 -9
  410. package/dist/workspace/grep-worker.d.ts +5 -0
  411. package/dist/workspace/grep-worker.js +9 -6
  412. package/dist/workspace/hands.d.ts +5 -2
  413. package/dist/workspace/hands.js +4 -3
  414. package/dist/workspace/index.d.ts +6 -5
  415. package/dist/workspace/index.js +4 -4
  416. package/dist/workspace/local.d.ts +14 -2
  417. package/dist/workspace/local.js +170 -43
  418. package/dist/workspace/paths.js +3 -2
  419. package/dist/workspace/pi-env.d.ts +4 -0
  420. package/dist/workspace/pi-env.js +3 -2
  421. package/dist/workspace/resolve-computer.d.ts +55 -10
  422. package/dist/workspace/resolve-computer.js +66 -14
  423. package/dist/workspace/run-tools.d.ts +15 -31
  424. package/dist/workspace/run-tools.js +19 -30
  425. package/dist/workspace/workspace.d.ts +5 -0
  426. package/dist/workspace-paths.d.ts +0 -17
  427. package/dist/workspace-paths.js +1 -41
  428. package/dist/workspace.d.ts +0 -17
  429. package/dist/workspace.js +4 -110
  430. package/package.json +14 -14
  431. package/skills/agentrun-serve/SKILL.md +1 -1
  432. package/templates/README.md +11 -5
  433. package/templates/code-review/evals/mentions-defused/case.yaml +15 -0
  434. package/templates/code-review/evals/mentions-defused/fixtures/github-mcp.json +254 -0
  435. package/templates/code-review/evals/mentions-defused/graders/no-pings.md +16 -0
  436. package/templates/code-review/evals/mentions-defused/graders/posted-a-review.md +5 -0
  437. package/templates/code-review/evals/mentions-defused/graders/schema.md +5 -0
  438. package/templates/code-review/evals/mentions-defused/prompt.md +10 -0
  439. package/templates/kyb/evals/clean-public-company/graders/no-opensanctions.md +5 -0
  440. package/templates/kyb/evals/opensanctions-on/case.yaml +5 -0
  441. package/templates/kyb/evals/opensanctions-on/graders/licence-and-evidence.md +18 -0
  442. package/templates/kyb/evals/opensanctions-on/graders/schema.md +5 -0
  443. package/templates/kyb/evals/opensanctions-on/prompt.md +11 -0
  444. package/templates/market-monitor/agent.md +2 -2
  445. package/templates/market-monitor/skills/monitor/SKILL.md +6 -4
  446. package/templates/release-notes/agent.md +11 -0
  447. package/dist/bound-files.d.ts +0 -4
  448. package/dist/bound-files.js +0 -164
  449. package/dist/coding-tools.d.ts +0 -47
  450. package/dist/coding-tools.js +0 -189
  451. package/dist/computer-adb.d.ts +0 -12
  452. package/dist/computer-adb.js +0 -14
  453. package/dist/console/assets/index-Dn0ngwG9.js +0 -535
  454. package/dist/console/assets/index-DvW6Aled.css +0 -1
  455. package/dist/grade.d.ts +0 -63
  456. package/dist/grade.js +0 -150
  457. package/dist/mcp-servers.d.ts +0 -269
  458. package/dist/mcp-servers.js +0 -456
  459. package/dist/packs.d.ts +0 -71
  460. package/dist/packs.js +0 -180
  461. package/dist/sealed-settings.d.ts +0 -60
  462. package/dist/sealed-settings.js +0 -171
  463. package/dist/sessions.d.ts +0 -6
  464. package/dist/sessions.js +0 -109
  465. package/dist/workspace/computer-serves.d.ts +0 -12
  466. package/dist/workspace/computer-serves.js +0 -15
package/README.md CHANGED
@@ -9,7 +9,7 @@ runner starts beside the server. The capabilities document (`GET /v2/capabilitie
9
9
 
10
10
  ## Quick start (no key, no network)
11
11
 
12
- Node 24.11 or later. In a checkout of this repository:
12
+ Node 24.22.3 or later. In a checkout of this repository:
13
13
 
14
14
  ```sh
15
15
  npm ci --ignore-scripts && npm run build
@@ -65,12 +65,12 @@ An edit is a new revision: `PUT $AGENTRUN_BASE_URL/agents/calc/definition` with
65
65
  | `--faux MODULE` | none | Answer every model request from the module's default export (below). |
66
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. |
67
67
  | `--allow-host NAME` | none | Another `Host` name to accept on a loopback address, on any port. Repeat it. |
68
- | `--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. |
69
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. |
70
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. |
71
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`. |
72
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. |
73
- | `--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`. |
74
74
 
75
75
  `AGENTRUN_TOKEN`, when set, is the token (32 characters or more), and the server prints `$AGENTRUN_TOKEN` in its
76
76
  place: a token from the environment stays out of the logs. `DIR/.token`'s token is printed only by the start that made
@@ -210,16 +210,12 @@ let a service with a disk change that.
210
210
  ## The disk, and earlier data directories
211
211
 
212
212
  The data directory has two parts. Its own files, the control plane, hold the agent store (`DIR/store.sqlite`, where
213
- each run's row keeps its claim: an epoch and its holder), the token and the server's settings; only the server opens
214
- 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
215
215
  in lower case, a dash and 16 hex digits of its SHA-256), with its learning folder (`learning/`) and its runs
216
- (`runs/<id>/`, each with `store/run.sqlite`, its log, and `work/`, where its tools work). Nothing is copied in or out of
217
- a run's folder: where it works, it works in that folder.
218
-
219
- A run's own process writes its `run.sqlite` in WAL, under an exclusive lock, with no automatic checkpoint, and ends
220
- with its WAL in place. The server reads it with a fresh read-only open per read, never shows a read older than one
221
- before, and never opens it for writing while the run's process holds it. Once that process is gone the server takes
222
- 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.
223
219
 
224
220
  A data directory an earlier version wrote, with its runs under `DIR/runs/` (or a store of store version 1), is refused
225
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
@@ -244,9 +240,11 @@ through `POST /v2/agents`. Their earlier runs stay readable where you moved them
244
240
 
245
241
  ## Capacity and health
246
242
 
247
- Each run is a process of its own, and how much memory it takes depends on its harness. The server admits runs by
248
- memory: each run that holds a live process (working, or waiting for an answer) reserves its harness's size out of the
249
- 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).
250
248
 
251
249
  | Harness | Reserved per run | Measured per run |
252
250
  | --- | --- | --- |
@@ -258,21 +256,22 @@ container's limit when it has one (cgroup), else the machine's, less the server'
258
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
259
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
260
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
261
- it, needs a 1 GB instance for one and 2 GB for two. A start that does not fit in what is left is
262
- `429 rate_limited` with `retry-after`, its message naming the harness and the memory, and nothing starts: there is no
263
- 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
264
- on a host under 416 MB, opencode under 832 MB) is unavailable: capabilities say why in its `harnesses` entry, and
265
- its runs are `409 agent_not_runnable` with that reason. pi always has one place, however small the host.
266
-
267
- `--max-runs N` or `AGENTRUN_MAX_RUNS` caps the count as well (by default, as many as pi runs fit), and both limits
268
- apply. Capabilities report pi's count in `limits.max_concurrent_runs`, and each harness's own in its `harnesses` entry
269
- (`max_concurrent_runs`, beside `run_memory_mib`). A message to a run already going is never refused for a place, nor is
270
- the relaunch of one whose process went, and a run's process the next server adopts after a restart holds its harness's
271
- memory there. A run whose harness can never fit (the server restarted on a smaller host) is not started again: it fails
272
- with why if it was working, and a message to it is `409 agent_not_runnable`.
273
-
274
- A data directory serves one AgentRun Server at a time: two servers on a shared disk are not supported (each
275
- 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`).
276
275
 
277
276
  `GET /v2/health`, with no credential like capabilities, answers `200 {status: "ok", checks: {store: "ok", disk: "ok"}}`
278
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`),
@@ -281,12 +280,12 @@ and `503` with `status: "failing"` and which check failed (`store: "does_not_ope
281
280
  It names no path, size or version. One route serves as both liveness and readiness: any answer says the server is up,
282
281
  and a 200 says it can work, and the platforms here take one path.
283
282
 
284
- A run whose end the agent store cannot take (a full disk) still ends: a cancel makes it `cancelled`, with its cost from
285
- its rows, and the server writes the end to the store again every 30 s until it lands; a restart before then reads the
286
- 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
287
- names its process (its pid, that process's start and this boot), and a process that is gone holds nothing. One server
288
- serves a data root, and the agent disk under it (`<data>/disk`): a second server on the same root is refused at start
289
- (`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`.
290
289
 
291
290
  ## Sandbox
292
291
 
@@ -339,9 +338,11 @@ and `GET /v2/runs/{id}` shows it as `place`. A harness's own tools in the box, w
339
338
  `sandbox` (such as `native_tools: true`), never a third mode.
340
339
 
341
340
  `bash` may be named only by an agentic definition whose place is a sandbox (`422` on a runner, named or by default, with
342
- the sandbox place as its `fix`), and a workflow's place is `runner` or none (`422` on a sandbox, with the runner place as
343
- its `fix`). In `capabilities.tools`, `bash` is `available: false` with a `reason` (`no box is set up on this server: …`,
344
- 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.
345
346
 
346
347
  `GET /v2/capabilities` lists `places`: the modes, the default, a new agent's place, and each box with `available`, its `state` (`ready`,
347
348
  `preparing` while the server builds or pulls its image, or `unavailable`) and, when it is not ready, the `reason`.
@@ -454,9 +455,9 @@ go through `work/` by path.
454
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
455
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).
456
457
  It may use 2 CPUs' time, 4 GiB of memory, swap included, and 1,024 processes and threads (`--cpu-period 100000
457
- --cpu-quota 200000 --memory 4g --memory-swap 4g --pids-limit 1024`), so a runaway build or a fork bomb stops in the
458
- box. `AGENTRUN_BOX_CPUS` (at least `0.01`), `AGENTRUN_BOX_MEMORY` (with its unit, such as `8g`, and at least `6m`) and
459
- `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
460
461
  time, as a CFS quota (the cap `--cpus` sets), so it holds whatever CPU count Docker's VM has, and where the kernel
461
462
  gives Docker no CPU controller (a rootless Docker without one delegated), Docker ignores it with a warning.
462
463
  - `bash` takes pi's `{command, timeout?}`, `timeout` in seconds, 300 when the call names none; a timeout kills the
@@ -626,10 +627,8 @@ is Modal's default sandbox runtime (gVisor), not a virtual machine: the server d
626
627
  show the box's `network` as `none`, with `network_reason`, unless the setting is `none`.
627
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
628
629
  with the run's `work/`. The call that met the gone box fails, saying so.
629
- - Each Modal sandbox reserves 2 CPUs and 4 GiB of memory by default, which the provider bills for while the box lives:
630
- the Docker box's defaults, asked of the provider as the sandbox's CPU and memory. `AGENTRUN_BOX_CPUS` and
631
- `AGENTRUN_BOX_MEMORY` change both boxes alike (such as `AGENTRUN_BOX_CPUS=1 AGENTRUN_BOX_MEMORY=1g`). The provider has
632
- 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.
633
632
  - A start copies back, then ends, the sandbox of every run that has ended or is archived.
634
633
 
635
634
  ### The box's image
@@ -721,7 +720,12 @@ Settings → Computers. The kind says what the agent is given, and the provider
721
720
  | `browser` | A hosted browser (the browser tools) | `browserbase`, `kernel` |
722
721
 
723
722
  A kind with no provider, a provider that does not serve the kind, or a provider whose required keys are not saved is
724
- 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,
725
729
  whether this server offers it now, the tools it brings, and each provider with its key names and whether each is saved
726
730
  (never a value). `PUT /v2/computers/{provider}/keys` saves a provider's keys, sealed under the server's seal key, from
727
731
  the owner's signed-in session only (the API token is 403), and `POST /v2/computers/{provider}/test` makes one read at
@@ -732,14 +736,43 @@ the provider with them and starts nothing. A key set in the server's environment
732
736
  computer time. The older [`place`](#place) is this setting's v2 view: `{"mode": "runner"}` is kind `none`, and
733
737
  `{"mode": "sandbox", "box": X}` is a sandbox on provider X. Writing either sets both.
734
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 one `H100`, the GPU of its GPU snapshot `daytona-gpu` (the computer package's `DAYTONA_GPU`:
756
+ `types: ["H100"]`, `max: 1`); another type or count needs a snapshot of its own, so it is refused. A GPU sandbox is
757
+ made from that snapshot, with its 16 vCPUs, 100 GiB of memory and 400 GiB of disk, in region `earth`. Stopping it
758
+ deletes it: it has no pause and no snapshot, so nothing on it outlives the run. A Daytona GPU may be preempted, so a
759
+ run on one can be cut short. The Daytona org needs GPU credits. It takes no mount (`mounts: []`: the snapshot's user
760
+ is not root and has no Archil client), so it can't hold the run's folder from Archil: in Mode 2 this server refuses a
761
+ Daytona sandbox with a `gpu`, and `GET /v2/computers` says why in Daytona's `gpu.why`. In Mode 1 a sandbox runs on
762
+ Docker only, so a Daytona GPU sandbox runs on neither mode's server today.
763
+ - **Modal** declares its GPUs, but a Modal GPU sandbox runs on gVisor, and the Archil mount the run's folder needs is not
764
+ proven there. So this server refuses a Modal sandbox with a `gpu` for now. A Modal GPU is also preemptible.
765
+
735
766
  **Where the run's folder lives.** A server keeps its runs' folders in one of two modes:
736
767
 
737
768
  - **Mode 1** (the default): on this server's own disk. Only a provider that binds a folder of this machine can hold
738
769
  it, so a sandbox runs on Docker only; a Daytona, Modal or E2B sandbox is refused ("Mode 1 runs a sandbox only on
739
770
  Docker").
740
771
  - **Mode 2**: on your own Archil disk. `PUT /v2/workspace/archil` turns it on with the disk's id, its region, its S3 URL
741
- (and an exec image pinned by digest, if you want one other than Archil's default), and the account key,
742
- `ARCHIL_API_KEY`; `DELETE` turns it off. A Daytona, Modal or E2B sandbox mounts the run's folder from the disk with a
772
+ (and an exec image pinned by digest, if you want one other than serve's default), and the account key,
773
+ `ARCHIL_API_KEY`; `DELETE` turns it off. The default exec image is Docker's `buildpack-deps:trixie-scm` pinned by
774
+ digest (git 2.47), because Archil's own has git 2.34 and a read-only bash policy runs git only at 2.43 or later. An
775
+ image you name needs git 2.43 for that too, and GNU coreutils and perl, as Debian-family images have. A Daytona, Modal or E2B sandbox mounts the run's folder from the disk with a
743
776
  mount credential minted for that run alone; Docker's sandbox is refused, since it cannot mount the disk.
744
777
 
745
778
  A desktop, a phone and a browser run in either mode. The run's folder is at `/workspace` in every computer that mounts
@@ -774,8 +807,10 @@ no computer.
774
807
  registries and GitHub) through its egress proxy, and nothing else; `AGENTRUN_BOX_ALLOW=none` gives it no network. From a
775
808
  server in a container the proxy also refuses the Docker host's own addresses, which the server reads through the socket
776
809
  ([in the published image](#in-the-published-image)). A
777
- Daytona, Modal or E2B sandbox has no network of its own (loopback only). A phone and a browser are on their vendor's
778
- own network, whatever the list says.
810
+ Daytona, Modal or E2B sandbox has no network of its own (loopback only). A phone and a hosted browser are on their
811
+ vendor's own network, whatever the list says. Local Chrome is open unless this server sets `AGENTRUN_BOX_ALLOW`; then
812
+ only those hosts (the default list, a sandbox's package registries, is no browsing policy). Under
813
+ `AGENTRUN_BOX_ALLOW=none`, each of these is refused at the run's start, in words that name the setting.
779
814
 
780
815
  **Docker.** A Docker computer runs where this server's Docker answers. With `AGENTRUN_BOXES` not set at all (a plain
781
816
  `npx @parcha/agentrun`), the server probes `docker` at its start (within 5 s) and offers it when Docker answers
@@ -847,7 +882,7 @@ A definition is checked for what keeps it from running here when it is saved, wi
847
882
  it starts:
848
883
 
849
884
  - What no setting of this host fixes refuses the save, `422 input_invalid` by field, and nothing is written: a tool
850
- this host does not bind (`definition.tools[i]`), `bash` on an agent whose place is not a sandbox, a model pi-ai does
885
+ 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
851
886
  not know when no gateway is set (`definition.model`, saying why), empty instructions (`definition.instructions`), and a workflow that needs a tool
852
887
  call this host does not run, code, or a node tool other than `read`, `write` and `edit` (`definition.workflow`, one
853
888
  field per need).
@@ -860,11 +895,13 @@ it starts:
860
895
  A run is refused before it starts, `409 agent_not_runnable`, saying which, for any of these: a warning the host has not
861
896
  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
862
897
  workflow of fast nodes runs with `AGENT_MODEL_FAST` and no `AGENT_MODEL`. A run thinks at its `effort` (`low`, `medium`,
863
- `high`), else at its agentic revision's `thinking` (`low` to `max`), else at the host's `AGENT_THINKING`, else at medium;
864
- it is never off, and a model node that names its own thinking level keeps it. An agentic run started with an `effort` also
865
- gets a short note on how to work, right after its instructions, on every harness (`src/effort-guidance.ts`): `low`
866
- answers directly, `medium` plans briefly and checks once, `high` plans each part, fills the gaps and reviews. A run
867
- started with none gets no note.
898
+ `high`), else at its agentic revision's `thinking` (`low` to `max`), else at the host's `AGENT_THINKING` (one of those
899
+ levels exactly), else at its harness's own default; it is never off, and a model node that names its own thinking level
900
+ 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
901
+ above the harness's highest runs at that highest (Codex and OpenCode stop at `xhigh`). An agentic run whose level is
902
+ `low`, `medium` or `high` also gets a short note on how to work, right after its instructions, on every harness
903
+ (`src/effort-guidance.ts`): `low` answers directly, `medium` plans briefly and checks once, `high` plans each part, fills
904
+ the gaps and reviews. A run with no level, or one above `high`, gets no note.
868
905
 
869
906
  ## Tools
870
907
 
@@ -881,7 +918,7 @@ agent_not_runnable`, with `details.unbound` and `details.missing`).
881
918
  | `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 |
882
919
  | `write` | Write a file in the run's `work/` | nothing | yes, no |
883
920
  | `edit` | Edit a file in the run's `work/` | nothing | yes, no |
884
- | `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 |
921
+ | `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 |
885
922
  | `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 |
886
923
  | `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 |
887
924
  | `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 |
@@ -1178,9 +1215,8 @@ picks which one a run gets, never the model.
1178
1215
  (`agentrun-` and 24 hex digits: Kernel's names are its account's, so a name derived from the agent would be any
1179
1216
  server's that shares the key). This
1180
1217
  server keeps only a pointer per agent and vendor, sealed under the seal key (`AGENTRUN_SEAL_KEY`) and bound to its
1181
- agent, in `<data>/homes/<key>/sign-ins/sign-ins.json`. With no seal key nothing is kept and runs start signed out;
1182
- capabilities say `sign_ins: true` only with a seal key and a browser vendor here. A local Chrome keeps none: its
1183
- cookies would sit on this server's disk.
1218
+ agent and vendor, in its store. Capabilities say `sign_ins: true` with a browser vendor here. A local Chrome keeps
1219
+ none: its cookies would sit on this server's disk.
1184
1220
  - **How a run gets it.** Before a run with the `browser` tool is launched, the server makes the agent's context at
1185
1221
  Browserbase (`POST /v1/contexts`, which opens no session; Browserbase bills sessions, not contexts) or its profile at
1186
1222
  Kernel (`POST /profiles`, which starts no browser) if it has none,
@@ -1319,8 +1355,8 @@ another server's by then. Under `--faux` a key is checked only against the fake
1319
1355
  with is checked under `--faux` only against a check's own fake (`fauxBrowserbase`, `fauxMonidCheck`, `fauxKernel`), so the fakes the runs use see the
1320
1356
  runs' calls alone; with none, its `check` stays null.
1321
1357
 
1322
- A saved key is kept only as ciphertext: AES-256-GCM in `DIR/tool-keys.json` (0600), each value bound to its field's
1323
- name, under the seal key `AGENTRUN_SEAL_KEY`, which only the server opens it with. A run's process never gets the seal
1358
+ 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
1359
+ the seal key `AGENTRUN_SEAL_KEY`, which only the server opens it with. A run's process never gets the seal
1324
1360
  key. With `AGENTRUN_SEAL_KEY` not set, the server keeps it in `seal/seal.key` in its data directory, beside the store,
1325
1361
  making it at the first start: 32 random bytes in base64, 0600 in a 0700 directory, and one another user can read is
1326
1362
  refused, not changed. It lives and dies with the data (a disk, a volume): back it up with the data directory, and keep
@@ -1385,22 +1421,20 @@ naming the limit and how many tools were read.
1385
1421
 
1386
1422
  `PUT /v2/settings/mcp-servers/{name}` previews the same way, then keeps the server: its URL, the tools it listed (the
1387
1423
  snapshot an agent will be shown) and its credential. A name is lowercase letters, digits and dashes, starting with a
1388
- letter, at most 32, with no underscores, so `mcp__<server>__<tool>` splits one way. Each credential header's value is
1389
- sealed like a [tool key](#tool-keys): AES-256-GCM under `AGENTRUN_SEAL_KEY`, bound to the server's name and the header,
1390
- in `DIR/mcp-servers.json` (0600, written whole, synced and renamed), which holds no value in the clear. With no seal key,
1391
- a server that takes a credential is `409 no_sealing_key`, before anything is contacted; one with `auth.type` none is
1392
- kept. A `PUT` that sends no `token` (or no `headers`) keeps the sealed credential, as long as the auth type and the URL's
1393
- origin stay the same: a saved credential never goes to another origin unless you send it again.
1394
-
1395
- `GET /v2/settings/mcp-servers` and `GET .../{name}` show each server with `credential`: `sealed`, `seal_key_missing`
1396
- (no seal key now) or `unreadable` (sealed under another key, or damaged: a `PUT` with the credential seals it again),
1397
- null for `auth.type` none. No read, log line or error shows a credential; a server's error text is cut of the values
1398
- sent before it is shown. `POST .../{name}/refresh` lists the tools again with the saved URL and credential, keeps them,
1399
- and answers `{added, removed, changed, server}`: `changed` names a tool whose title, description, schemas or
1400
- annotations differ. `DELETE .../{name}` forgets the server and its credential. A saved-servers file that does not read (damaged, or
1401
- another format) is never written over: the list answers `servers: []` with `file_unreadable: true`, and every other
1402
- route is `409 store_unreadable` until the file is restored or removed. Capabilities' `features.mcp_client`
1403
- says `transports: ["streamable-http"]`, the `auth` types and `at_rest` (`sealed`, or `unavailable` with no seal key).
1424
+ letter, at most 32, with no underscores, so `mcp__<server>__<tool>` splits one way. The credential is sealed like a
1425
+ [tool key](#tool-keys): AES-256-GCM under `AGENTRUN_SEAL_KEY`, bound to the server's name and its URL's origin, in the
1426
+ data directory's store, which holds no value in the clear. The server does not start without its seal key. A `PUT` that
1427
+ sends no `token` (or no `headers`) keeps the sealed credential, as long as the auth type and the URL's origin stay the
1428
+ same: a saved credential never goes to another origin unless you send it again.
1429
+
1430
+ `GET /v2/settings/mcp-servers` and `GET .../{name}` show each server with `credential`: `sealed`, `unreadable` (sealed
1431
+ under another key, or damaged: a `PUT` with the credential seals it again) or `expired` (an OAuth sign-in whose refresh
1432
+ its authorization server refused: sign in again), null for `auth.type` none. No read, log line or error shows a
1433
+ credential; a server's error text is cut of the values sent before it is shown. `POST .../{name}/refresh` lists the
1434
+ tools again with the saved URL and credential, keeps them, and answers `{added, removed, changed, server}`: `changed`
1435
+ names a tool whose title, description, schemas or annotations differ. `DELETE .../{name}` forgets the server and its
1436
+ credential. Capabilities' `features.mcp_client` says `transports: ["streamable-http"]`, the `auth` types and `at_rest:
1437
+ "sealed"`.
1404
1438
 
1405
1439
  ### Signing in with OAuth
1406
1440
 
@@ -1500,8 +1534,13 @@ asked by default.
1500
1534
  - **A call** goes to the pinned URL alone, the 2026-07-28 revision first and a 2025-era server through its
1501
1535
  `initialize`; on 2026-07-28 each `x-mcp-header` parameter of the pinned tool is sent as its `Mcp-Param-*` header. No
1502
1536
  redirect is followed, at most 4 MiB is read, and it may take 120 s. The
1503
- model reads the text blocks joined; past 60,000 characters, or with blocks that are not text, the whole answer is
1504
- filed under the run's `evidence/mcp/<server>/` and the text says where. A tool's own error (`isError`) reaches the
1537
+ model reads the text blocks and embedded text resources joined (GitHub's `get_file_contents` answers a file as one);
1538
+ past 60,000 characters it reads the answer's first lines, whole, and the rest is filed under the run's
1539
+ `evidence/mcp/<server>/` as lines (JSON laid out a value a line, its indent capped at 32 levels, and filed as
1540
+ written when the layout would pass twice its size and 64 KiB; a line past 10,000 characters broken), the text
1541
+ naming the file and the `read` offset that goes on, so a run with `read` and no shell pages through it. With blocks
1542
+ that are neither (an image, a blob), the whole answer is filed there as JSON and the text says where. On pi, every
1543
+ 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
1505
1544
  model as its error. A refused credential (401, 403) reads "the MCP server <name> refused its credential (its sign-in
1506
1545
  expired or was revoked, or its key changed): sign in again in Settings → MCP servers, or update its credential
1507
1546
  there"; another failure names the server and the HTTP status, never a header. A stop, or a
@@ -1552,19 +1591,19 @@ or `https` address, with no user or password in it. Loopback and private-network
1552
1591
  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
1553
1592
  need its person (`input_required`: a question, a call held for approval, a pause at its cap, an ask for its person in
1554
1593
  its browser, desktop or phone, or a stopped turn) and `run.ended` when it ends
1555
- (completed, failed or cancelled, once carried back). A [schedule](#schedules) whose firing fails sends a third,
1594
+ (completed, failed or cancelled, once the run's end is written). A [schedule](#schedules) whose firing fails sends a third,
1556
1595
  `trigger.failed`; a server with no triggers never sends one.
1557
1596
 
1558
1597
  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
1559
1598
  store, so the row's `ended_at` and the message's `webhook-id` name one time. `run.ended` is queued only once the agent
1560
1599
  store has the end, so a receiver that reads the run back on its message (`GET /v2/runs/{id}`) reads it ended; while the
1561
1600
  store refuses the end (a full disk, a busy store), nothing is sent, until a later try of the write or the next server
1562
- stores it. The outbox (`DIR/webhook-outbox.json`) keeps, in the same write as each message, which end and which wait of
1601
+ stores it. The outbox, in the store with the runs, keeps, in the same write as each message, which end and which wait of
1563
1602
  each run it queued. A server that starts queues any end of the last day that the agent store holds and the outbox does
1564
1603
  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
1565
1604
  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
1566
1605
  `webhook-id`. An end before the webhook was set is never sent. A run is continued only once its end's
1567
- `run.ended` is in the outbox on disk (`503` meanwhile), so a continued run's next end is its own, under its own id.
1606
+ `run.ended` is in the outbox (`503` meanwhile), so a continued run's next end is its own, under its own id.
1568
1607
 
1569
1608
  ```json
1570
1609
  { "type": "run.needs_input", "timestamp": "2026-11-01T12:00:00.000Z",
@@ -1587,15 +1626,15 @@ with any of its libraries: `webhook-id` (the same on every try of a message, so
1587
1626
  the secret's bytes. A receiver checks the signature against the raw body and refuses a timestamp more than 5 minutes
1588
1627
  from its clock, so a replay does not pass. The first `PUT` makes the secret, `whsec_` and 32 random bytes in base64,
1589
1628
  and answers `201` with it, once; `GET /v2/settings/webhook` never shows it. It is kept like a [tool key](#tool-keys):
1590
- sealed under `AGENTRUN_SEAL_KEY` in `DIR/webhook.json` (0600), so with no seal key no webhook is set
1591
- (`409 no_sealing_key`). A new secret is a `DELETE` and a `PUT`.
1629
+ sealed under `AGENTRUN_SEAL_KEY`, in the store (SQLite or Postgres) with the webhook itself. A new secret is a `DELETE` and a
1630
+ `PUT`; a secret that no longer opens under the server's key (sealed under another) is replaced, and shown once, by the next `PUT`.
1592
1631
 
1593
1632
  A try that is not answered 2xx within 15 s fails; a redirect is not followed. A failed message is tried again on the
1594
1633
  spec's schedule, with jitter: after about 5 s, 5 min, 30 min, 2 h, 5 h and 10 h, then logged as failed
1595
1634
  (`event=webhook condition=delivery_failed`). Each message goes on its own tries, so two queued close together can
1596
1635
  arrive in either order: a receiver orders them by `webhook-timestamp`, or reads the run (`GET /v2/runs/{id}`). A
1597
- `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
1598
- them after a restart; a message can then come twice, under the same `webhook-id`. An outbox file of another version
1636
+ `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
1637
+ them after a restart; a message can then come twice, under the same `webhook-id`. An outbox of another version
1599
1638
  is not read: the server starts with none, and the log says so (`condition=outbox_not_read`). `GET /v2/settings/webhook/deliveries`
1600
1639
  lists the last 50 attempts (`webhook_id`, type, status code, latency, error, when, and the next try's time), and
1601
1640
  `POST /v2/settings/webhook/deliveries/{webhook_id}/redeliver` sends one of those messages again, once, under the same
@@ -1631,7 +1670,7 @@ a restart drives again finds its run. A firing's key stays bound to that run: wh
1631
1670
  run up, the firing reads `failed` ("The server stopped while setting up the run.") with that run's id, it never fires
1632
1671
  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
1633
1672
  is `skipped`, with why (a webhook trigger with `accept` or `max_active_runs` is the exception: [each event it
1634
- 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
1673
+ 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
1635
1674
  one `missed` firing with their count, and the schedule goes on from now; the latest of them still fires, once, when it is
1636
1675
  no older than the trigger's `catchup_window_s` (default an hour; 0, never), marked `catch_up`. A
1637
1676
  firing while the last run is active (working, or parked waiting on a person) is skipped with why, never queued,
@@ -1663,8 +1702,7 @@ anything else. A bad signature, a stale timestamp, an unknown trigger, one that
1663
1702
  answer the same `401`, so no trigger id can be found by asking; a body past 256 KiB is `413`.
1664
1703
 
1665
1704
  The secret, `whsec_` and 32 random bytes in base64, is made with the trigger and shown in the `201` once; no `GET`
1666
- shows it. It is kept sealed under `AGENTRUN_SEAL_KEY` in `DIR/trigger-settings-webhook.json` (each trigger source's
1667
- sealed settings have a file of their own), so with no seal key no webhook trigger is made (`409 no_sealing_key`).
1705
+ shows it. It is kept sealed under `AGENTRUN_SEAL_KEY` in the server's store, with each trigger source's other sealed settings.
1668
1706
  `POST /v2/triggers/{id}/secret` makes a new one, shown once, and the old one signs nothing from then on. Like every
1669
1707
  secret this server keeps (its tokens, its outbound webhook's secret), it is cut from what a run shows, from what an
1670
1708
  import keeps and from every learning text. A secret replaced by a rotation, or whose trigger is deleted, is kept too,
@@ -1672,8 +1710,7 @@ sealed in a retired row of its own (scope `retired:<trigger>:<n>`), never a sett
1672
1710
  before is still cut on every later server. Retired rows are kept for good for now; dropping one once no run older than
1673
1711
  it is left is still to come. A secret that does not open under the seal key the server starts with is
1674
1712
  said in its log (`condition=trigger_setting_unopened`, naming the trigger), and its trigger is refused until a new
1675
- secret is made. A `trigger-settings-webhook.json` that does not read is never written over: until it is fixed or moved
1676
- away, no webhook trigger is made or rotated (`409 store_unreadable`) and none fires.
1713
+ secret is made.
1677
1714
 
1678
1715
  The request's `webhook-id`, which its signature covers, is its firing's key: the first answers `202` once the firing is
1679
1716
  recorded, and its run starts after; the same `webhook-id` again, for a day after, answers `200` with that firing and
@@ -1729,15 +1766,15 @@ conditions holding. A verified delivery no rule takes (GitHub's `ping` among the
1729
1766
  `accept`, every verified request fires, as before. A trigger holds at most 20 rules, each at most 20 conditions and 20
1730
1767
  actions; an `in` lists at most 20 values of at most 1024 characters of JSON each, a pointer is at most 512 characters,
1731
1768
  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
1732
- run active or not, since the events it takes are each their own work (a review per pull request); the server's run
1733
- limit still holds: a start it refuses (`429`) keeps the firing due and tries it again, and past 20 firings due a new
1734
- delivery answers `429`. This holds for every firing of such a trigger, a run now (`POST /v2/triggers/{id}/fire`)
1735
- included. Runs start in the order their events came while the server has room; while one firing waits to be tried
1736
- again after a `429`, a later one can start first.
1737
-
1738
- Such a trigger can take every run this server has room for, starving other triggers and the runs people start. Give it
1739
- `max_active_runs` (1 to 100; `null` clears it): past that many of its runs active, a firing waits due and is tried
1740
- again, as at a full server, and is never skipped. It counts the runs this trigger started while they work, kept apart
1769
+ run active or not, since the events it takes are each their own work (a review per pull request); the run limit still
1770
+ 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
1771
+ again, and past 20 firings due a new delivery answers `429`. This holds for every firing of such a trigger, a run now
1772
+ (`POST /v2/triggers/{id}/fire`) included. Runs start in the order their events came; while one firing waits to be
1773
+ tried again, a later one can start first.
1774
+
1775
+ Such a trigger can fill the runner's places and the queue behind them, starving other triggers and the runs people
1776
+ start. Give it `max_active_runs` (1 to 100; `null` clears it): past that many of its runs active, a firing waits due and
1777
+ is tried again, and is never skipped. It counts the runs this trigger started while they work, kept apart
1741
1778
  from its history (so a long run counts however many firings follow it) and read again at each check; a run a person
1742
1779
  opens again after it ended is that person's follow-up, not counted. Any `start_run` trigger of a pushed source (a
1743
1780
  webhook) takes it, with or without `accept`: set, each event starts its own run, never skipped behind the last, up to the
@@ -1774,7 +1811,7 @@ GitHub template) uses it. In the console, Connect GitHub calls `POST /v2/integra
1774
1811
  the App under an organization) and posts the form it answers to GitHub: `action`, GitHub's new-App page, and
1775
1812
  `manifest`, which names a name GitHub lets the person edit, the server's public URL, its hook `/v2/hooks/github`, its
1776
1813
  callback and setup URLs, the permissions (pull requests write; contents, metadata and issues read) and the events
1777
- (`pull_request`, `issue_comment`). It needs the address GitHub can reach, `AGENTRUN_PUBLIC_URL` (`409 github_no_public_url`,
1814
+ (`pull_request`, `issue_comment`, `release`). It needs the address GitHub can reach, `AGENTRUN_PUBLIC_URL` (`409 github_no_public_url`,
1778
1815
  "GitHub can't reach this server: set its public URL first"), a seal key (`409 github_no_seal_key`, naming
1779
1816
  `AGENTRUN_SEAL_KEY`), and no App connected already (`409 github_already_connected`, "This server already has a GitHub
1780
1817
  App. Disconnect it first."), and a request at the public URL itself, where GitHub sends the browser back
@@ -1881,7 +1918,7 @@ failed, 2 when nothing ran. The runner, the graders and the report are in
1881
1918
  | `GET /health` | Without a credential: whether the store reads and the disk has room ([capacity and health](#capacity-and-health)). |
1882
1919
  | `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. |
1883
1920
  | `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. |
1884
- | `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)). |
1921
+ | `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)), `max_tool_calls` (agentic only, on pi): the tool calls each conversation of a run may make ([tool-call budget](#tool-call-budget)), 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)). |
1885
1922
  | `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. |
1886
1923
  | `GET /agents/{id}/revisions` | The agent's revisions, newest first: `revision`, `version`, `parent`, `kind`, `current`, `note`, `created_at` and the `definition`. |
1887
1924
  | `POST /agents/{id}/current` | `{revision}`: one of the agent's revisions becomes current again. |
@@ -1891,7 +1928,7 @@ failed, 2 when nothing ran. The runner, the graders and the report are in
1891
1928
  | `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`. |
1892
1929
  | `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). |
1893
1930
  | `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. |
1894
- | `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`). |
1931
+ | `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`). |
1895
1932
  | `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. |
1896
1933
  | `POST /runs/{id}/archive`, `POST /runs/{id}/unarchive` | [Archiving](#archiving) one run. Answers the run, with `archived_at`. |
1897
1934
  | `GET /runs/{id}/files`, `GET /runs/{id}/files/{path}` | The files under the run's `work/`, raw. |
@@ -1913,8 +1950,9 @@ failed, 2 when nothing ran. The runner, the graders and the report are in
1913
1950
  | `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`. |
1914
1951
  | `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. |
1915
1952
 
1916
- Home export and import, quotes and `POST /runs/{id}/kill` answer `501 unsupported_here` naming the feature, and
1917
- 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
1953
+ Quotes answer `501 unsupported_here` naming the feature. Home export and import (`GET` and `PUT /agents/{id}/home`) and
1954
+ `POST /runs/{id}/kill` are not served here: they answer `404`, and the served document leaves them out (its
1955
+ `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
1918
1956
  above $0 is taken; it does not mean caps are unsupported ([spend cap](#spend-cap)).
1919
1957
 
1920
1958
  ### API only
@@ -1928,7 +1966,7 @@ serves these routes alone:
1928
1966
  - `GET /capabilities`, `GET /health` and `GET /usage`.
1929
1967
 
1930
1968
  Every other address is `404 not_found`, answered before the request is read further: the console at `/` and its
1931
- assets, the store page's `/api/*`, sign-in and setup, every `/settings` route, `POST /mcp`, triggers and their
1969
+ assets, sign-in and setup, every `/settings` route, `POST /mcp`, triggers and their
1932
1970
  `POST /hooks/{id}`, agents, templates, `/openapi.json`, `/llms.txt` and the live views. It has no accounts: there is no
1933
1971
  page to sign in to, so no setup code is printed. The token works as it does on every route served. Unset, `0` or
1934
1972
  `false` serve the whole server, as before; any value other than these and `1` or `true` stops the start, in words.
@@ -2007,7 +2045,7 @@ device and inode), so a disk that takes another spelling for one name is refused
2007
2045
  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
2008
2046
  its definition is. A write is held to its directory through `/proc/self/fd`; where there is none (macOS),
2009
2047
  `capabilities.home.writes` is `false` and `PUT` and `DELETE` are `501 unsupported_here`, as Node has no `openat` to
2010
- write safely by path, while the list and reads still work. `GET` and `PUT /agents/{id}/home`, the contract's packed home, stay `501`.
2048
+ 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`).
2011
2049
 
2012
2050
  ## For coding agents
2013
2051
 
@@ -2069,9 +2107,7 @@ into place and made read-only. `node scripts/harness-locks.mjs` makes the locks
2069
2107
  checks them). Every run that needs one waits for that one install, its ready time counted from the install's end, and
2070
2108
  shows a `phase` row, `Installing Claude Code (first use)…` or `Installing Codex (first use)…`, while it does. Each run
2071
2109
  then loads the harness from its own packages inside its install and nowhere else, never from a `node_modules` above it;
2072
- a tree that is not whole is installed again. Claude Code as an earlier build installed it, at the top of `<data>/harnesses`
2073
- itself, is removed before the first install (the server logs `harness_install_removed`), and it installs again; a
2074
- `harnesses` directory that holds anything else is left as it is. Until it is installed, capabilities list the harness with `installs:
2110
+ a tree that is not whole is installed again. Until it is installed, capabilities list the harness with `installs:
2075
2111
  "on_first_use"`. When npm fails, the run fails and its error names the command that installs it by hand, the same locked
2076
2112
  install: the shipped `package.json` and `package-lock.json` copied into a fresh `<data>/harnesses/<harness>.new`, `npm ci
2077
2113
  --ignore-scripts --include=optional` there, then that directory put in place of `<data>/harnesses/<harness>` (made
@@ -2192,10 +2228,7 @@ An agent or a run is archived, never deleted: `DELETE` stays `405`. These routes
2192
2228
  spend happened.
2193
2229
  - A new run of an archived agent is `409 agent_not_runnable`, saying it is archived (`details.archived_at`); a run
2194
2230
  already going when its agent is archived keeps going.
2195
- - The store keeps each change as one row of `archive_changes` in `store.sqlite`, written once
2196
- ([the store](../pi-durable-agent/README.md#agents-in-a-folder-the-agent-store)). A data directory an earlier version
2197
- wrote opens as it is, with nothing archived. Going back to an earlier version keeps every row, but that version does
2198
- not read them: archived agents and runs show as not archived there, and an archived agent's runs start again.
2231
+ - The store keeps an archive as `archived_at` on the agent's or the run's row, null when it is not archived.
2199
2232
 
2200
2233
  ## The console
2201
2234
 
@@ -2218,15 +2251,13 @@ server's own origin, under a CSP that allows that origin only, but for the provi
2218
2251
  agent's Tools step lists each saved server's tools; a box ticked grants `mcp:<server>/<tool>`.
2219
2252
 
2220
2253
  Its files (`index.html`, and Vite's hashed files under `/assets/`) are public and hold no data: everything it shows
2221
- comes through `/v2`. The store's read-only JSON stays under `/api/*` (`/api/store`, `/api/agents/{id}`, `/api/runs` and
2222
- the rest of [`@parcha/pi-durable-agent`](../pi-durable-agent/README.md#looking-at-a-store)'s store page's data), for a
2223
- script with the token or a browser with its cookie. With accounts on (the default) the console asks for the owner's password
2254
+ comes through `/v2`. With accounts on (the default) the console asks for the owner's password
2224
2255
  ([your password](#your-password)) and the browser holds the owner's session cookie; a `?token=` link sets no cookie: the
2225
2256
  token is for scripts and the CLI. With `AGENTRUN_ACCOUNTS=0`, the printed link (`/?token=`) sets a cookie (`HttpOnly`,
2226
2257
  `SameSite=Strict`, `Path=/`, and `Secure` when `X-Forwarded-Proto` says https) and sends the browser to the same address
2227
2258
  without the token. The cookie's value is derived from the token, never the token itself, and it lasts until the browser
2228
2259
  closes. Without it, the console says to open the link. Either cookie takes the place of `Authorization: Bearer` on
2229
- `/api/*` and `/v2`: for a `GET`, and for any other method only when the request's `Origin` is the server's own origin
2260
+ `/v2`: for a `GET`, and for any other method only when the request's `Origin` is the server's own origin
2230
2261
  and its body is `application/json`, or, on a `PUT` or `POST` to a route that takes bytes (`PUT /v2/files/{id}`,
2231
2262
  `POST /v2/files`), of any content type. A request that sends an `Authorization` header is checked on that header alone.
2232
2263
 
@@ -2298,18 +2329,22 @@ left out: 2 sessions still being written: they come in next time
2298
2329
 
2299
2330
  ## A run's life
2300
2331
 
2301
- 1. `POST /agents/{id}/runs` starts the run in the store (`startRun`, which pins the revision and seeds
2302
- `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
2303
- loopback, behind a token of its own (`DIR/.door-token`), with its stderr in `runs/<id>/process.log`. The run's input
2304
- is in `runs/<id>/serve.json`.
2305
- 2. The app reads the run's revision from the store.
2332
+ 1. `POST /agents/{id}/runs` starts the run in the store (`startRun`): one transaction writes a `queued` run, pinned to the
2333
+ agent's revision, with its launch record (the request, checked and resolved once, its model included). No process
2334
+ starts for it.
2335
+ 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
2336
+ the claim it opens the run's folder (`DIR/disk/agents/<agent>/runs/<id>/work`), reads the launch record and picks
2337
+ the run's loop: a workflow revision runs on the workflow loop, a learning run on the learning loop, and every
2338
+ other harness (pi, claude-agent, codex, opencode) on the adapter loop. Each loop writes the run's journal in the
2339
+ store, behind the claim's fence: a write under a claim the run has moved past is refused. A message, stop, cancel,
2340
+ raise or approval is a command row in the store, which the run's runner reads and applies.
2306
2341
  - An agentic revision runs as the root agent: its instructions and skills, its model, and the tools it names of the
2307
2342
  workspace's `read`, `write` and `edit`, and `ask_person`, which ends the turn; the timeline then shows a `waiting`
2308
- row, and the run is `input_required` and `waiting` until a message answers it. `bash` is bound only where the run
2309
- has a shell ([computers](#computers)): in a computer that mounts the run's folder, or on Archil's serverless exec
2310
- 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
2311
- timeline comes from its door's events through `@parcha/pi-durable-agent/timeline`. Once the run is idle and its
2312
- newest row is the agent's answer, the server sends the process SIGTERM. A model error ends it `failed`
2343
+ row, and the run is `input_required` and `waiting`, with no runner holding it, until a message answers it. `bash`
2344
+ is bound only where the run has a shell ([computers](#computers)): in a computer that mounts the run's folder, or
2345
+ 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
2346
+ `queued` until its first message shows. The timeline is read from the run's journal. When the turn ends on the
2347
+ agent's answer, the loop writes the run's end and the runner releases the claim. A model error ends it `failed`
2313
2348
  (`run_failed`). A run whose `max_cost_usd` cannot buy its next request is paused, `input_required` and `waiting`
2314
2349
  with `pending.kind` `budget`; one its cap refuses for a reason no cap fixes ends `failed` (`spend_cap_reached`,
2315
2350
  [below](#spend-cap)). A
@@ -2324,28 +2359,23 @@ left out: 2 sessions still being written: they come in next time
2324
2359
  A stopped run can be continued: a follow-up starts a fresh turn on the whole history, and the turn the stop cut is
2325
2360
  not replayed. A cancelled run cannot: a message to it is `409 not_continuable`, and its `next_action` is to start a
2326
2361
  new run of the agent.
2327
- - A workflow revision runs on agentrun-pi's durable workflow task, started by `startWorkflowRevision` of
2328
- `@parcha/pi-durable-agent/workflow` (keyed by the run's id): its model nodes (`agent`, `decide`, `extract`,
2329
- `report`) on the run's model, with the file tools each node names, and its typed questions on Jev or Parallel
2330
- ([decision workflows](#decision-workflows)). A workflow that needs code or a tool call this host does not run is
2331
- not saved here (`422`). The run is `queued` until its process serves, then `working`; when the workflow
2332
- ends, the app writes the run's final status with the outcome and releases it. Nothing is carried back from inside
2333
- the process, which holds the run's store until it exits.
2334
- 3. When the process has exited, the run's rows are read from its released store (an agentic run's conversation, a
2335
- workflow run's model nodes), and the server carries the run back, every run of both kinds: `carryBack` records its
2336
- state, cost and a summary in the store (an agentic run's answer; a workflow run's `workflowCarry`, its completed
2337
- nodes, then where it failed or escalated). Its last
2338
- page says `final`. v2's `cancelled` is the store's `stopped`; a workflow that escalated ends `completed`, its work
2339
- done and waiting for a person's review: `error` is null and `review` is `{kind, node, reason, at}`, in the run and in the
2340
- lists. In this release `kind` and `node` are always null: the store keeps only the escalation's summary (`reason`)
2341
- and the run's end (`at`). Every other run's
2342
- `review` is null. `GET /v2/stats` counts it in `needs_review`, never in `failed`.
2343
- 4. When the server starts, it reads every run the store says is running. A run process an earlier server started and
2344
- that still serves the run is supervised again, by the holder its row names (its pid, its start, its door); a run
2345
- that already ended is carried
2346
- back; a run whose process is gone before it ended is opened again on its directory and resumes from its store (an
2347
- agentic run waiting for an answer waits without one, until a message). A carry back that finds the store held by
2348
- another writer is tried again with backoff, and at the next start.
2362
+ - A workflow revision runs on the workflow loop, which drives the DSL's durable workflow task on the run's journal
2363
+ (keyed by the run's id): its model nodes (`agent`, `decide`, `extract`, `report`) on the run's model, with the file
2364
+ tools each node names, and its typed questions on Jev or Parallel ([decision workflows](#decision-workflows)). A
2365
+ workflow that needs code or a tool call this host does not run is not saved here (`422`). The run is `queued`
2366
+ until a runner claims it, then `working`. When the workflow ends, the loop writes the run's end from its outcome:
2367
+ a complete run ends `ended`, an escalated one `ended` with the outcome `escalated`, a refused or failed one
2368
+ `failed`, a cancelled one `stopped`.
2369
+ 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
2370
+ completed nodes, then where it failed or escalated) are written with the journal's end entry, so there is nothing to
2371
+ carry back afterwards. Its last page says `final`. v2's `cancelled` is the store's `stopped`; a workflow that
2372
+ escalated ends `completed`, its work done and waiting for a person's review: `error` is null and `review` is
2373
+ `{kind, node, reason, at}`, in the run and in the lists. In this release `kind` and `node` are always null: the
2374
+ store keeps only the escalation's summary (`reason`) and the run's end (`at`). Every other run's `review` is null.
2375
+ `GET /v2/stats` counts it in `needs_review`, never in `failed`.
2376
+ 4. A server that starts again adopts nothing: runs are claimed, not supervised. A run whose runner stopped or lost its
2377
+ claim writes nothing more; once the claim lapses another runner claims the run and resumes it from its journal,
2378
+ and a model request the stop cut is sent again. A run waiting for an answer has no claim and waits until a message.
2349
2379
 
2350
2380
  An `Idempotency-Key` answer is kept in `DATA/.idempotency.json` for `limits.idempotency_ttl_s` (a day), saved once the
2351
2381
  work is done and before the answer is sent, so a retry after a restart gets the first answer; a server that goes down
@@ -2387,9 +2417,13 @@ Each run of an agent that learns starts from `main` as it is when the run is mad
2387
2417
  not counted toward the budget. Each active note is there whole (its
2388
2418
  `## name (file.md)`, its description, then its text), the one changed last on `main` first (a merge or a person's
2389
2419
  edit; then by name), while they all fit the server's learning budget (`--learning-budget`, 8000 bytes by default).
2390
- Past it, the run reads the first 200 lines of `MEMORY.md` (and no more than 25 KB, as Claude Code loads its own),
2391
- then the notes changed last, whole, while they fit what is left; the rest are named only in the index, and an agent
2392
- with the `read` tool is told they are in `.learning/`, to open one when it applies (one without is not). A line
2420
+ Past it, the run reads the notes that bear on it: each active note is scored against the run's first message by a
2421
+ lexical match (BM25 over its name, description and text; a code review's changed paths weigh three times its prose; no
2422
+ model call), and the run reads the best ones whole while they fit, then one line for each of the rest
2423
+ (`- <name> (<file>): <description>`, at most 200 lines and 25 KB), in place of the index. A first message that shares
2424
+ no word with any note reads the index's first 200 lines, then the notes changed last, whole, while they fit. An agent
2425
+ with the `read` tool is told the notes not given whole are in `.learning/`, to open one when it applies (one without
2426
+ is not). A line
2393
2427
  before them says to follow a note when it applies. `# Learned` opens, for every run that learns, notes or none, with
2394
2428
  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
2395
2429
  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
@@ -2406,6 +2440,10 @@ Each run of an agent that learns starts from `main` as it is when the run is mad
2406
2440
  revision's (pi and codex read each `SKILL.md` in their prompt, claude-agent loads the ones its adapter takes through
2407
2441
  its Skill tool). A skill named like one of the revision's is the revision's, and only an active skill is served: one
2408
2442
  whose `SKILL.md` front matter says `status: pending` (held for its owner's OK), or any status but `active`, is not.
2443
+ One front-matter reader decides a skill's and a workflow's status everywhere (the checks, the console, the routes and
2444
+ a run's start): front matter that does not read one way (not closed, a key indented under another, a key set twice, a
2445
+ status over more than one line) reads as retired, so no run is given it. A learned skill is served with its `name` and
2446
+ `description` quoted, so a harness reads them as text.
2409
2447
  The learned ones get 256 KiB, every file of each together, and never more than the revision's skills leave of the 1
2410
2448
  MiB an adapter takes of a run's skills in all, so they never push the revision's back into the prompt: the one
2411
2449
  changed last on `main` first, each whole while it fits. One that does not fit, or holds one of the server's secrets,
@@ -2437,6 +2475,14 @@ Each run of an agent that learns starts from `main` as it is when the run is mad
2437
2475
  offered the workflows its pin names. A call a crash cut off is answered interrupted, never run again. The tool gate holds
2438
2476
  `learned_workflow` like any tool: its settings key is `learned_workflow`, allowed by default (the agent's own graded
2439
2477
  workflow, each node checked), and tool settings may set it to ask (the run parks until an owner answers) or deny.
2478
+ When a run's learned workflows name decision providers (Jev, Parallel, OpenRouter), the runner opens those providers'
2479
+ 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:
2480
+ never for its model or a CLI harness's own environment. A provider the run's tool gate denies gets no key. Learned
2481
+ workflows can use them once decision nodes land (see Coming).
2482
+ A learned workflow's call node can run an MCP tool the agent grants (`mcp:<server>/<tool>`) through the run's own MCP,
2483
+ under the run's tool gate: allowed, it runs at the run's tool cost; denied, the workflow is refused before any node
2484
+ runs; set to ask, the `learned_workflow` call asks once, naming every such tool, and the run parks. A run's own draft
2485
+ can't call one yet: the checks admitting it are coming.
2440
2486
 
2441
2487
  The server reads the commit with git plumbing, never the working tree. What it holds that is not a regular UTF-8 file of
2442
2488
  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
@@ -2454,27 +2500,41 @@ with each note to keep as one ` ```note <file>.md ` block in the note format, an
2454
2500
  needed, and nothing the run wrote in `work/.learning/`, during the task or the turn, counts. It also says that a memory
2455
2501
  is replaced by a new note with `supersedes: [old.md]` and never by reusing a name, how many index lines are left (200
2456
2502
  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,
2457
- with no reserve, and within 5 minutes; its rows are labelled `learning`, and the run's answer stays the job's.
2458
-
2459
- As the run settles, before it reads ended and before a follow-up can open it again, the server keeps what the turn
2460
- answered, the whole text of each of its messages, and what the user said in the run, in `runs/<id>/learning-turn.json`.
2461
- Once the run has ended, in the agent's queue, the server reads the notes from that answer alone (`parseReflection`, in
2503
+ with no reserve, and within 5 minutes; its rows are labelled `learning`, and the run's answer stays the job's. While it
2504
+ runs, the run reads `reflecting` on every harness. A run whose only tool work was its learned workflows, each answering,
2505
+ with nothing said after its first message, is not asked: no request is sent, and its learning ends `dropped` (`empty`),
2506
+ "Nothing new: the run only ran a learned workflow."
2507
+
2508
+ The same turn may give one skill (only when the job completed) and one workflow draft, when the work repeats. Once a
2509
+ learned skill the run was given has been given to 3 earlier runs of its agent, with no learned workflow of that name,
2510
+ 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
2511
+ 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
2512
+ the run's own input (its block's `example:` line) or one made from its input schema, with every model and tool answer
2513
+ made up from the node's output schema, so nothing is sent, paid or run. One whose wiring breaks is left out, and the
2514
+ turn is asked once more to fix it. [`src/learn/SPEC.md`](src/learn/SPEC.md) has the rules.
2515
+
2516
+ The runner reads the notes from that answer alone (`parseReflection`, in
2462
2517
  `src/learn/reflect.ts`): an answer with no note is `empty`, and one that gives notes out of format (a note outside a
2463
2518
  block, a block with no file name, or one name given twice with other words) is `unparsed`, nothing kept. A block opens
2464
2519
  with the fence asked for (```` ```note ```` or four backticks for a note, four for a skill or a draft) and runs to the
2465
2520
  next line that is that fence; a shorter fence is text, a longer one an example, and an opening never closed is left out
2466
2521
  alone. `checkProposal`
2467
- (`src/learn/check.ts`) then refuses, before anything is written anywhere, a note that reuses an existing note's name, a
2522
+ (`src/learn/check.ts`) then leaves out, before anything is written anywhere, each item that breaks a rule, and the rest
2523
+ goes on: a note that reuses an existing note's name, a
2468
2524
  path that is not a `.md` file at the top, a bad name, front matter out of shape or setting `status`, a `supersedes`
2469
2525
  naming a note that is not active, more than 8 notes superseded, more than 8 new notes or a note over 4068 bytes (4096,
2470
2526
  less the 28 the server's own `origin` and `status` lines may take once it merges the note), an
2471
2527
  index past 200 lines, hidden characters, and text shaped like a secret or holding one of the server's own secrets (the
2472
2528
  launcher's, the keys and tokens in its environment, its API and door tokens, each webhook trigger's signing secret as it
2473
- is now), in a note or its name. A `MEMORY.md` the
2474
- answer gives is ignored. What passes is kept as the run's proposal, `runs/<id>/learning-proposal.json`, with what the
2475
- user said, each message cut of the server's secrets.
2476
-
2477
- Then one grader decides, one grade at a time per agent: `gradePrompt` (`src/learn/grade.ts`), which holds
2529
+ 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
2530
+ learning names what was left out. The whole answer is refused when it holds a secret or a hidden character (no item of
2531
+ 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
2532
+ would pass 200 lines, or when nothing is left. A `MEMORY.md` the
2533
+ answer gives is ignored. What passes is kept as the run's proposal, with what the user said, each message cut of the
2534
+ 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
2535
+ learning run of its own, which no list of runs shows.
2536
+
2537
+ Then one grader decides, in that learning run: `gradePrompt` (`src/learn/grade.ts`), which holds
2478
2538
  `GRADE_RUBRIC`, the rubric's one statement, bounded (3 minutes), against `main` as it is then, and read by
2479
2539
  `parseVerdict`, which fails closed. It runs on the model the server grades on: `--grade-model` (or
2480
2540
  `AGENTRUN_SERVE_GRADE_MODEL`), else the strong tier (`AGENT_MODEL_STRONG`), named as the strong tier takes one; with
@@ -2483,9 +2543,17 @@ cheap model is a poor grader, so point the strong tier (or `--grade-model`) at a
2483
2543
  note's index line, the whole text only of the notes the proposal supersedes, what the user said in the run (cut of the
2484
2544
  server's secrets, as the proposal keeps it), and the new notes, so its prompt stays under 200,000 characters however
2485
2545
  many notes the folder holds. No injection screen runs before it: a page classifier cannot see where a note came
2486
- from, and read a preference the user stated as a planted instruction; the grader's Planted question decides. What the
2487
- 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
2546
+ from, and read a preference the user stated as a planted instruction; the grader's Planted question decides: a rule the
2547
+ 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
2548
+ inside text the run read is planted and dropped, never held for the owner's OK. An item that holds an account number is
2549
+ dropped too, even where the user gave it as where money goes; one with a bank account, IBAN, routing or sort-code number
2550
+ beside its word never reaches the grader, since the checks refuse it as they refuse a secret. The Risky question reads one way on every grade model: a
2551
+ limit or threshold that decides whether an approval or a check happens is risky in either direction, as is an exemption
2552
+ from a check, trusting or paying a named site or seller, or naming where money or data goes, whoever asked. What the
2553
+ 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
2488
2554
  `learning`, by agent and by day; a call cut off at its bound spent what nobody knows, so its cost is unknown, never $0.
2555
+ A grade that contradicts itself (it keeps every item yet says not to merge) is asked once more, the contradiction named;
2556
+ a second contradiction drops the proposal, saying the review contradicted itself.
2489
2557
 
2490
2558
  A kept verdict merges as one commit on `main`, made with plumbing: the new notes added, each with its `origin` (`you`
2491
2559
  for what the user asked in their own words, `run` for what the run worked out), each note they supersede marked
@@ -2539,14 +2607,30 @@ looking back cost, 0 when it did not), after its `serve.json` holds it; a server
2539
2607
  its next start. A run's notes are the one part that moves after its end (a follow-up reads another note): a line
2540
2608
  `{run, agent, notes: true, given, read}` then says them anew, the latest one winning, and counts neither the run nor its
2541
2609
  costs again. `GET /stats` counts the runs that tried to learn under `learning`, over its `from`, `to` and
2542
- `agent`, from that ledger and from the runs the server holds (`in_progress`), never opening a run's files; the
2543
- `learning` meter on `GET /usage` reads the same lines.
2610
+ `agent`, from the store (each run's kept learning and its learning run's journal; `in_progress` while a proposal waits
2611
+ for its grade), never opening a run's files; the `learning` meter on `GET /usage` reads each run's grade from the same.
2544
2612
 
2545
2613
  An eval set of 20 runs and what each proposed, labelled keep or drop (`test/fixtures/learn-eval.json`: lessons the
2546
2614
  agent worked out, user preferences and a "remember" during the task, one-shop facts, secrets, a tool's failure and four
2547
2615
  injections), runs in CI through the parser, the checks and the grader's prompt on a faux grader that answers by label
2548
2616
  (`test/learn-eval.test.mjs`). `scripts/learn-eval.mjs` runs the same set on real models, the grade and the end-of-run
2549
- turn both, and prints keep-precision, keep-recall and the injection-drop rate per model; it spends.
2617
+ turn both, and prints keep-precision, keep-recall and the injection-drop rate per model; it spends. It grades on several
2618
+ models at once (`--grade-models A,B,C`, with how often they agree, note by note), reads the held-out set with
2619
+ `--set heldout`, and lists its plan without calling a model with `--dry`.
2620
+
2621
+ The learning bench, `node scripts/learn-bench.mjs`, runs repeated jobs with learning off and on, on pi and
2622
+ claude-agent, and reports the follow rate on repeat steps, the work cost per run and its trend, how often workflows are
2623
+ proposed and reused, staleness after a rule changes, and wrong keeps after a planted request. Six jobs ship with it, in
2624
+ [`learn-bench/`](learn-bench/README.md); it calls real models and spends, so it runs on demand or nightly.
2625
+
2626
+ ### Coming
2627
+
2628
+ - 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).
2629
+ - A learned workflow may hold decision nodes (judge, pick, sift), answered by the run's decision provider under the run's cap (#2363).
2630
+ - Consolidation: related notes merged into one, and a skill and its workflow brought back in step (#2335).
2631
+ - A learned workflow's node of a tier runs on the server's model of that tier, at its own price (#2408).
2632
+ - A run's workflow draft may call a granted MCP tool: the checks admit it, and the grader holds one that writes for the owner's OK.
2633
+ - A learned workflow keeps the output format its skill asks for (#2412).
2550
2634
 
2551
2635
  ### What a person sees and controls
2552
2636
 
@@ -2594,6 +2678,17 @@ with the token, an archived agent's too:
2594
2678
  too (`Approved-Via: console`). The learning view gives each item `last_change` (`{kind, by, at}`: `approved`,
2595
2679
  `edited`, `created`, `retired` or `restored` by a `person`, or `learned` by a `run`) and each retired one `retired`
2596
2680
  (`{at, by}`, the time of its retire, which an edit since moves not).
2681
+ - `POST .../learning/workflows/{name}/promote` (`{name?}`) makes an active learned workflow an agent of its own: a new
2682
+ agent, as `POST /agents` makes one, whose revision is a workflow revision of the workflow's `workflow.json`, so its
2683
+ runs run the workflow's nodes with no agent loop, answer the workflow's output, and can be started by a trigger or a
2684
+ pipeline like any agent's. Only an active one: a workflow that waits for its owner's OK, or was retired, is 409
2685
+ `learned_not_active`. Its files are checked again as a restore checks them, and its workflow as the learning checker
2686
+ checks a run's draft against the agent's tools and gate (400 with `problems`), then as any workflow revision's save
2687
+ (422, or 409 `agent_not_runnable`). The new agent's `tools` are the ones its call nodes call, and it keeps the source
2688
+ agent's policy as it is now (its `tool_settings`, `approvals`, `max_cost_usd` and `cap_mode`), never more. Its id is the
2689
+ workflow's name, with `-2`, `-3` and on past an agent's id or name already here, and its name `name` or the same. It
2690
+ answers 201 with the agent; the learned workflow stays in the folder, unchanged. It takes the owner's password session
2691
+ alone, as an approval does.
2597
2692
  - `GET /runs/{run_id}/learning`: the run's learning whole (its `given`, `read` and `learned` as on its read, its seed, its merge, the grader's verdict with its item for
2598
2693
  each new note, `{file, keep, question, why}`, `question` the rubric's question a dropped note failed, the checker's
2599
2694
  problems, what the grade cost), `null` for a run that does not learn; `verdict` is `null` until a grade ran.
@@ -2669,6 +2764,19 @@ on claude-agent, codex and opencode the model proxy adds them to the body (after
2669
2764
  prefix is unchanged). Neither CLI nor pi keeps them in its transcript, and no message is queued, so nothing runs after
2670
2765
  the model's answer. Once per cap, across restarts; a raise re-arms it.
2671
2766
 
2767
+ A capped run also stops calling tools before its cap stops it. Once what it has spent, plus what its requests and paid
2768
+ steps still out are held at (their worst case, as the cap counts them, a browser session's open reserve included),
2769
+ reaches 75% of its cap, the run's tool gate
2770
+ refuses every call a model makes, in every conversation of the run, on every harness, before any setting or approval
2771
+ is read, with one fixed text: "Budget nearly spent: stop calling tools and answer now from what you have." A call that
2772
+ would open a child conversation is refused the same way, so no new one starts. Nothing in flight is cut: a child still
2773
+ working gets the same refusal on its next call and answers, a call a running tool makes is that tool's and runs, and
2774
+ model requests are judged by the cap as before, so the run's final answer still lands. The cap stays the last line: a
2775
+ request that does not fit what is left is refused as above. The figure is read from the run's booking records at each
2776
+ call, never kept in memory, so a restart or a claim moved to another runner holds the same line, and a raise moves it.
2777
+ Several requests out at once hold far more than they cost, which is why a fan-out of children used to end a small cap
2778
+ with no answer at all; the quarter left above the line is the room for each of them, and the parent, to answer.
2779
+
2672
2780
  Under a cap each request is limited to the
2673
2781
  output tokens what is left of the cap can buy, thinking included, never more than it asks for or than the model's
2674
2782
  ceiling (its max output tokens, else its context window, clamped to what the window leaves): on pi through the request's
@@ -2678,9 +2786,33 @@ so the cap stays exact. A request is refused only when what is left cannot buy i
2678
2786
  tokens for its answer (what it asks for, when that is fewer), and when it thinks, the provider's least thinking budget
2679
2787
  where thinking takes one (Anthropic's, 1,024, the budget squeezed to it at the least) or else its thinking level's
2680
2788
  budget, since its reasoning then shares the limit (minimal 1,024, low 2,048, medium 8,192, high 16,384). The input bound is one token per UTF-8 byte of what is sent (a byte-level tokenizer never makes
2681
- a token of less than one byte, and an image's base64 is far more bytes than its tokens), plus what the provider adds
2682
- server-side (a tool-use prompt, each image), from the same table the model proxy of claude-agent, codex and opencode uses; there
2683
- the proxy measures each request's body. A request in flight holds what it was admitted at until it answers, so requests
2789
+ a token of less than one byte), each image counted at what its model's provider bills it by its size in place of its
2790
+ base64's bytes, plus what the provider adds server-side (a tool-use prompt), from the same table the model proxy of
2791
+ claude-agent, codex and opencode uses; there the proxy measures each request's body. On a route straight to Anthropic
2792
+ (`https://api.anthropic.com`, on pi and claude-agent), each answer request is also counted by Anthropic's own free
2793
+ token count (`POST /v1/messages/count_tokens`, with only the credential and version headers, and never through a
2794
+ gateway or any other base), and its bound is that count plus the tool-use prompt when that is below its bytes. A count
2795
+ that fails or takes over 3 seconds leaves the byte bound; the request is never held up or refused for it.
2796
+
2797
+ **The smallest cap that works.** The byte bound reads text as about two to three times the tokens it is billed as, and a
2798
+ step is sent only when the run's spend plus that step's least (its input bound, priced by the cap mode, and a 1,024-token
2799
+ answer) fits. So a small cap pauses a run well before it has spent it. Measured on a pi desktop run on Sonnet ($3 / $15,
2800
+ cache write $3.75, cache read $0.30 a million) through the dispatch's own system prompt and tools, five requests (four
2801
+ screenshots, then the answer), spending about $0.04 in all:
2802
+
2803
+ | Cap mode | Route | First request needs | Five-step run needs | Each further step |
2804
+ | --- | --- | --- | --- | --- |
2805
+ | `strict` | Through a gateway (OpenRouter): the byte bound | $0.05 | $0.11 | about $0.013 |
2806
+ | `strict` | Straight to Anthropic: Anthropic's count | $0.03 | $0.09 | about $0.012 |
2807
+ | `expected` (the default) | Either | as `strict` | as `strict` until #2504 lands | as `strict` until #2504 lands |
2808
+
2809
+ In `strict` mode every step's whole input is priced at the cache-write price. The `expected` row is today's: the runner
2810
+ does not yet price a step from what the previous request read from the cache, as `expected` is described above, so it
2811
+ prices like `strict` until #2504 lands. Once it does, a five-step run in `expected` mode needs about $0.06 by either route,
2812
+ and about $0.007 a further step. A claude-agent run's first request is of the same size (the pinned
2813
+ CLI's measured 6,926 bytes with five tools: $0.04 for its first request through a gateway). A cap below these pauses at
2814
+ once with `Not sent: ... the next step needs at least $X`, and a raise to that figure sends it on.
2815
+ `packages/serve/test/cap-minimum.test.mjs` holds these figures to what the cap does. A request in flight holds what it was admitted at until it answers, so requests
2684
2816
  sent side by side cannot pass the cap together. Spent so far is read from the run's store each time its process starts, so it
2685
2817
  survives a restart, plus each response since, and with them each charge a paid tool booked (`monid.run`, which is itself
2686
2818
  refused once the spend reaches the cap; see [monid](#tools)).
@@ -2706,6 +2838,9 @@ session (spent before any process could hold it). A session whose release is nev
2706
2838
  (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
2707
2839
  last charges booked before its process exits.
2708
2840
 
2841
+ 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
2842
+ AgentRun does not count them yet: they are in no run's cost and are not held against its cap.
2843
+
2709
2844
  Under a cap, whatever cannot be priced is refused, never passed as $0, and the run ends `failed` with
2710
2845
  `spend_cap_reached`, since no cap would send it:
2711
2846
 
@@ -2792,11 +2927,8 @@ follows it. The refusal's words (`said`) keep its own figures. Its timeline show
2792
2927
  ending `:note`, so it is no message) marked `paused` (never an `error` row; it stays once the cap is raised, as the
2793
2928
  run's history), then a waiting row: "Waiting for you to raise the
2794
2929
  cap", and no more: the words are `pending.said`'s, which a client shows once. The
2795
- webhook's `run.needs_input` says `pending.kind: "budget"`. Its process is let go while it waits (SIGTERM: it drains and
2796
- releases the run), so a paused run holds no place; a server started again reads it paused from its store. A paused
2797
- process that does not let go within the drain timeout (`--drain-timeout`, 30 s by default) is killed, and the run ends
2798
- `failed`, as any run whose process is killed does, unless its cap was raised meanwhile: it held nothing, so the raise's
2799
- follow-up goes (below). A message to a
2930
+ webhook's `run.needs_input` says `pending.kind: "budget"`. The run is parked while it waits: no runner holds it,
2931
+ so a paused run holds no place, and a server started again reads it paused from its store. A message to a
2800
2932
  paused run is `409 budget_reached`; a stop does nothing more, and a cancel ends it `cancelled`. Only a refusal for room
2801
2933
  pauses a run: one no cap fixes (above) ends it `failed`, as does a cost found past the cap after a response.
2802
2934
 
@@ -2812,20 +2944,11 @@ still ends the run `failed`.
2812
2944
  `PATCH /runs/{run_id}` with `{max_cost_usd}` raises the cap, and only raises it: the new cap is above the run's current
2813
2945
  cap, its last raise included, by more than a float's tail (1e-9; `422` otherwise, and for a run with no cap;
2814
2946
  `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
2815
- answers as the first did. The run's serve.json keeps the raise before any answer, with each raise in `cap_raised`, so its
2816
- next process opens under it, as does a server started again; a raise it could not keep is not taken (an error answers it),
2817
- 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,
2818
- message_id, status, state}` at once, and the pause gets one follow-up turn, "The cap was raised to $2; continue the
2819
- task.", under that `message_id`, which the server sends once the process being let go is gone, and which runs under the
2820
- new cap. From the moment the raise is taken, the run reads `queued` (state `working`), in the answer's `status` and in
2821
- every read after it, until the follow-up's turn runs: nothing waits on a person, so it is never `input_required` with no
2822
- `pending` meanwhile. A second raise before it goes raises the cap it names and answers the same `message_id`. It is sent once: a
2823
- server stopped before it went, or between starting its process and sending it, sends it when it starts again. One that
2824
- 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
2825
- 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
2826
- person's message (its submit names the server as its origin, `cap_raised`). A working run's
2827
- 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
2828
- the refusal's own start mark, so a row shown after the refusal never reads the run paused again.
2947
+ 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
2948
+ `{run_id, max_cost_usd, resumed: true, status, state}` at once, and a runner claims the run again and resumes it from its
2949
+ 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
2950
+ under way keeps the cap it was admitted at, and the answer's `note` says so. A run a person stopped takes no raise
2951
+ (`409 not_continuable`): send it a message to go on, then raise its cap.
2829
2952
 
2830
2953
  A request carrying a native web search tool reads pages into its input that its body does not hold (the provider bills
2831
2954
  them as input): under a cap its input bound is its body's plus an allowance. Claude's own search, an explicit `native`
@@ -2873,6 +2996,15 @@ OpenRouter Decisions model the catalog lists no price for: `409 agent_not_runnab
2873
2996
  node's label and its fix. A step no cap fixes all the same (a spend no one knows) ends the run `failed`,
2874
2997
  `spend_cap_reached`, in the cap's words, after the node's label.
2875
2998
 
2999
+ ## Tool-call budget
3000
+
3001
+ An agentic definition's `max_tool_calls: N` gives each conversation of its runs on pi N tool calls: the run's own, and
3002
+ each conversation a tool opens, counted apart. Past N the run's tool gate refuses every call before it runs, before
3003
+ any setting or approval is read, with one fixed text: the budget is spent, don't call another tool, answer now from
3004
+ what you have. That refusal is not counted and never ends the run, so the model's next answer is the turn's. The count
3005
+ is read from the conversation's committed journal, so a restart or a claim moved to another runner keeps it. Above 0
3006
+ sets the budget, 0 clears it, an edit that leaves it out keeps it; a workflow's, or one on another harness, is `422`.
3007
+
2876
3008
  ## The faux model
2877
3009
 
2878
3010
  `--faux MODULE` loads `MODULE` in each run's process. Its default export is called for every model request with the
@@ -2950,18 +3082,19 @@ carries no cost at all, as from a provider that does not price the model. The te
2950
3082
  no cookie of this server's and nothing of yours; Google sees the browser's address and which providers the page
2951
3083
  lists. Offline, or with those hosts blocked, the page shows a key icon instead. The CSP's `img-src` allows those
2952
3084
  five hosts; everything else is this origin only.
2953
- - 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
2954
- at its first launch); a run's process an older server started keeps the server-wide one (`DIR/.door-token`).
2955
- - A run's process gets the server's environment (the `AGENT_MODEL` variables among it) without the server's token or any
2956
- key: no `AGENTRUN_TOKEN`, no `AGENTRUN_API_KEY`, no variable whose value is the token, and no variable named like a key
3085
+ - 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
3086
+ command row the runner reads, so no port a run listens on takes a token.
3087
+ - A run's tools run under the runner's environment (the `AGENT_MODEL` variables among it) without the server's token or
3088
+ any key: no `AGENTRUN_TOKEN`, no `AGENTRUN_API_KEY`, no variable whose value is the token, and no variable named like a key
2957
3089
  (one of its `_`-separated segments, in any case, is `KEY`, `TOKEN`, `SECRET`, `PASSWORD`, `PASSWD`, `PASS`, `PAT`,
2958
3090
  `CREDENTIAL`, `CREDENTIALS` or `DSN`, or its last is `PWD` after another: `SERVICE_KEY`, `GITHUB_TOKEN_RO`, `DB_PASS`,
2959
3091
  `SENTRY_DSN`, `DB_PWD`; never `PWD` or `OLDPWD`), whether the launcher's list names it or not. The rule is
2960
- 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
2961
- needs come over its pipe. It gets none of the boxes' keys ([Boxes](#boxes)). A tool key reaches it only when its
3092
+ `keyShaped` (`src/secret-cut.ts`), which an import's cut and a harness's log take too. The keys a
3093
+ run needs are read from the store at its claim, opened with the seal key, and are put on that run's environment alone.
3094
+ It gets none of the boxes' keys ([Boxes](#boxes)). A tool key reaches it only when its
2962
3095
  revision names a tool the key unlocks (`MONID_API_KEY` a monid tool, `BROWSERBASE_API_KEY` and `KERNEL_API_KEY` `browser`; a workflow's
2963
3096
  tools are those its model and call nodes name), and a model key only when its model needs it ([Models](#models)), read
2964
- from the revision at each launch, a relaunch or a resume after a restart included.
3097
+ from the revision at each claim, a resume after a restart included.
2965
3098
  - A variable named like a key that is not on the launcher's list (`capabilities.secrets.names`) is left out of every
2966
3099
  run's environment, but the launcher does not take it out of the server's: it stays in the server's own environment
2967
3100
  (`/proc/<pid>/environ`), which any process of the same user can read. Set only the keys the server needs where it
@@ -2974,15 +3107,15 @@ carries no cost at all, as from a provider that does not price the model. The te
2974
3107
  keys or bearer token (held, and handed to a run on Bedrock), an `AWS_PROFILE`, `GOOGLE_CLOUD_API_KEY` or the default
2975
3108
  application credentials file work. A credential file a provider reads by path (`AWS_PROFILE`'s `~/.aws` files, the
2976
3109
  default application credentials) is the host's: a run's process reads it for its model, and its file tools cannot.
2977
- - `TYPESAFE_API_KEY` is a decision key, handed to a workflow run's decision providers on a pipe of their own and never
2978
- 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
2979
- model, and the run fails.
3110
+ - `TYPESAFE_API_KEY` is a decision key, given to a workflow run's decision providers alone and never
3111
+ 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
3112
+ the run fails.
2980
3113
  - A run's file tools (`read`, `write`, `edit`) reach its own `work/`, and two places of its own beside it: `read` also
2981
3114
  reaches the run's `tmp/` (next to `work/`, where a command's spilled output would go), and a write may also land in a
2982
3115
  temporary directory the run's environment made for a tool (`createTempDir`). Every other path, a link inside `work/`
2983
- included, is resolved and refused (`outside the workspace`), so a run reads neither the server's token, the door
2984
- token, `store.sqlite`, another run's files (its `work/` or its `tmp/`) nor `/proc`, and writes nowhere else. This is
2985
- pi-durable-disk's confinement inside the run's process, not an operating-system boundary: the run and the server
3116
+ included, is resolved and refused (`outside the workspace`), so a run reads neither the server's token,
3117
+ `store.sqlite`, another run's files (its `work/` or its `tmp/`) nor `/proc`, and writes nowhere else. This is the
3118
+ Workspace's confinement inside the runner's process, not an operating-system boundary: the runner and the server
2986
3119
  share a user (one uid in the container), so the confinement holds only because the run has no shell on this machine.
2987
3120
  - No path offers a shell on this machine. On the runner `bash` is not bound: a definition that names it is not saved
2988
3121
  here (`422`), one saved before that check is not runnable (`409`), and a model that calls it anyway, as an agent or as
@@ -3018,8 +3151,8 @@ carries no cost at all, as from a provider that does not price the model. The te
3018
3151
  ## Test
3019
3152
 
3020
3153
  ```sh
3021
- 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
3154
+ npm run build -w @parcha/agentrun-dsl -w @parcha/agentrun-pi -w @parcha/pi-durable-agent -w @parcha/agentrun-serve
3022
3155
  npm test -w @parcha/agentrun-serve
3023
3156
  ```
3024
3157
 
3025
- The tests start real run processes on the faux model, both kinds: no key, no network.
3158
+ The tests start a real runner on the faux model, both kinds of run: no key, no network.