@parcha/agentrun-serve 0.1.0-beta.39 → 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.
- package/CHANGELOG.md +114 -0
- package/README.md +129 -16
- package/dist/api-only.d.ts +3 -1
- package/dist/api-only.js +4 -2
- package/dist/api-token.d.ts +30 -0
- package/dist/api-token.js +89 -0
- package/dist/cli.js +19 -5
- package/dist/composio-made.d.ts +54 -0
- package/dist/composio-made.js +83 -0
- package/dist/composio-preset.d.ts +16 -8
- package/dist/composio-preset.js +106 -43
- package/dist/composio-triggers.d.ts +7 -2
- package/dist/composio-triggers.js +13 -7
- package/dist/computer-attach.d.ts +29 -11
- package/dist/computer-attach.js +141 -47
- package/dist/computer-keys.d.ts +4 -0
- package/dist/computer-keys.js +5 -0
- package/dist/computers.d.ts +11 -1
- package/dist/computers.js +21 -12
- package/dist/console/assets/index-C3gNPz58.css +1 -0
- package/dist/console/assets/index-COGhx_2Z.js +711 -0
- package/dist/console/index.html +2 -2
- package/dist/decisions.js +9 -2
- package/dist/email/account.d.ts +0 -1
- package/dist/email/account.js +3 -3
- package/dist/email/answer.d.ts +5 -0
- package/dist/email/answer.js +35 -0
- package/dist/email/mail.js +19 -26
- package/dist/email/names.d.ts +30 -0
- package/dist/email/names.js +34 -0
- package/dist/email/routes.d.ts +1 -0
- package/dist/email/routes.js +1 -1
- package/dist/email/tools.d.ts +11 -4
- package/dist/email/tools.js +91 -46
- package/dist/eval-feed.d.ts +26 -0
- package/dist/eval-feed.js +68 -0
- package/dist/eval-mailbox.d.ts +5 -2
- package/dist/eval-mailbox.js +14 -6
- package/dist/exa-keyless.d.ts +1 -1
- package/dist/exa-keyless.js +1 -1
- package/dist/feed/feed-faux.d.ts +62 -0
- package/dist/feed/feed-faux.js +123 -0
- package/dist/feed/fetch.d.ts +41 -0
- package/dist/feed/fetch.js +128 -0
- package/dist/feed/parse.d.ts +41 -0
- package/dist/feed/parse.js +300 -0
- package/dist/learn/check.d.ts +3 -1
- package/dist/learn/check.js +57 -2
- package/dist/learn/compile.d.ts +3 -2
- package/dist/learn/compile.js +7 -6
- package/dist/learn/promote.d.ts +25 -14
- package/dist/learn/promote.js +32 -14
- package/dist/learned-nodes.d.ts +21 -4
- package/dist/learned-nodes.js +21 -8
- package/dist/learned-workflow.d.ts +3 -3
- package/dist/learned-workflow.js +14 -5
- package/dist/learning-cost.d.ts +17 -8
- package/dist/learning-cost.js +12 -4
- package/dist/local-models.d.ts +7 -1
- package/dist/local-models.js +11 -5
- package/dist/mcp-oauth.d.ts +15 -1
- package/dist/mcp-oauth.js +39 -5
- package/dist/mcp-pin-first.d.ts +4 -2
- package/dist/mcp-pin-first.js +4 -3
- package/dist/mcp-servers-store.d.ts +58 -5
- package/dist/mcp-servers-store.js +136 -17
- package/dist/mcp.d.ts +2 -2
- package/dist/mcp.js +2 -2
- package/dist/observation/http.d.ts +4 -1
- package/dist/observation/http.js +5 -4
- package/dist/openapi.d.ts +1 -1
- package/dist/openapi.js +63 -27
- package/dist/port-models.d.ts +4 -1
- package/dist/port-models.js +1 -0
- package/dist/print.d.ts +6 -3
- package/dist/print.js +4 -2
- package/dist/refusal-words.d.ts +3 -0
- package/dist/refusal-words.js +3 -0
- package/dist/run-labels.d.ts +23 -0
- package/dist/run-labels.js +79 -0
- package/dist/run-launch.d.ts +2 -0
- package/dist/run-launch.js +2 -0
- package/dist/run-secrets.js +12 -4
- package/dist/run-view.d.ts +3 -4
- package/dist/run-view.js +26 -24
- package/dist/runner/adapter-loop.d.ts +6 -2
- package/dist/runner/adapter-loop.js +136 -22
- package/dist/runner/adapter-run-spec.d.ts +5 -0
- package/dist/runner/adapter-run-spec.js +75 -32
- package/dist/runner/beside.d.ts +6 -3
- package/dist/runner/beside.js +9 -7
- package/dist/runner/cli-run-spec.js +33 -26
- package/dist/runner/conformance/harness.js +69 -14
- package/dist/runner/conformance/subject.d.ts +4 -1
- package/dist/runner/journal-kinds.d.ts +22 -0
- package/dist/runner/journal-kinds.js +39 -0
- package/dist/runner/main.d.ts +1 -1
- package/dist/runner/main.js +2 -2
- package/dist/runner/mcp-claim.d.ts +3 -0
- package/dist/runner/mcp-claim.js +1 -1
- package/dist/runner/mcp-run.d.ts +4 -0
- package/dist/runner/mcp-run.js +5 -3
- package/dist/runner/model-route.d.ts +7 -3
- package/dist/runner/model-route.js +24 -9
- package/dist/runner/promotion.d.ts +16 -8
- package/dist/runner/promotion.js +178 -55
- package/dist/runner/workflow-first.d.ts +6 -5
- package/dist/runner/workflow-first.js +9 -7
- package/dist/runs-over-store.js +5 -2
- package/dist/sdk/runs.d.ts +7 -1
- package/dist/sdk/runs.js +19 -6
- package/dist/secret-cut.js +3 -1
- package/dist/secrets.js +3 -1
- package/dist/server.d.ts +27 -2
- package/dist/server.js +181 -56
- package/dist/store/dialect.d.ts +6 -0
- package/dist/store/dialect.js +2 -0
- package/dist/store/index.d.ts +1 -1
- package/dist/store/postgres/connection.d.ts +11 -5
- package/dist/store/postgres/connection.js +44 -17
- package/dist/store/postgres/dialect.js +6 -0
- package/dist/store/postgres/migrations/0015_run_labels.sql +5 -0
- package/dist/store/postgres/migrations/0016_minted_tokens.sql +21 -0
- package/dist/store/postgres/store.d.ts +7 -3
- package/dist/store/postgres/store.js +1 -0
- package/dist/store/schema.d.ts +9 -0
- package/dist/store/schema.js +26 -2
- package/dist/store/sqlite/connection.js +80 -8
- package/dist/store/sqlite/run-launch.d.ts +11 -0
- package/dist/store/sqlite/run-launch.js +8 -0
- package/dist/store/sqlite/run-patch.d.ts +2 -1
- package/dist/store/sqlite/run-patch.js +3 -2
- package/dist/store/sqlite/store.js +101 -26
- package/dist/store/sqlite/worker.d.ts +2 -0
- package/dist/store/sqlite/worker.js +13 -10
- package/dist/store/store.d.ts +53 -1
- package/dist/store-reads/journal.js +2 -1
- package/dist/store-reads/learning.d.ts +30 -13
- package/dist/store-reads/learning.js +130 -51
- package/dist/store-reads/runs.d.ts +4 -3
- package/dist/store-reads/runs.js +3 -2
- package/dist/store-view.js +4 -2
- package/dist/template-eval.d.ts +4 -0
- package/dist/template-eval.js +127 -50
- package/dist/templates.d.ts +24 -1
- package/dist/templates.js +129 -21
- package/dist/timeline/origin.d.ts +1 -1
- package/dist/timeline/origin.js +2 -2
- package/dist/tool-gate.d.ts +5 -3
- package/dist/tool-gate.js +5 -2
- package/dist/tools.d.ts +13 -0
- package/dist/tools.js +15 -10
- package/dist/trigger-adapter.d.ts +12 -36
- package/dist/trigger-adapters.js +2 -1
- package/dist/trigger-email.js +30 -77
- package/dist/trigger-feed.d.ts +12 -0
- package/dist/trigger-feed.js +371 -0
- package/dist/triggers.d.ts +27 -14
- package/dist/triggers.js +121 -80
- package/dist/webhooks.js +9 -5
- package/dist/workflow/decision-recovery.js +5 -2
- package/dist/workflow/decisions.d.ts +7 -0
- package/dist/workspace/computer-deps.d.ts +5 -1
- package/dist/workspace/computer-deps.js +2 -2
- package/dist/workspace/index.d.ts +1 -0
- package/dist/workspace/index.js +2 -0
- package/dist/workspace/resolve-computer.d.ts +32 -3
- package/dist/workspace/resolve-computer.js +47 -9
- package/launcher/agentrun-serve +6 -1
- package/package.json +10 -9
- package/templates/README.md +27 -2
- package/dist/console/assets/index-BNhZs-jp.css +0 -1
- package/dist/console/assets/index-BQv5aOGB.js +0 -700
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,120 @@
|
|
|
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
|
+
|
|
82
|
+
## 0.1.0-beta.40 (2026-11-16)
|
|
83
|
+
|
|
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.
|
|
85
|
+
- A template package's `composio` trigger names its own Composio MCP need by its toolkit, as `mcp:<toolkit>/<tool>` names the need's tools: `source.server: github` for the need `{source: composio, toolkit: github, required: true}`. Apply makes the trigger on the saved Composio server that need resolves to: the one candidate, or the owner's pick under `servers.<toolkit>`. A package is portable again for Composio events, which #2961 took off the manual webhook way.
|
|
86
|
+
- A package whose composio trigger names no `source: composio` need of the package is refused when it is read (`422` at import), in words that say to name the need's toolkit.
|
|
87
|
+
- The need a composio trigger names is `required: true`: an optional need may have no saved server, and the trigger would have none. A required need with no saved server already refuses the apply (`409 agent_not_runnable`), so no trigger is made without a server.
|
|
88
|
+
- A composio trigger this server can't set up yet is skipped with a `not_set_up_here` warning under `triggers.<i>`, in the refusal's words, as a github trigger is with GitHub not connected: no public URL, no connected account (or several) for the saved server's user, or the project's subscription at another address. The agent stands, and the owner makes the trigger from Triggers → New app trigger once that's fixed. Any other refusal still undoes the apply. A template eval of a package with a composio trigger runs its cases on its own server, which has no public URL.
|
|
89
|
+
- A composio trigger's `config` values may hold `${parameters.<name>}`, filled at apply as an mcp pin's values are (one placeholder alone takes the parameter's type): `config: {owner: "${parameters.owner}", repo: "${parameters.repo}"}` makes the trigger on the owner's repository. Its `accept` where `in` values may too, as a github trigger's do. Either parameter is required or has a default, so the trigger never fills empty: one that is neither is refused when the package is read. Its `server` and `event` take no placeholder.
|
|
90
|
+
- A trigger made with `POST /v2/triggers` is unchanged: its `server` is still a saved Composio server's name.
|
|
91
|
+
- The console applies a template whose setup is only parameters (no MCP tool, no key) from its own screen: Apply is the main action there and Configure on its card, and "Set it up with an agent" is the second way. A template with more to set up keeps Run as its main action. On such a template that reads mail (an `email_*` tool or an email trigger), Apply waits for a mailbox saved under Settings → Email and links there, instead of being refused.
|
|
92
|
+
- `email_send` asks a person in two more cases, even when it is set to allow:
|
|
93
|
+
- after a run has sent 5 emails, each further send asks, saying "this run has sent N emails". This stops two auto-responders that answer each other from looping. The count is the run's own record of sends that went out (a send denied, refused or failed doesn't count), so a pause doesn't reset it. A subagent's sends count toward its run's cap, across a pause too. Sends the model makes at once count each other: past the cap, one of them may go unasked and the rest ask.
|
|
94
|
+
- on a run an email trigger started, a send that reaches anyone outside that email's thread asks, naming them ("eve@example.com is outside this email's thread"). The thread's people are the account's own address and every From, To and Cc of the thread's messages. A run whose agent reads the whole account (`scope: "mailbox"` on `email_read`), and any run no email started, is held to the cap alone.
|
|
95
|
+
|
|
96
|
+
The approval says why: its `summary` ends "Asks because …", and the card's arguments carry it as `asked_because`. With accounts off (no one can approve), such a send is refused in those words. A tool's own ask is a new field of the server's tool entry (`asks`), so the gate carries no email code.
|
|
97
|
+
- Three fixes from the computer milestone's QA: `apps.launch` no longer says it opened a url that a running Firefox never got, the Screen tab no longer says "released" right after a person allows a parked run, and the "Asked your approval" row sits above a park's rows on the Timeline.
|
|
98
|
+
- computerd: a url for an app that already runs is handed over by a second launch. Firefox takes it only over a session bus, and an app here has none, so that launch put up Firefox's "Firefox is already running" box while the call answered that it opened. Now a launch that shows a dialog of its own instead, or whose launcher fails, is ended (its box goes) and the call fails `unsupported`, naming the dialog and saying to open the url in the running window or to terminate the app and launch it with the url. A launcher that hands the url over and ends (Chromium's), or a second instance with a window of its own, still answers.
|
|
99
|
+
- Console: a desktop or phone kept at a park is opened again by the resume, so after an answer in time the Screen tab says "Waiting for the desktop. Its screen shows here once it is up." until the screen is back, not "This desktop has been released.". A page opened on a parked run now says what the run waits for and until when, even if it never saw the desktop live.
|
|
100
|
+
- Timeline: the approval row sits right below its call's row, as the ask came at the call. A park's "The desktop is kept…" row and the resume's "It's the same desktop, as the wait left it." row now come after it, not before.
|
|
101
|
+
- Two fixes for runs that wait on a person and for a server whose process is briefly held up.
|
|
102
|
+
- An answer sent just as a run paused on its question could leave the run reading working/idle for good, never resumed. This happened when no hold of the person's time fit the run's cap (so the run parked), or when the run had nothing to hold open, and the answer landed while the park let the browser session go. The answer started a turn that the park then cut, and nothing was left to wake the run. Now the answer waits for the park and resumes the run from it, and one that lands before the park starts is the run's next turn in the same claim.
|
|
103
|
+
- With the runner beside the server (the default), a write could fail with "the store stayed locked past its busy wait: database is locked" when the process was held up for about 10 s (a synchronous call, a long pause, a loaded machine) while a transaction of the other side was open or just starting. The SQLite store's wait for the write lock now gives back the time the process was held up when the holder is a transaction of the same process, as that transaction's own deadline already does. A wait on another process's write still ends after the busy wait, as before.
|
|
104
|
+
- The OpenAPI document capped the email account's password at 320 characters while the server took 1,024. Both now read one cap, 1,024, so a long OAuth-style token is valid in the document too. The tool catalog's email tool summaries are now the tools' own descriptions, so `email_send`'s says `rejected` and `note`.
|
|
105
|
+
- An email trigger starts watching at its first poll, which the server runs at once when the trigger is made, turned on again or edited, instead of a separate start step. A create or a turn-on waits for that poll (10 seconds at most) before it answers, or, when an edit of the trigger's source while it runs drops it, for the poll after the edit, so its answer carries `last_check` and mail after it starts runs. Mail that came while it was off still starts no run, and an edit of its filter or `every_s` still keeps its place. Three things change:
|
|
106
|
+
- mail that lands during the create or turn-on call itself, or past the 10 seconds when the mail server is that slow, counts as already there;
|
|
107
|
+
- a server that can't be reached at creation writes no history line (the trigger's `last_check` says so); the first check that signs in says "Couldn't check INBOX until now; watching from now: the N messages there won't start runs.";
|
|
108
|
+
- a sign-in refused at creation is one of the three in a row that turn the trigger off, as a refusal at any check is.
|
|
109
|
+
|
|
110
|
+
The note on turning it on again reads as a creation's ("Watching INBOX from now: the N messages already there won't start runs.").
|
|
111
|
+
- `GET /agents/{id}/learning/cost` counts only served runs on its after side: runs a learned workflow finished (`workflow`) or ran first and handed back (`handed_back`). A `replay` checks a new revision on a graded input and serves no one, and a run by hand after the takeover is not the workflow's, so neither moves `summary.after`, `times_cheaper`, `withheld` or `hand_backs`. The new `summary.after_state` says why `after` is null when it is: `no_served_runs` (no learned workflow has taken over) or `cost_unknown` (runs were served, none with a known cost); `priced` otherwise. The Learning tab says each figure's base: the headline and the chart's after line read "all-in over N served runs", a state with no served run priced is said in words, the "Since it learned" tile reads "medians of N runs started from what it learned", and a stopped workflow's level is "over its newest 10 priced runs" (the money rule's window, `workflows[].served`).
|
|
112
|
+
The agent's learning and cost reads now take each run's launch, proposals and learning run in two batched store reads per agent instead of a few per run, and share a settled run's journal read across concurrent requests: on a 480-run agent, the cost read made 7 store calls instead of 1,549.
|
|
113
|
+
- An OpenRouter model whose reasoning is mandatory (`openrouter/baidu/ernie-5.5-flash-preview:free`) no longer gets reasoning effort `none` with thinking off, which OpenRouter refused on every request ("Reasoning is mandatory"). With thinking off it now reasons at its default.
|
|
114
|
+
- A pi run's effort now applies on an OpenRouter model that speaks Chat Completions, `openrouter/openai/gpt-6.1-sol` (pi's default on an OpenRouter key) included. Until now the route's translation sent the model no thinking level, so an effort set on such a run did nothing, and on a model that can stop reasoning (Ling 3.2 Flash) any effort was sent as reasoning off. Now the run's level reaches OpenRouter as `reasoning: { effort }`, mapped and clamped by the model's catalog entry. A run that sets an effort may cost more and take longer than it did; a run with no effort set sends what it sent before.
|
|
115
|
+
- A runner's renew of the claims it holds, and its claim of a batch of runs, are each a few statements on the store whatever the count, never one or two a run. On Postgres a runner holding 300 runs renewed them in about 600 round trips with every row held, so a database a few milliseconds away (a loaded host) stretched the renew past the runner's claim deadline: every claim was lost at once, and the runs were claimed again and started over, again and again.
|
|
116
|
+
- On Postgres, a store call that waits for one of its pool's connections while every one is in use now waits up to a write's deadline (10 s, `poolWaitMs`), not the 4 s connect timeout. A runner of 300 loops on a database a few milliseconds away queues its loops' commits behind one another for seconds, and dozens of its runs failed for good with "no connection to the store's Postgres ... it does not answer, or every connection of this store is in use" while the database answered. A new connection's connect and startup keep the 4 s bound (`connectTimeoutMs`), so a database that does not answer still fails fast, now in words that say only that. A wait past the pool's bound fails in words of its own: "no connection of the store's Postgres at ... came free within 10000 ms: all 10 of this store's connections stayed in use".
|
|
117
|
+
- Learning: a promotion record a beta.39 store holds as `decided: "superseded"` (a replay a newer draft cancelled) reads as `skipped` on beta.40, with `skipped_by` and a reason saying so, so the promotions list and its replay read show it decided and never "running". Nothing rewrites the stored record, and it never blocks a new draft's replay.
|
|
118
|
+
|
|
5
119
|
## 0.1.0-beta.39 (2026-11-16)
|
|
6
120
|
|
|
7
121
|
- Agent37 starts from our public box image in any account. Its provider's `prepareImage()` reads the workspace template `agentrun-box-<recipe hash>` and, when the workspace has none, registers `ghcr.io/parcha-ai/agentrun-box:<recipe hash>` under that name (`POST /v1/templates`, no build). The wait is reported to `onWait` as a pull, so a run's first claim says it is pulling, once per workspace. A refusal is the run's error in Agent37's words.
|
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.
|
|
705
|
-
|
|
706
|
-
|
|
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
|
|
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
|
|
845
|
-
|
|
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
|
|
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
|
|
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.
|
|
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
|
|
@@ -2279,12 +2299,62 @@ carries one line: the checkout's facts, or why there is none (no pull request na
|
|
|
2279
2299
|
last words), so its instructions can read the change through the GitHub MCP instead. The checkout is removed when the
|
|
2280
2300
|
claim ends, and the next claim of the run makes it again.
|
|
2281
2301
|
|
|
2302
|
+
### Email (the server's own account)
|
|
2303
|
+
|
|
2304
|
+
Two ways to give an agent email: Email (IMAP/SMTP, runs on your server, no public URL) vs Composio Gmail (OAuth through
|
|
2305
|
+
Composio, needs a public URL). Email is one account per server: the server signs in to its mail servers itself with the
|
|
2306
|
+
account's app password, reads the mailbox on a timer and sends over SMTP, so nothing outside has to reach the server.
|
|
2307
|
+
Composio Gmail connects the account through Composio's OAuth and calls Gmail through Composio's tools; its events start
|
|
2308
|
+
runs through a [Composio trigger](#composio-triggers), which Composio reaches at the server's public URL.
|
|
2309
|
+
|
|
2310
|
+
**The account.** `PUT /v2/settings/email` saves it, from the owner's signed-in session only (the token is 403). A preset
|
|
2311
|
+
fills the servers: `gmail`, `fastmail` or `icloud`; `other` takes `imap` and `smtp` (`{host, port}`) from the body.
|
|
2312
|
+
`outlook` is refused in words ("Outlook needs Microsoft sign-in, which this server doesn't do yet."). The password is the
|
|
2313
|
+
account's app password (Gmail, iCloud and Fastmail each make one in the account's security settings; the account's own
|
|
2314
|
+
sign-in password is refused by most providers), at most 1,024 characters. It is sealed under the server's seal key
|
|
2315
|
+
(`AGENTRUN_SEAL_KEY`) and is in no answer, event or log line. Every connection is TLS: 993 and 465 from the start, any
|
|
2316
|
+
other port with STARTTLS required. Only `127.0.0.1` is reached in the clear. `POST /v2/settings/email/test` signs in to
|
|
2317
|
+
both servers and sends nothing; `DELETE` forgets the account.
|
|
2318
|
+
|
|
2319
|
+
**The trigger.** `{kind: "email", mailbox?: "INBOX", every_s?: 60, accept?}` reads the mailbox every `every_s` seconds
|
|
2320
|
+
and starts a run for each new message its `accept` takes (a rule's `where` reads `/from`, `/to`, `/subject`, `/text`).
|
|
2321
|
+
It watches from when it is made or turned on: the messages already there, and any that came while it was off, start no
|
|
2322
|
+
runs, and its note says so ("Watching INBOX from now: the 3 messages already there won't start runs."). A create or a
|
|
2323
|
+
turn-on waits for its first check (10 seconds at most), so the answer carries `last_check`. When the first checks fail, the first that signs in says
|
|
2324
|
+
"Couldn't check INBOX until now; watching from now: ...". An edit of its filter or `every_s` keeps its place. Mail this
|
|
2325
|
+
server sent starts none. A mail server out of reach is said in `last_check` and tried at the next time; one that refuses the
|
|
2326
|
+
sign-in 3 times in a row (its first check's among them) turns the trigger off (`sign_in_refused`) until the account is
|
|
2327
|
+
fixed and it is turned on again.
|
|
2328
|
+
|
|
2329
|
+
**The tools.** `email_search`, `email_read`, `email_draft`, `email_send` and `email_file`, host tools on every harness.
|
|
2330
|
+
Reading leaves mail unread, `email_draft` sends nothing, and `email_file` files under a label or folder and never deletes.
|
|
2331
|
+
`email_send` asks a person by default; the others are allowed.
|
|
2332
|
+
|
|
2333
|
+
**Thread scope.** On a run an email trigger started, `email_search`, `email_read` and `email_file` reach only the thread
|
|
2334
|
+
of the message that started it: that message, and every message whose References or In-Reply-To links it, in any
|
|
2335
|
+
mailbox, that its sender took part in. Anything else is answered "outside this run's thread" and never fetched. So the
|
|
2336
|
+
words of an email can't send the agent through the rest of the inbox. An agent's own tool setting `scope: "mailbox"` on
|
|
2337
|
+
one of those three tools reaches the whole account; a run no email started reaches the whole account either way.
|
|
2338
|
+
Composio Gmail tools on the same agent are not thread-scoped.
|
|
2339
|
+
|
|
2340
|
+
**What email_send asks, even on allow.** With `email_send` set to allow, a run's first 5 sends go unasked and each one
|
|
2341
|
+
after asks, saying "this run has sent 5 emails" (the count is the run's own record, so a pause doesn't reset it). This
|
|
2342
|
+
stops two auto-responders answering each other. On a run an email started whose `email_read` is thread-scoped (no
|
|
2343
|
+
`scope: "mailbox"`), a send to anyone outside the thread's people
|
|
2344
|
+
(the account's own address and every From, To and Cc of the thread's messages) asks too, naming them ("eve@example.com
|
|
2345
|
+
is outside this email's thread"). The approval's `summary` ends "Asks because ...". With accounts off, where no one can
|
|
2346
|
+
approve, such a send is refused in those words.
|
|
2347
|
+
|
|
2282
2348
|
## Templates
|
|
2283
2349
|
|
|
2284
2350
|
A template package makes a working agent in one call: its definition, its skills and rules, and its triggers, from a
|
|
2285
2351
|
folder the server ships. `GET /v2/templates` lists them; `POST /v2/templates/{name}/apply` with `{parameters,
|
|
2286
2352
|
overrides?: {model}}` makes one, or nothing when a check fails (a trigger refused archives the agent it made). A
|
|
2287
|
-
package's `version` is SemVer and never `definition.version`, the agent's revision number.
|
|
2353
|
+
package's `version` is SemVer and never `definition.version`, the agent's revision number. A package's `composio` trigger names its
|
|
2354
|
+
need's toolkit as its `server` (`server: github` for a required `{source: composio, toolkit: github}` need), and apply makes it
|
|
2355
|
+
on the saved Composio server that need maps to, its `config` filled from the parameters it names
|
|
2356
|
+
(`repo: "${parameters.repo}"`); one this server can't set up yet (no public URL, say) is skipped with a
|
|
2357
|
+
warning, as a github trigger is with GitHub not connected. The first package is `code-review`, a code review agent for one GitHub repository. The format and the
|
|
2288
2358
|
rules of an apply are in [templates/README.md](https://github.com/Parcha-ai/agentrun/blob/main/packages/serve/templates/README.md);
|
|
2289
2359
|
`agentrun template validate DIR` checks a folder as the server does.
|
|
2290
2360
|
|
|
@@ -2317,8 +2387,8 @@ failed, 2 when nothing ran. The runner, the graders and the report are in
|
|
|
2317
2387
|
| `POST /agents/{id}/current` | `{revision}`: one of the agent's revisions becomes current again. |
|
|
2318
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`. |
|
|
2319
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. |
|
|
2320
|
-
| `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. |
|
|
2321
|
-
| `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`. |
|
|
2322
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). |
|
|
2323
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. |
|
|
2324
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`). |
|
|
@@ -2348,6 +2418,46 @@ Quotes answer `501 unsupported_here` naming the feature. Home export and import
|
|
|
2348
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
|
|
2349
2419
|
above $0 is taken; it does not mean caps are unsupported ([spend cap](#spend-cap)).
|
|
2350
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
|
+
|
|
2351
2461
|
### API only
|
|
2352
2462
|
|
|
2353
2463
|
`AGENTRUN_API_ONLY=1` is for a server that runs behind its caller's backend and is never opened in a browser. It
|
|
@@ -2538,6 +2648,7 @@ than one segment after its provider (`anthropic/anthropic/claude-sonnet-5.5`) is
|
|
|
2538
2648
|
that refuses the run's key (401) fails the run naming the key and where to set it ("OpenRouter refused
|
|
2539
2649
|
OPENROUTER_API_KEY (401: User not found): set it where AgentRun starts, or save it in Settings → Model keys."), on every
|
|
2540
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.
|
|
2541
2652
|
|
|
2542
2653
|
`claude-agent` loads the revision's skills itself: the model is shown each as `agentrun:<name>`, loads one with the Skill
|
|
2543
2654
|
tool and reads its other files with `read_skill_file`, and the system prompt holds the instructions alone. A skill the
|
|
@@ -3547,13 +3658,14 @@ carries no cost at all, as from a provider that does not price the model. The te
|
|
|
3547
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
|
|
3548
3659
|
command row the runner reads, so no port a run listens on takes a token.
|
|
3549
3660
|
- A run's tools run under the runner's environment (the `AGENT_MODEL` variables among it) without the server's token or
|
|
3550
|
-
any key: no `AGENTRUN_TOKEN`, no `AGENTRUN_API_KEY`, no variable whose value is
|
|
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
|
|
3551
3662
|
(one of its `_`-separated segments, in any case, is `KEY`, `TOKEN`, `SECRET`, `PASSWORD`, `PASSWD`, `PASS`, `PAT`,
|
|
3552
3663
|
`CREDENTIAL`, `CREDENTIALS` or `DSN`, or its last is `PWD` after another: `SERVICE_KEY`, `GITHUB_TOKEN_RO`, `DB_PASS`,
|
|
3553
3664
|
`SENTRY_DSN`, `DB_PWD`; never `PWD` or `OLDPWD`), whether the launcher's list names it or not. The rule is
|
|
3554
3665
|
`keyShaped` (`src/secret-cut.ts`), which an import's cut and a harness's log take too. The keys a
|
|
3555
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.
|
|
3556
|
-
It gets none of the
|
|
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
|
|
3557
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
|
|
3558
3670
|
tools are those its model and call nodes name), and a model key only when its model needs it ([Models](#models)), read
|
|
3559
3671
|
from the revision at each claim, a resume after a restart included.
|
|
@@ -3590,7 +3702,8 @@ carries no cost at all, as from a provider that does not price the model. The te
|
|
|
3590
3702
|
- The launcher hands the server every secret on its list that is set over one pipe, which holds 4,096 bytes for sure
|
|
3591
3703
|
before the server reads it: each set secret costs its name, its value and two bytes. Past that it refuses to start,
|
|
3592
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
|
|
3593
|
-
fast (an AWS session token is often over 1,000 bytes): set only the keys the
|
|
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.
|
|
3594
3707
|
|
|
3595
3708
|
### Known gaps
|
|
3596
3709
|
|
package/dist/api-only.d.ts
CHANGED
|
@@ -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
|
+
}
|