pi-session-mcp 0.12.0 → 0.13.0

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 (62) hide show
  1. package/.pi-session-mcp-cli/client-adapters/mcp-verifier.js +8 -3
  2. package/.pi-session-mcp-cli/config.js +15 -1
  3. package/.pi-session-mcp-cli/doctor.js +44 -1
  4. package/.pi-session-mcp-cli/execution-modes.js +13 -3
  5. package/.pi-session-mcp-cli/execution-profile.js +1 -0
  6. package/.pi-session-mcp-cli/sandbox-shell.js +254 -0
  7. package/.pi-session-mcp-cli/session-tools.js +6 -2
  8. package/.pi-session-mcp-cli/writer-boundary.js +27 -0
  9. package/.pi-session-mcp-cli/writer-lifecycle.js +6 -4
  10. package/.pi-session-mcp-cli/writer-limits.js +19 -0
  11. package/.pi-session-mcp-cli/writer-state.js +5 -2
  12. package/CHANGELOG.md +96 -0
  13. package/README.md +2 -1
  14. package/dist/capabilities.d.ts +1 -0
  15. package/dist/capabilities.js +3 -1
  16. package/dist/client-adapters/mcp-verifier.js +8 -3
  17. package/dist/config.d.ts +1 -0
  18. package/dist/config.js +15 -1
  19. package/dist/confined-tools.d.ts +29 -0
  20. package/dist/confined-tools.js +118 -0
  21. package/dist/doctor.d.ts +5 -1
  22. package/dist/doctor.js +44 -1
  23. package/dist/execution-modes.d.ts +15 -1
  24. package/dist/execution-modes.js +13 -3
  25. package/dist/execution-profile.d.ts +4 -0
  26. package/dist/execution-profile.js +1 -0
  27. package/dist/main.js +6 -2
  28. package/dist/pi-adapter.d.ts +1 -1
  29. package/dist/pi-adapter.js +1 -0
  30. package/dist/sandbox-shell.d.ts +71 -0
  31. package/dist/sandbox-shell.js +254 -0
  32. package/dist/sdk-pi-adapter.d.ts +17 -1
  33. package/dist/sdk-pi-adapter.js +64 -10
  34. package/dist/session-tools.d.ts +4 -2
  35. package/dist/session-tools.js +6 -2
  36. package/dist/setup-cli.js +40 -6
  37. package/dist/setup-modes.d.ts +3 -0
  38. package/dist/setup-modes.js +18 -1
  39. package/dist/setup-writers.js +37 -6
  40. package/dist/tool-schemas.d.ts +4 -0
  41. package/dist/tool-schemas.js +1 -0
  42. package/dist/writer-boundary.d.ts +2 -0
  43. package/dist/writer-boundary.js +27 -0
  44. package/dist/writer-lifecycle.d.ts +1 -0
  45. package/dist/writer-lifecycle.js +6 -4
  46. package/dist/writer-limits.d.ts +13 -0
  47. package/dist/writer-limits.js +19 -0
  48. package/dist/writer-relay.js +1 -1
  49. package/dist/writer-state.d.ts +11 -0
  50. package/dist/writer-state.js +5 -2
  51. package/docs/acceptance.md +266 -0
  52. package/docs/adr/0013-hardened-read-only-profiles.md +182 -0
  53. package/docs/doctor-design.md +2 -0
  54. package/docs/execution-modes.md +59 -3
  55. package/docs/installation.md +34 -1
  56. package/docs/isolation-setup.md +31 -2
  57. package/docs/roadmap.md +8 -1
  58. package/docs/session-mcp.md +13 -0
  59. package/docs/threat-model.md +50 -0
  60. package/docs/tool-contracts.md +30 -3
  61. package/package.json +1 -1
  62. package/skills/pi-session-orchestration/references/start-errors.md +1 -1
@@ -31,6 +31,14 @@ clone tags, then imports the selected base tags when enabled. Worker-created
31
31
  tags are not collected work and do not affect the collected digest. The setting
32
32
  participates in settings drift, not the acceptance fingerprint.
33
33
 
34
+ Ignored files in a persistent writer's clone survive reset and finish by
35
+ default (`clean: "untracked"`); an ephemeral writer's finish recreates the
36
+ clone. Add `--clean all` to a container mode request to remove
37
+ them with `git clean -ffdx`; the per-writer `/pi/go`, `/pi/uv` and `/pi/npm` caches outside
38
+ the clone stay untouched. Changing this setting requires collecting work,
39
+ removing the writer with `--writer <name> --remove`, and provisioning again;
40
+ it participates in settings drift, not the acceptance fingerprint.
41
+
34
42
  ## Prerequisites
35
43
 
36
44
  - Linux with usable **rootless** Podman, Node.js 22.19.0 or newer and Git.
@@ -60,7 +68,7 @@ participates in settings drift, not the acceptance fingerprint.
60
68
  | Workspace | Separate full clone per writer, created via a base bundle; no hardlinks or shared linked-worktree metadata |
61
69
  | Wrapper | Generated stdio-only launcher bound to the release and writer name; no daemon between client connections |
62
70
  | Boundary | Rootless keep-id, read-only root, capability drop, no-new-privileges, tmpfs home and /tmp; clone read-write with hooks/config overmounted read-only |
63
- | Mounts | Only clone, release read-only, contained config read-only, isolated writable agent directory, optional Go or uv/npm cache; no per-session writer spool mount ([below](#event-spool-mount)) |
71
+ | Mounts | Only clone, release read-only, contained config read-only, isolated writable agent directory, optional Go, uv/npm or npm-only cache; no per-session writer spool mount ([below](#event-spool-mount)) |
64
72
  | Configuration | One workspace, selected coding profiles and a synthetic read-only default; internal acknowledged host mode permits writes only in the contained clone |
65
73
  | Credentials | Selected provider entries only; OAuth refresh token emptied, API keys retained; no host SSH/Git/client credentials intentionally mounted |
66
74
  | Acceptance | Explicit uncontained host control, then provider-free contained harness per writer; fingerprint gates readiness |
@@ -98,7 +106,13 @@ list and providers in its state, and the whole rendered writer configuration
98
106
  with each selected profile's model, thinking level and skills and the event
99
107
  delivery. A difference reports `writer_settings_changed` and leaves the writer
100
108
  as it is
101
- ([#134](https://github.com/plagor44-ux/pi-session-mcp/issues/134)). The same
109
+ ([#134](https://github.com/plagor44-ux/pi-session-mcp/issues/134)). On
110
+ apply the check runs before the mode is written, so a kept writer with a
111
+ difference refuses the mode change itself: the modes file stays unchanged
112
+ and no kept writer is changed; a surplus writer of a smaller count may already
113
+ have been fenced
114
+ ([#163](https://github.com/plagor44-ux/pi-session-mcp/issues/163));
115
+ reconciliation repeats the check under each writer's lease. The same
102
116
  holds for the other findings of this check: `podman_unavailable` when Podman
103
117
  cannot be asked, `image_unavailable` when Podman answers but cannot resolve the
104
118
  image, and `container_profile_unsupported` when a selected coding profile is
@@ -254,5 +268,20 @@ or npm variables are set. The cache belongs to one writer: it is never shared
254
268
  between writers and never a host cache mount, and setup does not install uv
255
269
  or npm for you.
256
270
 
271
+ Optional container settings `--cpus`, `--cpu-shares` and `--memory` bound the
272
+ serving container's CPU or memory use. CPU shares are relative weight under
273
+ contention against sibling cgroups in the operator's user slice only; CPU
274
+ count and memory are hard caps. Setup requires the corresponding host cgroup
275
+ controllers. A later mode request that omits a limit flag keeps the recorded
276
+ limit; `--cpus none`, `--cpu-shares none` and `--memory none` remove it;
277
+ changes update existing writer state without reprovisioning. See
278
+ [Resource limits](execution-modes.md#resource-limits) for ranges and syntax.
279
+
280
+ A Node writer can instead use `--cache npm`, recording `cache: "npm"` and
281
+ mounting its private directory at `/pi/npm` with
282
+ `npm_config_cache=/pi/npm/cache`. No other npm variables are set. Like the Go
283
+ and uv caches, it survives reset, finish and recreate, and is removed with the
284
+ writer. Repeat the cache flag on later mode requests.
285
+
257
286
  See [Execution modes](execution-modes.md#migration-from-manual-writers) for
258
287
  migration limitations and [Doctor](doctor-design.md) for offline writer checks.
package/docs/roadmap.md CHANGED
@@ -15,7 +15,14 @@ mean they are implemented or that their gates passed.
15
15
  - 2026-10-28: [ADR 0012](adr/0012-leased-writer-pool.md) was accepted and
16
16
  implemented in #157: one host registration with a leased container writer
17
17
  pool, base-aware allocation and host-spool events. Prepared as minor release
18
- 0.12.0 together with #151 and #154; no new live acceptance is claimed.
18
+ 0.12.0 together with #151 and #154, released the same day and installed with
19
+ a live relayed coding session; 0.12.1 fixes client-target verify (#160).
20
+ Both machines run 0.12.1, and #151 and #154 passed their live checks. The
21
+ opt-in `--clean all` (#162) follows as an unreleased change.
22
+ - 2026-10-28: [ADR 0013](adr/0013-hardened-read-only-profiles.md) (#169),
23
+ implemented and unreleased: workspace-confined read tools for every read-only
24
+ profile and the opt-in bubblewrap shell (`shell: "sandboxed"`). It changes the
25
+ public contract and needs minor release 0.13.0.
19
26
 
20
27
  The explicit 2026-10-17 user request adds a bounded development-only
21
28
  [token-footprint measurement](sprints/2026-10-17-token-footprint.md), following
@@ -137,6 +137,19 @@ made safe by this configuration. Use dedicated credentials and external process
137
137
  isolation where stronger boundaries are required. Do not grant a generic tool that
138
138
  can dispatch arbitrary unreviewed operations and assume that its name is a boundary.
139
139
 
140
+ Granting research tools (search, documentation lookup) to a read-only profile
141
+ uses this same `mcpServers` mechanism with `readOnly: true`. Since every
142
+ read-only profile is confined to its workspace and selected skill directories
143
+ ([ADR 0013](adr/0013-hardened-read-only-profiles.md)), such a tool cannot be fed
144
+ files outside them through the model's read tools. Prefer query-style tools
145
+ (search, documentation lookup) over tools that fetch free URLs: a fetch tool
146
+ with free-form input is still a channel for whatever the workspace contains.
147
+ The MCP server itself is trusted local code and is not confined.
148
+ A skill directory that equals or contains the operator's home, the configuration
149
+ file's directory or `~/.pi` is not a read root; only the skill file itself is,
150
+ so a catalog entry such as `./SKILL.md` next to the configuration does not
151
+ expose the configuration.
152
+
140
153
  Only local stdio tools are covered here. HTTP/SSE/OAuth transports, sampling,
141
154
  elicitation, roots negotiation, separate resource/prompt APIs and global extension
142
155
  loading are not added. MCP tool invocations are marked sequential within Pi's tool
@@ -6,6 +6,54 @@ Pi Session MCP trusts the local process that launches and speaks MCP over inheri
6
6
 
7
7
  ## Threats and mitigations
8
8
 
9
+ - **Read-only file disclosure and the sandboxed shell ([ADR 0013](adr/0013-hardened-read-only-profiles.md)):**
10
+ read-only sessions run in the host server process. `read`, `grep`, `find` and
11
+ `ls` of every read-only profile therefore accept only paths inside the
12
+ workspace and the directories of the selected skill files, so Pi credentials
13
+ and other files the operator can read stay unreachable even for a
14
+ prompt-injected worker. Each call is checked twice: the `path` argument is
15
+ resolved and canonicalized with `realpath` before the SDK tool runs
16
+ (arguments the SDK would rewrite, such as a leading `@` or `~`, a `file:`
17
+ URL, Unicode spaces or NUL, are refused so both resolve the same path), and
18
+ the `*Operations` hooks of `read`, `grep` and `ls` check the absolute path
19
+ again. `rg` and `fd` do not follow symlinks during traversal. A profile with
20
+ `shell: "sandboxed"` also gets `bash`, run as `/usr/bin/bwrap` (fixed path,
21
+ root-owned and not group- or world-writable, no `PATH` lookup) with
22
+ `--unshare-all`, `--disable-userns`, a cleared environment, no network, `/usr`
23
+ and `/etc` read-only, a tmpfs `/tmp`, and the workspace (and, for a linked
24
+ worktree whose pointers are consistent, the main repository's Git directory)
25
+ as a temporary overlay whose writes vanish with the command. The operator's
26
+ home, `PI_*` variables and the server's environment never reach the command.
27
+ The shell fails closed: an untrusted binary or a failing probe is
28
+ `sandbox_unavailable`, and a command whose sandbox cannot start fails; there
29
+ is no unsandboxed fallback. It is not allowed together with granted extension
30
+ tools, which may write.
31
+ - **Residual:** the confinement checks a path when the call starts, so a
32
+ concurrent writer in the same workspace (for example a host-mode coding
33
+ session) could swap a checked directory for a symlink before `rg` or `fd`
34
+ opens it; read-only workers cannot create symlinks themselves. Extension
35
+ hooks and granted extension tools run in the server process with the
36
+ operator's rights and are not confined; the confinement covers the built-in
37
+ tools only. The sandbox exposes `/etc` and the distribution's `/usr` and an
38
+ overlay of the workspace and, for worktrees, of the repository's Git
39
+ directory, including their configuration. Lock-dependent tests that need a
40
+ supported local filesystem can fail on the overlay. macOS, a VM backend and
41
+ network allowlists inside the sandbox are out of scope. The sandbox has no
42
+ memory, process-count or overlay upper-layer limits (only `/tmp` is limited to
43
+ 512 MiB and a command defaults to a 600 second timeout), so a prompt-injected
44
+ worker can exhaust memory or processes of the operator's user until the
45
+ command ends, as a host-mode coding session already can. When `bash`
46
+ truncates long output the SDK names a full-output file in the host's
47
+ temporary directory; confined `read` refuses it and the sandbox's `/tmp` is a
48
+ fresh tmpfs, so only the truncated output is available. `ls` omits entries
49
+ that are symlinks pointing outside the read roots, without a notice. A skill
50
+ directory that equals or contains the operator's home, the configuration
51
+ directory or `~/.pi` contributes only the skill file as a read root. On
52
+ timeout or abort the server kills bubblewrap and the PID namespace takes every
53
+ process of the sandbox with it. The start probe is cancelled with the start
54
+ request. A granted research
55
+ tool with free-form input (search, documentation lookup) is a possible
56
+ outbound channel for workspace content; prefer query-style tools.
9
57
  - **Unsafe diagnostics:** Doctor is a separate offline CLI with no MCP, Pi,
10
58
  provider, credential, or network dependency. Its human/JSON output is
11
59
  sanitized and its stable exit statuses are 0 (healthy), 1 (warning), 2
@@ -127,6 +175,8 @@ Pi Session MCP trusts the local process that launches and speaks MCP over inheri
127
175
  - Setup edits a Claude Code settings file, which is operator configuration. It writes one `PostToolUse` entry under the same dry-run, ownership and divergence rules as a registration: a read-modify-write with a compare-and-swap on the file bytes (a changed file is read again once, a second change fails with `settings_changed`), an atomic rename that keeps the file mode, a pending-before-write ownership record and no replacement or deletion of an entry it does not own. In a project scope it never follows a link below the project root. The entry holds absolute paths of the Node executable and the package, which must be free of shell metacharacters (`hook_path_unsafe`). Ownership records hold a fingerprint, never a path or a command.
128
176
 
129
177
  - **Concurrent writer use and orphaned containers ([ADR 0012](adr/0012-leased-writer-pool.md)):** new assets are the host-only lease directory/files, stable wrappers, relay subprocess/transport and recorded workspace default base. The launcher holds `~/.local/state/pi-session-mcp/leases/<name>.lock`, not the host server. Files are never deleted, opened without following links and checked for type, owner and mode (0700 directory, 0600 file). Every mutating setup operation takes the same lease with a bounded wait (`writer_busy`), including collect and acceptance. Mutating host children inherit its descriptor; nested launchers validate/adopt it. Neither container nor Podman's monitor receives it, so worker code cannot unlock it. Fixed session name `pi-writer-<name>` and label `pi-session-mcp.writer=<name>` supplement the lock. Under the lease the holder confirms absence by label and clone mount, removes orphaned containers and fails closed if absence is uncertain, before any credential or clone change. Stdin end, SIGTERM and SIGHUP trigger refresh join and container cleanup while the launcher still holds the fence; a killed holder's leftovers are removed by the next holder. The trusted same-UID operator must not replace lease files or mutate writers outside setup.
178
+ - **Writer resource fairness:** optional `--cpus` and `--memory` hard caps and `--cpu-shares` relative weight constrain serving containers when the Podman host exposes the required cgroup controllers. Caps are unlimited unless set, kept when a later mode request omits them, and removed only with `none`; maintenance containers are not limited. These are fairness measures for shared hosts, not a security boundary, and do not change acceptance or require reprovisioning.
179
+ - **Ignored writer files:** by default, ignored files in a persistent writer's clone survive reset and finish and reach the next task leased on that writer, invisible to baseline checks and collect. Opt in to `--clean all` to remove them on reset and finish; per-writer Go (`/pi/go`), uv/npm (`/pi/uv`) and npm-only (`/pi/npm`) caches outside the clone remain. These private writable caches survive reset, finish and recreate and are removed with the writer; they are not shared between writers or mounted from host package caches.
130
180
  - **Untrusted relay replies and wrong-base work:** inner replies are schema-validated and size-bounded, never raw-frame passthrough. Host IDs, turn state and spool remain authoritative. Allocation matches the requested/default branch from host writer state, compares profile selection and rechecks placement after inner start; the inner guard still decides baseline admission. Transport loss fails the turn and makes further prompts refuse with `writer_session_lost`; get and close remain available. Branch matching is not commit freshness: results expose the selected base commit for review. Migration requires closed sessions/controllers, removes only owned registrations, rebinds wrappers and re-accepts provider-free; a divergent registration keeps the writer legacy rather than entering the pool.
131
181
 
132
182
  ## Residual risks
@@ -40,7 +40,7 @@ records name the package version and the build they ran on, see
40
40
  ```json
41
41
  {
42
42
  "ok": true,
43
- "server": { "name": "pi-session-mcp", "version": "0.12.0" },
43
+ "server": { "name": "pi-session-mcp", "version": "0.13.0" },
44
44
  "configuration": {
45
45
  "fingerprint": "sha256:0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
46
46
  "reloadPolicy": "restart-required"
@@ -56,6 +56,7 @@ records name the package version and the build they ran on, see
56
56
  "thinkingLevel": "medium",
57
57
  "extensions": [],
58
58
  "grantedExtensionTools": [],
59
+ "shell": "none",
59
60
  "skills": []
60
61
  }]
61
62
  }
@@ -63,9 +64,9 @@ records name the package version and the build they ran on, see
63
64
 
64
65
  `events.delivery` is `spool` when the loaded configuration enables turn-event delivery (`"events": { "delivery": "spool" }`) and `off` otherwise. It reports configured intent, except that it is `off` when the server found no spool location at startup (no `PI_SESSION_MCP_EVENTS_DIR` and no absolute `XDG_RUNTIME_DIR`, as under Codex); it makes no claim that the spool directory is writable, and it carries no path.
65
66
 
66
- The server sorts both arrays by alias with a deterministic code-point comparison. It copies only loaded configuration fingerprint/reload policy, the event delivery setting, configured aliases and workspace modes, and the nine documented profile fields. Each workspace has a required `mode`: `unset`, `host`, `container`, or `read-only`; a missing modes entry is reported as `unset`. Container entries also carry `writers` (configured count, not free capacity) and `defaultBase` (short branch name, or `null` if not yet recorded), not writer names or other writers' branches. `extensions` lists the configured extension specs (`npm:<name>@<version>`), empty when a profile loads none; it makes no claim that the package is installed. `grantedExtensionTools`, directly after `extensions`, lists the configured extension tool grants in configured order, `[]` when absent. It is configuration intent only, not proof of registration, activation or declaration to the model. `skills` lists the skill-catalog aliases that the profile selects, in configured order, `[]` when it selects none. It contains no paths, file names, contents or SDK diagnostics, and it is configuration intent only: it makes no claim that a skill file exists, loads, or will be read by the model. See [Pi skills](skills.md). It never copies the configuration path or contents, workspace paths, authentication state, SDK data, session/turn data, prompts, transcripts, or tool arguments/results. The handler reads the in-memory loaded snapshot only and does not call the registry, Pi adapter, provider, filesystem, or network. The fingerprint identifies the exact loaded bytes, not current-file freshness; provider/model fields describe configured intent and make no availability claim.
67
+ The server sorts both arrays by alias with a deterministic code-point comparison. It copies only loaded configuration fingerprint/reload policy, the event delivery setting, configured aliases and workspace modes, and the ten documented profile fields. Each workspace has a required `mode`: `unset`, `host`, `container`, or `read-only`; a missing modes entry is reported as `unset`. Container entries also carry `writers` (configured count, not free capacity) and `defaultBase` (short branch name, or `null` if not yet recorded), not writer names or other writers' branches. `extensions` lists the configured extension specs (`npm:<name>@<version>`), empty when a profile loads none; it makes no claim that the package is installed. `grantedExtensionTools`, directly after `extensions`, lists the configured extension tool grants in configured order, `[]` when absent. It is configuration intent only, not proof of registration, activation or declaration to the model. `shell`, directly after `grantedExtensionTools`, is `none` or `sandboxed` ([ADR 0013](adr/0013-hardened-read-only-profiles.md)). `sandboxed` means the profile is configured to get a `bash` tool that runs each command in a network-less bubblewrap sandbox; it is configuration intent only and no claim that the sandbox works on this host (a failing sandbox surfaces as `sandbox_unavailable` at session start, and Doctor checks it offline). `skills` lists the skill-catalog aliases that the profile selects, in configured order, `[]` when it selects none. It contains no paths, file names, contents or SDK diagnostics, and it is configuration intent only: it makes no claim that a skill file exists, loads, or will be read by the model. See [Pi skills](skills.md). It never copies the configuration path or contents, workspace paths, authentication state, SDK data, session/turn data, prompts, transcripts, or tool arguments/results. The handler reads the in-memory loaded snapshot only and does not call the registry, Pi adapter, provider, filesystem, or network. The fingerprint identifies the exact loaded bytes, not current-file freshness; provider/model fields describe configured intent and make no availability claim.
67
68
 
68
- Setup verify accepts and validates `grantedExtensionTools` in its bounded direct
69
+ Setup verify accepts and validates `grantedExtensionTools` and `shell` in its bounded direct
69
70
  MCP capabilities check, without starting a session or using a provider.
70
71
  **Verifier limit:** at maximum field sizes (8 extension specs of 256 characters,
71
72
  32 grants of 64 characters, provider and model of 256 characters each), at most
@@ -111,6 +112,31 @@ tools: registered-but-inactive tools fail closed too. Lazy registration in
111
112
  decision: third-party tools may write, and workspace modes `container` and
112
113
  `read-only` do not restrict them. See [ADR 0010](adr/0010-read-only-extension-tools.md).
113
114
 
115
+ ### Read-only confinement and the sandboxed shell
116
+
117
+ [ADR 0013](adr/0013-hardened-read-only-profiles.md) confines `read`, `grep`,
118
+ `find` and `ls` of **every** read-only profile to the session's workspace and
119
+ the directories of the profile's selected skill files. A `path` outside them
120
+ (absolute, `..`, `~`, a symlink leading out, a leading `@`, a `file:` URL, a
121
+ Unicode space or NUL) is an ordinary tool error to the model,
122
+ `Path is outside the allowed read roots`, without the path. It is not a start
123
+ or turn error and has no code. Files outside the workspace that earlier
124
+ read-only sessions could read are no longer readable. Coding profiles are
125
+ unchanged.
126
+
127
+ The optional profile field `shell` takes the single value `"sandboxed"`. It is
128
+ valid only on `read-only` profiles, not together with `grantedExtensionTools`,
129
+ and only on Linux; any other combination prevents startup with
130
+ `invalid_execution_profile_config`. Such a profile also has a `bash` tool. Each
131
+ command runs under `/usr/bin/bwrap` with no network, the workspace as a
132
+ temporary copy-on-write overlay (writes vanish when the command ends), `/usr`
133
+ and `/etc` read-only and no other host path. Before the session starts the
134
+ server runs a probe through the same sandbox; if the binary is untrusted or the
135
+ probe fails, start fails with `sandbox_unavailable` and no session exists. There
136
+ is no unsandboxed fallback. For a linked worktree the main repository's Git
137
+ directory is mounted as a second temporary overlay when its pointers are
138
+ consistent, so `git log` and `git blame` work. The sandbox's `/tmp` is limited to 512 MiB, and a command without a `timeout` argument is killed after 600 seconds.
139
+
114
140
  ## Automated writer boundary (Plan B)
115
141
 
116
142
  The host routes container coding through its relay adapter under
@@ -166,6 +192,7 @@ Public MCP errors are stable and sanitized. Their messages do not include inputs
166
192
  | `extension_tool_conflict` | An extension tool name collides with a built-in, MCP or other extension tool, or is unsafe: not 1 to 64 letters, digits, `_` or `-` (not starting with `-`), or reserved for MCP (`mcp__` prefix, `list_mcp_resources`, `list_mcp_resource_templates`, `read_mcp_resource`). |
167
193
  | `extension_tool_missing` | A granted extension tool is not registered at load or is not active and declared to the model at admission. Fixed message: `Granted Pi extension tool is not available`; class `needs_operator` (operator needed; do not retry or switch profiles). |
168
194
  | `skill_load_failed` | A skill that the profile selects could not be loaded: a missing (also a `builtin:` name that matches no override and no shipped skill), unreadable or oversized (over 256 KiB) file, an invalid skill, two selected files with the same Pi skill name, two aliases on the same canonical file, or a skill with `disable-model-invocation: true`. The message is the fixed `Configured Pi skill could not be loaded`; it never contains a path, skill name or SDK text. |
195
+ | `sandbox_unavailable` | A profile with `shell: "sandboxed"` cannot start its shell sandbox: the bubblewrap binary is missing or untrusted, or the probe run for the session's workspace failed or was cancelled with the start request. Fixed message: `Read-only shell sandbox is not available`; class `needs_operator` (operator needed; do not retry or switch profiles). |
169
196
  | `pi_session_creation_failed` | Pi session construction failed without a more specific safe classification. |
170
197
  | `writer_uncollected` | The writer is not at its collected baseline, or its guard/Git state could not be verified; controller must collect and reset it. |
171
198
  | `writer_busy` | Controller action: a session or another operation holds the writer; wait for or close it. Setup waits briefly (10 seconds) for the lease, then fails with this code. |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-session-mcp",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "Local stdio MCP server for controlled Pi coding-agent sessions",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -2,7 +2,7 @@
2
2
 
3
3
  Load this file only after a `pi_session_start` call has failed. Classify the error by its `code` alone. Never decide by the message, provider text or any other free text, and never infer a cause. Each code below is in exactly one class.
4
4
 
5
- - Operator needed (do not retry and do not switch to another profile; report the code and stop that task): `unknown_execution_profile`, `unknown_workspace`, `workspace_mode_forbids_coding`, `unknown_provider`, `unknown_model`, `model_unavailable`, `thinking_level_unavailable`, `local_authentication_missing`, `execution_selection_mismatch`, `skill_load_failed`, `extension_not_installed`, `extension_version_mismatch`, `extension_tool_conflict`, `extension_tool_missing`, `external_mcp_no_tools`, `external_mcp_grant_tool_missing`, `external_mcp_activation_mismatch`, `writer_not_ready`, `container_runtime_unavailable`, `server_stopping`. Writer readiness needs repository setup and acceptance; runtime unavailability needs usable rootless Podman. The last code means the server is shutting down: a new server process is needed, not a retry.
5
+ - Operator needed (do not retry and do not switch to another profile; report the code and stop that task): `unknown_execution_profile`, `unknown_workspace`, `workspace_mode_forbids_coding`, `unknown_provider`, `unknown_model`, `model_unavailable`, `thinking_level_unavailable`, `local_authentication_missing`, `execution_selection_mismatch`, `skill_load_failed`, `sandbox_unavailable`, `extension_not_installed`, `extension_version_mismatch`, `extension_tool_conflict`, `extension_tool_missing`, `external_mcp_no_tools`, `external_mcp_grant_tool_missing`, `external_mcp_activation_mismatch`, `writer_not_ready`, `container_runtime_unavailable`, `server_stopping`. Writer readiness needs repository setup and acceptance; runtime unavailability needs usable rootless Podman. The last code means the server is shutting down: a new server process is needed, not a retry.
6
6
  - Controller action (do not blindly retry or switch profiles; collect and reset the writer for uncollected work, or wait for or close the open coding session for a busy writer; resolve pool state, lost sessions or inapplicable base before a fresh start): `writer_uncollected`, `writer_busy`, `writer_unavailable`, `writer_session_lost`, `base_not_applicable`.
7
7
  - Transient (retry at most once after a pause, then report): `external_mcp_unavailable` (an external MCP server that cannot connect, times out or breaks the protocol), `extension_load_failed` (an invalid package, but also a start timeout), `local_authentication_unavailable` (local authentication could not be resolved within its deadline).
8
8
  - Unknown (report the code; at most one retry in a fresh session): `pi_session_creation_failed`. Any code not listed above is also unknown.