fix(pi-extension): close the recovery, hook and context leaks; ship on pi-v*
Recovery client. ensure() assigned probed/child only after an await, so N concurrent callers ran N probes and N spawns and tracked only the last child — the rest stayed alive as orphans holding ccr.db. One in-flight bring-up is now shared, dispose() reaps a child that lands late, and a child that fails or never finishes the handshake is reaped instead of left for the next spawn to collide with. The handshake also stops borrowing the 30s retrieve budget: it is awaited inside session_start, so an MCP that starts but never answers initialize froze Pi startup for the full 30s. 2s, then the session degrades to "no recovery available". caveman_retrieve output is no longer shrunk. Its result IS the recovered original, so masking it hands the model a fresh ccr:// handle and recovery loops instead of terminating — and registering the tool disables the proxy's server-side retrieve loop, so nothing else would strip it. pending context from tool calls accumulates across a whole turn and drains only at the next before_agent_start; MAX_CONTEXT_BYTES capped one response, not the join, so a tool-heavy turn built an unbounded system prompt. It now caps the accumulation. The stamped hook argv is tried first but no longer alone: it bakes an absolute [node, …/dist/index.js] at enable time, so an nvm switch made every hook call ENOENT and the session degraded to permanent silent direct mode. PATH candidates follow it. Both copies of resolveWindowsCommand (here and in the CLI) now apply PATHEXT to a *path* too — returning the extensionless ~/.caveman/bin/caveman straight to execFile is the EFTYPE they exist to prevent. Release: `pi-v*` tags publish @caveman-ai/pi, with a smoke check that the tarball actually carries the bundled extension package.json names, plus the registry-resolved package-lock.json `npm ci` needs (the one generated inside the pnpm workspace linked to ../../node_modules/.pnpm and would have failed on a clean checkout). README gains the Pi wrap row (eight native agents) and drops the Sponsors section. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SqmbqWDtNexzDfH5V3BMRz
J
Julius Brussee committed
ce6850dbc6b4fdb6939182c9104241ed75a309b3
Parent: 12eadba