@parcha/agentrun-serve 0.1.0-beta.59 → 0.1.0-beta.61

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 (250) hide show
  1. package/CHANGELOG.md +135 -0
  2. package/README.md +230 -120
  3. package/dist/acp-package.d.ts +4 -0
  4. package/dist/agent-delete.d.ts +6 -9
  5. package/dist/agent-delete.js +5 -3
  6. package/dist/agent-package.js +11 -1
  7. package/dist/api-only.d.ts +21 -3
  8. package/dist/api-only.js +41 -6
  9. package/dist/archil-routes.d.ts +4 -1
  10. package/dist/archil-routes.js +15 -12
  11. package/dist/archil-settings.d.ts +18 -8
  12. package/dist/archil-settings.js +35 -17
  13. package/dist/browser-person.d.ts +1 -1
  14. package/dist/browser-person.js +1 -1
  15. package/dist/calendar/tools.js +1 -1
  16. package/dist/chatgpt-plan.d.ts +4 -2
  17. package/dist/chatgpt-plan.js +13 -3
  18. package/dist/claude-login-token.d.ts +5 -0
  19. package/dist/claude-login-token.js +8 -0
  20. package/dist/claude-login.d.ts +49 -3
  21. package/dist/claude-login.js +140 -10
  22. package/dist/cli-learning/connections.js +1 -1
  23. package/dist/cli.js +42 -10
  24. package/dist/console/assets/{backend-BztxEAvb.js → backend-C9ffXUR5.js} +1 -1
  25. package/dist/console/assets/index-BnZV3lvW.js +639 -0
  26. package/dist/console/assets/{share-L84tlUDW.js → share-B1o5mJ56.js} +2 -2
  27. package/dist/console/assets/{styles-CaRKlHke.js → styles-D_znYrHR.js} +31 -31
  28. package/dist/console/assets/styles-fjQBFfMv.css +1 -0
  29. package/dist/console/index.html +3 -3
  30. package/dist/console/share.html +3 -3
  31. package/dist/decisions.d.ts +1 -1
  32. package/dist/decisions.js +2 -2
  33. package/dist/errors.d.ts +1 -0
  34. package/dist/errors.js +2 -0
  35. package/dist/factory-activity.d.ts +68 -0
  36. package/dist/factory-activity.js +153 -0
  37. package/dist/factory-runs.d.ts +11 -0
  38. package/dist/factory-runs.js +52 -0
  39. package/dist/filed-tool.d.ts +32 -0
  40. package/dist/filed-tool.js +122 -0
  41. package/dist/harness-check.js +2 -1
  42. package/dist/harness-keys.d.ts +1 -2
  43. package/dist/harness-keys.js +1 -2
  44. package/dist/harness-recipe.d.ts +13 -2
  45. package/dist/harness-recipe.js +30 -7
  46. package/dist/harness-sign-in.js +2 -1
  47. package/dist/harness-table.d.ts +9 -3
  48. package/dist/harness-table.js +11 -5
  49. package/dist/harness.js +6 -2
  50. package/dist/import-worker.js +2 -2
  51. package/dist/import.d.ts +9 -0
  52. package/dist/import.js +11 -1
  53. package/dist/key-refusal.d.ts +5 -0
  54. package/dist/key-refusal.js +30 -18
  55. package/dist/learn/audit.d.ts +20 -22
  56. package/dist/learn/audit.js +72 -55
  57. package/dist/learn/check.js +1 -1
  58. package/dist/learn/commit.d.ts +35 -43
  59. package/dist/learn/commit.js +62 -270
  60. package/dist/learn/compile.d.ts +4 -4
  61. package/dist/learn/compile.js +6 -7
  62. package/dist/learn/corrections.js +1 -1
  63. package/dist/learn/delete.d.ts +5 -12
  64. package/dist/learn/delete.js +17 -30
  65. package/dist/learn/forget-run.d.ts +16 -0
  66. package/dist/learn/forget-run.js +53 -0
  67. package/dist/learn/index.js +1 -1
  68. package/dist/learn/learning-of.d.ts +0 -4
  69. package/dist/learn/learning-of.js +0 -5
  70. package/dist/learn/{folder.d.ts → legacy/folder.d.ts} +2 -1
  71. package/dist/learn/{folder.js → legacy/folder.js} +4 -7
  72. package/dist/learn/legacy/place.d.ts +16 -0
  73. package/dist/{workspace/learning-workspace.js → learn/legacy/place.js} +12 -42
  74. package/dist/learn/legacy/scrub.d.ts +28 -0
  75. package/dist/learn/legacy/scrub.js +258 -0
  76. package/dist/learn/promote.d.ts +40 -66
  77. package/dist/learn/promote.js +69 -207
  78. package/dist/learn/reset-ledger.d.ts +18 -0
  79. package/dist/learn/reset-ledger.js +14 -0
  80. package/dist/learn/rows.d.ts +186 -0
  81. package/dist/learn/rows.js +376 -0
  82. package/dist/learn/secrets.d.ts +2 -1
  83. package/dist/learn/secrets.js +2 -2
  84. package/dist/learn/workflow-draft.d.ts +4 -1
  85. package/dist/learn/workflow-draft.js +12 -2
  86. package/dist/learned-nodes.d.ts +36 -0
  87. package/dist/learned-nodes.js +23 -0
  88. package/dist/learning-reset.d.ts +1 -1
  89. package/dist/learning-reset.js +9 -11
  90. package/dist/learning-routes.d.ts +60 -81
  91. package/dist/learning-routes.js +187 -360
  92. package/dist/learning-words.d.ts +2 -0
  93. package/dist/learning-words.js +2 -0
  94. package/dist/learning.d.ts +18 -24
  95. package/dist/learning.js +35 -66
  96. package/dist/local-model.d.ts +144 -0
  97. package/dist/local-model.js +214 -0
  98. package/dist/mcp-gateway.d.ts +6 -0
  99. package/dist/mcp-gateway.js +44 -8
  100. package/dist/mcp-probe.d.ts +7 -0
  101. package/dist/mcp-probe.js +7 -0
  102. package/dist/mcp-resources.d.ts +1 -1
  103. package/dist/native/discovery.d.ts +6 -0
  104. package/dist/native/discovery.js +14 -1
  105. package/dist/native/remote.d.ts +5 -0
  106. package/dist/native/remote.js +16 -0
  107. package/dist/native/runtime.js +3 -2
  108. package/dist/observation/observer.d.ts +6 -6
  109. package/dist/ollama-provider.d.ts +35 -0
  110. package/dist/ollama-provider.js +108 -2
  111. package/dist/openapi.js +147 -35
  112. package/dist/place-offers.d.ts +3 -0
  113. package/dist/place-offers.js +3 -0
  114. package/dist/place.d.ts +35 -12
  115. package/dist/place.js +67 -29
  116. package/dist/print.js +1 -1
  117. package/dist/purged-workflow.d.ts +0 -33
  118. package/dist/purged-workflow.js +3 -71
  119. package/dist/redact/match.d.ts +36 -8
  120. package/dist/redact/match.js +179 -44
  121. package/dist/run-export.js +4 -2
  122. package/dist/run-launch.d.ts +3 -3
  123. package/dist/run-learning-served.d.ts +3 -3
  124. package/dist/run-learning-served.js +1 -1
  125. package/dist/run-listing.d.ts +1 -1
  126. package/dist/run-timeline-served.d.ts +1 -1
  127. package/dist/run-timeline-served.js +6 -5
  128. package/dist/run-usage.js +3 -2
  129. package/dist/runnable.js +25 -8
  130. package/dist/runner/adapter-loop.d.ts +8 -1
  131. package/dist/runner/adapter-loop.js +100 -20
  132. package/dist/runner/adapter-run-spec.d.ts +3 -5
  133. package/dist/runner/adapter-run-spec.js +35 -61
  134. package/dist/runner/adapters/pi.d.ts +3 -2
  135. package/dist/runner/adapters/pi.js +3 -1
  136. package/dist/runner/audit.d.ts +3 -5
  137. package/dist/runner/audit.js +28 -51
  138. package/dist/runner/cli-run-spec.js +19 -22
  139. package/dist/runner/compare-end.d.ts +1 -3
  140. package/dist/runner/compare-end.js +6 -2
  141. package/dist/runner/disk-free.d.ts +15 -4
  142. package/dist/runner/disk-free.js +25 -7
  143. package/dist/runner/dispatch.js +2 -2
  144. package/dist/runner/feedback-round.d.ts +1 -1
  145. package/dist/runner/feedback-round.js +2 -2
  146. package/dist/runner/harness-loops.d.ts +9 -0
  147. package/dist/runner/harness-loops.js +49 -7
  148. package/dist/runner/held.d.ts +4 -11
  149. package/dist/runner/held.js +0 -25
  150. package/dist/runner/journal-kinds.d.ts +4 -1
  151. package/dist/runner/journal-kinds.js +1 -1
  152. package/dist/runner/learned-first.d.ts +0 -2
  153. package/dist/runner/learned-first.js +3 -3
  154. package/dist/runner/learning-end.d.ts +12 -16
  155. package/dist/runner/learning-end.js +41 -75
  156. package/dist/runner/learning-seed.d.ts +13 -16
  157. package/dist/runner/learning-seed.js +13 -23
  158. package/dist/runner/live-ticker.js +3 -4
  159. package/dist/runner/main.js +1 -1
  160. package/dist/runner/mcp-claim.js +3 -2
  161. package/dist/runner/mcp-run.d.ts +23 -4
  162. package/dist/runner/mcp-run.js +31 -2
  163. package/dist/runner/metrics.d.ts +4 -0
  164. package/dist/runner/metrics.js +9 -3
  165. package/dist/runner/monid-run.js +3 -1
  166. package/dist/runner/native-loop.js +3 -4
  167. package/dist/runner/promotion.d.ts +19 -28
  168. package/dist/runner/promotion.js +50 -69
  169. package/dist/runner/redact.d.ts +3 -0
  170. package/dist/runner/redact.js +7 -0
  171. package/dist/runner/reflect-hook.d.ts +2 -2
  172. package/dist/runner/reflect-hook.js +4 -1
  173. package/dist/runner/run-child-host.d.ts +1 -9
  174. package/dist/runner/run-child-host.js +12 -68
  175. package/dist/runner/runner.d.ts +1 -1
  176. package/dist/runner/sdk-loop.js +7 -7
  177. package/dist/runner/workflow-calls.d.ts +4 -1
  178. package/dist/runner/workflow-calls.js +35 -18
  179. package/dist/runner/workflow-loop.d.ts +1 -1
  180. package/dist/runner/workflow-loop.js +3 -1
  181. package/dist/runner/workflow-spec.d.ts +4 -0
  182. package/dist/runner/workflow-spec.js +18 -13
  183. package/dist/runs-over-store.d.ts +2 -2
  184. package/dist/runs-over-store.js +1 -1
  185. package/dist/sdk/check.d.ts +1 -4
  186. package/dist/sdk/check.js +2 -3
  187. package/dist/sdk/runs.d.ts +20 -7
  188. package/dist/sdk/runs.js +105 -68
  189. package/dist/secret-cut.js +7 -4
  190. package/dist/secret-rules.js +97 -83
  191. package/dist/secrets.d.ts +4 -0
  192. package/dist/secrets.js +44 -10
  193. package/dist/server-fs.d.ts +1 -1
  194. package/dist/server-fs.js +1 -1
  195. package/dist/server-keys.d.ts +6 -0
  196. package/dist/server-keys.js +12 -0
  197. package/dist/server.d.ts +22 -15
  198. package/dist/server.js +311 -198
  199. package/dist/slack.js +2 -1
  200. package/dist/source-sync/auxiliary.js +2 -2
  201. package/dist/store/index.d.ts +1 -1
  202. package/dist/store/index.js +1 -1
  203. package/dist/store/postgres/migrate.js +3 -1
  204. package/dist/store/postgres/migrations/0032_learning_rows.sql +65 -0
  205. package/dist/store/schema.d.ts +28 -2
  206. package/dist/store/schema.js +81 -5
  207. package/dist/store/sqlite/learning-rows.d.ts +23 -0
  208. package/dist/store/sqlite/learning-rows.js +559 -0
  209. package/dist/store/sqlite/store.d.ts +7 -1
  210. package/dist/store/sqlite/store.js +84 -18
  211. package/dist/store/store.d.ts +219 -6
  212. package/dist/store/store.js +13 -0
  213. package/dist/store-reads/journal.d.ts +33 -3
  214. package/dist/store-reads/journal.js +99 -4
  215. package/dist/store-reads/learning.d.ts +23 -26
  216. package/dist/store-reads/learning.js +42 -30
  217. package/dist/store-reads/loop.js +1 -1
  218. package/dist/store-view.d.ts +24 -2
  219. package/dist/store-view.js +40 -11
  220. package/dist/templates.d.ts +10 -2
  221. package/dist/templates.js +31 -4
  222. package/dist/tool-plane.d.ts +27 -3
  223. package/dist/tool-plane.js +79 -4
  224. package/dist/tools.d.ts +12 -2
  225. package/dist/tools.js +42 -7
  226. package/dist/trigger-launch-hook.d.ts +2 -2
  227. package/dist/trigger-launch-hook.js +1 -1
  228. package/dist/triggers.d.ts +7 -4
  229. package/dist/triggers.js +4 -4
  230. package/dist/web-holds.d.ts +2 -0
  231. package/dist/web-holds.js +5 -2
  232. package/dist/web-run.js +2 -1
  233. package/dist/workspace/archil-exec.js +1 -1
  234. package/dist/workspace/archil.d.ts +1 -1
  235. package/dist/workspace/archil.js +1 -1
  236. package/dist/workspace/computer-deps.js +5 -3
  237. package/dist/workspace/computer-providers.d.ts +11 -1
  238. package/dist/workspace/computer-providers.js +29 -2
  239. package/dist/workspace/index.d.ts +1 -2
  240. package/dist/workspace/index.js +1 -2
  241. package/dist/workspace/paths.d.ts +0 -4
  242. package/dist/workspace/paths.js +0 -6
  243. package/dist/workspace/workspace.d.ts +1 -1
  244. package/dist/workspace/workspace.js +1 -1
  245. package/package.json +13 -13
  246. package/templates/TOOLS.md +46 -0
  247. package/dist/console/assets/index-LwNL4L9q.js +0 -619
  248. package/dist/console/assets/styles-DQo8rzY-.css +0 -1
  249. package/dist/workspace/learning-workspace.d.ts +0 -24
  250. /package/dist/learn/{learning.sh → legacy/learning.sh} +0 -0
package/README.md CHANGED
@@ -74,9 +74,10 @@ once they have loaded. A port already taken at the start is left to the start's
74
74
  replaces, as it always has, and prints no `Starting` line.
75
75
 
76
76
  A Docker box's image is built on its first run, which shows that on its timeline. `npx @parcha/agentrun` prints the
77
- `Boxes:` line on stderr, after its own line on stdout. On a machine where Docker is not running, the `Boxes:` line says so instead (`Boxes: none, so new agents run on the
78
- runner. Docker isn't running on this machine (no docker command on PATH): install or start Docker, then restart
79
- AgentRun.`); see [Sandbox](#sandbox).
77
+ `Boxes:` line on stderr, after its own line on stdout. On a machine where Docker is not running, the `Boxes:` line says so instead (`Boxes: none, so a new agent must name its
78
+ place: a box, or the runner. Docker isn't running on this machine (no docker command on PATH): install or start Docker,
79
+ then restart AgentRun.`; in Mode 2, where the runner's shell is Archil's serverless exec, `Boxes: none, so new agents run on
80
+ the runner.` and Docker's reason); see [Sandbox](#sandbox).
80
81
 
81
82
  `Open` is [the console](#the-console), which takes [your password](#your-password). For a client, export the two lines before
82
83
  it, then make an agent, start a run, and read its timeline until a page says `final`:
@@ -292,8 +293,12 @@ its first word is held too when that word is a known auth scheme (`Bearer`, `Bas
292
293
  and any query parameter named like a credential, and, inside any header's value, the value of each `name=value` pair
293
294
  named like a credential, read over the whole value as written, a URL's query and fragment included (a cookie's
294
295
  `session=<token>`, `https://relay/v1?region=us;session=<token>`, `#access_token=<token>`; pairs split at `;`, `&`, a
295
- comma or its `%2C`, and spaces, again at `?`, `#` and `/` too, and again at all but `;`, so `api_key=<key;rest>` holds
296
- the whole key; a value in quotes is held without them; `theme=dark` is not held), and the user, password and
296
+ comma or its `%2C`, and spaces, again at `?`, `#` and `/` too, and three times keeping a `;`: at all but `;`, so
297
+ `api_key=<key;rest>%2Cregion=us` holds the key; at `&` and spaces alone, so `api_key=<key;rest%2Cmore>` holds the
298
+ whole key; and at those or their `%26` and `%20`, so that key is held as written before an encoded `&` or space too,
299
+ and at those or `%26` alone, so a key with a `%20` in it is held before a `%26` (all are held, since a redactor matches each held value exactly and the longer reading never covers the
300
+ key alone); a value whose part before its first `;` is empty, `token=;<key>` or `token=%3B<key>`, is
301
+ held after that `;` too; a value in quotes, raw or written `%22` or `%27`, is held without them; `theme=dark` is not held), and the user, password and
297
302
  credential-named query parameters of every URL in it, one inside another's query or path too, scheme-relative
298
303
  (`//<key>@host`) or with its slashes escaped (`https:\/\/`). A URL's query, an endpoint's too, is read split at `&`
299
304
  alone and again at `&` and `;`, so `?api_key=<key;rest>` holds the whole key and `?region=us;session=<token>` the
@@ -390,7 +395,7 @@ sealed secrets, so a lost key is not replaced: recreating the container with the
390
395
 
391
396
  From a checkout, the same command in its root, with `--build` to build the image from it.
392
397
  `packages/serve/docker/Dockerfile` builds that image: the server and the open packages it runs, on Node 24.22.3 and Debian 13
393
- (trixie), with git 2.47 for an agent's learning folder and the Docker client. Everything it keeps is under `/data`: the agent store,
398
+ (trixie), with git 2.47 for a source project's capture and the Docker client. Everything it keeps is under `/data`: the agent store,
394
399
  the runs and the token.
395
400
 
396
401
  The image's default command, `server-and-runner --data /data --listen 0.0.0.0 --port 7340 --drain-timeout 6s`, starts
@@ -458,7 +463,7 @@ that can claim is there, the refusal is gone.
458
463
  The data directory has two parts. Its own files, the control plane, hold the agent store (`DIR/store.sqlite`, where
459
464
  each run's row keeps its claim: an epoch and its holder), the token and the server's settings; only the server and its
460
465
  runners open them. Everything the agents make is on the disk, `DIR/disk/`: one folder per agent, `DIR/disk/agents/<agent>/` (its id
461
- in lower case, a dash and 16 hex digits of its SHA-256), with its learning folder (`learning/`) and its runs
466
+ in lower case, a dash and 16 hex digits of its SHA-256), with its runs
462
467
  (`runs/<id>/`, each with `work/`, where its tools work). Nothing is copied in or out of a run's folder: where it
463
468
  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
464
469
  did, in order) are rows of the store.
@@ -624,17 +629,43 @@ command in the background ([background processes](#background-processes)). The p
624
629
  revision, so its answers show it. A definition that names its tools keeps exactly those, an empty list included, and
625
630
  gets the box only when one of them runs only there (`bash` or a background tool). One whose tools need no shell (`[]`,
626
631
  or `read`, `write`, `web_fetch` and the like) is saved with no place and runs on the runner, so its first run starts at
627
- once instead of waiting on a container. Where docker is unavailable, a new agent is saved with no place. So is one whose
628
- tools name one the box refuses (`browser`, runner-only for now). A workflow is never given a box.
629
-
630
- `capabilities.places.default_place` is the place a new agent with a shell gets here, and where a revision that names no
631
- place and has a shell tool runs. It is worked out again at each run, the same way as at create: an agentic revision with
632
- no place and a shell tool runs in the Docker box wherever this server has docker now, and on the runner where it does
633
- not. A workflow, a revision whose tools need no shell, and one whose tools name one the box refuses run on the runner. A save checks a revision with no place against where it would run, so `bash`
634
- with no place saves where docker is there and is `422` where it is not. When that is the runner,
635
- `default_reason` says why in docker's own words, such as `new agents run on the runner, because the docker box is
636
- unavailable here: Docker isn't running on this machine (no docker command on PATH): install or start Docker, then
637
- restart AgentRun`. The console's new-agent form says docker's reason too, under its place picker. The console's new-agent form starts on `default_place`, with bash ticked when that place is a sandbox.
632
+ once instead of waiting on a container. One whose tools name one the box refuses (`browser`, runner-only for now) is
633
+ saved with no place too. A workflow is never given a box.
634
+
635
+ Where a new agent with no place goes, by mode:
636
+
637
+ - **Docker's box available:** it gets the box (`default_place` is `{"mode": "sandbox", "box": "docker"}`, no
638
+ `default_reason`), as above.
639
+ - **No Docker, and the runner has no shell (Mode 1): refused, `name a box`.** A new agent that would get the box (no
640
+ tools named, or a shell tool) is `422 input_invalid` with `{field: "definition.place", reason: "missing"}`, and so is an
641
+ edit that would save such a revision: `name a box: this server has no Docker box for a new agent. Set place to {mode:
642
+ sandbox, box: <one of: daytona, e2b>}, or to {mode: runner} to run without a shell. docker: <why>.` The words list the
643
+ boxes this server has (`<none is set up>` when it has none), and its `fix` says the same, so no box is picked for it:
644
+ the default box is the one whose provider descriptor sets `defaultBox` (Docker's), never another box that answers. They
645
+ end with why Docker's box is not here, in its entry's own words and fix (joining the docker group, say). A template
646
+ apply, or an `agentrun deploy`, of a package that names no `tools` and no `computer` list is refused the same way,
647
+ whatever MCP tools it ticks: it is the agent that gets the box where Docker is here. Its `dry_run` is refused
648
+ alike, with no plan. `default_place` is `null`, and
649
+ `default_reason` carries those words. A definition with no place that names a shell tool and the browser is refused at
650
+ the shell tool instead: a box refuses the browser, so no place runs both, and the words say to remove one.
651
+ - **No Docker, in Mode 2:** not refused. The runner's shell is Archil's serverless exec, so a new agent with no place
652
+ saves for the runner as before, and `default_place` is `{"mode": "runner"}`, no `default_reason`. A background tool
653
+ still runs in a box alone, so naming one with no place is refused at the tool.
654
+
655
+ A definition that names its place, the runner included, a workflow, and one whose tools need no shell save as before in
656
+ every mode, and so does a package that names its tools (`tools: []` included) or its computer list. An agent saved
657
+ before this change with no place and no tools keeps running on the runner: the store holds its tools as `[]`.
658
+
659
+ `capabilities.places.default_place` is always sent: the place a new agent with a shell gets here, and where a revision
660
+ that names no place and has a shell tool runs; `null` means no default, so a new agent names its place. It is worked out
661
+ again at each run, the same way as at create: an agentic revision with no place and a shell tool runs in the Docker box
662
+ wherever this server has docker now, on the runner in Mode 2, and in Mode 1 with no Docker its run is `409
663
+ agent_not_runnable` in the `name a box` words. A workflow, a revision whose tools need no shell, and one whose tools name
664
+ one the box refuses run on the runner. `default_reason` is there exactly when `default_place` is `null`; a client tells
665
+ the cases apart by `default_place === null`, never by reading `default_reason`. Docker's own reason is on its entry in
666
+ `boxes`. The console's new-agent form starts on `default_place`, with bash ticked when that place is a sandbox; with
667
+ `null`, it starts on neither the server nor a box, Create waits until one is chosen, and its picker says each box's
668
+ reason, and, with no box set up, that the agent needs one set up or On the server chosen.
638
669
  What a person picks or unticks there is what is sent.
639
670
 
640
671
  A run runs in its revision's place, else where `default_place` says at that run (a workflow, a revision whose tools need
@@ -654,8 +685,8 @@ the server is in Mode 1.
654
685
  `unavailable`) and, when it is unavailable, the `reason`.
655
686
  A definition naming a box this server does not have saves with a warning on `definition.place`, and a run of it is
656
687
  `409 agent_not_runnable` with `details.box`. `GET /v2/openapi.json` marks `definition.place`, the run's `place` and
657
- `capabilities.places` `x-agentrun-serve: "place/1"`, `default_reason` `"place/3"`, and `default_place` `"place/4"`
658
- (it replaced `places.default`).
688
+ `capabilities.places` `x-agentrun-serve: "place/1"`, and `default_place` and `default_reason` `"place/5"` (`default_place`
689
+ replaced `places.default`, and took `null` at place/5).
659
690
 
660
691
  ### A run in a Docker box
661
692
 
@@ -1026,7 +1057,10 @@ run's hold), newest first. The runs list carries no computer, so this is the one
1026
1057
  across runs and agents; the console's Settings → Computers shows it as Running now. An agent's own computer kept
1027
1058
  between runs is on the agent's read (`own_computer`), and a paired computer under `paired` in `GET /v2/computers`. The keys are
1028
1059
  `DAYTONA_API_KEY` (with `DAYTONA_API_URL` and `DAYTONA_TARGET` optional), `MODAL_TOKEN_ID` and `MODAL_TOKEN_SECRET`,
1029
- `E2B_API_KEY`, `AGENT37_API_KEY` and `AGENT37_SSH_KEY`, `MORPH_API_KEY`, `ORGO_API_KEY`, `PHONE_HARNESS_API_KEY`,
1060
+ `E2B_API_KEY`, `AGENT37_API_KEY` (with `AGENT37_SSH_KEY` optional: unset, the server makes its own SSH key on first use,
1061
+ seals it in its store as every saved key under `AGENTRUN_SEAL_KEY`, and registers it on the workspace as
1062
+ `agentrun-<hash>`, one key per store even when claims or servers reach first use together; without a seal key, a new
1063
+ key each restart, the old one left on the workspace), `MORPH_API_KEY`, `ORGO_API_KEY`, `PHONE_HARNESS_API_KEY`,
1030
1064
  `BROWSERBASE_API_KEY` and `BROWSERBASE_PROJECT_ID`, `KERNEL_API_KEY`, `BOXD_API_KEY` (with `BOXD_ORG` and
1031
1065
  `BOXD_REGION` optional), `SMOLCLOUD_API_KEY`, `GROUNDBOX_API_KEY`, `CLOUDFLARE_RELAY_URL` and `CLOUDFLARE_RELAY_TOKEN` (the relay Worker's,
1032
1066
  `packages/computer/relays/cloudflare`), and `FLY_API_TOKEN` and `FLY_APP`; Docker takes none.
@@ -1208,8 +1242,12 @@ passes the binding's conformance cases (below) needs no change here.
1208
1242
  - **Mode 1** (the default): on this server's own disk. Only a provider that binds a folder of this machine can hold
1209
1243
  it, so a sandbox runs on Docker only; a Daytona, Modal, E2B or Agent37 sandbox is refused ("Mode 1 runs a sandbox only on
1210
1244
  Docker").
1211
- - **Mode 2**: on Archil disks. `PUT /v2/workspace/archil` turns it on with the account key, `ARCHIL_API_KEY`, its
1212
- region and that region's S3 URL (and an exec image pinned by digest, if you want one other than serve's default);
1245
+ - **Mode 2**: on Archil disks. `PUT /v2/workspace/archil` turns it on with the account key, `ARCHIL_API_KEY`, and its
1246
+ region (and an exec image pinned by digest, if you want one other than serve's default). For a region serve knows
1247
+ (`aws-us-east-1`, `aws-us-west-2`, `aws-eu-west-1` and `gcp-us-central1`, the regions Archil's SDK names; `GET` lists
1248
+ them in `regions`), the S3 URL is the region's (`https://s3.green.us-east-1.aws.prod.archil.com` for `aws-us-east-1`)
1249
+ and `s3Url` may be left out; one given is used instead, and `GET` says which in `s3UrlFrom`. Any other region needs
1250
+ its `s3Url`;
1213
1251
  `DELETE` turns it off. The default exec image is Docker's `buildpack-deps:trixie-scm` pinned by digest (git 2.47),
1214
1252
  because Archil's own has git 2.34 and a read-only bash policy runs git only at 2.43 or later. An image you name needs
1215
1253
  git 2.43 for that too, and GNU coreutils and perl, as Debian-family images have. A Modal, E2B or Agent37 sandbox
@@ -1232,17 +1270,17 @@ passes the binding's conformance cases (below) needs no change here.
1232
1270
  machine) or null (none).
1233
1271
 
1234
1272
  The PUT is a secret write, so it takes the owner's signed-in session. A server with none to give it (API only, or
1235
- `AGENTRUN_ACCOUNTS=0` reached beyond loopback) is set where it is started instead: `AGENTRUN_ARCHIL_REGION` and
1236
- `AGENTRUN_ARCHIL_S3_URL` together, and `AGENTRUN_ARCHIL_IMAGE` for a pinned exec image, with the account key in
1237
- `ARCHIL_API_KEY`. Each agent's disk is then made on its first run, as with saved settings:
1273
+ `AGENTRUN_ACCOUNTS=0` reached beyond loopback) is set where it is started instead: `AGENTRUN_ARCHIL_REGION`,
1274
+ `AGENTRUN_ARCHIL_S3_URL` for a region serve doesn't know (or to use another endpoint than a known region's), and
1275
+ `AGENTRUN_ARCHIL_IMAGE` for a pinned exec image, with the account key in `ARCHIL_API_KEY`. Each agent's disk is then
1276
+ made on its first run, as with saved settings:
1238
1277
 
1239
1278
  ```sh
1240
- AGENTRUN_ARCHIL_REGION=aws-us-east-1 AGENTRUN_ARCHIL_S3_URL=https://s3.example.com \
1241
- ARCHIL_API_KEY=... node packages/serve/dist/cli.js
1279
+ AGENTRUN_ARCHIL_REGION=aws-us-east-1 ARCHIL_API_KEY=... node packages/serve/dist/cli.js
1242
1280
  ```
1243
1281
 
1244
- Each value is checked as the PUT checks it. One of the region and S3 URL without the other, or a value the PUT would refuse,
1245
- stops the start, in words naming each variable. Set, they win over saved settings, as `ARCHIL_API_KEY` wins over a
1282
+ Each value is checked as the PUT checks it. A variable set without the region, no S3 URL for a region serve doesn't
1283
+ know, or a value the PUT would refuse, stops the start, in words naming each variable. Set, they win over saved settings, as `ARCHIL_API_KEY` wins over a
1246
1284
  saved key, and nothing is written to the store: `GET /v2/workspace/archil` says `source: "env"` (saved ones say
1247
1285
  `"console"`), and `PUT` and `DELETE` are `409 key_set_by_server`, since they are changed where the server is started.
1248
1286
  Unset, the saved settings, if any, hold again. A runner started on its own (`agentrun-serve runner`) reads them from its
@@ -1595,7 +1633,9 @@ unless the [launch hook](#launch-hook) is set, which hands each firing to your b
1595
1633
  would start runs of the agent with no hook, or message one of its runs, hook or not. A `message_run` trigger made
1596
1634
  before the setting was on, or while the server held the key, fails each firing with that 409 and sends nothing. An
1597
1635
  update apply that skips a trigger leaves the agent's trigger of that name as it was; when that one is on, it still
1598
- fires, and the skip's warning names it and says how to turn it off.
1636
+ fires until you turn it off. A firing that would start a run of the new revision is refused 409 for the keys it owes and
1637
+ starts no run, but a `message_run` firing aimed at a run of an earlier revision that owes no keys still reaches that run,
1638
+ which may spend. The skip's warning names the trigger and says how to turn it off.
1599
1639
 
1600
1640
  `MONID_API_KEY` stays the server's even with the setting on: an agent's monid tools are checked with it when the agent
1601
1641
  is saved, before any run, so a template that grants them is still refused at its apply (409 at
@@ -1801,6 +1841,28 @@ has the row **Use Claude Code's login on this machine**, over these routes:
1801
1841
  The CLI dies with the server, as a session's CLI does, so a server that is killed outright (SIGKILL, the OOM killer)
1802
1842
  leaves no sign-in waiting on the browser's port.
1803
1843
  - `DELETE /v2/settings/claude-login` turns it off. The login stays as the CLI keeps it.
1844
+ - `POST /v2/settings/claude-login/sign-out` signs out of AgentRun's own login, for a fresh sign-in or another account: it
1845
+ ends a sign-in that waits, turns the mode off, runs the pinned CLI's own `claude auth logout` on
1846
+ `<data>/claude-login` (which removes its credentials file and, on macOS, its Keychain item for that folder), then
1847
+ removes that folder, the login's signed-in note in `claude-login-answers/` and the runner's token reader, whatever the
1848
+ CLI said. Each removal stands alone: one that fails is named in the answer and the rest still happen. It answers
1849
+ `{ "confirmed": true, "login": <the view, off> }`; `confirmed` false adds a `message` saying what may remain: the
1850
+ CLI didn't confirm its own sign-out, or its step failed, named (on macOS its Keychain item may remain), or a file it
1851
+ could not remove, by path. The CLI's sign-out runs where the folder is already gone too, so a retry after an
1852
+ unconfirmed sign-out confirms only where the CLI does. The next turn-on reads `signed_out` and the sign-in starts as
1853
+ before. `<data>/claude-login`
1854
+ is a folder AgentRun keeps itself: a turn-on where it is a link is refused, and a sign-out that finds a link there
1855
+ removes the link alone (and the login's signed-in note), runs no CLI through it, and names what it led to. Runs already going are left as a turn-off leaves them, and fail saying the
1856
+ login is signed out at their next read of it. Where each run is a user of its own, a run claimed on the login and
1857
+ started while the mode is off is refused at its start, as after a turn-off; the claim checks the login's folder, not
1858
+ its account, so a run claimed before Sign out and started after a new sign-in may run on the new account. What Sign
1859
+ out does not guarantee for a run still going: where runs stay in the runner's process, the run's CLI holds the login's
1860
+ refresh token itself and may write a renewed token pair back into `<data>/claude-login` after the folder is removed
1861
+ (nothing removes it again when that run ends), so once such runs end, a turn-on that reads `signed_in` again means
1862
+ Sign out again. The runner's own renewal, for
1863
+ runs that are users of their own, never writes back to a removed login. This machine's own login (`place` `machine`)
1864
+ is the person's: the sign-out is refused (403) with nothing touched, and the words say to run `claude auth logout` in
1865
+ a terminal there. The console's Claude login row offers Sign out only while AgentRun's own login is signed in.
1804
1866
 
1805
1867
  While it is on, a claude-agent run on an `anthropic/<model>` model goes on the login: its CLI gets no
1806
1868
  `ANTHROPIC_BASE_URL`, `ANTHROPIC_AUTH_TOKEN` or key, no model proxy runs, and the CLI's sandbox denies its commands
@@ -2087,7 +2149,8 @@ Each child books on the run's cap, so size the cap for K passes, not one.
2087
2149
 
2088
2150
  `web_search` and `web_fetch` work on every harness with only a model key. Each resolves, for a run, in one order: (1) the
2089
2151
  provider the user picked, optional: the agent's own (`definition.tool_settings`) over the server's
2090
- (`PUT /settings/tools`); (2) for
2152
+ (`PUT /settings/tools`), except that the server's `kernel` for `web_fetch`, and its `native` or `off` for `web_search`,
2153
+ are a ceiling no agent's pick raises ([below](#search-and-fetch)); (2) for
2091
2154
  `web_search`, Parallel, where the server holds a Parallel key (`PARALLEL_API_KEY` in its environment, or one saved on Tool
2092
2155
  keys): `auto` then uses that key and bills it, each search booked as the run's cost ($0.001 a search); (3) the keyless
2093
2156
  fallback, Firecrawl's public MCP endpoint (for `web_search` with Exa's behind it). A revision's `tools` (and a pack's grant) names the capability, never a provider.
@@ -2103,7 +2166,8 @@ it is Parallel on the server's key, else keyless Firecrawl, or the provider pick
2103
2166
  unavailable for a workflow.
2104
2167
 
2105
2168
  Where the server holds a TypeSafe key (`TYPESAFE_API_KEY`, set or saved), Jev runs on the web tools by default, and
2106
- run content goes to TypeSafe. Each `web_search` sends TypeSafe its objective and each result's URL, title and snippet.
2169
+ run content goes to TypeSafe. Each `web_search` sends TypeSafe its objective and each result's URL, title, snippet and
2170
+ published date (when the provider gives one).
2107
2171
  Each `web_fetch` given an objective sends TypeSafe the page's text (up to 1,000,000 characters, in chunks) and the
2108
2172
  objective; a fetch with no objective sends nothing. TypeSafe bills every request to the server's TypeSafe key. To
2109
2173
  keep the old behaviour on a server that holds the key, set `AGENTRUN_WEB_JEV_OFF=1`. Jev (`jev-1.14.0`) scores each
@@ -2118,7 +2182,7 @@ OpenRouter key runs no ranking; `AGENTRUN_WEB_JEV_OFF=1` on the server turns Jev
2118
2182
  set, on whatever runner host claims it (the run's plane carries the switch, and keeps it at every later launch); a
2119
2183
  runner's own switch can add off for the runs that host claims, never turn it back on. `GET /capabilities`' `why` for
2120
2184
  each tool says what it sends TypeSafe, or that Jev is off: for `web_search` `…; Jev (jev-1.14.0) ranks results …; each
2121
- search sends that and each result's URL, title and snippet to TypeSafe …`, for `web_fetch` `…; a fetch given an
2185
+ search sends that and each result's URL, title, snippet and published date to TypeSafe …`, for `web_fetch` `…; a fetch given an
2122
2186
  objective sends the page's text and the objective to TypeSafe …`, and for either `…; Jev off: no TypeSafe key` or
2123
2187
  `…; Jev off (AGENTRUN_WEB_JEV_OFF)`.
2124
2188
 
@@ -2136,7 +2200,9 @@ objective sends the page's text and the objective to TypeSafe …`, and for eith
2136
2200
 
2137
2201
  `GET /settings/tools` answers the server's settings, `{web_search: {provider}, web_fetch: {provider}, browser: {provider}}`, the default
2138
2202
  where none is set; `PUT /settings/tools` takes the same map and replaces it (a capability it leaves out takes its
2139
- default). An agent's `definition.tool_settings` has the same shape and is over the server's. A provider is one offered
2203
+ default). An agent's `definition.tool_settings` has the same shape and is over the server's, except under the server's
2204
+ `kernel` for `web_fetch`, or its `native` or `off` for `web_search`, a ceiling no agent's pick raises, and a `deny`,
2205
+ which no agent's setting reaches past. A provider is one offered
2140
2206
  for its capability (`auto`, `native`, `firecrawl-keyless`, `exa-keyless`, `parallel` or `off` for `web_search`; `auto`,
2141
2207
  `firecrawl-keyless`, `kernel` or `parallel` for `web_fetch`;
2142
2208
  `auto`, `browserbase`, `kernel` or `chrome` for `browser`, [below](#tools)); an
@@ -2211,9 +2277,18 @@ sees the URL, its query string included, so a token in a URL's query goes to Fir
2211
2277
  guard's own check, and one it refuses (a private, loopback, link-local or intranet address, a name that resolves to one,
2212
2278
  or a URL holding a user name or password) is refused as the guarded direct fetch refuses it, and never sent to Firecrawl,
2213
2279
  to Exa or to Parallel. To keep every URL on the server, pick `kernel` for `web_fetch`, or hold a Parallel key, where
2214
- `auto` is the guarded direct fetch. A server's pick is the default only: an agent's own `tool_settings` outrank it, so an
2215
- agent (an imported template's among them) that picks `firecrawl-keyless` or `auto` still sends its URLs to Firecrawl.
2216
- Only a server's `deny` is absolute: set `web_fetch` to `deny` to stop every agent's fetches.
2280
+ `auto` is the guarded direct fetch. A server's pick is the default only, an agent's own `tool_settings` (an imported
2281
+ template's among them) over it, except for these. The server's `kernel` for `web_fetch`, and its `native` or `off` for
2282
+ `web_search`, are a ceiling: an agent's pick of `firecrawl-keyless`, `exa-keyless`, `auto` or `parallel` resolves as the
2283
+ server's setting does, so nothing goes to Firecrawl, to Exa or to Parallel, and capabilities' `why` says so ("the
2284
+ server's setting, kernel, is a ceiling over this agent's pick of auto"). Under `off`, an agent's `native` is off too;
2285
+ under `native`, it is the ceiling's own. To let agents use Parallel, set `parallel` server-wide; any server pick but
2286
+ these three (`auto`, `firecrawl-keyless`, `exa-keyless`, `parallel`) is only a default an agent's pick replaces. A
2287
+ server's `deny` is absolute: set `web_fetch` or `web_search` to `deny` to refuse every agent's calls, whatever it picks.
2288
+ A server setting applies at a run's next claim (its start, a follow-up, a resume or a reclaim): a claim keeps the plane
2289
+ it began with to its end, through any approval it waits on while it holds the run. Tool settings a claim cannot read
2290
+ fail closed: a capability kept on a keyless service or on Parallel runs nothing, its tool saying the settings could not
2291
+ be read.
2217
2292
 
2218
2293
  A `web_fetch` through keyless Firecrawl takes at most about 95 s: up to 30 s for the guard's check of the URL, 30 s for
2219
2294
  Firecrawl, then, where Firecrawl gives no page, the guarded fetch's 30 s and 5 s to read the page.
@@ -2684,8 +2759,9 @@ curl -X POST "$BASE/v2/agents/$AGENT/runs" -H "authorization: Bearer $TOKEN" -H
2684
2759
  user and account, the Composio key staying the server's own. The binding is kept as a `per_run` server's headers are:
2685
2760
  sealed into the run's launch, erased from the store by the write that ends the run, never on the server's row, the
2686
2761
  run's view, its timeline, its trace or a log line, and its values are cut from whatever the run shows. A message's
2687
- binding replaces the run's for the turn it starts. A run that names no account has its calls of the server answered, unsent, that it was
2688
- handed none, so a per-run server never calls as a default account. A malformed user or account is `422 input_invalid` at
2762
+ binding replaces the run's for the turn it starts. A run that names no account is not offered the server's tools (on
2763
+ Codex, its calls of them are answered, unsent, that it was handed none), so a per-run server never calls as a default
2764
+ account. A malformed user or account is `422 input_invalid` at
2689
2765
  `mcp_auth.<server>.composio_user_id` or `.connected_account_id`, and so is a binding to the preset's default user
2690
2766
  `agentrun` (`not_allowed`: the user single-user preset servers call as); headers for such a server, or a binding for any
2691
2767
  other server, are `422` at `mcp_auth.<server>`, and no run starts. A per-run server makes no Composio trigger: a trigger
@@ -2788,7 +2864,11 @@ credential answers the first request's run), and its values are cut from whateve
2788
2864
  `POST /v2/runs/{run_id}/messages` takes `mcp_auth` too: it replaces the run's credentials in the message's own write, so the turn the message starts (a
2789
2865
  steer into a working run from its next model request, or a follow-up that opens an ended run again) calls with them. A
2790
2866
  name that is not a saved per_run server is `422` at `mcp_auth.<server>`, and no run starts. A run handed no credential
2791
- for a per_run server it calls has those calls answered, unsent, that it was handed none. `POST .../{name}/refresh` lists
2867
+ for a per_run server it calls is not offered that server's tools, and its timeline says which server was left out and
2868
+ why; the next time the run picks up work after a message hands the credential, it has them. A message that hands it
2869
+ while a turn is still going is not put into that turn, whose tools can't change: it runs as the run's next turn, and
2870
+ the timeline says so. Codex keeps the tools its thread started with, so a Codex run keeps listing them, and their
2871
+ calls are answered, unsent, that it was handed none until the credential comes. `POST .../{name}/refresh` lists
2792
2872
  a per_run server's tools with no credential: save it again with `headers` for a server that lists only to a caller it
2793
2873
  knows. The tools are those it listed at its save, so a server whose tool list varies by caller shows each run the saved
2794
2874
  list.
@@ -3783,7 +3863,8 @@ serves these routes alone:
3783
3863
  are the console's, refused here;
3784
3864
  - what an agent learned, for the backend whose runs it learned from: the loop's compile turns
3785
3865
  (`GET /agents/{id}/learning/loop`), each learned workflow's promotion and what serves
3786
- (`GET /agents/{id}/learning/promotions`), the cost per run (`GET /agents/{id}/learning/cost`) and a run's learning
3866
+ (`GET /agents/{id}/learning/promotions`), the audit ledger of the workflows that serve
3867
+ (`GET /agents/{id}/learning/audits`), the cost per run (`GET /agents/{id}/learning/cost`) and a run's learning
3787
3868
  (`GET /runs/{id}/learning`), each cut of the host's secrets as the console's reads are; and its reset
3788
3869
  (`DELETE /agents/{id}/learning`, the agent and its runs kept), its one learning write served here;
3789
3870
  - a run's hosted machine fetching this server's computerd build (`GET /computers/daemon`), with the token its create
@@ -3797,11 +3878,20 @@ serves these routes alone:
3797
3878
  is what its delete (`DELETE /agents/{id}`) needs first. With the [launch hook](#launch-hook) set, the apply makes the
3798
3879
  package's schedule and feed triggers, and every firing that starts a run goes to the backend, which starts it through
3799
3880
  the API with the keys and budget it sends, a trigger the agent had before the profile included; the unarchive turns
3800
- them on again, as no trigger route is served to. Without the hook it makes neither (`not_set_up_here`: set the hook,
3801
- or start those runs through the API), and a trigger the agent already had stays as it was: an enabled one still fires
3802
- here, on this server's keys, until the agent is archived, and the skip's warning says so. A webhook, GitHub, Composio or email trigger is never made here, hook
3881
+ them on again. Without the hook it makes neither (`not_set_up_here`: set the hook, or start those runs through the
3882
+ API), and a trigger the agent already had stays as it was: an enabled one still fires here, on this server's keys,
3883
+ until it is turned off (below) or the agent is archived, and the skip's warning says so. A webhook, GitHub, Composio or email trigger is never made here, hook
3803
3884
  or not, since this profile refuses the hook or setting each needs (`not_an_option`). Each skipped trigger is a warning
3804
3885
  under `warnings` (`triggers.<i>`), and the dry run (`dry_run: true`) plans it as `skip` in the same words;
3886
+ - the triggers, for a backend to see one that is off and turn it on again: their list (`GET /triggers`), one
3887
+ (`GET /triggers/{id}`), its firings (`GET /triggers/{id}/firings`), and its turn on or off
3888
+ (`PATCH /triggers/{id}` with `{"enabled": true}` or `{"enabled": false}`; from the CLI,
3889
+ `agentrun triggers update <id> --enabled` or `--no-enabled`). A trigger whose firings failed 5 times in
3890
+ a row turns itself off (`disabled.reason` `auto_paused`), and there is no console here to turn it on in. The PATCH
3891
+ takes `enabled` alone (any other field is `422 not_allowed`), and turns on only what the apply would make: a schedule
3892
+ or a feed, with the launch hook set (`422` under `enabled` otherwise, since its firings would start runs on this
3893
+ server's keys or wait on a hook this profile refuses). Turning one off always works. Making, deleting or firing a
3894
+ trigger, and its secret, stay refused;
3805
3895
  - a Composio server's save (a new name, or a server the token saved) and the delete of a server the token saved, for a
3806
3896
  backend that grants its runs Composio tools. The token here never writes a secret, so the save keeps none:
3807
3897
  - a Composio server (`PUT /settings/mcp-servers/{name}/composio`) names its key with
@@ -3890,7 +3980,7 @@ Here a run's computer routes take the server's token. `POST /runs/{id}/computer/
3890
3980
  `AGENTRUN_PUBLIC_URL` that opens that run's live page and socket until the run ends (API doc).
3891
3981
 
3892
3982
  Every other address is `404 not_found`, answered before the request is read further: the console at `/` and its
3893
- assets, sign-in and setup, every other `/settings` route, `POST /mcp`, triggers and their
3983
+ assets, sign-in and setup, every other `/settings` route, `POST /mcp`, every other trigger route and the triggers'
3894
3984
  `POST /hooks/{id}`, the agents list, an agent made or edited through `/agents`, the templates list and every other
3895
3985
  template route, `/openapi.json`, `/llms.txt` and a browser's live view. It has no accounts: there is no page to sign in
3896
3986
  to, so no setup code is printed. The token works as it does on every route served. Unset, `0` or `false` serve the
@@ -4351,21 +4441,22 @@ stays in every total.
4351
4441
  overwrites them. `VACUUM FULL` rewrites the table into a new file (under an exclusive lock), and the old file's
4352
4442
  blocks go back to the filesystem unwiped. Postgres's own WAL and its archived WAL keep the old values until they are
4353
4443
  recycled or expire, and backups keep them for their retention.
4354
- - Its agent's other runs and what the agent learned from it are kept. A promotion record keeps the run's id and the
4355
- commits it names. A run's purge removes its diff file and its feedback line from the folder's current files, and the
4356
- folder's history no longer serves its merge; the bytes stay in the folder's `.git` until a learning reset
4357
- (`DELETE /v2/agents/{id}/learning`) or the agent's purge, which delete the folder whole. Each merge's feedback line goes in
4358
- one commit by the host (none when nothing is left to remove), a line a person edited since stays, and another
4359
- merge's diff that shows the line as context is written without it. The log and a workflow's revisions leave out its
4360
- merges, known by the run the log names for each (its newest 200 changes). A purge takes off main only what the run
4361
- put there, in one host commit: each learned workflow whose `workflow.json` it wrote last (over the whole history,
4362
- past those 200; a host commit that puts a version back names that version's run) goes back, its whole folder, to
4363
- the version before it that no purged run wrote, so another run's champion keeps serving; one it wrote new leaves
4364
- main, its file reads `404`. No run lays its text, and a read at an older commit (a champion by its digest, an SDK
4365
- receipt's pinned commit, a later merge's diff, which shows its files as added) never serves it. Each merge's scrub lands once, so a `DELETE` sent again
4366
- 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`
4367
- does this again. It covers the learning folder on this
4368
- 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.
4444
+ - Its agent's other runs, and what the agent learned from them, are kept. The run's own learning rows go in the purge's
4445
+ transaction: each line it added to `corrections.md`, each learned workflow version it wrote (a person's approve of one
4446
+ goes with it, being still its text; a person's retire or restore of one stays on the version that comes back), its
4447
+ grades, and the promotion records and audit rows of the workflow versions it alone wrote. Its saves stay as facts with
4448
+ no words (a version, its id and its merge key, so the run never merges again), and a person's save that changed only
4449
+ its text loses its words too; no other save names a file or workflow only it wrote.
4450
+ - The purge is a save of the agent's learning (the host's, which the log never shows). A write computed before it (a
4451
+ person's edit, a run's merge) is computed again on what the purge left, so none writes the purged text back. A run of
4452
+ the agent that read its learning before the purge (its seed) has its learning dropped at its end, nothing written
4453
+ (`learning.reason` `purged_since_seed`): the purge changed what it started from, so a file it gives back unchanged
4454
+ can't be told apart from the purged run's. A promotion, audit row or grade written after the purge for what it took
4455
+ (a check of the run's workflow version still replaying, a grade of the purged run) writes nothing. So the log and a
4456
+ workflow's revisions leave it out, and `GET /runs/{id}/learning/diff` is `404`. A workflow it revised goes back to the
4457
+ version before it, so another run's champion keeps serving; one it wrote new is gone, its file reads `404`. A read at
4458
+ an older version id (a champion by its digest, an SDK receipt's pinned save, a later merge's diff) reads the rows as
4459
+ they are now, so it never serves the run's text. A second `DELETE` does this again and finds nothing left.
4369
4460
  - It takes the owner's session (the password sign-in, or the console on a server bound to loopback) or the API token;
4370
4461
  any other console session is `403 forbidden`, no credential `401`. An [API-only](#api-only) server purges a run of
4371
4462
  any agent with its token, as it deletes or purges the whole agent.
@@ -4391,7 +4482,8 @@ delete what it sent. `DELETE /v2/agents/{id}` deletes such an agent whole, in th
4391
4482
  while a `DELETE` runs waits for it, then finds the agent gone (`404`), so none lands after its learning went. Each of
4392
4483
  its runs still going, its learning runs included, is cancelled as `POST /runs/{id}/cancel` cancels it, and the
4393
4484
  delete waits until every one has ended.
4394
- 2. Its learning is deleted by the learning module: every file of its learning folder, then its promotions and grades.
4485
+ 2. Its learning is deleted by the learning module: every learning row of the agent (its corrections, workflows, saves,
4486
+ promotion records, grades and audit rows).
4395
4487
  It refuses while learning work of the agent is in flight: `409 learning_busy`, naming
4396
4488
  that work in `details.runs`.
4397
4489
  3. The rest: its triggers (and what each registered at its source), its saved sign-ins (and each object at its vendor),
@@ -4424,6 +4516,14 @@ server's own origin, under a CSP that allows that origin only, but for the provi
4424
4516
  - **Mission Control**: the store's counts, imported history, analytics and the latest runs, available before the first
4425
4517
  server-run agent and without a model-provider key. Its introduction is dismissible. Connect agent and Query use
4426
4518
  the coding-agent selector; the page refreshes when you return from your coding agent.
4519
+ - **Agent Factory** (`#/factory`): a kanban of sessions reported to this server, including parallel runs of one agent,
4520
+ reported active child conversations, an audit's shadow run while it runs, and sessions without a repository. Waiting, Working, Needs you and Unknown
4521
+ describe execution; a completed run does not prove that its GitHub change passed checks or merged. Cards open the
4522
+ existing run viewer for activity and supported controls. GitHub links come from launch or trusted trigger provenance.
4523
+ Native connector health and missing SDK freshness are explicit; observed sessions do not acquire controls here.
4524
+ Archived active runs remain visible, imported history is excluded, and ended attention is separate from active counts.
4525
+ The board refreshes every ten seconds after a read settles. It reads bounded pages and offers **Load more** with
4526
+ partial-coverage counts; failures preserve the last-known cards with a stale notice.
4427
4527
  - **Agents**: **Build** opens a description composer and local starter templates; **Connected agents** lists definitions,
4428
4528
  with archived ones behind **Archived**. Build, edit and run actions share the remembered coding-agent dropdown,
4429
4529
  including **API playground**. Choosing a template prepares its full definition without creating or running it.
@@ -4452,6 +4552,18 @@ the checks' problems, and the seed and merge revisions. Its changed
4452
4552
  files remain available beside the result. The agent's Learning tab refreshes after returning to the console and
4453
4553
  while visible, without replacing an open edit or review.
4454
4554
 
4555
+ The visibility API uses `GET /v2/runs?scope=active` and `scope=review` (also on an agent's runs route), with `limit`
4556
+ and opaque `next_cursor`. Scope is filtered before pagination; cursors are tied to the scope and agent filters.
4557
+ Do not combine scope with `status` or `archived`. Scoped summaries add `factory` source/control, observation,
4558
+ activity, GitHub provenance and reported-child metadata. A lifecycle version captured inside each run snapshot
4559
+ orders overlapping observations across the two scopes. A run's summary is built once per change of the run and
4560
+ kept on its row, as the runs list keeps its items, so a refresh builds no view of a run that has not changed;
4561
+ only who observes the run and its computer are read at each request (a computer's read opens the run's journal
4562
+ only for a desktop or phone that is up, or a computer held for its owner). GitHub provenance is what the server
4563
+ saved of the delivery that fired the run, never a payload tag found in its input; a run started before servers
4564
+ saved it (0.1.0-beta.39) shows no GitHub link. An online connector is transport health, not a heartbeat for each
4565
+ session. These reads add no scheduling, branch-writing or merge authority.
4566
+
4455
4567
  Its files (`index.html`, and Vite's hashed files under `/assets/`) are public and hold no data: everything it shows
4456
4568
  comes through `/v2`. With accounts on (the default) the console asks for the owner's password
4457
4569
  ([your password](#your-password)) and the browser holds the owner's session cookie; a `?token=` link sets no cookie: the
@@ -4664,22 +4776,25 @@ corrections and shows captured runs; new captures begin with the next normal pro
4664
4776
  Historical learning files remain stored and are not converted into owner corrections or deleted. Older stored
4665
4777
  CLI `learning: "notes"` settings read publicly as `true`; that compatibility read does not rewrite the revision.
4666
4778
 
4667
- An agent that learns has a learning folder, `learning/` in its folder on the disk (`DATA/disk/agents/<key>/learning/`):
4779
+ An agent's learning is kept by the server as versioned rows in its store, SQLite or Postgres alike. It reads as a
4780
+ folder, and the routes name its files by path:
4668
4781
 
4669
4782
  - `corrections.md`, its owner's standing corrections, one `- ` line each, at most 2048 bytes;
4670
4783
  - one folder per learned workflow, `workflows/<name>/`, with its `workflow.json` and its `README.md` (front matter with
4671
4784
  `name` and `description`, and `status: pending` while it waits for its owner's OK).
4672
4785
 
4673
4786
  The server reads and writes it with its own code, in [`src/learn/`](src/learn/SPEC.md), whose `SPEC.md` is the
4674
- folder's contract. The folder is plain git with `main` checked out. The agent's first run that learns makes it, with
4675
- one empty commit on `main`; an agent that does not learn never gets one. The server is its only writer. Every git
4676
- call the server makes there runs with the folder's hooks and fsmonitor off, no replace refs, no lazy fetch and no system
4677
- or global config, one at a time per agent.
4787
+ contract. Three tables hold it: `learning_saves`, one row per version of the agent's learning (its random 40-hex id,
4788
+ its kind: `init`, `run`, `person` or `purged`, who saved it and why, and a run's merge key, one per run and round);
4789
+ `learning_items`, each item's versions (a note: one line of `corrections.md`; a workflow: its folder's files whole, with
4790
+ its `workflow.json`'s digest), never updated, each naming the run whose text it is; and `learning_records`, its promotion
4791
+ records, grades and audit rows. The server is its only writer, and nothing in it runs. The agent's first run that
4792
+ learns makes its first save, empty; an agent that does not learn never gets one.
4678
4793
 
4679
- Each run of an agent that learns starts from `main` as it is when the run is made, whatever its harness:
4794
+ Each run of an agent that learns starts from the agent's newest save when the run is made, whatever its harness:
4680
4795
 
4681
- - `runs/<id>/learning.json` pins that commit (`seed`). It is written once: a resume or a follow-up reads the same
4682
- commit, however `main` moves on.
4796
+ - The run's launch record pins that save's id (`learning.seed`). It is written once: a resume or a follow-up reads the
4797
+ same save, however the agent's learning moves on.
4683
4798
  - The agent's corrections go into the run's instructions after the agent's, under `# Learned`, so a run reads them
4684
4799
  whatever its tools: `corrections.md` whole, after one line that says they are its owner's standing corrections, to
4685
4800
  follow each one that applies. Nothing picks, ranks or summarizes them: the file's cap keeps it whole. A run with no
@@ -4687,7 +4802,7 @@ Each run of an agent that learns starts from `main` as it is when the run is mad
4687
4802
  pi's system prompt and claude-agent's and codex's instructions: the same channel `CLAUDE.md` and `AGENTS.md` travel
4688
4803
  in. No file is written into the run's work. The pin keeps the section the run reads (`section`), so a resume or a
4689
4804
  follow-up reads the same.
4690
- - The workflows the agent learned, each a folder `workflows/<name>/` on `main` with its `workflow.json` and its
4805
+ - The workflows the agent learned, each a folder `workflows/<name>/` at the run's seed with its `workflow.json` and its
4691
4806
  `README.md`, are the run's as one tool, `learned_workflow {name, input}`, on every harness (pi, claude-agent, codex),
4692
4807
  with no edit of the agent's definition. Only an active, promoted revision is: its `README.md` sets no status, or `active`,
4693
4808
  and its promotion record names the checked champion. A compiled draft without that record is withheld; front
@@ -4695,10 +4810,10 @@ Each run of an agent that learns starts from `main` as it is when the run is mad
4695
4810
  than one line) reads as retired, so no run is given it. Its description names each workflow with the line its README gives, 8 KiB of lines in all: by name, each
4696
4811
  while its line fits, and one that does not, or holds one of the server's secrets, is left out. A README whose front
4697
4812
  matter does not read one way (not closed, or a line that is no key at its left edge) is not read. The pin names the
4698
- ones the run gets (`workflows`), each kept whole in the run's directory (`learned-workflows.json`), outside its work,
4699
- and the ones left out (`workflows_left_out`). The list is fixed when the run starts: a workflow approved or retired
4813
+ ones the run gets (`workflows`), each read whole from the rows at the run's seed when the run is claimed, outside its
4814
+ work, and the ones left out (`workflows_left_out`). The list is fixed when the run starts: a workflow approved or retired
4700
4815
  while it runs is the next run's to get or not. A call checks the workflow again against the agent's own tools as its
4701
- run resolves them, as the commit's checks did: one whose call node names a tool the agent was not
4816
+ run resolves them, as the save's checks did: one whose call node names a tool the agent was not
4702
4817
  granted (or one its run resolves unavailable), whose model node names any tool (a learned model node runs without
4703
4818
  tools, so the checks refuse one too), or that holds a code node or a shell or executor call, is refused before any of
4704
4819
  its nodes runs. It runs with the workflow DSL: each model node on the run's own model (the one the run was made with
@@ -4721,15 +4836,13 @@ Each run of an agent that learns starts from `main` as it is when the run is mad
4721
4836
  runs; set to ask, the `learned_workflow` call asks once, naming every such tool, and the run parks. A run's own draft
4722
4837
  can't call one yet: the checks admitting it are coming.
4723
4838
 
4724
- The server reads the commit with git plumbing, never the working tree. What it holds that is not a regular UTF-8 file of
4725
- 1 MiB or less, or a workflow out of shape, is not read, and the server's stderr names it. A learning fault never blocks
4726
- a run: when the folder cannot be made or read, the run starts with nothing learned. A host without
4727
- git 2.32 or later (what learning's own git calls need) is one such fault, said once on stderr.
4839
+ A workflow out of shape is not read, and the server's stderr names it. A learning fault never blocks a run: when the
4840
+ agent's learning cannot be read, the run starts with nothing learned (`seed_failed`).
4728
4841
 
4729
4842
  ### What a run learns
4730
4843
 
4731
- When a run that learns answers or fails, its end step (`src/runner/reflect-hook.ts`) keeps two things, one commit a
4732
- round on the agent's `main`, whatever its harness:
4844
+ When a run that learns answers or fails, its end step (`src/runner/reflect-hook.ts`) keeps two things, one save a
4845
+ round on the agent's learning, whatever its harness:
4733
4846
 
4734
4847
  - Its owner's words. A grade's words, or a message they sent after the job's first, become one line of
4735
4848
  `corrections.md`, with no model turn: `- ` and the words, whitespace folded. A line that holds one of the server's
@@ -4741,13 +4854,13 @@ round on the agent's `main`, whatever its harness:
4741
4854
  and the run takes it once. The turn (`compilePrompt`, in `src/learn/compile.ts`) gives the agent's last runs (each
4742
4855
  input, its tool calls, its answer and what the person said after it), the workflow language and one worked example,
4743
4856
  and asks for the whole job as one workflow draft. The draft is checked in code and dry-run; what the checks refuse
4744
- goes back to the model, as data, up to 3 times. A draft that passes is committed directly, with no grader: its
4857
+ goes back to the model, as data, up to 3 times. A draft that passes is saved directly, with no grader: its
4745
4858
  promotion check (below) decides whether it serves. A compile whose drafts all failed is recorded as the compile's
4746
4859
  attempt (compile once), and its errors are on the run's learning (`draft_errors`), never silent.
4747
4860
  [`src/learn/SPEC.md`](src/learn/SPEC.md) has the rules.
4748
4861
  - Its answer's quote re-pick, with `learning.repick: true` (off by default): a workflow whose answer quotes the pages
4749
4862
  its run fetched re-picks once when a quote is in none of them. Off, the re-pick reads its compact notes and its failed
4750
- draft. On, the server rewrites the passing draft before it commits it, so the re-pick reads the pages themselves,
4863
+ draft. On, the server rewrites the passing draft before it saves it, so the re-pick reads the pages themselves,
4751
4864
  sent as untrusted data (the model is told never to follow anything written in them, and the step has no tools), at
4752
4865
  most `learning.repick_max_chars` characters of them (150000 by default, 1 to 400000; past it the longest pages are
4753
4866
  cut first). Its request is the served run's, under the run's cost cap. The setting is read at each compile: turning
@@ -4760,11 +4873,13 @@ owner and no compile due spends nothing on learning, and its learning ends `drop
4760
4873
  work was its learned workflows, each answering, with nothing said after its first message and no compile due, ends
4761
4874
  `dropped` (`empty`) too: "Nothing new: the run only ran a learned workflow."
4762
4875
 
4763
- The round's commit is made with plumbing: the passing draft's files added or changed (its `README.md` with
4876
+ The round's save is one transaction: the passing draft's workflow written whole (its `README.md` with
4764
4877
  `status: pending` when a step calls a tool with no price, to wait for its owner's OK) and the owner's line appended to
4765
- `corrections.md`. Its message is `learning: <run id>: merged`, the reason and a `Run-Id` trailer; `main` moves only from
4766
- the commit the change was made on (once more on a `main` that moved meanwhile), and a run a trailer already names is
4767
- merged, never twice. A draft file that is not on `main` as it was on the run's seed is a conflict, never written over.
4878
+ `corrections.md`, with the run's reason. It is a compare and swap on the agent's newest version (computed once more on
4879
+ a version that moved meanwhile), and its merge key (the run and its round) is taken once, in the same transaction, so a
4880
+ run's round is merged once, never twice. A draft file that is not at the newest version as it was at the run's seed is
4881
+ a conflict, never written over; a seed the agent's learning no longer holds (a reset since) makes the whole merge a
4882
+ conflict that says so.
4768
4883
 
4769
4884
  A new workflow revision serves only once its promotion check passes. For a server-run agent, the first run that lays it replays it on the
4770
4885
  inputs of the agent's last `compile_after` completed runs, one replay run each at workflow cost, and scores each against
@@ -4815,7 +4930,7 @@ evidence and the shadow result through the run-scoped SDK credential.
4815
4930
  The run's `learning` (on `GET /runs/{run_id}`, and `{state, reason, detail}` in run lists, the detail cut to 140
4816
4931
  characters and no time) says how it went: `seeded`, then `reflecting` during its end step, and `merged`, or `dropped`
4817
4932
  with a reason from a closed list (`seed_failed`, `no_budget`, `unknown_cost`, `cancelled`, `crashed`, `reflect_failed`,
4818
- `empty`, `checker`, `use`; a run record with any other reason is not counted). It is `null` for a run that does not
4933
+ `empty`, `checker`, `use`, `reset`, `purged_since_seed`; a run record with any other reason is not counted). It is `null` for a run that does not
4819
4934
  learn (its agent's `learning` is not true, the server's switch was off when it started, or it is a workflow's or an
4820
4935
  imported run). Its `detail` says the same in a person's words, never the machine's: "Started from 2 corrections.",
4821
4936
  "Keeping what this run learned…", "Learned the workflow sort-invoice. Kept your correction.", "Nothing new to keep from
@@ -4845,64 +4960,60 @@ proposed and reused, staleness after a rule changes, and wrong keeps after a pla
4845
4960
  A person reads and changes an agent's learning through this server's own routes (`learning/1` in `/v2/openapi.json`),
4846
4961
  with the token, an archived agent's too:
4847
4962
 
4848
- - `GET /agents/{agent_id}/learning`: `main`'s head, `corrections.md` as `corrections`, the learned workflows (each its
4963
+ - `GET /agents/{agent_id}/learning`: its newest save's id as `main`, `corrections.md` as `corrections`, the learned workflows (each its
4849
4964
  name, files, description, status and `etag`; `status` is one word: `pending` or `retired` as its `README.md` says,
4850
4965
  else where it stands as `.../learning/promotions` says it: `serving`, `checking`, `held` or `stopped`, a champion
4851
- the cost rule stopped included), the first 20 changes on `main` (newest first, each `by: {run}` from its
4852
- `Run-Id` trailer or `{user: true}`, with its commit, time, reason and files), how the agent's runs that tried to learn
4966
+ the cost rule stopped included), the first 20 changes of its log (newest first, each `by: {run}` for a run's merge or
4967
+ `{user: true}` for a person's change, with its save id as `commit`, time, reason and files), how the agent's runs that tried to learn
4853
4968
  fared (`merged`, `dropped` by reason, `in_progress`), counted as `GET /stats` counts them, and `impact`, what
4854
4969
  learning changed: the agent's completed runs that started from at least one learned item (a correction, or a learned
4855
4970
  workflow) against those that started before its first, each side's `runs`; `median_duration_s`, the time to the
4856
4971
  answer (the run's start to its job's end, before its end-of-run step). What a run costs, learning included, and what
4857
4972
  learning itself cost are `.../learning/cost`'s (`summary.before`/`after`, the bill's `learning_usd`).
4858
- Null unless both sides count 2 runs. An agent with no folder answers `main: null`, empty lists and `impact: null`.
4859
- `GET .../learning/log?cursor=&limit=` pages on, up to 200 at a time; a cursor reads the same commit its first page
4860
- did.
4861
- - `GET .../learning/corrections`: `corrections.md` on `main` as `{text, etag, cap_bytes}` (empty text when there is
4973
+ Null unless both sides count 2 runs. An agent with no save yet answers `main: null`, empty lists and `impact: null`.
4974
+ `GET .../learning/log?cursor=&limit=` pages on, up to 200 at a time; a cursor names the version its page stopped at, so the
4975
+ next page starts below it however the log grew since.
4976
+ - `GET .../learning/corrections`: `corrections.md` at the newest save as `{text, etag, cap_bytes}` (empty text when there is
4862
4977
  none). `PUT .../learning/corrections` with `{text}` replaces it whole under `If-Match: <etag>`: a stale ETag is 412,
4863
4978
  none (or `If-Match: *`) 428 `precondition_required`. A text that holds one of the server's secrets, a secret's shape or
4864
4979
  a hidden character, or passes 2048 bytes, is 422 with the problems, and nothing is written. A text read cut of a
4865
- secret and sent back keeps the cut: a person's write never puts a secret back. One commit on `main` in the agent's
4866
- queue, `learning: edited by a person: corrections.md` with a `Changed-By: user` trailer.
4867
- - `GET .../learning/files/{file}`: `corrections.md` or a workflow's file on `main`, with its `ETag`, the file's git blob
4868
- id. `POST .../learning/files/{file}/retire` under `If-Match`, on a workflow's `README.md`, sets `status: retired`: no
4980
+ secret and sent back keeps the cut: a person's write never puts a secret back. One save of the agent's learning,
4981
+ `edited by a person: corrections.md`, which the log shows as `by: {user: true}`.
4982
+ - `GET .../learning/files/{file}`: `corrections.md` or a workflow's file at the newest save, with its `ETag`, its text's
4983
+ blob id (as git would name its bytes). `POST .../learning/files/{file}/retire` under `If-Match`, on a workflow's `README.md`, sets `status: retired`: no
4869
4984
  later run is given it. `POST .../learning/files/{file}/approve` makes a pending workflow active (see
4870
4985
  [Approving a workflow that waits](#approving-a-workflow-that-waits), below). `POST .../learning/files/{file}/restore`
4871
4986
  under `If-Match` gives a retired workflow to every later run again, after checking its files again as a run's draft
4872
4987
  is checked (a refusal is 400 with `problems`, and it stays retired); it takes the owner's password session alone, as
4873
4988
  an approval does. The learning view gives each workflow `last_change` (`{kind, by, at}`: `approved`, `edited`,
4874
4989
  `created`, `retired` or `restored` by a `person`, or `learned` by a `run`) and each retired one `retired` (`{at, by}`).
4875
- - `GET .../learning/workflows/{name}/revisions` lists a learned workflow's revisions on `main`;
4990
+ - `GET .../learning/workflows/{name}/revisions` lists a learned workflow's revisions, newest first;
4876
4991
  `GET .../learning/promotions` its promotion records; `GET .../learning/loop` each compile turn; and
4877
4992
  `GET .../learning/cost` the agent's cost per run, run after run.
4878
- - `DELETE /agents/{agent_id}/learning` resets the agent's learning: its learning folder whole (`corrections.md`, its
4879
- workflows, their history and the audit ledger), here and on every Archil disk its runs used (`503` while one can't be
4880
- reached), then its promotion records and grades. The agent and its runs stay,
4993
+ - `DELETE /agents/{agent_id}/learning` resets the agent's learning: every learning row of the agent (`corrections.md`,
4994
+ its workflows, every save and version of them, its promotion records, grades and audit rows), in one transaction. A
4995
+ run started before it from a save it removed merges nothing: its seed is no longer held, a conflict. The agent and its runs stay,
4881
4996
  with their files, costs and each run's own learning, so the run list, `GET /stats` and `GET /usage` read the same (a
4882
- served run keeps its share of its revision's compile and check); a run's learning diff goes with the folder (404);
4997
+ served run keeps its share of its revision's compile and check); a run's learning diff goes with the rows (404);
4883
4998
  the next run takes the agent path, given nothing learned. It cancels the runs that exist only for learning (replays,
4884
4999
  audit shadows) and waits for them; while a run of the agent's own is still going it is `409 learning_busy` (each named
4885
5000
  in `details.runs`), and nothing is deleted. `204`, a second call and an agent that never learned included. The
4886
5001
  API-only profile serves it too.
4887
5002
  - `GET /runs/{run_id}/learning`: the run's learning whole (its seed, its merge, the corrections it added, the workflow it
4888
5003
  wrote, its compile turn's attempts and the checks' problems), `null` for a run that does not learn.
4889
- `GET /runs/{run_id}/learning/diff`: a merged run's merge commit against its parent, each file's patch as git writes it
4890
- from the first `@@`, or `withheld` (`too_large`, `secret`).
4891
-
4892
- Every read is the folder's snapshot (`.agentrun/snapshot.json`, written last by the same exec as each commit to
4893
- `main`), the files it names, each checked against its blob id (a file that is not, read twice, is a write in flight:
4894
- `503`), and a merge's `.agentrun/diffs/<run>.json`, through the folder's file API: no git and no exec. Every text it
4895
- answers is cut of the server's secrets as they are then; a file name holding one (a workflow named after a value made
4896
- secret since, say) reads `[redacted]` whole, in the workflows, the log's `files` and a diff's `path`, while its route
4897
- still answers the real name to a caller who knows it. A log page reads the snapshot alone (it keeps the newest 200
4898
- changes). A cursor reads at the main it names while this server still holds that snapshot, else as the first page of
4899
- `main` now. Every write to `main` (a run's merge, a person's corrections, retire, approve or restore) is one exec of the learning
4900
- script, a compare and swap on `main`. A symbolic link at the agent's home, its learning folder or the folder's `.git` is never
4901
- followed: a read or a write there answers `500`, and nothing is written.
5004
+ `GET /runs/{run_id}/learning/diff`: a merged run's merge save against the one before it, each file's patch in unified
5005
+ diff form from the first `@@` (as git writes one), `404` once the run is purged or the agent's learning reset, or `withheld` (`too_large`, `secret`).
5006
+
5007
+ Every read is the store's learning rows: the newest save, or a save by its id, read as the rows are now (so a purged
5008
+ run's text is never served at any version). Every text it answers is cut of the server's secrets as they are then; a
5009
+ file name holding one (a workflow named after a value made secret since, say) reads `[redacted]` whole, in the
5010
+ workflows, the log's `files` and a diff's `path`, while its route still answers the real name to a caller who knows it.
5011
+ Every write (a run's merge, a person's corrections, retire, approve or restore) is one save, a compare and swap on the
5012
+ agent's newest version, computed again when another write landed first; one that keeps losing is `503`, to retry.
4902
5013
 
4903
5014
  ### Approving a workflow that waits
4904
5015
 
4905
- A learned workflow whose step calls a tool with no price is committed with `status: pending` in its `README.md` and
5016
+ A learned workflow whose step calls a tool with no price is saved with `status: pending` in its `README.md` and
4906
5017
  given to no run until its owner approves it.
4907
5018
 
4908
5019
  Who can approve: the owner, signed in with their password. No token approves, the server's own included, so a run that reaches this server only through its API (its MCP tools, a sandbox run) can't approve its own workflows. Runs that use bash on the host run as you: they can read this server's files, its session key among them, so no route keeps them from approving. For untrusted tasks, use the sandbox.
@@ -4913,8 +5024,7 @@ carry) and a token sent beside the session. So is every request on a server with
4913
5024
  (`AGENTRUN_ACCOUNTS=0`), which has no password session: its console session comes from the launch code, never the token. With no credential it is 401, as every route.
4914
5025
  `capabilities.learning.approve` is true only for the owner's session; every other caller reads `approve: false` with
4915
5026
  `approve_needs: "password"`. A workflow that is not pending is 400; a stale ETag is 412, none 428. The approval is one
4916
- host commit, `learning: approved by a person: <file>`, with the trailers `Changed-By: user` and `Approved-Via: console`;
4917
- the log shows `by: {user: true, via: "console"}` at the commit's time.
5027
+ save, `approved by a person: <file>`; the log shows `by: {user: true, via: "console"}` at the save's time.
4918
5028
 
4919
5029
  ## A run's cost: its tokens and its basis
4920
5030
 
@@ -5009,7 +5119,7 @@ were reached. Nothing is priced here, and nothing is rounded to a billing increm
5009
5119
  over a 730-hour month); a computer still open is counted up to `measured_to` (`open_computers` says how many). `usd` is
5010
5120
  what the run's ledger booked for it while a claim held the computer, at the operator's price ([Computer
5011
5121
  time](#computer-time)), so `total` stays the run's `cost.usd`. The part no claim held (`unheld_quantity`: a computer
5012
- kept past its claim for a follow-up, one deleted after its run, one whose delete failed) is in no cost. A resource with
5122
+ kept past its claim for a follow-up, one deleted after its run, one whose delete failed) is in no cost; on a provider that bills nothing (`docker`) it reads 0, since none of its time costs anything. A resource with
5013
5123
  no price set, or whose figure no one said, is `unpriced`, its `usd` null; a provider that bills nothing (`docker`) is
5014
5124
  $0. A `compute_time` line that is `unpriced` and any `unheld_quantity` are outside `total`.
5015
5125
  ```json