Skip to content

feat(acp): run Pi-Bolt in editors over the Agent Client Protocol - #32

Merged
Kushalkhemka merged 5 commits into
pi-boltfrom
acp-support
Oct 15, 2026
Merged

Kushalkhemka merged 5 commits into
pi-boltfrom
acp-support

Conversation

@Kushalkhemka

Copy link
Copy Markdown
Member

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.

  • Each ACP session is a Pi session built by main.ts's runtime factory in the directory the editor names, so settings, models and logins, 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 (replays history), session/resume, session/close, over Pi's own session files (a session started in the editor opens with pi-bolt --session <id>).
  • The editor's MCP servers (stdio and HTTP) are registered with Pi's MCP support by the built-in acp extension; header and env values are taken literally (no ${VAR} / !command expansion).
  • Extension dialogs reach the editor: confirm/select as permission requests, input/editor as forms, notify as notices.

The ACP code is imported only for --acp; the TUI, -p and 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 start pi --acp against 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 check passes; the full coding-agent suite passes (write-call-collapsed-highlight timed 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:
Scenario Without With
startup (--version) 86M 87M
headless (-p, 5 model turns) 320M 320M
interactive (5 prompts) 849M 848M

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).

  • ci passes

`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).
Copilot AI balanced review requested due to automatic review settings October 15, 2026 09:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-15T10:02:25.605323Z a3563dc PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread packages/coding-agent/src/extensions/acp/mode.ts
Comment thread packages/coding-agent/src/extensions/acp/mode.ts Outdated
Comment thread packages/coding-agent/src/extensions/acp/mode.ts Outdated
Comment thread packages/coding-agent/src/extensions/acp/mode.lazy.ts
Comment thread packages/coding-agent/test/acp-mode.test.ts Outdated
…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.
@Kushalkhemka
Kushalkhemka merged commit 1e45560 into pi-bolt Oct 15, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants