@parcha/agentrun-serve 0.1.0-beta.51 → 0.1.0-beta.53

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 (322) hide show
  1. package/CHANGELOG.md +160 -1
  2. package/README.md +306 -36
  3. package/dist/adapters.js +1 -1
  4. package/dist/agent-delete.d.ts +14 -4
  5. package/dist/agent-delete.js +30 -58
  6. package/dist/agent-package.d.ts +71 -0
  7. package/dist/agent-package.js +345 -0
  8. package/dist/agents-store.d.ts +28 -18
  9. package/dist/agents-store.js +48 -34
  10. package/dist/api-only.d.ts +30 -8
  11. package/dist/api-only.js +40 -16
  12. package/dist/archil-routes.d.ts +1 -0
  13. package/dist/archil-routes.js +28 -2
  14. package/dist/claude-login.d.ts +1 -0
  15. package/dist/claude-login.js +1 -1
  16. package/dist/cli-learning/cli.d.ts +3 -0
  17. package/dist/cli-learning/cli.js +17 -3
  18. package/dist/cli-learning/connections.js +3 -2
  19. package/dist/cli-learning/schema.js +2 -1
  20. package/dist/cli.js +70 -7
  21. package/dist/composio-preset.d.ts +2 -1
  22. package/dist/composio-preset.js +4 -3
  23. package/dist/composio-triggers.d.ts +4 -0
  24. package/dist/composio-triggers.js +4 -1
  25. package/dist/computer-needs.d.ts +32 -0
  26. package/dist/computer-needs.js +80 -0
  27. package/dist/computer-setting.d.ts +9 -0
  28. package/dist/computer-setting.js +19 -1
  29. package/dist/computers.d.ts +6 -2
  30. package/dist/computers.js +2 -2
  31. package/dist/console/assets/index-BFgyZzF_.js +734 -0
  32. package/dist/console/assets/index-DbilxljH.css +1 -0
  33. package/dist/console/index.html +2 -2
  34. package/dist/console-links.d.ts +1 -0
  35. package/dist/console-links.js +2 -0
  36. package/dist/env-switch.d.ts +14 -0
  37. package/dist/env-switch.js +23 -0
  38. package/dist/errors.d.ts +1 -0
  39. package/dist/errors.js +3 -0
  40. package/dist/eval-previous.js +4 -3
  41. package/dist/fal-price.d.ts +76 -0
  42. package/dist/fal-price.js +365 -0
  43. package/dist/handed-secret.d.ts +4 -0
  44. package/dist/handed-secret.js +10 -0
  45. package/dist/harness-archive.d.ts +15 -5
  46. package/dist/harness-archive.js +71 -34
  47. package/dist/harness-check.d.ts +2 -1
  48. package/dist/harness-check.js +36 -95
  49. package/dist/harness-egress.d.ts +23 -0
  50. package/dist/harness-egress.js +69 -0
  51. package/dist/harness-recipe-entry.d.ts +71 -0
  52. package/dist/harness-recipe-entry.js +184 -0
  53. package/dist/harness-recipe.d.ts +73 -6
  54. package/dist/harness-recipe.js +185 -31
  55. package/dist/harness-sign-in.d.ts +29 -0
  56. package/dist/harness-sign-in.js +122 -0
  57. package/dist/harness-table.d.ts +21 -0
  58. package/dist/harness-table.js +58 -3
  59. package/dist/harness-zip.d.ts +6 -0
  60. package/dist/harness-zip.js +203 -0
  61. package/dist/ids.d.ts +11 -0
  62. package/dist/ids.js +36 -0
  63. package/dist/learn/commit.d.ts +19 -1
  64. package/dist/learn/commit.js +160 -2
  65. package/dist/learn/compile.d.ts +13 -5
  66. package/dist/learn/compile.js +46 -15
  67. package/dist/learn/delete.d.ts +12 -6
  68. package/dist/learn/delete.js +17 -11
  69. package/dist/learn/folder.d.ts +16 -0
  70. package/dist/learn/folder.js +30 -4
  71. package/dist/learn/learning-of.d.ts +8 -0
  72. package/dist/learn/learning-of.js +8 -0
  73. package/dist/learn/learning.sh +29 -4
  74. package/dist/learn/promote.d.ts +51 -7
  75. package/dist/learn/promote.js +51 -8
  76. package/dist/learn/secrets.js +30 -7
  77. package/dist/learning-reset.d.ts +18 -0
  78. package/dist/learning-reset.js +115 -0
  79. package/dist/learning-routes.d.ts +23 -11
  80. package/dist/learning-routes.js +110 -20
  81. package/dist/learning-words.d.ts +5 -0
  82. package/dist/learning-words.js +5 -0
  83. package/dist/learning.d.ts +15 -10
  84. package/dist/learning.js +14 -8
  85. package/dist/llms.txt +1 -0
  86. package/dist/mcp-gateway.d.ts +39 -2
  87. package/dist/mcp-gateway.js +56 -12
  88. package/dist/mcp-pin-first.js +1 -1
  89. package/dist/mcp-probe.d.ts +3 -0
  90. package/dist/mcp-probe.js +7 -2
  91. package/dist/mcp-resources.d.ts +44 -0
  92. package/dist/mcp-resources.js +100 -0
  93. package/dist/mcp-servers-store.d.ts +17 -12
  94. package/dist/mcp-servers-store.js +2 -1
  95. package/dist/media-duration.d.ts +2 -0
  96. package/dist/media-duration.js +136 -0
  97. package/dist/model.d.ts +4 -4
  98. package/dist/model.js +6 -6
  99. package/dist/native/cli.js +9 -2
  100. package/dist/native/connection.d.ts +2 -2
  101. package/dist/native/connection.js +5 -2
  102. package/dist/native/discovery.d.ts +2 -0
  103. package/dist/native/discovery.js +10 -6
  104. package/dist/native/remote-worker-bridge.js +36 -4
  105. package/dist/native/remote.d.ts +18 -1
  106. package/dist/native/remote.js +126 -37
  107. package/dist/native/schema.d.ts +6 -0
  108. package/dist/native/schema.js +31 -6
  109. package/dist/native/source-account.d.ts +13 -0
  110. package/dist/native/source-account.js +114 -0
  111. package/dist/native/source-capture-hooks.d.ts +5 -0
  112. package/dist/native/source-capture-hooks.js +102 -0
  113. package/dist/native/source-mcp-selection.d.ts +13 -0
  114. package/dist/native/source-mcp-selection.js +72 -0
  115. package/dist/native/source-runtime-tools.d.ts +19 -0
  116. package/dist/native/source-runtime-tools.js +103 -0
  117. package/dist/native/source-snapshot-types.d.ts +138 -0
  118. package/dist/native/source-snapshot-types.js +12 -0
  119. package/dist/native/source-snapshot.d.ts +8 -0
  120. package/dist/native/source-snapshot.js +1201 -0
  121. package/dist/observation/learning.js +3 -2
  122. package/dist/openapi.js +211 -47
  123. package/dist/print.js +1 -1
  124. package/dist/provider.d.ts +8 -0
  125. package/dist/provider.js +14 -2
  126. package/dist/purged-workflow.d.ts +12 -0
  127. package/dist/purged-workflow.js +43 -0
  128. package/dist/refusal-words.d.ts +0 -3
  129. package/dist/refusal-words.js +0 -3
  130. package/dist/request-metadata.d.ts +20 -0
  131. package/dist/request-metadata.js +24 -0
  132. package/dist/run-keys.d.ts +46 -0
  133. package/dist/run-keys.js +109 -0
  134. package/dist/run-launch.d.ts +29 -5
  135. package/dist/run-launch.js +44 -4
  136. package/dist/run-learning-served.d.ts +2 -2
  137. package/dist/run-model-key.d.ts +2 -2
  138. package/dist/run-model-key.js +5 -5
  139. package/dist/run-secrets.d.ts +2 -0
  140. package/dist/run-secrets.js +7 -4
  141. package/dist/run-usage.d.ts +48 -4
  142. package/dist/run-usage.js +156 -39
  143. package/dist/run-view.d.ts +18 -1
  144. package/dist/run-view.js +28 -8
  145. package/dist/runner/adapter-loop.d.ts +14 -4
  146. package/dist/runner/adapter-loop.js +150 -31
  147. package/dist/runner/adapter-run-spec.d.ts +1 -1
  148. package/dist/runner/adapter-run-spec.js +35 -22
  149. package/dist/runner/audit.d.ts +10 -3
  150. package/dist/runner/audit.js +30 -7
  151. package/dist/runner/beside.js +2 -1
  152. package/dist/runner/claim-secrets.d.ts +31 -4
  153. package/dist/runner/claim-secrets.js +43 -7
  154. package/dist/runner/cli-run-spec.d.ts +1 -1
  155. package/dist/runner/cli-run-spec.js +32 -20
  156. package/dist/runner/conformance/harness.js +4 -2
  157. package/dist/runner/dispatch.js +4 -2
  158. package/dist/runner/harness-loops.d.ts +6 -0
  159. package/dist/runner/harness-loops.js +16 -3
  160. package/dist/runner/held.d.ts +4 -0
  161. package/dist/runner/journal-kinds.d.ts +5 -0
  162. package/dist/runner/learned-first.d.ts +2 -0
  163. package/dist/runner/learned-first.js +1 -1
  164. package/dist/runner/learning-end.d.ts +9 -3
  165. package/dist/runner/learning-end.js +66 -29
  166. package/dist/runner/learning-seed.d.ts +9 -3
  167. package/dist/runner/learning-seed.js +2 -2
  168. package/dist/runner/main.d.ts +1 -0
  169. package/dist/runner/main.js +20 -13
  170. package/dist/runner/mcp-claim.js +7 -2
  171. package/dist/runner/mcp-run.d.ts +12 -0
  172. package/dist/runner/mcp-run.js +14 -1
  173. package/dist/runner/model-route.js +7 -4
  174. package/dist/runner/monid-run.js +9 -11
  175. package/dist/runner/project-checkpoint.d.ts +35 -0
  176. package/dist/runner/project-checkpoint.js +116 -0
  177. package/dist/runner/project-drain.d.ts +8 -0
  178. package/dist/runner/project-drain.js +25 -0
  179. package/dist/runner/project-host.d.ts +10 -0
  180. package/dist/runner/project-host.js +52 -0
  181. package/dist/runner/promotion.d.ts +51 -24
  182. package/dist/runner/promotion.js +206 -78
  183. package/dist/runner/redact.d.ts +13 -0
  184. package/dist/runner/redact.js +67 -1
  185. package/dist/runner/run-channel.d.ts +9 -0
  186. package/dist/runner/run-channel.js +15 -2
  187. package/dist/runner/run-child-host.d.ts +8 -4
  188. package/dist/runner/run-child-host.js +174 -42
  189. package/dist/runner/run-errors.js +2 -2
  190. package/dist/runner/runner-check.js +5 -2
  191. package/dist/runner/runner.js +41 -12
  192. package/dist/runner/sdk-loop.d.ts +2 -2
  193. package/dist/runner/sdk-loop.js +3 -3
  194. package/dist/runner/store-port.d.ts +3 -0
  195. package/dist/runner/store-secrets.js +7 -3
  196. package/dist/runner/workflow-first.d.ts +4 -0
  197. package/dist/runner/workflow-first.js +13 -0
  198. package/dist/runner/workflow-loop.d.ts +2 -1
  199. package/dist/runner/workflow-loop.js +2 -1
  200. package/dist/runner/workflow-spec.js +4 -4
  201. package/dist/runs-over-store.d.ts +39 -8
  202. package/dist/runs-over-store.js +147 -32
  203. package/dist/sdk/check.d.ts +6 -5
  204. package/dist/sdk/check.js +17 -16
  205. package/dist/sdk/runs.d.ts +11 -1
  206. package/dist/sdk/runs.js +185 -78
  207. package/dist/sdk/schema.js +12 -2
  208. package/dist/sdk/workflows.d.ts +1 -1
  209. package/dist/server.d.ts +68 -32
  210. package/dist/server.js +678 -124
  211. package/dist/skills/agentrun-serve/SKILL.md +2 -1
  212. package/dist/source-sync/adoption.d.ts +15 -0
  213. package/dist/source-sync/adoption.js +36 -0
  214. package/dist/source-sync/auxiliary.d.ts +23 -0
  215. package/dist/source-sync/auxiliary.js +64 -0
  216. package/dist/source-sync/capture-git.d.ts +5 -0
  217. package/dist/source-sync/capture-git.js +272 -0
  218. package/dist/source-sync/capture-project.d.ts +53 -0
  219. package/dist/source-sync/capture-project.js +206 -0
  220. package/dist/source-sync/capture-refusal.d.ts +7 -0
  221. package/dist/source-sync/capture-refusal.js +16 -0
  222. package/dist/source-sync/capture.d.ts +11 -0
  223. package/dist/source-sync/capture.js +22 -0
  224. package/dist/source-sync/checkpoint-gate.d.ts +21 -0
  225. package/dist/source-sync/checkpoint-gate.js +52 -0
  226. package/dist/source-sync/checkpoints.d.ts +66 -0
  227. package/dist/source-sync/checkpoints.js +168 -0
  228. package/dist/source-sync/claim.d.ts +11 -0
  229. package/dist/source-sync/claim.js +48 -0
  230. package/dist/source-sync/destination.d.ts +47 -0
  231. package/dist/source-sync/destination.js +239 -0
  232. package/dist/source-sync/io.d.ts +15 -0
  233. package/dist/source-sync/io.js +52 -0
  234. package/dist/source-sync/local.d.ts +43 -0
  235. package/dist/source-sync/local.js +229 -0
  236. package/dist/source-sync/prepare.d.ts +59 -0
  237. package/dist/source-sync/prepare.js +93 -0
  238. package/dist/source-sync/projects.d.ts +61 -0
  239. package/dist/source-sync/projects.js +130 -0
  240. package/dist/source-sync/registry.d.ts +95 -0
  241. package/dist/source-sync/registry.js +226 -0
  242. package/dist/source-sync/service.d.ts +33 -0
  243. package/dist/source-sync/service.js +118 -0
  244. package/dist/source-sync/skill-edits.d.ts +12 -0
  245. package/dist/source-sync/skill-edits.js +122 -0
  246. package/dist/source-sync/snapshots.d.ts +48 -0
  247. package/dist/source-sync/snapshots.js +448 -0
  248. package/dist/source-sync/types.d.ts +9 -0
  249. package/dist/source-sync/types.js +14 -0
  250. package/dist/source-sync/workspace.d.ts +66 -0
  251. package/dist/source-sync/workspace.js +273 -0
  252. package/dist/store/agent-body.d.ts +8 -0
  253. package/dist/store/agent-body.js +20 -6
  254. package/dist/store/index.d.ts +2 -2
  255. package/dist/store/index.js +1 -1
  256. package/dist/store/journal/storage.d.ts +2 -0
  257. package/dist/store/journal/storage.js +2 -1
  258. package/dist/store/postgres/migrations/0025_run_attempts.sql +27 -0
  259. package/dist/store/postgres/migrations/0026_run_disk.sql +23 -0
  260. package/dist/store/schema.d.ts +15 -1
  261. package/dist/store/schema.js +43 -4
  262. package/dist/store/seal.d.ts +5 -1
  263. package/dist/store/seal.js +12 -3
  264. package/dist/store/sqlite/project-checkpoints.d.ts +11 -0
  265. package/dist/store/sqlite/project-checkpoints.js +70 -0
  266. package/dist/store/sqlite/run-launch.d.ts +14 -0
  267. package/dist/store/sqlite/run-launch.js +58 -7
  268. package/dist/store/sqlite/run-patch.d.ts +2 -1
  269. package/dist/store/sqlite/run-patch.js +4 -3
  270. package/dist/store/sqlite/store.js +319 -153
  271. package/dist/store/store-schema.js +2 -2
  272. package/dist/store/store.d.ts +173 -33
  273. package/dist/store/store.js +14 -1
  274. package/dist/store-reads/learning.d.ts +12 -8
  275. package/dist/store-reads/learning.js +33 -24
  276. package/dist/store-reads/loop.d.ts +4 -3
  277. package/dist/store-reads/loop.js +7 -5
  278. package/dist/store-view.d.ts +3 -1
  279. package/dist/store-view.js +17 -5
  280. package/dist/template-eval.js +4 -4
  281. package/dist/template-import.d.ts +10 -2
  282. package/dist/template-import.js +116 -13
  283. package/dist/templates.d.ts +29 -5
  284. package/dist/templates.js +68 -14
  285. package/dist/timeline/index.d.ts +1 -1
  286. package/dist/timeline/index.js +1 -1
  287. package/dist/timeline/labels.js +1 -1
  288. package/dist/timeline/timeline.d.ts +5 -0
  289. package/dist/timeline/timeline.js +8 -0
  290. package/dist/tool-plane.d.ts +12 -12
  291. package/dist/tools.d.ts +8 -8
  292. package/dist/tools.js +1 -1
  293. package/dist/trigger-launch-hook.d.ts +47 -0
  294. package/dist/trigger-launch-hook.js +90 -0
  295. package/dist/trigger-targets.d.ts +14 -1
  296. package/dist/trigger-targets.js +20 -0
  297. package/dist/triggers.d.ts +54 -5
  298. package/dist/triggers.js +143 -8
  299. package/dist/uploads-archil.js +2 -1
  300. package/dist/uploads.d.ts +0 -3
  301. package/dist/uploads.js +2 -11
  302. package/dist/validate.js +4 -1
  303. package/dist/web-save.d.ts +3 -0
  304. package/dist/web-save.js +17 -2
  305. package/dist/workspace/archil-exec.js +1 -1
  306. package/dist/workspace/archil.js +1 -1
  307. package/dist/workspace/computer-for-claim.d.ts +2 -0
  308. package/dist/workspace/computer-for-claim.js +43 -0
  309. package/dist/workspace/paths.d.ts +6 -0
  310. package/dist/workspace/paths.js +6 -0
  311. package/dist/workspace/resolve-computer.d.ts +1 -0
  312. package/dist/workspace/revision-skills.js +24 -11
  313. package/dist/workspace/run-tools.d.ts +2 -0
  314. package/dist/workspace/run-tools.js +8 -0
  315. package/dist/workspace/synced-folder.d.ts +3 -3
  316. package/dist/workspace/synced-folder.js +7 -6
  317. package/launcher/agentrun-serve +1 -1
  318. package/package.json +10 -10
  319. package/skills/agentrun-serve/SKILL.md +2 -1
  320. package/templates/README.md +5 -2
  321. package/dist/console/assets/index-Bt1B51b7.js +0 -733
  322. package/dist/console/assets/index-sVftE9Ht.css +0 -1
package/README.md CHANGED
@@ -14,6 +14,11 @@ sign-in and configuration. Turn **Self-improving** On separately to give later r
14
14
  corrections. Eligible server-run and SDK agents can also compile checked workflows; CLI capture has no workflow
15
15
  bridge. Imported history stays historical and does not automatically train the agent.
16
16
 
17
+ New source connections also keep their setup in sync by default. A supported complete setup can **Move to AgentRun**
18
+ from the same agent page, retaining its identity and history. Destination accounts and unsupported tools/settings
19
+ appear as prerequisites. See [source sync and Move](../../docs/source-sync.md) for scope, project continuity,
20
+ conflicts and current compatibility; `--no-sync` opts out when connecting.
21
+
17
22
  For a source on a different laptop, VM or container, choose **Connection setup → Another machine** and use the
18
23
  matching [Python source connector](../../connector/README.md). Remote execution currently needs the server and
19
24
  connector from the same reviewed development checkout; the published observation-only CLI does not include it.
@@ -723,6 +728,45 @@ AGENTRUN_DOCKER_IMAGE=python:3.12-bookworm AGENTRUN_BOXES=docker node packages/s
723
728
  `sh`, `sleep` and `setsid`, and `bash` for the `bash` tool when there is one (else `sh`). The image's own entrypoint
724
729
  never runs; the box's first process is a `sleep` of its lifetime.
725
730
 
731
+ **The media image.** For an agent that makes video, the computer package keeps a second recipe,
732
+ `packages/computer/media/Dockerfile`: the default image's base, by the same digest, and its programs, plus Node 24 from
733
+ its official tarball (each architecture's sha256 checked), Chromium (also on PATH as `chrome`), FFmpeg and FFprobe,
734
+ Noto (with CJK and colour emoji), Liberation and DejaVu fonts, and the [HyperFrames](https://github.com/heygen-com/hyperframes)
735
+ CLI at an exact version. On amd64 it also has the `chrome-headless-shell` build that CLI pins, by sha256, so a render
736
+ needs no download. The CLI's usage reports and update check are off unless a command turns them on. Nothing builds it for
737
+ you, and no agent setting picks it: build it, then name its tag in `AGENTRUN_DOCKER_IMAGE`. From the repository's root:
738
+
739
+ ```sh
740
+ tag=agentrun-media:$(sha256sum packages/computer/media/Dockerfile | cut -c1-12)
741
+ docker build -t "$tag" - < packages/computer/media/Dockerfile
742
+ AGENTRUN_DOCKER_IMAGE=$tag AGENTRUN_BOXES=docker node packages/serve/dist/cli.js
743
+ ```
744
+
745
+ The tag is the recipe's hash, so an edit to the recipe is a new tag, and a tag already on this machine is used as it is
746
+ (nothing is pulled). Its Debian packages come from snapshot.debian.org (over https) at one instant, and the CLI's npm
747
+ dependencies from the registry as it stood at that instant (by date, not by content), so two builds of one tag install
748
+ the same Debian packages. It is about 2.7 GB on disk. An agent that needs it says so with
749
+ [`computer.needs`](#computers), so a server on another image fails its runs in words instead of running them.
750
+
751
+ **The documents image.** For an agent that writes decks, documents and sheets, `packages/computer/documents` is the
752
+ default image plus the Python and Node libraries that write Office files (python-pptx, python-docx and openpyxl for
753
+ `python3`; pptxgenjs, docx and exceljs for `node`), pinned as its header says. The Node libraries are linked as
754
+ `/node_modules`, so a script in any folder requires or imports them. The libraries are the folder's
755
+ `documents.sh`, the one layer both builds run. Build it and name its tag in `AGENTRUN_DOCKER_IMAGE`:
756
+
757
+ ```sh
758
+ tag=agentrun-documents:$(cat packages/computer/documents/Dockerfile packages/computer/documents/documents.sh | sha256sum | cut -c1-12)
759
+ docker build -t "$tag" packages/computer/documents
760
+ AGENTRUN_DOCKER_IMAGE=$tag AGENTRUN_BOXES=docker node packages/serve/dist/cli.js
761
+ ```
762
+
763
+ On Daytona, `python3 packages/computer/box/build-daytona.py --documents` builds the box
764
+ image with the same layer on top as the snapshot `agentrun-documents-<hash>` (the box recipe's snapshot,
765
+ `agentrun-box-<hash>`, is unchanged); name it in `AGENTRUN_DAYTONA_SNAPSHOT`. An agent that needs them says so in
766
+ `computer.needs` (`["python-pptx", "pptxgenjs"]`), and a box without them ends its runs before any model request; on
767
+ Docker, the words name this image's build. Neither is published, and no agent setting picks one: a server's Docker image, or its
768
+ Daytona snapshot, is one for every agent.
769
+
726
770
  ### In the published image
727
771
 
728
772
  The published image, `ghcr.io/parcha-ai/agentrun-server`, runs Docker sandboxes on the Docker of the host it runs on,
@@ -831,6 +875,31 @@ They apply to Docker computers only: a vendor's computer (Daytona, Modal, E2B, O
831
875
  size its provider makes it, and is never given them. A value the Docker provider refuses stops the server's start, in
832
876
  the provider's words.
833
877
 
878
+ **What a sandbox needs.** A sandbox may list the programs its agent's work needs on the box's PATH:
879
+ `"computer": {"kind": "sandbox", "provider": "docker", "needs": ["chrome", "ffmpeg", "ffprobe", "hyperframes"]}`, 1 to
880
+ 32 names (letters, digits, `.`, `_`, `+` and `-`; no path), each once. A name may also be a library the agent's code
881
+ loads: a Python package by the name pip installs it by (`python-pptx`), which the box's `python3` has installed, or a
882
+ Node package (`pptxgenjs`), which a script of the box's `node` requires (from `node_modules` of the folder the check
883
+ runs in or any folder above it, up to `/node_modules`). A scoped npm package (`@scope/name`) can't be named. It says what the box must have, never which
884
+ image it is: a Docker box's image is still `AGENTRUN_DOCKER_IMAGE`'s, and another provider's is its own. Each run's
885
+ claim asks the box it started, before the run's first model request: one `sh` with the names as its arguments, which
886
+ prints those that are neither a program `command -v` finds nor such a library, searching the folders the agent's shell searches (`/usr/local/sbin`,
887
+ `/usr/local/bin`, `/usr/sbin`, `/usr/bin`, `/sbin`, `/bin`), never a PATH the image sets. A box that lacks one, or that cannot be asked, is let go and the run ends
888
+ `failed` (`run_failed`), its words naming what is missing and how to give the box an image that has it:
889
+
890
+ ```text
891
+ This agent's sandbox on Docker lacks chrome, ffmpeg, ffprobe, and hyperframes, which the agent needs (computer.needs),
892
+ so nothing ran. Set AGENTRUN_DOCKER_IMAGE to an image that has them and restart the server. For video (chrome, ffmpeg,
893
+ ffprobe, hyperframes), build the media image: ...
894
+ ```
895
+
896
+ Nothing is installed and nothing falls back. A provider whose image is a setting of its own (Daytona's
897
+ `AGENTRUN_DAYTONA_SNAPSHOT`) is named in the fix instead. Only a sandbox takes `needs` (422 `not_allowed` on another
898
+ kind; a stored setting or a launch's computer that has them on another kind fails the run at claim in words, nothing
899
+ started); an agent without it is checked for nothing, and its revision is as before. A template states them as `needs`
900
+ beside `computer: [shell]` ([templates](templates/README.md)), and apply writes them onto the sandbox it picks, or
901
+ refuses where the shell here is no sandbox.
902
+
834
903
  **A lost sandbox.** A run's sandbox can be lost mid-run: its vendor deleted it (from its own console or API), or no
835
904
  longer has it. The tool call in flight when the loss is confirmed fails with code `gone`: `the computer <name> was lost
836
905
  while this call ran, and it was not run again: <the provider's words>. A new computer starts at the next call.` It is
@@ -888,7 +957,9 @@ one computer that it keeps between runs, instead of a fresh one for each run:
888
957
  **A video of each run.** `computer: {"kind": "desktop", "provider": "e2b", "record": true}` records the computer's
889
958
  screen during each of the agent's runs. Off by default; a desktop, a phone or a browser (a sandbox is 422). A browser's is
890
959
  each session's page, one file per session (its computer), from the live view's own screencast of it, which the viewer
891
- shares: frames come as the page changes.
960
+ shares: frames come as the page changes. `GET /v2/computers` says per kind whether its runs can record here, in
961
+ `record` (`{"available": false, "why": "..."}` for a sandbox, for no computer, and for every kind on a server with no
962
+ `ffmpeg` on its PATH), and the console's Recording switch reads it.
892
963
 
893
964
  - **It shows everything on the screen.** That includes what a person types while they have taken over the computer, and
894
965
  any password, key or private page shown on it. Pixels can't be redacted. Turn it on only for an agent whose screen
@@ -1289,7 +1360,8 @@ Custody, as for a per_run MCP server's `mcp_auth`:
1289
1360
  keeps failing, the message waits untaken and is delivered again, never run on the key held before it or the
1290
1361
  server's. A stop or cancel sent after it still reaches the run. A message without one keeps the key the run holds.
1291
1362
 
1292
- **The revoke-at-turn-end contract.** The write that ends a run's turn erases its key, and the run reports the turn
1363
+ **The revoke-at-turn-end contract.** The write that ends a run's turn erases its key from the store (the runner's
1364
+ redactor keeps the value in memory to cut it), and the run reports the turn
1293
1365
  ended (`run.ended`, the run's `completed`, `failed` or `stopped` status) only after that write. Every model request
1294
1366
  tied to the turn finishes before then: the job, its subagents, its learned workflows' nodes, its end-of-run compile
1295
1367
  turn. So a caller may revoke the key as soon as it sees the turn end, and no request of that run will
@@ -1306,6 +1378,47 @@ Jev and the other decision providers run on their own keys (`TYPESAFE_API_KEY`,
1306
1378
  `OPENROUTER_API_KEY`), which are not model keys and which a run's key does not replace. On a run that brings its own
1307
1379
  key, no model key is on the env its decision nodes run under, so Jev's route on an openrouter.ai gateway's key is off.
1308
1380
 
1381
+ ### Per-run tool keys
1382
+
1383
+ A caller can hand a run its own tool keys with `keys` on `POST /v2/runs`, `POST /v2/agents/{agent_id}/runs` and
1384
+ `POST /v2/runs/{run_id}/messages`: `{"PARALLEL_API_KEY": "..."}`. The run's tools use each one in place of the server's
1385
+ key of that name. The names a run can carry are the tool keys: `PARALLEL_API_KEY` (`web_search`, `web_fetch`, Parallel
1386
+ decisions), `MONID_API_KEY`, `BROWSERBASE_API_KEY` with `BROWSERBASE_PROJECT_ID` or `KERNEL_API_KEY` (`browser`) and
1387
+ `TYPESAFE_API_KEY` (Jev). A model key goes in `model_key`, above.
1388
+
1389
+ ```sh
1390
+ curl -s http://127.0.0.1:7340/v2/agents/searcher/runs -H "Authorization: Bearer $AGENTRUN_TOKEN" \
1391
+ -H 'content-type: application/json' \
1392
+ -d "{\"input\": {\"content\": \"Find the release notes\"}, \"keys\": {\"PARALLEL_API_KEY\": \"$CUSTOMER_PARALLEL_KEY\"}}"
1393
+ ```
1394
+
1395
+ - A name that is not a tool key, or one no tool of the run's revision reads (its tools, its workflow's nodes and
1396
+ decision providers, and the keys its template declares), is 422 at `keys.<NAME>`, the value never echoed. So is a
1397
+ value that is not text of 8 or more characters with no space or control character (`invalid`): the runner could
1398
+ not cut a shorter one from what the run writes.
1399
+ - The keys are taken out of the body before anything reads it, as `model_key` is: never in the run's saved body, its
1400
+ timeline, its view, a log or an `Idempotency-Key`'s fingerprint. They are sealed with the run's launch, opened at
1401
+ each claim for its tools alone, and erased from the store by the write that ends its turn; the runner's redactor
1402
+ keeps each value in memory to cut it. Since no read after that could cut them, the runner cuts them from everything
1403
+ the run writes, as it writes it.
1404
+ - A message's `keys` replace the run's in the message's own write, read from the run's next claim on; a turn still
1405
+ going keeps the keys it opened. `keys: {}` leaves the run none. A message without them keeps the run's, which are
1406
+ none once its last turn ended.
1407
+
1408
+ **Tool keys each run brings: `AGENTRUN_RUN_KEYS=1`.** Off, a template's apply refuses a tool key the server does not
1409
+ hold (409, as before). With `1`, a template's apply makes its agent though a tool key it declares is not set here, with
1410
+ a warning, and each run of that agent must bring the key in `keys`: without it, the run is 409 `agent_not_runnable` at
1411
+ `keys.<NAME>` before anything is made, and so is a message that would start a turn. Keys the server holds are still
1412
+ used by runs that bring none. A trigger's firing brings no keys, so no trigger is made whose firings would start or
1413
+ message such runs without them: the apply skips the template's triggers with a warning at `triggers.<N>`
1414
+ (`not_set_up_here`, the apply still 201), unless the [launch hook](#launch-hook) is set, which hands each firing to
1415
+ your backend to start the run with its keys; `POST /v2/triggers`, or a `PATCH` that moves a trigger, is 409
1416
+ `agent_not_runnable` naming the keys for a trigger that would start runs of the agent with no hook, or message one of
1417
+ its runs, hook or not. `MONID_API_KEY` stays the server's even with
1418
+ the setting on: an agent's monid tools are checked with it when the agent is saved, before any run, so a template that
1419
+ grants them is still refused at its apply (409 at `secrets.MONID_API_KEY`) where the server has none. A run can still
1420
+ bring its own monid key to use in place of the server's.
1421
+
1309
1422
  ### Direct Particle-1
1310
1423
 
1311
1424
  Save a Particle key in **Settings → Model keys → Particle**, then select `particle/particle-1` with the **Pi** harness.
@@ -1468,7 +1581,7 @@ agent_not_runnable`, with `details.unbound` and `details.missing`).
1468
1581
  | `ask_person` | Ask the person who started the run; the turn ends until a message answers | nothing | no, no |
1469
1582
  | `web_fetch` | Read one web page from a public host through the guarded direct fetch, or through Parallel's extract where Parallel is picked ([search and fetch](#search-and-fetch)), a part at a time: `{url, offset?, max_chars?}` in, a Page out, `{ok, url, status, title, text, chars, truncated?, original_chars?, beyond_read?, offset?, next_offset?, html_chars?, converted?, links, links_omitted?, via, parallel?, refused?, error?}` | nothing (`PARALLEL_API_KEY` for Parallel, one billed extract a page a run) | yes, yes |
1470
1583
  | `web_search` | Search the web, natively where the harness or the model's provider can, else through Parallel where the server holds its key, else keyless through Exa, or through the provider picked ([search and fetch](#search-and-fetch)): `{query, n?}` in, `{provider, query, results: [{url, title, snippet, published?}], text?}` or `{error}` out | nothing (`PARALLEL_API_KEY` for Parallel) | yes, yes |
1471
- | `web_save` | Download one file from a public URL into the run's `work/` and keep it there, for a link that expires (a generated image, audio or video): `{url, path}` in, `path` relative to `work/` and a bare name under `media/`; `{ok: true, path, bytes, content_type, url}` or `{ok: false, url, refused \| error}` out. Never overwrites | nothing | no, no |
1584
+ | `web_save` | Download one file from a public URL into the run's `work/` and keep it there, for a link that expires (a generated image, audio or video): `{url, path}` in, `path` relative to `work/` and a bare name under `media/`; `{ok: true, path, bytes, content_type, duration_s?, url}` or `{ok: false, url, refused \| error}` out, `duration_s` an mp3, wav, mp4 or m4a's length in seconds read from its bytes. Never overwrites | nothing | no, no |
1472
1585
  | `browser` | A hosted browser, Browserbase's or Kernel's, on pi-browser's durable adapter: `snapshot`, `run`, `screenshot`, `browser_read`, `browser_release`, `browser_relaunch`, `browser_downloads` and `browser_upload` (into and from the run's `work/`); Kernel keeps no downloads, so a run on Kernel has no `browser_downloads` | `BROWSERBASE_API_KEY` and `BROWSERBASE_PROJECT_ID`, or `KERNEL_API_KEY` | yes, no |
1473
1586
  | `monid:<provider>/<endpoint>`, `monid:<provider>/*` | One monid endpoint, or every endpoint monid lists for a provider (at most 50), each pinned at the save and run as a tool of its own, paid per call from the monid wallet: `{body?, queryParams?, pathParams?}` in, the run's `output`, `price` and `cost` out ([monid](#monid)) | `MONID_API_KEY` | no, no |
1474
1587
  | `pdf_pages` | A workflow call only: `{path, maxPages?, dpi?}` in, `{name, pageCount, dpi, pages: [{page, image}], text}` out. Draws a document's first pages (3 by default, at 110 dpi) as PNGs under the run's `work/pages/<stem>/<dpi>/` (`<stem>`: the document's path below its directory made one name, with a short hash, so two documents of one file name never share pages), the dpi lowered so a page's long side is at most 1568 px, with its text (`pdftotext`, cut at 20,000 characters). A PNG or JPEG passes through as one page, scaled down to 1568 px. `path` is under `--documents` or the run's `work/`, never outside | `pdftoppm`, `pdftotext` | no, yes |
@@ -1516,8 +1629,9 @@ loop), at most 200 MiB in at most 10 minutes, into the run's Workspace (a bare n
1516
1629
  absolute path and a link are refused, and a path already in use is refused, never overwritten. The file is written once,
1517
1630
  after the whole download, so a failed one leaves nothing. An image, audio or video is saved only when its bytes, the
1518
1631
  declared type and the path's extension agree (`media/card.png`, never `media/card`); any other type only to a path whose
1519
- extension names the declared type. It makes no paid request and is never run again after a crash. Only an agent that
1520
- names `web_save` has it; no workflow node or call node may name it.
1632
+ extension names the declared type. A saved mp3, wav, mp4 or m4a answers its length in seconds, `duration_s`, read from
1633
+ its bytes (`media-duration.ts`); other files answer none. It makes no paid request and is never run again after a crash.
1634
+ Only an agent that names `web_save` has it; no workflow node or call node may name it.
1521
1635
 
1522
1636
  On another harness, every host tool's result reaches the model within the host's bound of 120,000 characters
1523
1637
  (`HOST_RESULT_MAX_CHARS`, `@parcha/agentrun-kernel`): the kernel's tool bridge cuts a longer one, its start with a line
@@ -1975,8 +2089,8 @@ its charge unknown, as any cut call's) and given back when monid refused it unru
1975
2089
  which `maxCost` 0 lets through) is the call, settled at its charge. Under a cap, a read that ends with its charge unknown
1976
2090
  (no answer, or `FAILED` with no cost) stops the run at once, "monid may have charged for <name> and did not say how
1977
2091
  much, so this run's cap can't be kept; the run stopped": its $0 hold bounds nothing. Its charge can pass the estimate: then it is booked
1978
- as charged, and the run stops at once, failed, in the words "monid charged $X, more than the $Y held; the run stopped".
1979
- A run's spend cap is a hard stop for everything but that one charge. A mark a crash left unsettled leaves the run's cost unknown, as a
2092
+ as charged and logged ("monid charged $X, more than the $Y held"), and the run goes on while its charges fit its cap; one
2093
+ that takes them past it stops the run at once in the cap's words ([Spend cap](#spend-cap)). A mark a crash left unsettled leaves the run's cost unknown, as a
1980
2094
  model request a crash cut does, and its cap counts it at its held figure, never $0. A run that may have charged and says
1981
2095
  no cost (`FAILED`, `TIMED_OUT`, one stopped by the run or the wait, one whose sending failed) books an unknown charge,
1982
2096
  never $0: the run's cost reads `null`, and under a cap it counts at its held figure, the bound the cap let it go at, as
@@ -2085,6 +2199,15 @@ Streamable HTTP with the official MCP SDK client (`@modelcontextprotocol/client`
2085
2199
  value}}` (up to 8). An `oauth` server is signed in to first ([below](#signing-in-with-oauth)), then previewed by name.
2086
2200
  `url` is `https`, or `http` on loopback.
2087
2201
 
2202
+ A server advertising MCP resources also lists three AgentRun-generated read operations, including when it has no
2203
+ tools: `agentrun_list_resources` (`resource: "list"`), `agentrun_list_resource_templates` (`resource: "templates"`)
2204
+ and `agentrun_read_resource` (`resource: "read"`). The first two take `{}`; read takes `{uri}`. They are granted,
2205
+ pinned and gated like tools, using the same destination credential, but dispatch MCP resource methods. URIs are
2206
+ passed to that server rather than fetched directly. Resource lists include all pages within 500 entries, 1 MiB
2207
+ and one call deadline; exceeding a bound fails without a partial list. Text uses the ordinary answer filing and
2208
+ credential scrub. A binary resource containing a connection credential is withheld. These three names are reserved:
2209
+ an upstream ordinary tool with one of them makes preview or save fail. A name alone never grants resource authority.
2210
+
2088
2211
  ### Composio
2089
2212
 
2090
2213
  Composio is an MCP server like any other, so it needs no adapter of its own. Settings → MCP servers has a Composio
@@ -2126,8 +2249,9 @@ curl -X POST "$BASE/v2/agents/$AGENT/runs" -H "authorization: Bearer $TOKEN" -H
2126
2249
  `composio_user_id` is a Composio user id; `connected_account_id`, optional, is one of that user's connected accounts
2127
2250
  (`ca_...`), and without it Composio picks the user's account for the toolkit. Each request to the server carries that
2128
2251
  user and account, the Composio key staying the server's own. The binding is kept as a `per_run` server's headers are:
2129
- sealed into the run's launch, erased by the write that ends the run, never on the server's row, the run's view, its
2130
- timeline, its trace or a log line, and its values are cut from whatever the run shows. A message's binding replaces the
2252
+ sealed into the run's launch, erased from the store by the write that ends the run, never on the server's row, the
2253
+ run's view, its timeline, its trace or a log line, and its values are cut from whatever the run shows (the runner's
2254
+ redactor keeps them in memory to cut them). A message's binding replaces the
2131
2255
  run's for the turn it starts. A run that names no account has its calls of the server answered, unsent, that it was
2132
2256
  handed none, so a per-run server never calls as a default account. A malformed user or account is `422 input_invalid` at
2133
2257
  `mcp_auth.<server>.composio_user_id` or `.connected_account_id`, and so is a binding to the preset's default user
@@ -2199,9 +2323,10 @@ A per_run save keeps no secret, so the API token may make it, as it may preview
2199
2323
  credentials such a server receives are the ones each run's own caller hands it. The run's calls of that server carry
2200
2324
  those headers, and only to the origin the server had when the run was started. The
2201
2325
  credential is sealed into the run's launch record under `AGENTRUN_SEAL_KEY` (bound to the run's id), read at each claim, so
2202
- a resume, a restart or a lost lease uses it again, and erased by the write that ends the run. It is never in the run's
2203
- saved body, its timeline, its view, a log line or an `Idempotency-Key`'s fingerprint (a retry with a new credential
2204
- answers the first request's run), and its values are cut from whatever the run shows. `POST /v2/runs/{run_id}/messages`
2326
+ a resume, a restart or a lost lease uses it again, and erased from the store by the write that ends the run. It is never
2327
+ in the run's saved body, its timeline, its view, a log line or an `Idempotency-Key`'s fingerprint (a retry with a new
2328
+ credential answers the first request's run), and its values are cut from whatever the run shows (the runner's redactor
2329
+ keeps them in memory to cut them). `POST /v2/runs/{run_id}/messages`
2205
2330
  takes `mcp_auth` too: it replaces the run's credentials in the message's own write, so the turn the message starts (a
2206
2331
  steer into a working run from its next model request, or a follow-up that opens an ended run again) calls with them. A
2207
2332
  name that is not a saved per_run server is `422` at `mcp_auth.<server>`, and no run starts. A run handed no credential
@@ -2905,8 +3030,9 @@ approve, such a send is refused in those words.
2905
3030
  ## Templates
2906
3031
 
2907
3032
  A template package makes a working agent in one call: its definition, its skills and rules, and its triggers, from a
2908
- folder the server ships. `GET /v2/templates` lists them; `POST /v2/templates/{name}/apply` with `{parameters,
2909
- overrides?: {model}}` makes one, or nothing when a check fails (a trigger refused archives the agent it made). A
3033
+ folder the server ships. `GET /v2/templates` lists them; `GET /v2/templates/{name}` reads one whole (its instructions and
3034
+ every skill file, as an import shows them); `POST /v2/templates/{name}/apply` with `{parameters, overrides?: {model}}`
3035
+ makes one, or nothing when a check fails (a trigger refused archives the agent it made). A
2910
3036
  package's `version` is SemVer and never `definition.version`, the agent's revision number. A package's `composio` trigger names its
2911
3037
  need's toolkit as its `server` (`server: github` for a required `{source: composio, toolkit: github}` need), and apply makes it
2912
3038
  on the saved Composio server that need maps to, its `config` filled from the parameters it names
@@ -2959,11 +3085,12 @@ failed, 2 when nothing ran. The runner, the graders and the report are in
2959
3085
  | `GET /agents/{id}/home/files`, and `GET`, `PUT`, `DELETE` on a file's path below it | The files in the agent's home, listed, read, written and deleted ([agent home](#agent-home)). This server's own routes (`x-agentrun-serve: "home/1"`). |
2960
3086
  | `GET /stats` | This server's own route, outside the contract (`x-agentrun-serve: "stats/1"`): the agents, the runs (`total`, `active`, `needs_input`, `failed`, `needs_review`, `status_unknown`), each agent's run count, the cost and what is archived, read from the agent store's aggregates and verified source reports; source completion counters are read when needed to separate overlapping usage. Archived agents and runs are left out of every number but `archived`. A completed or cancelled run counts only in `runs.total`, but for an escalated one (completed, waiting for a person's review), which `needs_review` (`stats/3`) counts; `failed` never does. Each running run is in exactly one of `active` (queued or working) and `needs_input` (`input_required`), both from the runs this server holds, and `status_unknown`: a running run it does not hold, or holds as ended before its end is written. `cost.usd` sums the runs that ended with a cost and is null when none did, never $0, with `basis` (`reported`, `estimate` or `unpriced`: [A run's cost](#a-runs-cost-its-tokens-and-its-basis)), or null beside a null `usd`; `unknown_runs` counts the rest. `analytics` (`stats/2`) sums the runs' metrics over the runs not archived that the `from` and `to` query parameters (RFC 3339 date-times to the millisecond, an impossible one or a finer fraction refused; runs started in [`from`, `to`)) and `agent` pick, each optional, 400 when malformed: `filter` echoes them; `totals` (runs, completed, an escalated run included, `needs_review` (`stats/3`), failed, never an escalated run, `runs_with_metrics`, `runs_with_token_metrics`, tokens and each token kind, requests, unmetered, `cost_usd` and `unknown_cost_runs`), `time` (`wall_ms` over the ended runs, `active_ms` where metrics have it), `by_harness_effort`, `by_day` (UTC), `by_source` (`live` or the import source) and the top 20 `tools`. Token totals sum only runs with every token counter reported, counted by `runs_with_token_metrics`; other runs remain in `runs` but cannot hide the known partial total. If runs exist but none reports a complete count, `tokens` is null; an empty scope is zero. Individual token-kind totals remain null when a measured run reports that counter as unknown. `analytics.usage` combines recorded runs and connected source reports ([Unified token usage](#unified-token-usage)). `learning` (`learning/1`) counts the runs that tried to learn over the same filters, from the store ([Learning](#learning)). The query bounds `analytics` and `learning` alone. |
2961
3087
  | `GET /runs/{id}/graph` | A workflow run drawn, live: its workflow, the DSL's `workflowGraph`, each node's state (a map's items with their labels and the branch each route took for them, a route's branch), every decision with its receipt (answers, evidence, the state the judge saw, image links), every call with its input and output, and the totals (cost, null when any part is unknown). While the run goes it reads the run process's `live.json`, rewritten every 300 ms, never the run's store, which the process holds; once it ended, its store is read lock-free, so a poll never waits on it and never answers `home_busy`. An agentic run has none (`404`). |
2962
- | `GET /runs/{id}/usage` | This server's own (`runusage/1`): what one run cost, line by line: its model requests by model and provider, its paid tool calls by who charged for them, its browser time by provider, its computers' time by provider and resource (`runusage/4`), joining to its `cost.usd` ([A run's cost, line by line](#a-runs-cost-line-by-line)); beside them its browser sessions (`runusage/2`) and the computers it made, each from its create to its proven delete (`runusage/3`). Lines once the run ended; `reason` says why there are none. |
3088
+ | `GET /runs/{id}/usage` | This server's own (`runusage/1`): what one run cost, line by line: its model requests by model and provider, its paid tool calls by who charged for them, its browser time by provider, its computers' time by provider and resource (`runusage/4`), each line by the attempt it was made in and whether that attempt is billable, with `infra_usd` beside them (`runusage/5`), joining to its `cost.usd` ([A run's cost, line by line](#a-runs-cost-line-by-line)); beside them its browser sessions (`runusage/2`) and the computers it made, each from its create to its proven delete (`runusage/3`). Lines once the run ended; `reason` says why there are none. |
2963
3089
  | `GET /runs/{id}/trace` | A run's trace, for a person who debugs it: each model request that answered and each tool call as one span, in the order they started. A span has its `kind` (`model` or `tool`), its `name` (the model, or the tool), when it started and ended, how it ended (`status`), and the span it ran under (`parent_id`: the request that made a call, the call a subagent's request was started by). A model request also has its `tokens` (`input` not read from cache, `cache_read`, `cache_write`, `output`, and `reasoning` where reported), and its `usd`. A tool call also has the head of its arguments and of its output, as its Timeline rows show them, and what was charged under it (`usd`, `charged`, `not_metered`). A call that asked for approval ends as its approval did: `waiting` until it is answered, `refused` on a deny, `interrupted` when it was withdrawn with its run. Nothing is measured again or estimated: `model_requests` says what the run's record keeps. `priced`: each request is a span with its cost. `tokens_only`: a workflow run. Its model nodes' requests carry tokens and no cost, since the run's cost is its booking's; each of its decisions (a judge's, a route's, a verify's request) is a span too (`decision: true`), named by the model its provider answered with and labelled by its node, with its own cost. `not_recorded`: a CLI harness's record keeps no request, so its trace is its tool calls. A computer's own time is its provider's to bill and is in no span. Readable while the run goes; one read serves the run's first 2,000 spans and counts the rest in `dropped`. Its words are cut as the Timeline's are, and a run whose handed sign-in can't be read back is refused (`403`), as its graph is. The console's Dev tools tab reads it. |
2964
3090
  | `POST /runs/{id}/pause`, `POST /runs/{id}/resume` | A workflow run: what is in flight finishes, and no node, model call or decision starts until it is resumed. Its status reads `paused`, and stays so across a server restart. An agentic run is `501`, an ended one `409`. |
2965
3091
  | `POST /workflows/validate` | `{workflow, tools?}`: every issue a save would refuse (`[{path, code, message}]`, the DSL's validation with code not run) and what this host lacks as `warnings`. Writes nothing. A refused save's `422` carries each issue as a field under `definition.workflow`, with its `code`. |
2966
3092
  | `GET /settings/tool-keys`, `PUT` and `DELETE /settings/tool-keys/{id}` | [Tool keys](#tool-keys), this server's own routes (`x-agentrun-serve: "toolkeys/1"`): each key's fields by name and where each is set, never a value; save one sealed, or forget it. |
3093
+ | `GET /settings/mcp-server-names` | The saved MCP servers' names alone (`mcpservernames/1`), sorted, with the token, also [API-only](#api-only): no URL, auth type, header or tool. |
2967
3094
  | `GET /settings/mcp-servers`, `POST /settings/mcp-servers/preview`, `GET`, `PUT` and `DELETE /settings/mcp-servers/{name}`, `POST .../{name}/refresh`, `POST .../{name}/oauth/start`, `GET /settings/mcp-servers/oauth/callback` and `GET .../oauth/client.json` | [MCP servers](#mcp-servers), this server's own routes (`x-agentrun-serve: "mcpservers/1"`): preview a remote MCP server's tools, save it with its credential sealed, read it back without the credential, refresh its tools, forget it, or [sign in to it with OAuth](#signing-in-with-oauth) (the callback and the client document take no token). |
2968
3095
  | `GET /settings/tools`, `PUT /settings/tools` | This server's own: the providers of `web_search`, `web_fetch` and `browser` ([search and fetch](#search-and-fetch)). |
2969
3096
  | `GET /runs/{id}/browser` | This server's own (`x-agentrun-serve: "liveview/1"`): the run's live browser view for the owner, `{state: "off", reason}`, `{state: "none"}` or `{state: "live", viewer}` ([the live view](#the-browsers-live-view)). |
@@ -3085,6 +3212,9 @@ serves these routes alone:
3085
3212
  - an agent's Archil disk (`GET` and `DELETE /agents/{id}/archil`);
3086
3213
  - the [delete of an agent another system owns](#deleting-an-agent-another-system-owns) (`DELETE /agents/{id}`), for
3087
3214
  the backend whose inline runs made it;
3215
+ - the [purge of a run](#purging-a-run-or-an-agent-made-here) (`DELETE /runs/{id}`) of such an agent, for that
3216
+ backend: it erases one user's runs where deleting the agent, which every user's runs share, would take them all. A
3217
+ run of an agent made here is refused, as every address not listed here is;
3088
3218
  - the computer settings' two reads, for a backend to check before it launches: `GET /computers` (each provider, its
3089
3219
  key names and whether each is saved, and whether it is ready) and `GET /workspace/archil` (whether runs' folders are
3090
3220
  on Archil, and whether its account key is saved). Neither answers a key's value. Their writes, tests and key choices
@@ -3092,10 +3222,23 @@ serves these routes alone:
3092
3222
  - what an agent learned, for the backend whose runs it learned from: the loop's compile turns
3093
3223
  (`GET /agents/{id}/learning/loop`), each learned workflow's promotion and what serves
3094
3224
  (`GET /agents/{id}/learning/promotions`), the cost per run (`GET /agents/{id}/learning/cost`) and a run's learning
3095
- (`GET /runs/{id}/learning`), each cut of the host's secrets as the console's reads are;
3225
+ (`GET /runs/{id}/learning`), each cut of the host's secrets as the console's reads are; and its reset
3226
+ (`DELETE /agents/{id}/learning`, the agent and its runs kept), its one learning write served here;
3096
3227
  - a run's hosted machine fetching this server's computerd build (`GET /computers/daemon`), with the token its create
3097
3228
  minted;
3098
3229
  - `GET /capabilities`, `GET /health`, `GET /usage` and `GET /capacity`;
3230
+ - the names of the MCP servers saved here (`GET /settings/mcp-server-names`, `{names}`), never a URL or a credential:
3231
+ a backend that builds runs from saved servers holds back a job whose server isn't saved, before its launch is refused;
3232
+ - a deploy, for a backend that deploys agents here: a template's apply (`POST /templates/{id}/apply`, a redeploy with
3233
+ its `agent_id`), the agent's read (`GET /agents/{id}`), its revisions (`GET /agents/{id}/revisions`), a rollback
3234
+ (`POST /agents/{id}/current`), and its archive and unarchive (`POST /agents/{id}/archive`, `/unarchive`). The archive
3235
+ is what its delete (`DELETE /agents/{id}`) needs first. A run here starts through the backend, on its keys and
3236
+ budget, never on this server's own model key. So with the [launch hook](#launch-hook) set, the apply makes the
3237
+ package's schedule and feed triggers, and each firing goes to the backend, which starts its run through the API; the
3238
+ unarchive turns them on again, as no trigger route is served to. Without the hook it makes neither (`not_set_up_here`: set
3239
+ the hook, or start those runs through the API). A webhook, GitHub, Composio or email trigger is never made here, hook
3240
+ or not, since this profile refuses the hook or setting each needs (`not_an_option`). Each skipped trigger is a warning
3241
+ under `warnings` (`triggers.<i>`), and the dry run (`dry_run: true`) plans it as `skip` in the same words;
3099
3242
  - a run's desktop or phone, for a backend that shows its user the live view and lets them take over: see below.
3100
3243
 
3101
3244
  Here a run's computer routes take the server's token. `POST /runs/{id}/computer/viewer` mints a 5-minute link on
@@ -3103,12 +3246,50 @@ Here a run's computer routes take the server's token. `POST /runs/{id}/computer/
3103
3246
 
3104
3247
  Every other address is `404 not_found`, answered before the request is read further: the console at `/` and its
3105
3248
  assets, sign-in and setup, every `/settings` route, `POST /mcp`, triggers and their
3106
- `POST /hooks/{id}`, agents, templates, `/openapi.json`, `/llms.txt` and a browser's live view. It has no accounts: there is no
3107
- page to sign in to, so no setup code is printed. The token works as it does on every route served. Unset, `0` or
3108
- `false` serve the whole server, as before; any value other than these and `1` or `true` stops the start, in words.
3249
+ `POST /hooks/{id}`, the agents list, an agent made or edited through `/agents`, the templates list and every other
3250
+ template route, `/openapi.json`, `/llms.txt` and a browser's live view. It has no accounts: there is no page to sign in
3251
+ to, so no setup code is printed. The token works as it does on every route served. Unset, `0` or `false` serve the
3252
+ whole server, as before; any value other than these and `1` or `true` stops the start, in words.
3253
+
3254
+ So on an API-only server a run is launched inline (`POST /runs` with its definition), on an agent a template's apply
3255
+ made, or on an agent made before the profile was turned on.
3109
3256
 
3110
- Its routes for agents are refused too, so on an API-only server a run is launched inline (`POST /runs` with its
3111
- definition), or on an agent made before the profile was turned on.
3257
+ ### Launch hook
3258
+
3259
+ For an install that hosts agents for other people, where the host decides who pays for each run and with which keys,
3260
+ set `AGENTRUN_LAUNCH_HOOK_URL` to the host's address and `AGENTRUN_LAUNCH_HOOK_SECRET` to a Standard Webhooks secret
3261
+ (`whsec_` and 32 random bytes in base64; it is one of the server's own secrets, never a run's). Each trigger firing that
3262
+ would start a run (a schedule, a feed, a webhook, Composio, GitHub or email trigger, or Run now) is then POSTed to the
3263
+ host, and this server starts no run for it:
3264
+
3265
+ ```json
3266
+ { "firing_id": "fir_...", "trigger_id": "trg_...", "agent_id": "digest", "revision_id": "rev_...",
3267
+ "input": { "content": "Summarize yesterday's issues.\n\n(Started by the schedule ...)" },
3268
+ "fired_at": "2026-06-01T00:10:00Z" }
3269
+ ```
3270
+
3271
+ The POST carries `webhook-id` (the firing's id, the same if it is handed again), `webhook-timestamp` and
3272
+ `webhook-signature` as [webhooks](#webhooks) do: check them with any Standard Webhooks library before reading the
3273
+ body. The host starts the run with `POST /v2/agents/{agent_id}/runs`, giving the input, its own `model_key`, `keys` and
3274
+ `max_cost_usd`, and `"trigger_firing": { "trigger_id": ..., "firing_id": ... }` as it was sent, and answers 2xx within
3275
+ 10 s. It can start the run before it answers or after: a firing it answered 2xx with no run yet reads `sent` with
3276
+ `start_by`, 10 minutes after that answer, takes that one start until then, and is refused with 422 `not_due` after.
3277
+ The 10 minutes run from the answer, not from `fired_at`, so a firing that reaches the host late (a catch-up, one that
3278
+ waited on `max_active_runs`, one handed again after a restart) gets the same time; the server never hands a `sent`
3279
+ firing over again. That run is
3280
+ the firing's, as one this server started would be: it names the trigger and the firing, carries the trigger's title and
3281
+ input origin, is capped, and the firing reads `started` with it, so the trigger's overlap check and `max_active_runs`
3282
+ count it. The firing is the run's key, so a second start for the same firing answers the same run and the request
3283
+ takes no `Idempotency-Key` (422 with one); a firing that is not being handed over (skipped, or one of another agent's
3284
+ triggers) is refused with 422. Until its run starts, a `sent` firing is one the overlap check cannot see. Any other
3285
+ answer, a redirect included (it is not followed), no answer in 10 s, or no connection, and the firing reads `skipped`
3286
+ with why, unless the host started its run by then; a skip is no failure and never turns the trigger off, and the
3287
+ server does not try that firing again. A firing the server's stop cuts short stays due and is handed again at the next
3288
+ start, under the same `webhook-id`. A `message_run` target starts no run and is unchanged. The start prints the hook's
3289
+ origin, never its path or the secret. The hook is `https`: a firing's input can carry a person's data, and the
3290
+ signature proves who sent it, not that no one else read it, so plain `http` is taken only for 127.0.0.0/8, `::1` or
3291
+ `localhost`. One of the two set without the other, a URL that is not https (or http to this machine) or holds a user
3292
+ or password, or a secret that is not a `whsec_` one of 24 bytes or more stops the start, in words.
3112
3293
 
3113
3294
  ## Uploads
3114
3295
 
@@ -3485,12 +3666,23 @@ stays in every total.
3485
3666
  overwrites them. `VACUUM FULL` rewrites the table into a new file (under an exclusive lock), and the old file's
3486
3667
  blocks go back to the filesystem unwiped. Postgres's own WAL and its archived WAL keep the old values until they are
3487
3668
  recycled or expire, and backups keep them for their retention.
3488
- - Its agent's other runs and what the agent learned from it are kept. A promotion record keeps the run's id. The
3489
- agent's learning folder keeps what the run taught it: its merge's diff (`.agentrun/diffs/<run>.json`, with its
3490
- patches) and any feedback line it added to `corrections.md`, in the folder's history too. The run's purge removes
3491
- neither; the agent's purge (below) removes the whole folder.
3669
+ - Its agent's other runs and what the agent learned from it are kept. A promotion record keeps the run's id and the
3670
+ commits it names. A run's purge removes its diff file and its feedback line from the folder's current files, and the
3671
+ folder's history no longer serves its merge; the bytes stay in the folder's `.git` until a learning reset
3672
+ (`DELETE /v2/agents/{id}/learning`) or the agent's purge, which delete the folder whole. Each merge's feedback line goes in
3673
+ one commit by the host (none when nothing is left to remove), a line a person edited since stays, and another
3674
+ merge's diff that shows the line as context is written without it. The log and a workflow's revisions leave out its
3675
+ merges, known by the run the log names for each (its newest 200 changes). A purge takes each learned workflow whose
3676
+ `workflow.json` the run changed last (by the commits' run trailers over the whole history, past those 200) off main
3677
+ in one host commit, its whole folder: its file reads are `404`, no run lays it, and a read at an older commit
3678
+ (a champion by its digest, an SDK receipt's pinned commit, a later merge's diff, which shows its files as added)
3679
+ never serves its text. Each merge's scrub lands once, so a `DELETE` sent again
3680
+ after a stop takes no other run's same line, and a merge of the run made since is scrubbed by it. A second `DELETE`
3681
+ does this again. It covers the learning folder on this
3682
+ server; a Mode 2 agent's folder on an Archil disk keeps the run's text until a learning reset or the agent's purge.
3492
3683
  - It takes the owner's session (the password sign-in, or the console on a server bound to loopback) or the API token;
3493
- any other console session is `403 forbidden`, no credential `401`.
3684
+ any other console session is `403 forbidden`, no credential `401`. An [API-only](#api-only) server purges a run of
3685
+ an agent another system owns alone; a run of an agent made here is its profile's `404` there.
3494
3686
 
3495
3687
  An agent made here is purged the same way once archived: `DELETE /v2/agents/{id}`. Its revisions' content, name and
3496
3688
  description, learning, triggers, saved sign-ins, own computer, disk and folders go, and each of its runs is purged.
@@ -3907,8 +4099,10 @@ check closed.
3907
4099
  The bridge posts one `workflow_check` event with the reservation's `id` and `digest`, its execution `outcome`
3908
4100
  (`answered`, `handed_back`, `failed` or `skipped_write`), and its answer or reason. It does not choose whether the
3909
4101
  workflow passes. The server compares the answer with the immutable native completion and applies the same
3910
- `agree_min` and `alone_min` promotion policy. This initial SDK check uses **one independent native turn** (`n: 1`),
3911
- not the server-run agent's historical replay set. Agreement is whole-answer equality (JSON values or trimmed text), or equality of the owner's
4102
+ `agree_min` and `alone_min` promotion policy on the same evidence bar: the check decides once, on `compile_after`
4103
+ **independent native turns**, as a server check decides once on that many of the agent's inputs. Each turn is one row,
4104
+ kept on the promotion record (`check.turns`) while the check waits for the next turn the draft takes; the turn that
4105
+ makes `compile_after` decides on all of them. Agreement is whole-answer equality (JSON values or trimmed text), or equality of the owner's
3912
4106
  configured `agree_on` fields; there is no semantic model grader on this path. A paraphrase can therefore be held even
3913
4107
  when a person would consider it equivalent.
3914
4108
 
@@ -3916,8 +4110,10 @@ A start reserves a check only on a turn that can be its baseline: a JSON object
3916
4110
  schema (a prose task's input is resolved by the bridge), and a start whose task or instructions held a protected value
3917
4111
  reserves nothing. A reserved turn that still cannot be the baseline (cancelled or failed, incomplete, redacted or
3918
4112
  workflow-assisted evidence, no `workflow_check` report, or a shadow that `failed` or `skipped_write`) gives the
3919
- reservation back: the record stays `replaying` with no `runs`, counts it in `check.released`, and the next turn the
3920
- draft takes is checked. The fifth given-back turn stops the check with nothing checked (no recompile). A turn the
4113
+ reservation back: the record stays `replaying` with no `runs`, counts it in `check.released` (a cancel is never
4114
+ counted), and the next turn the draft takes is checked. A turn that lands starts the count again; five counted
4115
+ give-backs in a row hold the draft, never promoted and never stopped for good: the agent's next compile, after
4116
+ `compile_after` more runs, revises it, and the revision is checked afresh. A turn the
3921
4117
  backend never completes within an hour is decided as one failed input through the same check, so its hold asks the
3922
4118
  one recompile and a recompile's check that ends the same way stops. Connected checks' records say `via: "sdk"`;
3923
4119
  `check.fresh_reads` counts the shadow's `shadowReadFallback` reads.
@@ -3992,6 +4188,15 @@ with the token, an archived agent's too:
3992
4188
  - `GET .../learning/workflows/{name}/revisions` lists a learned workflow's revisions on `main`;
3993
4189
  `GET .../learning/promotions` its promotion records; `GET .../learning/loop` each compile turn; and
3994
4190
  `GET .../learning/cost` the agent's cost per run, run after run.
4191
+ - `DELETE /agents/{agent_id}/learning` resets the agent's learning: its learning folder whole (`corrections.md`, its
4192
+ workflows, their history and the audit ledger), here and on every Archil disk its runs used (`503` while one can't be
4193
+ reached), then its promotion records and grades. The agent and its runs stay,
4194
+ with their files, costs and each run's own learning, so the run list, `GET /stats` and `GET /usage` read the same (a
4195
+ served run keeps its share of its revision's compile and check); a run's learning diff goes with the folder (404);
4196
+ the next run takes the agent path, given nothing learned. It cancels the runs that exist only for learning (replays,
4197
+ audit shadows) and waits for them; while a run of the agent's own is still going it is `409 learning_busy` (each named
4198
+ in `details.runs`), and nothing is deleted. `204`, a second call and an agent that never learned included. The
4199
+ API-only profile serves it too.
3995
4200
  - `GET /runs/{run_id}/learning`: the run's learning whole (its seed, its merge, the corrections it added, the workflow it
3996
4201
  wrote, its compile turn's attempts and the checks' problems), `null` for a run that does not learn.
3997
4202
  `GET /runs/{run_id}/learning/diff`: a merged run's merge commit against its parent, each file's patch as git writes it
@@ -4150,6 +4355,60 @@ were reached. Nothing is priced here, and nothing is rounded to a billing increm
4150
4355
  `browser_sessions`. A run's computers made before this server kept them have none either. The records are kept in the
4151
4356
  store's `computer_intervals` table (keyed by provider and the provider's id), and a purge of the run keeps them.
4152
4357
 
4358
+ ### Attempts: what the infrastructure redid
4359
+
4360
+ A run's turn can be worked more than once. A runner that drains for a deploy hands its runs back mid-turn, a runner that
4361
+ dies leaves its claims to lapse, a runner that can't renew loses its claim, and a turn whose loop ended on its own is
4362
+ tried again. In each case another claim works the same turn again. It resumes from what the cut claim saved: requests
4363
+ already answered and calls already finished are reused, not sent again. What it does send again is each model request
4364
+ the cut claim sent and never finished, cut in flight or cut off by a crash. Those requests are the infrastructure's
4365
+ cost, not the task's.
4366
+
4367
+ The read says which is which (`runusage/5`). It does not change what anything costs: `total` and `cost.usd` still hold
4368
+ every line.
4369
+
4370
+ - Each line, browser session and computer interval has `attempt`: the attempt at its turn it was made in (1 for the
4371
+ turn's first, 2 for its first redo, and so on). A turn's charges are split into one line per attempt.
4372
+ - Each also has `billable`. It is false only for the model requests an attempt never finished when a later attempt
4373
+ worked its turn again. Everything else is billable: answered requests, paid calls, browser and computer time.
4374
+ - `infra_usd` is the sum of the lines that are not billable. It is 0 for a run with no such request. A request cut in
4375
+ flight never got an answer, so its cost is unknown, and `infra_usd` reads null for a run that has one, as `total`
4376
+ does. It is also null with no lines.
4377
+ - A run from before this server kept attempts reads `attempt: null` and `billable: true` on every line.
4378
+
4379
+ The attempts live in the store's `run_attempts` table: one row per claim, written in the claim's own transaction. Each
4380
+ row holds the claim's turn and attempt, and `cause`, which says why the attempt before it was cut:
4381
+
4382
+ | `cause` | What cut the attempt before |
4383
+ | --- | --- |
4384
+ | `drain` | Its runner closed (SIGTERM) and handed the run back. |
4385
+ | `crash` | Its lease ran out and nobody said why (its runner died). |
4386
+ | `lease_lapse` | Its runner was still there but could not renew the claim in time. |
4387
+ | `retry` | Its loop ended interrupted on its own, and the run was released to be tried again. A stopped run whose end was refused is no cut: the claim that retries the end runs no turn, so it starts a new one and redoes nothing. |
4388
+
4389
+ A turn is the work one claim starts afresh: the run's first, a follow-up's, or a resume after a park. A claim is a redo
4390
+ only of the claim it takes over, and only when that claim wrote its row. A runner of an earlier build, running beside
4391
+ this server through an upgrade, writes none. When the claim after it takes over, it starts a new turn, so no earlier
4392
+ recorded turn is read as redone.
4393
+
4394
+ Each part of the usage is matched to its claim this way:
4395
+
4396
+ - **Journal entries:** a claim's entries start at the run's next entry id at the moment it claimed. Anything written
4397
+ before the run's first recorded claim belongs to no attempt and stays billable, unless that claim was the run's first.
4398
+ - **Browser charges:** a charge whose booking a later claim recovered is the attempt's that wrote the charge, matched
4399
+ by its ref.
4400
+ - **Computer time:** a computer's time is split across the claims that held it, by each claim's window on the store's
4401
+ clock. A computer kept across a park is billed by the claim that resumed it. Its `unheld_quantity` is spread over those
4402
+ windows by their share of its life.
4403
+ - **Computer intervals:** each record's own `attempt` is the claim that made the computer.
4404
+
4405
+ Each model request a claim sends to this server's model gateway carries the run, turn and attempt as LiteLLM's
4406
+ spend-logs metadata, in the header `x-litellm-spend-logs-metadata` (LiteLLM v1.110.0 and later). For example:
4407
+ `{"agentrun_run_id":"run_…","agentrun_turn":1,"agentrun_attempt":2}`. A gateway's spend logs can then be matched to the
4408
+ run's lines call by call. "This server's model gateway" means `AGENT_MODEL_BASE_URL`, or `ANTHROPIC_BASE_URL` on its
4409
+ origin. The header is sent on pi's routes and Claude Code's; Codex's adapter takes no extra headers yet. It is never
4410
+ sent to a vendor's own endpoint.
4411
+
4153
4412
  ### Computer time
4154
4413
 
4155
4414
  A computer's time is priced the way providers bill it: by what the computer holds (its vCPUs, its memory, its GPUs, its
@@ -4200,12 +4459,23 @@ spend limit. A workflow definition keeps one the same way. The cap is checked in
4200
4459
  before each model request, the agent's and a compaction's alike, on every harness: what the run has spent so far, plus
4201
4460
  what each request still in flight is held at, plus the most this request can cost must stay within it, or the
4202
4461
  request is not sent and the run pauses ([below](#a-run-paused-at-its-cap)). The cap is a hard stop for everything but
4203
- the charge of a monid call priced by usage, which can pass the estimate it was held at: when it does, the run stops at
4204
- once ([monid](#monid)). An MCP tool counts only at the price saved for it (its server's `prices`); one with none is
4205
- not metered and bills its own account outside the cap. fal's generations are such calls: they bill your fal account at
4206
- fal's price for the model and the output, the fal presets save no price, and the cap does not count them. A template
4207
- that uses fal caps its fal spend itself, with an input such as `max_fal_usd` that it prices its plan against before the
4208
- first paid call. A request costs its input, plus the output it
4462
+ two charges that can pass what they were held at: a monid call priced by usage, which can pass monid's estimate
4463
+ ([monid](#monid)), and a fal job, booked at the units its output states, which can pass those its input asked for. Either
4464
+ is booked as charged; when that takes the run past its cap, the run stops at once in the cap's words, nothing run after
4465
+ it, and below the cap the run goes on. An MCP tool counts only at the price saved for it (its server's `prices`); one with none is
4466
+ not metered and bills its own account outside the cap. fal is counted: a job sent to a fal server (one saved with the
4467
+ toolkit `fal`, or at `mcp.fal.ai`) through `run_model`, `submit_job` or `submit_jobs` is priced before it is sent, at
4468
+ fal's unit price for its endpoint (the server's own `get_pricing`, read with the run's credential and kept five
4469
+ minutes) times the units the job's input states: its images, their megapixels, its text's characters, the seconds it
4470
+ names, or, for dubbing, lip-sync, voice isolation and speech-to-text, which fal bills by the length of the media they
4471
+ are given, that length, read from the file first. That price is held under the cap, a
4472
+ job the cap can't take is refused before it is submitted, and the job is booked as the run's tool cost, charged by the
4473
+ server, with the price and the count it came from. It is an estimate at fal's list price, not fal's invoice: fal
4474
+ reports no cost for a job, and a minimum charge, a discount or a rate that depends on a setting `get_pricing` does not
4475
+ list are not in it. A job whose units can't be known before it runs (one billed by compute time or tokens, one that
4476
+ names no size or length, media whose length can't be read, an endpoint with no listed price) is refused under a cap,
4477
+ in words that say why; with no cap it runs, booked as an unknown charge. A price saved for a fal tool takes the place
4478
+ of this. A request costs its input, plus the output it
4209
4479
  is sent with at the output price, plus any fee its tokens do not show (below). Its input is priced at its worst case:
4210
4480
  every input token at the higher of the input and cache-write prices, since the provider may bill any of it as a cache
4211
4481
  write and a cache can miss at any request. So no request passes the cap, a cache miss included: a request costs at most
package/dist/adapters.js CHANGED
@@ -284,7 +284,7 @@ export async function claudeOf(env, needs, load = loadClaude, sdkOf = (version,
284
284
  // The CLI runs Anthropic's own id, which it knows the limits and betas of, and sends it as it is, OpenRouter too
285
285
  // (providerFor's modelId); the key goes as the endpoint takes it, and the run is priced by the catalog entry of
286
286
  // whoever bills it (its priceModel).
287
- const endpoint = provider ? { origin: provider.origin, credential: provider.credential, auth: provider.auth } : { origin: "", credential: () => "" };
287
+ const endpoint = provider ? { origin: provider.origin, credential: provider.credential, auth: provider.auth, ...(provider.headers ? { headers: provider.headers } : {}) } : { origin: "", credential: () => "" };
288
288
  const priced = provider ? { ...needs, model: provider.priceModel } : native;
289
289
  // Its CLI checked off the event loop first (hashed and run as a child), so the server goes on answering: a pass is
290
290
  // kept, and the adapter's own check answers from it. A CLI that fails its pins is the adapter's to report, in its
@@ -1,7 +1,14 @@
1
1
  import { type PurgeKept, type Store } from "./store/index.js";
2
2
  /** The delete of an agent's learning: the server's is the learning module's deleteLearning over the agent's learning
3
- * folder (learn/delete.ts). Idempotent; refuses with LearningInFlight while learning work of the agent is in flight. */
4
- export type DeleteLearning = (store: Store, agentId: string) => Promise<unknown>;
3
+ * folder, and its folder on each Archil disk a launch of its runs named, a purged run's included (learn/delete.ts;
4
+ * server.ts learningDisksOf), and its records. Idempotent; refuses with LearningInFlight while learning work of the
5
+ * agent is in flight. A reset of the agent's learning (learning-reset.ts), whose agent and runs stay, keeps its reset
6
+ * ledger and watermark (`keepResetLedger`) and deletes the folder on the agent's own disk too (`agentDisk`), which the
7
+ * agent's delete removes whole in its step 3. */
8
+ export type DeleteLearning = (store: Store, agentId: string, options?: {
9
+ keepResetLedger?: boolean;
10
+ agentDisk?: boolean;
11
+ }) => Promise<unknown>;
5
12
  /** A point of a delete a test may stop it at (AgentDeleteHost.at). An agent's: after step 1, after step 2, in step 3
6
13
  * between a trigger's removal upstream and its settings', between its settings' and its row's, and in step 3 once its
7
14
  * triggers and the agent's first run are gone (a purge's: after its learning, then the same). A run's: once the runs
@@ -43,7 +50,8 @@ export interface AgentDeleteHost {
43
50
  madeFrom(runId: string): Promise<string[]>;
44
51
  /** What agent `agentId`'s learning copied from run `runId`, gone: the grades it keeps of the run dropped, its promotion
45
52
  * records' disagreements naming the run blanked, their decisions, numbers and run ids kept (learn/promote.ts
46
- * forgetRunCopies). */
53
+ * forgetRunCopies), and the run's text off its learning folder's current files (learn/commit.ts forgetRunText).
54
+ * Idempotent: a purged run's DELETE runs it again. */
47
55
  forgetCopies(agentId: string, runId: string): Promise<void>;
48
56
  /** What run `runId`'s spend reads from its journal, read before its purge removes it (store-reads/cap.ts). */
49
57
  kept(runId: string): Promise<PurgeKept>;
@@ -66,7 +74,9 @@ export declare function purgeAgent(host: AgentDeleteHost, agentId: string): Prom
66
74
  /** The setting that marks agent `agentId`'s purge begun and not finished (purgeAgent). */
67
75
  export declare const purgingKey: (agentId: string) => string;
68
76
  /** Purges run `runId` with every run made from it, as the header says. 404 not_found when it is not there; 409
69
- * run_not_final, nothing purged, while it or a run made from it is live. A purged run is no work. */
77
+ * run_not_final, nothing purged, while it or a run made from it is live. A purged run's only work is forgetCopies again,
78
+ * which finds nothing left once a purge finished it; its store scrub was marked before the purge changed a row
79
+ * (sqlite/store.ts #purging). */
70
80
  export declare function purgeRun(host: AgentDeleteHost, runId: string): Promise<void>;
71
81
  /** One delete of an agent at a time: a second DELETE of the same agent waits for the first, then finds it gone (404) or
72
82
  * finishes what the first left. `queued`, a test's seam: told each time a work waits behind another of its agent's,