@parcha/agentrun-serve 0.1.0-beta.57 → 0.1.0-beta.58
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 +52 -0
- package/README.md +64 -33
- package/dist/api-only.d.ts +2 -4
- package/dist/api-only.js +2 -4
- package/dist/box-paths.d.ts +4 -3
- package/dist/box-paths.js +7 -4
- package/dist/claude-login-token.d.ts +117 -0
- package/dist/claude-login-token.js +737 -0
- package/dist/claude-login.d.ts +52 -12
- package/dist/claude-login.js +164 -39
- package/dist/cli.js +7 -41
- package/dist/computer-attach.d.ts +35 -17
- package/dist/computer-attach.js +301 -49
- package/dist/computers.d.ts +10 -10
- package/dist/computers.js +5 -5
- package/dist/console/assets/{backend-DVhHzJX2.js → backend-CSAWUqtZ.js} +1 -1
- package/dist/console/assets/index-DPh29cyz.js +747 -0
- package/dist/console/index.html +1 -1
- package/dist/dial-relay.d.ts +25 -4
- package/dist/dial-relay.js +129 -1
- package/dist/env-switch.d.ts +1 -3
- package/dist/env-switch.js +1 -3
- package/dist/fal-price.d.ts +1 -3
- package/dist/fal-price.js +77 -26
- package/dist/learn/ledger.d.ts +170 -0
- package/dist/learn/ledger.js +218 -0
- package/dist/learn/promote.d.ts +3 -3
- package/dist/learn/promote.js +1 -1
- package/dist/learning-cost.d.ts +22 -20
- package/dist/learning-cost.js +15 -21
- package/dist/live-reach.d.ts +2 -0
- package/dist/live-reach.js +2 -0
- package/dist/mcp-api-only-origins.d.ts +8 -3
- package/dist/mcp-api-only-origins.js +17 -17
- package/dist/micro.d.ts +2 -0
- package/dist/micro.js +2 -0
- package/dist/model.d.ts +5 -4
- package/dist/model.js +7 -6
- package/dist/monid.d.ts +14 -1
- package/dist/monid.js +103 -26
- package/dist/openapi.js +34 -12
- package/dist/place-offers.d.ts +4 -0
- package/dist/place-offers.js +7 -4
- package/dist/provider.d.ts +2 -2
- package/dist/provider.js +9 -5
- package/dist/run-learning-served.d.ts +2 -2
- package/dist/run-view.d.ts +1 -2
- package/dist/run-view.js +2 -1
- package/dist/runner/adapter-loop.js +3 -16
- package/dist/runner/adapter-run-spec.d.ts +20 -13
- package/dist/runner/adapter-run-spec.js +57 -48
- package/dist/runner/beside.d.ts +9 -2
- package/dist/runner/beside.js +24 -7
- package/dist/runner/claim-secrets.d.ts +17 -15
- package/dist/runner/claim-secrets.js +32 -34
- package/dist/runner/cli-run-spec.js +21 -9
- package/dist/runner/held.d.ts +16 -4
- package/dist/runner/main.d.ts +11 -6
- package/dist/runner/main.js +12 -7
- package/dist/runner/mcp-claim.js +3 -2
- package/dist/runner/mcp-run.d.ts +3 -6
- package/dist/runner/mcp-run.js +3 -4
- package/dist/runner/presence.d.ts +11 -1
- package/dist/runner/presence.js +7 -0
- package/dist/runner/reflect-hook.js +1 -1
- package/dist/runner/run-child-host.d.ts +19 -8
- package/dist/runner/run-child-host.js +80 -34
- package/dist/runner/runner.d.ts +3 -0
- package/dist/runner/runner.js +1 -1
- package/dist/runner/save-slots.js +2 -1
- package/dist/runner/subagent.d.ts +11 -0
- package/dist/runner/subagent.js +17 -3
- package/dist/runner/workflow-first.d.ts +27 -14
- package/dist/runner/workflow-first.js +29 -22
- package/dist/runner/workflow-spec.js +1 -1
- package/dist/server.d.ts +18 -7
- package/dist/server.js +150 -64
- package/dist/slots.d.ts +9 -0
- package/dist/slots.js +45 -0
- package/dist/store/postgres/migrations/0028_learning_ledger.sql +44 -0
- package/dist/store/schema.d.ts +17 -0
- package/dist/store/schema.js +47 -1
- package/dist/store/sqlite/run-patch.d.ts +11 -1
- package/dist/store/sqlite/run-patch.js +29 -1
- package/dist/store/sqlite/store.js +72 -9
- package/dist/store/store.d.ts +14 -0
- package/dist/store-reads/learning.d.ts +81 -124
- package/dist/store-reads/learning.js +207 -286
- package/dist/template-eval.d.ts +19 -0
- package/dist/template-eval.js +92 -43
- package/dist/template-import.d.ts +0 -10
- package/dist/template-import.js +5 -10
- package/dist/timeline/web-calls.d.ts +12 -14
- package/dist/timeline/web-calls.js +14 -30
- package/dist/web-save.d.ts +4 -9
- package/dist/web-save.js +4 -43
- package/dist/workspace/attached-computers.d.ts +32 -9
- package/dist/workspace/attached-computers.js +77 -13
- package/dist/workspace/computer-deps.d.ts +6 -1
- package/dist/workspace/computer-deps.js +1 -1
- package/dist/workspace/computer-for-claim.js +6 -3
- package/dist/workspace/paired-route.d.ts +91 -0
- package/dist/workspace/paired-route.js +153 -0
- package/dist/wrapped.d.ts +8 -2
- package/dist/wrapped.js +21 -6
- package/package.json +12 -12
- package/templates/README.md +3 -3
- package/dist/console/assets/index-okP-y8PK.js +0 -747
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,58 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## 0.1.0-beta.58 (2026-11-25)
|
|
6
|
+
|
|
7
|
+
**Breaking:**
|
|
8
|
+
|
|
9
|
+
- `agentrun deploy` no longer checks a package with the server bundled beside the CLI before it sends it, and `agentrun-serve check-upload` is gone. The target's import is the check: a package the target refuses exits 2 in the target's own words (its 422 `input_invalid`), with nothing applied, and a package the target accepts deploys even when an older CLI's server would have refused it. A script that ran `agentrun-serve check-upload` should deploy and read the exit code and refusal instead. A refused `category` names the value it got: `category is one of engineering, security, sales, marketing, research, finance, operations, compliance, personal, not "productivity"`. `agentrun deploy DIR` with a hidden file in the folder (a `.DS_Store`, a `.env`) no longer throws a TypeError; it names the hidden paths it leaves out, as before. <!-- changes/deploy-import-is-the-check.md -->
|
|
10
|
+
|
|
11
|
+
**Changes:**
|
|
12
|
+
|
|
13
|
+
- Learning cost now has a single source of truth, a ledger. The store writes one ledger row for each run, plus spend rows for each compile, check and audit, filed under the workflow version they were for. An agent's cost page (`GET /agents/{id}/learning/cost`), a run's cost (`GET /runs/{id}`) and the launch's money rule all read one summary of those rows, so they agree on every figure. The money rule had its own cost formula and its own by-hand baseline; both are deleted. <!-- changes/learning-ledger.md -->
|
|
14
|
+
- New fields, all additions: a run's `cost` and the cost page's `runs[]` gain `compile_usd`, `followup_usd`, `shadow_usd` and `share_usd`, the parts that make up the run's `learning_usd`. `runs[]` also gains `not_served`: `"cost_stop"` when the money rule stopped the workflow, `"cut"` when a restart cut the workflow's call and the run was handed back (the summary counts that in `hand_backs.cut`, never `back`), or null. Existing fields keep their names and meaning.
|
|
15
|
+
- The money rule's by-hand side is now the job's own cost, without the run's compile turns, follow-ups or audit. It is still the mean over the same runs as the served side: the agent's newest 500 runs on no named disk since its learning's reset. Before, it was the all-in mean. The line where a workflow counts as over the by-hand cost moves to match.
|
|
16
|
+
- Two changes to which runs the by-hand side counts. First, the fallback is gone: when the window holds no `agent` run with a known cost, by-hand is null and the workflow keeps serving. Before, it fell back to the runs before the workflow first ran. Second, runs with learning off now count as by-hand runs anywhere in the window: a run that does not learn is on the `agent` path. Before, such runs were left out once any `agent` run was known.
|
|
17
|
+
- The cost page shows two by-hand figures over different runs, and their descriptions now say which: `workflows[].by_hand` is the money rule's window, and `summary.before` is every run the series counts before the takeover.
|
|
18
|
+
- A revision's compile spend stays on that revision even when no promote record names it. Such a revision now shows on the bill at the default K instead of falling into unattributed.
|
|
19
|
+
- Postgres stores apply migration 0028, which adds the `learning_ledger` and `learning_spend` tables and is additive. On SQLite a server adds them at its start, and a runner waits for that server. Some runs have no ledger row, or a stale one: a run that ended before the upgrade, or one that a runner or server of the earlier version ended again or healed. A row records the run's epoch at the end that wrote it, and every end moves the epoch, so a grade's correction round counts as a new end even though it keeps the run's end time. Each such run gets its ledger row worked out from its run row when it is read.
|
|
20
|
+
- Purging a run deletes its ledger rows. Its cost stays on the run's tombstone, where `/usage` and `/stats` read it.
|
|
21
|
+
- A paired computer works under a runner in a process of its own (`--no-runner`; the image's default `server-and-runner`) when the runner knows the server's public address (`AGENTRUN_PUBLIC_URL`), the relay a dial provider's machines already take. A run's claim writes the computer's route, one settings row per computer naming the runner, its process, the run and the hold's end, by compare-and-set. A route held by a live run on a live runner refuses the claim (`<name> is held by run <run> on runner <runner>: one run at a time`); one whose runner is gone or restarted, or whose run is final (completed, failed or cancelled), is taken. Once a second the server closes a paired computer's socket that is not where its route says (close 1001), and the driver's redial lands there: relayed to the run's runner, or on the server itself once the run releases it or its hold ends. A redial to a stale route is `503` in words the server keeps on the route. A run on the runner beside the server takes a route of its own too, so a runner apart's claim for another run is refused in the same words while it holds the computer, which stays on the server. A run cancelled, failed or whose claim is lost while it holds a paired computer lets it go as it ends. The run's create waits for the computer about 80 s and fails in words naming the runner when it does not arrive. `GET /v2/computers` lists a paired computer's `held_on` (the runner its run's hold is on) and `hold_note` (the server's note of a refused relay, or that it is attached nowhere), and Settings → Computers shows both on its row. `runs_refused` on a pairing code, the pair answer and a paired computer is null once a runner relays, and names both fixes until one does. <!-- changes/paired-computer-relay.md -->
|
|
22
|
+
- `GET /v2/runs` takes `source`: `source=claude-code` (or `codex`, ... a source's name as the run's `imported_from.source` holds it) lists only the runs imported from that source, and `source=live` the runs made here, not imported. It is the link behind "open these sessions as runs": the console's runs list keeps it in the address (`#/runs?source=claude-code`, with a button that clears it), and the CLI, the TypeScript client and the Python client send it as `--source`, `source` and `source=`. A name no run holds lists none; a second `source`, or a value that is not a lowercase name, is 400. <!-- changes/runs-source-filter.md -->
|
|
23
|
+
- Wrapped links each harness's numbers to the runs of every source behind it (`#/runs?source=<source>`), and says "not imported yet", with the import command, for a source with no imported runs. `GET /v2/wrapped`'s harness rows gain `sources` (the sources read for that harness: several can share one), so the console needs no copy of the source-to-harness table. The page also holds the registry of the nine prototype cards (what each reads and waits on) and a renderer seam; with no renderer it shows no cards section. <!-- changes/wrapped-open.md -->
|
|
24
|
+
- More follow-ups to the Claude login on this machine (Settings → Model keys), and to the server's probe of the harness offers. <!-- changes/claude-sign-in-followups-2.md -->
|
|
25
|
+
- A tool key's save or delete while the offers held are behind the inputs, and the probe out was made from the inputs read now (a turn-on of the login, say), waits for that probe's turn and starts no probe of its own while it lands. The turn ends when the probe lands or fails, or when a later probe overtakes it; the change then reads the inputs again: landed, it composes the capabilities; failed, it probes for itself; overtaken, it goes by the later probe. So it never answers `500` for another request's failed probe once its key is stored, never waits on a dropped probe, and its key always shows in the capabilities it answers after. Before, it started a probe that dropped the one out, so the save answered only after a whole probe of its own. The server logs `harness_offers_wait` as it waits.
|
|
26
|
+
- A probe of the offers that fails leaves no probe out when it was the latest one, so a later change back to the inputs the offers held were made from reuses them. Before, that change probed again.
|
|
27
|
+
- The Playground's "No model yet" bar is gone while the login is on and reads signed in, no agent is picked (no agents yet, or the agents still being read), and the server's default place is the runner, where a first agent on Claude Agent runs on the login. The bar's ChatGPT and key offer goes with it, whatever harness the first agent will use. On a server whose default place is a box, or before its places are read, the bar stays: a first agent there runs in the box on the model keys. Before, a Playground with no agents offered ChatGPT or a key though an agent on Claude Agent would run on the login.
|
|
28
|
+
- A run of an agent on Claude Agent in a box, refused for its model while the login is on, on a model the login runs (Anthropic's own, `anthropic/<id>`, or none named), says that the login runs agents on the runner only, names the box, and says that moving the agent to the runner runs it on the login. Its `409 agent_not_runnable` carries a new `details.login_on_runner: true` (additive), and the Playground offers "Move it to the runner" there, which saves the agent's definition with its computer set to none and its box-only tools dropped, as the agent's Computer step does, and names the tools it dropped. Which tools run only in a box is the capabilities' word: a move taken before they are read, or after their read failed, reads them itself, and while that read fails it saves nothing and says so. The Computer step, with no tools read, refuses a pick that puts the agent on the runner, in words, and changes nothing. Before, either saved the agent on the runner with bash still granted, and its next run was refused there. The offer is the refused agent's: it shows only while that agent is picked and moves only that agent. After the move, a revision picked in the Playground becomes the one the move saved, so the next request runs on the runner. An agent already on the runner is not saved again. The login still runs agents on the runner only. An agent on any other model (an OpenRouter one, Anthropic's through OpenRouter included) is offered no move: on the runner it still needs its provider's key, which its refusal names. Serve puts a run on the login and makes the offer by one rule.
|
|
29
|
+
- A run's check of the login takes the Settings view's signed-in answer from a runner in a process of its own on the same data folder (`agentrun-serve --no-runner` beside `agentrun-serve runner`). The answer is kept in the data folder's `claude-login-answers/`: one file per login (0600, in a 0700 folder), named by a hash of the machine's id and the login, holding only the time; a signed-out answer removes it. A run's check reads it only as a regular file of at most 32 bytes, never through a link, and a FIFO there is no answer rather than a held check. A note tightens a wider folder to 0700 and never writes through a link at its name. On disk, an answer outlives a server restart for up to its 10 minutes. Before, it was in the server process's memory, so such a runner refused a first run whose two checks timed out right after Settings read signed in.
|
|
30
|
+
- A sign-in whose CLI is a script naming an interpreter that is not there (`#!/path`, or `#!/usr/bin/env <program>` with the program on no folder of the sign-in's PATH) fails at its start, in words that name the interpreter. Before, the parent watch's exit 127 read as the CLI's own exit. The `#!` line is read as the kernel reads it, as bytes, so an interpreter under a folder whose name is not ASCII (a home folder named `José`, say) is found.
|
|
31
|
+
- `parentWatched` throws a `RangeError` at the call for a `termGraceMs` the parent-watch shim would refuse (anything but a whole number of ms from 1 to 2^31 - 1), whichever watch is asked for. Before, the shim exited 2 at spawn, which read as the child's own exit.
|
|
32
|
+
- The status check reads an answer that is already in the CLI's output when the drain's second ends, though the server's event loop was held up past that second. Before, the loop ran the drain's timer before its reads, and the check read `no_status`.
|
|
33
|
+
- The agent editor's tools step, with no MCP server saved, links to Settings → MCP servers instead of only naming it. On a server that sends its models to a gateway, unless its own default model is one of the plan's (`AGENT_MODEL=chatgpt/…`), the ChatGPT plan row and the first screen's sign-in no longer say Codex and pi agents run on the plan: there an agent with no model named runs on the gateway, and the plan runs only an agent that names one of its models (`chatgpt/…`). <!-- changes/console-tools-link-gateway-plan.md -->
|
|
34
|
+
- A fal job priced by its settings (Kling v3, Veo 3 and 3.1, Ideogram, Nano Banana, sync-lipsync v2, Fabric) is held and booked at no less than its tier's rate on fal's model page when get_pricing states a rate other than the one its tiers were decided at. Before, the tier's ratio was applied to whatever get_pricing stated, so if fal lowered Kling v3 pro from $0.14 to $0.112 a second, a default job (audio on, $0.168 a second on the model page) was held and booked at $0.1344 a second, about 20% under its bill, with nothing to show it. The basis now says so when it happens: get_pricing's rate, the rate the tiers were decided at, and the model page's rate the job is held at. A raise on get_pricing still scales the ratio up. <!-- changes/fal-price-drift.md -->
|
|
35
|
+
A price of $0 from get_pricing is no price: such a job is refused unsent under a cap and, with no cap, booked as an unknown charge, never $0. Before, it was held and booked at $0.
|
|
36
|
+
Jobs sent at once on one endpoint share one get_pricing call, and an error or no answer from get_pricing is asked once more before a job is called unpriceable. Before, calls sent together each asked get_pricing, and one error answer among them refused that job under a cap ("its get_pricing answered an error") although the price had just been read for the others.
|
|
37
|
+
When the call that sent a shared read stops before fal answers (its deadline, or its run's abort), a job whose own call is still live reads the price again with its own call rather than taking the stopped call's empty answer.
|
|
38
|
+
- A burst of saves granting monid endpoints no longer loses grants to monid's rate limit. A save's read of monid's listing or an inspect that monid refuses for its rate (429), fails (5xx) or leaves unanswered past the request's limit is sent again after monid's Retry-After (250 ms at least), at most 20 times and for up to 20 s of waits, inside 45 s of the save's start, and only then refused, in the same words as before. One server's saves share those reads: saves that arrive together read the listing once and each endpoint once, each waiting on the other's read no longer than its own 45 s, and a read that answered is reused for 60 s. A refusal monid gives as sent (401, 403, 404), or monid out of reach, still refuses the grant at once. <!-- changes/monid-save-burst-reads.md -->
|
|
39
|
+
- A race's lanes are the console's own agents, no longer inline runs on external agents the Agents list could only read. Each lane makes an agent `race-<label>-<n>-<pick>` (POST /v2/agents) and starts its run, labeled and capped as before, on that agent's first revision (POST /v2/agents/{id}/runs), so a resend after a lost answer never runs an edited agent. A lane picked again after a refusal archives the agent it had. A refused last lane can be removed (its agent archived), and the race opens once every lane left has a run. <!-- changes/race-lanes-console-agents.md -->
|
|
40
|
+
- A run that grants the subagent tool now gives its subagent tiers only the saved model keys of the models those tiers run on (the revision's `model_tiers`, else `AGENT_MODEL_FAST` / `AGENT_MODEL_STRONG`), or the gateway's key behind a gateway. That holds whether the run has a process of its own, which is now handed only those keys, or routes its tiers in the runner. It used to hand every saved model key. A replay's or audit run's grader now reads only its fast tier's model's key, and reads none when no fast tier is set. A runner with no seal key gives its tiers only their models' keys from its environment. A tier whose provider has no saved key fails on that tier with words saying so, and never falls back to another key. <!-- changes/subagent-tier-keys-only.md -->
|
|
41
|
+
- `template eval`: the read of a run's timeline page now stops at the run's deadline and at the eval's stop (Ctrl-C), as the read that asks whether a runner holds it does. A page that stalls is given up on after 15 s and asked again. Before, a server that stalled a page held the eval until fetch's own 300 s timeout, past the deadline, and the run then ended "unknown", not cancelled as timed out. A read that the deadline ends now ends the wait at once, with no further page read. A deadline that has already passed sends no read, and a cancel at the deadline that fails still ends the run timed out. `evalTemplate` refuses a `runTimeoutMs` or `queueTimeoutMs` that isn't a number of milliseconds over 0 (NaN, 0, below 0, Infinity) with a RangeError, before anything runs. Before, NaN left the wait with no deadline, and a fraction of a millisecond threw from the claim read. <!-- changes/template-eval-page-read-deadline.md -->
|
|
42
|
+
- `GET /v2/wrapped` is 403 on a server that has an API key made in the console for an app (Settings → AgentRun API keys), as on one that takes a second API token: the key's holder no longer reads the machine user's year. Once the keys are revoked, the owner reads it again. <!-- changes/wrapped-api-keys.md -->
|
|
43
|
+
- Where each run is a user of its own (the image, `run_isolation: "uid"`), a claude-agent run now runs on Claude Code's login in AgentRun's own login folder instead of failing at its claim. The runner, as the server's user, reads the login's access token from that folder and hands the run's CLI that token alone, in `CLAUDE_CODE_OAUTH_TOKEN`: never the folder and never the refresh token, so the run's CLI never renews the login. The runner reads the folder again when the run starts and whenever Anthropic refuses the token mid-run, so a renewal your own Claude Code wrote there is picked up. The runner also renews the login itself, in the CLI's place, when a token has less than five minutes left and after Anthropic refuses one mid-run: it sends the pinned CLI's own refresh request, holds the CLI's own refresh lock on the folder, reads the file again under it (a renewal by the CLI or another runner is taken, and nothing is sent twice), and writes the answer back to that folder's `.credentials.json` alone, atomically at mode 0600, every other field kept. It holds the lock as the CLI does, by the directory it made and the mtime it set (to the microsecond; on a filesystem that keeps whole seconds alone, any mtime in that second, as the CLI reads its own lock there), so a lock another holder took over while the runner was paused is never touched or removed, and nothing is sent under it. Runners take the lock one at a time, a dead one included, through a short-lived `.takeover` directory beside it, so two runners never hold it at once, unless a runner stalls past the 60 s stale time inside a takeover or between its last check of the lock and its removal of it (every lock that expires has these gaps). The CLI does not see that directory: between a runner and the CLI the lock is as safe as the CLI's own, and where the CLI's second lock beside the login folder can be made, it keeps the two from both sending. If the write back fails, the runner keeps the new pair in memory: later asks get its token, send nothing (the old refresh token is spent and never sent again) and try the write again, under the same lock and after reading the file again, so a newer pair another holder wrote is kept; once that token has less than five minutes left and is still unsaved, the run fails in words that say the renewal could not be saved and what to fix. A held token Anthropic refuses is never handed again: the ask fails while its pair is unsaved, and once the pair is saved the runner renews from it. One ask sends at most one renewal and nothing retries it. A renewal that fails, a refresh token Anthropic refused included, fails the run at its start, and ends the turn mid-run, in words that say to open Claude Code once to renew the login; a token refused mid-run that the runner had no way to renew ends the turn in words that say to run the claude CLI once on this login to renew it. No token is in the runner's log or in any error, and each token handed is cut from the run's journal, messages and rows as the runner writes them. A command the run's CLI starts can read the token, as the run's own user can. Under per-run users, a run on this machine's own Claude Code login (`~/.claude`, or the `CLAUDE_CONFIG_DIR` AgentRun was started with) still fails at its claim. So does a login run while another runner on the same data folder runs its login runs under the server's user, and the error names that runner. A login kept in a form the runner does not read fails in words too. For each of these, set `AGENTRUN_RUN_USER=same` or give the run a `model_key`. `claudeAgentAdapter({ login })` in `@parcha/agentrun-harness-claude` also takes `{ token(), refused?(sent) }`, a host's reader of the login's access token: on the CLI's request for a newer token it tells the host which token was refused, then answers from `token()`. The pinned CLI's refresh request, lock and write back are exported as `CLAUDE_LOGIN_REFRESH` (and `loginRefresh` from `/facts`), and a test reads each of them in the installed CLI. <!-- changes/claude-login-per-run-users.md -->
|
|
44
|
+
- Claude Code's login on this machine now uses a home the server's own user owns: the server's `HOME` when that user owns it, else that user's own home. A server started under a sudo that keeps `HOME` no longer signs Claude Code in as root inside the person's home, leaving files their own CLI can't read, and a service account that inherited someone's `HOME` no longer reads that person's login as its own. Where the server's user owns neither, Settings says why, the turn-on and the sign-in are refused in those words, and a login saved before is turned off at the start. <!-- changes/claude-login-owned-home.md -->
|
|
45
|
+
|
|
46
|
+
The refusal of a box agent on Claude Agent that names no model, while the login is on, offers the move to the runner by the model the agent would run there: the host's default for Claude Agent, `AGENT_MODEL` first. Where that is Anthropic's own, the refusal now says the login runs agents on the runner only and carries `details.login_on_runner`, as it does for an agent that names Anthropic's model itself. Before, the refusal named a key and offered no move. Where it is an OpenRouter model, no move is offered, since the moved agent would still need OpenRouter's key.
|
|
47
|
+
- A fal job priced by its settings (Kling v3, Veo 3 and 3.1, Ideogram, Nano Banana, sync-lipsync v2, Fabric) can't be priced when get_pricing states its endpoint in another unit than the one its tiers were decided in (per second, minute or image): under a spend cap it is refused unsent, and without one it is booked as an unknown charge. Before, the tier's ratio and its model-page rate were applied in the new unit, so sync-lipsync v2 stated per second would have been held and booked at its per-minute rate for every second (60 times its bill), and one 4K Nano Banana 2 image stated per megapixel at $2.72 against the $0.16 fal bills. <!-- changes/fal-price-unit.md -->
|
|
48
|
+
- A server whose computerd build for its Docker's architecture is not there (built with `npm run build` but not `npm run build:daemon -w @parcha/agentrun-computer`) says so at its start and doesn't offer Docker. Its `boxes` line, the start's banner and capabilities give the reason with the command that builds it ("no daemon for Docker's amd64 at …: run npm run build:daemon -w @parcha/agentrun-computer, then restart AgentRun"). A run that needs a Docker computer or the Docker box is refused at its start with that reason, and a new agent runs on the runner. Before, Docker was offered and every Docker run failed at its computer's create, a fraction of a second in. As with the server's other Docker checks, it is decided once at the start, so a build made later takes a restart. A daemon of another machine, or a layout whose paths Docker lacks, is still said first. <!-- changes/serve-docker-daemon-missing.md -->
|
|
49
|
+
The start's probe of Docker (`docker version`) now names the daemon's architecture with its version, so the check asks Docker nothing more. A server with `AGENTRUN_BOXES` not listing docker still asks Docker nothing.
|
|
50
|
+
`@parcha/agentrun-computer/docker` exports `dockerDaemonOf(arch, dir?)`: the daemon file a Docker computer binds for that architecture, and the words when it is missing. Docker's `create()` takes its daemon there, so it and a server's start check name the same file in the same words.
|
|
51
|
+
- Wrapped: a failed read, a long read, a refusal, and a model's price, each said as they are. <!-- changes/wrapped-states.md -->
|
|
52
|
+
- A read of the year that fails (the worker ended, or ran out of memory on a large home) is kept for a minute, like a read that worked. Each ask in that minute is `500 internal`, and the next ask after it reads again. The server logs the failure once, as it fails, `agentrun-serve: the read of this machine's session history for <year> failed: …`. Before, the failure was dropped with no log, often after its ask had already answered 503, so each new ask started another full read and got another 503.
|
|
53
|
+
- Each of `GET /v2/wrapped`'s `models` has `unpriced_requests` (additive): how many of the model's requests its `cost_usd` leaves out. `wrappedHome`'s models carry `unpricedRequests` to match. The console marks "priced only" on the model that has unpriced requests, and shows "no known price" for a model none of whose requests were priced. Before, every model was marked "priced only" once any request of the year was unpriced, and an unlisted model showed "$0.00 priced only".
|
|
54
|
+
- The console's Wrapped page keeps reading through a `503` (a home still being read): it keeps its skeleton, asks again after the server's `retry_after_ms`, and stops when the page closes. Before, it showed "The server is busy" with a Retry button.
|
|
55
|
+
- A `403` on the Wrapped page shows the server's reasons as the why, and the next step is to open Wrapped on one owner's own server. Before, it said to sign in as the server's owner, which fixes none of these refusals.
|
|
56
|
+
|
|
5
57
|
## 0.1.0-beta.57 (2026-11-24)
|
|
6
58
|
|
|
7
59
|
**Breaking:**
|
package/README.md
CHANGED
|
@@ -329,7 +329,8 @@ two processes in the container: the server with `--no-runner`, and one runner on
|
|
|
329
329
|
`GET /v2/health`. Each has its own store connection, so a busy runner never holds up the API. If either exits, the other
|
|
330
330
|
stops and the container exits non-zero. Give the image other arguments and it runs that one command, as given:
|
|
331
331
|
`runner --data /data --name runner-1` is a runner, and server options alone (no `server-and-runner`) are a server with
|
|
332
|
-
its runner in its own process
|
|
332
|
+
its runner in its own process. A [paired computer](#a-persons-own-computer) works under either once the runner relays,
|
|
333
|
+
below.
|
|
333
334
|
|
|
334
335
|
A computer provider whose machines dial the server (Fly Machines and Cloudflare; the computer package's `connectOf`,
|
|
335
336
|
which also says dial for E2B, Daytona or Modal made with `connect: "dial"`) works under a runner apart that knows the
|
|
@@ -345,6 +346,15 @@ and the server says it sooner: in `GET /v2/computers`, each dial provider's row
|
|
|
345
346
|
and its Test connection in Settings → Computers fails in the same words. With a runner that relays, `runs_refused` is
|
|
346
347
|
null.
|
|
347
348
|
|
|
349
|
+
A [paired computer](#a-persons-own-computer) takes the same relay. A run's claim on a runner that relays writes the
|
|
350
|
+
computer's route (a settings row: the runner, its process, the run and the hold's end), refused while a live run on a
|
|
351
|
+
live runner holds it, and taken from a runner that is gone or restarted, or a run that is over. Once a second the server
|
|
352
|
+
closes a paired computer's socket that is not where its route says (close 1001), and the driver's redial lands there:
|
|
353
|
+
relayed to the run's runner, or back on the server once the run releases it. The run's create waits for it about 80 s
|
|
354
|
+
(the driver's longest redial, a relay's connect and a hello) and fails in words naming the runner when it does not
|
|
355
|
+
come. `GET /v2/computers` lists the runner the hold is on (`held_on`), and the server's note when a relay was refused
|
|
356
|
+
(`hold_note`), each shown on the computer's row in Settings → Computers.
|
|
357
|
+
|
|
348
358
|
The token is in the log of the start that made it. A `docker stop` reaches both processes. The runner gives a busy run
|
|
349
359
|
6 s (`--drain-timeout 6s`) to finish its turn, so a busy `docker stop` ends in about 7.5 s, inside Docker's default 10 s
|
|
350
360
|
grace, and Compose's `stop_grace_period` is 15 s; a turn cut off resumes at the next start. Compose publishes the port
|
|
@@ -1095,13 +1105,16 @@ passes the binding's conformance cases (below) needs no change here.
|
|
|
1095
1105
|
refused at its start, saying to open its driver. A run uses what the hello's groups and features allow.
|
|
1096
1106
|
- **Remove it.** Remove on its row (`DELETE /v2/computers/{computer_id}`) ends its token and closes its connection; a
|
|
1097
1107
|
run holding it loses it. Pairing it again gives it a new id.
|
|
1098
|
-
- **One process.** A computer's connection lands on
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1108
|
+
- **One process, or a relay.** A computer's connection lands on the server process it dials. A run of the runner
|
|
1109
|
+
beside the server (`agentrun-serve start`, the default) uses it there. A runner started apart (`agentrun-serve
|
|
1110
|
+
runner`, beside a server started with `--no-runner`; the image's default command) uses it through the server's relay
|
|
1111
|
+
when it knows the server's public address, `AGENTRUN_PUBLIC_URL`: its run's claim routes the computer's next dial to
|
|
1112
|
+
that runner, and its release routes it back (above). One that does not refuses a paired computer at the claim,
|
|
1113
|
+
naming both fixes. Such a server says it sooner: while no runner relays, its pairing code, the pair answer and each
|
|
1114
|
+
paired computer carry `runs_refused`, which the console shows with the code and on the computer's row. Give the
|
|
1115
|
+
runner `AGENTRUN_PUBLIC_URL`, or give the image the server's options alone (`--data /data --listen 0.0.0.0 --port
|
|
1116
|
+
7340 --drain-timeout 6s`) to keep the runner in the server's process. A second server on one store is already
|
|
1117
|
+
refused by the store's owner lock, on SQLite and Postgres alike.
|
|
1105
1118
|
- **Conformance.** `node dist/attach-conformance-cli.js [--port 7392] [--listen 127.0.0.1]` runs the binding's cases
|
|
1106
1119
|
against whatever driver pairs with the code it prints: pair, a wrong or used code, ping, a quiet minute, a redial
|
|
1107
1120
|
after each close it must redial after (4408, 1000, 1001, 4409) and after a drop, a binary frame (1003), a frame over
|
|
@@ -1683,13 +1696,37 @@ reads of the login. A model named on a gateway or OpenRouter keeps its key, and
|
|
|
1683
1696
|
`model_key`. With no key at all, claude-agent's default
|
|
1684
1697
|
model is `anthropic/claude-sonnet-5-5`. A run whose login is signed out fails at its start and says so. A status check
|
|
1685
1698
|
the CLI outlasts (15 s) is asked once more; still no answer, the run goes on when the same login read signed in within
|
|
1686
|
-
the last 10 minutes
|
|
1699
|
+
the last 10 minutes on this machine (at a run's check or in Settings, in the server or in a runner process of its own on
|
|
1700
|
+
the same data folder, which keeps that time alone per login in `claude-login-answers/`, 0600), else it fails saying the
|
|
1701
|
+
check timed out. Being on disk, a signed-in answer outlives a restart of the server, and a turn-off and turn-on, for up to
|
|
1702
|
+
those 10 minutes; a signed-out answer removes it, and a new machine id (`machine-id` made again) leaves it standing for
|
|
1703
|
+
nothing.
|
|
1687
1704
|
A check where the CLI answered nothing that reads as a status gets the same. Any other failure of the check, such as no CLI at
|
|
1688
1705
|
its path, fails the run at once in the check's own words. It never switches to a key. The run books its tokens and no dollars (`cost.plan`, `on: "claude_code"`), and the plan's own limits
|
|
1689
1706
|
apply. Only a run in a runner place, on the machine the mode was turned on for, goes on the login. A run placed in a
|
|
1690
|
-
sandbox, or on another machine, uses the keys. The login is the server's user's
|
|
1691
|
-
|
|
1692
|
-
|
|
1707
|
+
sandbox, or on another machine, uses the keys. The login is the server's user's. Where each run is a user of its own
|
|
1708
|
+
(the image, `run_isolation: "uid"`), a run on AgentRun's own login folder gets the login's access token alone in
|
|
1709
|
+
`CLAUDE_CODE_OAUTH_TOKEN`: never the folder and never the refresh token, so its CLI never renews the login. The runner
|
|
1710
|
+
reads the token from the folder at the run's start and again whenever Anthropic refuses it mid-run, so a renewal the
|
|
1711
|
+
person's own Claude Code wrote there is picked up. The runner renews the login itself, in the CLI's place: when a token
|
|
1712
|
+
has less than five minutes left, and after Anthropic refuses one mid-run. It sends the pinned CLI's own refresh request,
|
|
1713
|
+
holds the CLI's own refresh lock on the folder (so a renewal by the CLI or another runner is taken and nothing is sent
|
|
1714
|
+
twice), and writes the answer back to the folder's `.credentials.json` alone, atomically at mode 0600, every other field
|
|
1715
|
+
kept. It holds that lock as the CLI does, by the mtime it set: a lock another holder took over while the runner was
|
|
1716
|
+
paused is never touched or removed, and the runner sends nothing under it. If the write back fails, the runner keeps the
|
|
1717
|
+
new pair in memory: each later ask gets its token, sends nothing (the old refresh token is spent and is never sent
|
|
1718
|
+
again) and tries the write again, under the same refresh lock and after reading the file again, so a newer pair another
|
|
1719
|
+
holder wrote there is kept. Once that token has less than five minutes left and is still unsaved, the run fails
|
|
1720
|
+
in words that say the renewal could not be saved and what to fix. A held token Anthropic refuses is never handed again:
|
|
1721
|
+
the ask fails while the pair is unsaved, and once it is saved the runner renews from it. One ask sends at most one renewal and nothing retries it. A renewal that fails, a refresh token Anthropic refused
|
|
1722
|
+
included, fails the run at its start in words that say to open Claude Code once to renew it, and mid-run ends the turn
|
|
1723
|
+
in the same words (or, with no failure to tell, words that say to run the claude CLI once on this login to renew it).
|
|
1724
|
+
No token is in the runner's log or in any error, and each token handed is cut from the run's journal, messages and rows
|
|
1725
|
+
as the runner writes them. A command the run's CLI starts can read the token,
|
|
1726
|
+
as the run's own user can. Under per-run users, a run on this machine's own Claude Code login (`~/.claude`, or the `CLAUDE_CONFIG_DIR` AgentRun was started with) fails at its
|
|
1727
|
+
claim and says so, and so does any login run while another runner on the same data folder runs its login runs under
|
|
1728
|
+
the server's user (its CLI renews the folder's login itself), naming that runner. Set `AGENTRUN_RUN_USER=same`, or give
|
|
1729
|
+
the run a `model_key`.
|
|
1693
1730
|
|
|
1694
1731
|
The mode exists only on a server that listens on loopback (a local install, or one behind a local proxy). A server
|
|
1695
1732
|
bound to any other address, such as all interfaces in a container or on a hosting service, has it off
|
|
@@ -3395,7 +3432,7 @@ failed, 2 when nothing ran. The runner, the graders and the report are in
|
|
|
3395
3432
|
| `DELETE /runs/{id}` | This server's own route (`x-agentrun-serve: "purge/1"`): [purges](#purging-a-run-or-an-agent-made-here) a run that is not live, its cost kept in every total. `204`, again on a second `DELETE`; a live run is `409 run_not_final`, and every route of a purged run is `410 purged`. |
|
|
3396
3433
|
| `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. |
|
|
3397
3434
|
| `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. |
|
|
3398
|
-
| `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`. |
|
|
3435
|
+
| `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, `source=<name>` (`runsource/1`, once per request) keeps the runs imported from that source (its name as `imported_from.source` holds it: `claude-code`, `codex`, ...) and `source=live` the runs made here, not imported, and `archived=true` lists only archived ones. A failed run's summary carries its `error`, and a waiting run's its `pending`. |
|
|
3399
3436
|
| `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` `reported`, `estimate` or `unpriced`, with its model requests' `tokens`: [A run's cost](#a-runs-cost-its-tokens-and-its-basis); $0 before its first model request, a cancelled run's included). |
|
|
3400
3437
|
| `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. Beside the rows, `in_flight`: what a live run waits on now, each model request sent and not answered (from its booking's `runner.request`, stamped `at` when it left) and each tool call not returned, from when it was sent; empty once the run is final. A request sent or answered is a change of the page, as a row is. |
|
|
3401
3438
|
| `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 run of an agent [being deleted](#deleting-an-agent-another-system-owns), `409 agent_not_runnable`); a workflow run takes none (`501`). |
|
|
@@ -3589,26 +3626,20 @@ serves these routes alone:
|
|
|
3589
3626
|
|
|
3590
3627
|
The names route above is the listing: there is no list or read of a server's address, auth or tools here. The
|
|
3591
3628
|
generic save (`PUT /settings/mcp-servers/{name}`) is a `404` unless the operator names the MCP origins it may save at,
|
|
3592
|
-
so by default the token saves no server at an address or with headers of its own. The preview, refresh, sign-in,
|
|
3593
|
-
|
|
3594
|
-
way;
|
|
3595
|
-
- a per_run MCP server's save at an origin the operator names
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
an agent's save and at the next call of a run already going, and nothing is sent to it. Unset, the list is empty, so
|
|
3607
|
-
a per_run server the token saved with API-only off is refused until its origin is listed: list it before upgrading,
|
|
3608
|
-
or re-save it from the owner's signed-in session with API-only off, which makes it the owner's and leaves the save
|
|
3609
|
-
closed. The start logs one line (`api_only_mcp_off_list`) with the count and names of the servers off the list,
|
|
3610
|
-
never their addresses, and nothing when there are none. A server saved from the owner's signed-in session (which an
|
|
3611
|
-
API-only server doesn't serve) is the owner's, whenever it was saved, and the list does not govern it;
|
|
3629
|
+
so by default the token saves no server at an address or with headers of its own. The preview, refresh, sign-in,
|
|
3630
|
+
Composio tool listing and every other MCP settings route stay refused. On the full server the token's `api_key_env`
|
|
3631
|
+
is `403`, as `api_key` is: the owner's session saves a Composio server there either way;
|
|
3632
|
+
- a per_run MCP server's save at an origin the operator names: `AGENTRUN_API_ONLY_MCP_ORIGINS`, comma-separated
|
|
3633
|
+
http(s) origins (`https://mcp.example.com`), a plain setting. With it, the token's `PUT /settings/mcp-servers/{name}`
|
|
3634
|
+
saves `"auth": {"type": "per_run"}` at a listed origin, and each run hands its own credential in `mcp_auth`. A body
|
|
3635
|
+
that carries a credential, or a save over a server the token did not save or one that seals a credential, is `403`;
|
|
3636
|
+
any other origin or auth type, or a Composio server's name, is `404`. A wildcard or an entry that is not an http(s)
|
|
3637
|
+
origin alone stops the start, and a loopback origin also needs `AGENTRUN_MCP_ALLOW_LOOPBACK=1`. The list holds past
|
|
3638
|
+
the save: a per_run server the token saved at an origin not listed is refused, and nothing is sent to it. Unset, the
|
|
3639
|
+
list is empty, so on an upgrade list each such server's origin first, or re-save it from the owner's signed-in
|
|
3640
|
+
session with API-only off; the start names the servers off the list in one log line (`api_only_mcp_off_list`), never
|
|
3641
|
+
their addresses. A server the owner's session saved is not governed by the list, and its runs' `mcp_auth` still
|
|
3642
|
+
goes there;
|
|
3612
3643
|
- a run's desktop or phone, for a backend that shows its user the live view and lets them take over: see below.
|
|
3613
3644
|
|
|
3614
3645
|
Here a run's computer routes take the server's token. `POST /runs/{id}/computer/viewer` mints a 5-minute link on
|
package/dist/api-only.d.ts
CHANGED
|
@@ -27,10 +27,8 @@ import type { Route } from "./server.js";
|
|
|
27
27
|
* its key by api_key_env (COMPOSIO_API_KEY, on the launcher's list of secrets, read at each use through secrets.ts
|
|
28
28
|
* secret, sent to Composio's origin alone: composio-made.ts composioEnvKey), and its body names no address or headers.
|
|
29
29
|
* There is no list or read of the servers here (listMcpServerNames above is the listing). The generic save
|
|
30
|
-
* (saveMcpServer) is
|
|
31
|
-
*
|
|
32
|
-
* any other route, so the token saves no server at an address or with headers of its own. Previews, refreshes,
|
|
33
|
-
* sign-ins and Composio's triggers stay refused;
|
|
30
|
+
* (saveMcpServer) is apiOnlyMcpSave: the serve README's API-only section states it. Previews, refreshes, sign-ins
|
|
31
|
+
* and Composio's triggers stay refused;
|
|
34
32
|
* - the launch hook's host (the backend in front of this server) releases a firing it took and will start no run for
|
|
35
33
|
* (releaseTriggerFiring, triggers.ts release), so its trigger's room frees at once; with no launch hook the route is
|
|
36
34
|
* the route's own 422. */
|
package/dist/api-only.js
CHANGED
|
@@ -34,10 +34,8 @@ import { LAUNCH_HOOK_SECRET_ENV, LAUNCH_HOOK_URL_ENV } from "./trigger-launch-ho
|
|
|
34
34
|
* its key by api_key_env (COMPOSIO_API_KEY, on the launcher's list of secrets, read at each use through secrets.ts
|
|
35
35
|
* secret, sent to Composio's origin alone: composio-made.ts composioEnvKey), and its body names no address or headers.
|
|
36
36
|
* There is no list or read of the servers here (listMcpServerNames above is the listing). The generic save
|
|
37
|
-
* (saveMcpServer) is
|
|
38
|
-
*
|
|
39
|
-
* any other route, so the token saves no server at an address or with headers of its own. Previews, refreshes,
|
|
40
|
-
* sign-ins and Composio's triggers stay refused;
|
|
37
|
+
* (saveMcpServer) is apiOnlyMcpSave: the serve README's API-only section states it. Previews, refreshes, sign-ins
|
|
38
|
+
* and Composio's triggers stay refused;
|
|
41
39
|
* - the launch hook's host (the backend in front of this server) releases a firing it took and will start no run for
|
|
42
40
|
* (releaseTriggerFiring, triggers.ts release), so its trigger's room frees at once; with no launch hook the route is
|
|
43
41
|
* the route's own 422. */
|
package/dist/box-paths.d.ts
CHANGED
|
@@ -33,9 +33,10 @@ export declare function remoteDockerOnce(env: NodeJS.ProcessEnv): Promise<string
|
|
|
33
33
|
/** Why this server can't run a Docker computer, or undefined when it can: on its Docker's own host (`here`), or in a
|
|
34
34
|
* container of that Docker's with its data on a named volume (`paths`: the computer mounts the run's folder and its
|
|
35
35
|
* daemon as that volume's subpaths, workspace/computer-deps.ts dockerVolumeOf). Any other layout says why (`reason`,
|
|
36
|
-
* dockerPathsOf), and so does a daemon of another machine (`remote`, remoteDockerOf's endpoint)
|
|
37
|
-
*
|
|
38
|
-
|
|
36
|
+
* dockerPathsOf), and so does a daemon of another machine (`remote`, remoteDockerOf's endpoint), and then a computerd
|
|
37
|
+
* build missing for Docker's architecture (`noDaemon`: the computer package's dockerDaemonOf words, the ones its
|
|
38
|
+
* create() would fail with). The one check every reader of Docker's offer takes. */
|
|
39
|
+
export declare function dockerComputerRefusal(paths: DockerPaths, remote: string | undefined, noDaemon?: string): string | undefined;
|
|
39
40
|
/** Where a runner's Docker has the data directory `data`, read once by the runner that makes a Docker computer: as the
|
|
40
41
|
* server reads it at its start (dockerPathsOf), on Linux alone; under `--faux` from the mountinfo file the tests name
|
|
41
42
|
* (FAUX_MOUNTINFO_ENV), else as a host. */
|
package/dist/box-paths.js
CHANGED
|
@@ -74,12 +74,15 @@ export function remoteDockerOnce(env) {
|
|
|
74
74
|
/** Why this server can't run a Docker computer, or undefined when it can: on its Docker's own host (`here`), or in a
|
|
75
75
|
* container of that Docker's with its data on a named volume (`paths`: the computer mounts the run's folder and its
|
|
76
76
|
* daemon as that volume's subpaths, workspace/computer-deps.ts dockerVolumeOf). Any other layout says why (`reason`,
|
|
77
|
-
* dockerPathsOf), and so does a daemon of another machine (`remote`, remoteDockerOf's endpoint)
|
|
78
|
-
*
|
|
79
|
-
|
|
77
|
+
* dockerPathsOf), and so does a daemon of another machine (`remote`, remoteDockerOf's endpoint), and then a computerd
|
|
78
|
+
* build missing for Docker's architecture (`noDaemon`: the computer package's dockerDaemonOf words, the ones its
|
|
79
|
+
* create() would fail with). The one check every reader of Docker's offer takes. */
|
|
80
|
+
export function dockerComputerRefusal(paths, remote, noDaemon) {
|
|
80
81
|
if ("reason" in paths)
|
|
81
82
|
return paths.reason;
|
|
82
|
-
|
|
83
|
+
if (remote !== undefined)
|
|
84
|
+
return remoteDockerWords(remote);
|
|
85
|
+
return noDaemon === undefined ? undefined : `${noDaemon}, then restart AgentRun`;
|
|
83
86
|
}
|
|
84
87
|
/** Where a runner's Docker has the data directory `data`, read once by the runner that makes a Docker computer: as the
|
|
85
88
|
* server reads it at its start (dockerPathsOf), on Linux alone; under `--faux` from the mountinfo file the tests name
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import type { ClaudeAgentLogin, ClaudeLoginToken } from "@parcha/agentrun-harness-claude";
|
|
2
|
+
import type { Runners } from "./store/index.js";
|
|
3
|
+
/** The pinned CLI's credentials file in its credentials directory (CLAUDE_SECURESTORAGE_CONFIG_DIR). */
|
|
4
|
+
export declare const LOGIN_FILE = ".credentials.json";
|
|
5
|
+
/** The least a token handed to a run has left: the pinned CLI's own margin before it calls a token expired (its
|
|
6
|
+
* `n+300000>=e`), and when the runner renews it. */
|
|
7
|
+
export declare const LOGIN_MARGIN_MS: number;
|
|
8
|
+
/** The longest one renewal request may take: the runner gives it up then (chatgpt-plan.ts's own). */
|
|
9
|
+
export declare const REFRESH_CALL_MS = 15000;
|
|
10
|
+
/** How long an ask waits while another holder (the CLI, another runner) holds the login's refresh lock: the CLI's own
|
|
11
|
+
* request timeout (30 s) and its write back. Then it refuses, having posted nothing. */
|
|
12
|
+
export declare const LOCK_WAIT_MS = 35000;
|
|
13
|
+
/** The words a run gets when the login's token has less than the margin left and the runner could not renew it. */
|
|
14
|
+
export declare const LOGIN_RUNNING_OUT = "Claude Code's login on this machine runs out in less than 5 minutes, and the runner could not renew it: open Claude Code on this login once to renew it, or sign in again under Settings \u2192 Model keys, then start the run again.";
|
|
15
|
+
/** The words a run gets when Anthropic refused the login's token (the run's CLI's 401), whatever time it had left, and
|
|
16
|
+
* the runner could not renew it. */
|
|
17
|
+
export declare const LOGIN_REFUSED_NOT_RENEWED = "Claude refused this login and it could not be renewed; open Claude Code once to sign in again.";
|
|
18
|
+
/** The words a run gets when the runner renewed the login but could not write the renewal to the login's file, and the
|
|
19
|
+
* renewed token it holds in memory has less than the margin left: Anthropic took the file's refresh token, so only that
|
|
20
|
+
* held pair can be renewed, and the runner renews only from the file. */
|
|
21
|
+
export declare const LOGIN_NOT_SAVED = "Claude Code's login on this machine was renewed, but the runner could not save the renewal to the login's file, and the renewed token runs out in less than 5 minutes: make room on the disk (or fix the login folder's permissions) and start the run again; if the runner restarted meanwhile, sign in again under Settings \u2192 Model keys.";
|
|
22
|
+
/** The words a run gets when the login is kept in a form this runner does not read (not the pinned CLI's plaintext file). */
|
|
23
|
+
export declare const LOGIN_SEALED = "Claude Code's login on this machine is kept in a form this runner cannot hand to a run of its own user: set AGENTRUN_RUN_USER=same, or give the run a model_key.";
|
|
24
|
+
/** What a renewal hands back: the token it got and its end, for the one ask whose re-read still finds the old token (a
|
|
25
|
+
* write back that did not land); the file's own read wins otherwise. */
|
|
26
|
+
export type Renewed = {
|
|
27
|
+
readonly access: string;
|
|
28
|
+
readonly expiresAt: number;
|
|
29
|
+
};
|
|
30
|
+
/** Renews `login` in its own file, the one whose access token was read as `seen`, unless the file holds another by then
|
|
31
|
+
* (another holder renewed it: nothing to do). Throws when it could not. `refused`: the token Anthropic refused (the
|
|
32
|
+
* run's CLI's 401), when there is one: a held pair holding it is renewed once saved, never handed again. */
|
|
33
|
+
export type Renew = (login: ClaudeAgentLogin, seen: string, refused?: string) => Promise<Renewed | undefined>;
|
|
34
|
+
export interface LoginTokensOptions {
|
|
35
|
+
/** The login's directories (claude-login.ts loginAt): its file is LOGIN_FILE in `dir`. */
|
|
36
|
+
readonly login: ClaudeAgentLogin;
|
|
37
|
+
readonly now?: () => number;
|
|
38
|
+
/** The renewal. Default: the pinned CLI's own (renewLogin), with `fetch`, `now` and `log` below. */
|
|
39
|
+
readonly renew?: Renew;
|
|
40
|
+
/** What the default renewal posts with (a test's fake endpoint). Default: the global fetch, as it is at the post. */
|
|
41
|
+
readonly fetch?: typeof fetch;
|
|
42
|
+
/** Told each renewal's outcome, in fields that hold no token. */
|
|
43
|
+
readonly log?: (fields: Record<string, string>) => void;
|
|
44
|
+
}
|
|
45
|
+
/** The runner's reader of one login's access token, and its renewer. */
|
|
46
|
+
export declare class LoginTokens {
|
|
47
|
+
#private;
|
|
48
|
+
constructor(options: LoginTokensOptions);
|
|
49
|
+
/** Tells `listener` each token as it is handed, for a redactor. */
|
|
50
|
+
watch(listener: (tokens: string[]) => void): void;
|
|
51
|
+
/** The login's access token, read from its file now, with at least LOGIN_MARGIN_MS left: renewed first (once) when
|
|
52
|
+
* it has less, or when Anthropic refused it (refused). Else it throws in words (signed out, a form not read here, or
|
|
53
|
+
* near its end and not renewed), never with a value of the file in them. */
|
|
54
|
+
token(): Promise<string>;
|
|
55
|
+
/** Anthropic refused `sent` (the run's CLI's 401): the next ask renews it, unless the file holds another token by
|
|
56
|
+
* then (another holder renewed it, and that one is handed). */
|
|
57
|
+
refused(sent: string): Promise<void>;
|
|
58
|
+
}
|
|
59
|
+
export interface RenewLoginOptions {
|
|
60
|
+
/** What it posts with. Default: the global fetch, as it is at the post. */
|
|
61
|
+
readonly fetch?: typeof fetch;
|
|
62
|
+
/** The clock a renewed token's end is counted on (the reader's). A lock's age is the wall clock's, as the CLI's. */
|
|
63
|
+
readonly now?: () => number;
|
|
64
|
+
readonly log?: (fields: Record<string, string>) => void;
|
|
65
|
+
/** Default REFRESH_CALL_MS. */
|
|
66
|
+
readonly callMs?: number;
|
|
67
|
+
/** Default LOCK_WAIT_MS. */
|
|
68
|
+
readonly lockWaitMs?: number;
|
|
69
|
+
/** The refresh locks' file operations. Default: fs/promises' own. */
|
|
70
|
+
readonly lockFs?: LockFs;
|
|
71
|
+
/** How often a held lock is read and touched (its heartbeat). Default: the pinned CLI's (`update:5000`). */
|
|
72
|
+
readonly lockUpdateMs?: number;
|
|
73
|
+
}
|
|
74
|
+
/** The pinned CLI's renewal of a login (the adapter's login-refresh.ts), as the runner does it in the CLI's place. */
|
|
75
|
+
export declare function renewLogin(options?: RenewLoginOptions): Renew;
|
|
76
|
+
/** The file operations a refresh lock is taken, touched and released with: fs/promises' own, or a test's that watches
|
|
77
|
+
* or pauses them (RenewLoginOptions.lockFs). */
|
|
78
|
+
export interface LockFs {
|
|
79
|
+
mkdir(path: string): Promise<unknown>;
|
|
80
|
+
stat(path: string): Promise<LockIdentity>;
|
|
81
|
+
utimes(path: string, atime: Date, mtime: Date): Promise<void>;
|
|
82
|
+
rm(path: string, options: {
|
|
83
|
+
readonly recursive: boolean;
|
|
84
|
+
readonly force: boolean;
|
|
85
|
+
}): Promise<void>;
|
|
86
|
+
}
|
|
87
|
+
/** A lock directory as read: which directory it is (its device and inode) and its mtime. */
|
|
88
|
+
type LockIdentity = {
|
|
89
|
+
readonly dev: number;
|
|
90
|
+
readonly ino: number;
|
|
91
|
+
readonly mtimeMs: number;
|
|
92
|
+
};
|
|
93
|
+
/** Whether `login` is AgentRun's own login folder in `data` (claude-login.ts loginAt "agentrun"), the one login a run
|
|
94
|
+
* under a user of its own is handed a token of; this machine's own Claude Code login is not. */
|
|
95
|
+
export declare const agentRunLogin: (login: ClaudeAgentLogin, data: string) => boolean;
|
|
96
|
+
export declare function loginTokensFor(login: ClaudeAgentLogin): LoginTokens;
|
|
97
|
+
/** The words a run's claim is refused in by its runner (held.ts claudeLogin) when the claim goes on a login the runner
|
|
98
|
+
* hands no reader of to a run's own process: one not on AgentRun's own login folder. */
|
|
99
|
+
export declare const LOGIN_NOT_HANDED = "This run's runner handed it no Claude Code login: it runs each run as a user of its own and hands such a run only AgentRun's own login folder's token. Switch to that folder under Settings \u2192 Model keys, set AGENTRUN_RUN_USER=same, or give the run a model_key.";
|
|
100
|
+
/** A run's own process's login (held.ts claudeLogin's reader): each token it reads held by `hold` (the run's redactors)
|
|
101
|
+
* and this process's own (secrets.ts holdSecret) before the run's CLI is handed it, and a token Anthropic refused told
|
|
102
|
+
* to the runner, which renews it at the next ask. */
|
|
103
|
+
export declare function heldTokenLogin(reader: {
|
|
104
|
+
token(): Promise<string>;
|
|
105
|
+
refused?(sent: string): Promise<void>;
|
|
106
|
+
}, hold: (values: string[]) => void): ClaudeLoginToken;
|
|
107
|
+
/** Where the runners on a data folder say whether their runs on the login stay in their own process: one file per
|
|
108
|
+
* runner, named by the sha256 of its whole name, so two names never share a file and no name is a folder (`.`,
|
|
109
|
+
* `..`). The file holds the name itself, which loginRunnerInProcess reads. */
|
|
110
|
+
export declare const loginRunnersDir: (data: string) => string;
|
|
111
|
+
/** Runner `runner` says, at its start, how its runs on the login run: `process` (in its own process, its CLI on the
|
|
112
|
+
* login folder), or `uid` (each a user of its own, on a token), which takes back what an earlier start of that name said. */
|
|
113
|
+
export declare function sayLoginRunner(data: string, runner: string, isolation: "uid" | "process"): void;
|
|
114
|
+
/** The name of a runner on data folder `data` whose runs on the login stay in its own process, and whose word in the
|
|
115
|
+
* store is fresh (presence.ts); none when there is no such runner. */
|
|
116
|
+
export declare function loginRunnerInProcess(data: string, runners: Pick<Runners, "live">): Promise<string | undefined>;
|
|
117
|
+
export {};
|