Packages
What each package offers across the install boundary (its config files, commands, tools, environment variables, bus channels, wires and exports), with each item’s tier, is the public surface page.
Ours (developed here)
Only @gadhs/pi is published (#836). The ten sibling packages below are
private workspace packages (private: true) that move in lockstep with
`@gadhs/pi’s version and are bundled into it at pack time.
| Package | Purpose |
|---|---|
|
The distribution. |
|
Every publisher on Google Cloud Vertex AI — Claude through the Anthropic
SDK, Gemini through pi’s own Vertex adapter, the Model-as-a-Service models
Vertex serves through its OpenAI-compatible endpoint (Grok, gpt-oss, and the
open models Google hosts) — as three provider ids from one config file (ADR-005). Per-model
region routing (quota and availability are granted per |
|
The policy layer: four modes with per-mode models and rules, the
deterministic permission stages, the safety-only judge, subagent contracts,
the status line and inline traces. Depends on |
|
Delivery-workflow enforcement, mode-independent by design (yolo included):
commit format and mechanical attribution, |
|
Agency standards as content: the working-agreements digest, four language
profiles (Rust, TypeScript, Python, Java), the composition seam that injects
them each session, and the |
|
Agency-standard subagent definitions (Explore on Gemini 4 Hydrogen, argued
on the model-battery page; Research on Sonnet 5.5;
and general-purpose, on the session’s model under the parent’s prompt,
packaged so that it carries |
|
pivot’s box side: |
|
The bash parser the enforcement packages read commands with: tree-sitter-bash through web-tree-sitter, at the permission engine’s own ranges. It offers three views over one parse: pi-workflow’s guards use the structure (argv, wrappers, redirects, inert heredocs); pi-modes' rules use the line (every command and pipeline, and whether the line is one command) and plain-line commands. Each view caches recent results in a bounded LRU scoped to the active parser generation, returning isolated clones so repeated calls for the same bash command reuse one WASM parse (#964). One wrapper table serves them all. A library, not an extension: no loader, reached through pi-modes, pi-shellcheck and pi-workflow as a regular dependency (ADR-004, amended for #206). |
|
The workspace seam (#489, ADR-006). One |
|
pi over SSH (#488, ADR-006). It contains: * * * The session half (#498): The meta package loads it as |
|
The shell guard (#751). Every |
The meta package also ships the four Orchard TUI themes (themes/,
generated from the agency palette data — node tools/task.mjs themes
regenerates, and a drift check runs in validate).
Vendored upstream (pinned, unmodified)
| Package | License | Role |
|---|---|---|
|
MIT |
Deterministic permission gates: bash decomposition, symlink-resolved path
denies, fail-closed posture, subagent ask-forwarding, the |
|
MIT |
Subagent delegation. Chosen over alternatives for its native permission-system
integration ( |
|
MIT |
Web search, URL fetch, repo cloning, PDF/video extraction. Already routes model calls through pi’s registry-complete path, so it works with Vertex ADC models out of the box. |
Upstream updates are normal dependency management: get notified → bump the
pin → CI → publish a new @gadhs/pi. No local patches, ever (see
Architecture).
Import resolution inside extensions
pi resolves an extension’s imports of upstream code through an alias map that
covers only the @earendil-works/* package roots plus three subpaths:
/compat, /oauth, and /providers/all. Any deeper subpath import resolves
in this workspace (where node_modules has the real tree) and then breaks in
a consumer install — which is exactly the kind of gap task consumer-sim
exists to catch.
Updating without restarting: pi update, then /reload
/reload loads the updated packages in the same pi process (#459, seen
live locally and over SSH). pi loads extensions through jiti with its
module cache off, so every TypeScript file of ours is read fresh.
pivot-wire, which Node itself requires for pi-remote and whose cache
survives a reload, is dropped from that cache each time pi-remote loads,
so it is fresh too (#579). The diagnostics stream, shared on globalThis
by every copy of pi-modes in the process, records which version made it.
After an update it is replaced once, keeping any records it still held
unwritten, so secret scrubbing is the new release’s at once.
What a reload does not keep is the work in flight. Monitors end, and the next session offers their list back. Jobs (#577) are the exception: they run on, and the next session watches them again. Commands running on an SSH remote end, and the phone link pauses and returns.
Two pieces of pi-modes live in the process rather than in its code: the ask broker’s registry, and the terminal’s lone-ESC patch on pi-tui, which pi never reloads. When an update changes either one’s contract version, the earlier copy keeps running, and the session start says so once: "pi was updated, but this process still runs the earlier …; restart pi to load the new one". Restart then. Otherwise the reload is enough.
A session that has not reloaded says so (#900). At the start of each turn
of a main session, pi-modes reads the installed @gadhs/pi manifest’s
version, and when it is newer than the release this process loaded, the
human is told once per installed release: "@gadhs/pi 0.173.0 is
installed, and this session still runs 0.172.0, the release it loaded when
it started. Run /reload to load the new one, or restart pi." A helper says
nothing. The loaded release is read once, when pi-modes is first imported,
so it is the release whose code runs. Pins: test/stale-release.test.ts,
and consumer-sim’s row, which bumps the installed manifest on a real
session after it has started and before its first turn.
Registry
Packages publish to the GitLab npm registry under the @gadhs scope
(internal; not published to npmjs.com). Consumers resolve the scope from the
GROUP endpoint, which serves reads publicly — no token to install:
npm config set @gadhs:registry https://gitlab.com/api/v4/groups/55134190/-/packages/npm/
Why the group endpoint
npm permits exactly one registry per scope, so the @gadhs → registry
mapping on a developer’s box covers the whole namespace — and the agency
publishes @gadhs packages from more than one project: this repo’s @gadhs/pi,
pivot’s wire (vendored inside @gadhs/pi), and the shared docs
theme and its search extensions. A project-endpoint mapping would serve
this repo’s packages and send every other name to GitLab’s forwarding,
which answers it from registry.npmjs.org (#380).
npm 12
npm 12 refuses dependencies fetched from a URL by default
(allow-remote=none), and it counts a registry’s tarball as one unless the
tarball’s path starts with the registry’s path (npm/cli#9796, open). The
group endpoint serves each package’s tarball from its project’s path, so on
npm 12 every @gadhs package is refused with EALLOWREMOTE (#379). On
npm 12 or newer, the fix is scoped to pi’s own package directory:
npm config set allow-remote=all --location=project --prefix ~/.pi/agent/npm
That writes ~/.pi/agent/npm/.npmrc, which npm reads only for installs
into that prefix — which is where pi installs packages. Every other npm use
on the box keeps npm 12’s protection. Inside pi’s package tree a dependency
declared as a URL installs, as it did on npm 11. Older npm needs nothing:
npm 11 already defaults to all, and npm 10 does not know the setting and
refuses the command ("`allow-remote` is not a valid npm option", #383) -
npm 10 is what pi’s installer brings with the Node 22 it downloads. With
PI_CODING_AGENT_DIR set, use its npm directory instead. The CI rehearsal installs with npm 12 and this line, so a
consumer’s install is covered. Drop the line once npm accepts GitLab’s
tarball paths.
The tree-sitter-bash install-script warning
Since npm 11.18, every install into pi’s package directory ends with
tree-sitter-bash@0.25.1 (install: node-gyp-build) listed as an install
script "not yet covered by allowScripts" (#549). It is expected and
harmless. pi uses only the grammar file the package ships,
tree-sitter-bash.wasm, loaded through web-tree-sitter. The script builds
a native addon that nothing loads. Both pi-bash and the bundled permission
system depend on the package, so it stays.
Do not approve the script: that compiles native code for no use. npm 12
blocks it by default, and npm 11 still runs it. pi records the denial
itself (#654): each session start adds "allowScripts": { "tree-sitter-bash":
false } to package.json in pi’s npm directory (~/.pi/agent/npm, or the
npm directory under PI_CODING_AGENT_DIR). That is what npm
deny-scripts tree-sitter-bash writes, and it silences the warning. So only
the very first install still lists the script; every pi update after a
session is quiet. pi creates that file only when it is missing, so pi
update keeps the entry.
The denial is written only into a file that exists, and only when nothing
there decides the package yet. An entry of your own is kept, by name or
pinned (tree-sitter-bash@0.25.1), true or false. So is a file that does
not parse.
The accepted residual
The group endpoint’s namespace is every project in gadhs, so an
accidental name collision — a fork that keeps package names and publishes
from its own project — would enter consumers' resolution. Under the agency
threat model that is an accident class, not an adversary class; if it ever
occurs, GitLab package-protection rules and the fork’s own cleanup are the
remedy.
How provenance is checked
task consumer-sim --registry installs through the group endpoint
exactly as a consumer does, then asserts provenance from what npm
recorded: every package of ours must have resolved from this project’s
endpoint and pivot’s wire from pivot’s. A same-named package from any
other project in the group installs, and the check fails naming it.
Publishing
Only @gadhs/pi is published, targeting the per-project endpoint (#836);
auth comes from the environment, never from a committed token (see .npmrc).
The ten sibling packages are private workspace packages bundled into
@gadhs/pi.
One packaging rule learned the hard way: the files allowlists use globs
pinned by tests that read npm pack --json — every package’s import closure
is checked against its real tarball (packages/pi/test/shipped-imports.test.ts,
since #241 no longer a hand expansion of the globs) — because a
hand-maintained file list rots invisibly in a workspace, where the files are
always present locally.