Commit a6e485f
feat: add Claude Code CLI driver and release 0.1.13
Adds `claude` as a fifth builtin agent driver on the Structured transport,
using Claude Code's own stream-json stdio surface rather than a third-party
ACP shim. The adapter is its own family under src/adapters/claude/ and sits
directly on the generic JSONL process layer, because stream-json is a
newline-delimited message stream and not JSON-RPC.
Protocol notes established against Claude Code 2.1.233:
- The `system`/`init` frame is emitted only after the first user message, so
it cannot serve as a handshake. start() uses the SDK control protocol
instead: `initialize` observes `current_permission_mode` and proves the
process is alive without a model turn, then `set_permission_mode`
establishes bypassPermissions. Only a set refusal or downgrade is
NATIVE_POLICY_BLOCKED; the deferred init frame still verifies session_id,
cwd and permissionMode on the first turn.
- Cancellation reports two abort reasons: aborted_streaming mid-token and
aborted_tools during tool execution. Both normalize to turn.cancelled and
leave the stdio process usable for the next turn.
- An interrupt that loses the race to a settling turn leaves the CLI owing a
second result frame, which is absorbed within the cancel window.
result.num_turns counts agent iterations per prompt, so it cannot correlate
a result with a turn.
- Interactive control requests (can_use_tool, elicitation,
request_user_dialog) are denied at the wire boundary and fail the turn with
UNEXPECTED_NATIVE_INTERACTION. GroupX still has no approval subsystem.
- The initialize payload also carries account, organization, model and
command inventories; only current_permission_mode and pid are projected.
Unrestricted access is applied through argv only and GroupX never writes
Claude Code's settings files. Claude Code rewrites its own ~/.claude.json
session-state file on any invocation; that is native CLI behavior and is
recorded as a diagnostic rather than gated.
Command resolution covers the native single-file build and the npm package
on both platforms: Windows PATH, %USERPROFILE%\.local\bin\claude.exe, then
the npm-global entrypoint (APPDATA is read only for that last layer); POSIX
PATH, $HOME/.local/bin/claude, then the npm-global cli.js under this Node
prefix, Homebrew or /usr/local, without shelling out to `npm root -g`.
Like Hermes, `claude` is not auto-enabled when the agents field is omitted,
and it carries independent native-live evidence rather than entering the
core codex/grok/kimi M0 gate.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 570babe commit a6e485f
39 files changed
Lines changed: 3413 additions & 73 deletions
File tree
- docs
- site
- src
- adapters
- claude
- app
- contracts
- core
- launch
- tests
- fixtures/claude
- unit
- adapters/claude
- app
- contracts
- launch
- web
- server
- setup
- web
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
46 | 55 | | |
47 | 56 | | |
48 | 57 | | |
| |||
80 | 89 | | |
81 | 90 | | |
82 | 91 | | |
83 | | - | |
| 92 | + | |
84 | 93 | | |
85 | 94 | | |
86 | 95 | | |
| |||
130 | 139 | | |
131 | 140 | | |
132 | 141 | | |
133 | | - | |
| 142 | + | |
134 | 143 | | |
135 | 144 | | |
136 | 145 | | |
| |||
160 | 169 | | |
161 | 170 | | |
162 | 171 | | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
163 | 177 | | |
164 | 178 | | |
165 | 179 | | |
| |||
169 | 183 | | |
170 | 184 | | |
171 | 185 | | |
| 186 | + | |
| 187 | + | |
172 | 188 | | |
173 | 189 | | |
174 | 190 | | |
175 | 191 | | |
176 | | - | |
| 192 | + | |
177 | 193 | | |
178 | 194 | | |
179 | 195 | | |
| |||
228 | 244 | | |
229 | 245 | | |
230 | 246 | | |
| 247 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
44 | 49 | | |
45 | 50 | | |
46 | 51 | | |
| |||
50 | 55 | | |
51 | 56 | | |
52 | 57 | | |
| 58 | + | |
53 | 59 | | |
54 | 60 | | |
55 | 61 | | |
| |||
65 | 71 | | |
66 | 72 | | |
67 | 73 | | |
| 74 | + | |
| 75 | + | |
68 | 76 | | |
69 | 77 | | |
70 | 78 | | |
| |||
243 | 251 | | |
244 | 252 | | |
245 | 253 | | |
246 | | - | |
| 254 | + | |
247 | 255 | | |
248 | 256 | | |
249 | 257 | | |
| |||
0 commit comments