Skip to content

feat: Grok CLI support via ACP (generalized RPC agent seam) - #266

Open
iabdousd wants to merge 18 commits into
mainfrom
sleeping-memoization-185
Open

feat: Grok CLI support via ACP (generalized RPC agent seam)#266
iabdousd wants to merge 18 commits into
mainfrom
sleeping-memoization-185

Conversation

@iabdousd

@iabdousd iabdousd commented Aug 8, 2026

Copy link
Copy Markdown
Member

Grok CLI support via ACP

Adds xAI's Grok CLI (grok agent stdio) as a first-class Verun agent with full UI parity: streamed reasoning + text, tool-call cards with per-card diffs, interactive permission approvals, resume, and usage/cost.

The generalization (single source of truth)

Grok speaks ACP (Agent Client Protocol) — a persistent bidirectional JSON-RPC 2.0 session, the same transport shape as Codex's app-server. Rather than clone a parallel path, the Codex-only RPC path was generalized into a protocol-agnostic Agent::rpc_* seam:

  • agent/codex_rpc.rsagent/rpc.rs (the JSON-RPC transport was already protocol-agnostic)
  • task.rs (spawn_rpc_session) and stream.rs (stream_and_capture_rpc) now dispatch entirely through Agent::rpc_* trait methods — encode handshake/turn/interrupt, decode notifications, classify/encode approvals, extract usage, parse session/turn ids
  • Codex and Grok both flow through this one seam; the temporary Codex delegation shim was inlined and deleted
  • No if kind == Grok anywhere outside agent/ — orchestration is fully trait-driven

What Grok does

  • initialize advertising no fs capability (Grok does its own file I/O), session/new / session/load (resume), session/prompt, session/cancel
  • decodes session/update into thinking / text / tool-cards / diffs / usage; maps session/request_permission onto Verun's approval UI
  • grok-4.5; persistent process across turns

Verification

  • Backend lib: 799 pass (the 8 failing mcp::tests::write_mcp_config_* are pre-existing and unrelated — stale since e9f988c changed the config write path; confirmed failing on the base commit)
  • clippy clean (0 warnings); tsc --noEmit clean; frontend vitest 691 pass
  • All Codex tests green throughout — the refactor is behavior-preserving
  • Live ACP verification against the real grok binary: streaming, tool calls, diffs, permission requests, and cross-process session/load resume all confirmed; the Rust encoders emit the same wire frames and the decoders are tested against captured real shapes

Deferred (documented follow-ups)

  • Plan mode, reasoning-effort selection, and attachments (not exposed over ACP)
  • FullAuto auto-approve for Grok (currently always routes through the approval UI)
  • Real diff algorithm (current renderer is prefix/suffix-trim) and Verun per-task MCP passthrough
  • Manual GUI smoke test in pnpm tauri dev (couldn't be driven headlessly)

Related to #239 (enabling/disabling agent CLI providers — Grok is a new provider).

🤖 Generated with Claude Code

iabdousd added 18 commits July 18, 2026 18:12
- build.rs drops the externalBin placeholder before tauri_build::build() so
  bare `cargo check/test/clippy` work from a fresh checkout without the
  scripts/check.sh / pnpm tauri beforeBuild hook.
- .cargo/config.toml caps [build] jobs so builds don't saturate every core;
  overridable via CARGO_BUILD_JOBS or global cargo config.
- Claude: lead with Claude 5 family (claude-opus-5 default, claude-fable-5,
  claude-sonnet-5, previous-gen claude-opus-4-8, claude-haiku-4-5).
- Codex: lead with GPT-5.6 (gpt-5.6-sol default, gpt-5.6-terra, gpt-5.6-luna,
  plus gpt-5.5/5.4/5.4-mini/5.3-codex); turn-start default -> gpt-5.6-sol.
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.

1 participant