@parcha/agentrun-serve 0.1.0-beta.40 → 0.1.0-beta.41

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 (126) hide show
  1. package/CHANGELOG.md +77 -0
  2. package/README.md +78 -15
  3. package/dist/api-only.d.ts +3 -1
  4. package/dist/api-only.js +4 -2
  5. package/dist/api-token.d.ts +30 -0
  6. package/dist/api-token.js +89 -0
  7. package/dist/cli.js +19 -5
  8. package/dist/composio-made.d.ts +54 -0
  9. package/dist/composio-made.js +83 -0
  10. package/dist/composio-preset.d.ts +16 -8
  11. package/dist/composio-preset.js +106 -43
  12. package/dist/composio-triggers.d.ts +7 -2
  13. package/dist/composio-triggers.js +13 -7
  14. package/dist/computer-attach.d.ts +29 -11
  15. package/dist/computer-attach.js +141 -47
  16. package/dist/computer-keys.d.ts +4 -0
  17. package/dist/computer-keys.js +5 -0
  18. package/dist/computers.d.ts +11 -1
  19. package/dist/computers.js +21 -12
  20. package/dist/console/assets/{index-B8Zn1Iqn.css → index-C3gNPz58.css} +1 -1
  21. package/dist/console/assets/index-COGhx_2Z.js +711 -0
  22. package/dist/console/index.html +2 -2
  23. package/dist/decisions.js +9 -2
  24. package/dist/eval-feed.d.ts +26 -0
  25. package/dist/eval-feed.js +68 -0
  26. package/dist/eval-mailbox.d.ts +4 -1
  27. package/dist/eval-mailbox.js +11 -3
  28. package/dist/exa-keyless.d.ts +1 -1
  29. package/dist/exa-keyless.js +1 -1
  30. package/dist/feed/feed-faux.d.ts +62 -0
  31. package/dist/feed/feed-faux.js +123 -0
  32. package/dist/feed/fetch.d.ts +41 -0
  33. package/dist/feed/fetch.js +128 -0
  34. package/dist/feed/parse.d.ts +41 -0
  35. package/dist/feed/parse.js +300 -0
  36. package/dist/learn/check.d.ts +3 -1
  37. package/dist/learn/check.js +57 -2
  38. package/dist/learn/compile.js +1 -1
  39. package/dist/learned-nodes.d.ts +21 -4
  40. package/dist/learned-nodes.js +21 -8
  41. package/dist/learned-workflow.d.ts +3 -3
  42. package/dist/learned-workflow.js +14 -5
  43. package/dist/mcp-oauth.d.ts +15 -1
  44. package/dist/mcp-oauth.js +39 -5
  45. package/dist/mcp-pin-first.d.ts +4 -2
  46. package/dist/mcp-pin-first.js +4 -3
  47. package/dist/mcp-servers-store.d.ts +58 -5
  48. package/dist/mcp-servers-store.js +136 -17
  49. package/dist/mcp.d.ts +2 -2
  50. package/dist/mcp.js +2 -2
  51. package/dist/observation/http.d.ts +4 -1
  52. package/dist/observation/http.js +5 -4
  53. package/dist/openapi.js +46 -12
  54. package/dist/print.d.ts +6 -3
  55. package/dist/print.js +4 -2
  56. package/dist/run-labels.d.ts +23 -0
  57. package/dist/run-labels.js +79 -0
  58. package/dist/run-secrets.js +12 -4
  59. package/dist/runner/adapter-loop.js +91 -10
  60. package/dist/runner/adapter-run-spec.d.ts +4 -0
  61. package/dist/runner/adapter-run-spec.js +38 -31
  62. package/dist/runner/beside.d.ts +6 -3
  63. package/dist/runner/beside.js +9 -7
  64. package/dist/runner/cli-run-spec.js +32 -26
  65. package/dist/runner/conformance/harness.js +69 -14
  66. package/dist/runner/conformance/subject.d.ts +4 -1
  67. package/dist/runner/main.d.ts +1 -1
  68. package/dist/runner/main.js +2 -2
  69. package/dist/runner/mcp-claim.d.ts +3 -0
  70. package/dist/runner/mcp-claim.js +1 -1
  71. package/dist/runner/mcp-run.d.ts +4 -0
  72. package/dist/runner/mcp-run.js +5 -3
  73. package/dist/runner/model-route.d.ts +4 -2
  74. package/dist/runner/model-route.js +8 -8
  75. package/dist/runner/promotion.d.ts +8 -0
  76. package/dist/runner/promotion.js +43 -1
  77. package/dist/runner/workflow-first.d.ts +6 -5
  78. package/dist/runner/workflow-first.js +9 -7
  79. package/dist/runs-over-store.js +5 -2
  80. package/dist/sdk/runs.d.ts +7 -1
  81. package/dist/sdk/runs.js +19 -6
  82. package/dist/secret-cut.js +3 -1
  83. package/dist/secrets.js +3 -1
  84. package/dist/server.d.ts +27 -2
  85. package/dist/server.js +168 -50
  86. package/dist/store/dialect.d.ts +3 -0
  87. package/dist/store/dialect.js +1 -0
  88. package/dist/store/index.d.ts +1 -1
  89. package/dist/store/postgres/dialect.js +1 -0
  90. package/dist/store/postgres/migrations/0015_run_labels.sql +5 -0
  91. package/dist/store/postgres/migrations/0016_minted_tokens.sql +21 -0
  92. package/dist/store/schema.d.ts +9 -0
  93. package/dist/store/schema.js +26 -2
  94. package/dist/store/sqlite/connection.js +11 -3
  95. package/dist/store/sqlite/run-patch.d.ts +2 -1
  96. package/dist/store/sqlite/run-patch.js +3 -2
  97. package/dist/store/sqlite/store.js +64 -10
  98. package/dist/store/store.d.ts +38 -1
  99. package/dist/store-reads/journal.js +2 -1
  100. package/dist/store-reads/learning.js +6 -1
  101. package/dist/store-reads/runs.d.ts +4 -3
  102. package/dist/store-reads/runs.js +3 -2
  103. package/dist/store-view.js +4 -2
  104. package/dist/template-eval.d.ts +4 -0
  105. package/dist/template-eval.js +127 -50
  106. package/dist/templates.d.ts +10 -0
  107. package/dist/templates.js +75 -17
  108. package/dist/timeline/origin.d.ts +1 -1
  109. package/dist/timeline/origin.js +2 -2
  110. package/dist/trigger-adapter.d.ts +9 -4
  111. package/dist/trigger-adapters.js +2 -1
  112. package/dist/trigger-feed.d.ts +12 -0
  113. package/dist/trigger-feed.js +371 -0
  114. package/dist/triggers.d.ts +2 -1
  115. package/dist/triggers.js +23 -5
  116. package/dist/webhooks.js +9 -5
  117. package/dist/workspace/computer-deps.d.ts +5 -1
  118. package/dist/workspace/computer-deps.js +2 -2
  119. package/dist/workspace/index.d.ts +1 -0
  120. package/dist/workspace/index.js +2 -0
  121. package/dist/workspace/resolve-computer.d.ts +32 -3
  122. package/dist/workspace/resolve-computer.js +47 -9
  123. package/launcher/agentrun-serve +6 -1
  124. package/package.json +10 -9
  125. package/templates/README.md +27 -2
  126. package/dist/console/assets/index-Jbxjcmdp.js +0 -705
package/CHANGELOG.md CHANGED
@@ -2,6 +2,83 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## 0.1.0-beta.41 (2026-11-16)
6
+
7
+ - A message sent to a working `claude-agent` run now steers it mid-turn. Before, it waited for the turn's end, and a run whose whole job is one turn read it only after the work was done. The model now reads it at its next step, after the tool calls in flight finish, in the same turn. `POST /v2/runs/{id}/messages` answers mode `steer` for a working claude-agent run (it answered `follow_up`), and `GET /v2/capabilities` lists `claude-agent` with `steer: true`.
8
+ - The Timeline shows the message where the model read it: after the tool call it was sent during, never where it waited in the queue. Its command row is taken in that commit.
9
+ - A message sent as the turn ends starts the next turn, and the run ends only after that turn.
10
+ - A runner lost after it placed the message, before the model took it, neither loses it nor sends it twice. The next runner places nothing again, its resumed turn carries the message if the CLI never had it, and the message is on the Timeline once.
11
+ - A trigger's message that answers nothing (`answers: false`), and the answer to a question the run's last turn ended on, still run as turns of their own, as before.
12
+ - Adapters: `AdapterEvent` gains `message_taken` (`ids`): the submissions the model was given, for a host that keeps the run's record itself. `@parcha/agentrun-harness-claude`'s session implements `steer()`, places nothing again for an id it already holds, and says `message_taken`.
13
+ - Deleting a Composio server in Settings → MCP servers now also removes what its save made in your Composio account, not just the Composio MCP server. That covers the connected account its connect link started (the pending link with it) and the auth config it made.
14
+ - **Kept while shared:** what another saved server still uses stays until the last of them is deleted.
15
+ - **Never deleted:** anything that was there before the save, such as an auth config or account you already had.
16
+ - **The answer:** a Composio server's `DELETE /v2/settings/mcp-servers/{name}` answers `200 {deleted: true, composio: {removed, note}}`. The note says what it removed, what it kept and why, and what is left when Composio refused or didn't answer (`removed: false`). The server is forgotten here either way. Before, a full removal answered `204` with no words.
17
+ - **Older servers:** a server saved before this change has no record of what its save made, so its delete removes only the Composio MCP server, as before.
18
+ - **A failed save:** a save that fails after Composio made something removes what it made (the MCP server, the account its connect link started, the auth config it made), never what it found. When Composio refuses that too, the error says what is left there. A save refused on a field (422) also says it in `details.composio`, and the console shows it under the field's words.
19
+ - **A save over a server:** saving a Composio server again removes the Composio MCP server the earlier save made, once the new one is saved. Saving it as another `user_id`, or with another toolkit, also removes the account or auth config the earlier save made and the server no longer uses, unless another saved server uses it. The save's answer then carries `composio: {removed, note}`, as a delete's does. While Composio triggers use the server, a save as another `user_id` or auth config is refused (`409 composio_in_use`, naming them), as its delete is; a save that keeps what they run as goes through.
20
+ - **Moved off Composio:** an ordinary `PUT /v2/settings/mcp-servers/{name}` that points a Composio server at another address removes what the preset made for it in Composio, as its delete would, and answers `composio: {removed, note}` too. It is refused (`409 composio_in_use`) while Composio triggers use the server.
21
+ - **One at a time:** Composio saves and MCP server deletes now run one after another, so a delete never removes an auth config or account that a save still in progress is reusing. An ordinary save of a Composio server lists its tools at once, and takes its turn only to write the server and clean up. If a Composio save over the server moved it meanwhile, a save that keeps the credential is refused (`412 precondition_failed`) and writes nothing, so it never points the server back at the MCP server that save removed. Other MCP servers' saves don't wait.
22
+ - **The console:** it shows the note, as a success when nothing is left.
23
+ - A self-hosted Daytona target with an Archil egress relay takes Archil mounts again; Daytona's hosted cloud still refuses them. `DAYTONA_ARCHIL_EGRESS` is a Daytona key again (optional), filling `DaytonaProvider`'s `archilEgress` option, `<IPv4 gateway>:<mount lane>:<data lane>`, checked at construction as the shared adapter checks it. A provider made with it declares `capabilities().mount` `["archil"]`, `check()` and `create()` take an Archil mount, and the helper's mount and revoke go through the relay. A provider made without it is unchanged: `check()` and `create()` refuse an Archil mount up front, before any request, in the descriptor's `unmounted.archil` words, now "Archil mounts don't work on Daytona's hosted cloud, where Archil's client hangs on its sandboxes; a self-hosted Daytona target takes one once its operator sets DAYTONA_ARCHIL_EGRESS". Set the key only for a self-hosted target: on the hosted cloud the mount waits out its bound. A Daytona GPU computer still takes no mount.
24
+ A descriptor may declare `mountsWith: { <kind>: "<KEY>" }`, a mount kind its computers take only where the operator sets that optional key (the kind is in `unmounted` too), and `mountsOf(descriptor, set)` gives the mounts for the keys set; `defineProvider` refuses a `mountsWith` that names no optional key or a kind `unmounted` lacks. The conformance module reads `COMPUTER_DAYTONA_ARCHIL_EGRESS`, and its `mountFor("archil")` makes a run folder only with it set.
25
+ In serve, a Mode 2 Daytona sandbox is ready, at its save and its run's start, where `DAYTONA_ARCHIL_EGRESS` is saved or set and `AGENTRUN_DAYTONA_SNAPSHOT` names a snapshot of `box/Dockerfile`. With the relay but no snapshot named, it is refused, saying to name one there; without the relay, it is refused as before. Settings → Computers now refuses a key saved as whitespace alone (422, `wrong_type`), as the Archil routes already do and as the environment reads one as unset: such a relay would have shown a Daytona sandbox ready that its run's start refused.
26
+ - The console makes and edits a feed trigger. Triggers has New feed trigger (`#/triggers/new-feed`), and a first trigger card for it when there is no trigger yet.
27
+ - The form takes 1 to 20 URLs, one a line, and says each one that is not http or https, holds a user or password, or is there twice, under its place in the list sent (`source.urls[i]`, as the server names it). It reads them every 15 minutes unless told, and not under the server's floor (capabilities' `min_every_s`). A JSON list's `items` and `id` pointers sit behind a "JSON list" disclosure, and "Only when" conditions on the item become its filter (`accept: [{event: "item", where}]`).
28
+ - There is no Test button. PLAN-feed's "What a person sees" had one that read the feeds before saving; serve has no such route. Instead, the create lands on the trigger's page, which says its first check (the create waits for it) and the note of what it starts from ("Watching 2 feeds from now: the 130 items already there won't start runs.").
29
+ - A feed trigger's page shows its feeds, how often they are read, its pointers, its filter, and its last check: ok or failed, its words, and when. A trigger turned off because every feed stopped says to edit its feeds. The list says each trigger's last check under its last firing.
30
+ - Edit feed sends the URLs, the interval, the pointers and the filter as a PATCH of the source alone, and nothing when nothing changed. A line under the URLs says that a feed added starts from now: what is in it already won't start runs.
31
+ - A feed trigger: `{kind: "feed", urls, every_s?: 900, items?, id?, accept?}` starts a run for each new or updated item in 1 to 20 feeds, RSS, Atom, JSON Feed or a JSON list such as GitHub's pulls API (read at its `items` and `id` pointers). It polls, so nothing outside has to reach the server.
32
+ - It starts watching at its first poll, which a create or a turn-on runs at once and waits on (10 seconds at most); the items already there start no run, and the check says how many. Turning it on again forgets what it read.
33
+ - An item fires once, and again with `update: true` when its `updated` time moves on. Each URL keeps the keys it has seen (the larger of 1,000 and twice the feed's length) in the trigger's settings, with no store change. One poll starts 20 runs at most across all its URLs, oldest first, and the check says how many wait for the next. Reads are conditional on ETag and Last-Modified.
34
+ - A `410`, or a `404` three checks running, stops that URL and the check names it; the trigger turns itself off (`source_unreadable`) only when every URL has stopped.
35
+ - Reads are held to the MCP servers' address check (no private, link-local or own address; each of at most 5 redirects checked again), plain `http` on a public address only, 20 s and 5 MB at most, and no entity declared in a DTD (such a feed is refused in words; the trigger stays on). Only XML's five named references and numeric character references decode. An Atom title, summary or content written as XHTML reads as its text, in the order it is written.
36
+ - The payload: `{id, link, title, published, updated, author, summary, categories, feed: {title, url}, update}` for a feed, `{id, link, title, item, update}` for a JSON list.
37
+ - Template packages may use feed triggers: `urls` takes parameters inside a URL, or one whole array parameter (required or with a default; given empty, apply skips the trigger with a `triggers.<i>` warning and the agent stands); `every_s`, `items` and `id` take none; `where` in values are filtered as the other kinds' are. A template eval case's `feed:` fixture serves fake feeds to the case's run and fires on its new or updated item. A triggered case, an email one included, now puts its mail or item in only once the trigger's first poll has read, so a slow first poll no longer takes it as part of the start.
38
+ - The generated clients and the console's types know the kind; the console lists a feed trigger with its words.
39
+ - The parser is fast-xml-parser 4.5.7, pinned exact (198 kB unpacked, with strnum 1.1.2 at 19 kB).
40
+ - A template eval's trigger clock fires a timer it moves past at once, and one the engine armed a millisecond past the time it moves to a moment later, never after the real wait it was armed with.
41
+ - Settings → MCP servers: the add form offers five URL presets above "Or any MCP URL", the servers the free templates use. Each one fills the name (the first free one), address, credential and toolkit, and shows a one-line note:
42
+ - Parallel Search (`https://mcp.parallel.ai/mcp`, no credential).
43
+ - Firecrawl (`https://mcp.firecrawl.dev/v2/mcp`, no credential): free without a key and rate limited. A Firecrawl key added later as a bearer token gives more.
44
+ - GitHub (token) (`https://api.githubcopilot.com/mcp/`, a fine-grained token as a bearer token). It has a Read-only switch for `https://api.githubcopilot.com/mcp/readonly`. It sits beside the GitHub App credential, which is unchanged.
45
+ - Linear (`https://mcp.linear.app/mcp`) and Notion (`https://mcp.notion.com/mcp`), with Sign in.
46
+
47
+ Preview and Save are the same as for any address. `#/settings/mcp?add=<name>&preset=<id>` (`parallel`, `firecrawl`, `github-token`, `linear` or `notion`) opens the form with that preset filled. A preset id that is none of these opens the plain form.
48
+
49
+ Choosing a preset clears a token, header rows, scopes or client typed for another server, so none of them goes to the preset's address. The presets wait until the saved servers have been read. A new server whose name is already saved can't be saved or signed in, because saving it would replace that server.
50
+ - A hosted machine of a dial provider can dial this server. The server mints each machine a token at its create (`art_` and 64 hex, kept as its SHA-256 until the machine's backstop or its delete), and the attach socket (`GET /v2/computers/attach`) takes it as it takes a paired computer's: the socket stands for that machine, and a hello of another kind, os or arch than the machine was made as is closed with 4400. The machine fetches this server's own computerd build with the same token from the new `GET /v2/computers/daemon?arch=amd64|arm64` (ten fetches a minute per machine, then 429). An unknown, revoked or expired token is 401 on both, and the token is in no log line. An API-only server (`AGENTRUN_API_ONLY=1`) serves both to a run's machines, and takes a paired computer's token there as unknown. The runner beside the server builds every remote provider with the server's dial: the address its machines dial (`AGENTRUN_PUBLIC_URL`; without one, a dial provider's create refuses), the tokens and the hub. A runner in its own process has none.
51
+ - A learned workflow whose answer quotes the pages it fetched re-picks once on a quote miss before it hands back. The learning checks refuse a draft whose step writing the answer hands back on its first miss: that step must be the body of a `loop` with `maxIters` 2 whose `until` is `not` of the answer's `quote_missing` check (the same `path`, `field` and `pages`), followed by the `quote_missing` escalate. The check is a step of the top-level chain after the loop, never inside it: a draft with a `quote_missing` escalate in the loop's body is refused, since that escalate would hand back on the first miss. The step in the loop has no `state` map, so it reads the whole run state; a `state` map passes only the keys it names, so its second pass would never see the failed draft, and a draft with one there is refused. A first miss writes the answer once more with the failed draft in its state; a second miss hands back. A loop's `until` is one predicate, so the answer's quotes must have one check: a draft whose quotes need two different `quote_missing` checks (`quotes: string | [{quote}]`, or quotes in two places) is refused, the detail asking for one place one check reads. The compile prompt asks for the same loop and the same single place. On the H5d test, re-picking kept 26 of 31 misses at about half the cost of handing every miss to the agent.
52
+ - A run's metrics carry `loops`: one row per loop exit of its learned workflows, `{node, iterations, met, workflow}`, so a re-pick (`iterations` 2) and whether its quotes were found (`met`) can be counted. Its model request is booked as any node's.
53
+ - Upgrading: a learned workflow already merged keeps serving as it is; its next compiled revision must carry the re-pick loop to pass the checks.
54
+ - A run takes `labels` at its start (`POST /agents/{agent_id}/runs` and `POST /runs`): a map of the caller's own strings, at most 16 keys of 1 to 63 letters, digits, `.`, `_`, `-` or `/`, each value 1 to 256 characters with no control character and no lone UTF-16 surrogate. The run keeps them as given and serves them as `labels` on every read (`{}` when none), and `GET /runs` and `GET /agents/{agent_id}/runs` take `label=<key>:<value>`, once per request, to list only the runs holding that label. Labels out of bounds are `422` under `labels` or `labels.<key>`; a filter that does not read is `400`. The server reads nothing else from them, so they are no place for a secret.
55
+ - On Postgres the store applies migration `0015_run_labels` (a nullable `runs.labels` column) at the server's start.
56
+ - On SQLite the store keeps its schema version: the server adds the nullable `runs.labels` column at its open to a data directory an earlier release set up, and every run started before reads as given none. Start the upgraded server before its runners: a runner of this release opening a data directory its server has not opened yet is refused with "Start the AgentRun server to add each run's labels before opening a runner", and nothing in the directory changes.
57
+ - The server takes a list of API tokens, each with an id, so a token rotates with no caller refused: add the new token, move every caller to it, then remove the old one. `AGENTRUN_TOKENS` holds the list as `id:secret` entries separated by commas or whitespace; `AGENTRUN_TOKEN` (or `DIR/.token`) keeps working as the one entry `default`, so a server with a single token needs no change. Any listed token opens every route the token opens (`/v2`, `/mcp`, `/api/v2/control`, the setup code's field); every presented token is compared against every entry in constant time, with no early return. Each request log line names the id of the token used (`token=<id>`), never the secret, and the banner lists the ids when there is more than one. An entry that is not `id:secret`, a secret under 32 characters or with whitespace or a comma, or an id or secret given twice stops the start. Set alone, `AGENTRUN_TOKENS` takes `DIR/.token`'s place (the file is neither read nor made). The list is a secret on the launcher's list, and never reaches a run's process or a runner's loops. An SDK run's credential (`ar_sdk_…`) is now signed with a secret derived from the seal key instead of the token, so no change to the list strands a live run; one signed by an earlier server keeps working while its token is listed. `deploy/README.md` gives the three steps.
58
+ - A template whose feed trigger takes `urls` from an array parameter with `default: []` now passes validation and reads. Apply already skipped such a trigger with a `triggers.<i>` warning; validate-template and readPackage refused it with "urls is a list of 1 to 20 feed URLs", and now agree with apply.
59
+ - The launcher (`agentrun-serve`) now takes `ARCHIL_API_KEY`, `E2B_API_KEY`, `ORGO_API_KEY`, `PHONE_HARNESS_API_KEY`, `AGENT37_API_KEY` and `AGENT37_SSH_KEY` out of the server's environment and hands them over its pipe, as it already did for Daytona's and Modal's keys. Before, each one set where the server started stayed in the server's own environment (`/proc/<pid>/environ`), where any process of the same user could read it and any child the server spawned with `process.env` inherited it.
60
+ - Archil's settings, the server's view of a run's files and Settings → Computers now read a key set where the server starts from the secrets the server holds, not from `process.env`. Before, they read `process.env`, so Settings → Computers showed Daytona's, Modal's, Browserbase's and Kernel's keys, set where the server started, as not set by the environment, and its test used only a saved key.
61
+ - No run is handed one of these keys. The runner's claim still reads them, and the Archil claim mints each run's own mount credential from the account key.
62
+ - `AGENT37_SSH_KEY` is a private key. An RSA key can take the secrets past the 4,096 bytes the launcher's pipe holds, and then the launcher refuses to start. Save that key in Settings → Computers instead, or use an Ed25519 key.
63
+ - A run's `learned_workflow` tool runs only what serves: a learned workflow's champion (the revision promoted last), never a revision that is replaying, queued, held or not yet decided. Before, a run its workflow did not serve first (the revision replaying with nothing promoted yet, the champion held, or the champion not taking the run's input) handed the agent the folder's newest revision to call, so an unpromoted draft could answer the run. A workflow with nothing promoted is left out of the tool; one no promotion record names (no run's input fit it yet) is offered as before.
64
+ - A run's learning that settles while it is read (GET /runs/{id}/learning, GET /sdk-runs/{id}) no longer reads merged or dropped with the proposal's time as its `at` once, then the learning run's end time on every read after. The learning run's row was read before its journal, so its last save could land between the two; the row is now read again when the journal holds an end the row had not seen.
65
+ - Signing in to a Google-backed MCP server asks for offline access, so it gets a refresh token and stays signed in. A sign-in whose authorization endpoint is on `accounts.google.com` adds `access_type=offline` and `prompt=consent`; every other authorization server's sign-in is unchanged.
66
+ - When the keyless web search is rate-limited, its words now name the free option too: add the free Parallel Search server in Settings → MCP servers and grant the agent its web_search. The paid Parallel key on Tool keys is still named. The Parallel Search preset's address is `https://mcp.parallel.ai/mcp`, the one Parallel's docs give; `search.parallel.ai/mcp` is its legacy address.
67
+ - The runner beside a local install now holds its loopback requests to the rule the server's settings routes use: never at the server's own ports (where it listens, and its public address when that is on loopback). The server tells that runner its addresses as it starts (`Serve.own`, `runnerBeside`'s `mcpOwn`). An MCP server's call, an authorization server's refresh or a pin's listing at one of those ports is refused unsent, in the server's words.
68
+ - Applying a template: a url MCP need whose toolkit is one of the URL presets (parallel, firecrawl, github, linear, notion) now links to Settings → MCP servers with that preset filled (`&preset=<id>`, github's is `github-token`), not an empty add form under the toolkit's name.
69
+ - A run whose revision has skills, whose folder is on Archil and whose computer mounts that folder no longer fails at its claim with `mkdir ".agents/skills": … 409 OperationAborted … another client holds a write delegation`. The claim now lays the revision's skills, and a learning run's seed, in the run's folder before it starts the computer. Before, it laid them after the computer's mount had taken Archil's write delegation for the folder. The disk then refused each write over its file API, and the run failed once the Workspace's retry window ran out.
70
+ - Both the pi spec and the CLI harnesses' spec lay in this order.
71
+ - A later claim of the same run lays only the skill folders that are missing. The folders an earlier claim laid, and the run's edits to them, stay as they are.
72
+ - Before, a learning run's seed failed silently under such a mount: the run started with no learned notes or skills laid.
73
+ - On SQLite, a begin, write or statement whose wait for the write lock ran out while the process was held up, on a transaction of the same process, no longer fails StoreBusy when that transaction's commit is read before the wait's busy answer: it waits on and lands. Two connections' answers come back in no set order, so the holder was looked for after it had let go.
74
+ - A webhook delivery whose receiver's name lookup was still out when the server stopped no longer leaves that lookup's failure (a name that answers NXDOMAIN) as an unhandled rejection, which could end the process as it stopped. The try gives up in words ("not reached: the server is stopping"). `ServeOptions.webhookLookup` is a test's seam for the receiver's name lookup, so the tests' servers answer their example webhook hosts without the system resolver.
75
+ - Model requests AgentRun sends to OpenRouter carry OpenRouter's app attribution headers: `HTTP-Referer: https://github.com/Parcha-ai/agentrun`, `X-OpenRouter-Title: AgentRun` and `X-OpenRouter-Categories: cloud-agent,personal-agent`. Usage then counts toward AgentRun's page on OpenRouter (openrouter.ai/apps?url=https://github.com/Parcha-ai/agentrun), including a self-hosted server's usage on its owner's own key. Set `AGENTRUN_OPENROUTER_ATTRIBUTION=off` where AgentRun starts to send none.
76
+ - The headers go only where a request goes to openrouter.ai itself, which covers every harness: the model proxy (claude-agent, codex, opencode, and pi on OpenRouter's Anthropic and OpenAI models), pi's translation route (every other OpenRouter model, the free ones included), and the server's Decisions providers on OpenRouter (OpenRouter's models, and Parallel's through OpenRouter). Anthropic, OpenAI, a ChatGPT plan and a gateway at another URL never get them.
77
+ - The kernel's host entry (`OPENROUTER_APP`, `openRouterApp`, `openRouterAttribution`) is the one place that names the app; the server hands it to the Decisions provider.
78
+ - The Decisions provider's `app` option takes `categories` and sends `title` as `X-OpenRouter-Title` (OpenRouter's current name for `X-Title`).
79
+ - `GET /v2/computers` never lists a paired computer as online with `seen_at: null`. The attach hub has a socket live before the store keeps its hello, and a list between the two read online and never seen. `seen_at` is now the live socket's hello time while the computer is attached (`AttachHub.since(id)`), else the last one kept.
80
+ - The probe's diagnose test holds its closed UDP port for the whole test (a socket connected elsewhere, so the kernel refuses the probe's datagram) instead of binding and freeing one, which another process on a CI runner bound and answered from.
81
+
5
82
  ## 0.1.0-beta.40 (2026-11-16)
6
83
 
7
84
  - Learning: a running replay finishes. A learned workflow's revision that arrives while another revision replays no longer cancels that replay: it is queued (promotion record `decided: "queued"`), and replays at the first run's claim once the running replay is decided, whose verdict (promote or hold) stands. Only the newest queued revision replays next: one queued before it is `decided: "skipped"`, with `skipped_by` naming the newer revision and a reason that says so. The queue is the promotion records in the store, so a restart keeps it. Upgrading: `decided: "superseded"` and `superseded_by` are gone from the promotion records, and from a replay read's `decided`; read `queued`, `skipped` and `skipped_by` instead.
package/README.md CHANGED
@@ -91,6 +91,16 @@ address people open (a container's published port, or a proxy's URL): the printe
91
91
  use it. `AGENTRUN_FREE_MODEL_REQUESTS` (default 60) is the most requests on free models a run makes
92
92
  ([a limit on free requests](#a-limit-on-free-requests)).
93
93
 
94
+ `AGENTRUN_TOKENS`, when set, is a list of more tokens, each with an id: `id:secret` entries separated by commas or
95
+ whitespace (each secret follows the token's rules, and holds no comma). `AGENTRUN_TOKEN`'s token is the entry `default`;
96
+ set alone, the list takes `DIR/.token`'s place, and its first entry is the server's token. Any token on the list opens
97
+ every route the token opens (`/v2`, `/mcp`, the setup code's field), and each presented token is compared against every
98
+ entry in constant time. Each request line names the id of the token used (`token=<id>`), or `session=owner` or
99
+ `session=console` for the console's own requests, never a secret. The banner lists the ids when there is more than one.
100
+ An id or a secret given twice, or an entry that is not `id:secret`, stops the start. The list is a secret like the token:
101
+ the launcher hands it over its pipe, and no run's process or runner loop gets it. A rotation adds the new token, moves
102
+ callers, then removes the old one ([deploy/README.md](../../deploy/README.md#rotating-the-api-token)).
103
+
94
104
  ## Sandbox in 60 seconds
95
105
 
96
106
  An agent with a shell, in a Docker container of its own: on a machine with Docker, in a checkout built as above, with
@@ -701,9 +711,9 @@ computer is made with the GPUs asked.
701
711
  `types: ["H100"]`, `max: 1`); another type or count needs a snapshot of its own, so it is refused. A GPU sandbox is
702
712
  made from that snapshot, with its 16 vCPUs, 100 GiB of memory and 400 GiB of disk, in region `earth`. Stopping it
703
713
  deletes it: it has no pause and no snapshot, so nothing on it outlives the run. A Daytona GPU may be preempted, so a
704
- run on one can be cut short. The Daytona org needs GPU credits. No Daytona sandbox takes an Archil mount, with a GPU
705
- or without (Archil's client hangs on its sandboxes), so it can't hold the run's folder: Mode 2 refuses it, and in
706
- Mode 1 a sandbox runs on Docker only, so a Daytona sandbox runs on neither mode's server today.
714
+ run on one can be cut short. The Daytona org needs GPU credits. A Daytona GPU sandbox takes no Archil mount (its
715
+ GPU host gives no `/dev/fuse`), so it can't hold the run's folder: Mode 2 refuses it, and in Mode 1 a sandbox runs
716
+ on Docker only, so a Daytona GPU sandbox runs on neither mode's server today.
707
717
  - **Modal** declares its GPUs, but a Modal GPU sandbox runs on gVisor, and the Archil mount the run's folder needs is not
708
718
  proven there. So this server refuses a Modal sandbox with a `gpu` for now. A Modal GPU is also preemptible.
709
719
 
@@ -776,7 +786,11 @@ passes the binding's conformance cases (below) needs no change here.
776
786
  work. E2B's says `prepareImage` as well, and it answers our public box template by name
777
787
  (`<publisher>/agentrun-archil-<recipe hash>`, which the release builds and makes public), with no call, so an E2B
778
788
  sandbox and desktop are ready once the key works; the desktop mounts the folder too (it has files and exec). Docker's
779
- sandbox is refused, since it cannot mount the disk, and so is Daytona's, since Archil's client hangs on its sandboxes.
789
+ sandbox is refused, since it cannot mount the disk. Daytona's is refused on Daytona's hosted cloud, where Archil's
790
+ client hangs on its sandboxes. On a self-hosted Daytona target whose sandboxes reach Archil through an Archil egress
791
+ relay, save the relay's address as `DAYTONA_ARCHIL_EGRESS` (Settings → Computers, beside `DAYTONA_API_KEY`) and name
792
+ a snapshot of `box/Dockerfile` in `AGENTRUN_DAYTONA_SNAPSHOT` (below): the Daytona sandbox then mounts the run's
793
+ folder and is ready. With the relay but no snapshot named, it is refused, saying to name one.
780
794
 
781
795
  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
782
796
  `AGENTRUN_ACCOUNTS=0` reached beyond loopback) is set where it is started instead: `AGENTRUN_ARCHIL_REGION` and
@@ -841,8 +855,9 @@ the computer package's `box/Dockerfile` is built in the organization of `DAYTONA
841
855
  DAYTONA_API_KEY=... python3 packages/computer/box/build-daytona.py # prints snapshot=agentrun-archil-<12 hex>
842
856
  ```
843
857
 
844
- A Daytona computer takes no Archil mount, so this server never holds a run's folder on one (see Mode 2 above). A
845
- Daytona [box](#sandbox) never reads it.
858
+ A Daytona computer mounts the run's folder only where `DAYTONA_ARCHIL_EGRESS` names a self-hosted target's Archil
859
+ egress relay (see Mode 2 above), and then it needs this snapshot. A changed recipe is a new name, so build again after
860
+ an upgrade that changes `box/`. A Daytona [box](#sandbox) never reads it.
846
861
 
847
862
  A desktop, a phone and a browser run in either mode. The run's folder is at
848
863
  `/workspace` in every computer that mounts it: a sandbox always, and a desktop whose provider mounts the mode's folder
@@ -1272,7 +1287,8 @@ Exa takes keyless use only over IPv4, straight to its endpoint (through a proxy
1272
1287
  free limit Exa answers a `429` with a Retry-After, or a tool result it marks rate-limited (`ai.exa/rateLimited`); the
1273
1288
  search is tried once more after a jittered 1 to 3 s, or the Retry-After Exa names when it is 5 s or less (a longer one, as
1274
1289
  for its daily limit, is not waited out). Still limited, the tool answers `{error}` in our words: `Free web search is
1275
- rate-limited right now. Try again in a minute, or add a Parallel key in Settings → Tool keys to search with a key.` Any
1290
+ rate-limited right now. Try again in a minute; add the free Parallel Search server in Settings → MCP servers and grant
1291
+ the agent its web_search; or add a Parallel key in Settings → Tool keys to search with a key.` Any
1276
1292
  other failure Exa answers reads `Free web search failed. Exa said: "<the first sentence of its text>"`, cut at 120
1277
1293
  characters; Exa's own instructions (a key for its MCP URL) are never passed on.
1278
1294
 
@@ -1668,7 +1684,7 @@ out an action it was allowed (it did for `HACKERNEWS_GET_FRONTPAGE`), so the ans
1668
1684
  action the saved server doesn't list. Both routes are the owner's
1669
1685
  session alone, and a saved Composio server is gated, approved and shown on the Timeline as any MCP server's tools are,
1670
1686
  "not metered" until you price them. Composio's own meta tools stay refused, and the helper actions that connect an
1671
- account are left off the server's address. Deleting the server in Settings deletes the Composio MCP server it made too, with the saved key (Composio's "already gone" is fine); if Composio refuses or does not answer, the server is still forgotten here, and the `DELETE` answers `200 {deleted: true, composio: {removed: false, note}}` saying what to remove in Composio yourself, which the console shows.
1687
+ account are left off the server's address. Deleting the server in Settings deletes what its save made in Composio too, with the saved key: the Composio MCP server, the connected account its connect link started (the link with it) and the auth config it made (Composio's "already gone" is fine). What another saved server uses is kept until the last of them goes, and what was there before the save (an auth config or account you had) is never deleted. The `DELETE` answers `200 {deleted: true, composio: {removed, note}}`: the note says what it removed, what it kept and why, and, when Composio refuses or does not answer, what is left to remove in Composio yourself (`removed: false`; the server is still forgotten here). The console shows it. A save that fails removes in Composio what it made there and never what it found, and its error names what is left when Composio refuses that too (a 422 on a field says it in `details.composio` as well). A save over a preset server removes, once it is saved, the Composio MCP server its earlier save made, and what that save made and the new one no longer stands on (the account of another `user_id`, the auth config of another toolkit), with the key it was made with, unless another saved server uses it, and answers `composio: {removed, note}` saying so. An ordinary `PUT` that moves a preset server to another address makes it another service's server: it removes what the preset made for it in Composio as its delete would, and answers `composio` too. While Composio triggers use the server, that move, and a preset save over it as another `user_id` or auth config, are refused as its delete is (`409 composio_in_use`, naming them). Preset saves and MCP server deletes run one at a time, so a delete never removes what a save in progress reuses; an ordinary save of a preset server lists its tools at once and takes its turn only to write the server and clean up.
1672
1688
  [Connect Composio tools and triggers](../../docs/tutorials/composio.md) walks through the preset and a Composio
1673
1689
  trigger in the console, with each step's API call.
1674
1690
 
@@ -1767,7 +1783,9 @@ every request to one) must be `https` and resolve to no private, loopback or lin
1767
1783
  refresh is refused with words and nothing is sent. A loopback MCP server (a `127.0.0.1` or `localhost` URL) is taken only
1768
1784
  by a server started with `AGENTRUN_MCP_ALLOW_LOOPBACK=1`, which says this is a local install: set it only on a machine you
1769
1785
  alone use, since loopback is this machine's other services too. Without it such a URL is refused at the save, the preview
1770
- and the sign-in, in words naming the variable, and a runner never reaches one; only the runner beside such a server does.
1786
+ and the sign-in, in words naming the variable, and a runner never reaches one; only the runner beside such a server does,
1787
+ and never at that server's own ports (where it listens, and its public address when that is on loopback), which the server
1788
+ tells it as it starts: an MCP server or a refresh's endpoint there is refused unsent, as at a save.
1771
1789
  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
1772
1790
  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
1773
1791
  authorization server may name endpoints on the MCP server's own loopback host, exactly as its URL writes it (never
@@ -1775,7 +1793,9 @@ another loopback address, the IPv6 loopback, or a name for this machine in its p
1775
1793
  loopback endpoint is refused the same way. The host is pinned, not the port, as a local authorization server listens on
1776
1794
  its own port. What that leaves: such an authorization server can still have this server send its sign-in and refresh
1777
1795
  requests to other ports on that same loopback host (a port Docker publishes there, say), blind, learning only the
1778
- endpoint and its status, never a body. That is why the allowance is for development only. The callback exchanges the code, seals the token set (access and refresh tokens, expiry,
1796
+ endpoint and its status, never a body. That is why the allowance is for development only. A sign-in at Google's authorization endpoint
1797
+ (`accounts.google.com`) asks for offline access (`access_type=offline` and `prompt=consent`), the one way Google gives a
1798
+ refresh token; any other authorization server's page is opened as it was. The callback exchanges the code, seals the token set (access and refresh tokens, expiry,
1779
1799
  scopes, the client and its secret) under `AGENTRUN_SEAL_KEY`, bound to the server's name, lists the tools as a `PUT`
1780
1800
  does, and redirects to the console's MCP servers page, `/#/settings/mcp?server=<name>&sign_in=ok` (or
1781
1801
  `sign_in=failed&error=<code>`). The redirect URI is this server's own callback under its address: on loopback, the
@@ -2367,8 +2387,8 @@ failed, 2 when nothing ran. The runner, the graders and the report are in
2367
2387
  | `POST /agents/{id}/current` | `{revision}`: one of the agent's revisions becomes current again. |
2368
2388
  | `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`. |
2369
2389
  | `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. |
2370
- | `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. The agent's runs, newest first. |
2371
- | `GET /runs` | Every agent's runs, newest first, a page of at most 100; `agent`, `revision` and `status` narrow it, and `archived=true` lists only archived ones. A failed run's summary carries its `error`, and a waiting run's its `pending`. |
2390
+ | `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. |
2391
+ | `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`. |
2372
2392
  | `GET /runs/{id}` | The run: its revision, kind, status, state, result, error, `pending` (this server's own, `pending/1`: what a waiting run waits on, by `kind`: `{kind: "question", question, asked_at}` for a question it asked a person; `approval` for a tool call held for a person's approval, with the tool, its arguments and its price; `budget` for a run paused at its cap ([a run paused at its cap](#a-run-paused-at-its-cap)); `{kind: "browser", instruction, completion_condition, asked_at, expires_at}` for its agent's ask for the owner in its browser; or `{kind: "computer", computer: "desktop" | "phone", instruction, completion_condition, asked_at, expires_at}` for its agent's ask for the owner on its desktop or phone; else null, a stopped turn's included) and cost (`basis: estimate`; $0 before its first model request, a cancelled run's included). |
2373
2393
  | `GET /runs/{id}/timeline` | JSON pages with the change-number cursor (`after`, `next_after`, `reset`, `drop`, `has_more`, `final`, `wait_ms` long poll, and this server's own `limit`, 1 to 500 rows a page, default 500), or server-sent events with `Accept: text/event-stream` (`id` is the cursor, `Last-Event-ID` resumes). Rows sort by `seq`; the usage row (`Cost so far`), the run's running total, is always the last row, and moves to the end when a row comes after it. |
2374
2394
  | `POST /runs/{id}/messages` | To an agentic run: `steer` while the agent works, `answer` when it asked the person, `follow_up` after a stop or after it completed: a completed run opens again, the same run on its own session and store, takes a place under `--max-runs` (it waits for one when none is free), and completes again. A failed or cancelled run, an archived run and a run of an archived agent are `409 not_continuable`; a workflow run takes none (`501`). |
@@ -2398,6 +2418,46 @@ Quotes answer `501 unsupported_here` naming the feature. Home export and import
2398
2418
  `info.x-agentrun-serve.not_served` lists them). Capabilities declare each of the four false. No run waits out `input_wait_s` here (`null`). `limits.max_cost_usd` is the highest cap a run may name: `null` here, as any cap
2399
2419
  above $0 is taken; it does not mean caps are unsupported ([spend cap](#spend-cap)).
2400
2420
 
2421
+ ### Feed triggers
2422
+
2423
+ A feed trigger starts a run for each new or updated item in one or more feeds: RSS (2.0 and 1.0), Atom, JSON Feed, or a
2424
+ plain JSON list such as GitHub's pulls API. It polls, as the email trigger does, so nothing outside has to reach the
2425
+ server.
2426
+
2427
+ **The source.** `{kind: "feed", urls, every_s?: 900, items?, id?, accept?}`. `urls` is 1 to 20 `http` or `https` URLs,
2428
+ no two alike, each read every `every_s` seconds (the schedules' bounds). `items` and `id` are JSON Pointers for a JSON
2429
+ list: where its array is (`""`, the whole answer, by default) and where each item's id is (`/id` by default). A rule's
2430
+ `accept` takes the event `item`; its `where` reads the payload.
2431
+
2432
+ **From the first poll.** A feed trigger starts watching at its first poll: making it, or turning it on again, polls at
2433
+ once and answers when that poll has (10 s at most). The items already in its feeds start no run, and the check says so
2434
+ (`Watching <feed> from now: the 25 items already there won't start runs.`). Turning it on again forgets what it read, so it
2435
+ starts again from that poll; editing it keeps what it read. A URL added by an edit starts the same way at its own first
2436
+ read.
2437
+
2438
+ **What fires.** Each item fires once, and again when its `updated` time moves past the one it fired on (an
2439
+ incident that is updated); items with no id are told apart by link, then by title and date. Each URL keeps the keys of
2440
+ the items it has seen, the larger of 1,000 and twice the feed's length, so an item that drops off and comes back stays seen.
2441
+ One poll starts 20 runs at most across all its URLs, oldest first; the rest wait for the next poll, which the check says
2442
+ (`Read <feed>: 26 new, 6 more at the next check.`). Each read is conditional on the last ETag and Last-Modified, and a
2443
+ `304` reads nothing.
2444
+
2445
+ **When a feed fails.** A read that fails (no answer, an HTTP error, a body that isn't a feed) is said in the trigger's last
2446
+ check and read again at the next poll; nothing it saw is lost. A `410`, or a `404` three checks running, stops that URL:
2447
+ it is no longer read and the check names it. The trigger turns itself off (`source_unreadable`) only when every URL it
2448
+ reads has stopped; edit its `urls`, then turn it on again.
2449
+
2450
+ **Where it may read.** The same address check as an [MCP server](#mcp-servers)'s requests: no private, link-local or
2451
+ loopback address and no address of this machine, every address a name resolves to checked and the one dialled checked
2452
+ again, each redirect (5 at most) checked as the first URL is. Plain `http` is read on a public address only; a private host
2453
+ the owner allows for MCP sign-in is read over `https` only. A read takes 20 s at most and a body over 5 MB is refused.
2454
+ A feed that declares an entity in a DTD is refused.
2455
+
2456
+ **The payload.** An RSS, Atom or JSON Feed item: `{id, link, title, published, updated, author, summary, categories,
2457
+ feed: {title, url}, update}`, with `summary` as plain text of 4,000 characters at most and `update` true when the item
2458
+ was seen before and has been updated since. A JSON list item: `{id, link, title, item, update}`, `item` the raw object (cut down,
2459
+ with `item_truncated`, when it would pass 16 KB). A run it starts is titled `Feed <trigger name>: <item title>`, and its payload is marked untrusted.
2460
+
2401
2461
  ### API only
2402
2462
 
2403
2463
  `AGENTRUN_API_ONLY=1` is for a server that runs behind its caller's backend and is never opened in a browser. It
@@ -2588,6 +2648,7 @@ than one segment after its provider (`anthropic/anthropic/claude-sonnet-5.5`) is
2588
2648
  that refuses the run's key (401) fails the run naming the key and where to set it ("OpenRouter refused
2589
2649
  OPENROUTER_API_KEY (401: User not found): set it where AgentRun starts, or save it in Settings → Model keys."), on every
2590
2650
  harness, with the provider's first sentence only.
2651
+ Every request to OpenRouter carries AgentRun's app attribution (`HTTP-Referer: https://github.com/Parcha-ai/agentrun`, `X-OpenRouter-Title: AgentRun`), so a self-hosted server's usage on its own key counts toward AgentRun's listing on OpenRouter; `AGENTRUN_OPENROUTER_ATTRIBUTION=off` where AgentRun starts sends none.
2591
2652
 
2592
2653
  `claude-agent` loads the revision's skills itself: the model is shown each as `agentrun:<name>`, loads one with the Skill
2593
2654
  tool and reads its other files with `read_skill_file`, and the system prompt holds the instructions alone. A skill the
@@ -3597,13 +3658,14 @@ carries no cost at all, as from a provider that does not price the model. The te
3597
3658
  - A run has no door of its own. The server and a run's runner meet in the store: a message, stop or approval is a
3598
3659
  command row the runner reads, so no port a run listens on takes a token.
3599
3660
  - A run's tools run under the runner's environment (the `AGENT_MODEL` variables among it) without the server's token or
3600
- any key: no `AGENTRUN_TOKEN`, no `AGENTRUN_API_KEY`, no variable whose value is the token, and no variable named like a key
3661
+ any key: no `AGENTRUN_TOKEN`, no `AGENTRUN_TOKENS`, no `AGENTRUN_API_KEY`, no variable whose value is a token, and no variable named like a key
3601
3662
  (one of its `_`-separated segments, in any case, is `KEY`, `TOKEN`, `SECRET`, `PASSWORD`, `PASSWD`, `PASS`, `PAT`,
3602
3663
  `CREDENTIAL`, `CREDENTIALS` or `DSN`, or its last is `PWD` after another: `SERVICE_KEY`, `GITHUB_TOKEN_RO`, `DB_PASS`,
3603
3664
  `SENTRY_DSN`, `DB_PWD`; never `PWD` or `OLDPWD`), whether the launcher's list names it or not. The rule is
3604
3665
  `keyShaped` (`src/secret-cut.ts`), which an import's cut and a harness's log take too. The keys a
3605
3666
  run needs are read from the store at its claim, opened with the seal key, and are put on that run's environment alone.
3606
- It gets none of the boxes' keys ([Sandbox](#sandbox)). A tool key reaches it only when its
3667
+ It gets none of the computer providers' account keys ([Sandbox](#sandbox)) and not the Archil account key
3668
+ (`ARCHIL_API_KEY`), from which the claim mints the run's own mount credential. A tool key reaches it only when its
3607
3669
  revision names a tool the key unlocks (`MONID_API_KEY` a monid tool, `BROWSERBASE_API_KEY` and `KERNEL_API_KEY` `browser`; a workflow's
3608
3670
  tools are those its model and call nodes name), and a model key only when its model needs it ([Models](#models)), read
3609
3671
  from the revision at each claim, a resume after a restart included.
@@ -3640,7 +3702,8 @@ carries no cost at all, as from a provider that does not price the model. The te
3640
3702
  - The launcher hands the server every secret on its list that is set over one pipe, which holds 4,096 bytes for sure
3641
3703
  before the server reads it: each set secret costs its name, its value and two bytes. Past that it refuses to start,
3642
3704
  saying `the secrets come to N bytes, more than the 4096 a pipe is sure to hold`, and starts nothing. A long value adds up
3643
- fast (an AWS session token is often over 1,000 bytes): set only the keys the server needs where it starts.
3705
+ fast (an AWS session token is often over 1,000 bytes, an RSA `AGENT37_SSH_KEY` over 3,000): set only the keys the
3706
+ server needs where it starts, and save a long one in Settings instead.
3644
3707
 
3645
3708
  ### Known gaps
3646
3709
 
@@ -3,7 +3,9 @@ import type { Route } from "./server.js";
3
3
  export declare const API_ONLY_ENV = "AGENTRUN_API_ONLY";
4
4
  /** The routes (server.ts ROUTES, by name) an API-only server serves: a run's launch, read, list, timeline, messages,
5
5
  * stop, cancel, cap raise and grade; its files and the uploads a launch names; an agent's Archil disk, read and removed (the
6
- * agent layer of a run's disk, archil-routes.ts); capabilities, health and usage. */
6
+ * agent layer of a run's disk, archil-routes.ts); capabilities, health and usage; and a run's hosted machine that dials
7
+ * fetching this server's computerd with its own token (computer-attach.ts), as it dials the attach socket, which the
8
+ * upgrade takes for such a machine alone (a paired computer is the console's). */
7
9
  export declare const API_ONLY_ROUTES: ReadonlySet<string>;
8
10
  /** Whether `env` turns the profile on: `1` or `true` on; unset, empty, `0` or `false` off. Any other value is refused in
9
11
  * words (a TypeError), so a typo never leaves the console open on a server meant to be API-only. */
package/dist/api-only.js CHANGED
@@ -2,9 +2,11 @@
2
2
  export const API_ONLY_ENV = "AGENTRUN_API_ONLY";
3
3
  /** The routes (server.ts ROUTES, by name) an API-only server serves: a run's launch, read, list, timeline, messages,
4
4
  * stop, cancel, cap raise and grade; its files and the uploads a launch names; an agent's Archil disk, read and removed (the
5
- * agent layer of a run's disk, archil-routes.ts); capabilities, health and usage. */
5
+ * agent layer of a run's disk, archil-routes.ts); capabilities, health and usage; and a run's hosted machine that dials
6
+ * fetching this server's computerd with its own token (computer-attach.ts), as it dials the attach socket, which the
7
+ * upgrade takes for such a machine alone (a paired computer is the console's). */
6
8
  export const API_ONLY_ROUTES = new Set([
7
- "createRun", "createInlineRun",
9
+ "createRun", "createInlineRun", "getComputerDaemon",
8
10
  "getAgentArchil", "deleteAgentArchil",
9
11
  "getRun", "listRuns", "listAllRuns", "getTimeline",
10
12
  "sendMessage", "stopRun", "cancelRun", "raiseRunCap", "gradeRun",
@@ -0,0 +1,30 @@
1
+ /** The variable that holds the token list. A secret, as AGENTRUN_TOKEN is. */
2
+ export declare const TOKENS_ENV = "AGENTRUN_TOKENS";
3
+ /** The id of the token AGENTRUN_TOKEN (or DIR/.token) gives. */
4
+ export declare const DEFAULT_TOKEN_ID = "default";
5
+ /** One API token: `id` names it in log lines and the banner; `token` is the secret a caller sends as its Bearer. */
6
+ export type ApiToken = {
7
+ readonly id: string;
8
+ readonly token: string;
9
+ };
10
+ /** Why `token` (from `name`) is no API token, in words; undefined when it is one: 32 characters or more, no whitespace. */
11
+ export declare function tokenProblem(token: string, name?: string): string | undefined;
12
+ /** AGENTRUN_TOKENS read: entries `id:secret`, separated by commas, whitespace or newlines; the first `:` ends the id.
13
+ * An empty or blank value, or one of separators alone, is no list (undefined), as an empty AGENTRUN_TOKEN is no token. Throws, in words that never
14
+ * hold a secret, on an entry with no `:`, an id outside ID, a secret that breaks the token's rules or holds a comma
15
+ * (the separator), or an id used twice. */
16
+ export declare function parseTokens(text: string | undefined): ApiToken[] | undefined;
17
+ /** The tokens a server takes, in order: AGENTRUN_TOKEN's (or DIR/.token's) as `default` when there is one, then the
18
+ * list's. The first is the server's token: the one the console's session header stands for. Throws when there is none,
19
+ * when an id is used twice (a log line could not say which token was used) or when one secret is given twice. */
20
+ export declare function acceptedTokens(token: string | undefined, list: readonly ApiToken[] | undefined): readonly ApiToken[];
21
+ /** The values a redaction cuts for the variable `name` holding `value`: the value whole, and for AGENTRUN_TOKENS each
22
+ * entry's secret too, so a listed token met alone (pasted into a session, a file) is cut as AGENTRUN_TOKEN's would be.
23
+ * Read leniently: an entry that is not id:secret is cut whole, never skipped, and nothing here throws. */
24
+ export declare function secretValues(name: string, value: string): string[];
25
+ /** A test of an Authorization header: the id of the token when it is exactly `Bearer <that token's secret>`, else
26
+ * undefined. The header and each token's `Bearer ` line are hashed first, so every comparison is of two 32-byte digests
27
+ * whatever was sent, and `equal` (node:crypto's timingSafeEqual) compares them in constant time. Every token is
28
+ * compared on every call, with no early return on a match, so the time taken says neither whether a token matched nor
29
+ * which. */
30
+ export declare function bearerCheck(tokens: readonly ApiToken[], equal?: (a: Buffer, b: Buffer) => boolean): (header: string | undefined) => string | undefined;
@@ -0,0 +1,89 @@
1
+ // The server's API tokens: a list of named tokens, any of which opens every route the token opens. AGENTRUN_TOKENS holds
2
+ // the list as `id:secret` entries; AGENTRUN_TOKEN (else the one DIR/.token keeps) is the entry named `default`. A
3
+ // rotation never refuses a caller: add the new token as an entry, move every caller to it, then remove the old entry.
4
+ // Every check of a presented token goes through bearerCheck here, against every entry, in constant time, and answers
5
+ // which entry matched (its id, never its secret) for the request's log line.
6
+ import { createHash, timingSafeEqual } from "node:crypto";
7
+ /** The variable that holds the token list. A secret, as AGENTRUN_TOKEN is. */
8
+ export const TOKENS_ENV = "AGENTRUN_TOKENS";
9
+ /** The id of the token AGENTRUN_TOKEN (or DIR/.token) gives. */
10
+ export const DEFAULT_TOKEN_ID = "default";
11
+ /** A token's id: a letter or digit, then up to 31 letters, digits, `.`, `_` or `-`. Never a secret, so a log may hold it. */
12
+ const ID = /^[A-Za-z0-9][A-Za-z0-9._-]{0,31}$/;
13
+ /** Why `token` (from `name`) is no API token, in words; undefined when it is one: 32 characters or more, no whitespace. */
14
+ export function tokenProblem(token, name = "the token") {
15
+ return token.length < 32 || /\s/.test(token) ? `${name} must be 32 characters or more, with no whitespace` : undefined;
16
+ }
17
+ /** AGENTRUN_TOKENS read: entries `id:secret`, separated by commas, whitespace or newlines; the first `:` ends the id.
18
+ * An empty or blank value, or one of separators alone, is no list (undefined), as an empty AGENTRUN_TOKEN is no token. Throws, in words that never
19
+ * hold a secret, on an entry with no `:`, an id outside ID, a secret that breaks the token's rules or holds a comma
20
+ * (the separator), or an id used twice. */
21
+ export function parseTokens(text) {
22
+ if (text === undefined || text.trim() === "")
23
+ return undefined;
24
+ const entries = text.split(/[\s,]+/).filter((entry) => entry !== "");
25
+ // Separators alone hold no entry: no list, so the start and its banner agree (DIR/.token's is the token, and printed).
26
+ if (entries.length === 0)
27
+ return undefined;
28
+ return entries.map((entry, index) => {
29
+ const colon = entry.indexOf(":");
30
+ if (colon < 0)
31
+ throw new Error(`${TOKENS_ENV} entry ${index + 1} is not id:secret`);
32
+ const id = entry.slice(0, colon);
33
+ const token = entry.slice(colon + 1);
34
+ if (!ID.test(id))
35
+ throw new Error(`${TOKENS_ENV} entry ${index + 1}'s id must be a letter or digit, then up to 31 letters, digits, ".", "_" or "-"`);
36
+ const problem = tokenProblem(token, `${TOKENS_ENV} entry ${id}'s secret`);
37
+ if (problem)
38
+ throw new Error(problem);
39
+ return { id, token };
40
+ });
41
+ }
42
+ /** The tokens a server takes, in order: AGENTRUN_TOKEN's (or DIR/.token's) as `default` when there is one, then the
43
+ * list's. The first is the server's token: the one the console's session header stands for. Throws when there is none,
44
+ * when an id is used twice (a log line could not say which token was used) or when one secret is given twice. */
45
+ export function acceptedTokens(token, list) {
46
+ const all = [...(token === undefined ? [] : [{ id: DEFAULT_TOKEN_ID, token }]), ...(list ?? [])];
47
+ if (all.length === 0)
48
+ throw new TypeError("a server takes at least one token");
49
+ const ids = new Set();
50
+ const secrets = new Set();
51
+ for (const entry of all) {
52
+ if (ids.has(entry.id))
53
+ throw new Error(`the API token id ${entry.id} is used twice${entry.id === DEFAULT_TOKEN_ID ? ` (AGENTRUN_TOKEN is ${DEFAULT_TOKEN_ID})` : ""}`);
54
+ if (secrets.has(entry.token))
55
+ throw new Error(`the API token ${entry.id} has the same secret as another token`);
56
+ ids.add(entry.id);
57
+ secrets.add(entry.token);
58
+ }
59
+ return all;
60
+ }
61
+ /** The values a redaction cuts for the variable `name` holding `value`: the value whole, and for AGENTRUN_TOKENS each
62
+ * entry's secret too, so a listed token met alone (pasted into a session, a file) is cut as AGENTRUN_TOKEN's would be.
63
+ * Read leniently: an entry that is not id:secret is cut whole, never skipped, and nothing here throws. */
64
+ export function secretValues(name, value) {
65
+ if (name !== TOKENS_ENV)
66
+ return [value];
67
+ const entries = value.split(/[\s,]+/).filter((entry) => entry !== "");
68
+ return [value, ...entries, ...entries.map((entry) => entry.slice(entry.indexOf(":") + 1))];
69
+ }
70
+ const digest = (text) => createHash("sha256").update(text).digest();
71
+ /** A test of an Authorization header: the id of the token when it is exactly `Bearer <that token's secret>`, else
72
+ * undefined. The header and each token's `Bearer ` line are hashed first, so every comparison is of two 32-byte digests
73
+ * whatever was sent, and `equal` (node:crypto's timingSafeEqual) compares them in constant time. Every token is
74
+ * compared on every call, with no early return on a match, so the time taken says neither whether a token matched nor
75
+ * which. */
76
+ export function bearerCheck(tokens, equal = timingSafeEqual) {
77
+ if (tokens.length === 0)
78
+ throw new TypeError("a server takes at least one token");
79
+ const expected = tokens.map((entry) => digest(`Bearer ${entry.token}`));
80
+ return (header) => {
81
+ const given = digest(String(header ?? ""));
82
+ let found = -1;
83
+ for (let i = 0; i < expected.length; i++) {
84
+ const hit = equal(given, expected[i]);
85
+ found = hit ? i : found;
86
+ }
87
+ return found < 0 ? undefined : tokens[found].id;
88
+ };
89
+ }
package/dist/cli.js CHANGED
@@ -15,6 +15,7 @@ import { REPEAT_MS, stopOnSignals } from "./stop-signals.js";
15
15
  import { canOpen } from "./host.js";
16
16
  import { resetPassword } from "./owner.js";
17
17
  import { banner } from "./print.js";
18
+ import { parseTokens } from "./api-token.js";
18
19
  import { DEFAULT_PORT, fauxEnvOf, startServe } from "./server.js";
19
20
  import { besideRunnerOptions, besideStopping, runnerBeside } from "./runner/beside.js";
20
21
  import { apiOnlyFrom } from "./api-only.js";
@@ -73,7 +74,10 @@ Without --faux, a revision's model ("provider/model-id", or AGENT_MODEL when it
73
74
  to AGENT_MODEL_FAST or AGENT_MODEL_STRONG, each falling back to AGENT_MODEL) is served by pi-ai's providers with their
74
75
  keys from the environment, or, with AGENT_MODEL_BASE_URL, by that one OpenAI Responses gateway (AGENT_MODEL_API_KEY when
75
76
  it needs a key). AGENTRUN_TOKEN, when set, is the token in place of DIR/.token's (a DIR/.token from an earlier start is removed), and is never printed; DIR/.token's is
76
- printed only by the start that made it. AGENTRUN_PUBLIC_URL, when set, is the address people open (a container's
77
+ printed only by the start that made it. AGENTRUN_TOKENS, when set, holds more tokens as id:secret entries separated by
78
+ commas or whitespace (each secret 32 characters or more): every one opens what the token opens, AGENTRUN_TOKEN's id is
79
+ "default", and the request lines name the id of the token used, never a secret. Set alone, it takes DIR/.token's place.
80
+ AGENTRUN_PUBLIC_URL, when set, is the address people open (a container's
77
81
  published port, or a proxy's URL), and the link printed uses it; with none, Render's RENDER_EXTERNAL_URL is.
78
82
  AGENTRUN_FREE_MODEL_REQUESTS (default 60) is the most requests on free models ($0 in the catalog) a run makes, capped
79
83
  or not (ChatGPT-plan requests don't count): the next is not sent and the run fails, spend_cap_reached. stdout gets one line per request, per run start and
@@ -331,6 +335,16 @@ if (budget !== undefined && !/^\d+$/.test(budget)) {
331
335
  }
332
336
  const data = values.data ?? defaultData();
333
337
  const given = secret("AGENTRUN_TOKEN") || undefined;
338
+ // More tokens, each with an id (api-token.ts), for a rotation with no caller refused; never printed. A list that cannot
339
+ // be read stops here, in words that hold no secret.
340
+ let givenList;
341
+ try {
342
+ givenList = parseTokens(secret("AGENTRUN_TOKENS"));
343
+ }
344
+ catch (error) {
345
+ console.error(`${error.message}\n\n${USAGE}`);
346
+ process.exit(2);
347
+ }
334
348
  // The stop is listened for before anything starts: a SIGTERM or SIGINT during the start (a platform's redeploy, the
335
349
  // moment the banner shows) is kept, never the default end by signal that cuts what the start began. Once the start has
336
350
  // what a stop closes, the stop below takes over (stopOnSignals), and a stop asked meanwhile runs it, through the same
@@ -370,7 +384,7 @@ try {
370
384
  console.error(`agentrun-serve: ${error.message}`);
371
385
  process.exit(1);
372
386
  },
373
- data, port, ...(values.port === undefined ? { nextFreePort: true } : {}), ...(values.listen ? { host: values.listen } : {}), ...(given ? { token: given } : {}), ...(values.faux ? { faux: values.faux } : {}), ...(values["faux-browser"] ? { fauxBrowser: values["faux-browser"] } : {}), ...(values["faux-github"] ? { fauxGitHub: true } : {}), allowHosts: values["allow-host"],
387
+ data, port, ...(values.port === undefined ? { nextFreePort: true } : {}), ...(values.listen ? { host: values.listen } : {}), ...(given ? { token: given } : {}), ...(givenList ? { tokens: givenList } : {}), ...(values.faux ? { faux: values.faux } : {}), ...(values["faux-browser"] ? { fauxBrowser: values["faux-browser"] } : {}), ...(values["faux-github"] ? { fauxGitHub: true } : {}), allowHosts: values["allow-host"],
374
388
  ...(values["max-runs"] !== undefined ? { maxRuns: Number(values["max-runs"]) } : {}),
375
389
  ...(values["drain-timeout"] ? { drainTimeout: values["drain-timeout"] } : {}), ...(values.documents ? { documents: values.documents } : {}), ...(values["allow-code-nodes"] ? { allowCodeNodes: true } : {}), ...(values.learning !== undefined ? { learning: values.learning } : {}), ...(values["grade-model"] ? { gradeModel: values["grade-model"] } : {}), ...(budget !== undefined ? { learningBudget: Number(budget) } : {}), log: (line) => void process.stdout.write(`${line}\n`),
376
390
  // The public address is the server's with accounts on or off: the Host names it serves, the webhook URLs it gives.
@@ -405,7 +419,7 @@ if (!values["no-runner"] && askedAt === undefined) {
405
419
  // server's AttachHub: a paired computer's socket is in this process, so only this runner takes one (--no-runner's
406
420
  // separate runners refuse it in words). Its runs reach an MCP server on loopback only when this server is a local
407
421
  // install (Serve.localInstall).
408
- runnerProc = await runnerBeside(data, { loops, drainMs, env: besideRunEnv(process.env, fauxEnvOf(serveOptions)), janitor: true, hub: serve.attachHub, mcpLoopback: serve.localInstall });
422
+ runnerProc = await runnerBeside(data, { loops, drainMs, env: besideRunEnv(process.env, fauxEnvOf(serveOptions)), janitor: true, hub: serve.attachHub, dial: serve.dial, mcpLoopback: serve.localInstall, mcpOwn: serve.own });
409
423
  }
410
424
  catch (error) {
411
425
  console.error(`agentrun-serve: the runner could not start: ${error.message}`);
@@ -414,8 +428,8 @@ if (!values["no-runner"] && askedAt === undefined) {
414
428
  }
415
429
  }
416
430
  // A token from the environment is the operator's already, and the stored one is printed by the start that made it only.
417
- const source = given ? "env" : serve.tokenMade ? "made" : "file";
418
- for (const line of banner({ url: serve.url, baseUrl: serve.baseUrl, data, token: serve.token, source, accounts, ...(apiOnly ? { apiOnly } : {}), ...(serve.launchCode ? { launchCode: serve.launchCode } : {}), boxes: serve.boxesLine, ...(values.listen ? { listen: values.listen } : {}), ...(publicUrl ? { publicUrl } : {}) }))
431
+ const source = given ? "env" : givenList ? "list" : serve.tokenMade ? "made" : "file";
432
+ for (const line of banner({ url: serve.url, baseUrl: serve.baseUrl, data, token: serve.token, source, tokenIds: serve.tokenIds, accounts, ...(apiOnly ? { apiOnly } : {}), ...(serve.launchCode ? { launchCode: serve.launchCode } : {}), boxes: serve.boxesLine, ...(values.listen ? { listen: values.listen } : {}), ...(publicUrl ? { publicUrl } : {}) }))
419
433
  console.log(line);
420
434
  // Open setup (no public address, a loopback listener): the link that sets the password. Any other start printed the
421
435
  // setup link with its code as the code was made (owner.ts).
@@ -0,0 +1,54 @@
1
+ /** A thing on Composio by its id, and whether this server made it. */
2
+ export type Made = {
3
+ id: string;
4
+ made: boolean;
5
+ };
6
+ /** What a preset server stands on at Composio: the user its address names, its auth config (none for a toolkit with no
7
+ * sign-in) and the connected accounts under it. */
8
+ export type ComposioMade = {
9
+ user: string;
10
+ auth_config: Made | null;
11
+ accounts: Made[];
12
+ };
13
+ /** What a delete does at Composio beyond the MCP server: what it removes, in order (the accounts before the auth config
14
+ * they are under), and what it keeps, each with whose it stays (`by`: the saved server that uses it too; none: this
15
+ * server didn't make it). */
16
+ export type Cleanup = {
17
+ remove: Thing[];
18
+ kept: (Thing & {
19
+ by?: string;
20
+ })[];
21
+ };
22
+ export type Thing = {
23
+ kind: "account" | "auth_config";
24
+ id: string;
25
+ };
26
+ /** The store.settings key a server's record lives under. */
27
+ export declare const composioMadeKey: (name: string) => string;
28
+ /** The settings value a record is stored as, bound to the server row it was written for. */
29
+ export declare const storedMade: (made: ComposioMade, row: {
30
+ createdAt: number;
31
+ }) => ComposioMade & {
32
+ of: number;
33
+ };
34
+ /** A stored record read for the row created at `createdAt`; undefined when there is none, it was written for another row,
35
+ * or it is not one (then nothing beyond the MCP server is removed). */
36
+ export declare function recordedMade(value: unknown, createdAt: number | undefined): ComposioMade | undefined;
37
+ /** A record a save writes, from what the preset found and made (`found`): a thing it found that a record of the server
38
+ * saved before over this row (`was`) or of another saved server (`others`) says was made here stays made here; and the
39
+ * accounts the server saved before had made, under the same auth config and user, stay its own. */
40
+ export declare function madeToWrite(found: ComposioMade, was: ComposioMade | undefined, others: readonly ComposioMade[]): ComposioMade;
41
+ /** What a removed server's record leaves to do, with the records of the servers still saved (`others`, by name): each
42
+ * thing it made that none of them uses is removed; one another uses is kept and passed to that one (`handover`: its record
43
+ * as it is to be written, owning it); one it didn't make is kept. */
44
+ export declare function cleanupOf(mine: ComposioMade, others: readonly [string, ComposioMade][], withConfig?: boolean): {
45
+ cleanup: Cleanup;
46
+ handover: [string, ComposioMade][];
47
+ };
48
+ /** What a save over a server leaves to do at Composio, with the records of the other servers saved (`others`, by name):
49
+ * what the record it replaces (`was`) made that the one written now (`now`) no longer stands on, an account of another
50
+ * user or auth config, and an auth config of another toolkit, each removed or passed on as a delete's is (cleanupOf). */
51
+ export declare function droppedOf(was: ComposioMade, now: ComposioMade, others: readonly [string, ComposioMade][]): {
52
+ cleanup: Cleanup;
53
+ handover: [string, ComposioMade][];
54
+ };