@parcha/agentrun-serve 0.1.0-beta.36 → 0.1.0-beta.37

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 (325) hide show
  1. package/CHANGELOG.md +170 -0
  2. package/README.md +158 -52
  3. package/dist/attach-conformance-cli.d.ts +1 -0
  4. package/dist/attach-conformance-cli.js +18 -0
  5. package/dist/attach-conformance.d.ts +25 -0
  6. package/dist/attach-conformance.js +343 -0
  7. package/dist/browser-cost.d.ts +1 -1
  8. package/dist/browser-live.d.ts +20 -8
  9. package/dist/browser-live.js +50 -27
  10. package/dist/cap.d.ts +0 -17
  11. package/dist/cap.js +0 -91
  12. package/dist/catalog.d.ts +1 -12
  13. package/dist/catalog.js +3 -33
  14. package/dist/cli.js +13 -4
  15. package/dist/composio-preset.d.ts +36 -0
  16. package/dist/composio-preset.js +179 -0
  17. package/dist/computer-attach.d.ts +125 -0
  18. package/dist/computer-attach.js +330 -0
  19. package/dist/computer-calls.d.ts +48 -0
  20. package/dist/computer-calls.js +126 -0
  21. package/dist/computer-channel.d.ts +57 -0
  22. package/dist/computer-channel.js +115 -0
  23. package/dist/computer-commands.d.ts +1 -1
  24. package/dist/computer-held-routes.d.ts +35 -0
  25. package/dist/computer-held-routes.js +106 -0
  26. package/dist/computer-held.d.ts +48 -0
  27. package/dist/computer-held.js +87 -0
  28. package/dist/computer-keys.d.ts +21 -1
  29. package/dist/computer-keys.js +53 -11
  30. package/dist/computer-live.d.ts +160 -0
  31. package/dist/computer-live.js +643 -0
  32. package/dist/computer-view.d.ts +13 -0
  33. package/dist/computer-view.js +50 -3
  34. package/dist/computer-viewer.d.ts +6 -0
  35. package/dist/computer-viewer.js +297 -0
  36. package/dist/computers.d.ts +33 -7
  37. package/dist/computers.js +50 -8
  38. package/dist/console/assets/index-Cn6JX1uH.js +563 -0
  39. package/dist/console/assets/index-DRN62V5v.css +1 -0
  40. package/dist/console/index.html +2 -2
  41. package/dist/faux-computers.d.ts +9 -20
  42. package/dist/faux-computers.js +53 -25
  43. package/dist/github-connection.d.ts +10 -2
  44. package/dist/github-connection.js +65 -2
  45. package/dist/github-faux.js +1 -1
  46. package/dist/graph-view.d.ts +1 -1
  47. package/dist/harness.d.ts +1 -0
  48. package/dist/harness.js +35 -1
  49. package/dist/host-tools.d.ts +1 -1
  50. package/dist/hosted-search.d.ts +5 -4
  51. package/dist/hosted-search.js +2 -7
  52. package/dist/import-sources.d.ts +10 -0
  53. package/dist/import-sources.js +44 -2
  54. package/dist/import.d.ts +3 -3
  55. package/dist/import.js +37 -6
  56. package/dist/learn/check.d.ts +4 -1
  57. package/dist/learn/check.js +1 -1
  58. package/dist/learn/commit.d.ts +4 -2
  59. package/dist/learn/commit.js +5 -5
  60. package/dist/learn/folder.d.ts +6 -0
  61. package/dist/learn/folder.js +4 -1
  62. package/dist/learn/general.d.ts +66 -0
  63. package/dist/learn/general.js +73 -0
  64. package/dist/learn/grade.d.ts +4 -0
  65. package/dist/learn/grade.js +22 -1
  66. package/dist/learn/reflect.d.ts +10 -1
  67. package/dist/learn/reflect.js +14 -4
  68. package/dist/learn/skills.d.ts +33 -5
  69. package/dist/learn/skills.js +53 -7
  70. package/dist/learned-workflow.d.ts +24 -0
  71. package/dist/learned-workflow.js +66 -3
  72. package/dist/learning-batch.d.ts +283 -0
  73. package/dist/learning-batch.js +574 -0
  74. package/dist/learning-evals.d.ts +33 -0
  75. package/dist/learning-evals.js +98 -0
  76. package/dist/learning-routes.d.ts +25 -2
  77. package/dist/learning-routes.js +39 -6
  78. package/dist/learning-words.d.ts +6 -0
  79. package/dist/learning-words.js +6 -0
  80. package/dist/learning.d.ts +28 -15
  81. package/dist/learning.js +84 -44
  82. package/dist/live/stream.js +6 -3
  83. package/dist/live/translate.d.ts +4 -3
  84. package/dist/live/translate.js +8 -4
  85. package/dist/live-reach.d.ts +37 -0
  86. package/dist/live-reach.js +62 -0
  87. package/dist/mcp-gateway.d.ts +9 -0
  88. package/dist/mcp-gateway.js +60 -11
  89. package/dist/mcp-oauth.d.ts +57 -7
  90. package/dist/mcp-oauth.js +133 -18
  91. package/dist/mcp-private-hosts.d.ts +4 -4
  92. package/dist/mcp-private-hosts.js +20 -12
  93. package/dist/mcp-probe.d.ts +19 -2
  94. package/dist/mcp-probe.js +44 -9
  95. package/dist/mcp-secret-writes.js +4 -0
  96. package/dist/mcp-servers-store.d.ts +38 -15
  97. package/dist/mcp-servers-store.js +112 -20
  98. package/dist/mcp-store.d.ts +10 -4
  99. package/dist/mcp-store.js +17 -6
  100. package/dist/model-form.d.ts +26 -0
  101. package/dist/model-form.js +80 -0
  102. package/dist/model.js +23 -10
  103. package/dist/openapi.js +386 -21
  104. package/dist/page.d.ts +18 -0
  105. package/dist/page.js +48 -20
  106. package/dist/paid-calls.d.ts +1 -1
  107. package/dist/place-offers.d.ts +2 -3
  108. package/dist/place-offers.js +3 -7
  109. package/dist/place.js +1 -2
  110. package/dist/print.d.ts +15 -1
  111. package/dist/print.js +14 -3
  112. package/dist/propose.d.ts +3 -0
  113. package/dist/propose.js +13 -5
  114. package/dist/provider.js +3 -2
  115. package/dist/reflect-range.d.ts +8 -1
  116. package/dist/reflect-range.js +1 -1
  117. package/dist/run-launch.d.ts +14 -2
  118. package/dist/run-launch.js +9 -4
  119. package/dist/run-learning-served.d.ts +2 -2
  120. package/dist/run-reads-over-store.d.ts +1 -1
  121. package/dist/run-repo.d.ts +20 -0
  122. package/dist/run-repo.js +63 -0
  123. package/dist/run-timeline-served.d.ts +1 -1
  124. package/dist/run-view.d.ts +3 -3
  125. package/dist/run-view.js +14 -7
  126. package/dist/runner/adapter-loop.d.ts +23 -7
  127. package/dist/runner/adapter-loop.js +648 -62
  128. package/dist/runner/adapter-run-spec.d.ts +11 -3
  129. package/dist/runner/adapter-run-spec.js +77 -22
  130. package/dist/runner/adapters/pi-computer.d.ts +7 -0
  131. package/dist/runner/adapters/pi-computer.js +43 -0
  132. package/dist/runner/adapters/pi.d.ts +9 -4
  133. package/dist/runner/adapters/pi.js +76 -14
  134. package/dist/runner/beside.d.ts +7 -3
  135. package/dist/runner/beside.js +21 -11
  136. package/dist/runner/claim-secrets.d.ts +4 -0
  137. package/dist/runner/claim-secrets.js +6 -1
  138. package/dist/runner/cli-run-spec.d.ts +20 -3
  139. package/dist/runner/cli-run-spec.js +113 -43
  140. package/dist/runner/commands.d.ts +3 -1
  141. package/dist/runner/commands.js +28 -3
  142. package/dist/runner/computer-channel.d.ts +34 -0
  143. package/dist/runner/computer-channel.js +61 -0
  144. package/dist/runner/conformance/harness.js +80 -14
  145. package/dist/runner/conformance/subject.d.ts +1 -1
  146. package/dist/runner/dispatch.js +3 -0
  147. package/dist/runner/end-of-run.d.ts +22 -12
  148. package/dist/runner/end-of-run.js +38 -16
  149. package/dist/runner/github-app.d.ts +2 -1
  150. package/dist/runner/github-app.js +4 -2
  151. package/dist/runner/harness-loops.js +15 -1
  152. package/dist/runner/held-run.d.ts +65 -0
  153. package/dist/runner/held-run.js +158 -0
  154. package/dist/runner/journal-kinds.d.ts +20 -1
  155. package/dist/runner/journal-kinds.js +14 -0
  156. package/dist/runner/journal-reader.d.ts +5 -4
  157. package/dist/runner/journal-reader.js +12 -10
  158. package/dist/runner/learning-ask.d.ts +7 -1
  159. package/dist/runner/learning-ask.js +21 -6
  160. package/dist/runner/learning-dispatch.d.ts +22 -0
  161. package/dist/runner/learning-dispatch.js +77 -10
  162. package/dist/runner/learning-end.d.ts +22 -1
  163. package/dist/runner/learning-end.js +92 -12
  164. package/dist/runner/learning-factory.d.ts +1 -1
  165. package/dist/runner/learning-factory.js +11 -5
  166. package/dist/runner/learning-loop.d.ts +67 -7
  167. package/dist/runner/learning-loop.js +173 -21
  168. package/dist/runner/learning-seed.d.ts +7 -0
  169. package/dist/runner/learning-seed.js +13 -0
  170. package/dist/runner/live-ticker.js +1 -0
  171. package/dist/runner/loop-contract.d.ts +8 -1
  172. package/dist/runner/loop.d.ts +5 -1
  173. package/dist/runner/loop.js +2 -1
  174. package/dist/runner/main.d.ts +13 -1
  175. package/dist/runner/main.js +27 -5
  176. package/dist/runner/mcp-claim.d.ts +10 -7
  177. package/dist/runner/mcp-claim.js +113 -24
  178. package/dist/runner/mcp-github.js +1 -1
  179. package/dist/runner/mcp-run.d.ts +5 -5
  180. package/dist/runner/mcp-run.js +15 -3
  181. package/dist/runner/metrics.d.ts +11 -2
  182. package/dist/runner/metrics.js +12 -2
  183. package/dist/runner/pr-checkout.d.ts +1 -0
  184. package/dist/runner/pr-checkout.js +1 -1
  185. package/dist/runner/reflect-hook.d.ts +18 -0
  186. package/dist/runner/reflect-hook.js +20 -8
  187. package/dist/runner/runner.d.ts +26 -0
  188. package/dist/runner/runner.js +184 -15
  189. package/dist/runner/scratch-sweep.d.ts +13 -0
  190. package/dist/runner/scratch-sweep.js +62 -0
  191. package/dist/runner/sessions.d.ts +1 -1
  192. package/dist/runner/store-port.d.ts +4 -2
  193. package/dist/runner/store-secrets.js +4 -3
  194. package/dist/runner/subagent.js +3 -1
  195. package/dist/runner/workflow-host.d.ts +6 -1
  196. package/dist/runner/workflow-host.js +1 -1
  197. package/dist/runner/workflow-loop.d.ts +1 -1
  198. package/dist/runner/workflow-spec.d.ts +14 -2
  199. package/dist/runner/workflow-spec.js +56 -20
  200. package/dist/runs-over-store.d.ts +6 -1
  201. package/dist/runs-over-store.js +38 -9
  202. package/dist/seal-key.js +3 -3
  203. package/dist/sealed-settings-store.d.ts +5 -2
  204. package/dist/sealed-settings-store.js +10 -4
  205. package/dist/secret-writes.d.ts +5 -4
  206. package/dist/secret-writes.js +5 -4
  207. package/dist/server-secrets-store.d.ts +4 -3
  208. package/dist/server-secrets-store.js +15 -9
  209. package/dist/server-secrets.js +3 -2
  210. package/dist/server.d.ts +43 -14
  211. package/dist/server.js +472 -126
  212. package/dist/settings-wake.d.ts +21 -0
  213. package/dist/settings-wake.js +59 -0
  214. package/dist/standard-webhooks.d.ts +4 -1
  215. package/dist/standard-webhooks.js +8 -4
  216. package/dist/store/command-wake.d.ts +12 -0
  217. package/dist/store/command-wake.js +37 -0
  218. package/dist/store/dialect.d.ts +6 -0
  219. package/dist/store/dialect.js +5 -0
  220. package/dist/store/index.d.ts +1 -1
  221. package/dist/store/journal/storage.d.ts +3 -2
  222. package/dist/store/journal/storage.js +13 -5
  223. package/dist/store/postgres/dialect.js +4 -0
  224. package/dist/store/postgres/migrations/0005_learning_rounds.sql +14 -0
  225. package/dist/store/postgres/migrations/0006_run_changes_channel_attempts.sql +57 -0
  226. package/dist/store/postgres/migrations/0007_viewer_host.sql +11 -0
  227. package/dist/store/postgres/migrations/0008_paired_computers.sql +30 -0
  228. package/dist/store/postgres/migrations/0009_commands_answer.sql +10 -0
  229. package/dist/store/schema.d.ts +1 -1
  230. package/dist/store/schema.js +77 -8
  231. package/dist/store/sqlite/run-patch.d.ts +7 -5
  232. package/dist/store/sqlite/run-patch.js +28 -13
  233. package/dist/store/sqlite/store.js +272 -54
  234. package/dist/store/store.d.ts +268 -9
  235. package/dist/store/store.js +12 -1
  236. package/dist/store-reads/cap.d.ts +1 -1
  237. package/dist/store-reads/cap.js +8 -1
  238. package/dist/store-reads/decisions.d.ts +2 -2
  239. package/dist/store-reads/decisions.js +1 -1
  240. package/dist/store-reads/import-summary.d.ts +1 -1
  241. package/dist/store-reads/journal.d.ts +5 -4
  242. package/dist/store-reads/journal.js +73 -15
  243. package/dist/store-reads/learning.d.ts +20 -4
  244. package/dist/store-reads/learning.js +74 -18
  245. package/dist/store-reads/runs.d.ts +1 -1
  246. package/dist/store-reads/workflow.d.ts +1 -1
  247. package/dist/store-view.d.ts +5 -0
  248. package/dist/store-view.js +26 -11
  249. package/dist/template-eval.js +6 -4
  250. package/dist/template-github-permissions.d.ts +22 -8
  251. package/dist/template-github-permissions.js +35 -15
  252. package/dist/timeline/timeline.d.ts +27 -0
  253. package/dist/timeline/timeline.js +10 -9
  254. package/dist/timeline/util.d.ts +4 -0
  255. package/dist/timeline/util.js +14 -0
  256. package/dist/tool-budget.d.ts +19 -7
  257. package/dist/tool-budget.js +14 -8
  258. package/dist/tool-gate.d.ts +16 -9
  259. package/dist/tool-gate.js +53 -42
  260. package/dist/tool-plane.d.ts +16 -12
  261. package/dist/tool-plane.js +9 -4
  262. package/dist/tools.d.ts +13 -4
  263. package/dist/tools.js +13 -4
  264. package/dist/trigger-adapter.d.ts +4 -0
  265. package/dist/trigger-secrets-shown.d.ts +2 -2
  266. package/dist/trigger-secrets-shown.js +1 -1
  267. package/dist/trigger-signatures.d.ts +25 -6
  268. package/dist/trigger-signatures.js +41 -7
  269. package/dist/trigger-targets.d.ts +2 -0
  270. package/dist/trigger-targets.js +1 -0
  271. package/dist/trigger-webhook.js +5 -2
  272. package/dist/triggers.d.ts +7 -3
  273. package/dist/triggers.js +35 -5
  274. package/dist/turns.js +16 -1
  275. package/dist/validate.js +11 -1
  276. package/dist/web-fetch.d.ts +1 -1
  277. package/dist/web-search.d.ts +10 -5
  278. package/dist/web-search.js +7 -6
  279. package/dist/webhooks.d.ts +145 -102
  280. package/dist/webhooks.js +559 -322
  281. package/dist/workflow/decisions.d.ts +1 -1
  282. package/dist/workflow/node-runner.d.ts +2 -1
  283. package/dist/workflow/node.d.ts +2 -1
  284. package/dist/workflow/node.js +3 -1
  285. package/dist/workflow/pi-versions.d.ts +23 -0
  286. package/dist/workflow/pi-versions.js +57 -0
  287. package/dist/workflow/record-tool.d.ts +2 -1
  288. package/dist/workflow/store.d.ts +1 -1
  289. package/dist/workflow/task.js +3 -2
  290. package/dist/workflow-run.d.ts +1 -1
  291. package/dist/workspace/attached-computers.d.ts +41 -0
  292. package/dist/workspace/attached-computers.js +114 -0
  293. package/dist/workspace/computer-deps.d.ts +16 -9
  294. package/dist/workspace/computer-deps.js +19 -7
  295. package/dist/workspace/computer-for-claim.d.ts +17 -8
  296. package/dist/workspace/computer-for-claim.js +62 -21
  297. package/dist/workspace/computer-hold.d.ts +11 -27
  298. package/dist/workspace/computer-hold.js +36 -56
  299. package/dist/workspace/computer-ledger.d.ts +3 -1
  300. package/dist/workspace/computer-ledger.js +4 -0
  301. package/dist/workspace/computer-mcp.d.ts +25 -0
  302. package/dist/workspace/computer-mcp.js +41 -0
  303. package/dist/workspace/computer-ports.d.ts +4 -13
  304. package/dist/workspace/computer-ports.js +4 -107
  305. package/dist/workspace/computer-script.d.ts +37 -0
  306. package/dist/workspace/computer-script.js +138 -0
  307. package/dist/workspace/executors.d.ts +1 -1
  308. package/dist/workspace/index.d.ts +4 -2
  309. package/dist/workspace/index.js +3 -1
  310. package/dist/workspace/kind-skills/desktop/SKILL.md +119 -84
  311. package/dist/workspace/kind-skills/phone/SKILL.md +100 -85
  312. package/dist/workspace/resolve-computer.d.ts +3 -0
  313. package/dist/workspace/resolve-computer.js +8 -2
  314. package/dist/workspace/run-tools.d.ts +32 -15
  315. package/dist/workspace/run-tools.js +23 -30
  316. package/package.json +19 -16
  317. package/templates/market-monitor/agent.md +1 -1
  318. package/dist/console/assets/index-BI4Byidu.js +0 -550
  319. package/dist/console/assets/index-C19gUF2n.css +0 -1
  320. package/dist/run-db.d.ts +0 -53
  321. package/dist/run-db.js +0 -116
  322. package/dist/workflow/readers.d.ts +0 -36
  323. package/dist/workflow/readers.js +0 -145
  324. package/dist/workflow/wal.d.ts +0 -11
  325. package/dist/workflow/wal.js +0 -106
package/README.md CHANGED
@@ -67,14 +67,13 @@ An edit is a new revision: `PUT $AGENTRUN_BASE_URL/agents/calc/definition` with
67
67
  | `--documents DIR` | `AGENTRUN_SERVE_DOCUMENTS` | A read-only directory of documents a workflow's `pdf_pages` calls read by file name, confined to it. |
68
68
  | `--allow-code-nodes` | off (`AGENTRUN_SERVE_CODE_NODES=1` turns it on) | Run workflows' `code` nodes. They run in the run's process through the DSL's `new Function` transform, which is no sandbox, so only turn it on for workflows you wrote. Off, a workflow with a code node saves with a `not_set_up_here` warning and its runs are `409 agent_not_runnable` with `details.code: true`. A call `via: "shell"` or `"executor"` is refused either way. |
69
69
  | `--learning on\|off` | on (`AGENTRUN_SERVE_LEARNING`) | Whether runs [learn](#learning). On, a run of an agent whose definition says `learning: true` starts from what that agent learned and adds to it; off, no run does, whatever its agent says. Any other value refuses the start. Capabilities report it as `features.learning`. |
70
- | `--learning-budget BYTES` | `8000` (`AGENTRUN_SERVE_LEARNING_BUDGET`) | How much of what an agent learned its runs' instructions hold under `# Learned`, in UTF-8 bytes: every note whole while they fit, else the index and the notes changed last, whole, while they fit ([learning](#learning)). `0` gives the index alone. A value that is not a whole number of bytes refuses the start. |
70
+ | `--learning-budget BYTES` | `8000` (`AGENTRUN_SERVE_LEARNING_BUDGET`) | How much of what an agent learned its runs' instructions hold under `# Learned`, in UTF-8 bytes: every note whole while they fit, else the notes that bear most on the run whole while they fit, then one line each for more of them; the rest are left out, and the run's log names them ([learning](#learning)). `0` gives no notes. A value that is not a whole number of bytes refuses the start. |
71
71
  | `--drain-timeout D` | `30s` (the image: `6s`) | How long the runner beside the server lets each busy run finish its turn when the server stops (`8s`, `500ms`, `1m`): a turn that ends within it keeps its outcome, and its model request is never sent again. A run still busy at the bound is stopped where it can resume, and the next claim carries on from its journal (that turn's model request sent again). The stop says how long it waits and for how many runs. A runner of its own (`agentrun-serve runner`) takes `--drain-timeout` too, default `AGENTRUN_DRAIN_TIMEOUT`, else `6s`. |
72
72
 
73
73
  `AGENTRUN_TOKEN`, when set, is the token (32 characters or more), and the server prints `$AGENTRUN_TOKEN` in its
74
74
  place: a token from the environment stays out of the logs. `DIR/.token`'s token is printed only by the start that made
75
75
  it; a later start prints `AGENTRUN_API_KEY=<in DIR/.token>`, to read it there. With `AGENTRUN_ACCOUNTS=0` the `Open`
76
- link carries the token (`?token=<in DIR/.token>` on a later start); it encodes the token, and the server also takes one
77
- whose `+` arrived as a space. `AGENTRUN_PUBLIC_URL`, when set, is the
76
+ link carries a launch code this start made at random (`?launch=<code>`), never the token. `AGENTRUN_PUBLIC_URL`, when set, is the
78
77
  address people open (a container's published port, or a proxy's URL): the printed `Open` link and `AGENTRUN_BASE_URL`
79
78
  use it.
80
79
 
@@ -136,7 +135,7 @@ at=2026-10-25T21:04:09.010Z event=auth_failed route=/v2/runs reason=wrong_token
136
135
  ```
137
136
 
138
137
  A request's path has no query. `auth_failed` names the route and why (`no_credential`, `wrong_token`,
139
- `wrong_link_token`, `wrong_password`, `sign_in_table_full`), never the token given nor any part of it. `AGENTRUN_LOG=quiet` leaves out the request lines; the
138
+ `wrong_launch_code`, `wrong_password`, `sign_in_table_full`), never the token given nor any part of it. `AGENTRUN_LOG=quiet` leaves out the request lines; the
140
139
  run and `auth_failed` lines stay. A run whose process failed at its start says why in its `error.message`, in words.
141
140
  One line at start, `event=boxes`, says which boxes this server has ([Boxes](#boxes)); quiet keeps it too.
142
141
  `event=harness_offers why=start ms=<n>` says how long the server took to check what each harness offers (each CLI's
@@ -620,10 +619,22 @@ Settings → Computers. The kind says what the agent is given, and the provider
620
619
  |---|---|---|
621
620
  | `none` | The run's folder alone: no computer, and no provider (`{"kind": "none"}`) | |
622
621
  | `sandbox` | A Linux shell, with files and processes | `docker`, `daytona`, `modal`, `e2b` |
623
- | `desktop` | A screen, a pointer and keys (`desktop_screen`, `desktop_input`), and a shell where its provider mounts the run's folder | `docker` (with an image that has an X server), `e2b`, `orgo` |
624
- | `phone` | A rented Android: its screen, touch and apps (the `phone_*` tools) | `phone-harness` |
622
+ | `desktop` | The computer's tools (`computer_observe`, `computer_act`, `computer_screenshot`, `computer_script`), and a shell where its provider mounts the run's folder | `docker` (with an image that has an X server), `e2b`, `orgo`, or [a paired computer](#a-persons-own-computer) by its id |
623
+ | `phone` | A rented Android, through the same computer tools | `phone-harness` |
625
624
  | `browser` | A hosted browser (the browser tools) | `browserbase`, `kernel` |
626
625
 
626
+ A desktop's and a phone's tools are one set over the computer's groups. With the `ui` group, `computer_observe` returns
627
+ the app window's elements as compact lines (`@e12 button "Save"`), and `computer_act` runs steps on them by ref (press,
628
+ set, click, type, key, scroll, drag, nav), each step saying its route and whether a readback verified it, and the answer
629
+ ending with the window's new state. Without it, observe is a screenshot and act's steps are raw input at its pixels.
630
+ `computer_script` runs JavaScript in an isolate in this server, with a typed `computer` object as its only binding (no
631
+ network, no keys): a known sequence of steps is one script, and it returns only what the next decision needs. Its
632
+ declarations are `spec/computer/computer.d.ts`, generated from `packages/computer/src/surface/api.ts`. On pi, a run
633
+ with a desktop or a phone also has pi's code mode (`codemode`), whose scripts call the run's tools and have the same
634
+ `computer` bound; the call is held to the kind's setting. In Codex's code mode, a script's call of a computer tool
635
+ answers the tool's value as JSON. `computerMcp` (`src/workspace/computer-mcp.ts`) serves the same tools to an MCP
636
+ client, each answer with its value as `structuredContent`.
637
+
627
638
  A kind with no provider, a provider that does not serve the kind, or a provider whose required keys are not saved is
628
639
  refused before anything starts, in words that name the fix in Settings → Computers. A Docker computer needs a Docker
629
640
  daemon on this server: where none answers `docker version` (Render and most hosted services run none), Docker is not
@@ -685,16 +696,50 @@ one computer that it keeps between runs, instead of a fresh one for each run:
685
696
  - The computer is owned by this server's id (kept in its store) and the agent's id, so two servers on one vendor
686
697
  account never take each other's. The janitor deletes an agent's computer only once its agent no longer wants it.
687
698
 
699
+ #### A person's own computer
700
+
701
+ A computer of your own (a laptop, a desktop, a phone) can be an agent's computer. A driver on it dials this server and
702
+ holds the connection open, so the computer needs no open port and this server needs no address of its
703
+ ([spec/computer/attach.md](../../spec/computer/attach.md)). This server knows no OS: a paired computer is what its
704
+ driver's hello says it is (its kind, os, device, screen, capability groups and features), and a driver on any OS that
705
+ passes the binding's conformance cases (below) needs no change here.
706
+
707
+ - **Pair it.** Settings → Computers → Pair a computer shows a code, such as `K7PD-W3QX` (`POST /v2/computers/pairings`),
708
+ and this server's address. The code pairs one computer, once, within 10 minutes. Type both into the driver: it trades
709
+ the code for its own token (`POST /v2/computers/pair`, which takes no token of this server's) and keeps that token in
710
+ the OS's keychain. This server keeps only the token's SHA-256. A wrong, used or expired code is a 404, and each source
711
+ address gets 10 tries a minute.
712
+ - **It attaches.** The driver dials `GET /v2/computers/attach`, a WebSocket with its token and the subprotocol
713
+ `agentrun.computer.0.2`, and dials again when the connection drops. `GET /v2/computers` lists it under `paired` as its
714
+ hello says, online or offline, with the run that holds it and the time that hold ends by, and as a provider, named by
715
+ its name and os, of each kind its hello serves (`desktop`, `phone`), ready while it is online.
716
+ - **An agent uses it.** `computer: {"kind": "desktop", "provider": "cmp-8f2k3jq7m4xw9tnb"}` names it by its id. A run
717
+ claims it at its start (one run at a time: another is refused while one holds it) and releases it at its end, or at
718
+ its lifetime, released or not; it is never made, stopped or deleted. A run of an agent whose computer is offline is
719
+ refused at its start, saying to open its driver. A run uses what the hello's groups and features allow.
720
+ - **Remove it.** Remove on its row (`DELETE /v2/computers/{computer_id}`) ends its token and closes its connection; a
721
+ run holding it loses it. Pairing it again gives it a new id.
722
+ - **One process.** A computer's connection lands on one server process, and only a run in that process can use it:
723
+ run `agentrun-serve start` with its runner beside the server (the default). A runner started apart
724
+ (`agentrun-serve runner`, beside a server started with `--no-runner`) refuses a paired computer at the claim, saying
725
+ so. A second server on one store is already refused by the store's owner lock, on SQLite and Postgres alike.
726
+ - **Conformance.** `node dist/attach-conformance-cli.js [--port 7392] [--listen 127.0.0.1]` runs the binding's cases
727
+ against whatever driver pairs with the code it prints: pair, a wrong or used code, ping, a quiet minute, a redial
728
+ after each close it must redial after (4408, 1000, 1001, 4409) and after a drop, a binary frame (1003), a frame over
729
+ 1 MiB (1009), a second socket with the same token (4409 to the older), and revoke (4401, no redial). It runs a store
730
+ of its own in a scratch directory, prints PASS or FAIL for each case, and exits 0 when all pass; it takes about five
731
+ minutes. The revoke case leaves the driver unpaired. Serve's tests run the same cases against a test driver.
732
+
688
733
  **Where the run's folder lives.** A server keeps its runs' folders in one of two modes:
689
734
 
690
735
  - **Mode 1** (the default): on this server's own disk. Only a provider that binds a folder of this machine can hold
691
- it, so a sandbox runs on Docker only; a Daytona, Modal or E2B sandbox is refused ("Mode 1 runs a sandbox only on
736
+ it, so a sandbox runs on Docker only; a Daytona, Modal, E2B or Agent37 sandbox is refused ("Mode 1 runs a sandbox only on
692
737
  Docker").
693
738
  - **Mode 2**: on Archil disks. `PUT /v2/workspace/archil` turns it on with the account key, `ARCHIL_API_KEY`, its
694
739
  region and that region's S3 URL (and an exec image pinned by digest, if you want one other than serve's default);
695
740
  `DELETE` turns it off. The default exec image is Docker's `buildpack-deps:trixie-scm` pinned by digest (git 2.47),
696
741
  because Archil's own has git 2.34 and a read-only bash policy runs git only at 2.43 or later. An image you name needs
697
- git 2.43 for that too, and GNU coreutils and perl, as Debian-family images have. A Daytona, Modal or E2B sandbox mounts
742
+ git 2.43 for that too, and GNU coreutils and perl, as Debian-family images have. A Daytona, Modal, E2B or Agent37 sandbox mounts
698
743
  the run's folder from its disk with a mount credential minted for that run alone; Docker's sandbox is refused, since
699
744
  it cannot mount the disk.
700
745
 
@@ -799,7 +844,7 @@ no computer.
799
844
  registries and GitHub) through its egress proxy, and nothing else; `AGENTRUN_BOX_ALLOW=none` gives it no network. From a
800
845
  server in a container the proxy also refuses the Docker host's own addresses, which the server reads through the socket
801
846
  ([in the published image](#in-the-published-image)). A
802
- Daytona, Modal or E2B sandbox has no network of its own (loopback only). A phone and a hosted browser are on their
847
+ Daytona, Modal, E2B or Agent37 sandbox has no network of its own (loopback only). A phone and a hosted browser are on their
803
848
  vendor's own network, whatever the list says. Local Chrome is open unless this server sets `AGENTRUN_BOX_ALLOW`; then
804
849
  only those hosts (the default list, a sandbox's package registries, is no browsing policy). Under
805
850
  `AGENTRUN_BOX_ALLOW=none`, each of these is refused at the run's start, in words that name the setting.
@@ -848,7 +893,7 @@ model with no price set that the catalog does not list in any form; null while `
848
893
  in USD per million tokens, so a run's cost estimate has a price; `AGENT_MODEL_FAST_PRICE` and `AGENT_MODEL_STRONG_PRICE`
849
894
  price their tier's model, and default to it. With no price set, a model id pi-ai's catalog knows (`gpt-6-luna`, say)
850
895
  takes the catalog's list price; one it lists only with its version's separators written the other way (a gateway's
851
- `gpt-5-4-mini` for the catalog's `gpt-5.4-mini`, `claude-haiku-4.5` for `claude-haiku-4-5`) takes that entry's price,
896
+ `gpt-6-1-terra` for the catalog's `gpt-6.1-terra`, `claude-haiku-5.5` for `claude-haiku-5-5`) takes that entry's price,
852
897
  only when every entry of that form lists one price (else none), and the id sent to the gateway stays as named; any
853
898
  other has no price: its answers' cost is unknown, so the run's `cost.usd` is
854
899
  `null`, never $0. A model the catalog lists at $0, or one `AGENT_MODEL_PRICE=0,0` prices, is a known $0. A revision's `provider/model-id` takes that provider's
@@ -1459,6 +1504,21 @@ Streamable HTTP with the official MCP SDK client (`@modelcontextprotocol/client`
1459
1504
  value}}` (up to 8). An `oauth` server is signed in to first ([below](#signing-in-with-oauth)), then previewed by name.
1460
1505
  `url` is `https`, or `http` on loopback.
1461
1506
 
1507
+ ### Composio
1508
+
1509
+ Composio is an MCP server like any other, so it needs no adapter of its own. Settings → MCP servers has a Composio
1510
+ preset: you give your Composio API key, a toolkit (`github`, `slack`...), the actions to grant (picked from the
1511
+ toolkit's list) and a server name, and the server has Composio make a managed MCP server for them, then saves it as an
1512
+ ordinary MCP server with the key sealed as an `x-api-key` header. `POST /v2/settings/mcp-servers/composio/tools`
1513
+ `{api_key, toolkit}` lists the actions; `PUT /v2/settings/mcp-servers/{name}/composio` `{api_key, toolkit, tools,
1514
+ user_id?}` makes and saves the server. When the toolkit needs your account and `user_id` (default `agentrun`) has none
1515
+ active, the answer's `connect_url` is Composio's page to connect it; nothing here signs in. Composio's server can leave
1516
+ out an action it was allowed (it did for `HACKERNEWS_GET_FRONTPAGE`), so the answer's `not_served` names any chosen
1517
+ action the saved server doesn't list. Both routes are the owner's
1518
+ session alone, and a saved Composio server is gated, approved and shown on the Timeline as any MCP server's tools are,
1519
+ "not metered" until you price them. Composio's own meta tools stay refused, and the helper actions that connect an
1520
+ account are left off the server's address.
1521
+
1462
1522
  What can go wrong, told apart:
1463
1523
 
1464
1524
  - `422 auth_required`: the server answered 401 or 403. `details.auth` is `oauth` when it names protected-resource
@@ -1543,7 +1603,12 @@ proxy on a public https address, set `AGENTRUN_PUBLIC_URL` to that address and h
1543
1603
  and `X-Forwarded-Proto: https`: without them a start reads as another address (or plain http) than the callback's,
1544
1604
  and every start answers `409 wrong_origin`. For an MCP server whose URL is not loopback, every endpoint its authorization server names (and
1545
1605
  every request to one) must be `https` and resolve to no private, loopback or link-local address, or the sign-in or
1546
- refresh is refused with words and nothing is sent. A loopback MCP server is a development-only exception: its
1606
+ refresh is refused with words and nothing is sent. A loopback MCP server (a `127.0.0.1` or `localhost` URL) is taken only
1607
+ by a server started with `AGENTRUN_MCP_ALLOW_LOOPBACK=1`, which says this is a local install: set it only on a machine you
1608
+ alone use, since loopback is this machine's other services too. Without it such a URL is refused at the save, the preview
1609
+ and the sign-in, in words naming the variable, and a runner never reaches one; only the runner beside such a server does.
1610
+ An MCP server's URL is shown on every read as its origin and `/…`: its path and query are held as a secret, sent only to
1611
+ the server itself, and sending the shown URL back for a saved server keeps the saved one. A loopback MCP server is a development-only exception: its
1547
1612
  authorization server may name endpoints on the MCP server's own loopback host, exactly as its URL writes it (never
1548
1613
  another loopback address, the IPv6 loopback, or a name for this machine in its place), on any port but this server's own; any other
1549
1614
  loopback endpoint is refused the same way. The host is pinned, not the port, as a local authorization server listens on
@@ -1670,23 +1735,25 @@ asked by default.
1670
1735
  ## Webhooks
1671
1736
 
1672
1737
  One URL hears of your runs without anyone watching the page. `PUT /v2/settings/webhook` with `{url}` sets it: an `http`
1673
- or `https` address, with no user or password in it. Loopback and private-network addresses are allowed, so a receiver
1674
- on your own machine or network works. Two kinds of message are POSTed to it about runs: `run.needs_input` when a run comes to
1738
+ or `https` address, with no user or password in it, on a public host: a loopback or private-network address is refused
1739
+ unless the operator allows it (`AGENTRUN_WEBHOOK_PRIVATE_TARGETS=1`, below). Two kinds of message are POSTed to it about runs: `run.needs_input` when a run comes to
1675
1740
  need its person (`input_required`: a question, a call held for approval, a pause at its cap, an ask for its person in
1676
1741
  its browser, desktop or phone, or a stopped turn) and `run.ended` when it ends
1677
1742
  (completed, failed or cancelled, once the run's end is written). A [schedule](#schedules) whose firing fails sends a third,
1678
1743
  `trigger.failed`; a server with no triggers never sends one.
1679
1744
 
1680
- A run's end and its `run.ended` are one durable step. The server chooses the end's time once and gives it to the agent
1681
- store, so the row's `ended_at` and the message's `webhook-id` name one time. `run.ended` is queued only once the agent
1682
- store has the end, so a receiver that reads the run back on its message (`GET /v2/runs/{id}`) reads it ended; while the
1683
- store refuses the end (a full disk, a busy store), nothing is sent, until a later try of the write or the next server
1684
- stores it. The outbox, in the store with the runs, keeps, in the same write as each message, which end and which wait of
1685
- each run it queued. A server that starts queues any end of the last day that the agent store holds and the outbox does
1686
- not, under the same `webhook-id` (one lost to a kill, or to a crash of the machine), and a server that takes over a run
1687
- queues a wait it stands at that the outbox does not name (one the run came to while no server was up), under its one
1688
- `webhook-id`. An end before the webhook was set is never sent. A run is continued only once its end's
1689
- `run.ended` is in the outbox (`503` meanwhile), so a continued run's next end is its own, under its own id.
1745
+ The server follows the store's run-change feed: each run that reaches its end, or that its runner lets go waiting on a
1746
+ person, is told once, in order, whichever runner wrote it, so a receiver that reads the run back on its message
1747
+ (`GET /v2/runs/{id}`) reads it as the message says. The end's time is the store's, so the row's `ended_at` and the
1748
+ message's `webhook-id` name one time. A wait's `webhook-id` comes from its ask (a question's, an approval's call, a
1749
+ pause at the cap, a hand-over), so one ask sends one `run.needs_input`, however often the run is read and after its
1750
+ answer too. Everything the webhook keeps is in the store: its messages, their tries, and which
1751
+ end and which wait of each run it queued, written with each message in one transaction. While the store refuses that
1752
+ write (a full disk, a busy store), nothing is sent and the log says so (`condition=outbox_unwritable`); the server tells
1753
+ the notice again on its next read. A server that starts queues any end of the last day that the store holds and the
1754
+ webhook has not, under the same `webhook-id` (one lost to a kill, or to a crash of the machine), and any wait a run
1755
+ stands at that it has not told (one the run came to while no server was up), under its one `webhook-id`. An end before
1756
+ the webhook was set is never sent.
1690
1757
 
1691
1758
  ```json
1692
1759
  { "type": "run.needs_input", "timestamp": "2026-11-01T12:00:00.000Z",
@@ -1709,16 +1776,23 @@ with any of its libraries: `webhook-id` (the same on every try of a message, so
1709
1776
  the secret's bytes. A receiver checks the signature against the raw body and refuses a timestamp more than 5 minutes
1710
1777
  from its clock, so a replay does not pass. The first `PUT` makes the secret, `whsec_` and 32 random bytes in base64,
1711
1778
  and answers `201` with it, once; `GET /v2/settings/webhook` never shows it. It is kept like a [tool key](#tool-keys):
1712
- sealed under `AGENTRUN_SEAL_KEY`, in the store (SQLite or Postgres) with the webhook itself. A new secret is a `DELETE` and a
1713
- `PUT`; a secret that no longer opens under the server's key (sealed under another) is replaced, and shown once, by the next `PUT`.
1779
+ sealed under the server's seal key in the store, and a replaced or removed one is kept sealed too, so a run that echoes
1780
+ it is still cut. A `PUT` that changes the URL makes a new secret and shows it once, as the first does; one that keeps the
1781
+ URL keeps it. `GET` and the log show the URL's origin and its last four characters, never the whole URL (a chat
1782
+ service's incoming-hook URL is a credential itself). The URL is refused when it is on a private network or this machine,
1783
+ by address or by any address its name resolves to, and each try resolves the name again and dials the address it
1784
+ checked; an operator who sends to an internal receiver sets `AGENTRUN_WEBHOOK_PRIVATE_TARGETS=1` where the server starts. A `DIR/webhook.json` an earlier build left is not read: the
1785
+ server says so at its start (`condition=webhook_left_over`), and a `PUT` sets the webhook again. A new secret for the
1786
+ same URL is a `DELETE` and a `PUT`; a secret that no longer opens under the server's key (sealed under another) is
1787
+ replaced, and shown once, by the next `PUT`. The URL and its secret go live together: a `PUT` whose write the store
1788
+ refuses leaves the webhook as it was, and the secret it made is never used.
1714
1789
 
1715
1790
  A try that is not answered 2xx within 15 s fails; a redirect is not followed. A failed message is tried again on the
1716
1791
  spec's schedule, with jitter: after about 5 s, 5 min, 30 min, 2 h, 5 h and 10 h, then logged as failed
1717
1792
  (`event=webhook condition=delivery_failed`). Each message goes on its own tries, so two queued close together can
1718
1793
  arrive in either order: a receiver orders them by `webhook-timestamp`, or reads the run (`GET /v2/runs/{id}`). A
1719
- `410 Gone` turns the webhook off (`disabled` in `GET`, and the log says why) until a `PUT` sets it again. Pending messages are kept in the store's outbox, so the next server goes on with
1720
- them after a restart; a message can then come twice, under the same `webhook-id`. An outbox of another version
1721
- is not read: the server starts with none, and the log says so (`condition=outbox_not_read`). `GET /v2/settings/webhook/deliveries`
1794
+ `410 Gone` turns the webhook off (`disabled` in `GET`, and the log says why) until a `PUT` sets it again. Pending messages are kept in the store, so the next server goes on with them after a
1795
+ restart; a message can then come twice, under the same `webhook-id`. `GET /v2/settings/webhook/deliveries`
1722
1796
  lists the last 50 attempts (`webhook_id`, type, status code, latency, error, when, and the next try's time), and
1723
1797
  `POST /v2/settings/webhook/deliveries/{webhook_id}/redeliver` sends one of those messages again, once, under the same
1724
1798
  `webhook-id`. `POST /v2/settings/webhook/test` sends a `webhook.test` message once and answers how it went. A webhook a
@@ -1823,6 +1897,21 @@ delivery on the payload's tag, for tracing. A request that carries no scheme's s
1823
1897
  one, or is signed under a scheme other than its trigger's, is the same `401` as a bad signature, and the headers are
1824
1898
  checked before the body is read.
1825
1899
 
1900
+ `composio` takes [Composio](https://composio.dev) trigger events. Register the trigger's `hook_url` as Composio's webhook
1901
+ subscription (`POST /api/v3.1/webhook_subscriptions` with `enabled_events: ["composio.trigger.message"]`); Composio
1902
+ answers with a `secret` it makes, which you give here, whole and as Composio shows it, with `POST /v2/triggers/{id}/secret`
1903
+ and the body `{"secret": "..."}` (the same call replaces it when you rotate it in Composio). A composio trigger is made with no
1904
+ secret (the URL carries its id, so Composio can only make the secret after); until one is set every request is refused. It is sealed as a minted one is and never shown again; this server never
1905
+ makes one for a composio trigger. Composio signs as Standard Webhooks does (`webhook-id`, `webhook-timestamp`, `webhook-signature`) but keyed by the
1906
+ UTF-8 bytes of that secret string, not a decoded `whsec_` key, which is why a `standard` trigger cannot take it. The
1907
+ firing's key is `webhook-id`, the event is the body's `metadata.trigger_slug`, so `accept: [{"event":
1908
+ "GITHUB_ISSUE_ADDED_EVENT"}]` takes one Composio trigger's events, and a rule's `where` pointers read the payload under
1909
+ `/data`. The subscription also delivers account events (`composio.connected_account.expired`,
1910
+ `composio.connected_account.activated`, `composio.trigger.disabled`), signed the same way, with no slug: their event is the
1911
+ body's top-level `type`, so `accept` can take them too. A Composio project's subscription posts every event to the one URL it names, so it fires that one composio
1912
+ trigger and its agent: other triggers never see those deliveries, whatever their `accept`. The tag also names
1913
+ `trigger_id` and `user_id`.
1914
+
1826
1915
  `accept` makes a trigger take only the events it names, from the delivery alone:
1827
1916
 
1828
1917
  ```json
@@ -2353,10 +2442,13 @@ server's own origin, under a CSP that allows that origin only, but for the provi
2353
2442
  Its files (`index.html`, and Vite's hashed files under `/assets/`) are public and hold no data: everything it shows
2354
2443
  comes through `/v2`. With accounts on (the default) the console asks for the owner's password
2355
2444
  ([your password](#your-password)) and the browser holds the owner's session cookie; a `?token=` link sets no cookie: the
2356
- token is for scripts and the CLI. With `AGENTRUN_ACCOUNTS=0`, the printed link (`/?token=`) sets a cookie (`HttpOnly`,
2357
- `SameSite=Strict`, `Path=/`, and `Secure` when `X-Forwarded-Proto` says https) and sends the browser to the same address
2358
- without the token. The cookie's value is derived from the token, never the token itself, and it lasts until the browser
2359
- closes. Without it, the console says to open the link. Either cookie takes the place of `Authorization: Bearer` on
2445
+ token is for scripts and the CLI. With `AGENTRUN_ACCOUNTS=0`, the printed link (`/?launch=<code>`, a code each start
2446
+ makes at random) gives the browser a console session: a cookie (`HttpOnly`, `SameSite=Strict`, `Path=/`, and `Secure`
2447
+ when `X-Forwarded-Proto` says https) whose value is an id made at random and kept by the server, and sends the browser
2448
+ to the same address without the code. Nothing about it is derived from the API token, and a `?token=` link sets no
2449
+ cookie there either, so the token alone never holds a console session (and so never writes a secret, below). The
2450
+ session lasts until the browser closes or the server stops; the next start prints its own link. Without it, the console
2451
+ says to open the link. Either cookie takes the place of `Authorization: Bearer` on
2360
2452
  `/v2`: for a `GET`, and for any other method only when the request's `Origin` is the server's own origin
2361
2453
  and its body is `application/json`, or, on a `PUT` or `POST` to a route that takes bytes (`PUT /v2/files/{id}`,
2362
2454
  `POST /v2/files`), of any content type. A request that sends an `Authorization` header is checked on that header alone.
@@ -2519,11 +2611,14 @@ Each run of an agent that learns starts from `main` as it is when the run is mad
2519
2611
  edit; then by name), while they all fit the server's learning budget (`--learning-budget`, 8000 bytes by default).
2520
2612
  Past it, the run reads the notes that bear on it: each active note is scored against the run's first message by a
2521
2613
  lexical match (BM25 over its name, description and text; a code review's changed paths weigh three times its prose; no
2522
- model call), and the run reads the best ones whole while they fit, then one line for each of the rest
2523
- (`- <name> (<file>): <description>`, at most 200 lines and 25 KB), in place of the index. A first message that shares
2524
- no word with any note reads the index's first 200 lines, then the notes changed last, whole, while they fit. An agent
2525
- with the `read` tool is told the notes not given whole are in `.learning/`, to open one when it applies (one without
2526
- is not). A line
2614
+ model call), and the run reads the best ones whole while they fit the budget, then one line each
2615
+ (`- <name> (<file>): <description>`, at most 200 lines and 25 KB) for the next ones while they fit what is left, in
2616
+ place of the index. A note that shares no word with the first message is a line at most. A first message that shares
2617
+ no word with any note reads the notes changed last, whole while they fit, then their lines. Whole notes take the
2618
+ budget before lines do, so an agent with hundreds of notes still reads the ones that bear on the run whole; the notes
2619
+ given neither way are left out, and the run's log names them ("starts without N of the notes its agent learned").
2620
+ An agent with the `read` tool is told the notes not given whole are in `.learning/`, to open one when it applies
2621
+ (one without is not). A line
2527
2622
  before them says to follow a note when it applies. `# Learned` opens, for every run that learns, notes or none, with
2528
2623
  what the run is told of learning: that only what it answers when it is asked at the end is kept, never a file it
2529
2624
  writes, so it tells the person it will keep what they ask it to remember, and that a secret is never kept. A run with
@@ -2642,7 +2737,15 @@ neither, on the agent's own model. `GET /capabilities` names it as `learning.gra
2642
2737
  cheap model is a poor grader, so point the strong tier (or `--grade-model`) at a strong one. The grader reads each active
2643
2738
  note's index line, the whole text only of the notes the proposal supersedes, what the user said in the run (cut of the
2644
2739
  server's secrets, as the proposal keeps it), and the new notes, so its prompt stays under 200,000 characters however
2645
- many notes the folder holds. No injection screen runs before it: a page classifier cannot see where a note came
2740
+ many notes the folder holds. A note must hold beyond the one input it came from: before the grader, one Jev question
2741
+ per new note (the Jev model and keys decision nodes use) asks whether it states a method, a source, a fact or a
2742
+ preference that holds for this job's other inputs, and a note rated below 0.5
2743
+ (`AGENTRUN_SERVE_LEARNING_GENERAL_THRESHOLD`, from 0 to 1) is dropped there, its reason on the verdict; its cost is
2744
+ the grade's. When Jev cannot run, the grader reads every note: the runner's log says why, the run's learning says the
2745
+ check could not run, and the grade's cost is unknown, never the grader's alone (a Jev request that failed may still
2746
+ have been charged). The grader answers General
2747
+ for every item, and one it says is not general is never kept, whatever else it decides. No injection screen runs
2748
+ before it: a page classifier cannot see where a note came
2646
2749
  from, and read a preference the user stated as a planted instruction; the grader's Planted question decides: a rule the
2647
2750
  user states in their own words is theirs, even beside a form or a pasted email in the same message, and a rule found only
2648
2751
  inside text the run read is planted and dropped, never held for the owner's OK. An item that holds an account number is
@@ -2805,7 +2908,7 @@ Who can approve: the owner, signed in with their password. No token approves, th
2805
2908
  `POST .../learning/files/{file}/approve` (and `.../restore`, which puts a retired item back into every run) takes the console's password session, sent from this server's own origin with
2806
2909
  a JSON body as every page write is. Any token is 403: the server's own (what scripts and the MCP endpoint's tools
2807
2910
  carry) and a token sent beside the session. So is every request on a server with accounts off
2808
- (`AGENTRUN_ACCOUNTS=0`), whose page cookie any token holder can mint. With no credential it is 401, as every route.
2911
+ (`AGENTRUN_ACCOUNTS=0`), which has no password session: its console session comes from the launch code, never the token. With no credential it is 401, as every route.
2809
2912
  `capabilities.learning.approve` is true only for the owner's session; every other caller reads `approve: false` with
2810
2913
  `approve_needs: "password"`. A note that is not pending is 400; a stale ETag is 412, none 428. The approval is one host
2811
2914
  commit, `learning: approved by a person: <file>`, with the trailers `Changed-By: user` and `Approved-Via: console`; the
@@ -2853,11 +2956,14 @@ cap, due at the run's first request), the words say the budget instead, on every
2853
2956
  $X, enough for little work: answer as soon as you can." On pi the words go into that one request's context;
2854
2957
  on claude-agent, codex and opencode the model proxy adds them to the body (after everything the CLI sent, so its cached
2855
2958
  prefix is unchanged). Neither CLI nor pi keeps them in its transcript, and no message is queued, so nothing runs after
2856
- the model's answer. Once per cap, across restarts; a raise re-arms it.
2857
-
2858
- A capped run also stops calling tools before its cap stops it. Once what it has spent, plus what its requests and paid
2859
- steps still out are held at (their worst case, as the cap counts them, a browser session's open reserve included),
2860
- reaches 75% of its cap, the run's tool gate
2959
+ the model's answer. Once per cap, across restarts; a raise re-arms it. The note also comes due, if it has not already,
2960
+ on the request whose tool call would be refused now (the wrap-up below: what is left no longer covers what the run keeps
2961
+ back to answer), so the note tells the model what is left no later than its tools stop.
2962
+
2963
+ A capped run also stops calling tools before its cap stops it. It keeps back enough to answer: one typical step (its own
2964
+ answers' typical cost) and one final answer at its least, as the cap prices the main model's next request. Once what it
2965
+ has spent, plus what its requests and paid steps still out are held at (their worst case, as the cap counts them, a
2966
+ browser session's open reserve included), leaves less than that, the run's tool gate
2861
2967
  refuses every call a model makes, in every conversation of the run, on every harness, before any setting or approval
2862
2968
  is read, with one fixed text: "Budget nearly spent: stop calling tools and answer now from what you have." A call that
2863
2969
  would open a child conversation is refused the same way, so no new one starts. Nothing in flight is cut: a child still
@@ -2866,7 +2972,10 @@ model requests are judged by the cap as before, so the run's final answer still
2866
2972
  request that does not fit what is left is refused as above. The figure is read from the run's booking records at each
2867
2973
  call, never kept in memory, so a restart or a claim moved to another runner holds the same line, and a raise moves it.
2868
2974
  Several requests out at once hold far more than they cost, which is why a fan-out of children used to end a small cap
2869
- with no answer at all; the quarter left above the line is the room for each of them, and the parent, to answer.
2975
+ with no answer at all: their holds count as taken, so the run stops calling tools while each of them, and the parent,
2976
+ still has room to answer. A simple run, with nothing else out, uses its cap up to its last step and answer. The run is
2977
+ told what is left (its wrap-up note, above) no later than its first refused call. Its one known miss: a request that
2978
+ writes to its max output can still leave no room for the answer; then the run pauses for a raise rather than overspend.
2870
2979
 
2871
2980
  Under a cap each request is limited to the
2872
2981
  output tokens what is left of the cap can buy, thinking included, never more than it asks for or than the model's
@@ -2893,16 +3002,13 @@ screenshots, then the answer), spending about $0.04 in all:
2893
3002
 
2894
3003
  | Cap mode | Route | First request needs | Five-step run needs | Each further step |
2895
3004
  | --- | --- | --- | --- | --- |
2896
- | `strict` | Through a gateway (OpenRouter): the byte bound | $0.05 | $0.11 | about $0.013 |
3005
+ | `strict` | Through a gateway (OpenRouter): the byte bound | $0.06 | $0.12 | about $0.013 |
2897
3006
  | `strict` | Straight to Anthropic: Anthropic's count | $0.03 | $0.09 | about $0.012 |
2898
- | `expected` (the default) | Either | as `strict` | as `strict` until #2504 lands | as `strict` until #2504 lands |
3007
+ | `expected` (the default) | Either | as `strict` | $0.06 | about $0.007 |
2899
3008
 
2900
- In `strict` mode every step's whole input is priced at the cache-write price. The `expected` row is today's: the runner
2901
- does not yet price a step from what the previous request read from the cache, as `expected` is described above, so it
2902
- prices like `strict` until #2504 lands. Once it does, a five-step run in `expected` mode needs about $0.06 by either route,
2903
- and about $0.007 a further step. A claude-agent run's first request is of the same size (the pinned
3009
+ In `strict` mode every step's whole input is priced at the cache-write price. In `expected` mode a step after the first is priced from what the session's previous request read from the cache, so a five-step run needs about $0.06 by either route, and about $0.007 a further step; the first request is priced as in `strict`, so its figure is the same. A claude-agent run's first request is of the same size (the pinned
2904
3010
  CLI's measured 6,926 bytes with five tools: $0.04 for its first request through a gateway). A cap below these pauses at
2905
- once with `Not sent: ... the next step needs at least $X`, and a raise to that figure sends it on.
3011
+ once with `Not sent: ... the next step needs at least $X`, and a raise to that figure sends it on. (In `strict` mode through a gateway, a run a cent under the five-step figure is not parked before its last step: the cap's wrap-up refuses its last screenshot, and the run answers from what it has.)
2906
3012
  `packages/serve/test/cap-minimum.test.mjs` holds these figures to what the cap does. A request in flight holds what it was admitted at until it answers, so requests
2907
3013
  sent side by side cannot pass the cap together. Spent so far is read from the run's store each time its process starts, so it
2908
3014
  survives a restart, plus each response since, and with them each charge a paid tool booked (`monid.run`, which is itself
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,18 @@
1
+ // The attach binding's conformance cases (attach-conformance.ts) as a command, for a person checking a real driver:
2
+ //
3
+ // node dist/attach-conformance-cli.js [--port 7392] [--listen 127.0.0.1]
4
+ //
5
+ // prints the server address and a pairing code to type into the driver, runs every case once it has paired, prints PASS
6
+ // or FAIL for each, and exits 0 when all passed.
7
+ import { parseArgs } from "node:util";
8
+ import { runAttachConformance } from "./attach-conformance.js";
9
+ const { values } = parseArgs({ options: { port: { type: "string", default: "7392" }, listen: { type: "string", default: "127.0.0.1" } } });
10
+ const results = await runAttachConformance({
11
+ port: Number(values.port),
12
+ host: values.listen,
13
+ pair: () => console.log("Waiting for the driver to pair..."),
14
+ say: (line) => console.log(line),
15
+ });
16
+ const failed = results.filter((result) => !result.ok).length;
17
+ console.log(failed === 0 ? `All ${results.length} cases passed.` : `${failed} of ${results.length} cases failed.`);
18
+ process.exitCode = failed === 0 ? 0 : 1;
@@ -0,0 +1,25 @@
1
+ /** The most of a pairing request's body this server keeps (a code and a hello): a larger one is refused 413. */
2
+ export declare const PAIR_BODY_MAX: number;
3
+ /** The cases, in the order they run: each later one needs the driver attached, and revoke ends it. */
4
+ export declare const ATTACH_CASES: readonly ["pair", "wrong-or-used-code", "ping", "quiet", "redial-after-close", "redial-after-drop", "binary-frame", "oversize-frame", "same-token", "revoke"];
5
+ export type AttachCase = (typeof ATTACH_CASES)[number];
6
+ export type CaseResult = {
7
+ readonly name: AttachCase;
8
+ readonly ok: boolean;
9
+ readonly detail: string;
10
+ };
11
+ export interface ConformanceOptions {
12
+ /** The port to listen on (0: any free one) and the address (127.0.0.1 by default). */
13
+ readonly port?: number;
14
+ readonly host?: string;
15
+ /** Every wait as a share of the protocol's (1, the default, for a real driver): heartbeat, idle and redial limits. */
16
+ readonly scale?: number;
17
+ /** How long the driver has to pair with the code (10 minutes, the code's life, by default). */
18
+ readonly pairMs?: number;
19
+ /** Told the server's address and the code: a person types them into the driver, or a test pairs its fake. */
20
+ readonly pair: (address: string, code: string) => void | Promise<void>;
21
+ /** Each line of progress. */
22
+ readonly say?: (line: string) => void;
23
+ }
24
+ /** Runs every case against the driver that pairs with the printed code; answers each case's result. */
25
+ export declare function runAttachConformance(options: ConformanceOptions): Promise<CaseResult[]>;