@parcha/agentrun-serve 0.1.0-beta.32 → 0.1.0-beta.33
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 +37 -0
- package/README.md +78 -46
- package/dist/adapters.d.ts +0 -3
- package/dist/adapters.js +0 -7
- package/dist/agents.d.ts +1 -1
- package/dist/api-only.d.ts +14 -0
- package/dist/api-only.js +33 -0
- package/dist/archil-routes.d.ts +1 -1
- package/dist/box-egress-vm.d.ts +0 -8
- package/dist/box-egress-vm.js +0 -10
- package/dist/box-egress.d.ts +0 -4
- package/dist/box-egress.js +1 -16
- package/dist/box-paths.d.ts +25 -2
- package/dist/box-paths.js +79 -11
- package/dist/box-relay.d.ts +0 -11
- package/dist/box-relay.js +0 -20
- package/dist/box-settings.d.ts +46 -0
- package/dist/box-settings.js +107 -0
- package/dist/boxes.d.ts +4 -1
- package/dist/browser-cost.js +2 -1
- package/dist/browser-person.d.ts +0 -2
- package/dist/browser-person.js +0 -2
- package/dist/budget.d.ts +0 -4
- package/dist/budget.js +0 -7
- package/dist/cap.d.ts +0 -7
- package/dist/cap.js +0 -22
- package/dist/cli.js +23 -8
- package/dist/computers.d.ts +1 -1
- package/dist/console/assets/index-Dn0ngwG9.js +535 -0
- package/dist/console/assets/index-DvW6Aled.css +1 -0
- package/dist/console/index.html +2 -2
- package/dist/daytona-api.d.ts +0 -11
- package/dist/daytona-api.js +1 -82
- package/dist/docker-host-addresses.d.ts +37 -0
- package/dist/docker-host-addresses.js +110 -0
- package/dist/files.d.ts +0 -8
- package/dist/files.js +0 -17
- package/dist/github-connection.d.ts +1 -1
- package/dist/github-connection.js +1 -1
- package/dist/harness-install.d.ts +23 -0
- package/dist/harness-install.js +99 -4
- package/dist/harness.d.ts +4 -3
- package/dist/harness.js +16 -1
- package/dist/import.js +52 -13
- package/dist/learn/secrets.d.ts +2 -1
- package/dist/learn/secrets.js +19 -6
- package/dist/learned-workflow.d.ts +5 -4
- package/dist/learned-workflow.js +6 -3
- package/dist/learning-routes.d.ts +9 -46
- package/dist/learning-routes.js +25 -29
- package/dist/learning-run.d.ts +4 -231
- package/dist/learning-run.js +7 -651
- package/dist/live/translate.js +1 -1
- package/dist/mcp-gateway.d.ts +0 -3
- package/dist/mcp-gateway.js +0 -13
- package/dist/mcp-probe.d.ts +2 -2
- package/dist/mcp-probe.js +2 -2
- package/dist/mcp-servers-store.js +1 -1
- package/dist/openapi.js +3 -3
- package/dist/page.js +3 -1
- package/dist/paid-calls.js +3 -2
- package/dist/pause.d.ts +0 -2
- package/dist/pause.js +1 -8
- package/dist/place.d.ts +0 -5
- package/dist/place.js +0 -10
- package/dist/print.d.ts +2 -1
- package/dist/print.js +4 -2
- package/dist/run-db.d.ts +0 -2
- package/dist/run-db.js +0 -4
- package/dist/run-learning-served.d.ts +38 -0
- package/dist/run-learning-served.js +9 -0
- package/dist/run-secrets.d.ts +33 -0
- package/dist/run-secrets.js +53 -0
- package/dist/run-timeline-served.js +5 -2
- package/dist/run-view.d.ts +5 -9
- package/dist/run-view.js +4 -22
- package/dist/runner/adapter-loop.d.ts +8 -2
- package/dist/runner/adapter-loop.js +44 -12
- package/dist/runner/adapter-run-spec.d.ts +8 -0
- package/dist/runner/adapter-run-spec.js +6 -5
- package/dist/runner/adapters/pi.d.ts +4 -0
- package/dist/runner/adapters/pi.js +4 -1
- package/dist/runner/beside.js +19 -8
- package/dist/runner/claim-secrets.js +1 -1
- package/dist/runner/cli-run-spec.js +15 -1
- package/dist/runner/journal-kinds.d.ts +6 -0
- package/dist/runner/live-ticker.d.ts +1 -1
- package/dist/runner/live-ticker.js +28 -4
- package/dist/runner/loop-contract.d.ts +3 -2
- package/dist/runner/main.d.ts +11 -4
- package/dist/runner/main.js +39 -10
- package/dist/runner/mcp-claim.d.ts +1 -1
- package/dist/runner/mcp-claim.js +1 -1
- package/dist/runner/model-route.js +21 -2
- package/dist/runner/redact.d.ts +8 -2
- package/dist/runner/redact.js +11 -2
- package/dist/runner/workflow-spec.js +5 -9
- package/dist/runs-over-store.d.ts +1 -1
- package/dist/runs-over-store.js +16 -5
- package/dist/seal-key.d.ts +54 -15
- package/dist/seal-key.js +272 -84
- package/dist/sealed-settings.d.ts +2 -2
- package/dist/sealed-settings.js +3 -10
- package/dist/secrets.d.ts +2 -10
- package/dist/secrets.js +21 -17
- package/dist/server-secrets-store.js +1 -1
- package/dist/server-secrets.js +3 -0
- package/dist/server.d.ts +10 -6
- package/dist/server.js +89 -41
- package/dist/store/index.d.ts +1 -1
- package/dist/store/index.js +1 -1
- package/dist/store/open.d.ts +12 -2
- package/dist/store/open.js +23 -3
- package/dist/store/postgres/migrate.js +18 -1
- package/dist/store/sqlite/store.js +23 -8
- package/dist/store/store.d.ts +3 -0
- package/dist/store-reads/journal.d.ts +16 -0
- package/dist/store-reads/journal.js +82 -6
- package/dist/store-view.js +38 -5
- package/dist/tool-keys.d.ts +4 -3
- package/dist/tool-keys.js +7 -4
- package/dist/tools.d.ts +1 -1
- package/dist/tools.js +4 -1
- package/dist/trigger-schedule.js +2 -1
- package/dist/trigger-secrets-shown.js +5 -1
- package/dist/workspace/computer-deps.d.ts +29 -0
- package/dist/workspace/computer-deps.js +48 -1
- package/dist/workspace/computer-for-claim.d.ts +7 -3
- package/dist/workspace/computer-for-claim.js +1 -1
- package/dist/workspace/computer-providers.d.ts +6 -2
- package/dist/workspace/computer-providers.js +1 -1
- package/dist/workspace/index.d.ts +1 -1
- package/dist/workspace/index.js +1 -1
- package/dist/workspace.d.ts +0 -3
- package/dist/workspace.js +0 -3
- package/launcher/agentrun-serve +6 -33
- package/package.json +14 -14
- package/templates/inbound-lead/agent.md +1 -1
- package/templates/kyb/agent.md +1 -1
- package/dist/app.d.ts +0 -5
- package/dist/app.js +0 -514
- package/dist/bounds.d.ts +0 -26
- package/dist/bounds.js +0 -137
- package/dist/console/assets/index-35-7aeIZ.js +0 -519
- package/dist/console/assets/index-Cejbov-Y.css +0 -1
- package/dist/content-filter.d.ts +0 -7
- package/dist/content-filter.js +0 -23
- package/dist/disk.d.ts +0 -33
- package/dist/disk.js +0 -85
- package/dist/door-line.d.ts +0 -23
- package/dist/door-line.js +0 -83
- package/dist/harness-app.d.ts +0 -69
- package/dist/harness-app.js +0 -1162
- package/dist/request-start.d.ts +0 -27
- package/dist/request-start.js +0 -381
- package/dist/run-box.d.ts +0 -205
- package/dist/run-box.js +0 -661
- package/dist/run-holder.d.ts +0 -52
- package/dist/run-holder.js +0 -139
- package/dist/runs.d.ts +0 -1200
- package/dist/runs.js +0 -4103
- package/dist/served-only.d.ts +0 -5
- package/dist/served-only.js +0 -12
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,43 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## 0.1.0-beta.33 (2026-11-10)
|
|
6
|
+
|
|
7
|
+
- The console's Keys page shows each provider's own icon beside its name, in place of a key icon. The icon comes from Google's favicon service (`www.google.com/s2/favicons`, which redirects to `t0`-`t3.gstatic.com`), so the console now loads one thing from the network, and the page's Content-Security-Policy `img-src` allows those five hosts. The request names the provider's public site and carries no referrer and no cookie of the server's; Google sees the browser's address and which providers the page lists. Offline, or with those hosts blocked, a provider shows its bundled mark (Anthropic, OpenRouter) or the key icon. To keep the console from asking, block those hosts.
|
|
8
|
+
- `AGENTRUN_STORE_POOL_SIZE` sets how many connections the server's and each runner's Postgres store holds at once (default 10, as before). It takes a whole number from 1 to 1000; any other value stops the server or runner at start with a message naming the setting, its range and the value given. `deploy/README.md` lists it with the other store settings.
|
|
9
|
+
- Template Apply fixes from QA on the release:
|
|
10
|
+
- `kyb`'s risk appetite and `inbound-lead`'s destination take their documented defaults when left out (medium; none), so Apply shows "medium (default)" and "none (default)" instead of refusing them as required.
|
|
11
|
+
- The owner's first apply answer, which shows each webhook trigger's signing secret, no longer also says the secret is not shown. An API token's answer, or a retry, still says where to get it.
|
|
12
|
+
- A run parked at its spend cap no longer shows a "Model request failed: 400 {…agentrun_proxy…}" row in its Timeline. The model proxy refused that request before it was sent, and the park's row already says what happened. That refused request also no longer counts as a model request in the run's usage line.
|
|
13
|
+
|
|
14
|
+
The cap's refusal now carries its code through to the proxy as a field: the runner's `Refusal.code`, then `HarnessRunError.refusal`. The proxy writes `code: "spend_cap_reached"` in its refusal body. The Timeline matches on that code and `type: "agentrun_proxy"`, never on the words. Every other model failure, a provider's 400 included, keeps its row.
|
|
15
|
+
- Docker sandboxes run from a server in a container, as compose.yaml starts it, on Docker Engine 26 or later. The run's folder and the sandbox's daemon (copied under the data volume, at `.agentrun/computerd`) mount as the named data volume's subpaths, and the sandbox's egress proxy refuses the Docker host's own addresses: the server reads them once at its start through the socket (one short-lived container on the host's network, as nobody, from the proxy's own image, with `host.docker.internal` for Docker Desktop and OrbStack) and adds `AGENTRUN_DOCKER_HOST_ADDRESSES` (a comma list of IP addresses, for a NAT'd or elastic public address no interface shows), shown in capabilities' docker entry as `host_addresses`. With none known under an allow-list, or a layout with no named data volume, or a daemon of another machine (named by `DOCKER_HOST` or the current Docker context), docker is unavailable at the start in words that say why, so an agent that names a Docker computer is refused at its run's start instead of failing at create.
|
|
16
|
+
- The server image has `agentrun-serve` on its PATH, so the sign-in page's "Forgot it?" command (`agentrun-serve reset-password --data /data`)
|
|
17
|
+
works as written in the image's shell, Render's Shell included. Before, it answered "command not found" (#2225).
|
|
18
|
+
- A learned workflow's call nodes never run a tool on a default of allow: its run must give the tool policy (and where each setting came from) that its call nodes are held to, and one given none runs nothing and says so. Every caller passes one already. Upgrading: nothing to do.
|
|
19
|
+
- `GET /v2/runs/{id}/learning/diff` answers again (it answered `unsupported_here`, so a run's "What it changed" box said it couldn't read it). A run its learning merged reads its merge against its parent from the agent's learning folder; one whose proposal was not merged reads its notes as added against its seed; one that proposed nothing reads no file against its seed; a run that does not learn is 404. A patch holding a value saved as a secret is withheld, and a file named for one reads `[redacted]`.
|
|
20
|
+
- Upgrading: nothing to change.
|
|
21
|
+
- A run's live view no longer holds a secret the runner holds. The live view (the running tools with their arguments and the output they have streamed so far, and the answer still being written) was written as the run's tools and model produced it, so a tool that echoed a key, or an answer that quoted one, put it there in the clear, where the live stream a console watches served it.
|
|
22
|
+
- Every value of a run's live view is now cut with the run's one redactor before it is written: the same one its record's text goes through, holding the runner's secrets and every key the run's claim opened.
|
|
23
|
+
- Output still streaming and the answer still being written hold back a tail as long as a held key's widest form, so a key paused halfway at a write shows none of itself; the settled record replaces it once it ends. A tool argument that is a held key written as a number is withheld, as is an argument object two of whose names would come out the same once cut.
|
|
24
|
+
- A run whose loop has no redactor, or one that does not know its values, has no live view at all, rather than an uncut one.
|
|
25
|
+
- Settings → Model keys names, for each key, the harnesses that key runs on this server, the same before and after another provider's key is saved. With Claude Code on an endpoint set where AgentRun starts (`ANTHROPIC_BASE_URL`), OpenRouter's key no longer lists Claude Code once Anthropic's key is saved: only Anthropic's own key runs it there.
|
|
26
|
+
- The server starts on a Postgres schema an administrator made ahead of time, with a role that owns that schema and has no `CREATE` on the database. At its start the server now makes the schema only when it is absent (Postgres refuses `CREATE SCHEMA IF NOT EXISTS` to a role without `CREATE` on the database even when the schema exists), then migrates it as before. On a schema that does not exist, such a role is refused at the start in words that name the schema and what to do: create the schema ahead of time, owned by the role, or grant the role `CREATE` on the database.
|
|
27
|
+
- A raised spend cap now holds for the rest of a run: a pi or CLI run paused at its cap and raised has its next model request admitted under the raised cap, on the runner that takes the raise and on any that takes the run over later, and a later pause names the raised cap. Before, the runner kept checking every request against the cap the run started with, so a raised run went on once and paused again at the old cap. A working run's raise holds from its next step (the step under way keeps the cap it was admitted at), and the raise's `note` says so. The run's `cost.cap_usd` and its budget card show the raised cap. A raise of a run a person stopped is refused in words (`not_continuable`: "This run was stopped: send it a message to go on, then raise its cap."), never a bare error.
|
|
28
|
+
- A one-time schedule set to a time already passed is refused in words a person reads, on its field: "Pick a time in the future: <time> has already passed.", never "at is in the past" (#2248). The API's 422 says it so, for the console and for SDK and CLI callers alike. The console's schedule form shows it on the time field and clears it as soon as a time ahead is picked.
|
|
29
|
+
- The seal key now lives with the data. With no `AGENTRUN_SEAL_KEY`, the server keeps its key in `seal/seal.key` in the data directory, beside the store (0600 in a 0700 directory), made at the first start, so a disk or volume carries its key with it; back the two up together. The store records the key's fingerprint, and the server, every runner and `import` check the key they hold against it: a store whose secrets were sealed with another key does not start ("this store's secrets were sealed with another key; hand the server the original AGENTRUN_SEAL_KEY"), and a lost key file is never replaced by a new key over saved secrets. On Postgres a second machine with another key refuses the same way. Only the server's start makes a key; a runner reads it and never makes one. The launcher no longer makes or reads a key under the config home, and nothing reads one there: set `AGENTRUN_SEAL_KEY` explicitly, the same in every process.
|
|
30
|
+
- A held secret is cut wherever a path tool's error names it: with its "." segments dropped (`a/./b` as `a/b`), as its "//" collapsed already was, and percent-encoded as a URL's path writes it, each cut in place, the error's own words kept. Before, a secret holding "/./" written with that segment dropped was not found at all, and a percent-encoded one was found but cut the whole text. Upgrading: nothing to do.
|
|
31
|
+
- A pi run on a translated route (OpenRouter, OpenAI and every other provider that doesn't speak Anthropic's Messages) now sends the model the images in a tool's result, so browser, desktop and phone screenshots reach it. Before, only the tool's text went and the images were dropped. On OpenRouter's chat completions each image goes as an attached image right after the tool's message, because a tool message there holds only text. On OpenAI's Responses API it goes in the call's output.
|
|
32
|
+
- A workflow whose model node names `browser` is refused when it is saved (422), in the words any node tool this server doesn't give is refused in, instead of being accepted and then failing at its run (#2098). Capabilities' `workflows.node_tools` no longer lists `browser`, and the browser tool's `nodes` reads false.
|
|
33
|
+
- A workflow's call and model nodes fail closed when the server's tool settings can't be read, as an agent's calls do: with no good read yet, every tool asks, so a call node is refused ("needs a person's approval, which a workflow's call node cannot wait for") instead of running on the revision's own allow over a deny the server holds; after a good read, that read is kept and its denies still refuse.
|
|
34
|
+
- `AGENTRUN_API_ONLY=1` makes the server serve the run routes alone, for a server behind its caller's backend: a run's launch, read, lists, timeline, messages, stop, cancel, kill and cap raise, its files and uploads, capabilities, health and usage. Every other address (the console at `/`, the store page's `/api/*`, sign-in, setup, settings, `/mcp`, triggers and their webhook hooks, agents, templates, the live views) is `404`, answered before the request is read further, and the server has no accounts. Off by default; a value other than `1`/`true` or `0`/`false` stops the start in words.
|
|
35
|
+
Under the profile the server opens no browser (`--open`), and `npx @parcha/agentrun` takes the API-only line in place of the console's `Open` line: it names the server's API (its `AGENTRUN_BASE_URL`), so it never stops a healthy API-only server for want of an `Open` line.
|
|
36
|
+
- The server no longer ships the old run engine. Every run already went through the runner and the one store, but the per-run process (`app.ts`, `harness-app.ts`, `request-start.ts`, `run-box.ts`) and the file-era run kernel (`runs.ts`) were still in the package, and nothing called them. Their tests are gone with them. What the runner and the server still read from them moved to its live home first: a run's secrets (`run-secrets.ts`), the claim refusal's words (`run-view.ts`) and the box settings the server checks at its start (`box-settings.ts`). Nothing a person or a model sees changes.
|
|
37
|
+
- A tool call refused before it ran now reads as refused in the run's Timeline, never as a call that ran and failed. This covers a tool set to deny on the server or the agent, and a call a person denied. The row reads "Refused: write deny.md: Permission denied: write is set to deny on this server…" instead of "Wrote deny.md failed: …". Every tool reads that way, named by what it would have acted on: a path, a command, a page, or the tool's name alone.
|
|
38
|
+
|
|
39
|
+
pi's adapter marks a refused call's result in its `details` with the new `CALL_REFUSED` key (from `@parcha/pi-durable-agent/timeline`). The model never reads that field, and the Timeline matches on it, never on the refusal's words. A call that ran and errored still reads "<label> failed: <error>".
|
|
40
|
+
- `render.yaml` no longer trusts every private address as a proxy. It set `AGENTRUN_TRUSTED_PROXIES=uniquelocal`, so any peer on Render's private network could name its own address in `X-Forwarded-For` and pass the sign-in limit's per-address count (the server-wide budget still held). Render publishes no address for the proxy that reaches a service, so the blueprint now leaves it unset. The owner's first sign-in of a start (the right password) that comes with `X-Forwarded-For` from an address the server doesn't trust logs that address once (`event=forwarded_untrusted peer=<address>`): behind a proxy, the proxy that carried the owner's own request, the address to set `AGENTRUN_TRUSTED_PROXIES` to. A peer without the password can't put its own address there.
|
|
41
|
+
|
|
5
42
|
## 0.1.0-beta.32 (2026-11-10)
|
|
6
43
|
|
|
7
44
|
- Everything the agents make is now on the disk, apart from the data directory's own files. Each agent has one folder, `<data>/disk/agents/<agent>/` (its id in lower case, a dash, and 16 hex digits of its SHA-256). That folder holds the agent's learning folder (`learning/`) and its runs (`runs/<run>/`, each with `store/run.sqlite` and `work/`). store.sqlite and the server's files stay at the top of the data directory, as the control plane, and only the server opens them. A run's row in store.sqlite now holds its claim: `claim_epoch` and `claim_holder`. Each launch of the run's process bumps the epoch, with that process as the holder, and hands the process its epoch. Once the process is gone, the server takes the run back: it bumps the epoch, names itself the holder, and checkpoints the run's database. A run's database (pi-durable-disk's exclusive profile) is WAL, under an exclusive lock, with `wal_autocheckpoint = 0` and synchronous FULL. The run's process ends with its WAL in place: its store's close keeps the connection open (`keepWal`), and the process ends by process.exit, which never checkpoints. A test pins this node:sqlite behaviour, and its inverse: a close does checkpoint. The server reads a run's database with a fresh read-only, lock-free open (`vfs=unix-none`, EXCLUSIVE) per read. It opens the WAL only once the WAL holds a commit that SQLite's recovery would take: a frame with the header's salts, a valid chained checksum and a nonzero commit size. Until then it reads the database file alone, as an immutable file. A lock-free reader of a WAL whose first transaction is still being written recovers no frame, and its close removes that WAL, which loses the writer's rows. agentrun-pi exports that check as `walHasCommit`, and both readers use it. It never shows a read whose last entry is behind one it read before. It never opens the database for writing while a process holds the run. A data directory an earlier version wrote (runs under `<data>/runs/`, or a store of store version 1) is refused at start, in words, and nothing is migrated. pi-durable-agent's store is now store version 2. It names a run's folder by its row's agent (`runDir`, `runStorePath`), and adds `claimRun` and `runClaim`. A store of version 1 is refused. serve gains the local disk adapter: `mount`, `sync`, `unmount` and `revoke` for one machine, where a runner works in the folder itself and a revoke is the server's take-back of the claim. agentrun-pi's durable readers take `unlocked` (a fresh `vfs=unix-none` read, as the server's), which serve's reads of a run's decisions use. A run's folder is never made through a symbolic link: a link on the way to it refuses the run's start, and refuses an import that finishes a run its last import left without a transcript (pi-durable-agent `runFolders`).
|
package/README.md
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
# @parcha/agentrun-serve
|
|
2
2
|
|
|
3
|
-
AgentRun
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
pointed at it works the way it works against the hosted API; the capabilities document says what this server does not
|
|
8
|
-
offer.
|
|
3
|
+
The AgentRun server: the process you deploy to run AgentRun, the open-source platform that supercharges your agents. `agentrun-serve` serves the `/v2` API (`agentrun.v2/0`) and the console over one store (SQLite in its data
|
|
4
|
+
directory, or Postgres): many agents, each with revisions written once (an agentic prompt, or an agentrun-dsl
|
|
5
|
+
workflow), and every run pinned to the revision it ran. Runners claim runs from that store and run them; by default one
|
|
6
|
+
runner starts beside the server. The capabilities document (`GET /v2/capabilities`) says what this server offers.
|
|
9
7
|
|
|
10
|
-
|
|
11
|
-
console included. Until then, run it from a checkout (below) or the container.
|
|
8
|
+
`npx @parcha/agentrun` starts it, with its console, on your machine; the container image runs it on a server (below).
|
|
12
9
|
|
|
13
10
|
## Quick start (no key, no network)
|
|
14
11
|
|
|
15
|
-
Node
|
|
12
|
+
Node 24.11 or later. In a checkout of this repository:
|
|
16
13
|
|
|
17
14
|
```sh
|
|
18
15
|
npm ci --ignore-scripts && npm run build
|
|
@@ -157,10 +154,9 @@ once without checking again (a key some harness reads would, with `why=key`).
|
|
|
157
154
|
|
|
158
155
|
The image is public: `ghcr.io/parcha-ai/agentrun-server` (`:beta`, or an exact version such as `:v0.1.0-beta.27`).
|
|
159
156
|
`compose.yaml` at the repository's root is the one way to run it: the server, its data on a named volume, and the host's
|
|
160
|
-
Docker socket
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
workspaces on Archil.
|
|
157
|
+
Docker socket, so each run's Docker sandbox is a container beside the server's, its run's folder mounted from that
|
|
158
|
+
volume ([in the published image](#in-the-published-image)). It takes Docker Engine 26 or later, which mounts a
|
|
159
|
+
volume's subpath.
|
|
164
160
|
|
|
165
161
|
1. Start it (below).
|
|
166
162
|
2. Open the console and set your password.
|
|
@@ -669,8 +665,8 @@ never runs; the box's first process is a `sleep` of its lifetime.
|
|
|
669
665
|
|
|
670
666
|
### In the published image
|
|
671
667
|
|
|
672
|
-
The published image, `ghcr.io/parcha-ai/agentrun-server`, runs Docker
|
|
673
|
-
that Docker's socket, as `compose.yaml` at the repository's root starts it ([in a container](#in-a-container)). The image
|
|
668
|
+
The published image, `ghcr.io/parcha-ai/agentrun-server`, runs Docker sandboxes on the Docker of the host it runs on,
|
|
669
|
+
through that Docker's socket, as `compose.yaml` at the repository's root starts it ([in a container](#in-a-container)). The image
|
|
674
670
|
has the Docker client (Debian's `docker-cli`) and no daemon; `group_add` gives the image's `node` user the socket's group
|
|
675
671
|
(`DOCKER_GID`), so the server never runs as root.
|
|
676
672
|
|
|
@@ -680,27 +676,32 @@ has the Docker client (Debian's `docker-cli`) and no daemon; `group_add` gives t
|
|
|
680
676
|
it root. A box never gets it.
|
|
681
677
|
- **A box is a container beside the server's.** It is made as on a Linux host (`--network none`, every capability dropped,
|
|
682
678
|
no new privileges, the server's uid, the box limits).
|
|
683
|
-
- **No host list from a container yet.** A Docker sandbox's egress proxy refuses the Docker host's own addresses, so it
|
|
684
|
-
must know them, and a provider that runs in a container (`/.dockerenv`, `/run/.containerenv` or a container's cgroup)
|
|
685
|
-
can't read them from its own interfaces. The computer package's Docker provider takes them as its
|
|
686
|
-
`egress.hostAddresses` option (IP addresses, the host's public ones and any NAT'd or elastic IP;
|
|
687
|
-
[its README](../computer/README.md)), but this server sets no such option and has no setting for it. So in a
|
|
688
|
-
container, a Docker sandbox asked for a host list (`AGENTRUN_BOX_ALLOW`, whose default is a list) is refused before
|
|
689
|
-
anything is made: "this provider runs in a container (…), so this provider's own interfaces are not the Docker
|
|
690
|
-
host's, and the egress proxy could not refuse the host's own addresses: pass them as egress.hostAddresses, or ask for
|
|
691
|
-
network none or open". With `AGENTRUN_BOX_ALLOW=none` a sandbox asks for no network, which this check does not
|
|
692
|
-
refuse.
|
|
693
679
|
- **Its files.** The daemon has none of the server's paths, only what it mounted into the server's container. At its
|
|
694
680
|
start the server reads its own container's id from `/proc/self/mountinfo`, asks Docker for that container's mounts
|
|
695
|
-
(`docker inspect`), and takes the named volume that holds the data directory. A
|
|
696
|
-
and the
|
|
697
|
-
(`--mount type=volume,...,volume-subpath
|
|
681
|
+
(`docker inspect`), and takes the named volume that holds the data directory. A run's sandbox mounts that run's folder
|
|
682
|
+
from it, and the sandbox's own daemon (copied to `<volume mount>/.agentrun/computerd`, read-only), as the volume's
|
|
683
|
+
subpaths (`--mount type=volume,...,volume-subpath=...`), never the rest. The run's files and the sandbox's are the same
|
|
698
684
|
files, as on a host.
|
|
685
|
+
- **The host's own addresses.** A sandbox's egress proxy refuses the Docker host's own addresses, which the server in a
|
|
686
|
+
container can't see on its interfaces. At its start it reads them once through the socket: one container on the
|
|
687
|
+
host's network (`--network host`, with `host.docker.internal` added for Docker Desktop and OrbStack, whose listing is
|
|
688
|
+
the VM's), from the proxy's own image, as nobody (`65534:65534`), every capability dropped, no new privileges, a
|
|
689
|
+
read-only root, 64 MiB and 32 processes, removed at its exit, bounded to 60 s. To those it adds
|
|
690
|
+
`AGENTRUN_DOCKER_HOST_ADDRESSES` (a comma list of IP addresses, checked at the start), for what no interface shows,
|
|
691
|
+
such as a NAT'd or elastic public address. The union is in capabilities' docker entry (`host_addresses`) and the
|
|
692
|
+
`event=docker_host_addresses` line. With none known under an allow-list (the read failed, nothing set), docker is
|
|
693
|
+
unavailable at the start, saying so and naming the setting or `AGENTRUN_BOX_ALLOW=none`; under `none` nothing is read.
|
|
699
694
|
- **Any other layout** (the data directory not on a read-write named volume of the server's own container, the socket of
|
|
700
695
|
another Docker than the one that runs the server, a container whose id `/proc/self/mountinfo` does not name) makes
|
|
701
696
|
docker unavailable at the start, its reason in capabilities and the `event=box_paths` line: `run AgentRun in a
|
|
702
697
|
container with docker compose up from compose.yaml (its named data volume is how boxes reach a run's files)`. On an
|
|
703
|
-
older engine: `Docker Engine <26 can't mount a named volume's subpath: upgrade to Docker 26+`.
|
|
698
|
+
older engine: `Docker Engine <26 can't mount a named volume's subpath: upgrade to Docker 26+`. A daemon of another
|
|
699
|
+
machine makes it unavailable too, whether `DOCKER_HOST` names it or the current Docker context does (`DOCKER_CONTEXT`,
|
|
700
|
+
else the saved current one, read once with `docker context inspect`): that daemon has none of this machine's paths.
|
|
701
|
+
Another machine's is `ssh://`, or `tcp://` to a host that isn't loopback; `unix://`, `npipe://` (Docker Desktop on
|
|
702
|
+
Windows) and `tcp://` to loopback are this machine's. An agent that
|
|
703
|
+
names a Docker computer is refused at its run's start in those words, and one with no computer runs on the runner,
|
|
704
|
+
with the file tools and no shell.
|
|
704
705
|
- On a host the server finds no container of its own and asks Docker nothing: a box binds this machine's paths and its
|
|
705
706
|
proxy's directory is under `/tmp`, as before.
|
|
706
707
|
|
|
@@ -770,8 +771,9 @@ Docker sandbox where this server's Docker answers, else no computer; in Mode 2,
|
|
|
770
771
|
no computer.
|
|
771
772
|
|
|
772
773
|
**What a computer reaches.** A Docker sandbox reaches the hosts of `AGENTRUN_BOX_ALLOW` (by default the package
|
|
773
|
-
registries and GitHub) through its egress proxy, and nothing else; `AGENTRUN_BOX_ALLOW=none` gives it no network.
|
|
774
|
-
server
|
|
774
|
+
registries and GitHub) through its egress proxy, and nothing else; `AGENTRUN_BOX_ALLOW=none` gives it no network. From a
|
|
775
|
+
server in a container the proxy also refuses the Docker host's own addresses, which the server reads through the socket
|
|
776
|
+
([in the published image](#in-the-published-image)). A
|
|
775
777
|
Daytona, Modal or E2B sandbox has no network of its own (loopback only). A phone and a browser are on their vendor's
|
|
776
778
|
own network, whatever the list says.
|
|
777
779
|
|
|
@@ -1319,18 +1321,20 @@ runs' calls alone; with none, its `check` stays null.
|
|
|
1319
1321
|
|
|
1320
1322
|
A saved key is kept only as ciphertext: AES-256-GCM in `DIR/tool-keys.json` (0600), each value bound to its field's
|
|
1321
1323
|
name, under the seal key `AGENTRUN_SEAL_KEY`, which only the server opens it with. A run's process never gets the seal
|
|
1322
|
-
key. With `AGENTRUN_SEAL_KEY` not set, the
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1324
|
+
key. With `AGENTRUN_SEAL_KEY` not set, the server keeps it in `seal/seal.key` in its data directory, beside the store,
|
|
1325
|
+
making it at the first start: 32 random bytes in base64, 0600 in a 0700 directory, and one another user can read is
|
|
1326
|
+
refused, not changed. It lives and dies with the data (a disk, a volume): back it up with the data directory, and keep
|
|
1327
|
+
the two together. The store records the key's fingerprint (an HMAC of a fixed label under the key, never the key), and
|
|
1328
|
+
the server, every runner and `import` check the key they hold against it: a store whose secrets were sealed with another
|
|
1329
|
+
key does not start ("this store's secrets were sealed with another key; hand the server the original
|
|
1330
|
+
AGENTRUN_SEAL_KEY"), and no key is ever made over sealed secrets, so a lost `seal.key` is never replaced by a new one.
|
|
1331
|
+
The same holds on Postgres: a second machine with another key refuses. Only the server's start makes the key; a runner
|
|
1332
|
+
reads it from `AGENTRUN_SEAL_KEY` or the data directory, never makes one, and is refused without one. Set
|
|
1333
|
+
`AGENTRUN_SEAL_KEY` explicitly, the same in every process, and keep it.
|
|
1328
1334
|
|
|
1329
1335
|
A stored value that does not open is never a reason not to start. It reads `set: false, stored_unreadable: true`, and
|
|
1330
|
-
`reenter` names those fields with why: `
|
|
1331
|
-
|
|
1332
|
-
the value seals it again under the current key. In a container, `~/.config` is the container's own and goes with it:
|
|
1333
|
-
pass `AGENTRUN_SEAL_KEY`, or mount a directory at `XDG_CONFIG_HOME`, so a new container opens the keys the volume holds.
|
|
1336
|
+
`reenter` names those fields with why: `seal_key_changed` (sealed under another key) or `file_unreadable`. The log says
|
|
1337
|
+
so once, naming the condition and the file, never a value; a `PUT` of the value seals it again under the current key.
|
|
1334
1338
|
|
|
1335
1339
|
A saved key is read by name like one the launcher hands over, and the launcher's value wins for a name it holds. A run
|
|
1336
1340
|
gets the saved keys at its launch, over the pipe its secrets come on (a workflow run's `PARALLEL_API_KEY` on its
|
|
@@ -1913,6 +1917,25 @@ Home export and import, quotes and `POST /runs/{id}/kill` answer `501 unsupporte
|
|
|
1913
1917
|
capabilities declare each one 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
|
|
1914
1918
|
above $0 is taken; it does not mean caps are unsupported ([spend cap](#spend-cap)).
|
|
1915
1919
|
|
|
1920
|
+
### API only
|
|
1921
|
+
|
|
1922
|
+
`AGENTRUN_API_ONLY=1` is for a server that runs behind its caller's backend and is never opened in a browser. It
|
|
1923
|
+
serves these routes alone:
|
|
1924
|
+
|
|
1925
|
+
- a run's launch (`POST /agents/{id}/runs`, `POST /runs`), read (`GET /runs/{id}`), lists (`GET /agents/{id}/runs`,
|
|
1926
|
+
`GET /runs`), timeline, messages, stop, cancel, kill (`501` here, as above) and cap raise (`PATCH /runs/{id}`);
|
|
1927
|
+
- its files (`GET /runs/{id}/files`, `GET /runs/{id}/files/{path}`) and [uploads](#uploads) (`/files`);
|
|
1928
|
+
- `GET /capabilities`, `GET /health` and `GET /usage`.
|
|
1929
|
+
|
|
1930
|
+
Every other address is `404 not_found`, answered before the request is read further: the console at `/` and its
|
|
1931
|
+
assets, the store page's `/api/*`, sign-in and setup, every `/settings` route, `POST /mcp`, triggers and their
|
|
1932
|
+
`POST /hooks/{id}`, agents, templates, `/openapi.json`, `/llms.txt` and the live views. It has no accounts: there is no
|
|
1933
|
+
page to sign in to, so no setup code is printed. The token works as it does on every route served. Unset, `0` or
|
|
1934
|
+
`false` serve the whole server, as before; any value other than these and `1` or `true` stops the start, in words.
|
|
1935
|
+
|
|
1936
|
+
Its routes for agents are refused too, so on an API-only server a run is launched inline (`POST /runs` with its
|
|
1937
|
+
definition), or on an agent made before the profile was turned on.
|
|
1938
|
+
|
|
1916
1939
|
## Uploads
|
|
1917
1940
|
|
|
1918
1941
|
A run's input files. Send one in one call, its bytes the body and its path in the query:
|
|
@@ -2177,7 +2200,7 @@ An agent or a run is archived, never deleted: `DELETE` stays `405`. These routes
|
|
|
2177
2200
|
## The console
|
|
2178
2201
|
|
|
2179
2202
|
Open the link the server prints, once, in a browser. `/` is the console (`apps/console` in the repository), on the
|
|
2180
|
-
server's own origin, under a CSP that allows that origin only:
|
|
2203
|
+
server's own origin, under a CSP that allows that origin only, but for the provider icons on the Keys page (below):
|
|
2181
2204
|
|
|
2182
2205
|
- **Mission Control**: the store's counts and the latest runs.
|
|
2183
2206
|
- **Agents**: each agent with its kind and harness, archived ones behind **Archived**. **New agent** and an agent's page:
|
|
@@ -2232,8 +2255,13 @@ at once; a new one past that is held by the server's budget only, and no address
|
|
|
2232
2255
|
Behind a proxy every visitor would be the proxy's address, so one guesser would hold the owner too: set
|
|
2233
2256
|
`AGENTRUN_TRUSTED_PROXIES` to the proxy's addresses or ranges (comma-separated, or `loopback`, `linklocal`,
|
|
2234
2257
|
`uniquelocal`), and a request from one of them counts under the client its `X-Forwarded-For` names (the nearest address
|
|
2235
|
-
that is not itself a trusted proxy). Unset, that header is never read.
|
|
2236
|
-
|
|
2258
|
+
that is not itself a trusted proxy). Unset, that header is never read. The owner's first sign-in of a start (the
|
|
2259
|
+
right password) that comes with `X-Forwarded-For` from an address the server doesn't trust is logged once, with that
|
|
2260
|
+
address (`event=forwarded_untrusted peer=<address>`; a server from a release after 0.1.0-beta.32). Only the right
|
|
2261
|
+
password logs it, so the address is the one that carried the owner's own request: behind a proxy, the proxy's.
|
|
2262
|
+
`render.yaml` leaves it unset, as Render publishes no address for its proxy: after a deploy, sign in, read the
|
|
2263
|
+
`forwarded_untrusted` line in the service's Logs, and set `AGENTRUN_TRUSTED_PROXIES` to that address (or its range,
|
|
2264
|
+
when Render's proxy reaches the service from more than one; sign in again after a redeploy to see whether it moved).
|
|
2237
2265
|
|
|
2238
2266
|
Forgot it: run
|
|
2239
2267
|
`agentrun-serve reset-password --data DIR` where the data directory is (`docker exec agentrun node
|
|
@@ -2916,8 +2944,12 @@ carries no cost at all, as from a provider that does not price the model. The te
|
|
|
2916
2944
|
It sends no CORS headers, so a page on another origin cannot read an answer.
|
|
2917
2945
|
- Every route but `GET /capabilities` needs `Authorization: Bearer <the token>`, compared in constant time, or the
|
|
2918
2946
|
browser's cookie under the rules of [the console](#the-console). The console's own files (its HTML, scripts, styles
|
|
2919
|
-
and fonts) hold no data; everything it shows comes through those routes. It loads
|
|
2920
|
-
|
|
2947
|
+
and fonts) hold no data; everything it shows comes through those routes. It loads one thing from the network: on
|
|
2948
|
+
Settings → Keys, each provider's icon, from Google's favicon service (`www.google.com/s2/favicons`, which redirects
|
|
2949
|
+
to `t0`-`t3.gstatic.com`). The request names the provider's public site (`chatgpt.com`) and carries no referrer,
|
|
2950
|
+
no cookie of this server's and nothing of yours; Google sees the browser's address and which providers the page
|
|
2951
|
+
lists. Offline, or with those hosts blocked, the page shows a key icon instead. The CSP's `img-src` allows those
|
|
2952
|
+
five hosts; everything else is this origin only.
|
|
2921
2953
|
- Each run's door listens on loopback and takes only that run's own door token (`DIR/disk/agents/<agent>/runs/<id>/door-token`, 0600, made
|
|
2922
2954
|
at its first launch); a run's process an older server started keeps the server-wide one (`DIR/.door-token`).
|
|
2923
2955
|
- A run's process gets the server's environment (the `AGENT_MODEL` variables among it) without the server's token or any
|
package/dist/adapters.d.ts
CHANGED
|
@@ -81,9 +81,6 @@ export type AdapterNeeds = {
|
|
|
81
81
|
skills?: readonly SkillFiles[];
|
|
82
82
|
unpriced?: ReadonlySet<string>;
|
|
83
83
|
};
|
|
84
|
-
/** The ConfineChild that starts a child under `prefix` (the argv pi's commands start under, ending in "--"); none when
|
|
85
|
-
* the run confines nothing, since an adapter refuses a confinement that adds nothing. */
|
|
86
|
-
export declare function confineOf(prefix: readonly string[]): ConfineChild | undefined;
|
|
87
84
|
/** The model key a run on `harness` (one on an adapter, by its wire's route) of `model` (the revision's; none, the host's default for the
|
|
88
85
|
* harness) takes: the one its requests carry on the route its provider below takes, as key-refusal.ts' runKeyOf names
|
|
89
86
|
* it. codex: the gateway's when AGENT_MODEL_BASE_URL is set, else OpenAI's, or OpenRouter's on OpenRouter's route;
|
package/dist/adapters.js
CHANGED
|
@@ -159,13 +159,6 @@ function unavailable(facts, error, npx, env) {
|
|
|
159
159
|
const hinted = installHint(said, facts.install.npmLine, facts.install.spec, npx, env);
|
|
160
160
|
return new HarnessUnavailable(hinted, hinted === said ? fixOf(facts, error) : undefined);
|
|
161
161
|
}
|
|
162
|
-
/** The ConfineChild that starts a child under `prefix` (the argv pi's commands start under, ending in "--"); none when
|
|
163
|
-
* the run confines nothing, since an adapter refuses a confinement that adds nothing. */
|
|
164
|
-
export function confineOf(prefix) {
|
|
165
|
-
if (!prefix.length)
|
|
166
|
-
return undefined;
|
|
167
|
-
return (child) => ({ command: prefix[0], args: [...prefix.slice(1), child.command, ...child.args] });
|
|
168
|
-
}
|
|
169
162
|
/** The model key a run on `harness` (one on an adapter, by its wire's route) of `model` (the revision's; none, the host's default for the
|
|
170
163
|
* harness) takes: the one its requests carry on the route its provider below takes, as key-refusal.ts' runKeyOf names
|
|
171
164
|
* it. codex: the gateway's when AGENT_MODEL_BASE_URL is set, else OpenAI's, or OpenRouter's on OpenRouter's route;
|
package/dist/agents.d.ts
CHANGED
|
@@ -103,7 +103,7 @@ export declare function agentView(entry: AgentEntry, origin: string, signIns?: r
|
|
|
103
103
|
} | undefined;
|
|
104
104
|
agent_id: string;
|
|
105
105
|
definition: Json | null;
|
|
106
|
-
kind: "
|
|
106
|
+
kind: "workflow" | "agentic" | null;
|
|
107
107
|
revision: string | null;
|
|
108
108
|
revisions: number;
|
|
109
109
|
source: null;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Route } from "./server.js";
|
|
2
|
+
/** The variable that turns the profile on. */
|
|
3
|
+
export declare const API_ONLY_ENV = "AGENTRUN_API_ONLY";
|
|
4
|
+
/** The routes (server.ts ROUTES, by name) an API-only server serves: a run's launch, read, list, timeline, messages,
|
|
5
|
+
* stop, cancel, kill and cap raise; its files and the uploads a launch names; capabilities, health and usage. */
|
|
6
|
+
export declare const API_ONLY_ROUTES: ReadonlySet<string>;
|
|
7
|
+
/** Whether `env` turns the profile on: `1` or `true` on; unset, empty, `0` or `false` off. Any other value is refused in
|
|
8
|
+
* words (a TypeError), so a typo never leaves the console open on a server meant to be API-only. */
|
|
9
|
+
export declare function apiOnlyFrom(env?: NodeJS.ProcessEnv): boolean;
|
|
10
|
+
/** Whether an API-only server serves `method` on `raw` (the path as sent, its query cut): a /v2 path one of
|
|
11
|
+
* API_ONLY_ROUTES matches for that method (HEAD as GET). */
|
|
12
|
+
export declare function servedApiOnly(routes: readonly Route[], method: string | undefined, raw: string): boolean;
|
|
13
|
+
/** The refusal's words for `raw` on an API-only server. */
|
|
14
|
+
export declare const apiOnlyRefusal: (raw: string) => string;
|
package/dist/api-only.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** The variable that turns the profile on. */
|
|
2
|
+
export const API_ONLY_ENV = "AGENTRUN_API_ONLY";
|
|
3
|
+
/** The routes (server.ts ROUTES, by name) an API-only server serves: a run's launch, read, list, timeline, messages,
|
|
4
|
+
* stop, cancel, kill and cap raise; its files and the uploads a launch names; capabilities, health and usage. */
|
|
5
|
+
export const API_ONLY_ROUTES = new Set([
|
|
6
|
+
"createRun", "createInlineRun",
|
|
7
|
+
"getRun", "listRuns", "listAllRuns", "getTimeline",
|
|
8
|
+
"sendMessage", "stopRun", "cancelRun", "killRun", "raiseRunCap",
|
|
9
|
+
"listRunFiles", "readRunFile",
|
|
10
|
+
"createFile", "listFiles", "getFile", "uploadFile", "deleteFile",
|
|
11
|
+
"getCapabilities", "getHealth", "getUsage",
|
|
12
|
+
]);
|
|
13
|
+
/** Whether `env` turns the profile on: `1` or `true` on; unset, empty, `0` or `false` off. Any other value is refused in
|
|
14
|
+
* words (a TypeError), so a typo never leaves the console open on a server meant to be API-only. */
|
|
15
|
+
export function apiOnlyFrom(env = process.env) {
|
|
16
|
+
const given = env[API_ONLY_ENV]?.trim().toLowerCase() ?? "";
|
|
17
|
+
if (given === "1" || given === "true")
|
|
18
|
+
return true;
|
|
19
|
+
if (given === "" || given === "0" || given === "false")
|
|
20
|
+
return false;
|
|
21
|
+
throw new TypeError(`${API_ONLY_ENV} is 1 (serve the run API only) or 0 (the whole server), not ${JSON.stringify(env[API_ONLY_ENV])}`);
|
|
22
|
+
}
|
|
23
|
+
/** Whether an API-only server serves `method` on `raw` (the path as sent, its query cut): a /v2 path one of
|
|
24
|
+
* API_ONLY_ROUTES matches for that method (HEAD as GET). */
|
|
25
|
+
export function servedApiOnly(routes, method, raw) {
|
|
26
|
+
if (!raw.startsWith("/v2/"))
|
|
27
|
+
return false;
|
|
28
|
+
const path = raw.slice(3);
|
|
29
|
+
const asked = method === "HEAD" ? "GET" : method;
|
|
30
|
+
return routes.some((route) => API_ONLY_ROUTES.has(route.name) && route.method === asked && route.pattern.test(path));
|
|
31
|
+
}
|
|
32
|
+
/** The refusal's words for `raw` on an API-only server. */
|
|
33
|
+
export const apiOnlyRefusal = (raw) => `this server serves the run API only (${API_ONLY_ENV}=1): ${raw} is not served here`;
|
package/dist/archil-routes.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export type ArchilTest = {
|
|
|
24
24
|
export interface ArchilRoutesOptions {
|
|
25
25
|
/** The server's one store: its settings and sealed keys. */
|
|
26
26
|
readonly store: Pick<Store, "settings" | "sealedKeys">;
|
|
27
|
-
/** The server's seal key: there is always one (seal-key.ts
|
|
27
|
+
/** The server's seal key: there is always one (seal-key.ts bootSealKey, at the start). */
|
|
28
28
|
readonly sealKey: Buffer;
|
|
29
29
|
/** Makes the disk for the test (default archilDisk): a test's fake. */
|
|
30
30
|
readonly makeDisk?: (options: ArchilDiskOptions) => ArchilDisk;
|
package/dist/box-egress-vm.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type BoxEgress } from "./box-egress.js";
|
|
2
1
|
/** What `docker info` is asked on a Mac: the daemon's OS type, its kernel, the name it gives its OS, and its host name. */
|
|
3
2
|
export declare const VM_INFO_FORMAT = "{{.OSType}}|{{.KernelVersion}}|{{.OperatingSystem}}|{{.Name}}";
|
|
4
3
|
/** The VM runtimes a box's network goes on for, on a Mac. */
|
|
@@ -117,10 +116,3 @@ export declare function startEgressContainer(options: {
|
|
|
117
116
|
/** What the server hands a run's process on a Mac with the proxy container: its volume's name, which the run's Docker
|
|
118
117
|
* boxes mount read-only at EGRESS_MOUNT. Unset on Linux, where the run's process starts its own proxy (box-egress.ts). */
|
|
119
118
|
export declare const RUN_BOX_VOLUME_ENV = "AGENTRUN_RUN_BOX_VOLUME";
|
|
120
|
-
/** The run's process's reading of RUN_BOX_VOLUME_ENV: the volume, or undefined when it is unset or not a name this
|
|
121
|
-
* server makes. */
|
|
122
|
-
export declare function runBoxVolumeOf(env: NodeJS.ProcessEnv): string | undefined;
|
|
123
|
-
/** A run's box's egress on a Mac: the server's proxy container, its socket in the volume the Docker provider mounts on
|
|
124
|
-
* every box (run-box.ts), so nothing for the run's process to start or bind. The volume outlives each proxy, so a box
|
|
125
|
-
* made before one started again reaches the new one. */
|
|
126
|
-
export declare const vmEgress: BoxEgress;
|
package/dist/box-egress-vm.js
CHANGED
|
@@ -352,13 +352,3 @@ export async function startEgressContainer(options) {
|
|
|
352
352
|
/** What the server hands a run's process on a Mac with the proxy container: its volume's name, which the run's Docker
|
|
353
353
|
* boxes mount read-only at EGRESS_MOUNT. Unset on Linux, where the run's process starts its own proxy (box-egress.ts). */
|
|
354
354
|
export const RUN_BOX_VOLUME_ENV = "AGENTRUN_RUN_BOX_VOLUME";
|
|
355
|
-
/** The run's process's reading of RUN_BOX_VOLUME_ENV: the volume, or undefined when it is unset or not a name this
|
|
356
|
-
* server makes. */
|
|
357
|
-
export function runBoxVolumeOf(env) {
|
|
358
|
-
const value = env[RUN_BOX_VOLUME_ENV]?.trim();
|
|
359
|
-
return value && /^agentrun-egress-[0-9a-f]{12}$/.test(value) ? value : undefined;
|
|
360
|
-
}
|
|
361
|
-
/** A run's box's egress on a Mac: the server's proxy container, its socket in the volume the Docker provider mounts on
|
|
362
|
-
* every box (run-box.ts), so nothing for the run's process to start or bind. The volume outlives each proxy, so a box
|
|
363
|
-
* made before one started again reaches the new one. */
|
|
364
|
-
export const vmEgress = async () => ({ socket: EGRESS_SOCKET, fresh: false });
|
package/dist/box-egress.d.ts
CHANGED
|
@@ -37,8 +37,6 @@ export declare function egressDir(runId: string, uid?: number, parent?: string):
|
|
|
37
37
|
export declare const MAX_EGRESS_PARENT: number;
|
|
38
38
|
/** Whether `parent` is too long, in bytes, for a run's proxy directories (MAX_EGRESS_PARENT). */
|
|
39
39
|
export declare const egressParentTooLong: (parent: string) => boolean;
|
|
40
|
-
/** Removes a run's proxy directory once its box is gone. */
|
|
41
|
-
export declare const removeEgressDir: (runId: string, parent?: string) => Promise<void>;
|
|
42
40
|
/** Where a run's box finds its proxy: what is mounted read-only at EGRESS_MOUNT, and the socket's name there. The one
|
|
43
41
|
* seam between the box's side, which is the same wherever the proxy runs (the mount, the relay, the proxy variables),
|
|
44
42
|
* and where the proxy runs. Today that is hostEgress: the run's own process, its socket's directory on this machine
|
|
@@ -105,5 +103,3 @@ export type DockerNetwork = {
|
|
|
105
103
|
/** What the server hands a run's process: the list its box reaches, resolved (boxNetworkOf), or `none`. The run's
|
|
106
104
|
* process reads this, never AGENTRUN_BOX_ALLOW: unset, it is none. */
|
|
107
105
|
export declare const RUN_BOX_ALLOW_ENV = "AGENTRUN_RUN_BOX_ALLOW";
|
|
108
|
-
/** The run's process's reading of RUN_BOX_ALLOW_ENV: the list, or `none` when it says so, is unset or is not a list. */
|
|
109
|
-
export declare function runBoxAllowOf(env: NodeJS.ProcessEnv): readonly string[] | "none";
|
package/dist/box-egress.js
CHANGED
|
@@ -16,7 +16,7 @@ import { connect } from "node:net";
|
|
|
16
16
|
import { release } from "node:os";
|
|
17
17
|
import { join } from "node:path";
|
|
18
18
|
import { pathToFileURL } from "node:url";
|
|
19
|
-
import {
|
|
19
|
+
import { startEgressProxy } from "./egress-proxy.js";
|
|
20
20
|
import { FAUX_ENV } from "./model.js";
|
|
21
21
|
import { withoutSecrets } from "./secrets.js";
|
|
22
22
|
/** Where the proxy's directory is in the box, read-only. */
|
|
@@ -86,8 +86,6 @@ export function egressDir(runId, uid = process.getuid?.() ?? 0, parent = hostPar
|
|
|
86
86
|
export const MAX_EGRESS_PARENT = 107 - Buffer.byteLength("/0123456789abcdef/.egress-0123456789ab.sock");
|
|
87
87
|
/** Whether `parent` is too long, in bytes, for a run's proxy directories (MAX_EGRESS_PARENT). */
|
|
88
88
|
export const egressParentTooLong = (parent) => Buffer.byteLength(parent) > MAX_EGRESS_PARENT;
|
|
89
|
-
/** Removes a run's proxy directory once its box is gone. */
|
|
90
|
-
export const removeEgressDir = (runId, parent) => rm(egressDir(runId, undefined, parent), { recursive: true, force: true });
|
|
91
89
|
/** This user's parent directory in /tmp: made 0700, and refused unless it is a directory of this user's, not a link. */
|
|
92
90
|
async function ownParent(dir) {
|
|
93
91
|
await mkdir(dir, { recursive: true, mode: 0o700 });
|
|
@@ -256,16 +254,3 @@ function answers(path) {
|
|
|
256
254
|
/** What the server hands a run's process: the list its box reaches, resolved (boxNetworkOf), or `none`. The run's
|
|
257
255
|
* process reads this, never AGENTRUN_BOX_ALLOW: unset, it is none. */
|
|
258
256
|
export const RUN_BOX_ALLOW_ENV = "AGENTRUN_RUN_BOX_ALLOW";
|
|
259
|
-
/** The run's process's reading of RUN_BOX_ALLOW_ENV: the list, or `none` when it says so, is unset or is not a list. */
|
|
260
|
-
export function runBoxAllowOf(env) {
|
|
261
|
-
const value = env[RUN_BOX_ALLOW_ENV]?.trim();
|
|
262
|
-
if (!value || value === "none")
|
|
263
|
-
return "none";
|
|
264
|
-
try {
|
|
265
|
-
const list = parseAllow(value);
|
|
266
|
-
return list.length ? list : "none";
|
|
267
|
-
}
|
|
268
|
-
catch {
|
|
269
|
-
return "none";
|
|
270
|
-
}
|
|
271
|
-
}
|
package/dist/box-paths.d.ts
CHANGED
|
@@ -15,12 +15,35 @@ export type DockerPaths = {
|
|
|
15
15
|
export declare const IN_COMPOSE = "run AgentRun in a container with `docker compose up` from compose.yaml (its named data volume is how boxes reach a run's files)";
|
|
16
16
|
/** An engine that cannot mount a volume's subpath. */
|
|
17
17
|
export declare const OLD_ENGINE = "Docker Engine <26 can't mount a named volume's subpath: upgrade to Docker 26+";
|
|
18
|
+
/** Why a Docker computer can't run for a server whose Docker daemon (at `endpoint`) is another machine's: a run's
|
|
19
|
+
* computer mounts the run's folder (and the computer's daemon) by this server's own paths, which that daemon doesn't
|
|
20
|
+
* have. */
|
|
21
|
+
export declare const remoteDockerWords: (endpoint: string) => string;
|
|
22
|
+
/** Whether a daemon endpoint is another machine's: ssh://, or tcp:// to a host that is not this machine's loopback.
|
|
23
|
+
* Everything else is this machine's: unix:// (and fd://), npipe:// (Docker Desktop on Windows), tcp:// to loopback. Its
|
|
24
|
+
* Docker provider still applies its own allow-list rule to those (the provider's check where it isn't on the host). */
|
|
25
|
+
export declare function remoteEndpoint(endpoint: string): boolean;
|
|
26
|
+
/** The daemon `env`'s docker reaches, when it is another machine's (remoteEndpoint): DOCKER_HOST when set, else the
|
|
27
|
+
* current context's endpoint as the CLI resolves it (DOCKER_CONTEXT, else the saved current context), read as the
|
|
28
|
+
* computer package's Docker provider reads it (`docker context inspect`); undefined for this machine's. A context that
|
|
29
|
+
* can't be read is taken as this machine's: its Docker provider still refuses at create where it isn't. `docker` is
|
|
30
|
+
* the tests'. */
|
|
31
|
+
export declare function remoteDockerOf(env: NodeJS.ProcessEnv, docker?: DockerCall): Promise<string | undefined>;
|
|
32
|
+
export declare function remoteDockerOnce(env: NodeJS.ProcessEnv): Promise<string | undefined>;
|
|
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
|
+
* container of that Docker's with its data on a named volume (`paths`: the computer mounts the run's folder and its
|
|
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). The one check every
|
|
37
|
+
* reader of Docker's offer takes. */
|
|
38
|
+
export declare function dockerComputerRefusal(paths: DockerPaths, remote: string | undefined): string | undefined;
|
|
39
|
+
/** Where a runner's Docker has the data directory `data`, read once by the runner that makes a Docker computer: as the
|
|
40
|
+
* server reads it at its start (dockerPathsOf), on Linux alone; under `--faux` from the mountinfo file the tests name
|
|
41
|
+
* (FAUX_MOUNTINFO_ENV), else as a host. */
|
|
42
|
+
export declare function dockerPathsForRuns(env: NodeJS.ProcessEnv, data: string, platform?: NodeJS.Platform): Promise<DockerPaths>;
|
|
18
43
|
/** Under `--faux` only: a file the server reads as its /proc/self/mountinfo (server.ts fauxMountinfo). */
|
|
19
44
|
export declare const FAUX_MOUNTINFO_ENV = "AGENTRUN_SERVE_FAUX_MOUNTINFO";
|
|
20
45
|
/** What the server hands a run's process: the paths, as JSON; empty on a host. */
|
|
21
46
|
export declare const RUN_BOX_PATHS_ENV = "AGENTRUN_RUN_BOX_PATHS";
|
|
22
|
-
/** The run's process's reading of RUN_BOX_PATHS_ENV: the paths, or undefined when it is empty or not theirs. */
|
|
23
|
-
export declare function runBoxPathsOf(env: NodeJS.ProcessEnv): BoxPaths | undefined;
|
|
24
47
|
/** The directory the runs' egress proxy sockets are in, for a server in a container: on its data volume, so a box can
|
|
25
48
|
* mount its run's (box-egress.ts egressDir). */
|
|
26
49
|
export declare const egressParentOf: (data: string) => string;
|