@junghanacs/entwurf 0.12.0 → 0.12.1

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 (45) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +88 -28
  3. package/docs/setup-clean-host.md +117 -219
  4. package/mcp/entwurf-bridge/dist/mcp/entwurf-bridge/src/index.js +454 -0
  5. package/mcp/entwurf-bridge/dist/pi-extensions/lib/entwurf-control-rpc.js +111 -0
  6. package/mcp/entwurf-bridge/dist/pi-extensions/lib/entwurf-core.js +1683 -0
  7. package/mcp/entwurf-bridge/dist/pi-extensions/lib/entwurf-deliverability.js +76 -0
  8. package/mcp/entwurf-bridge/dist/pi-extensions/lib/entwurf-fact-provider.js +121 -0
  9. package/mcp/entwurf-bridge/dist/pi-extensions/lib/entwurf-facts.js +155 -0
  10. package/mcp/entwurf-bridge/dist/pi-extensions/lib/entwurf-peers-render.js +119 -0
  11. package/mcp/entwurf-bridge/dist/pi-extensions/lib/entwurf-preflight.js +160 -0
  12. package/mcp/entwurf-bridge/dist/pi-extensions/lib/entwurf-resume-args.js +63 -0
  13. package/mcp/entwurf-bridge/dist/pi-extensions/lib/entwurf-self-address.js +81 -0
  14. package/mcp/entwurf-bridge/dist/pi-extensions/lib/entwurf-v2-contract.js +290 -0
  15. package/mcp/entwurf-bridge/dist/pi-extensions/lib/entwurf-v2-decider.js +254 -0
  16. package/mcp/entwurf-bridge/dist/pi-extensions/lib/entwurf-v2-lock.js +365 -0
  17. package/mcp/entwurf-bridge/dist/pi-extensions/lib/entwurf-v2-mailbox.js +64 -0
  18. package/mcp/entwurf-bridge/dist/pi-extensions/lib/entwurf-v2-production.js +218 -0
  19. package/mcp/entwurf-bridge/dist/pi-extensions/lib/entwurf-v2-release.js +108 -0
  20. package/mcp/entwurf-bridge/dist/pi-extensions/lib/entwurf-v2-resume-marker.js +33 -0
  21. package/mcp/entwurf-bridge/dist/pi-extensions/lib/entwurf-v2-runner.js +116 -0
  22. package/mcp/entwurf-bridge/dist/pi-extensions/lib/entwurf-v2-send-fallback.js +125 -0
  23. package/mcp/entwurf-bridge/dist/pi-extensions/lib/entwurf-v2-send.js +184 -0
  24. package/mcp/entwurf-bridge/dist/pi-extensions/lib/entwurf-v2-spawn-production.js +237 -0
  25. package/mcp/entwurf-bridge/dist/pi-extensions/lib/entwurf-v2-spawn.js +216 -0
  26. package/mcp/entwurf-bridge/dist/pi-extensions/lib/entwurf-v2-surface.js +164 -0
  27. package/mcp/entwurf-bridge/dist/pi-extensions/lib/meta-mailbox-body.js +66 -0
  28. package/mcp/entwurf-bridge/dist/pi-extensions/lib/meta-session.js +1502 -0
  29. package/mcp/entwurf-bridge/dist/pi-extensions/lib/session-id.js +50 -0
  30. package/mcp/entwurf-bridge/dist/pi-extensions/lib/socket-discovery.js +259 -0
  31. package/mcp/entwurf-bridge/dist/pi-extensions/lib/socket-probe.js +81 -0
  32. package/mcp/entwurf-bridge/dist/protocol.js +29 -0
  33. package/mcp/entwurf-bridge/start.sh +49 -7
  34. package/mcp/entwurf-bridge/test.sh +12 -3
  35. package/mcp/entwurf-bridge/tsconfig.build.json +42 -0
  36. package/package.json +29 -9
  37. package/pi-extensions/lib/entwurf-v2-contract-schema.ts +101 -0
  38. package/pi-extensions/lib/entwurf-v2-contract.ts +10 -78
  39. package/pi-extensions/lib/entwurf-v2-decider.ts +6 -2
  40. package/pi-extensions/lib/entwurf-v2-production.ts +26 -4
  41. package/run.sh +140 -15
  42. package/scripts/check-entwurf-bridge-pi-free.ts +146 -0
  43. package/scripts/check-entwurf-v2-contract.ts +6 -4
  44. package/scripts/smoke-acp-bundled-mcp-live.ts +13 -2
  45. package/scripts/smoke-acp-carrier-augment-live.ts +35 -19
package/CHANGELOG.md CHANGED
@@ -4,6 +4,27 @@ All notable changes to this project will be documented here. Format follows [Kee
4
4
 
5
5
  ## Unreleased
6
6
 
7
+ ## 0.12.1 — 2026-06-29
8
+
9
+ ### Fixed
10
+
11
+ - **Installed MCP bridge boots from npm/node_modules.** The 0.12.0 launcher ran `src/index.ts` through Node strip-types, but Node refuses type stripping below `node_modules` (`ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING`). The npm tarball now carries a clean tsc-emitted bridge JS closure under `mcp/entwurf-bridge/dist/`, and `start.sh` runs that dist path when installed while keeping the strip-types source path for development clones.
12
+ - **Stale dist files cannot ship.** `build-bridge` removes `mcp/entwurf-bridge/dist` before emit, and `check-pack-install` plants a stale sentinel before `npm pack` to prove prepack cleaned the tree. This closes the orphan-emit tarball contamination found during the 0.12.1 C review.
13
+ - **npm bin symlink installs resolve the package root.** `run.sh`, `start.sh`, and the bridge protocol smoke now resolve symlinks before computing their root, so `node_modules/.bin/entwurf` and `node_modules/.bin/entwurf-bridge` work like direct package paths.
14
+ - **Two live ACP MUST smokes no longer flake on model-in-loop phrasing.** `smoke-acp-carrier-augment-live` proved augment delivery by asking the model to echo a `SECRET_PROJECT_CODE` planted in a `/tmp` `AGENTS.md` — current Claude correctly refuses that as a prompt-injection/exfil pattern, so the MUST gate failed even though the augment rode the wire and the empty carrier billed clean. It now uses a benign factual marker (an internal build codename) asked back as a normal "answer from project context" task. `smoke-acp-bundled-mcp-live` asked the model for "values only, one per line" yet asserted on field-name-labeled lines (`socketState: alive`), so a compliant bare-value reply was dropped by the envelope filter while the `[tool:done]` notice truncated `socketState`; it now requests labeled lines so the three identity fields are deterministically observable. Neither change weakens the gate (same MUST assertions, same non-circular gid proof) — both only realign the observation contract with current model behavior.
15
+
16
+ ### Changed
17
+
18
+ - **Install docs are npm-first and pi-adapter-second.** The README and clean-host walkthrough now lead with neutral `npm install @junghanacs/entwurf`, document the `entwurf` / `entwurf-bridge` bins, and move pi to the optional ACP-provider/control-socket adapter lane (`@earendil-works/pi-coding-agent >=0.80.2 <0.81`). `pi install npm:...` is no longer the public primary install recipe.
19
+ - **Pi peers are optional for the neutral package.** The `@earendil-works/*` peer trio and `typebox` are marked optional so a plain npm install can boot the MCP bridge without pulling the pi adapter stack. The pi loader lane is still verified separately with explicit pi peers.
20
+ - **Garden id concept is documented up front.** The concept primer now defines garden/garden id as the shared address space for independent harness citizens, not a worker name or proof of pi ownership, and points callers to `entwurf_peers` + `entwurf_v2` instead of hand-picking transports.
21
+
22
+ ### Verification
23
+
24
+ - `./run.sh check-pack-install` passes with the neutral npm install regression: package bins present, optional pi peers absent, installed dist bridge answers `tools/list`, and pi-loader registration still passes on the explicit pi-peer lane.
25
+ - Remote `hejdev6` real-install probe from the packed tarball passed: local npm install, package bins, optional pi peers absent, installed `entwurf-bridge` `tools/list`, `entwurf install` with isolated HOME, and `entwurf check-bridge`. The host's real HOME also exposed a pre-existing stale `~/.pi/agent/entwurf-targets.json` symlink to `pi-shell-acp`; fix with `entwurf setup:links --force` or an explicit `ENTWURF_TARGETS_PATH` if that old registry is intentional.
26
+ - `LIVE=1 ./run.sh release-gate /tmp/psa-release-gate-0.12.1.GUFDUb` tiers `MUST: PASS=17 FAIL=0 SKIP=0` with `BEHAVIOR: PASS=1 FAIL=0` on 2026-06-29; log `/tmp/entwurf-release-gate-0.12.1-20260629T191543.log` (the two live-smoke observation fixes above were what moved the gate from `MUST FAIL=1` to green; the install change is harness-neutral and touches no ACP code path).
27
+
7
28
  ## 0.12.0 — 2026-06-29
8
29
 
9
30
  > This release hard-cuts the project from `pi-shell-acp` to **`entwurf`**. It is not a compatibility rename: the package/provider/model/MCP identity is now `entwurf`, v1 entwurf verbs are gone, and `entwurf_v2` is the canonical garden-id dispatch verb. The repo is **entwurf-core (v2 dispatch) + meta-bridge + pi adapter + ACP plugin**. Pi remains an important adapter and ACP host, but the project subject is the garden-citizen dispatch substrate. Verified release floor: `pnpm check`, `check-pack`, `check-pack-install`, and `LIVE=1 ./run.sh release-gate <scratch>` MUST tier `PASS=17 FAIL=0 SKIP=0` on 2026-06-29, with BEHAVIOR (advisory model-in-loop autonomous MCP tool-selection) `PASS=1 FAIL=0` and recorded separately from the cut decision.
package/README.md CHANGED
@@ -8,9 +8,11 @@
8
8
 
9
9
  npm package: <https://www.npmjs.com/package/@junghanacs/entwurf>
10
10
 
11
+ Legacy package: [`@junghanacs/pi-shell-acp`](https://www.npmjs.com/package/@junghanacs/pi-shell-acp). `entwurf` is its 0.12+ successor line: the same work renamed around the garden-citizen dispatch substrate rather than the pi adapter.
12
+
11
13
  > **Public, active development.** Real working code, still young. Verify it in your own workflow before relying on it all day. Evidence calibration: [VERIFY.md](./VERIFY.md); native async-delivery capability levels: [DELIVERY.md](./DELIVERY.md).
12
14
 
13
- > **Current state for 0.12.0.** This repo is **entwurf-core (v2 dispatch) + a meta-bridge + a pi adapter + an ACP plugin**. Pi is one supported harness adapter — important because it supplies control sockets and hosts the ACP plugin today — but it is not the project subject. Claude Code is shipped through the meta-bridge; pi is shipped through the control-socket adapter; Codex and Antigravity (`agy`) reach the garden with verified delivery probes, documented per launch mode in [DELIVERY.md](./DELIVERY.md), with shipped adapter/install lanes landing after the 0.12.0 doc cut. The ACP plugin is Claude-first; Cortex/vendor-governed ACP backends are future lanes.
15
+ > **Current state for 0.12.1.** This repo is **entwurf-core (v2 dispatch) + a meta-bridge + a pi adapter + an ACP plugin**. Pi is one supported harness adapter — important because it supplies control sockets and hosts the ACP plugin today — but it is not the project subject. Claude Code is shipped through the meta-bridge; pi is shipped through the control-socket adapter; Codex and Antigravity (`agy`) reach the garden with verified delivery probes, documented per launch mode in [DELIVERY.md](./DELIVERY.md), with shipped adapter/install lanes landing after the 0.12.0 doc cut. The ACP plugin is Claude-first; Cortex/vendor-governed ACP backends are future lanes.
14
16
 
15
17
  <details>
16
18
  <summary>Watch archived pre-0.12 demo (2131×1142 GIF, click to expand)</summary>
@@ -68,68 +70,126 @@ This meta-bridge installer/doctor is **Claude Code only** in the shipped 0.12.0
68
70
  A few words that look unusual for a coding tool.
69
71
 
70
72
  - **Entwurf** (기투, projection-of-self) — sibling sessions with their own runtime boundary. Not "delegate," not "worker," not "sub-agent." Spawn, resume, and live peer messaging are first-class.
73
+ - **Garden / garden id** — the garden is the shared address space where independent harness sessions become citizens without losing their own runtime or transcript. A garden id is the stable address of one such citizen (for pi, a garden-native session id like `YYYYMMDDTHHMMSS-<6hex>`; for native harnesses, a meta-session id minted by the `SessionStart` hook). It is not a worker name and not proof that pi owns the session. The same-looking id may name a live control socket, a dormant pi record, or a mailbox-backed native session, so callers discover facts with `entwurf_peers` and deliver with `entwurf_v2` instead of choosing a transport by hand.
71
74
  - **Engraving** — optional short operator text delivered through each backend's native identity carrier. Not a giant hidden prompt, not a tool catalog.
72
75
  - **MCP** — in this repo, MCP is just the transport by which ACP-backed sessions receive pi capabilities that native pi exposes directly as extensions. It is not a general MCP platform. Explicit `entwurfProvider.mcpServers` only; no ambient `~/.mcp.json` scanning, no automatic retrieval. The same `entwurf-bridge` entry can also be wired into another host's MCP catalog (Claude Code, Codex, Antigravity, …) when the operator chooses. `entwurf_self` returns an authoritative pi-session or trusted meta-session identity envelope; `entwurf_v2` can deliver from plain external MCP hosts, but only pi-session and trusted meta-session senders are replyable.
73
76
  - **Session persistence** — re-attaches pi to the same remote ACP session. Does not hydrate backend transcripts into pi history.
74
77
 
75
78
  ## Install
76
79
 
77
- `entwurf` is a thin garden-citizen bridge with a **Claude-first ACP plugin**. Pi is the host adapter for that ACP plugin today; Codex runs as a direct pi-native provider by default, with a tested `ENTWURF_ACP_FOR_CODEX=1` opt-in that routes it through the ACP bridge too. The bridge does not provide Claude credentials, tokens, or subscription access, and does not bypass any backend auth. Whatever the operator's local `claude` / `codex` already trusts is what entwurf uses.
80
+ `entwurf` is a neutral npm package first. Install the package with `npm` (or
81
+ `pnpm`/`yarn`) and then wire the harness you want to use. Pi is still the
82
+ adapter that hosts the ACP plugin and live control-socket surface, but the base
83
+ install is **not** `pi install npm:...` anymore.
84
+
85
+ The package exposes two bins:
78
86
 
79
- `pi` installs the bridge from an `npm:` source (the published `@junghanacs/entwurf` package) in **global** (default, writes to `~/.pi/agent/settings.json`) or **project** (`-l` flag, writes to `.pi/settings.json`) scope. A `git:` source and a local clone remain available for tracking `main` or hacking on the bridge.
87
+ - `entwurf` `run.sh` (installer, checks, meta-bridge doctor/install)
88
+ - `entwurf-bridge` → the MCP stdio launcher (`mcp/entwurf-bridge/start.sh`)
80
89
 
81
- After installing the package, run `run.sh install .` in your target project. The script writes the `entwurfProvider` block into `.pi/settings.json` with the correct absolute path for `entwurf-bridge/start.sh` no hand-editing required. The exact location of `run.sh` depends on which install path was used (each section below shows it). For manual configuration, [`pi/settings.reference.json`](./pi/settings.reference.json) is the reference shape — see [Settings](#settings) below.
90
+ The bridge does not provide Claude credentials, tokens, or subscription access,
91
+ and does not bypass any backend auth. Whatever the operator's local `claude` /
92
+ `codex` / pi runtime already trusts is what entwurf can use.
82
93
 
83
- ### From npm via pi — global
94
+ ### From npm — user/global install
84
95
 
85
96
  ```bash
86
- pi install npm:@junghanacs/entwurf
97
+ npm install -g @junghanacs/entwurf
98
+
99
+ # wire a target project for the pi adapter / ACP plugin lane
87
100
  cd /path/to/your-project
88
- ~/.pi/agent/npm/node_modules/@junghanacs/entwurf/run.sh install .
89
- ~/.pi/agent/npm/node_modules/@junghanacs/entwurf/run.sh check-bridge
101
+ entwurf install .
102
+ entwurf check-bridge
90
103
  ```
91
104
 
92
- ### From npm via pi project (`-l` flag)
105
+ This writes `.pi/settings.json` in the target project with the absolute path to
106
+ the installed `entwurf-bridge` launcher. It also links the target registry under
107
+ `~/.pi/agent/` for spawn-bg resume. The global install is the easiest path when
108
+ Claude Code's USER-scope MCP registration should work from every cwd.
109
+
110
+ ### From npm — project-local install
93
111
 
94
112
  ```bash
95
113
  cd /path/to/your-project
96
- pi install -l npm:@junghanacs/entwurf
97
- ./.pi/npm/node_modules/@junghanacs/entwurf/run.sh install .
98
- ./.pi/npm/node_modules/@junghanacs/entwurf/run.sh check-bridge
114
+ npm install --save-dev @junghanacs/entwurf
115
+
116
+ npx entwurf install .
117
+ npx entwurf check-bridge
99
118
  ```
100
119
 
101
- ### From source via pi global (alternative)
120
+ For manual MCP registration from a project-local install, point the host at:
102
121
 
103
- ```bash
104
- pi install git:github.com/junghan0611/entwurf
105
- cd /path/to/your-project
106
- ~/.pi/agent/git/github.com/junghan0611/entwurf/run.sh install .
107
- ~/.pi/agent/git/github.com/junghan0611/entwurf/run.sh check-bridge
122
+ ```text
123
+ /path/to/your-project/node_modules/.bin/entwurf-bridge
108
124
  ```
109
125
 
110
- ### From source via pi — project (`-l` flag)
126
+ or at the package launcher directly:
111
127
 
112
- ```bash
113
- cd /path/to/your-project
114
- pi install -l git:github.com/junghan0611/entwurf
115
- ./.pi/git/github.com/junghan0611/entwurf/run.sh install .
116
- ./.pi/git/github.com/junghan0611/entwurf/run.sh check-bridge
128
+ ```text
129
+ /path/to/your-project/node_modules/@junghanacs/entwurf/mcp/entwurf-bridge/start.sh
117
130
  ```
118
131
 
119
- ### Local development clone
132
+ ### From source — development clone
120
133
 
121
134
  ```bash
122
135
  git clone https://github.com/junghan0611/entwurf ~/repos/gh/entwurf
123
136
  cd ~/repos/gh/entwurf
124
137
  pnpm install
125
- pi install ./
138
+
126
139
  ./run.sh install /path/to/your-project
127
140
  ./run.sh check-bridge
128
141
  ```
129
142
 
130
- > **First time on a clean Ubuntu / Debian / macOS host?** See the [clean-host walk-through](./docs/setup-clean-host.md) `nvm` + `pnpm` + `pi` install, `pi install git:...`, `run.sh install .`, the missing-auth boundary surface, and an authenticated runtime smoke for Claude.
143
+ A development clone runs the bridge source through Node's strip-types path;
144
+ an npm-installed package runs the prebuilt JS under `mcp/entwurf-bridge/dist/`
145
+ because Node refuses to strip `.ts` files under `node_modules`.
146
+
147
+ ### Pi adapter / ACP plugin lane
148
+
149
+ To use the `entwurf` provider inside pi, install a compatible pi binary
150
+ separately (`@earendil-works/pi-coding-agent >=0.80.2 <0.81`). Then point pi at
151
+ the npm-installed package or development clone:
152
+
153
+ ```bash
154
+ # global npm install path
155
+ pi -e "$(npm root -g)/@junghanacs/entwurf" --list-models entwurf
156
+
157
+ # project-local install path
158
+ pi -e ./node_modules/@junghanacs/entwurf --list-models entwurf
159
+ ```
160
+
161
+ For daily operator sessions, launch pi with `--entwurf-control` and a garden id
162
+ from `entwurf new-session-id`; see [Garden launcher](#garden-launcher). Older pi
163
+ versions may silently miss the provider/extension surface, so treat the pi floor
164
+ as release-critical for the ACP/plugin lane. A host that only uses
165
+ `entwurf-bridge` from Claude Code / Codex / Antigravity does not need pi until it
166
+ tries an `owned-outcome` spawn-bg resume target.
167
+
168
+ ### External MCP host lane
169
+
170
+ After any npm install, register `entwurf-bridge` with the external host:
171
+
172
+ ```bash
173
+ claude mcp add --scope user entwurf-bridge \
174
+ entwurf-bridge
175
+ ```
176
+
177
+ If the host does not inherit the npm bin directory, use an absolute path to the
178
+ bin or `start.sh`. For a garden-native Claude Code meta-session (replyable by
179
+ garden id), run:
180
+
181
+ ```bash
182
+ entwurf install-meta-bridge
183
+ entwurf doctor-meta-bridge
184
+ ```
185
+
186
+ For manual configuration, [`pi/settings.reference.json`](./pi/settings.reference.json)
187
+ shows the pi adapter settings shape, and the external-host examples below show
188
+ plain MCP registrations.
189
+
190
+ > **First time on a clean Ubuntu / Debian / macOS host?** See the [clean-host walk-through](./docs/setup-clean-host.md) — Node/npm install, auth-free bridge boot, optional pi adapter verification, and authenticated runtime smokes.
131
191
 
132
- > **Post-install checks.** `run.sh check-bridge` proves the `entwurf-bridge` MCP surface loads (provider registration + protocol/negative-path), with no backend auth needed. To prove the **ACP backend actually answers** — the bridge spawns Claude through the provider path and a real turn comes back — run `LIVE=1 run.sh smoke-acp-provider-live` (it needs the operator's local Claude auth/credit). Package-source routing — so that a `provider=entwurf` Entwurf target from a `git:` / `npm:` install resolves and does not die with `Unknown provider "entwurf"` (#29) — is pinned deterministically by `run.sh check-package-source-routing`, which runs inside `pnpm check` and the release gate.
192
+ > **Post-install checks.** `entwurf check-bridge` (or `./run.sh check-bridge` from a clone) proves the `entwurf-bridge` MCP surface loads with no backend auth needed. To prove the **ACP backend actually answers** — the bridge spawns Claude through the pi provider path and a real turn comes back — run `LIVE=1 entwurf smoke-acp-provider-live` from an installed package/clone with pi and Claude auth available. Package-source routing is pinned deterministically by `run.sh check-package-source-routing`, which runs inside `pnpm check` and the release gate.
133
193
 
134
194
  > **Extension set — do not filter.** `entwurf` ships three `pi.extensions` entries as a single set: the ACP provider extension (`pi-extensions/acp-provider.ts`) plus `pi-extensions/entwurf-control.ts` and `pi-extensions/model-lock.ts`. Filtering some out via pi's object-form package configuration can leave the model lock or entwurf-control surface in a broken state. Disable the entire package or none of it unless you know precisely which boundary you are turning off.
135
195
 
@@ -1,305 +1,203 @@
1
1
  # Clean-host setup walk-through
2
2
 
3
3
  End-to-end install of **entwurf** on a host with only `git` available — no
4
- node, no pnpm, no pi binary, no dotfiles. The point is to validate the public
5
- install surface as an outside user would experience it.
4
+ node, no npm package, no pi binary, no dotfiles. The point is to validate the
5
+ public install surface as an outside user would experience it.
6
6
 
7
- > **Scope.** This is the entwurf 0.12.0 install recipe. The earlier per-command
8
- > cleanhost evidence dumps (recorded 2026-05-18, pi-shell-acp era) are not
9
- > carried forward here they live in git history. The command *shape* below is
10
- > the current one; substitute your own host.
7
+ > **Scope.** This is the entwurf 0.12.1 install recipe. The base package install
8
+ > is **neutral npm**, not `pi install npm:...`. Pi is an optional adapter lane for
9
+ > the ACP provider / control-socket runtime.
11
10
 
12
- `entwurf` is a thin meta-bridge. It does not provide, copy, or mediate any
13
- backend credential — it spawns the official backend CLI and lets it read
14
- whatever auth the user already trusts on the host (AGENTS.md Hard Rule #9).
11
+ `entwurf` is a garden-citizen dispatch substrate and meta-bridge. It does not
12
+ provide, copy, or mediate backend credentials — it lets the official backend CLI
13
+ or the pi adapter read whatever auth the user already trusts on the host
14
+ (AGENTS.md Hard Rule #9).
15
15
 
16
16
  ## Reference target
17
17
 
18
18
  Written against a clean Ubuntu / Debian / macOS host reachable via SSH, here
19
- called `cleanhost`. `nvm` + `corepack` keep the path identical across them.
19
+ called `cleanhost`. `nvm` keeps the path identical across them.
20
20
 
21
21
  ```bash
22
- ssh cleanhost 'uname -a; whoami; which git node pnpm pi 2>/dev/null'
23
- # expect: git present, node/pnpm/pi absent
22
+ ssh cleanhost 'uname -a; whoami; which git node npm pi claude 2>/dev/null'
23
+ # expect on a fully clean host: git present, node/npm/pi/claude absent
24
24
  ```
25
25
 
26
26
  ## Pin matrix
27
27
 
28
- These pins are the verification axis drift from them moves you off the
29
- walk-through and onto your own integration.
30
-
31
- | Component | Pin | Source of truth |
28
+ | Component | Pin / floor | Source of truth |
32
29
  |---|---|---|
33
- | Node | **24** (LTS line) | `engines.node` is `>=22.6.0` (minimum, for TypeScript strip-types); verification axis is **24** |
34
- | pnpm | **10.33.0** (via corepack) | matches the version entwurf's `pnpm check` chain runs under |
35
- | pi binary | **`@earendil-works/pi-coding-agent` 0.80.2 or newer** | npm registry; binary name `pi`; garden-native session identity needs `--session-id` / `--name` |
36
- | entwurf install path | `npm:@junghanacs/entwurf` (published release path) | the `git:github.com/junghan0611/entwurf` source path remains the alternative for tracking `main` |
30
+ | Node | **24** recommended; `>=22.6.0` minimum | `engines.node` (Node strip-types / ESM runtime) |
31
+ | npm | bundled with Node 24 | public package install path |
32
+ | entwurf | `@junghanacs/entwurf` | neutral npm package; exposes `entwurf` and `entwurf-bridge` bins |
33
+ | pi binary | **optional**, `@earendil-works/pi-coding-agent >=0.80.2 <0.81` | needed only for the pi adapter / ACP provider / spawn-bg resume lane |
37
34
 
38
- ## Stage 0 — Node 24 + pnpm via nvm
35
+ ## Stage 0 — Node 24 via nvm
39
36
 
40
37
  ```bash
41
38
  ssh cleanhost
42
39
 
43
- # nvm (user-scope, no global root)
44
40
  curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
45
41
  source ~/.nvm/nvm.sh
46
42
 
47
- # Node 24 explicit — not --lts (re-runnable across calendar drift)
48
43
  nvm install 24
49
44
  nvm alias default 24
50
- node -v # expect: v24.x.y
51
-
52
- # pnpm via corepack (user-scope, no -g)
53
- corepack enable
54
- corepack prepare pnpm@10.33.0 --activate
55
- pnpm -v # expect: 10.33.0
45
+ node -v
46
+ npm -v
56
47
  ```
57
48
 
58
49
  Drift points:
59
- - corporate proxy / sudo policy may block `curl | bash`. Fallback: clone `nvm` via git and source `~/.nvm/nvm.sh` directly.
60
- - `corepack enable` needs Node 24's bundled corepack — confirm with `corepack -v` before activate.
61
- - **Subshell trap**: `nvm install 24 | tail` runs the install inside a pipe-subshell, so PATH changes do not reach the parent shell and `node -v` fails right after. Drop the pipe, or follow with an explicit `nvm use 24` in the same shell (the recipe above already does).
50
+ - Corporate proxy / sudo policy may block `curl | bash`. Fallback: clone `nvm`
51
+ via git and source `~/.nvm/nvm.sh` directly.
52
+ - **Subshell trap**: `nvm install 24 | tail` runs in a pipe-subshell, so PATH
53
+ changes do not reach the parent shell. Drop the pipe, or run `nvm use 24` in
54
+ the same shell afterward.
62
55
 
63
- ## Stage 1 — pi binary
56
+ ## Stage 1 — neutral entwurf npm install
57
+
58
+ Install the public package with npm. This does **not** require pi.
64
59
 
65
60
  ```bash
66
- # global install with the user's nvm shim (no system-wide root)
67
- npm i -g @earendil-works/pi-coding-agent
68
- pi --version # expect: 0.80.2 or newer
61
+ npm install -g @junghanacs/entwurf
69
62
 
70
- # pi's data dir is created lazily on first run
71
- pi --help | head -5
63
+ which entwurf
64
+ which entwurf-bridge
65
+ entwurf --help | head -5
72
66
  ```
73
67
 
74
- Drift points:
75
- - if `npm i -g` lands outside the nvm shim, `pi` may not be on `$PATH` after a shell reload. `which pi` should resolve under `~/.nvm/versions/node/v24.*/bin/pi`.
76
- - backend ACP server packages (e.g. `claude-agent-acp`) ship as pinned `dependencies` of entwurf and get installed in the next stage **do not install them globally yourself**.
68
+ `@earendil-works/*` pi packages are optional peers. A neutral npm install should
69
+ not pull them in as package dependencies. That separation is intentional: the
70
+ MCP bridge can boot in Claude Code / Codex / Antigravity without pi present.
77
71
 
78
- ## Stage 2 — entwurf install (npm path)
72
+ ## Stage 2 — auth-free bridge boot
79
73
 
80
- Install the bridge from the published npm package. `pi install` lands it under
81
- `~/.pi/agent/npm/node_modules/@junghanacs/entwurf/`, then `run.sh install` wires
82
- it into a target project's `.pi/` directory.
74
+ Prove the installed MCP server answers `tools/list` from inside `node_modules`.
75
+ This is the regression that 0.12.0 missed: Node refuses `--experimental-strip-types`
76
+ for `.ts` under `node_modules`, so the installed package must boot the prebuilt
77
+ JS under `mcp/entwurf-bridge/dist/`.
83
78
 
84
79
  ```bash
85
- # package-side install — populates ~/.pi/agent/npm/node_modules/...
86
- pi install npm:@junghanacs/entwurf
87
-
88
- # verify the package landed where pi expects it
89
- ls ~/.pi/agent/npm/node_modules/@junghanacs/entwurf/
90
-
91
- # project-side wire-up — pick an empty cwd for the smoke
92
- mkdir -p ~/entwurf-smoke
93
- cd ~/entwurf-smoke
94
- ~/.pi/agent/npm/node_modules/@junghanacs/entwurf/run.sh install .
95
- ```
96
-
97
- `run.sh install .` runs the one-shot wiring the consumer-project README
98
- documents: writes `.pi/` config, registers the extensions (provider,
99
- `entwurf-control`, `model-lock`), adds `entwurfProvider.mcpServers.entwurf-bridge`,
100
- and links `~/.pi/agent/entwurf-targets.json` to the package's
101
- `pi/entwurf-targets.json`. Expected log lines:
102
-
103
- ```
104
- install: added entwurfProvider.mcpServers.entwurf-bridge
105
- install: updated <cwd>/.pi/settings.json
106
- install: package source -> ~/.pi/agent/npm/node_modules/@junghanacs/entwurf
107
- install: linked ~/.pi/agent/entwurf-targets.json -> .../pi/entwurf-targets.json
80
+ node --input-type=module <<'JS'
81
+ import { spawn } from 'node:child_process';
82
+ const child = spawn('entwurf-bridge', { stdio: ['pipe', 'pipe', 'pipe'], env: { ...process.env, NODE_PATH: '' } });
83
+ let out = '', err = '';
84
+ const timer = setTimeout(() => { child.kill('SIGKILL'); console.error(err || 'timeout'); process.exit(1); }, 5000);
85
+ child.stderr.on('data', d => err += d);
86
+ child.stdout.on('data', d => {
87
+ out += d;
88
+ try {
89
+ const msg = JSON.parse(out.trim());
90
+ const names = (msg.result?.tools ?? []).map(t => t.name).sort();
91
+ for (const n of ['entwurf_v2','entwurf_peers','entwurf_self','entwurf_inbox_read']) {
92
+ if (!names.includes(n)) throw new Error(`missing ${n}: ${names.join(',')}`);
93
+ }
94
+ clearTimeout(timer);
95
+ child.kill('SIGTERM');
96
+ console.log(names.join(','));
97
+ } catch {}
98
+ });
99
+ child.stdin.write(JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'tools/list' }) + '\n');
100
+ JS
108
101
  ```
109
102
 
110
- Drift points:
111
- - with no backend credentials yet, `run.sh install .` still completes — it does not validate backend auth, only registers the bridge.
112
- - `~/.pi/agent/npm/...` is fixed by pi's install scanner. Use `pi install -l npm:...` to land it inside the project cwd instead.
113
- - the `git:github.com/junghan0611/entwurf` source path is the alternative for tracking `main` or hacking on the bridge; it clones into `~/.pi/agent/git/...` with the same `run.sh install .` wire-up.
114
- - `pi install` runs `npm install` inside the package; `husky` is dev-only and absent on a target host, so its `prepare` hook silently exits 0.
103
+ Expected: a comma-separated tool list containing all four `entwurf_*` tools,
104
+ exit code 0, no backend auth required.
115
105
 
116
- ## Stage 3 — package-surface verification (auth-free)
106
+ ## Stage 3 — wire a project for the pi adapter / ACP plugin (optional)
117
107
 
118
- Proves the bridge is registered and visible to pi, without touching any
119
- backend.
108
+ If the host will run pi sessions or the Claude ACP provider through pi, install
109
+ a compatible pi binary separately and wire the target project.
120
110
 
121
111
  ```bash
112
+ npm install -g @earendil-works/pi-coding-agent@0.80.2
113
+ pi --version
114
+
115
+ mkdir -p ~/entwurf-smoke
122
116
  cd ~/entwurf-smoke
117
+ entwurf install .
118
+ entwurf check-bridge
123
119
 
124
- # the entwurf provider should now appear in pi's catalog
125
- pi --list-models entwurf
126
- # expect: curated model ids under provider entwurf
127
- # (claude-opus-4-8, claude-sonnet-4-6, ...), exit code 0
120
+ # pi adapter/provider registration smoke
121
+ pi -e "$(npm root -g)/@junghanacs/entwurf" --list-models entwurf
128
122
  ```
129
123
 
130
- Deterministic gates (no live backend) from the clone:
124
+ Drift points:
125
+ - `entwurf install .` writes `.pi/settings.json`, registers the bundled
126
+ `entwurf-bridge`, and links `~/.pi/agent/entwurf-targets.json` to the package's
127
+ `pi/entwurf-targets.json`.
128
+ - Older pi versions may silently miss the provider/extension surface. Use the
129
+ pinned floor (`>=0.80.2 <0.81`) for release verification.
130
+ - A host that only uses the external MCP bridge can skip this stage until it
131
+ needs `owned-outcome` spawn-bg resume or pi-native control sockets.
132
+
133
+ ## Stage 4 — Claude Code meta-bridge (optional, garden-native native sessions)
134
+
135
+ For an external Claude Code session to be replyable by garden id, install the
136
+ meta-bridge plugin globally. This is still a neutral npm-package command; it
137
+ registers Claude Code USER-scope MCP + the SessionStart hook.
131
138
 
132
139
  ```bash
133
- cd ~/.pi/agent/git/github.com/junghan0611/entwurf
134
- pnpm install
135
- pnpm typecheck
136
- ./run.sh check-bridge # MCP tool contract (tools/list + negatives)
137
- ./run.sh check-package-source-routing # install-root resolver, fail-fast routing
138
- # full deterministic floor (longer, ~60 gates): pnpm check
140
+ entwurf install-meta-bridge
141
+ entwurf doctor-meta-bridge
139
142
  ```
140
143
 
141
- Drift points:
142
- - `pi --list-models entwurf` failing here means the install scanner did not register the extension — most often a node engines mismatch or a permission issue under `~/.pi/`. Re-run Stage 2 after fixing.
143
- - the `pnpm install` step may emit an `Ignored build scripts` warning for transitive deps (pnpm refuses postinstall hooks by default). Our surface does not need them; the warning is informational.
144
-
145
- ## Stage 4 — runtime smoke (backend auth required)
144
+ A plain external MCP host can call tools but is non-replyable. A garden-native
145
+ meta-session has a garden id, a mailbox, and a trusted sender marker; it can call
146
+ `entwurf_self`, receive mailbox wakeups, and be replied to by garden id.
146
147
 
147
- Backend authentication is **the operator's responsibility** and lives entirely
148
- outside entwurf. The 0.12.0 runtime floor is **Claude-first** — the
149
- `smoke-acp-*-live` floor inside `release-gate` exercises the Claude ACP backend
150
- only (there is no standalone per-backend smoke command). Codex reaches the
151
- garden as a native citizen (ACP only via the `ENTWURF_ACP_FOR_CODEX=1` opt-in,
152
- off the live floor); the Gemini path is deprecated.
148
+ ## Stage 5 backend auth and live runtime smoke
153
149
 
154
- ### Stage 4 prep Claude CLI install + login
150
+ Backend authentication is the operator's responsibility and lives entirely
151
+ outside entwurf. For the Claude ACP lane:
155
152
 
156
153
  ```bash
157
- # Claude — official install script (writes into ~/.local/bin, no sudo).
158
154
  curl -fsSL https://claude.ai/install.sh | bash
159
155
  echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
160
156
  source ~/.bashrc
161
- which claude && claude --version
162
-
163
- # interactive login (opens browser or prints a token-paste URL)
164
157
  claude login
165
- ```
166
-
167
- `claude login` writes into Claude's own state directory. entwurf does not
168
- provide, copy, decrypt, or mediate these credentials. If a smoke fails, run the
169
- backend CLI directly first (`claude -p "ping"`); if that also fails, the
170
- missing piece is upstream of entwurf.
171
-
172
- > **Codex / Gemini (optional).** `npm i -g @openai/codex` + `codex login` for
173
- > the Codex lane; `npm i -g @google/gemini-cli` + `gemini auth` for the
174
- > deprecated Gemini probe. Neither is on the 0.12.0 live floor — the
175
- > `smoke-acp-*-live` gates run the Claude ACP backend only; Codex/agy delivery
176
- > is captured as raw probes in [DELIVERY.md](../DELIVERY.md).
177
-
178
- ### Stage 4 prep — interactive setting (optional)
179
-
180
- For live interactive use (vs. headless CI), pin tool-progress visibility:
181
158
 
182
- ```bash
183
- node -e '
184
- const fs = require("fs");
185
- const path = process.env.HOME + "/entwurf-smoke/.pi/settings.json";
186
- const cur = JSON.parse(fs.readFileSync(path, "utf8"));
187
- cur.entwurfProvider = cur.entwurfProvider || {};
188
- cur.entwurfProvider.showToolNotifications = true;
189
- fs.writeFileSync(path, JSON.stringify(cur, null, 2) + "\n");
190
- '
191
- ```
192
-
193
- `showToolNotifications` defaults to `true` already; setting it explicitly pins
194
- the value for reproducibility. **No operator config is needed to make tool
195
- calls flow without prompts when a backend is invoked through entwurf** — the
196
- bridge runs the backend YOLO inside its own isolated overlay
197
- (`~/.pi/agent/*-config-overlay/`, AGENTS.md Hard Rule #10), so native backend
198
- config is neither read nor required on the bridged path.
199
-
200
- ### Stage 4 — runtime smoke
201
-
202
- ```bash
203
- ENTWURF=~/.pi/agent/git/github.com/junghan0611/entwurf
204
159
  cd ~/entwurf-smoke
205
-
206
- # lightweight: one Claude turn through entwurf (proves auth + bridge round-trip)
207
160
  pi --provider entwurf --model claude-sonnet-4-6 -p "reply with ok only"
208
-
209
- # full live floor (LIVE=1 required): pnpm check + the v2-native live gates
210
- # + the ACP plugin acceptance floor (10 smoke-acp-*-live smokes). Two-tier
211
- # MUST/BEHAVIOR summary; MUST owns the exit code. GLG authorizes the cut.
212
- LIVE=1 $ENTWURF/run.sh release-gate .
213
- ```
214
-
215
- A passing turn is a full round-trip: bootstrap → ACP session → bridge response
216
- → clean shutdown.
217
-
218
- Drift points:
219
- - a backend you have not authenticated fails loudly with `Authentication required` (Claude/Codex shape) or an early `EPIPE` (Gemini-CLI shape). **That is not an entwurf failure** — the bridge surfaces missing auth, it does not fix it. Add the credential and re-run.
220
- - `release-gate` honest-skips its LIVE-gated MUST steps when `LIVE!=1`; a real cut needs `LIVE=1` with `SKIP=0`.
221
-
222
- ## Stage 5 — entwurf surface (optional)
223
-
224
- > Do not run Stage 5 until at least one authenticated `smoke-*` is green — a
225
- > live entwurf flow drives a real backend turn, so an unauthenticated host just
226
- > re-surfaces the Stage 4 auth noise.
227
-
228
- ### Package-source ACP routing — auth-free, run this first
229
-
230
- Covers the boundary where a package-installed bridge (a `git:` / `npm:`
231
- settings source, not a local checkout) must still resolve so a
232
- `provider=entwurf` child does not die with `Unknown provider`:
233
-
234
- ```bash
235
- # from the installed bridge root (auth-free, also in pnpm check)
236
- ./run.sh check-package-source-routing
237
161
  ```
238
162
 
239
- It pins the package-source install-root resolver math across the full install
240
- matrix (local / git / npm / missing × local + remote). The live ACP routing
241
- itself is exercised by the `smoke-acp-*-live` floor under `release-gate`.
163
+ If the backend CLI fails directly (`claude -p "ping"`), fix that upstream first.
164
+ `entwurf` surfaces missing auth; it does not repair it.
242
165
 
243
- ### Resident control session
166
+ ## Stage 6 — garden/control-socket surface (optional)
244
167
 
245
- To address a long-lived pi session from another session (or an external MCP
246
- host like Claude Code), open it with `--entwurf-control`. A garden-native
247
- `--session-id` is **required** — a raw `pi --entwurf-control` (pi-assigned
248
- uuid) hard-exits at `session_start` before any model turn. Mint the id from the
249
- SSOT:
168
+ To address a long-lived pi session from another session or an external MCP host,
169
+ open it with `--entwurf-control`. A garden-native `--session-id` is required —
170
+ a raw pi-assigned uuid hard-exits before any model turn.
250
171
 
251
172
  ```bash
252
- pi --session-id "$(/path/to/entwurf/run.sh new-session-id)" \
173
+ pi --session-id "$(entwurf new-session-id)" \
253
174
  --entwurf-control --provider entwurf --model claude-sonnet-4-6
254
- # control socket: ~/.pi/entwurf-control/<sessionId>.sock
175
+ # control socket: ~/.pi/entwurf-control/<garden-id>.sock
255
176
  ```
256
177
 
257
- Inside such a session, builtin `/new` / `/fork` / `/clone` are blocked (they
258
- would mint a non-garden uuid); use `/gnew` (alias `/garden-new`) for a
259
- same-terminal fresh garden session (a zero-token switch into a pre-created
260
- garden file).
261
-
262
- The bridge exposes four MCP tools — `entwurf_v2` (canonical dispatch /
263
- delivery verb), `entwurf_peers` (discover live citizens), `entwurf_self`
264
- (identity envelope), `entwurf_inbox_read` (drain meta-bridge inbox). From any
265
- other pi session on the same host, call `entwurf_peers` to list live targets
266
- and `entwurf_v2` to message/hand off by garden id. Dispatch is fire-and-forget
267
- on a live target; set `wants_reply` if you need an answer. See AGENTS.md
268
- `Send-is-throw` for the full rule.
269
-
270
- ### Native-harness wake (optional)
271
-
272
- For an external Claude Code session to receive async messages, install the
273
- meta-bridge plugin globally (Claude Code only):
274
-
275
- ```bash
276
- ./run.sh install-meta-bridge # plugin + USER-scope entwurf-bridge MCP
277
- ./run.sh doctor-meta-bridge # fail-loud health check
278
- ```
178
+ Use `entwurf_peers` to discover citizens and `entwurf_v2` to deliver by garden
179
+ id. Do not choose the transport by hand: the same-looking id may name a live pi
180
+ socket, a dormant pi record, or a mailbox-backed native session.
279
181
 
280
182
  ## Teardown
281
183
 
282
- The bridge has no daemon. To remove everything installed:
283
-
284
184
  ```bash
285
- # entwurf clone
286
- rm -rf ~/.pi/agent/git/github.com/junghan0611/entwurf
287
-
288
- # project wiring (per-project)
185
+ # project wiring
289
186
  rm -rf ~/entwurf-smoke/.pi
290
187
 
291
188
  # meta-bridge plugin (if installed)
292
- ~/.pi/agent/git/github.com/junghan0611/entwurf/run.sh uninstall-meta-bridge 2>/dev/null || true
189
+ entwurf uninstall-meta-bridge 2>/dev/null || true
293
190
 
294
- # pi binary
295
- npm uninstall -g @earendil-works/pi-coding-agent
191
+ # package and optional pi binary
192
+ npm uninstall -g @junghanacs/entwurf
193
+ npm uninstall -g @earendil-works/pi-coding-agent 2>/dev/null || true
296
194
 
297
- # node + pnpm via nvm
195
+ # node via nvm
298
196
  nvm uninstall 24
299
197
  rm -rf ~/.nvm
300
198
  ```
301
199
 
302
- This walk-through is the **verification floor** underneath every downstream
303
- publish step install, package surface, and at least one authenticated
304
- runtime smoke green not the publish trigger itself. GLG owns the publish/tag
305
- decision.
200
+ This walk-through is a verification floor underneath release cuts: neutral npm
201
+ install, installed bridge boot, optional pi adapter registration, and at least
202
+ one authenticated runtime smoke when cutting a live release. GLG owns the
203
+ publish/tag decision.