|
| 1 | +# Vendor CLI agent backends |
| 2 | + |
| 3 | +ShadowCode can run a coding task by spawning the official Claude, Codex, or |
| 4 | +Grok CLI in a trusted workspace. In this mode the **vendor agent** owns the |
| 5 | +loop, its tools, and its sandbox. ShadowCode is the workspace, transcript, |
| 6 | +review, approval, and steering shell. |
| 7 | + |
| 8 | +This is distinct from a **local model (ShadowCode agent)**, where ShadowCode |
| 9 | +calls an OpenAI-compatible or Ollama HTTP API and injects its own tools. |
| 10 | + |
| 11 | +ShadowCode **never** reads, stores, proxies, or re-implements vendor OAuth |
| 12 | +tokens. Login is always: |
| 13 | + |
| 14 | +| Vendor | Login | |
| 15 | +| --- | --- | |
| 16 | +| Codex | `codex login` | |
| 17 | +| Grok | `grok login` | |
| 18 | +| Claude | `claude auth login` | |
| 19 | + |
| 20 | +Doctor only checks that the binary is on `PATH` and that a login *marker* |
| 21 | +exists (`~/.codex/auth.json`, `~/.grok/auth.json`, `~/.claude/.credentials.json`, |
| 22 | +or `claude auth status --json` → `loggedIn`). Credential contents are never |
| 23 | +opened, logged, or shown. |
| 24 | + |
| 25 | +## Adapters |
| 26 | + |
| 27 | +### Codex |
| 28 | + |
| 29 | +Primary: `codex app-server` — JSON-RPC 2.0 over stdio (`initialize` → |
| 30 | +`thread/start` → `turn/start`, streamed `item/*` notifications, approval |
| 31 | +requests such as `item/commandExecution/requestApproval`). |
| 32 | + |
| 33 | +Fallback: `codex exec --json` only when `app-server` is unavailable (unknown |
| 34 | +subcommand or missing help). Exec has no approval channel. |
| 35 | + |
| 36 | +References: [OpenAI Codex docs](https://developers.openai.com/codex), |
| 37 | +[openai/codex](https://github.com/openai/codex), and the T3 Code provider |
| 38 | +notes at |
| 39 | +[docs/internals/providers.md](https://github.com/pingdotgg/t3code/blob/main/docs/internals/providers.md). |
| 40 | + |
| 41 | +### Grok |
| 42 | + |
| 43 | +`grok agent stdio` speaks the [Agent Client Protocol](https://agentclientprotocol.com) |
| 44 | +(JSON-RPC over stdio). ShadowCode declares no `fs` / `terminal` client |
| 45 | +capabilities, so Grok performs its own I/O. See [xAI build docs](https://docs.x.ai/build). |
| 46 | + |
| 47 | +### Claude |
| 48 | + |
| 49 | +`claude -p --output-format stream-json --input-format stream-json --verbose --include-partial-messages --permission-prompts host` |
| 50 | +([Claude Code headless](https://code.claude.com/docs/en/headless)). |
| 51 | +Permission prompts become ShadowCode Allow/Deny cards. |
| 52 | + |
| 53 | +**Policy:** Anthropic forbids third-party clients from using Pro/Max OAuth |
| 54 | +tokens directly (enforced 2026). Driving the official `claude` binary with the |
| 55 | +user's own login is currently tolerated but not guaranteed. Settings → Advanced |
| 56 | +has `cli_agents.claude_enabled` to disable the adapter. |
| 57 | + |
| 58 | +## What ShadowCode does and does not do |
| 59 | + |
| 60 | +- Maps vendor text, tool start/finish, file-change reports, results, and errors |
| 61 | + into the existing transcript. |
| 62 | +- Routes vendor permission prompts through the existing Allow/Deny flow. |
| 63 | +- Cancels by killing the child **process group**. |
| 64 | +- Applies the same redaction used for ShadowCode tool output. |
| 65 | +- Does **not** inject ShadowCode tools or bubblewrap into the vendor process. |
| 66 | +- **Pause / Steer** = interrupt the vendor turn (where the protocol supports it) |
| 67 | + and send a follow-up prompt on Resume. |
| 68 | +- **Rewind does not apply.** Vendor CLIs write files with their own tools; |
| 69 | + ShadowCode file-tool checkpoints do not cover those edits. Use Git or the |
| 70 | + vendor CLI to undo. |
| 71 | + |
| 72 | +## Doctor states |
| 73 | + |
| 74 | +Each vendor reports one of: |
| 75 | + |
| 76 | +- `not_installed` — binary not on `PATH` |
| 77 | +- `not_logged_in` — installed, no login marker |
| 78 | +- `ready` — installed and login detected |
| 79 | +- `disabled` — turned off in Settings → Advanced |
| 80 | + |
| 81 | +## Settings |
| 82 | + |
| 83 | +Knobs live only in **Settings → Advanced**: |
| 84 | + |
| 85 | +- Enable vendor CLI backends |
| 86 | +- Enable Claude adapter |
| 87 | +- Binary names/paths |
| 88 | +- Approval and stall timeouts |
| 89 | + |
| 90 | +The composer model picker lists vendor backends under |
| 91 | +**Claude / Codex / Grok (vendor agent)** and local HTTP models under |
| 92 | +**Local model (ShadowCode agent)**. A Doctor status chip shows the three |
| 93 | +install/login states. |
0 commit comments