podster 0.0.0-stage → 0.0.1-test.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/README.md +218 -2
  2. package/build/core/adapter.js +1 -0
  3. package/build/core/broker.js +461 -0
  4. package/build/core/capabilities.js +49 -0
  5. package/build/core/claude-profile.js +35 -0
  6. package/build/core/connection.js +106 -0
  7. package/build/core/errors.js +128 -0
  8. package/build/core/explain.js +124 -0
  9. package/build/core/gateway.js +93 -0
  10. package/build/core/known-secrets.js +38 -0
  11. package/build/core/lifecycle.js +1477 -0
  12. package/build/core/nudge.js +358 -0
  13. package/build/core/pairing.js +285 -0
  14. package/build/core/policy.js +834 -0
  15. package/build/core/poller.js +265 -0
  16. package/build/core/prompt.js +93 -0
  17. package/build/core/pull-text.js +140 -0
  18. package/build/core/record.js +106 -0
  19. package/build/core/repository.js +307 -0
  20. package/build/core/results.js +243 -0
  21. package/build/core/run-interface.js +538 -0
  22. package/build/core/runs.js +192 -0
  23. package/build/core/runtime.js +51 -0
  24. package/build/core/state.js +41 -0
  25. package/build/core/storage.js +125 -0
  26. package/build/core/thumbprint.js +15 -0
  27. package/build/core/tool-policy.js +215 -0
  28. package/build/core/toolchains.js +66 -0
  29. package/build/node/broker-listener.js +187 -0
  30. package/build/node/child-env.js +26 -0
  31. package/build/node/claude-driver.js +749 -0
  32. package/build/node/claude-engine.js +217 -0
  33. package/build/node/cli.js +283 -0
  34. package/build/node/diagnostics.js +201 -0
  35. package/build/node/docker-sandbox.js +605 -0
  36. package/build/node/egress-network.js +217 -0
  37. package/build/node/egress-proxy.js +288 -0
  38. package/build/node/explaining-log.js +23 -0
  39. package/build/node/file-runs.js +63 -0
  40. package/build/node/file-state.js +73 -0
  41. package/build/node/git.js +124 -0
  42. package/build/node/github-api.js +78 -0
  43. package/build/node/hidden-input.js +47 -0
  44. package/build/node/image-pin.js +35 -0
  45. package/build/node/key-store.js +150 -0
  46. package/build/node/keychain.js +160 -0
  47. package/build/node/local-stop.js +67 -0
  48. package/build/node/lock.js +155 -0
  49. package/build/node/nudge-command.js +132 -0
  50. package/build/node/nudge-listener.js +137 -0
  51. package/build/node/platform.js +127 -0
  52. package/build/node/policy-file.js +13 -0
  53. package/build/node/prompter.js +169 -0
  54. package/build/node/provider-transport.js +181 -0
  55. package/build/node/repo-path.js +415 -0
  56. package/build/node/run-command.js +61 -0
  57. package/build/node/safe-fs.js +270 -0
  58. package/build/node/toolchain-images.js +225 -0
  59. package/claude-image/Dockerfile +29 -0
  60. package/git/credential-helper +29 -0
  61. package/npm-shrinkwrap.json +3222 -0
  62. package/package.json +51 -4
  63. package/proxy-image/Dockerfile +28 -0
  64. package/sandbox/Dockerfile +43 -0
  65. package/toolchains/python/Dockerfile +66 -0
  66. package/toolchains/rust/Dockerfile +70 -0
package/README.md CHANGED
@@ -1,3 +1,219 @@
1
- # Temporary Holding Version
1
+ # podster (Runner, test pre-release)
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ **Test pre-release for Podster's staging only. Not supported. Not security-reviewed (M7 step 17 pending).**
4
+
5
+ Don't use it with anything you can't lose. It talks to Podster's staging deployment, which can be reset at any time. Versions are `0.0.x-test.N`, published only under npm's `test` tag; npm may also point `latest` at the first version. The real release, once M7's gate and security review pass, replaces it.
6
+
7
+ Runner pairs your machine with one of your Podster agents, then polls that agent's inbox from your machine, outbound only. With your provider key it runs the tasks its run policy allows, in Docker containers. Unattended runs are off by default: you approve each run at your terminal unless you switch them on for a workroom in Runner's own run policy, `policy.json` in Runner's home. Nothing Podster sends can switch them on.
8
+
9
+ ## Requirements
10
+
11
+ - Node 22 or later.
12
+ - To run tasks, Docker on one of these, since Claude Code and each task run in their own containers:
13
+ - macOS, with Docker Desktop;
14
+ - Linux, with Docker Engine ([Linux](#linux));
15
+ - Windows, only inside a WSL2 Linux distro with Docker Desktop's WSL integration ([Windows (WSL2)](#windows-wsl2)). Runner refuses native Windows.
16
+
17
+ On any other system Runner refuses to run tasks (`platform_unverified`), and pairing and polling still work.
18
+ - Git at `/usr/bin/git`, `/opt/homebrew/bin/git` or `/usr/local/bin/git`.
19
+
20
+ ## Commands
21
+
22
+ Run it with install scripts off, as below: no dependency Runner uses needs one. Or set `npm_config_ignore_scripts=true` in your environment. The package ships `npm-shrinkwrap.json`, so `npx` installs exactly the dependencies Runner was tested with.
23
+
24
+ Pair this machine with the agent a pairing in Podster started. Paste the code when asked: it's never an argument.
25
+
26
+ ```bash
27
+ npx --ignore-scripts podster@test pair --agent <agt_…>
28
+ ```
29
+
30
+ The gateway is staging's, `https://gateway-staging.podster.dev`, unless you name another with `--gateway <https://…>`.
31
+
32
+ Poll the inbox until you stop it with Ctrl-C:
33
+
34
+ ```bash
35
+ npx --ignore-scripts podster@test run
36
+ npx --ignore-scripts podster@test run --provider-key-file <path>
37
+ ```
38
+
39
+ Then:
40
+
41
+ ```bash
42
+ npx --ignore-scripts podster@test status # what this Runner's record says, by IDs
43
+ npx --ignore-scripts podster@test why <tsk_…> # the newest failure recorded for a task on this machine
44
+ npx --ignore-scripts podster@test stop # stop the Runner running from this home, and any run, at once
45
+ npx --ignore-scripts podster@test forget # delete this Runner's keys and record; disconnect the agent in Podster yourself
46
+ ```
47
+
48
+ Every command takes `--home <folder>`, Runner's own folder. The default is `~/.podster-runner`.
49
+
50
+ Running tasks needs plain paths: letters, digits, `.`, `_`, `-` and `/` only. If your home folder's path has a space or any other character, Runner refuses to run tasks (`helper_unavailable`, or `path_unsafe` for its home), since both npm's cache, where `npx` puts Runner (`<cache>/_npx`), and `~/.podster-runner` sit under it. Then point npm's cache and Runner's home at plain folders only you can write, for example `npm_config_cache=/Users/Shared/podster-npm npx --ignore-scripts podster@test run --home /Users/Shared/podster-runner …`, and use the same two on every command.
51
+
52
+ ## When something fails
53
+
54
+ Runner's log is one JSON line per event, with IDs and a code, on standard error. Under each failure, refusal or stop it adds a line in plain English: what happened, what to do, the code, and where the details are. For example:
55
+
56
+ ```text
57
+ why: The task's container couldn't be started or prepared. Check that Docker is running and the task image is built; the details file has Docker's exit code and output. (code container_failed; details: ~/.podster-runner/logs/errors.jsonl)
58
+ ```
59
+
60
+ The details are in `logs/errors.jsonl` in Runner's home: one line per failure, with the time, the run's IDs, the code, and the raw error's message and stack. For a Docker command it also has Docker's exit code and the end of its error output. Each field is cut to 4 KiB. Before anything is written, the exact tokens Runner holds for a run (its broker token and the task's GitHub token) are written as `[redacted]`, and so is anything else that looks like a key or token. If Docker cut its own output, the last word of that output is redacted too. The folder is readable only by you (mode 700, owned by you, not a link). The file is mode 600, owned by you, with one link. The file is kept to 1 MiB and moves to `errors.jsonl.1` and `.2` as it fills, so at most three files are kept. It stays on this machine: Runner never sends it to Podster or anywhere else. `podster why <tsk_…>` prints a task's newest entry.
61
+
62
+ The room sees only fixed words. When the agent answers `blocked`, Runner posts its reason on the task's thread, under the room's output policy. When a run can't start, Runner posts a fixed note with one generic code, `runner_could_not_start`. The specific cause stays in your terminal and the details file, never in the room.
63
+
64
+ When the agent's structured result breaks one of Runner's rules, Runner tells the agent which rule, in fixed words, so it can fix it and give the result again. Examples: a summary that's too long, a file outside the task's folder, an unknown field. The log's code names the rule, such as `result_file_outside_folder`.
65
+
66
+ ## Your provider key
67
+
68
+ Without `--provider-key-file`, `run` records offers and accepts none.
69
+
70
+ To run tasks, put your Anthropic API key alone in a file that you own and only you can read, then pass its path:
71
+
72
+ ```bash
73
+ chmod 600 <path>
74
+ ```
75
+
76
+ Runner refuses a key file that's a link, that someone else can read, or that holds anything but one key. It reads the key once and keeps it on your machine, in its own process: never in a task's container, a log, an argument or the environment of anything it starts. Use a key with a spending limit you set at the provider.
77
+
78
+ Runner's three container images, one for each task, one for Claude Code and one for the egress proxy (used only by rooms that list hosts in `rooms[].network`), are pinned by image ID in Runner's home. The first time `run --provider-key-file` finds one missing, Runner builds it with Docker from the Dockerfile in this package, says so first, and pins what it built. A build takes a few minutes, the Claude Code image downloads Claude Code from npm's registry, and the task image downloads Node.js from nodejs.org. If a build fails, `run` stops before running anything.
79
+
80
+ The task image is Debian bookworm-slim with the tools Runner's own task tools use (`cat`, `tee`, `mkdir`, `ls`, `kill` and ripgrep's `rg`), `/bin/sh` for a run policy that allows the shell, and Node.js 22.23.5 LTS with its npm and npx, so a task's shell commands can run `node`, `npm test` or `npx` on what's already in the task's folder. Each is pinned: the base by digest, Debian's packages at exact versions from one snapshot, and Node's official tarball by a SHA-256 written in the Dockerfile. npm keeps its cache and logs in the container's `/tmp` and its global prefix in `.npm-global` in the task's folder; the rest of the container is read-only. A task's container has no network unless its room lists hosts in `rooms[].network`, so without that, `npm install`, and `npx` of a package that isn't already in the task's `node_modules`, fail. With `"network": ["registry.npmjs.org"]`, npm reaches the registry through Runner's egress proxy.
81
+
82
+ ## Your run policy (`policy.json`)
83
+
84
+ Runner runs a task only if your run policy says so. The policy is a file, `policy.json`, in Runner's home: by default `~/.podster-runner/policy.json`, or the folder you give with `--home`. You write it; nothing Podster sends can change it. Runner reads it again on every evaluation, so an edit counts at the next task with no restart. A file that's missing, unreadable or invalid in any way means no policy, and Runner runs nothing.
85
+
86
+ A complete, valid example, for one workroom. Replace the `org_…` and `ws_…` placeholders with your own IDs, and `/Users/you/podster-work` with a plain absolute folder of your own that isn't inside Runner's home:
87
+
88
+ ```json
89
+ {
90
+ "version": 1,
91
+ "revision": 1,
92
+ "owner_org": "org_…",
93
+ "adapter": "claude_agent_sdk",
94
+ "workspace_root": "/Users/you/podster-work",
95
+ "caps": {
96
+ "spend_micro_usd": 500000,
97
+ "run_time_ms": 900000,
98
+ "turns": 30,
99
+ "output_tokens": 20000,
100
+ "max_tokens": 8000
101
+ },
102
+ "day_caps": { "spend_micro_usd": 2000000 },
103
+ "rooms": [
104
+ {
105
+ "room_id": "ws_…",
106
+ "mode": "ask",
107
+ "outputs": "hold",
108
+ "tools": ["read", "search", "write", "edit"],
109
+ "network": [],
110
+ "repository": null,
111
+ "allowed_orgs": [],
112
+ "acknowledged": { "trust_statement": true, "public_room_warning": true }
113
+ }
114
+ ]
115
+ }
116
+ ```
117
+
118
+ | Field | What it means |
119
+ | --- | --- |
120
+ | `version` | Always `1`. |
121
+ | `revision` | A whole number from 1 up. Raise it when you edit the file. |
122
+ | `owner_org` | Your own organization's ID. Tasks from your own organization are always allowed. |
123
+ | `adapter` | Always `"claude_agent_sdk"`. |
124
+ | `workspace_root` | An absolute folder where task folders are made. Plain path characters only, no `,` `:` `=`, not inside Runner's home and not holding it, and not on a Windows drive under WSL2 (`/mnt/c`). |
125
+ | `caps` | Limits for one run. Each can be set lower than its ceiling, never above, and none can be left out. Money is in micro-USD: 1000000 is 1 USD, so `500000` is 0.50 USD. Time is in milliseconds. |
126
+ | `caps.spend_micro_usd` | Spend for one run, 1 to 25000000 (25 USD). |
127
+ | `caps.run_time_ms` | Time for one run, 60000 (1 minute) to 86400000 (24 hours). |
128
+ | `caps.turns` | Model turns in one run, 1 to 1000. |
129
+ | `caps.output_tokens` | Output tokens in one run, 1 to 1000000. |
130
+ | `caps.max_tokens` | Tokens in one model reply, 1 to 32000, and no more than `output_tokens`. |
131
+ | `day_caps.spend_micro_usd` | Spend across all runs in a day. At least `caps.spend_micro_usd`, and at most 250000000 (250 USD). |
132
+ | `max_active_tasks` | Optional. How many tasks Runner holds at once, 1 to 4. Leave it out for 1. |
133
+ | `rooms` | One entry per workroom you allow. A workroom not listed here is never run. |
134
+ | `rooms[].room_id` | The workroom's `ws_…` ID. |
135
+ | `rooms[].mode` | `"ask"` shows each run at your terminal for you to approve. `"unattended"` runs without asking. Unattended runs are off by default: leave `mode` out or set `"ask"` until you choose otherwise. |
136
+ | `rooms[].outputs` | `"hold"` keeps a finished run's result on your machine until you approve publishing it. `"share"` publishes it. Leaving it out means `"hold"`. |
137
+ | `rooms[].tools` | Runner's own tools for a task. `read`, `search`, `write` and `edit` are the default. `shell` is never on unless you list it. |
138
+ | `rooms[].network` | Host names the room's tasks may reach, such as `["registry.npmjs.org"]` so an agent can `npm install`; `[]`, the default, is no network. Only HTTPS on port 443 to exactly these names, through Runner's egress proxy: no subdomain, other host, plain HTTP, other port or IP address, and never a name that resolves to your LAN or this machine. List exact lower-case names, at most 50; a scheme, port, path, wildcard, IP address, upper case, trailing dot or a name like `localhost` is refused when Runner starts, with `network_host_invalid` and the entry's index. A listed host is fully reachable, so list only hosts you'd let the task send data to, and a host behind a shared CDN can be used to reach other sites on that CDN (domain fronting), which an allowlist of names can't stop. Needs Docker Engine 26 or later; an older one refuses the run with `docker_engine_too_old`. Runner logs each allowed or refused host when a run ends. |
139
+ | `rooms[].toolchains` | Optional toolchains for the room's tasks: `["rust"]`, `["python"]` or both. `[]`, the default, runs tasks in Runner's base image (shell tools and Node 22). `rust` adds Rust 1.100.0 (cargo, rustc, rustfmt, clippy) with gcc as its linker; `python` adds Python 3.14.10 and uv 0.13.9. Each needs `shell` in `tools`. Runner builds the room's image from its own pinned Dockerfiles the first time a task needs it, which takes a few minutes and counts against that run's time; after that it's reused. A toolchain adds no network: to fetch packages, list the registries in `network`, `index.crates.io` and `static.crates.io` for crates, `pypi.org` and `files.pythonhosted.org` for PyPI. Toolchain rooms get larger bounds a build needs: 4 GB of memory, 1,024 processes and 10 minutes per command. An unknown or repeated name is refused when Runner starts, with `toolchain_unknown` or `toolchain_duplicate` and the entry's index, and toolchains without `shell` with `toolchain_needs_shell`. |
140
+ | `rooms[].repository` | `null` for a task that starts in an empty folder, or `{ "full_name": "owner/name", "provider_repo_id": 123456 }` for one GitHub repository. |
141
+ | `rooms[].allowed_orgs` | Other organizations whose tasks you'll run in this room. Do not list `owner_org`: your own organization is always allowed, and Runner refuses a policy that lists it. An empty list is fine. |
142
+ | `rooms[].acknowledged` | Both flags are required. Until `trust_statement` is `true`, Runner asks you at your terminal each time. Until `public_room_warning` is `true`, it also asks for a public room. |
143
+
144
+ Every ID is lower case. Unknown fields, missing fields, a field out of range, or a repeated room refuse the whole file.
145
+
146
+ **Where to find the IDs.** A workroom's `ws_…` ID is in its address in the web app: `/w/ws_…/…`. For your organization's `org_…` ID, open Settings, then Organization, and pick the organization: the `org=` in the address bar is its ID. If you can't find it, ask your Podster admin.
147
+
148
+ ### Writing the key file without the clipboard
149
+
150
+ Pasting a key into an editor often adds a newline or a space, and Runner refuses a key file that holds anything but one key. Write it from your terminal instead, so the key never touches the clipboard history of an editor:
151
+
152
+ ```bash
153
+ read -rs k
154
+ printf '%s' "$k" > <path>
155
+ chmod 600 <path>
156
+ unset k
157
+ ```
158
+
159
+ Paste the key when `read` waits (nothing shows as you paste), then press Return. Check the file without printing the key:
160
+
161
+ ```bash
162
+ head -c 7 <path>
163
+ ```
164
+
165
+ It should print `sk-ant-`.
166
+
167
+ ## Nudges (optional, off by default)
168
+
169
+ Runner polls, and that's enough to get every offer. If you want offers picked up sooner, you can also let Podster nudge Runner. A nudge only makes Runner poll sooner: it never carries a task, never starts a run by itself, and polling stays on, so a missed nudge loses nothing. **Proposed** (M7 step 14), not security-reviewed.
170
+
171
+ You need a public HTTPS address you control that forwards to your machine: a reverse proxy, or a tunnel you run (for example `cloudflared`). It ends TLS and forwards to Runner's port on `127.0.0.1` with the path unchanged. Podster sends only to `https://` at a DNS name on the default port. Runner listens only on `127.0.0.1`, never on your network.
172
+
173
+ ```bash
174
+ npx --ignore-scripts podster@test run --nudge-listen 8787 --nudge-url https://runner.example.com/podster/nudge
175
+ ```
176
+
177
+ Runner then:
178
+
179
+ 1. listens on `127.0.0.1:8787`;
180
+ 2. registers the address with Podster as this agent's nudge endpoint, and keeps the signing secret Podster gives it in the key store with its other keys, never in a file, a log or an argument;
181
+ 3. asks Podster to check it: Podster sends one signed challenge to the address, and Runner answers with a proof only the secret can make.
182
+
183
+ Runner prints the endpoint's version. An admin of the agent's organization switches the nudge on for that version in Podster; the agent can't. Starting Runner again with the same address keeps the registration and the switch. A new address, or a secret Runner no longer holds, needs the check and the switch again.
184
+
185
+ Runner takes a request only if its signature checks out under the secret and its time is within 5 minutes, before reading anything in it. It refuses replays, bodies over 8 KB and anything but a nudge or the challenge, and it limits how many requests it takes a minute. Stopping Runner closes the port. Podster switches the endpoint off after 3 failed nudges in a row; polling goes on either way.
186
+
187
+ ## Linux
188
+
189
+ **Validated so far only by CI's Linux job,** on GitHub's Ubuntu runner with Docker Engine (S-47). That job builds both images, starts the containers with the relay, and checks that the provider key is in none of them, that the relay refuses a request without its per-run token, and that nothing is left afterwards. It calls no provider. No task has run end to end with Claude Code on Linux yet.
190
+
191
+ You need:
192
+
193
+ - Docker Engine, which your user can reach without `sudo`: `docker version` names a server. Rootful Docker only. Rootless Docker, user-namespace remapping, and SELinux enforcing on bind mounts aren't supported yet, so Runner's check fails there.
194
+ - `docker` at `/usr/bin/docker` or `/usr/local/bin/docker`.
195
+ - Runner's home and the workspace root in the Linux file system, owned by you. On Linux, Runner's home path may be at most 51 bytes, so each run's Unix socket path fits; the default, `~/.podster-runner`, does. A longer `--home` is refused with a message saying so.
196
+
197
+ How it differs from macOS:
198
+
199
+ - **The relay.** On a Mac, Claude Code's requests reach Runner's listener over TCP through Docker Desktop's `host.docker.internal`. On Linux the listener is a Unix socket in the run's own folder, mode 600, which only the relay container mounts, read-only, and forwards to with `socat`. The relay joins no network but the run's internal one, and no TCP port opens on your machine. The per-run token is still required.
200
+ - **A check before any task.** `run --provider-key-file` first checks that Docker answers, then sends one request from a throwaway Claude Code container through the relay to a throwaway listener. If either fails, Runner refuses to run tasks (`linux_check_failed`), says which part failed, and runs nothing. Pairing and polling still work.
201
+ - **Where your keys go.** If the Secret Service answers (GNOME Keyring or KWallet, through `/usr/bin/secret-tool`), Runner keeps its keys there. Otherwise it keeps them in files under `keys/` in Runner's home: the folder mode 700 and each file mode 600, both yours, each replaced whole when written. Runner refuses a key folder or file with any other mode or owner. Anyone who can read your files can read these. Runner prints one line saying which store it uses. The choice is made once per home, in `key-store` there, so a locked keyring later shows as an error rather than a lost pairing.
202
+
203
+ ## Windows (WSL2)
204
+
205
+ **Validated only by CI's Linux job and by M7's staging run (step 16) on Long's machine.** Nothing else has run Runner under WSL2.
206
+
207
+ Runner on Windows runs inside a WSL2 Linux distro and follows the Linux path above. Native Windows is refused, with a message pointing here.
208
+
209
+ 1. Install WSL2 and a distro such as Ubuntu: `wsl --install` in PowerShell.
210
+ 2. Install Docker Desktop for Windows with its WSL2 backend.
211
+ 3. In Docker Desktop, open **Settings > Resources > WSL integration** and turn it on for your distro. Apply, then open a new terminal in the distro.
212
+ 4. In the distro, `docker version` should name a server. Install Node 22 or later in the distro, not on Windows, and run the `npx --ignore-scripts podster@test …` commands above from the distro's terminal.
213
+ 5. Keep Runner's home and your workspace root in the distro's own file system, such as `~/.podster-runner`. Runner refuses either one under `/mnt/<drive>` (the Windows file system, where Linux file modes aren't enforced and access is slow), and refuses Runner's home on any 9p or drvfs mount.
214
+
215
+ A WSL2 distro usually has no Secret Service, so Runner uses its file store there and says so.
216
+
217
+ ## Where it comes from
218
+
219
+ Each version is built and published by the `runner-prerelease` workflow on `main` of `github.com/thachp/podster`, with npm provenance. The one exception is the first, `0.0.1-test.1`, which the owner published once from that workflow's own build, without provenance, on 2026-11-19 (see `docs/runner-prerelease.md` in the repository). The package refuses a plain `npm publish` from a machine, but that check only catches mistakes: what limits who can publish is npm's own trusted-publisher and package settings. MIT licensed.
@@ -0,0 +1 @@
1
+ export {};