@parcha/agentrun-serve 0.1.0-beta.47 → 0.1.0-beta.49

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 (185) hide show
  1. package/CHANGELOG.md +68 -1
  2. package/README.md +218 -20
  3. package/dist/acp-package.d.ts +24 -6
  4. package/dist/adapter-facts.d.ts +0 -4
  5. package/dist/adapter-facts.js +1 -4
  6. package/dist/adapters.d.ts +3 -12
  7. package/dist/adapters.js +1 -70
  8. package/dist/agent-delete.d.ts +33 -10
  9. package/dist/agent-delete.js +184 -26
  10. package/dist/agents-store.d.ts +6 -2
  11. package/dist/agents-store.js +18 -5
  12. package/dist/agents.d.ts +8 -1
  13. package/dist/agents.js +14 -4
  14. package/dist/answer-json.d.ts +10 -0
  15. package/dist/answer-json.js +23 -0
  16. package/dist/api-only.d.ts +5 -2
  17. package/dist/api-only.js +10 -2
  18. package/dist/archil-routes.d.ts +1 -1
  19. package/dist/archil-routes.js +4 -3
  20. package/dist/browser-live.d.ts +9 -4
  21. package/dist/browser-live.js +18 -5
  22. package/dist/browser-sessions.d.ts +56 -0
  23. package/dist/browser-sessions.js +117 -0
  24. package/dist/cap.js +7 -9
  25. package/dist/cli.js +6 -6
  26. package/dist/computer-routes.d.ts +6 -14
  27. package/dist/computer-routes.js +8 -10
  28. package/dist/computers.d.ts +6 -2
  29. package/dist/computers.js +4 -2
  30. package/dist/conformance.d.ts +4 -0
  31. package/dist/conformance.js +6 -0
  32. package/dist/console/assets/index-Bzn4eUYF.js +715 -0
  33. package/dist/console/assets/index-CR2ZGei1.css +1 -0
  34. package/dist/console/index.html +2 -2
  35. package/dist/errors.d.ts +4 -1
  36. package/dist/errors.js +15 -5
  37. package/dist/harness-check.d.ts +3 -1
  38. package/dist/harness-check.js +99 -70
  39. package/dist/harness-cursor.d.ts +10 -27
  40. package/dist/harness-cursor.js +5 -84
  41. package/dist/harness-goose.d.ts +4 -29
  42. package/dist/harness-goose.js +6 -86
  43. package/dist/harness-module.d.ts +4 -0
  44. package/dist/harness-module.js +1 -0
  45. package/dist/harness-owned.d.ts +52 -0
  46. package/dist/harness-owned.js +92 -0
  47. package/dist/harness-recipe.js +2 -24
  48. package/dist/harness-table.d.ts +109 -6
  49. package/dist/harness-table.js +242 -28
  50. package/dist/harness.js +2 -2
  51. package/dist/import.js +4 -3
  52. package/dist/key-refusal.d.ts +2 -1
  53. package/dist/key-refusal.js +18 -2
  54. package/dist/learn/check.d.ts +11 -2
  55. package/dist/learn/check.js +12 -9
  56. package/dist/learn/promote.d.ts +18 -1
  57. package/dist/learn/promote.js +47 -0
  58. package/dist/learn/repick.d.ts +34 -0
  59. package/dist/learn/repick.js +201 -0
  60. package/dist/learn/secrets.d.ts +4 -0
  61. package/dist/learn/secrets.js +23 -0
  62. package/dist/learned-workflow.d.ts +2 -0
  63. package/dist/learned-workflow.js +18 -1
  64. package/dist/learning-model.d.ts +18 -0
  65. package/dist/learning-model.js +77 -0
  66. package/dist/learning-setting.d.ts +13 -0
  67. package/dist/learning-setting.js +23 -1
  68. package/dist/llms.txt +1 -0
  69. package/dist/model-form.js +12 -12
  70. package/dist/model.d.ts +5 -4
  71. package/dist/model.js +19 -13
  72. package/dist/openapi.js +203 -15
  73. package/dist/page.d.ts +1 -0
  74. package/dist/page.js +1 -1
  75. package/dist/paid-calls.d.ts +4 -1
  76. package/dist/paid-calls.js +1 -1
  77. package/dist/run-learning-served.d.ts +1 -1
  78. package/dist/run-secrets.d.ts +2 -2
  79. package/dist/run-secrets.js +6 -5
  80. package/dist/run-trace.js +6 -3
  81. package/dist/run-usage.d.ts +110 -0
  82. package/dist/run-usage.js +312 -0
  83. package/dist/runner/adapter-loop.d.ts +4 -1
  84. package/dist/runner/adapter-loop.js +52 -22
  85. package/dist/runner/adapter-run-spec.d.ts +3 -2
  86. package/dist/runner/adapter-run-spec.js +8 -4
  87. package/dist/runner/adapters/index.d.ts +4 -2
  88. package/dist/runner/adapters/index.js +6 -42
  89. package/dist/runner/cli-run-spec.js +10 -6
  90. package/dist/runner/conformance/harness.d.ts +2 -0
  91. package/dist/runner/conformance/harness.js +18 -4
  92. package/dist/runner/conformance/host-tools.d.ts +4 -0
  93. package/dist/runner/conformance/host-tools.js +14 -0
  94. package/dist/runner/feedback-round.d.ts +29 -1
  95. package/dist/runner/feedback-round.js +54 -3
  96. package/dist/runner/journal-kinds.d.ts +3 -1
  97. package/dist/runner/learning-end.js +49 -18
  98. package/dist/runner/loop-contract.d.ts +3 -0
  99. package/dist/runner/meta-tools.js +4 -2
  100. package/dist/runner/monid-run.js +2 -2
  101. package/dist/runner/presence.d.ts +3 -0
  102. package/dist/runner/presence.js +19 -12
  103. package/dist/runner/promotion.d.ts +62 -4
  104. package/dist/runner/promotion.js +154 -17
  105. package/dist/runner/reflect-hook.js +3 -2
  106. package/dist/runner/sdk-loop.js +25 -1
  107. package/dist/runner/workflow-spec.js +3 -2
  108. package/dist/runs-over-store.d.ts +5 -3
  109. package/dist/runs-over-store.js +11 -11
  110. package/dist/sdk/check.d.ts +31 -0
  111. package/dist/sdk/check.js +58 -0
  112. package/dist/sdk/runs.d.ts +10 -2
  113. package/dist/sdk/runs.js +87 -17
  114. package/dist/sdk/schema.js +11 -3
  115. package/dist/server.d.ts +6 -3
  116. package/dist/server.js +297 -98
  117. package/dist/store/index.d.ts +2 -2
  118. package/dist/store/index.js +1 -1
  119. package/dist/store/journal/storage.js +1 -1
  120. package/dist/store/open.d.ts +1 -1
  121. package/dist/store/open.js +1 -1
  122. package/dist/store/postgres/migrations/0021_purged.sql +13 -0
  123. package/dist/store/postgres/migrations/0022_computer_intervals.sql +27 -0
  124. package/dist/store/schema.d.ts +15 -1
  125. package/dist/store/schema.js +50 -5
  126. package/dist/store/sqlite/connection.d.ts +4 -1
  127. package/dist/store/sqlite/connection.js +5 -0
  128. package/dist/store/sqlite/run-patch.d.ts +8 -3
  129. package/dist/store/sqlite/run-patch.js +15 -7
  130. package/dist/store/sqlite/store.d.ts +5 -2
  131. package/dist/store/sqlite/store.js +283 -77
  132. package/dist/store/sqlite/worker.d.ts +9 -0
  133. package/dist/store/sqlite/worker.js +18 -1
  134. package/dist/store/store.d.ts +162 -27
  135. package/dist/store/store.js +63 -0
  136. package/dist/store-reads/analytics.js +2 -1
  137. package/dist/store-reads/cap.d.ts +8 -2
  138. package/dist/store-reads/cap.js +27 -3
  139. package/dist/store-reads/learning.d.ts +1 -1
  140. package/dist/store-reads/learning.js +5 -2
  141. package/dist/store-reads/runs.js +2 -0
  142. package/dist/store-reads/stats.js +4 -2
  143. package/dist/store-view.d.ts +12 -3
  144. package/dist/store-view.js +70 -27
  145. package/dist/template-eval.js +5 -2
  146. package/dist/template-github-permissions.d.ts +5 -1
  147. package/dist/template-github-permissions.js +7 -3
  148. package/dist/timeline/index.d.ts +1 -1
  149. package/dist/timeline/index.js +1 -1
  150. package/dist/timeline/timeline.d.ts +8 -0
  151. package/dist/timeline/timeline.js +18 -6
  152. package/dist/tool-gate.d.ts +8 -4
  153. package/dist/tool-gate.js +6 -7
  154. package/dist/tool-plane.d.ts +4 -0
  155. package/dist/tool-plane.js +10 -10
  156. package/dist/tools.js +9 -0
  157. package/dist/trigger-targets.d.ts +14 -2
  158. package/dist/trigger-targets.js +73 -4
  159. package/dist/triggers.d.ts +2 -1
  160. package/dist/triggers.js +5 -2
  161. package/dist/validate.d.ts +4 -2
  162. package/dist/validate.js +18 -4
  163. package/dist/viewer-credential.d.ts +24 -0
  164. package/dist/viewer-credential.js +53 -0
  165. package/dist/workspace/computer-for-claim.d.ts +5 -1
  166. package/dist/workspace/computer-for-claim.js +47 -18
  167. package/dist/workspace/computer-intervals.d.ts +20 -0
  168. package/dist/workspace/computer-intervals.js +49 -0
  169. package/dist/workspace/computer-janitor.d.ts +7 -3
  170. package/dist/workspace/computer-janitor.js +14 -6
  171. package/dist/workspace/computer-kept.d.ts +7 -2
  172. package/dist/workspace/computer-kept.js +9 -2
  173. package/dist/workspace/resolve-computer.d.ts +9 -1
  174. package/dist/workspace/resolve-computer.js +29 -22
  175. package/dist/workspace/run-end-computers.d.ts +1 -0
  176. package/dist/workspace/run-end-computers.js +4 -1
  177. package/package.json +18 -10
  178. package/templates/code-review/agent.md +2 -3
  179. package/templates/code-review/evals/mentions-defused/case.yaml +0 -1
  180. package/templates/code-review/evals/mentions-defused/fixtures/github-mcp.json +0 -27
  181. package/templates/code-review/evals/other-repo/case.yaml +0 -1
  182. package/templates/code-review/evals/other-repo/fixtures/github-mcp.json +0 -18
  183. package/templates/code-review/evals/other-repo/graders/no-other-repo.md +1 -1
  184. package/dist/console/assets/index-BBFzAxLB.js +0 -715
  185. package/dist/console/assets/index-BRi-Rgq6.css +0 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,73 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## 0.1.0-beta.49 (2026-11-20)
6
+
7
+ - An agent's `learning` takes `repick: true` (off by default): a learned workflow compiled after it re-picks a missed <!-- changes/learning-repick-pages.md -->
8
+ quote from the pages its run fetched, not from its compact notes alone. The server rewrites the passing draft before it
9
+ commits it: the answer's re-pick loop runs the answer step as compiled first, then, on a miss, the same step reading
10
+ the pages, told they are untrusted data and never instructions, with no tools. `learning.repick_max_chars` (150000 by
11
+ default, 1 to 400000) caps the characters that second pass sends, the longest pages cut first. Its cost is the served
12
+ run's, under the run's cost cap. The setting is read at each compile, so a change reaches only workflows compiled after
13
+ it; agents whose workflows run through an SDK bridge ignore it.
14
+ - A purged run's or agent's content no longer stays in the SQLite store's file bytes: every store connection writes with `secure_delete` on, so a deleted or overwritten row's bytes are zeroed in its page, and a purge checkpoints the WAL (`TRUNCATE`) once it commits, so neither `store.sqlite` nor its `-wal` keeps an earlier copy. The checkpoint waits a few milliseconds for another connection, never the store's 10 s busy wait, so it holds up no other request. One another connection holds back is retried once, then logged (the next purge's checkpoint or the server's stop clears it), and never fails the `DELETE`. Postgres is not covered: `VACUUM` only makes a purged row's space reusable, so its bytes stay until a later write overwrites them; `VACUUM FULL` rewrites the table; Postgres's WAL, archived WAL and backups keep the old values for their own lifetimes. <!-- changes/purge-secure-delete.md -->
15
+ - `DELETE /v2/runs/{run_id}` purges a run that is not live: its launch, journal and timeline, messages, outputs and files, folders, kept answers, its agent's grades of it, its kept learning's content and what its agent's promotion records copied from it (a disagreement's input and answers; each record's decision, numbers and run ids stay) go, with the runs made from it (its audit's shadow run, the replay runs of its input, a learning run that grades it); no replay or shadow run of a purged run is started. Its row stays as a tombstone (id, agent, state, times, cost, purge time): `/usage`, `/stats` and a cap's spend read are unchanged, every route of the run answers `410 purged` with the tombstone in `details`, and no run list shows it. A second `DELETE` is `204`; a live run (queued, working, waiting on a person, or held by a runner) is `409 run_not_final`, nothing purged; a purge stopped part way is finished by the next `DELETE`. A message, a trigger's message or a grade sent to the run while its `DELETE` runs waits for it and is then `410 purged`. `DELETE /v2/agents/{agent_id}` now purges an archived agent made here the same way (its definition, learning, triggers, sign-ins, computer, disk and folders go, its runs become tombstones, its row is a tombstone answering `410 purged`); one not archived is `409 agent_not_archived`, which replaces `agent_not_external`. An unarchive or a write sent to the agent while its purge runs (its home, its definition, a move of its current revision) is `410 purged` once it ends, as is a definition edit or a template update whose body arrives after it, and a trigger made for a purged agent or moved to it: nothing of a purged agent is written again; after a purge stopped part way, each is `409 agent_not_runnable` until a `DELETE` finishes it. An agent another system owns is deleted whole, as before. Both deletes take the owner's session or the API token: any other console session is `403 forbidden`. The TypeScript client, the Python client and the CLI (`agentrun runs delete`) carry the new operation. <!-- changes/run-delete.md -->
16
+ - `GET /v2/runs/{run_id}/usage` (`runusage/1`) says what one run cost, line by line, and whose invoice each part lands on: `tokens` per model (`model`, and `provider` where the server sent the requests itself; null behind a gateway), `tools` per charger (`charged_by`, with calls of unpriced tools in `not_metered_calls`), and `browser_time` per browser provider (`provider`, seconds). Each line has its quantity as measured, its dollars as the run's booking holds them, and its basis (`reported`, `estimate`, `unpriced`). It reads the same for a pi run, a CLI-harness run and a workflow run (its decisions on the model that answered them). The lines join to `total`, the run's `cost.usd`; a charge of unknown cost is null with what is known beside it, never $0. `ended_at` is the end the lines cover: a follow-up can reopen an ended run, and a later read with another `ended_at` says it moved. The console's Dev tools tab shows the lines as "Cost by line". In the kernel, a paid request may say `reported` (it settles at the provider's own figure), written on its `runner.request`. <!-- changes/run-usage-lines.md -->
17
+ - `GET /v2/computers`' `folder` field is described by its rule alone, naming no vendor: `bind` a folder of this machine (Mode 1), `archil` the owner's Archil disk where the provider takes an Archil mount, has Archil's image and does not dial this server, `sync` a synced folder the runner keeps for any other computer that takes a folder in Mode 2, null none. The computer package's README no longer says a program of the user can join the window manager's namespace with nsenter: root made it, and the user holds no capability there. A Daytona desktop on exec is refused in the shared refusal's words alone. `runConformance` takes `onScreenshot(png)`, called with screen.screenshot-size's last whole screenshot. <!-- changes/computer-untangle-16.md -->
18
+ - In the console, updating an agent from a template (Update <agent>) now says it was updated and names the new revision ("Updated: rev 2"). It used to say the template was applied and "The agent is made", as if the apply had made a new agent. Only an Apply that makes a new agent says "made". <!-- changes/template-update-says-updated.md -->
19
+ - A scheduled run handed its previous result's `x-carried` fields is told how many entries each carried array lost from its front, "the first N entries" (the template keeps the array oldest first), no longer "the N oldest": the engine drops from the front and reads no dates. A stored `x-carried` the save would refuse (a repeated, unknown or empty name) is read as none, so its run gets the too-large line. `submitParameters` leaves every `x-` keyword out of submit tool schemas, as it does `criteria`, not only `x-carried`; a property or definition so named keeps its name. <!-- changes/x-carried-first-entries.md -->
20
+ - A run's look-back (its own after its job, or the feedback round a grade opens) keeps the run's end: GET, the list, SSE and the console show it completed (or failed) with its answer and `ended_at` while its learning reads `reflecting`, polled until it settles, and it tells `run.ended` once. Stop and cancel refuse it then, and a runner-side stop or cancel that lands mid-round drops only the round, so a graded run is never left cancelled or stopped. A runner lost during the look-back leaves the next one the same end at the same time. `PUT /runs/{run_id}/grade` during a look-back is `409 run_learning` (a new error code), nothing kept: grade the run once its learning moves on from `reflecting`. The console shows no Grade form then, and says why. <!-- changes/grade-keeps-run-end.md -->
21
+ - `GET /v2/runs/{run_id}/usage` gives `browser_sessions` (`runusage/2`): one record per browser session the run opened, with the provider's session id, when the server opened it and let it go, why it ended, the seconds charged for it, and the provider's own record of it (`provider_record`: its start, end and proxy bytes), read once when the session is let go. With it a person running AgentRun sees how long each session ran, spots one that ended late or was lost, and finds each on the provider's own dashboard and invoice by its id. A provider that keeps no record, or a read that fails, says so in `provider_record_status`, with the record null, never zeros. In the computer package, a browser provider may offer `sessionUsage(ref)`, the vendor's record of a session; Browserbase's reads `GET /v1/sessions/{id}`. <!-- changes/run-usage-browser-sessions.md -->
22
+ - `GET /v2/runs/{run_id}/usage` gives `computer_intervals` (`runusage/3`): one record per computer the run made through its provider (a sandbox, a desktop or a phone), by when each was made, with the provider's own id for it (`provider_id`), its `kind`, what its create asked for (`gpu`, `cpus`, `memory_mb`; null where it asked none, never a guess), when the create answered (`started_at`), when the provider's delete of it answered ok (`ended_at`), and whether the run's park kept it past its claim (`kept`). With it a person running AgentRun sees how long each of a run's computers lived, finds one left running after its run (`ended_at` null: no delete was proven, never a guessed end), and matches the provider's invoice by its id. The server writes the store's new `computer_intervals` table (Postgres migration `0022_computer_intervals.sql`; a SQLite store gets it at the server's open) at the claim's create, the park, and every delete that answers ok: the claim's release, a later claim letting an earlier one's go, the run's end, a kept computer's end, and the janitor's sweeps. A write that fails is said on the runner's log and never fails the run. The agent's own computer, a paired one and `--faux`'s have no record. Computer time is not priced: it is on no line and not in `total`. A `tools` line now names its `provider` too, the same vendor as `charged_by`; a `tokens` line behind a model gateway keeps `provider` null, since the server does not know the gateway's upstream. <!-- changes/computer-intervals.md -->
23
+ - An agent whose `input_schema` has fields of its own, all optional, takes a run that gives one of them and no `content`: a template's `pr_number` run by hand (`{"pr_number": 3318}`) starts, where it was refused 422 `input.content is required`, though the schema left `content` out and closed the object. A run still has to say something: an input with neither `content` nor any of those fields is refused at `input.content`, naming the fields that would do instead. A schema with no field of its own, or with one required, is unchanged. <!-- changes/input-content-or-field.md -->
24
+
25
+ ## 0.1.0-beta.48 (2026-11-20)
26
+
27
+ - A harness module builds its harness the way the built-in harnesses are built: `entries(builtins, kit)` now gets a kit with `kit.adapterEntry(facts, adapter)` and `kit.acpEntry({ facts, recipe, proxy })`, so the harness is offered its wire's vendor's models, named on that vendor's and OpenRouter's key rows, and gated and named by its own facts. [HARNESS.md](../../HARNESS.md) is the guide, and `examples/harness-module` is a whole module (Goose under an id of its own). <!-- changes/harness-modules-kit.md -->
28
+ - The built-in harnesses read the same facts as before, with or without a module loaded.
29
+ - An adapter harness that loads skills itself gives `kit.adapterEntry` a `skillCheck`: the run's skills it accepts are taken out of the prompt and handed to its adapter as `launch.skills`.
30
+ - `kit.acpEntry`'s offer promises resume `"restart"` unless given `resume: "load"`, which its recipe must declare (`declares.load`); otherwise its first launch is refused (`HARNESS_RESUME_UNDECLARED`).
31
+ - `missing(env)`, on either builder, says what no model key fixes (a binary, say). It is asked before the key, so the harness's offer says it and names no key. An error it or the adapter throws with a `code` refuses the harness with its facts' install fix for that code, as the built-in Goose's are.
32
+ - `@parcha/agentrun-serve/conformance` adds `suiteHostTools`, and `@parcha/agentrun-harness-acp/testing` exports the fake ACP agent (`FAKE_ACP_AGENT`, `fakeAgentRecipe`), so a module's author runs the conformance suite with no binary, model or key. The run spec a subject hands `createAdapterLoop` names its harness's `facts`.
33
+ - A schedule trigger's next run keeps what its last answer carried when that answer is over 32 KiB. An agent's `output_schema` may name, in `x-carried`, the top-level fields its next run reads back (a watch's `seen`, a digest's `open_urgent`). When the last completed result is over the limit, the next run is handed those fields alone, read from the schema of the run that produced it (its revision's, not the agent's current one), with words naming them and the whole result's size. A carried array is kept oldest first by convention; the template owns that order and the engine reads no dates. When the carried fields are themselves over the limit (UTF-8 bytes), the largest carried array gives up its oldest entry, one at a time and measured again after each (a tie goes to the first in `x-carried`), until they fit, and the words say per field how many were dropped (`seen: 12 oldest entries dropped`). A scalar or object is never cut. With no `x-carried`, or carried fields still over the limit with no entry left to drop, the run is told the result was too large, as before; under the limit it is handed whole, as before. <!-- changes/x-carried-previous-result.md -->
34
+ A save refuses an `x-carried` that is not an array of unique names of the schema's root `properties` (`422 input_invalid`, field `definition.output_schema.x-carried`). `submitParameters` leaves `x-carried` out of a submit tool's schema, as it does `criteria`, so a learned workflow that copies the agent's output schema never sends a provider a keyword it does not know.
35
+ - Keep compiled workflow drafts out of connected agents' reusable workflow lists until a shadow check compares them with an independent native answer. Claude Agent SDK, Codex SDK and Eve use the same reserved candidate, caller-side execution and server promotion decision; native and remote runner tools also withhold unchecked drafts. <!-- changes/connected-workflow-shadow-checks.md -->
36
+
37
+ The first check uses one fresh native turn and reports that sample count. It compares the full answer exactly, or the owner's configured agreement fields. A mismatch, missing evidence, expired check, ambiguous input or failed execution never promotes a draft. Original native results remain unchanged. Shadow writes use only that turn's matching recorded results; an unrecorded write stops the check. Reads also use recorded results by default; `shadowReadFallback` explicitly opts into missing read-only observations under the host's existing policy, never retries failed calls. Complex input mappings can supply `resolveCheckInput`; the default does not guess fields from prose.
38
+
39
+ Write-bearing checks require complete serial native tool lifecycles and a serial candidate preserving every original call once and in order, including reads. Unknown tools, overlapping calls, buffered Codex write traces and parallel write candidates remain unpromoted. Read-only turns retain recorded-read reuse and reordering. Raw callback results preserve their values and types; only SDK-confirmed MCP envelopes are decoded, and ambiguous or error responses stay held. Asynchronous schema validators are rejected before invocation.
40
+
41
+ Eve now uses the shared durable delivery client and an in-process workflow binding. Old pending delivery failures remain recorded without blocking new native turns. Context says compiled workflows and leaves selection to the agent; it no longer claims owner approval or instructs the model to prefer a workflow. The unused Eve mount threshold options are removed; existing server agent learning settings remain authoritative.
42
+
43
+ Agent Learning and Learning Dojo now show when the selected learning model lacks server access, name the model, and link to API Keys. Readiness checks the actual learning route rather than accepting any saved key or an unrelated default model. Native connections keep their own sign-in. SDK background compilation requires server-owned model access; a per-request gateway key alone is insufficient. The read-only readiness fields make no paid request and do not verify quota.
44
+ - An ended run whose end could not read its booking now heals by the end's own rule: a booking that holds a charge at its hold heals as an upper bound (`cost.upper_bound: true`), so `GET /v2/usage` and `GET /v2/runs/{id}` read the same figure, and the store writes it only over an unknown cost with no bound. The start sweep no longer rereads runs that can never heal (a native run, a person's stop of an agentic run, a run with no booked answer), so the `cost_heal` line's `read` counts only runs that could. SQLite and Postgres alike; no schema change. <!-- changes/cost-heal-reads-only-healable.md -->
45
+ - `agentrun-serve check-harness` cuts the recipe's keys and the server's secrets from its report and its output, so an agent that prints its key on stderr as it fails leaves it in neither. <!-- changes/harness-check-redacts-keys.md -->
46
+ - Only a built-in harness owns a key. A harness module's entry that names a run secret in `ownKeys` no longer withholds it from other harnesses' runs; Cursor's `CURSOR_API_KEY` still goes to Cursor's runs alone. <!-- changes/module-own-keys.md -->
47
+ - A built-in's own key goes to the built-in that owns it and to no other harness, built in or not. A harness module whose entry names one in `ownKeys` (`CURSOR_API_KEY`) refuses the server's start with `HARNESS_KEY_OWNED`, naming the module, the id and the key.
48
+ - A module's ACP recipe (`kit.acpEntry`) that names a key this server holds in its `keys` (`ANTHROPIC_API_KEY`, `OPENROUTER_API_KEY`, any `AGENTRUN_*` or `AGENT_MODEL_*` setting) is refused with `RECIPE_KEY_NOT_OWN` when its run would launch, so the harness's offer says so and no run of it starts. A recipe names only keys saved for its own harness.
49
+ - The console's API playground rules the Request pane and the Code/Response pane at the same heights: the line under <!-- changes/playground-pane-lines.md -->
50
+ their headers and the line above their footers (Send request, the code's note, Open this run) run straight across the
51
+ divider instead of stepping at it. The footer's "Sends a real request to this server." note wraps beside the buttons
52
+ instead of pushing them onto a second row.
53
+ - A run's views no longer show a `Bearer` token or the value of a URL parameter named like a credential (`?api_key=`, `&access_token=`, `&client_secret=`, a signed URL's `sig=` or `X-Amz-Signature=`) when the server holds neither value. Both are new secret shapes, cut to `[redacted]` wherever a run's text is served: its Timeline, its trace (`GET /v2/runs/{id}/trace`) and the Dev tools tab, its answer and its error. The scheme and the parameter's name stay, so `Authorization: Bearer [redacted]` and `?api_key=[redacted]` still say what was sent. Learning refuses a draft that holds either, as it does every other secret shape. <!-- changes/redact-bearer-token-and-url-credential.md -->
54
+ A token is twenty characters or more with a digit among them, and a parameter's value sixteen or more, so a placeholder (`Bearer <token>`, `Bearer $TOKEN`), a challenge (`Bearer realm="x"`) and a parameter that only resembles a credential's name (`page_token`, `sort_key`) are left as written.
55
+ - A connected agent's shadow check now reserves a native turn only when the draft takes its input: a JSON task must pass the draft's input schema, and a start whose task or instructions held a protected value reserves nothing. A turn that cannot be the check's baseline (cancelled or failed, a learned workflow in it, redacted evidence, no shadow report, or a shadow that failed or stopped at an unrecorded write) gives its reservation back instead of holding the draft, and the next turn the draft takes is checked. The fifth given-back turn stops the check with nothing checked, which asks no recompile. A start that could not be admitted gives its turn back uncounted. <!-- changes/sdk-check-release-and-deadline.md -->
56
+
57
+ A turn the backend never completed within the hour is decided like any other check, as one failed input: its hold asks the one recompile, and a recompile's check that ends the same way stops instead of compiling again. A draft still waiting for a turn when a newer revision lands is set aside, and the newer revision is checked.
58
+
59
+ Promotion records of connected checks say `via: "sdk"`, and their check records count `released` turns and the shadow's `fresh_reads` (live read-only calls it made where the recording had none, which the client now reports). A failure to settle a check no longer skips the run's own end or its learning.
60
+ - The code-review template no longer asks for GitHub's `get_repository_tree`. That tool is in the GitHub MCP server's `git` toolset, which its hosted server leaves off by default, so applying the template with its suggested tools ticked was refused with "The MCP server github has no tool get_repository_tree". The review reads the repository from its checkout, or through `get_file_contents`, which lists a directory. <!-- changes/code-review-no-repository-tree.md -->
61
+ - When a codemode script stops at a call that waited for a person's answer, its answer now gives every call's value whole. Before, each value was cut at 2,000 characters. In QA, an approved Hacker News item of about 9 KB reached the model without its title. The whole answer is still held to the host's bound on every tool answer. <!-- changes/codemode-stopped-whole-values.md -->
62
+ - Console: the "Set up GitHub App access" link under a template's missing tool, and "Browse history" on Start here, are underlined all the time, not only on hover. In light mode the link's orange and the warning box's amber are nearly the same colour, so the link read as plain text. <!-- changes/inline-link-underline.md -->
63
+ - Applying a template that grants `issue_write` on a GitHub App whose installation has only Issues: read now warns that GitHub refuses it on a private repository, and says a public repository takes it anyway. The warning said GitHub always refuses it, but on a public repository anyone who can read it may open an issue, App tokens included, so release-notes opened its draft issue there. <!-- changes/issue-write-warning-public-repos.md -->
64
+ - After an agent is created in the API playground, "Open agent" sits beside the response status, above the definition, instead of below it. A long definition no longer pushes the link out of view. <!-- changes/playground-open-agent-top.md -->
65
+ - The console's Tools step lays out an MCP server's tools and the monid row across the whole width, in the same columns <!-- changes/tools-step-mcp-full-row.md -->
66
+ as the built-in tools. They took two columns before, so on a wide window a server's tools sat in two middle columns
67
+ with empty space on both sides.
68
+ - A run's trace (`GET /v2/runs/{id}/trace`, `agentrun runs trace`) no longer shows a model request's or a decision's cost with floating-point noise: a request that cost $0.001893 reads `0.001893`, not `0.0018930000000000002`. A tool call's charges already read so. The amount is unchanged, and the Dev tools tab, which rounds for display, shows what it did. <!-- changes/trace-span-cost-no-float-noise.md -->
69
+ - GET /v2/computers says, on each provider's row, the run's folder a computer of it holds on this server now: `folder` is `bind` (Mode 1's folder of this machine), `archil` (the owner's Archil disk mounted), `sync` (a synced folder the runner keeps on the disk) or null (none). It is read by the rule a run's claim picks the folder by, in this server's mode and with the provider's keys and image as this server has them, so a caller no longer guesses from DAYTONA_ARCHIL_EGRESS. The API-only profile serves it too. <!-- changes/computers-folder-kind.md -->
70
+ - An operator's backend can show a run's live view and let its user take over: on an API-only server (`AGENTRUN_API_ONLY=1`), `GET /runs/{id}/computer`, `POST /runs/{id}/computer/take-over` and `POST /runs/{id}/computer/hand-back` take the server's token, and `POST /runs/{id}/computer/viewer` mints a 5-minute link on `AGENTRUN_PUBLIC_URL` that opens that run's live page and socket for the backend's user, until the run ends. <!-- changes/operator-live-view.md -->
71
+
5
72
  ## 0.1.0-beta.47 (2026-11-19)
6
73
 
7
74
  **Breaking:**
@@ -83,7 +150,7 @@
83
150
  attributions in the package archives.
84
151
  Browser archive verification recognizes both required vendor provenance manifests and continues
85
152
  to reject unlisted files.
86
- - Bring your own harness, door 1: a recipe. A JSON file names an ACP agent's registry release (the archive's URL and sha256, the binary inside it), its model billing (through AgentRun's model proxy, or the owner's plan with turn and tool-call limits), its literal env, files and session folders in the private HOME, and what it declares. `agentrun harness install --recipe FILE` installs the release, and `agentrun harness-check --recipe FILE --model PROVIDER/MODEL` runs it for real: the agent's own tools off, its environment an allowlist, the cap or plan limits, the pinned binary at every start, no side request (stage 2); a SIGKILL then resume, a denied call, one of AgentRun's tools over MCP, a second runner (stage 3). It writes a JSON report and prints the three facts a harness row carries: `resume`, `tool_gate`, `billing`. See [docs/harness-recipe.md](https://github.com/Parcha-ai/agentrun/blob/main/docs/harness-recipe.md) and [HARNESS-SCORECARD.md](https://github.com/Parcha-ai/agentrun/blob/main/HARNESS-SCORECARD.md), which rates 25 agents. <!-- changes/harness-recipe-door-one.md -->
153
+ - Bring your own harness, door 1: a recipe. A JSON file names an ACP agent's registry release (the archive's URL and sha256, the binary inside it), its model billing (through AgentRun's model proxy, or the owner's plan with turn and tool-call limits), its literal env, files and session folders in the private HOME, and what it declares. `agentrun harness install --recipe FILE` installs the release, and `agentrun harness-check --recipe FILE --model PROVIDER/MODEL` runs it for real: the agent's own tools off, its environment an allowlist, the cap or plan limits, the pinned binary at every start, no side request (stage 2); a SIGKILL then resume, a denied call, one of AgentRun's tools over MCP, a second runner (stage 3). It writes a JSON report and prints the three facts a harness row carries: `resume`, `tool_gate`, `billing`. See [docs/harness-recipe.md](https://github.com/Parcha-ai/agentrun/blob/v0.1.0-beta.47/docs/harness-recipe.md) and [HARNESS-SCORECARD.md](https://github.com/Parcha-ai/agentrun/blob/main/HARNESS-SCORECARD.md), which rates 25 agents. <!-- changes/harness-recipe-door-one.md -->
87
154
 
88
155
  The loader refuses a recipe that breaks one of five rules by its code: a key that is not the harness's own (`RECIPE_KEY_NOT_OWN`), a binary not pinned to a registry archive (`RECIPE_BINARY_UNPINNED`), a file or folder outside the private HOME (`RECIPE_PATH_OUTSIDE`), an install step of its own (`RECIPE_INSTALLS_ITSELF`), an environment beyond the allowlist (`RECIPE_ENV_NOT_ALLOWLIST`). A release whose registry entry lists no binary digest is pinned to the first one its owner's install records; a later binary that differs is refused, at an install and a check alike (`HARNESS_BINARY_MISMATCH`). A recipe's keys reach the agent the way a run's do, read by name at its start: `harness-check` on a host without one is refused before the agent starts (`ACP_KEY_MISSING`). The ACP adapter logs each permission the agent asks for (`acp: the agent asked permission`).
89
156
  - A learned workflow's check and its shadow audit compare two answers by their decision when the definition names no `learning.agree_on`: the replay run, or the shadow, asks the agent's fast model (`model_tiers.fast`, else AGENT_MODEL_FAST) once at its end whether its answer and the other one reach the same decision, and its reply `{"same": boolean, "differs_on": string | null}` decides that pair. Answers equal as JSON still agree with no call, and an `agree_on` revision asks no model. The request runs through the run's own session under its cap and is booked as its spend, so it counts as the check's cost (`check_usd`) or the served run's learning cost. A reply that is not the verdict, a request that failed twice, one cut by its 60 s deadline, or a cap refusal counts as a disagreement and says why. A person's stop or cancel of the run cuts the request at once. A verdict holds only for the two answers it read: if the agent's run answers again after its replay was compared, that input counts as a disagreement ("the comparison read an earlier answer"). The check record keeps `grader` (the model) and each disagreement's `differs_on`. A hold says "its answers reached a different decision from the agent's on k of n (for example: …)", and the console's check line says "compared by the fast model". With no fast model the whole answer is compared as before, and the hold words say a learning agent with no `agree_on` wants one. <!-- changes/learning-grader-compare.md -->
package/README.md CHANGED
@@ -939,7 +939,10 @@ passes the binding's conformance cases (below) needs no change here.
939
939
  relay, save the relay's address as `DAYTONA_ARCHIL_EGRESS` (Settings → Computers, beside `DAYTONA_API_KEY`) and name
940
940
  a snapshot of `box/Dockerfile` in `AGENTRUN_DAYTONA_SNAPSHOT` (below): the Daytona sandbox then mounts the run's
941
941
  folder and is ready. With the relay but no snapshot named, it is refused, saying to name one. A boxd sandbox takes no
942
- mount yet, so it is refused in both modes; a boxd desktop runs in either.
942
+ mount yet, so it is refused in both modes; a boxd desktop runs in either. Which folder a provider's computer holds on
943
+ this server now is on its row in `GET /v2/computers`, by the rule a run's claim picks it by: `folder` is `archil`
944
+ (mounted from the disk), `sync` (a synced folder the runner keeps on the disk), `bind` (Mode 1's folder of this
945
+ machine) or null (none).
943
946
 
944
947
  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
945
948
  `AGENTRUN_ACCOUNTS=0` reached beyond loopback) is set where it is started instead: `AGENTRUN_ARCHIL_REGION` and
@@ -2677,8 +2680,9 @@ so the store's files keep no copy of the old row: neither the one rewritten nor
2677
2680
  free space. A marker beside the database (`store.sqlite.scrub`) is written before the rewrite and removed once the
2678
2681
  checkpoint is done. A `VACUUM` held off by another connection's write past the store's busy wait is tried once more
2679
2682
  after a short pause. A start that finds the marker (the server stopped mid-way, or another connection held the
2680
- `VACUUM` or the checkpoint back, logged as `store_scrub_not_done`) runs the scrub again. On Postgres the old row version stays until the
2681
- database vacuums it. The log line names the trigger and the field, never the value.
2683
+ `VACUUM` or the checkpoint back, logged as `store_scrub_not_done`) runs the scrub again. On Postgres the old row version
2684
+ stays on disk as a purged row's does (Purging a run or an agent made here: on disk). The log line names the trigger and
2685
+ the field, never the value.
2682
2686
 
2683
2687
  The create is refused before Composio is asked anything with `409 composio_no_public_url` when the server has no public
2684
2688
  address (`AGENTRUN_PUBLIC_URL`): Composio could not reach it. `features.triggers.public_url` on `GET /v2/capabilities`
@@ -2881,12 +2885,13 @@ failed, 2 when nothing ran. The runner, the graders and the report are in
2881
2885
  | `GET /health` | Without a credential: whether the store reads and the disk has room ([capacity and health](#capacity-and-health)). |
2882
2886
  | `GET /openapi.json` | Without a credential: this API as an OpenAPI 3.1 document, the `agentrun.v2/0` contract (vendored in `src/openapi/`, its source in `info`) with this server's own routes marked `x-agentrun-serve`, the operations it answers `501` marked `x-agentrun-serve-unsupported`, and a contract operation that takes more than the contract gives marked `x-agentrun-serve-changed` with each change named; `links.openapi` in capabilities points at it. |
2883
2887
  | `GET /capabilities` | Without a credential. `backend: local`, every feature flag present and true only when it works; `tools`, the tools an agentic revision may name; `workflows`, what a workflow revision's model nodes get and, in `workflows.decisions.providers`, the decision providers its typed questions run on; `models`, where models come from and the model of each tier. |
2884
- | `POST /agents`, `GET /agents`, `GET /agents/{id}` | `POST` takes `{definition, skills?, note?}` and makes the agent with its first revision, current. A definition has `instructions` (an agentic revision) or `workflow` (a workflow revision, checked by the DSL first), and `name`, `description`, `model` and `thinking` (agentic only), `harness` ([harnesses](#harnesses)), `place` ([place](#place)), `tools`, `tool_settings` ([search and fetch](#search-and-fetch)), `skills` (names; each `<name>/SKILL.md` is in `skills`) and `version`, which is the number the revision gets, and `max_cost_usd`, the agent's default cap (an agentic agent's or a workflow's), kept by an edit that leaves it out and cleared only by 0 ([spend cap](#spend-cap)), and `output_schema` (agentic only, at most 64 KiB): the JSON Schema the final answer's last fenced json block meets, which a completed run's `result.output` then holds (null when the answer doesn't meet it), kept by an edit that leaves it out. A template's answer schema is set here at apply, and a run a schedule trigger starts is handed that trigger's last completed `result.output` after its message; no other source's runs are, since each of their firings is a different event. `checkout` (agentic only): `pull_request` has the server check out, before each run's first turn, the pull request the run's GitHub event names, in `repo/` at its head with its base and merge base, using a read-only token of its GitHub App that the agent never holds ([GitHub triggers](#github-triggers-connect-github)); `none` clears it, and an edit that leaves it out keeps it. A field the store does not keep (`input_schema`) is `422 input_invalid` by name, and so is a definition that can never run here; one this host cannot run yet saves with `warnings` ([models](#models)). The ETag (`home_etag`) is the current revision's id. `GET /agents/{id}` adds `tools`, the tools its current revision grants with each one's provider ([search and fetch](#search-and-fetch)). It also adds `run_blockers` (`x-agentrun-serve: "runblockers/1"`): `{message, fields}` as a start with no overrides would be refused now (`409 agent_not_runnable`), or null. It is always null for an archived, native or SDK agent and for a revision whose MCP tools its first run pins, and the read asks no other service, so under the agent's `max_cost_usd` an OpenRouter decision model's missing price is named only once a save or a start has read OpenRouter's catalog: null is no promise that a start is accepted. |
2888
+ | `POST /agents`, `GET /agents`, `GET /agents/{id}` | `POST` takes `{definition, skills?, note?}` and makes the agent with its first revision, current. A definition has `instructions` (an agentic revision) or `workflow` (a workflow revision, checked by the DSL first), and `name`, `description`, `model` and `thinking` (agentic only), `harness` ([harnesses](#harnesses)), `place` ([place](#place)), `tools`, `tool_settings` ([search and fetch](#search-and-fetch)), `skills` (names; each `<name>/SKILL.md` is in `skills`) and `version`, which is the number the revision gets, and `max_cost_usd`, the agent's default cap (an agentic agent's or a workflow's), kept by an edit that leaves it out and cleared only by 0 ([spend cap](#spend-cap)), and `output_schema` (agentic only, at most 64 KiB): the JSON Schema the final answer's last fenced json block meets, which a completed run's `result.output` then holds (null when the answer doesn't meet it), kept by an edit that leaves it out. A template's answer schema is set here at apply, and a run a schedule trigger starts is handed that trigger's last completed `result.output` after its message; no other source's runs are, since each of their firings is a different event. Over 32 KiB, a scheduled run is handed only the fields the producing run's schema names in `x-carried`; carried arrays lose entries from the front until they fit, and the run is told how many. A save refuses an `x-carried` that is not unique root property names. `checkout` (agentic only): `pull_request` has the server check out, before each run's first turn, the pull request the run's GitHub event names, in `repo/` at its head with its base and merge base, using a read-only token of its GitHub App that the agent never holds ([GitHub triggers](#github-triggers-connect-github)); `none` clears it, and an edit that leaves it out keeps it. A field the store does not keep (`input_schema`) is `422 input_invalid` by name, and so is a definition that can never run here; one this host cannot run yet saves with `warnings` ([models](#models)). The ETag (`home_etag`) is the current revision's id. `GET /agents/{id}` adds `tools`, the tools its current revision grants with each one's provider ([search and fetch](#search-and-fetch)). It also adds `run_blockers` (`x-agentrun-serve: "runblockers/1"`): `{message, fields}` as a start with no overrides would be refused now (`409 agent_not_runnable`), or null. It is always null for an archived, native or SDK agent and for a revision whose MCP tools its first run pins, and the read asks no other service, so under the agent's `max_cost_usd` an OpenRouter decision model's missing price is named only once a save or a start has read OpenRouter's catalog: null is no promise that a start is accepted. |
2885
2889
  | `PUT /agents/{id}/definition` | The same body, checked [the same way](#models): a new revision, its parent the current one, made current. Without `skills` the current revision's skill files carry over. A definition that is the current revision already writes nothing, so a PUT sent twice makes one revision. An agent's id and name stay those it was made with (another name is `422` on `definition.name`). Its description is a label kept on the agent, not on a revision: a PUT that names a new one makes the next revision (even when nothing else changed) and writes the description with it in one commit, so a stale or refused edit changes neither; a PUT that leaves it out keeps it. `If-Match` that is not the current ETag is `412 precondition_failed`; the store compares it again inside the commit, so of two edits that read the same revision exactly one lands. The contract's body is taken too: the definition itself, with `If-Match` required (`412` without it) and `definition.version` greater than the current one (`422`). Any such version is taken, and always makes a new revision, the same definition included; the revision is numbered as this server numbers them, the next, and the answer says which; the route reads a body holding `definition` as this one, any other as the contract's. |
2886
2890
  | `GET /agents/{id}/revisions` | The agent's revisions, newest first: `revision`, `version`, `parent`, `kind`, `current`, `note`, `created_at` and the `definition`. |
2887
2891
  | `POST /agents/{id}/current` | `{revision}`: one of the agent's revisions becomes current again. |
2888
2892
  | `POST /agents/{id}/archive`, `POST /agents/{id}/unarchive` | [Archiving](#archiving): hides the agent and its runs from the lists, or shows them again. Answers the agent, with `archived_at`. |
2889
- | `DELETE /agents/{id}` | This server's own route (`x-agentrun-serve: "agentdelete/1"`): [deletes an agent another system owns](#deleting-an-agent-another-system-owns) (one an inline run made) whole. `204`; an agent made here is `409 agent_not_external`. |
2893
+ | `DELETE /agents/{id}` | This server's own route (`x-agentrun-serve: "agentdelete/1"`): [deletes an agent another system owns](#deleting-an-agent-another-system-owns) (one an inline run made) whole, and [purges](#purging-a-run-or-an-agent-made-here) an archived agent made here. `204`; an agent made here not archived is `409 agent_not_archived`. |
2894
+ | `DELETE /runs/{id}` | This server's own route (`x-agentrun-serve: "purge/1"`): [purges](#purging-a-run-or-an-agent-made-here) a run that is not live, its cost kept in every total. `204`, again on a second `DELETE`; a live run is `409 run_not_final`, and every route of a purged run is `410 purged`. |
2890
2895
  | `DELETE /agents/{id}/sign-ins/{key}` | This server's own route (`x-agentrun-serve: "signins/1"`): forgets one of the agent's [saved sign-ins](#saved-sign-ins), at its vendor and here. `409 sign_in_held` while a run holds its save lease, or while a run it was handed is still going. |
2891
2896
  | `POST /agents/{id}/runs`, `GET /agents/{id}/runs` | A run of the current revision, or of `revision`. An agentic run's input is `{content: string}`; a workflow run's is what its workflow's input schema takes. `file_ids` names [uploaded](#uploads) files, copied into the run's `work/inputs/` before it starts and named in its first message. `labels` (this server's own, `runlabels/1`) is the caller's map of its own strings for the run: at most 16 keys, each 1 to 63 letters, digits, `.`, `_`, `-` or `/` starting with a letter or a digit, each value 1 to 256 characters with no control character; kept as given, served as `labels` on every read of the run (`{}` when none), never read by the server otherwise, so no place for a secret. The agent's runs, newest first; `label` filters them as `GET /runs` does. |
2892
2897
  | `GET /runs` | Every agent's runs, newest first, a page of at most 100; `agent`, `revision` and `status` narrow it, `label=<key>:<value>` (`runlabels/1`, split at the first `:`, once per request) keeps the runs holding that label, and `archived=true` lists only archived ones. A failed run's summary carries its `error`, and a waiting run's its `pending`. |
@@ -2900,6 +2905,7 @@ failed, 2 when nothing ran. The runner, the graders and the report are in
2900
2905
  | `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"`). |
2901
2906
  | `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 alone, no run's files opened. 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`, 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`. A run with no metrics counts in `runs` and in no token sum. `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. |
2902
2907
  | `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`). |
2908
+ | `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, 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. |
2903
2909
  | `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. |
2904
2910
  | `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`. |
2905
2911
  | `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`. |
@@ -2979,11 +2985,15 @@ serves these routes alone:
2979
2985
  key names and whether each is saved, and whether it is ready) and `GET /workspace/archil` (whether runs' folders are
2980
2986
  on Archil, and whether its account key is saved). Neither answers a key's value. Their writes, tests and key choices
2981
2987
  are the console's, refused here;
2982
- - `GET /capabilities`, `GET /health` and `GET /usage`.
2988
+ - `GET /capabilities`, `GET /health` and `GET /usage`;
2989
+ - a run's desktop or phone, for a backend that shows its user the live view and lets them take over: see below.
2990
+
2991
+ Here a run's computer routes take the server's token. `POST /runs/{id}/computer/viewer` mints a 5-minute link on
2992
+ `AGENTRUN_PUBLIC_URL` that opens that run's live page and socket until the run ends (API doc).
2983
2993
 
2984
2994
  Every other address is `404 not_found`, answered before the request is read further: the console at `/` and its
2985
2995
  assets, sign-in and setup, every `/settings` route, `POST /mcp`, triggers and their
2986
- `POST /hooks/{id}`, agents, templates, `/openapi.json`, `/llms.txt` and the live views. It has no accounts: there is no
2996
+ `POST /hooks/{id}`, agents, templates, `/openapi.json`, `/llms.txt` and a browser's live view. It has no accounts: there is no
2987
2997
  page to sign in to, so no setup code is printed. The token works as it does on every route served. Unset, `0` or
2988
2998
  `false` serve the whole server, as before; any value other than these and `1` or `true` stops the start, in words.
2989
2999
 
@@ -3200,22 +3210,30 @@ the console all read that table. An owner adds harnesses with a harness module:
3200
3210
  takes the same flag and setting, and needs them to run the module's harnesses. MODULE is a path, or a package installed
3201
3211
  with `npm install --prefix <data>/harnesses <package>`.
3202
3212
 
3203
- A module exports `entries(builtins)`, which returns new entries by id. Each entry gives `label`, `steer`, `runMib`,
3204
- `oneAlwaysFits`, `runs`, `onWire`, `model`, `priceModel`, `refusal` and its `runner`, and may give `promises`. A run of
3205
- the harness runs on its runner's `adapter(launch, extra)`, and is admitted by the `runMib` its entry declares. A module
3206
- adds harnesses and never replaces one. The start of the server, or of a separate runner, is refused, naming the module
3207
- and the id, when a module:
3213
+ A module exports `entries(builtins, kit)`, which returns new entries by id. [HARNESS.md](../../HARNESS.md) walks through
3214
+ writing one, and [examples/harness-module](../../examples/harness-module/README.md) is a whole one.
3215
+
3216
+ An entry made without `kit` gives `label`, `steer`, `runMib`, `oneAlwaysFits`, `runs`, `onWire`, `model`, `priceModel`,
3217
+ `refusal` and its `runner`, and may give `promises`; a run of it runs on its runner's `adapter(launch, extra)`. Every
3218
+ harness is admitted by the `runMib` its entry declares. A module adds harnesses and never replaces one: the built-in
3219
+ harnesses' facts, offers, key rows, default models and tool names are the same with any module loaded. The start of the
3220
+ server, or of a separate runner, is refused, naming the module and the id, when a module:
3208
3221
  - gives an id that does not match `^[a-z][a-z0-9-]{0,39}$`;
3209
- - names an id serve's own runs carry: `learning`, `sdk`, `workflow`, `claude-agent-sdk` or `codex-sdk`;
3222
+ - takes a name serve reserves (listed in [HARNESS.md's `id` row](../../HARNESS.md#field-by-field));
3210
3223
  - names a built-in harness;
3211
3224
  - names an id another module adds;
3212
3225
  - gives an entry that is missing a member;
3226
+ - names in an entry's `ownKeys` a key a built-in harness owns (`HARNESS_KEY_OWNED`);
3213
3227
  - does not resolve.
3214
3228
 
3215
3229
  A module's entry that gives no adapter `facts` runs on the general spec, with pi's tools: capabilities list its id on
3216
3230
  every tool pi runs (`tools[].harnesses`) and on MCP grants (`features.mcp_client.harnesses`), so an agent on it keeps
3217
3231
  its tool choices. One that gives `facts` runs the host tools, as the other built-in harnesses do.
3218
3232
 
3233
+ A module's author proves its harness with `@parcha/agentrun-serve/conformance`: the same suite (`registerHarnessConformance`),
3234
+ adapter loop (`createAdapterLoop`) and host tools (`suiteHostTools`) this repository proves its own harnesses with. An ACP
3235
+ agent's module runs it on `@parcha/agentrun-harness-acp/testing`'s fake ACP agent, which needs no binary, model or key.
3236
+
3219
3237
  The harnesses a module adds are listed in `capabilities.harnesses` after the built-in ones. Each offer there carries a
3220
3238
  `label` and `promises`:
3221
3239
  - `resume`: `exact`, `load` or `restart`.
@@ -3280,9 +3298,9 @@ typed answers and their probabilities.
3280
3298
 
3281
3299
  ## Archiving
3282
3300
 
3283
- An agent made here or a run is archived, never deleted: a run's `DELETE` stays `405`, and an agent's is `409
3284
- agent_not_external` (an agent another system owns is [deleted](#deleting-an-agent-another-system-owns), and is never
3285
- archived here). These routes are this server's own, outside the `/v2` contract, like `GET /runs` and an agent's
3301
+ Archiving an agent made here or a run hides it and keeps everything of it; [purging](#purging-a-run-or-an-agent-made-here)
3302
+ removes what it was given and did, its cost kept, and an agent made here is purged only once archived (an agent another
3303
+ system owns is [deleted](#deleting-an-agent-another-system-owns), and is never archived here). These routes are this server's own, outside the `/v2` contract, like `GET /runs` and an agent's
3286
3304
  revisions; capabilities list them in `features.archive`.
3287
3305
 
3288
3306
  - `POST /v2/agents/{id}/archive` hides the agent and its runs from `GET /agents`, `GET /runs` and
@@ -3302,6 +3320,54 @@ revisions; capabilities list them in `features.archive`.
3302
3320
  already going when its agent is archived keeps going.
3303
3321
  - The store keeps an archive as `archived_at` on the agent's or the run's row, null when it is not archived.
3304
3322
 
3323
+ ## Purging a run or an agent made here
3324
+
3325
+ An owner must be able to delete what a run read. `DELETE /v2/runs/{id}` purges a run that is not live; what it cost
3326
+ stays in every total.
3327
+
3328
+ | Purged | Kept |
3329
+ | --- | --- |
3330
+ | Its launch record (input, prompt), journal and timeline, messages and commands, outputs and files, the answers kept under its idempotency keys, its folders (here, and its own folder on an Archil disk; the disk is kept), its settings, its labels and summary, its agent's grades of it, and its kept learning's content | Its row, as its tombstone: id, agent, state, how it ended (a code), started and ended, `cost_usd` (an upper bound when that is all it has), its paid tools' cost, its purge time, how its learning ended (for `/stats`), and the spend figures `/usage` and a cap read from its journal, and the intervals of the computers it made (each a provider's id and its times). Its metrics keep their figures alone: counts by tool name, the effort and the cost basis, no grader's words, call arguments or results |
3331
+ | Its kept learning's turn and proposal | Each kept learning row as a link alone (the run's and its learning run's ids, its state): `/usage`'s learning line reads it, and it keeps its learning run out of every run list |
3332
+ | What a promotion record copied from it: a check's or an audit's disagreement's input, answers and the grader's words, and the words a hold's reason quoted from them | The record's decision, numbers and run ids, the run's among them |
3333
+
3334
+ - Every route of a purged run is `410 purged`, `details` its tombstone; no run list shows it. `/usage`, `/stats` and
3335
+ the spend a cap reads are as they were. A second `DELETE` is `204`; a run never here is `404`.
3336
+ - The runs made from it are purged with it, each a tombstone: its audit's shadow run, the replay runs of its input,
3337
+ and a learning run its kept learning names. A replay or a shadow run a check or an audit starts while the `DELETE`
3338
+ runs holds it: `409 run_not_final` naming that run, the run not purged, and the next `DELETE` purges both. Once the
3339
+ run is purged, no replay or shadow run of it is started.
3340
+ - A live run (queued, working, waiting on a person or an approval, or held by a runner), or a live run made from it,
3341
+ is `409 run_not_final` (`details.runs`), nothing purged: cancel it first. A run that ended and takes a follow-up
3342
+ (idle), or that a person stopped, is not live. Such a run reads idle a moment before its runner writes it ended: a
3343
+ `DELETE` then waits for that, up to 30 seconds, and purges it.
3344
+ - A message, a trigger's message or a grade sent to the run while its `DELETE` runs waits for it, then is `410 purged`:
3345
+ nothing opens the run again or keeps a grade of it under its purge.
3346
+ - `503 unavailable` while its folder on an Archil disk is not deleted there yet: the run is not purged, and the next
3347
+ `DELETE` finishes it, as it finishes a purge that stopped part way (its purge time is set last).
3348
+ - On disk. On both stores the purge deletes or blanks the rows above; what the database files keep differs.
3349
+ - **SQLite:** every store connection writes with `secure_delete` on, which zeroes the bytes a write frees, and a run's
3350
+ or an agent's purge checkpoints the WAL once it commits. So the purged content is in neither `store.sqlite` nor
3351
+ its `-wal` after the `DELETE`. A checkpoint another connection holds back is retried once, then logged, and the
3352
+ next purge's checkpoint or the server's stop clears it. Copies outside the file are out of scope: backups,
3353
+ snapshots, the filesystem's own journal.
3354
+ - **PostgreSQL** (not closed): a purged row's old version stays in its table as a dead tuple. `VACUUM` (or
3355
+ autovacuum, on its schedule) only marks its space reusable; the bytes stay in the data file until a later write
3356
+ overwrites them. `VACUUM FULL` rewrites the table into a new file (under an exclusive lock), and the old file's
3357
+ blocks go back to the filesystem unwiped. Postgres's own WAL and its archived WAL keep the old values until they are
3358
+ recycled or expire, and backups keep them for their retention.
3359
+ - Its agent's other runs and what the agent learned are kept: a promotion record and the learning folder's history
3360
+ may still name the run's id.
3361
+ - It takes the owner's session (the password sign-in, or the console on a server bound to loopback) or the API token;
3362
+ any other console session is `403 forbidden`, no credential `401`.
3363
+
3364
+ An agent made here is purged the same way once archived: `DELETE /v2/agents/{id}`. Its revisions' content, name and
3365
+ description, learning, triggers, saved sign-ins, own computer, disk and folders go, and each of its runs is purged.
3366
+ Its row stays as its tombstone (id, archive and purge times): every route of it is `410 purged`, and no list shows it.
3367
+ Not archived: `409 agent_not_archived`. A live run of it: `409 run_not_final`. Purging one agent touches no other.
3368
+ An unarchive or a write to it sent while its `DELETE` runs waits for it, then is `410 purged`; after a purge stopped
3369
+ part way, each is `409 agent_not_runnable` until a `DELETE` finishes it.
3370
+
3305
3371
  ## Deleting an agent another system owns
3306
3372
 
3307
3373
  An agent made by an inline run (`POST /v2/runs` with `external`) belongs to the system that sent it, which may have to
@@ -3561,8 +3627,20 @@ job, once it repeats: after `learning.compile_after` completed runs (20 by defau
3561
3627
  for the whole job as one workflow, which is checked in code, replayed on the agent's own past inputs, and served as one
3562
3628
  tool once it agrees with the agent's own answers. The console reads `GET /v2/agents/{id}/learning` for the agent's
3563
3629
  corrections, workflows and history, and `GET /v2/runs/{id}/learning` and its `/diff` for an individual result.
3564
- Observation requires no model key; producing new learning requires an agentic run through this server with learning
3565
- enabled and a configured model.
3630
+ Observation requires no model key. Creating workflow drafts requires an agentic run executed or reported through this
3631
+ server with learning enabled and access to its configured compile model. For a connected SDK agent, compilation runs
3632
+ on this server; shadow execution and tool access remain in the original application, as described below.
3633
+
3634
+ Set up **Settings → API Keys → Model keys** with a provider key that matches the learning model, such as OpenRouter,
3635
+ Anthropic or OpenAI, or a supported server sign-in. An unrelated provider key, tool API key, AgentRun connection key or
3636
+ decision-provider key does not supply compiler access. Background compilation cannot borrow a caller's per-request
3637
+ gateway key. The new SDK shadow comparison is deterministic and needs no separate Jev key. Native project connections
3638
+ use their original runtime's sign-in for corrections; learned workflows are not available on that connection.
3639
+
3640
+ The agent's Learning tab and Learning Dojo show missing setup for that agent's actual model. `learning_model` in
3641
+ `GET /v2/agents/{id}/learning` describes that route; the same field in capabilities describes the server default.
3642
+ `ready` means the route and credentials are configured, not that quota or provider availability has been verified.
3643
+ These reads make no paid request, and saving a matching key refreshes the setup guidance.
3566
3644
 
3567
3645
  Importing Claude Code, Codex or pi session history does not replay learning or connect a live learning stream.
3568
3646
  Before/after cost and duration are observations, not an accuracy evaluation.
@@ -3592,7 +3670,8 @@ Each run of an agent that learns starts from `main` as it is when the run is mad
3592
3670
  follow-up reads the same.
3593
3671
  - The workflows the agent learned, each a folder `workflows/<name>/` on `main` with its `workflow.json` and its
3594
3672
  `README.md`, are the run's as one tool, `learned_workflow {name, input}`, on every harness (pi, claude-agent, codex),
3595
- with no edit of the agent's definition. Only an active one is: its `README.md` sets no status, or `active`; front
3673
+ with no edit of the agent's definition. Only an active, promoted revision is: its `README.md` sets no status, or `active`,
3674
+ and its promotion record names the checked champion. A compiled draft without that record is withheld; front
3596
3675
  matter that does not read one way (not closed, a key indented under another, a key set twice, a status over more
3597
3676
  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
3598
3677
  while its line fits, and one that does not, or holds one of the server's secrets, is left out. A README whose front
@@ -3647,6 +3726,14 @@ round on the agent's `main`, whatever its harness:
3647
3726
  promotion check (below) decides whether it serves. A compile whose drafts all failed is recorded as the compile's
3648
3727
  attempt (compile once), and its errors are on the run's learning (`draft_errors`), never silent.
3649
3728
  [`src/learn/SPEC.md`](src/learn/SPEC.md) has the rules.
3729
+ - Its answer's quote re-pick, with `learning.repick: true` (off by default): a workflow whose answer quotes the pages
3730
+ 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
3731
+ draft. On, the server rewrites the passing draft before it commits it, so the re-pick reads the pages themselves,
3732
+ sent as untrusted data (the model is told never to follow anything written in them, and the step has no tools), at
3733
+ most `learning.repick_max_chars` characters of them (150000 by default, 1 to 400000; past it the longest pages are
3734
+ cut first). Its request is the served run's, under the run's cost cap. The setting is read at each compile: turning
3735
+ it on or off changes only the workflows compiled after that, never one already kept. An agent whose workflows run
3736
+ through an SDK bridge ignores it.
3650
3737
 
3651
3738
  The turn runs under the run's own cap, with no reserve, and within 10 minutes; its rows are labelled `learning`, and the
3652
3739
  run's answer stays the job's. While it runs, the run reads `reflecting` on every harness. A run with no words from its
@@ -3660,13 +3747,48 @@ The round's commit is made with plumbing: the passing draft's files added or cha
3660
3747
  the commit the change was made on (once more on a `main` that moved meanwhile), and a run a trailer already names is
3661
3748
  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.
3662
3749
 
3663
- A new workflow revision serves only once its promotion check passes: the first run that lays it replays it on the
3750
+ 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
3664
3751
  inputs of the agent's last `compile_after` completed runs, one replay run each at workflow cost, and scores each against
3665
3752
  the agent's own recorded answer. It is promoted when it agrees on at least `learning.agree_min` (0.8) of them and
3666
3753
  answers at least `learning.alone_min` (0.7) alone; under either bar it is held, and the next run asks one revision with
3667
3754
  the inputs it disagreed on. Held again, it stops, and nothing compiles again until its owner acts. A promotion by
3668
3755
  check is never moved by grades. `GET /agents/{agent_id}/learning/promotions` reads every record.
3669
3756
 
3757
+ Connected SDK agents (Claude Agent SDK, Codex SDK and Eve) check where their original tools live. When an application
3758
+ starts an SDK run with a workflow bridge, `learning.workflows` contains only compatible promoted revisions. If a
3759
+ compiled draft needs a check, the server instead reserves one candidate in
3760
+ `learning.check: {id, revision, digest, workflow}` and returns an empty `learning.workflows` list. The candidate is
3761
+ not a tool for the model. The application completes its ordinary native turn first, then the bridge executes the
3762
+ candidate in shadow using that turn's recorded tool results. It makes no fresh tool calls by default and never repeats
3763
+ a write. A host can explicitly enable `shadowReadFallback` for its declared read-only callbacks under its original
3764
+ policy. Missing or changed evidence, an input that cannot be bound to the workflow, and unsupported adapters fail the
3765
+ check closed.
3766
+
3767
+ The bridge posts one `workflow_check` event with the reservation's `id` and `digest`, its execution `outcome`
3768
+ (`answered`, `handed_back`, `failed` or `skipped_write`), and its answer or reason. It does not choose whether the
3769
+ workflow passes. The server compares the answer with the immutable native completion and applies the same
3770
+ `agree_min` and `alone_min` promotion policy. This initial SDK check uses **one independent native turn** (`n: 1`),
3771
+ 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
3772
+ configured `agree_on` fields; there is no semantic model grader on this path. A paraphrase can therefore be held even
3773
+ when a person would consider it equivalent.
3774
+
3775
+ A start reserves a check only on a turn that can be its baseline: a JSON object task must pass the draft's input
3776
+ schema (a prose task's input is resolved by the bridge), and a start whose task or instructions held a protected value
3777
+ reserves nothing. A reserved turn that still cannot be the baseline (cancelled or failed, incomplete, redacted or
3778
+ workflow-assisted evidence, no `workflow_check` report, or a shadow that `failed` or `skipped_write`) gives the
3779
+ reservation back: the record stays `replaying` with no `runs`, counts it in `check.released`, and the next turn the
3780
+ draft takes is checked. The fifth given-back turn stops the check with nothing checked (no recompile). A turn the
3781
+ backend never completes within an hour is decided as one failed input through the same check, so its hold asks the
3782
+ one recompile and a recompile's check that ends the same way stops. Connected checks' records say `via: "sdk"`;
3783
+ `check.fresh_reads` counts the shadow's `shadowReadFallback` reads.
3784
+
3785
+ Concurrent starts reserve at most one check per workflow; retries keep the same reservation, and a late report cannot
3786
+ replace a recorded decision.
3787
+ An older checked champion can still serve while a newer revision is checking or held, except on the independent
3788
+ check turn itself. Learning Off returns neither workflows nor a check. Without a workflow bridge the application gets
3789
+ no workflow to execute. The application's tools, model callbacks and credentials stay in its process; the server receives
3790
+ evidence and the shadow result through the run-scoped SDK credential.
3791
+
3670
3792
  The run's `learning` (on `GET /runs/{run_id}`, and `{state, reason, detail}` in run lists, the detail cut to 140
3671
3793
  characters and no time) says how it went: `seeded`, then `reflecting` during its end step, and `merged`, or `dropped`
3672
3794
  with a reason from a closed list (`seed_failed`, `no_budget`, `unknown_cost`, `cancelled`, `crashed`, `reflect_failed`,
@@ -3796,6 +3918,82 @@ and says how its figure was reached.
3796
3918
 
3797
3919
  The console shows the tokens beside the run's cost, and the figure says its basis: `$0.0042 est.`, `$0.0042 reported`.
3798
3920
 
3921
+ ## A run's cost, line by line
3922
+
3923
+ `GET /runs/{id}/usage` (`runusage/1`) says what one run cost and where each part goes: its model requests by model, its
3924
+ paid tool calls by who charged for them, its browser time by browser provider. It answers "what did this run cost, and
3925
+ whose invoice does each part land on?" for every run that books its cost: a pi run, a run on a CLI harness that sends
3926
+ its model requests through this server, and a workflow run with its decisions. The console's Dev tools tab shows it
3927
+ under "Cost by line". Each line has its quantity as measured, its dollars as the run's booking holds them, and how those
3928
+ were reached. Nothing is priced here, and nothing is rounded to a billing increment or topped up to a minimum.
3929
+
3930
+ ```json
3931
+ { "run_id": "run_…", "ended_at": "2026-11-19T10:01:30.000Z", "currency": "USD", "total": { "usd": 0.0566 }, "reason": null,
3932
+ "lines": [
3933
+ { "meter": "tokens", "model": "claude-sonnet-5-5", "provider": "anthropic", "charged_by": null, "quantity": 3300, "unit": "token",
3934
+ "basis": "reported", "usd": 0.0036, "requests": 3, "tokens": { "input": 3000, "output": 300, "cache_read": 0, "cache_write": 0 },
3935
+ "unmetered_requests": 0 },
3936
+ { "meter": "tools", "model": null, "provider": "monid", "charged_by": "monid", "quantity": 1, "unit": "call", "basis": "reported", "usd": 0.003 },
3937
+ { "meter": "tools", "model": null, "provider": "docs", "charged_by": "docs", "quantity": 1, "unit": "call", "basis": "estimate", "usd": 0.05,
3938
+ "not_metered_calls": 2 } ],
3939
+ "browser_sessions": [],
3940
+ "computer_intervals": [
3941
+ { "provider": "daytona", "provider_id": "5f0c…", "kind": "sandbox", "gpu": null, "cpus": null, "memory_mb": null,
3942
+ "started_at": "2026-11-19T10:00:04.000Z", "ended_at": "2026-11-19T10:01:31.000Z", "kept": false } ] }
3943
+ ```
3944
+
3945
+ - `tokens`: one line per model the requests were sent on (`model`; a workflow decision on the model its provider
3946
+ answered with). `provider` is where the requests went, named only when this server sent them there itself: the run's
3947
+ own model on a provider's key, or a decision's provider. Behind a model gateway it is null, since the gateway picks the
3948
+ upstream. A model reached two ways is two lines, one per provider. `quantity` is the input, cache read, cache write and
3949
+ output tokens as each request reported them (a decision's as its receipt does), with the split beside it; `basis` is the run's `cost.basis` rule over that model's requests alone.
3950
+ - `tools`: one line per charger (`charged_by`: `monid`, an MCP server's name, `parallel`), the vendor whose invoice the
3951
+ calls land on. `provider` names the same vendor: the one that charges for a call is its provider. `quantity` is the charges booked, one per paid call. `basis` is `reported` when every charge is the
3952
+ vendor's own figure (monid's answer says what it charged), `estimate` when any is a price this server holds (an MCP
3953
+ tool's saved price, Parallel's). Calls of a tool with no price set ran outside the run's cost, as `GET /usage` counts
3954
+ them: `not_metered_calls`, in neither `quantity` nor `usd`.
3955
+ - `browser_time`: one line per browser provider (`provider`). `quantity` is the seconds this server's clock charged the
3956
+ provider's sessions for, the provider's minimum per session included as the browser charged it; `basis` is
3957
+ `estimate`, the provider's price per hour on this server's clock, never its invoice.
3958
+ - A field a meter does not use is null, and so is a name the record does not keep: never `""`.
3959
+ - A charge of unknown cost makes its line's `usd` null, with `so_far_usd` and `unpriced` beside it, never $0. `total`
3960
+ joins the lines by the rule `cost.usd` is, so `total.usd` is the run's `cost.usd`, with the same `so_far_usd`,
3961
+ `unpriced` and `upper_bound` beside it; the `tools` lines sum to `cost.tools_usd`.
3962
+ - Learning is not on the lines. A learning run's end-of-run turn is this server's work for the agent, not the run's
3963
+ task, and `cost.usd` leaves it out too; its spend is `learning_usd` on the run read.
3964
+ - When the lines can change: only while the run works. A follow-up opens an ended run again (a trigger's often does),
3965
+ and it ends again later. `ended_at` is the end the lines cover: keep it with them, and read again at `run.ended`, which
3966
+ fires at each end. A later read with another `ended_at`, or null, means the run moved since.
3967
+ - `lines` and `total` are null, with `reason`, while the run is at work (`running`), for a run whose figure is not its
3968
+ booking's (`not_booked`: an imported, native or SDK run, or a CLI run whose model requests went past its proxy), and
3969
+ for a learning run a follow-up opened again (`reopened`, whose booking can't be split by round).
3970
+ - Computer time is not priced yet: no line carries it, and its cost is not in `total`. What the run's computers did is
3971
+ in `computer_intervals` (below), so it can be measured and matched to the provider's invoice.
3972
+ - `browser_sessions` (`runusage/2`) holds one record per browser session the run opened, in the order it opened them.
3973
+ With it you can see how long each session ran, spot one that ended late or was lost, and find each on the provider's
3974
+ own dashboard and invoice by its id: the provider's id for the session (`provider_session_id`), when
3975
+ this server opened it and let it go (`started_at`, `ended_at`), why it ended (`release_reason`), the seconds charged
3976
+ for it (`charged_seconds`, what the line sums), and the provider's own record of it, read once when it was let go
3977
+ (`provider_record`: its `started_at`, `ended_at` and `proxy_bytes`). Browserbase keeps such a record; a provider that
3978
+ keeps none says `provider_record_status: "not_offered"`, and a read that failed says `failed`, with `provider_record`
3979
+ null, never zeros. A session whose end was never recorded (its run's process lost first) has `ended_at` null.
3980
+ `charged_seconds` are the seconds charged for the session, its provider's minimum included where the browser charged
3981
+ one at the release, as on the `browser_time` line; how long it ran is `ended_at` less `started_at`.
3982
+ - `computer_intervals` (`runusage/3`) holds one record per computer the run made through its provider (a sandbox, a
3983
+ desktop or a phone), by when each was made. With it you can see how long each of the run's computers lived, find one
3984
+ left running after its run, and match the provider's invoice by its own id: the provider (`provider`, this server's
3985
+ name for it, as the agent's computer setting names it), the provider's id for the computer (`provider_id`), its
3986
+ `kind`, what its create asked for (`gpu` with its `type` and `count`, `cpus`, `memory_mb`; null where it asked none, as
3987
+ a hosted provider that sizes its own machines is never given numbers, and none is guessed), when the create answered
3988
+ (`started_at`), and when the provider's delete of it answered ok (`ended_at`). `ended_at` is written only on that ok:
3989
+ null means no delete was proven (the computer may still be running, or its delete failed or never answered), never a
3990
+ guessed end. `kept` is true once the run's park kept the computer past its claim, for the person's answer. A computer
3991
+ is ended wherever this server deletes it: the claim's release, a later claim letting an earlier one's go, the run's
3992
+ end, a kept computer's end at its time, and the janitor's sweeps. The agent's own persistent computer (it outlives
3993
+ every run), a paired computer and `--faux`'s are not the run's and have no record; a browser's sessions are in
3994
+ `browser_sessions`. A run's computers made before this server kept them have none either. The records are kept in the
3995
+ store's `computer_intervals` table (keyed by provider and the provider's id), and a purge of the run keeps them.
3996
+
3799
3997
  ## Spend cap
3800
3998
 
3801
3999
  A run may name `max_cost_usd`, an agentic run or a workflow run ([below](#a-workflow-run-under-its-cap)). A run that names none takes its agent's default,
@@ -1,4 +1,5 @@
1
1
  import type { AdapterFacts, AgentAdapter } from "@parcha/agentrun-kernel";
2
+ import type { AcpRecipe } from "@parcha/agentrun-harness-acp";
2
3
  export declare const ACP_PACKAGE = "@parcha/agentrun-harness-acp";
3
4
  /** One platform's release of an ACP agent, as the pin holds it (the package's AcpArchivePin). */
4
5
  export type AcpRelease = {
@@ -37,16 +38,33 @@ export type AcpPackage = {
37
38
  readonly maxToolCalls: number;
38
39
  }): string;
39
40
  cursorAdapter(options: Record<string, unknown>): AgentAdapter;
40
- /** Cursor's release pinned for `platform` (default this host's), its launcher's and tree's digests; undefined where none is. */
41
- cursorRelease(platform?: string): {
42
- readonly cmd: string;
43
- readonly binarySha256: string;
44
- readonly treeSha256: string;
45
- } | undefined;
41
+ /** Cursor's recipe for a run: its launcher, the run's limits, and its model (none: Cursor's own default). */
42
+ cursorRecipe(options: {
43
+ command: string;
44
+ limits: {
45
+ readonly maxTurns: number;
46
+ readonly maxToolCalls: number;
47
+ };
48
+ model?: string;
49
+ }): AcpRecipe;
50
+ /** The folder Cursor was installed into, from its launcher's path and the pin's `cmd`; undefined when it is not there. */
51
+ cursorRootOf(binary: string, cmd: string): string | undefined;
46
52
  /** The form a model id an ACP agent lists takes (Cursor's `gpt-5.4-nano[reasoning=medium]` among them). */
47
53
  readonly MODEL_ID: RegExp;
48
54
  acpPlatform(): string | undefined;
55
+ /** `pin`'s release for `platform` (default this host's) with its binary's digest, and its tree's when `tree`; undefined
56
+ * where none is pinned so. */
57
+ pinnedRelease(pin: AcpPin, platform?: string, tree?: boolean): (AcpRelease & {
58
+ readonly binarySha256: string;
59
+ }) | undefined;
49
60
  gooseAdapter(options: Record<string, unknown>): AgentAdapter;
61
+ /** Any ACP agent's adapter, from its recipe (a harness module's, harness-table.ts acpEntry). */
62
+ acpAdapter(options: Record<string, unknown>): AgentAdapter;
63
+ /** The model proxy on Anthropic's Messages, Goose's policy (a recipe's under harness-check). */
64
+ gooseProxy(options: Record<string, unknown>): (session: unknown) => Promise<{
65
+ env: Record<string, string>;
66
+ close(): Promise<void>;
67
+ }>;
50
68
  verifyPinnedBinary(path: string, sha256: string): void;
51
69
  verifyPinnedBinaryAsync(path: string, sha256: string): Promise<void>;
52
70
  treeDigest(root: string): Promise<string>;
@@ -7,7 +7,3 @@ export declare const GOOSE_FACTS: AdapterFacts | undefined;
7
7
  /** Cursor's facts (the same package's), or undefined where it is not beside serve. Listed, as Goose is, only while its
8
8
  * owner has installed it; billed to the owner's Cursor plan (its wire `plan`), never to a model key of ours. */
9
9
  export declare const CURSOR_FACTS: AdapterFacts | undefined;
10
- /** Every adapter harness's facts: the built-in ones, then Goose's and Cursor's where their package is. */
11
- export declare const EVERY_ADAPTER_FACTS: readonly AdapterFacts[];
12
- /** The facts of the adapter harness `id`, built-in, Goose or Cursor; undefined for pi and for an id no adapter states. */
13
- export declare const adapterFactsOf: (id: string) => AdapterFacts | undefined;
@@ -10,7 +10,4 @@ export const GOOSE_FACTS = acpPackage()?.gooseFacts;
10
10
  /** Cursor's facts (the same package's), or undefined where it is not beside serve. Listed, as Goose is, only while its
11
11
  * owner has installed it; billed to the owner's Cursor plan (its wire `plan`), never to a model key of ours. */
12
12
  export const CURSOR_FACTS = acpPackage()?.cursorFacts;
13
- /** Every adapter harness's facts: the built-in ones, then Goose's and Cursor's where their package is. */
14
- export const EVERY_ADAPTER_FACTS = Object.freeze([...ADAPTER_FACTS, ...(GOOSE_FACTS ? [GOOSE_FACTS] : []), ...(CURSOR_FACTS ? [CURSOR_FACTS] : [])]);
15
- /** The facts of the adapter harness `id`, built-in, Goose or Cursor; undefined for pi and for an id no adapter states. */
16
- export const adapterFactsOf = (id) => EVERY_ADAPTER_FACTS.find((facts) => facts.id === id);
13
+ // A harness's facts by id are its table entry's (harness-table.ts factsOf), so a module's harness is read as a built-in is.