Repository navigation
feat(acp): run Pi-Bolt in editors over the Agent Client Protocol - #32
Conversation
`pi-bolt --acp` (or `--mode acp`) serves the Agent Client Protocol on stdin and stdout, so Zed, JetBrains IDEs, VS Code ACP extensions, Neovim and other ACP clients run Pi-Bolt in their agent panel. - Each ACP session is a Pi session built by main.ts's runtime factory, in the directory the editor names: settings, models, extensions, skills, prompt templates, context files and mcp.json apply as in the terminal. - Streaming text and thinking; tool calls with kinds, file locations, diffs for edits and writes, and live command output; cancel. - Model and thinking level as session config options; extension commands, prompt templates, skills, /compact and /name as slash commands; context usage and cost after each prompt. - session/list, session/load (with history), session/resume and session/close over Pi's own session files. - The editor's MCP servers are registered with Pi's MCP support by the built-in `acp` extension, with their values taken literally. - Extension dialogs reach the editor: confirm and select as permission requests, input and editor as forms, notify as notices. The ACP code is imported only for --acp; the other modes do not load it (same instruction counts as before for startup, -p and the TUI).
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a3563dcfc7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…cope - session/new and session/load fail when the session's runtime reports an error (an extension that failed to load, an unknown --provider), as the other modes exit on them. - session/list without a directory and session/load of such a session read the --session-dir / PI_CODING_AGENT_SESSION_DIR directory. - The model option lists and accepts only the models of --models or the enabledModels setting when one is set, as the terminal does. - The ACP test client uses the ACP types instead of `any`.
Checked against the ACP test kit (acp-tck, v1 conformant), the official TypeScript SDK, and the clients of Zed and the VS Code ACP extension. - Live command output updates carry status "in_progress": some clients take an update without a status for a finished call. - A permission request about a running tool no longer leaves its question as the tool's title or clears its output: both are restored after the answer. A dialog's own entry ends once answered. - No model or API key set up: the prompt fails with a message that says how to set one up from the editor (run pi-bolt in a terminal and /login, or an API key in the agent's environment), not as AuthRequired, which Zed replaces with a sign-in screen that has no methods. - Prompt templates' argument-hint is the command's input hint. - Clients with _meta.terminal_output (Zed) show the commands Pi runs in a terminal view: terminal_info on the tool call, the new output as terminal_output, and terminal_exit with the exit code. Other clients get the text output as before.
The read tool's offset counts from 1, but Zed takes a tool call location's line as 0-based, so following a read landed one line below where it started. Locations now send offset - 1.
c18a189 to
8910521
Compare
What and why
pi-bolt --acp(or--mode acp) serves the Agent Client Protocol on stdin and stdout, so Zed, JetBrains IDEs, VS Code ACP extensions, Neovim and other ACP clients run Pi-Bolt in their agent panel. It is built in (packages/coding-agent/src/extensions/acp/) and needs no install.main.ts's runtime factory in the directory the editor names, so settings, models and logins, extensions, skills, prompt templates, context files andmcp.jsonapply as in the terminal./compactand/nameas slash commands; context usage and cost after each prompt.session/list,session/load(replays history),session/resume,session/close, over Pi's own session files (a session started in the editor opens withpi-bolt --session <id>).acpextension; header and env values are taken literally (no${VAR}/!commandexpansion).confirm/selectas permission requests,input/editoras forms,notifyas notices.The ACP code is imported only for
--acp; the TUI,-pand RPC mode do not load it. Docs:docs/ACP.md, README "Editors".How it was tested
test/acp-mode.test.ts: 7 end-to-end tests that startpi --acpagainst a local fake OpenAI-compatible model (prompt with write/edit/bash tool calls and diffs, cancel, load from an earlier process with replay, resume, extension dialogs, editor MCP server with literal env values, config options). They pass from source and on the AOT executable (PI_ACP_TEST_EXECUTABLE=out/pi-bolt/pi), on macOS arm64.test/acp-translate.test.ts: unit tests for the conversions, the MCP config mapping and the JSON-RPC connection.npm run checkpasses; the full coding-agent suite passes (write-call-collapsed-highlighttimed out once under build load and passes on its own).bench/benchmark.py, 15 runs, same commit with and without this change (darwin-arm64, JIT off), instructions retired:--version)-p, 5 model turns)Peak memory and time to interactive are the same too.
Not yet tried in a real editor or with the ACP test kit (acp-tck).
cipasses