Add Pi coding-agent provider#3818
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
16306de to
3083872
Compare
ApprovabilityVerdict: Needs human review 4 blocking correctness issues found. Diff is too large for automated approval analysis. A human reviewer should evaluate this PR. You can customize Macroscope's approvability policy. Learn more. |
There was a problem hiding this comment.
Effect service conventions: two issues in the new PiTextGeneration.ts. Both have a canonical precedent in the same directory (OpenCodeTextGeneration.ts).
Posted via Macroscope — Effect Service Conventions
3083872 to
4c74957
Compare
- PiSettings/PiSettingsPatch (enabled, binaryPath, customModels) on ServerSettings - pi driver kind display name + MODEL_SLUG_ALIASES passthrough entry - pi.rpc.event / pi.rpc.extension-ui runtime raw sources
RPC-mode (pi --mode rpc) driver over the Effect ChildProcessSpawner: - PiRpcClient JSONL transport + pure parsing/extraction helpers - PiAdapter: sessions, text_delta streaming, tool lifecycle, finalize on the terminal agent_end, mid-turn steer, image attachments, in-session model switch + thinking level, fork-based rollback; thread.started for projection parity; unexpected-exit reported as error - Approval gate driven by runtimeMode (like Claude/Cursor): bundled default-deny t3-approvals extension injected via -e with a get_commands load handshake (fail-closed); extension_ui <-> canonical approval/user-input bridge - PiProvider: version probe, live model discovery, models-based auth verdict - PiTextGeneration via stateless RPC + get_last_assistant_text + shared JSON extract - @earendil-works/pi-coding-agent devDependency (types only); ship the gate asset
Also ignore local agent scratch dirs (.pi-subagents, .repos/pi-pr-analysis).
4c74957 to
8e79df1
Compare
# Conflicts: # pnpm-lock.yaml
Local merge of Add Pi coding-agent provider for DMG build.
|
Hi @ahmadaccino, are you still actively maintaining this PR and open to contributions? I would like to help finish and harden the full Pi integration. If so, would you prefer focused PRs or commits against your |
Summary
@earendil-works/pi-coding-agent) as a selectable coding-agent provider, alongside Codex / Claude / Cursor / Grok / OpenCode.pi --mode rpcJSONL protocol over the shared EffectChildProcessSpawner. The Pi package is a types-only devDependency — the user's installedpibinary is the runtime, so nothing heavy is bundled.What's included
Server (
apps/server)PiRpcClient— typed JSONL transport overChildProcessSpawner(stdin-writer + stdout-reader fibers, request/response correlation, scoped teardown) plus pure, unit-tested parse/extract helpers.PiAdapter— per-thread sessions,text_deltastreaming, tool lifecycle, finalize onagent_end, mid-turnsteer, image attachments, in-session model switch + thinking level, andfork-based rollback. Emits the same canonical runtime events as the other adapters (includingthread.startedfor projection parity, andexitKind: "error"on unexpected exit).runtimeMode(like Claude/Cursor): a bundled, default-deny Pi extension is injected via--extensionand verified with aget_commandsload handshake (fail-closed), bridging Pi'sextension_uirequests to the canonical approval / user-input events.PiProvider—pi --versionprobe, live model discovery (get_available_models), and a models-based auth verdict (mirrors OpenCode).PiTextGeneration— stateless RPC +get_last_assistant_text, reusing the shared JSON extractor.Contracts & web
PiSettings+ driver-kind wiring;pi.rpc.*runtime raw sources.Docs
docs/providers/pi.md; lists Pi (and Grok) in the README.Testing
vp checkvp run typecheckvp test(server, contracts, and web suites; new Pi unit + integration tests included)piinstall: session lifecycle, mid-turn steer, model/thinking switch,forkrollback, and the tool-approval round-trip (default-deny gate blockingbash).vp run lint:mobile(no native mobile changes).Notes
Effect.fn, scoped fibers,Schema.TaggedErrorClass, no escape hatches) and reviewed for consistency with the existing providers.Note
Medium Risk
Large new subprocess and tool-approval path, but it mirrors existing providers, defaults off, and fails closed when the approval gate cannot load.
Overview
Adds Pi as a first-class, disabled-by-default coding-agent provider wired like Codex/Claude/Cursor: driver, adapter, health/model snapshot, text generation, contracts, settings UI, and docs.
The server talks to the user’s
pi --mode rpcprocess over a new JSONL RPC transport, mapping Pi events into the shared runtime model (streaming, tools, approvals, user prompts, model/thinking switches, fork-based rollback). Tool approval loads a bundled Pi extension at build time and refuses to start gated sessions unless the extension registers its sentinel command. Pi is removed from the “coming soon” add-provider list and promoted to the live picker (Early Access).Reviewed by Cursor Bugbot for commit ab7cefa. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add Pi coding-agent as a provider with RPC adapter, text generation, and tool approval gate
pi --mode rpcsession.PiAdapterthat manages per-thread RPC sessions, streams assistant/reasoning events, and bridges tool approval and user-input requests via Pi's extension-ui protocol.PiTextGenerationthat prompts the Pi CLI in RPC mode and returns schema-validated, sanitized commit messages, PR content, branch names, and thread titles.t3-approvalsPi extension that blocks tool calls by default and requires explicit user confirmation unlessT3_PI_APPROVAL_MODE=auto-accept-edits.piprovider,resolveModelSlugreturns an empty string instead of falling back to a default model, since available models are discovered live per account.Macroscope summarized ab7cefa.