npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@yandy0725/pi-sandbox

v1.12.0

Published

pi coding-agent extension: process-level sandbox (bwrap / landlock / seatbelt / windows-acl) — workspace writable, everything else readable, fail-closed

Readme

pi-sandbox

pi coding-agent extension: process-level sandbox (bwrap / landlock / seatbelt / windows-acl) — workspace and detected tool storage writable, everything else readable, fail-closed.

Install

# From npm
pi install npm:@yandy0725/pi-sandbox

# Or from a local checkout
pi install .

Requires pi >= 1.5.0.

Hosts older than 1.5.0 are unsupported, and pi does not check or warn about this peer floor when installing the extension. On such a host the extension may fail during ESM linking; pi then falls back to the unconfined built-in bash, write, and edit tools (and powershell on Windows). Upgrade pi first, then use /permission and the extension load status to confirm that pi-sandbox is active.

How it works

bash commands are wrapped in a platform sandbox runner and spawned locally (path transparent: host paths work as-is); the write/edit tools run an in-process write fence before execution; read is unrestricted.

Scope: model-issued work only. A !command / !!command you type yourself (also the RPC bash command) is executed by pi itself through the user_bash event, which this extension does not handle — it runs as your own shell, unconfined by the modes above. The same holds for any other process you start outside pi.

| Platform | Runner | Mechanism | |---|---|---| | Linux | bwrap (preferred) | --ro-bind / / whole filesystem read-only + rw binds of the workspace and the host /tmp | | Linux | landlock-run (fallback, precompiled binary shipped with the package) | Landlock LSM allow list: / read-only, workspace + /tmp writable | | macOS | sandbox-exec (built in) | Seatbelt SBPL: deny file-write* + workspace/temp exceptions | | Windows | windows-acl (built in, partial enforcement) | Restricted-token sandbox: WRITE_RESTRICTED token + capability-SID ACL grants on the workspace and %TEMP% + Low mandatory integrity label; powershell tool only (bash is refused in confined modes) | | Other | none | fail-closed: confined commands are always refused, never silently run bare |

Windows

The windows-acl runner starts each confined command from a WRITE_RESTRICTED token whose integrity level is lowered to Low. In workspace-write the token also carries capability SIDs granted write access to the workspace and the host %TEMP%, with an inheritable NO_WRITE_UP label on both roots; read-only grants no write capability. Enforcement is partial, with three structural gaps inherited from the reference implementation:

  • an NTFS hard link aliases the file object: a hard link to an authorized file inside the workspace is equally writable from outside it
  • reads are unconfined: like every other runner here, a confined process can read everything you can read
  • files tagged by another AppContainer tool's package SID are unreadable to the Low-integrity child (remove the foreign ACE or reinstall the tree to recover)

The confined shell is the powershell tool only. On Windows, pi-sandbox registers its confined bash with exposure: "hidden", which makes it registered but unreachable: the model never sees it, and naming it (defaultTools, --tools, setActiveTools()) does not activate it. Keeping the registration is deliberate — extension tools shadow same-named built-ins, so the bash name stays occupied by this definition and no unconfined built-in bash can be reached on Windows; should a future host change how hidden is honored, that definition still refuses every confined call (fail-closed, never spawned). bash is never run unconfined here unless you explicitly switch to danger-full-access, the only bypass (where it runs bare, as everywhere else).

Known limitation: defaultTools cannot deselect an extension-registered tool (-name entries only remove built-ins, and extension tools are auto-activated unless their definition opts out). pi-sandbox does not ask you to configure around this: on Windows the bash name is withdrawn from the model at the definition level (exposure: "hidden"), so there is nothing to configure away. If powershell is not active (a selection that leaves it out), /permission shows shell: powershell only (not activated); { "defaultTools": ["+powershell"] } adds it back. When the activation state cannot be determined at all — the extension ctx is stale after a session swap or reload, or reading the active tool list throws — the status line says shell: powershell only (activation unknown) instead of guessing: a bare shell: powershell only would read as "activated".

Supported Windows range. Same as the upstream design this backend ports (deepseek-harness): no new OS floor — the mechanism is a WRITE_RESTRICTED token plus a Low mandatory label, both legacy APIs — which is exactly why that route was chosen over mxc (Windows 11 24H2+). End-to-end verification in this repository ran on Windows 10 Enterprise LTSC 2019 (build 17763.316): the automated e2e suite and the manual acceptance checklist are green there. Newer builds are expected to work (nothing in the backend depends on them), but have not been exercised here yet. Note the upstream tests run on Windows Server 2025, so its test fixtures are not portable to older builds; this package's Windows fixtures deliberately use version-independent primitives.

PowerShell language mode follows startup constraints, not the ACL boundary: under read-only PowerShell may degrade to ConstrainedLanguage (Add-Type/COM/reflection fail) because %TEMP% is not writable; workspace-write keeps FullLanguage.

NUL is writable in both modes — an environment property of the device (its DACL grants Everyone read/write/execute), not a capability grant, so it holds regardless of which roots the token was granted. It is reachable only through the device spellings: cmd's > NUL and Node's \\.\NUL. A relative NUL is not the device: libuv builds NT paths and does not apply the Win32 device-name mapping, so writeFileSync('NUL', …) is an ordinary file named NUL in the child's cwd — allowed inside the workspace, denied outside it, exactly like any other name.

Standing security-descriptor changes. Granting is idempotent but never revoked: after pi exits, the ACEs, the world FILE_DELETE_CHILD deny and the Low mandatory label on the workspace and %TEMP% remain. Directories listed in ~/.pi/agent/sandbox-writable.json and detected built-in tool storage roots get the same standing changes in workspace-write (a per-directory capability ACE, the world FILE_DELETE_CHILD deny and a Low label); a directory that cannot be granted (you cannot change its ACL — no WRITE_DAC/WRITE_OWNER) makes the confined command fail closed — it is never run unconfined. The first grant to a large existing store recursively propagates descriptors and can lengthen that command substantially; propagation runs in the standalone runner, and later calls hit the exact-match fast path. This relaxes those trees for any Low-integrity process running as the same user, and clearing an inheritable label later does not walk back what already propagated to child objects. Switching back to read-only makes the capability ACEs inert (that token carries no capability SID) but does not remove them. The first grant eagerly propagates across the whole %TEMP% tree (seconds on a large tree); later calls hit the exact-match fast path. %TEMP% and TMP themselves are not rewritten — the sandbox's writable temp root is the host %TEMP%.

The %TEMP% cost. %TEMP% is a shared user tree: its subdirectories inherit the deny ACE, so a third party that opens its own temp subdirectory with GENERIC_ALL/FullControl is refused. DELETE-based deletes, MAXIMUM_ALLOWED and ordinary read/write opens are unaffected.

Denial classification is English-only. The denial dialects the tool matches to inject the [sandbox: …] denial marker, the escalation hint and the denial ledger are English Win32/cmd/PowerShell message text, matched against the child's stderr. On a localized Windows those messages are localized: the sandbox still denies the access (enforcement is language-independent), but the tool may not annotate the denial and the denial fast path will not arm (a proactive escalation request is still possible, subject to the process-wide rate limit). Treat a missing marker as a classification gap, not as a confinement failure.

koffi (the FFI layer for the Win32 calls) is a regular dependency, loaded lazily and only on Windows — the Win32 binding table is never materialized elsewhere.

The bundled diagnose-windows-sandbox-acl skill (diagnoses and repairs cases where Windows file permissions block pi-sandbox's grants) is contributed to pi on Windows only. Its repair modifies security descriptors, so it needs an unconfined caller — run it from an approved danger-full-access (or by hand).

Three permission modes

| Mode | File effects | |---|---| | read-only | only /dev/null writable | | workspace-write (default) | working directory + /tmp + os.tmpdir() + detected built-in tool storage + the extra roots listed in sandbox-writable.json writable, everything else read-only | | danger-full-access | sandbox bypassed entirely (explicit escape hatch) |

Network is always allowed (no network isolation).

/permission command

  • /permission — show the current status (mode/source, runner, workspace, and tool storage: auto (...) / off; custom roots appear as extra writable:, with (inactive: <mode>) when not applicable)
  • /permission <read-only|workspace-write|danger-full-access> — switch mode, process-wide: the next tool call in the parent session and in every subagent child session adopts it immediately

Escalation approval (model-initiated, dual-track)

bash/write/edit take two optional parameters: sandbox_permissions (workspace-write or danger-full-access) + justification (a one-sentence reason). A strictly wider request reaches the one-shot approval prompt through one of two tracks:

  • Denial fast path: when this session already had a real sandbox denial of the same kind (bash ↔ command, write/edit ↔ operation), the retry goes straight to approval and neither reads nor consumes the proactive budget — it is honored even when that budget is empty. A denial record is consumed once: one denial buys exactly one escalation retry (approval still applies to that one call only);
  • Proactive request: without a matching denial the request may still ask, but it consumes one token from a process-wide bucket: 3 tokens to start and at most 3, one refilled every 5 minutes (settled lazily, no timer, never persisted — a pi restart starts full again). The parent session and every subagent session in the same pi process share that one bucket, so concurrent children cannot multiply the prompts; a token is consumed when the request actually enters approval, and Allow once, Deny, cancellation and approval errors never refund it. With an empty bucket no prompt is shown: the call runs at the current mode and its normal successful result carries a [sandbox: proactive escalation was rate-limited …] note telling the model to continue confined rather than rewrite the call (paths that throw — a non-zero bash exit, a fence denial — keep the existing denial/error protocol instead);
  • same-mode requests and invalid targets enter neither track (no prompt, no token);
  • with no approval channel (headless, cross-process subagents) a strictly wider request still fails closed and nothing is executed, without consuming a token. A session with a direct UI can make proactive requests even without a session id; the denial fast path still requires a session id and a same-kind record;
  • the tools' standing rules state the same policy: escalate only when the exact call is known to need a wider mode (never defensively), denial retries do not consume the proactive budget, a rate-limited call continues at the current mode without being rewritten to bypass the sandbox, and Deny or unavailability ends in an explanation rather than a workaround;
  • placeholder parameters are normalized per field: omission and JSON null both mean "no request", and the parameter schema declares null explicitly — so models on strict-schema providers (where pi marks both fields as required) have a valid "no escalation" value to send; a "null" or blank string in justification is normalized the same way. String placeholders ("null" / empty / whitespace) get one more layer of protection: the tools' prepareArguments strips them before pi validates the arguments — strict-schema models often write the required-but-optional fields as the string "null", and this keeps such calls running instead of failing with an error that has nothing to do with the sandbox.

The prompt offers Deny / Allow once, Deny first so a stray Enter does not grant anything; after choosing Deny you may type an optional reason (press Enter to skip) that is passed back to the model with the rejection, so it understands why instead of retrying a rewritten command. A subagent child session's escalation (foreground or background) is forwarded to the parent session's prompt (in-process pi-subagents, and the parent must have UI); with no parent channel available (headless, cross-process subagents) escalation is always refused (fail-closed) — widen the process mode with /permission to unblock it.

Only the literal Allow once grants the escalation; Deny keeps its rejection message (plus the optional reason) and undefined means cancelled. Any other value coming back through the UI/RPC boundary (an RPC client echoing "Allow", null, an object) is an invalid approval and fails closed with nothing was executed. When the host is not a TUI, each dialog also carries a 300 s local deadline plus a local abort path: if the client never answers, the approval settles as cancelled (not as a denial) and nothing runs; a result arriving after that is discarded.

When approvals overlap, the host manages their dialogs. In the TUI, the newest dialog receives focus; earlier dialogs remain on the host's dialog stack, temporarily hidden rather than cancelled, and reappear when the dialogs above them close. If new approvals keep arriving, an earlier request may be handled later; pi-sandbox makes no ordering guarantee. /reload or switching sessions may leave the approval for the current call pending (host behavior) without affecting other approvals. In RPC mode, each approval request settles independently, and an unanswered one settles as cancelled at its 300 s local deadline.

Immediately before the initial approval selection, the visible UI's instance emits notify:request with { title: "Approval required", body: <approval title>, urgency: "critical" }. Brokered approvals use the parent instance's event bus, never the requesting child's. The optional denial-reason step emits nothing further. Delivery is fire-and-forget, and an announcement failure does not change approval control flow.

Cache/data relocation is out of policy. The tools' rules instruct the model never to work around the sandbox by relocating global cache/data directories into the workspace — via environment-variable overrides (XDG_CACHE_HOME, HOME, UV_CACHE_DIR, npm_config_cache, PNPM_HOME, …), cache-relocating flags (--cache-dir, --store-dir, …), or config files — and to run tools unmodified instead, including on the escalated retry: a relocation is silent, it suppresses the denial that would have armed the fast-path retry and bypasses approval altogether. This is a prompt-level policy only: pi-sandbox does not detect or refuse such commands, and an explicit user request to relocate stays legitimate. Common tools are covered by built-in storage profiles; other custom paths are added by the user in ~/.pi/agent/sandbox-writable.json. The model still must not relocate cache/data directories itself.

Configuration

Two files are read from the agent dir (~/.pi/agent/): sandbox.json for the sandbox itself, and sandbox-writable.json for the extra writable roots. Both are read once per pi process (the parsed config is cached), so config changes need a pi restart. A project-level <project>/.pi/sandbox.json or <project>/.pi/sandbox-writable.json is ignored silently — not parsed, not validated, not warned about. (The project directory is writable by the confined model, so a config layer there would hand the model the ability to rewrite its own mode / runnerCommand / writable roots.) Missing or corrupt files, and invalid values, fall back the same way as before; the two files fail independently — a broken sandbox-writable.json never changes mode or the runner settings.

~/.pi/agent/sandbox.json:

{
  "mode": "workspace-write",
  "runnerCommand": null,
  "runnerFailureSignatures": null,
  "probeTimeoutMs": 5000,
  "toolStorage": true
}

| Field | Default | Notes | |---|---|---| | mode | workspace-write | default permission mode; invalid values fall back to the default with a warning | | runnerCommand | null | custom bwrap-compatible runner argv (must be paired with the next field) | | runnerFailureSignatures | null | fatal diagnostic signatures for the custom runner (non-empty single lines) | | probeTimeoutMs | 5000 | runner capability probe timeout (positive) | | toolStorage | true | detect and grant built-in tool storage; false disables all profiles, invalid values warn and use the default |

~/.pi/agent/sandbox-writable.json is a bare JSON array of directory paths — no root key — so adding a root is a one-line edit:

["~/.cache/uv", "~/.local/share/pnpm/store", "/srv/team-data"]

Extra writable roots apply in workspace-write mode only, beyond the workspace and tmp. Entries must be absolute paths; ~ / ~/ (Win32 ~\) expand to your home, ~user is unsupported. Non-absolute, missing, or non-directory entries are warned about at load and ignored one by one; a file that is not a JSON array of strings (including invalid JSON) is warned about and ignored as a whole, leaving no extra roots. A missing file means no extra roots, silently — the same as []. extraWritableDirs inside sandbox.json is a leftover from 1.7.x: it is warned about and ignored — move the list to sandbox-writable.json.

Config warnings never go straight to the terminal: the config is read before any UI context exists, so warnings are buffered and then delivered by the first session with a UI — in the TUI they show up in the chat as a Warning: … line (rather than being painted over by the interface), while -p / JSON mode writes them to stderr.

Built-in tool storage

workspace-write detects and grants persistent storage for common tools by default, so ordinary uv sync, uv pip install, pnpm install, and similar commands need neither environment relocation nor escalation. Detection inspects PATH entries (playwright or playwright-cli) and fixed project entry points: mvnw / gradlew, node_modules/.bin/playwright / playwright-cli (including .cmd / .ps1), and a project-local virtualenv's playwright script (.venv or venv, bin/ or Scripts/). It never runs the tools, parses shell commands, or reads dependency manifests. Python Playwright writes the same browser storage as the Node package, so one profile covers both; the venv entries cover python -m playwright install without an activated venv, while pipx, uv tool, and pip --user installs are covered by the PATH entry. A Corepack entry activates the Corepack, pnpm, and Yarn profiles. Generic launchers such as npx do not activate Playwright unless a PATH or fixed local Playwright entry exists.

| Profile | Storage included | Main path overrides | |---|---|---| | pip | HTTP and wheel cache | PIP_CACHE_DIR, XDG_CACHE_HOME | | uv | dependency cache + managed Python python/ | UV_CACHE_DIR, UV_PYTHON_INSTALL_DIR, XDG | | npm | cache, logs, and npx content | npm_config_cache / NPM_CONFIG_CACHE | | Corepack | package-manager downloads and cache | COREPACK_HOME | | pnpm | store + cache + state + named lock directories | PNPM_HOME, XDG cache/data/state | | Yarn | Classic cache + Berry global cache/metadata | YARN_CACHE_FOLDER, YARN_GLOBAL_FOLDER | | Bun | global package cache (including optional links store) | BUN_INSTALL_CACHE_DIR | | Go | module cache + build cache | GOMODCACHE, GOCACHE, GOPATH | | Maven | local repository + Wrapper distributions | MAVEN_USER_HOME affects the wrapper only | | Gradle | caches/, daemon/, jdks/, wrapper/dists/ | GRADLE_USER_HOME | | vcpkg | binary/registries caches + manifest downloads/, buildtrees/, packages/ | VCPKG_DEFAULT_BINARY_CACHE, X_VCPKG_REGISTRIES_CACHE, VCPKG_DOWNLOADS, VCPKG_ROOT, XDG cache | | Playwright | downloaded browser binaries | PLAYWRIGHT_BROWSERS_PATH, INIT_CWD, XDG cache on Linux |

Paths follow Linux, macOS, and Windows conventions plus the parent process's environment. Examples on Linux: uv cache is ~/.cache/uv and the pnpm store is ~/.local/share/pnpm/store. On macOS, pip uses ~/Library/Caches/pip and the pnpm store uses ~/Library/pnpm/store. On Windows, uv cache is %LOCALAPPDATA%\uv\cache, managed Python is %APPDATA%\uv\data\python, and the pnpm store is %LOCALAPPDATA%\pnpm\store. pnpm locks grant only named children under the XDG runtime root or %LOCALAPPDATA%, never either shared base itself.

vcpkg caches use %LOCALAPPDATA%\vcpkg on Windows and $XDG_CACHE_HOME/vcpkg or ~/.cache/vcpkg on Linux/macOS; setting VCPKG_ROOT adds only its downloads/, buildtrees/, and packages/ children. Playwright uses %LOCALAPPDATA%\ms-playwright on Windows, ~/Library/Caches/ms-playwright on macOS, and $XDG_CACHE_HOME/ms-playwright or ~/.cache/ms-playwright on Linux. A relative PLAYWRIGHT_BROWSERS_PATH resolves from INIT_CWD, falling back to the workspace.

Missing built-in storage roots are created before an actual workspace-write call. Read-only, danger-full-access, and /permission queries create nothing. Every call revalidates the roots, so a deleted directory can be recreated on the next call. A root that cannot be created or validated is warned about and omitted without disabling confinement for unrelated commands. PATH, environment, and tool installation state are cached per process; restart pi after changing them.

Global installs stay blocked. uv tool install, uv pip install --system, pnpm add -g, global self-updates, PATH bin/shim directories, user configuration, and credentials gain no automatic write access. Creating global executable entries with an explicit uv python install is outside the storage grant; PEP 514 registry writes on Windows are not directory grants. A pnpm store selected on another volume, and custom paths set through config files or CLI flags, still require explicit user authorization. vcpkg's classic installed/ tree and Playwright's system Chrome/Edge install locations are not granted. PLAYWRIGHT_BROWSERS_PATH=0 selects package-local .local-browsers: workspace-local packages are already covered, while package locations outside the workspace require explicit authorization.

Use ~/.pi/agent/sandbox-writable.json for those custom paths and tools without a built-in profile. Unlike built-in roots, manual entries must already exist; the extension does not create them. Cargo has no first-version profile: its CARGO_HOME/.package-cache lives at the root, so granting the whole directory with the current directory-only pipeline would also grant bin/. Add it manually only if you accept that trade-off. Normal CMake builds need no global dependency cache; projects explicitly using the user package registry can grant POSIX ~/.cmake/packages manually.

Security notes

  • Confined processes can read everything you can read on the host (including ~/.ssh and the like) — that is this sandbox's design semantics (same as the deepseek harness); root-only files stay protected by file permissions
  • Built-in stores/caches/managed runtimes are part of the same-user trust domain: content written by a confined process may be reused by later unconfined tools. pnpm store integrity checks do not make an untrusted writer safe. Set toolStorage:false to disable all built-in grants
  • Do not put your home directory, ~/.pi, or any ancestor of pi's agent dir into sandbox-writable.json: the confined model could then rewrite the global sandbox config, AGENTS.md, or extensions — which run unconfined on the next start; such entries are warned about at load time, but still kept (warn-only)
  • Under bwrap, bash's /tmp is the host /tmp (rw bind, matching the write/edit fence and the landlock/macOS runners): confined commands can modify or delete the host's temporary files — including live session sockets and pi's own temp files — and the host's /tmp permissions apply as-is. If the host /tmp is not writable, neither is the sandbox's
  • On Windows the sandbox's temp root is the host %TEMP% (the windows-acl runner grants the real path and does not rewrite TMP/TEMP): confined commands can modify or delete the host's temporary files there — the same "the host tmp is the host tmp" semantics as the bwrap bind above
  • Confined child processes force LC_MESSAGES=C (so denial diagnostics stay classifiable) and do not touch your LANG/LC_CTYPE
  • Confined bash runs in its own process group (detached): timeout/abort kills the whole group, but if pi itself is hard-killed (e.g. SIGKILL), background grandchildren spawned by the command may survive (pi's internal child-tracking API is not available to extensions)
  • The landlock fallback is partial enforcement on older kernel ABIs (the status output says so)

Migrating from pi-container-sandbox 1.x

  • Config lives in the agent dir's global files only (~/.pi/agent/sandbox.json for the sandbox fields, ~/.pi/agent/sandbox-writable.json for the extra writable roots): project-level <project>/.pi/sandbox.json and <project>/.pi/sandbox-writable.json are ignored silently (move any settings you rely on to the global files). Legacy image/runtime/host sections are ignored with a warning — rewrite them as the new fields above as needed
  • The container runtime (docker/podman), image builds, runtime.mounts, the /sandbox command, --container* flags, and the external-path approval flow are not part of this package
  • Container-grade isolation (separate filesystem/network namespaces) is out of scope for this package. The old @yandy0725/pi-container-sandbox is retired from this repo (npm package deprecated; source in git history at pi-container-sandbox-v1.3.0)
  • If you still run the old @yandy0725/pi-container-sandbox: it and pi-sandbox are mutually exclusive — both take over bash/write/edit and both read the same global ~/.pi/agent/sandbox.json (with incompatible schemas); enable only one at a time, and uninstall or disable the other before switching. pi-sandbox ignores project-level files; the old package still reads its own project scope

Development

pnpm test              # unit + integration (integration auto-skips without a runner)
pnpm run typecheck
./tests/e2e.sh

Verifying escalation forwarding with a local build

The parent session can load a local pi-sandbox via pi -e <path>, but -e only affects the parent: pi-subagents builds a separate resource loader for each child session, so the child re-discovers extensions from agentDir and the project .pi/. If ~/.pi/agent/settings.json still declares npm:@yandy0725/pi-sandbox, the child loads the published build and forwarding fails silently (the child only reports requires approval, but no approval channel is available). Make both sides discover the same build:

AG=$(mktemp -d); cp ~/.pi/agent/auth.json "$AG/" 2>/dev/null || true
cat > "$AG/settings.json" <<EOF
{ "packages": ["<repo>/pi-sandbox", "<repo>/pi-subagents"] }
EOF
cd <writable project dir> && PI_CODING_AGENT_DIR="$AG" pi

Observations and the verification record live in docs/superpowers/specs/2026-09-30-escalation-approval-forwarding-design.md §11.

UI surface

| Method | Guard | Outside TUI (RPC / headless) | |---|---|---| | select + input (escalation approval for sandbox_permissions / file_operation requests; the input step collects an optional denial reason) | hasUI picks the channel; mode picks the deadline — only tui is treated as attended. A subagent session resolves the nearest registered parent channel that still has UI and uses that parent's ctx.mode, never the child's | Forwarded as extension_ui_request with a derived AbortSignal and timeout. A host that is not tui gets a local 300 s deadline per dialog plus a local abort path that races the host promise, so a client that silently drops the request settles as cancelled instead of hanging the turn, and anything that arrives after the deadline (including a late "Allow once") is discarded. Only the literal "Allow once" grants the escalation ("Deny" and cancellation keep their own branches); any other value ("Allow", null, an object) fails closed with nothing was executed. The deadline only cancels that approval: it never grants it and never records a user denial | | notify (config warnings, /permission feedback) | hasUI for warnings | Warning routing: notify when a UI is available; stderr only when no UI has ever appeared in the process (pi -p, JSON); a no-UI subagent session buffers them instead of printing over the parent's TUI |

License

MIT