feat: add claw-acp — ACP server bridge for IDE integration#2575
Open
joka-7 wants to merge 3 commits into
Open
Conversation
Adds `claw-acp`, a TypeScript/Bun script that exposes NanoClaw as an ACP (Agent Client Protocol) server so IDEs like WebStorm, Zed, and acpx can use NanoClaw as their AI backend via ACP JSON-RPC 2.0 over stdio. The bridge forwards prompts to NanoClaw's existing CLI Unix socket and returns responses through the ACP session — no host changes required. Supported methods: initialize, session/new, session/prompt, session/cancel, session/close, fs/read_text_file (with line/limit, sandboxed to $HOME). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Exports LineReader, AcpBridge, and CliTransport. Adds injectable I/O (input, output, connectCli, recvTimeoutMs, fsRoot) so tests run without a live NanoClaw instance. 23 tests covering LineReader, all ACP methods, timeout, path sandboxing, and error codes — mirrors the acp-client.test.ts pattern. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
When an IDE sends a resource_link block in session/prompt (e.g. a WebStorm @file mention), the bridge now calls fs/read_text_file back on the IDE, fetches the file content, and embeds it as text in the NanoClaw prompt. Fixes the deadlock by firing session/prompt without blocking the run loop, so incoming IDE responses can be processed while the prompt is in flight. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Demo
WebStorm AI Chat using NanoClaw as the agent backend via ACP —
@filementionattaches the file content, which is fetched from the IDE via
fs/read_text_fileand forwarded to the NanoClaw agent in the prompt.
Summary
Adds
claw-acp, a utility skill that makes NanoClaw available as an ACP server — so IDEs like WebStorm, Zed, andacpxcan use NanoClaw as their AI backend via the Agent Client Protocol.How it works
No NanoClaw host changes.
claw-acpis a pure bridge on top of the existing CLI channel — install the skill, add one config file to your IDE, done.ACP server vs ACP client
NanoClaw already has an ACP client provider (
feature/acp-agent-client-protocol) — where NanoClaw connects out to an external ACP agent and uses it as the container's AI backend.This PR is the opposite direction: the IDE connects in to NanoClaw.
agent_provider: "acp-client"on agent group~/.jetbrains/acp.jsonor Zed settingsBoth can run simultaneously — the IDE connects to NanoClaw via the server bridge, while NanoClaw's agent containers can still connect out to external ACP agents as their AI backend.
Supported ACP methods
initializepromptCapabilities,serverInfo,authMethodssession/newsession/promptsession/updatechunksession/cancelsession/closefs/read_text_fileline/limitsupport; sandboxed to$HOMEorNANOCLAW_FS_ROOTfs/write_text_fileInstall
Then add one config file to your IDE. See
SKILL.mdfor JetBrains, Zed, andacpxconfig examples.Files
.claude/skills/add-acp-server/SKILL.md.claude/skills/add-acp-server/scripts/claw-acp.ts.claude/skills/add-acp-server/scripts/claw-acp.test.tsbun:test)Tests
23 tests, no live NanoClaw instance required. Mirrors the test structure of
acp-client.test.tsusingMockIO+MockClihelpers.Coverage:
LineReaderhandleInitializehandleSessionNewhandleSessionPrompthandleSessionCancel/handleSessionClose{}handleFsReadTextFilerun()dispatch-32601, notification ignored, invalid JSON skippedKnown limitations
claw-acpprocess evicts the firstsession/updatechunk, not token-by-tokenfs/read_text_filesupported;fs/write_text_filenotclaw-acpis a bridge, not a standalone AI server