feat(provider): add acpx provider for any ACP-compatible coding agent#16
Merged
Conversation
Routes review/fix/revalidate through openclaw/acpx so clawpatch can use Codex, Claude, Pi, Gemini, or any other ACP-compatible coding agent behind one provider name. Defaults to codex as the underlying agent so existing users keep working unchanged; select a different agent via `--model claude`, `--model pi`, or `--model claude:sonnet-4-5`. The new `runCommandRaw` exec helper preserves full stdout for stream-protocol consumers; the existing `runCommand` still truncates output > 8KB, so existing callers are unaffected. The NDJSON parser reads agent_message_chunk, agent_thought_chunk, and tool_call_result envelopes so non-codex agents that route final output differently still work. The malformed-output diagnostic names the observed envelope kinds so acpx-version-shape drift is diagnosable rather than silent.
…mode caveat acpx --deny-all denies ACP permission prompts but does not force the underlying agent into a read-only sandbox. Agents in their own full-access mode that bypass ACP permissions could still write to the workspace during review/revalidate. Add an explicit READ-ONLY directive to the prompt body when permission is deny, and document the limitation in safety.md and providers.md so the existing read-only contract is preserved where the agent honors prompt directives, and the residual risk is named for agents that don't.
# Conflicts: # CHANGELOG.md # docs/providers.md # src/exec.ts # src/provider.test.ts # src/provider.ts
Contributor
Author
|
Thanks for landing the acpx provider, @steipete. ACP-compatible coverage in clawpatch is a real unlock. |
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.
Summary
acpxprovider that routesclawpatch review/fix/revalidatethrough openclaw/acpx, so any ACP-compatible coding agent (Codex, Claude, Pi, Gemini, OpenClaw ACP) can back a clawpatch run behind one provider name. Defaults tocodexas the underlying agent so existing users keep the same behavior; pick a different agent via--model claude,--model pi, or--model claude:sonnet-4-5.providerByNameplus a small helper trio (runAcpxJson,buildAcpxPrompt,extractAcpxJson) insrc/provider.ts. No new runtime dependencies;acpxis a peer CLI likecodex.runCommandRawinsrc/exec.tspreserves full stdout for stream-protocol consumers. The existingrunCommandkeeps its 8 KBtrimOutputfor short-output CLIs, so codex/mocks are unaffected. acpx's--format json --json-strictemits 200+ NDJSON envelopes per prompt, which would be corrupted by truncation.acpx --approve-allis a permission-prompt auto-approver, not an enforced sandbox likecodex --sandbox workspace-write. Forreview/revalidate(--deny-all), the provider also embeds an explicit READ-ONLY directive in the prompt body, anddocs/safety.mdis updated to reflect that the read-only guarantee for theacpxpath depends on the underlying agent's cooperation.agent_message_chunk,agent_thought_chunk, andtool_call_resultenvelope kinds so the provider works for agents that route final structured output differently (Claude can land it in thought chunks; some configs use tool-call returns). On extraction failure, the diagnostic names the envelope kinds it observed, so an acpx version-shape change surfaces as a clear "envelope shape may have changed" error rather than a silent malformed-output.Why this matters
The README at line 79 and
docs/providers.mdline 42 both call out that "Direct OpenAI, Claude, Gemini, and provider panels are not implemented yet." The cheapest path to closing that gap is not to write a Claude provider, a Gemini provider, and a Pi provider one at a time, but to route throughopenclaw/acpx(the org's existing headless ACP client). This is the same patternopenclaw/mcporteruses for MCP servers: one CLI surface for a whole protocol family.Selection syntax uses last-colon split on
model, so model identifiers that contain colons work cleanly:modelvaluecodexclaudeclaudeclaude:sonnet-4-5claudesonnet-4-5pipiollama:llama3:70bollama:llama370bMigration:
--provider codex --model Xis NOT equivalent to--provider acpx --model X(the latter selects an agent named X). The correct migration is--provider acpx --model codex:X.docs/providers.mdhas a dedicated migration note.Demo
Simulated demo:
Empirical validation from the dogfood run:
acpx --cwd <root> --deny-all --format json --json-strict codex exec --file <prompt>against aclawpatch review-shaped prompt embeddingreviewJsonSchemareturned schema-conforming JSON on first try. 256 NDJSON lines, ~19s, concatenatedagent_message_chunk.content.textparsed cleanly into{findings, inspected}.Testing
corepack pnpm typecheckcorepack pnpm lintcorepack pnpm test— 126 tests pass; newsrc/provider.test.tscoversextractAcpxJsonfor codex / claude (thought-chunk) / tool-call shapes,jsonfence stripping, prose-preamble tolerance, the malformed-output diagnostic paths, and a 256-line NDJSON fixture >8KB as a regression guard for therunCommandRawpath.