Skip to content

feat(coding-agent): add native ACP stdio mode - #310

Draft
li-xiu-qi wants to merge 2 commits into
stepfun-ai:mainfrom
li-xiu-qi:feat/native-acp-stdio
Draft

li-xiu-qi wants to merge 2 commits into
stepfun-ai:mainfrom
li-xiu-qi:feat/native-acp-stdio

Conversation

@li-xiu-qi

Copy link
Copy Markdown
Collaborator

Resolves #224

What this adds

A native --mode acp headless mode that speaks Agent Client Protocol v1 over stdio.

  • initialize, session/new, session/load, session/prompt, and session/cancel are mapped onto the existing AgentSessionRuntimeHost; no new session engine is introduced.
  • Agent events stream back as session/update notifications, including assistant text, thinking, tool calls, tool results, plans, and available commands.
  • Extension UI dialogs are bridged to session/request_permission; input(), editor, and custom component dialogs are explicitly unsupported in ACP.
  • Mode-specific bindings are extended for ACP: project trust fallback, extension mode, plan-mode external approval, login startup exclusion, and completion-check rejection.

Files

  • New protocol implementation: packages/coding-agent/src/modes/acp/acp-types.ts, acp-wire.ts, acp-mode.ts
  • New CLI entry: apps/cli/src/modes/acp.ts
  • Mode wiring and docs: apps/cli/src/main.ts, packages/coding-agent/src/main.ts, packages/coding-agent/src/cli/args.ts, packages/coding-agent/docs/acp.md, README/usage/security/settings/quickstart/extensions docs

Verification

  • pnpm run check passes: Biome, pinned deps, TS import/layer/ui/workspace/entry/contracts/boundary checks, tsgo --noEmit, and browser smoke.
  • Targeted tests pass: vitest --run test/acp-wire.test.ts test/acp-mode.test.ts test/args.test.ts (168 tests). The ACP mode test drives initialize, a streaming prompt turn, a permission request/response, and cancellation without blocking stdin.

Notes

This PR is intentionally scoped to the stdio protocol entry and mode bindings. MCP capabilities are advertised as unsupported for now; HTTP/SSE MCP can be layered on after the core transport is accepted.

Wire the Agent Client Protocol v1 JSON-RPC stdio transport as a new headless
mode so external clients can drive the existing session runtime. It maps
session/new, session/load, session/prompt, and session/cancel onto the runtime
host, streams agent events as session/update notifications, and bridges
permission requests back to the client. RPC remains unchanged; ACP only adds
the protocol entry and its mode-specific trust/extension bindings.

Resolves stepfun-ai#224
CI caught two plan-mode assertions still expecting the old RPC-only copy after
ACP generalized the approval path. Update the expected result text and warning
substring; no behavior change.

Refs stepfun-ai#224
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.

[feat] 希望增加原生 ACP 模式(如 step acp)以便编辑器/客户端集成

1 participant