FE-841: Embed pi as an in-process SDK to drop the external pi CLI dependency#194
FE-841: Embed pi as an in-process SDK to drop the external pi CLI dependency#194kostandinang wants to merge 4 commits into
Conversation
PR SummaryMedium Risk Overview Session setup maps the old CLI flags into SDK config: comma-separated tools → allowlist, prompt file → I126-K is unchanged: Docs drop the Reviewed by Cursor Bugbot for commit 81e0833. Bugbot is set up for automated code reviews on this repo. Configure here. |
Dependency ReviewThe following issues were found:
|
1b4e94a to
3e1665d
Compare
This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 21f80de. Configure here.
…endency
Replace the spawn('pi', …) subprocess in pi-actions.ts with an in-process
createAgentSession over @earendil-works/pi-coding-agent (pinned 0.79.1), so a
fresh checkout no longer needs an external pi binary on $PATH — only
ANTHROPIC_API_KEY.
- buildSessionOptions maps the old CLI flags to SDK config: tools allowlist,
model-registry lookup, system-prompt override, in-memory session + empty
resource overrides (no context files).
- Auth fed from brunch's own ANTHROPIC_API_KEY (no pi login / ~/.pi/auth.json);
one reused per-process agent dir, no per-call temp leak.
- Output captured off text_delta events (never brunch's stdout, keeps the cook
SSE stream clean); cooperative timeout + 10MB output cap.
- Read-only evaluator scoping (I126-K) preserved via the SDK tools allowlist;
injectable SessionFactory keeps the drive loop offline-testable.
- Drops the `which pi` prereq from the cook guide (npx pi for the interim helper).
- Override transitive hono to 4.12.25 (patches the moderate advisories the
dependency-review gate flags).
- PI_REAL_LLM-gated smoke proves a real in-process run with no pi on $PATH.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
a6b27a5 to
81e0833
Compare


Problem
The cook harness drove the agent by shelling out to a
piCLI (spawn('pi', …)), so running brunch required an externalpibinary on$PATH— an out-of-band prerequisite a fresh checkout couldn't satisfy.Change
runPinow drives an in-processcreateAgentSessionover@earendil-works/pi-coding-agent(pinned0.79.1) — no external binary, onlyANTHROPIC_API_KEY.buildSessionOptionsmaps the old CLI flags to SDK config:--tools→ tools allowlist,--model→ registry lookup,--append-system-prompt→systemPromptOverride,--no-context-files/--no-session→ empty resource overrides + in-memory session.ANTHROPIC_API_KEY(nopi login/auth.json); one reused per-process agent dir; output captured offtext_deltaevents, never stdout (keeps the cook SSE stream clean); cooperative timeout + 10MB cap.toolsallowlist; an injectableSessionFactorykeeps the drive loop offline-testable.which piprereq from the cook guide (npx pifor the interim plan-translation helper).Verification
npm run verify(check + test + build). API_REAL_LLM-gated smoke drives a real in-process session end-to-end — skipped in CI, verified passing live with the globalpibinary off$PATH.