llm-cli-gateway 1.13.1 → 1.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +51 -0
- package/dist/index.js +6 -1
- package/dist/upstream-contracts.js +21 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,57 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to the llm-cli-gateway project.
|
|
4
4
|
|
|
5
|
+
## [1.13.2] - 2026-05-27 — Claude stream-json regression fix (--verbose now required)
|
|
6
|
+
|
|
7
|
+
Patch release. Single user-facing fix to `claude_request` /
|
|
8
|
+
`claude_request_async` when called with `outputFormat: "stream-json"`.
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- Claude CLI 2.x rejects `--print --output-format=stream-json` without
|
|
13
|
+
`--verbose` ("When using --print, --output-format=stream-json requires
|
|
14
|
+
--verbose"). The gateway was emitting `--output-format stream-json
|
|
15
|
+
--include-partial-messages` without `--verbose`, so every claude
|
|
16
|
+
request configured for stream-json (sync or async) was exiting 1.
|
|
17
|
+
- `prepareClaudeRequest` now pushes `--verbose` as part of the
|
|
18
|
+
stream-json arg group. `--verbose` only affects what claude writes to
|
|
19
|
+
stderr; the stream-json stdout payload is unchanged, so the existing
|
|
20
|
+
NDJSON parser in `src/stream-json-parser.ts` needs no changes.
|
|
21
|
+
- This was the practical reason the flight recorder's
|
|
22
|
+
`cache_read_tokens` / `cache_creation_tokens` columns stayed NULL for
|
|
23
|
+
claude rows — token capture is gated on a successful stream-json run.
|
|
24
|
+
With this fix, callers who opt into `outputFormat: "stream-json"` get
|
|
25
|
+
Anthropic cache_read_input_tokens / cache_creation_input_tokens
|
|
26
|
+
recorded in the FR for the first time since the CLI started enforcing
|
|
27
|
+
`--verbose`.
|
|
28
|
+
- Direct CLI verification: `claude -p ... --output-format stream-json
|
|
29
|
+
--verbose --include-partial-messages` returned a clean NDJSON stream
|
|
30
|
+
with `cache_read_input_tokens: 17978` and
|
|
31
|
+
`cache_creation_input_tokens: 17435` on a 1-hour-cache-enabled
|
|
32
|
+
account. The parser path is correct; only the missing flag was
|
|
33
|
+
blocking it.
|
|
34
|
+
|
|
35
|
+
### Tests
|
|
36
|
+
|
|
37
|
+
- New regression: `prepareClaudeRequest` emits `--verbose` when
|
|
38
|
+
`outputFormat: "stream-json"` and does NOT emit it for `text` / `json`
|
|
39
|
+
(src/__tests__/claude-handler.test.ts).
|
|
40
|
+
- Updated `upstream-contracts.test.ts` "accepts a valid Claude argv
|
|
41
|
+
emitted by the gateway" to pin the three-flag combo so a future
|
|
42
|
+
removal of `--verbose` fails at the contract gate.
|
|
43
|
+
- New conformance fixture `claude-stream-json-requires-verbose` in
|
|
44
|
+
`src/upstream-contracts.ts` registering `--verbose` and asserting the
|
|
45
|
+
combo is accepted.
|
|
46
|
+
- 886 tests pass (884 prior + 2 new). Build clean.
|
|
47
|
+
|
|
48
|
+
### Why a patch release
|
|
49
|
+
|
|
50
|
+
The regression silently broke a documented MCP API surface; users
|
|
51
|
+
explicitly opting into stream-json (for token observability or
|
|
52
|
+
upcoming cache_control work in slice κ) were getting exit-1 errors
|
|
53
|
+
with no obvious gateway-side cause. Same shape as v1.13.1 (single
|
|
54
|
+
focused fix, no behaviour change for callers using `text` / `json`).
|
|
55
|
+
|
|
5
56
|
## [1.13.1] - 2026-05-27 — Installer Windows build fix (no code changes)
|
|
6
57
|
|
|
7
58
|
Patch release. **No changes to the gateway, MCP tools, or any provider
|
package/dist/index.js
CHANGED
|
@@ -957,7 +957,12 @@ export function prepareClaudeRequest(params, runtime = resolveGatewayServerRunti
|
|
|
957
957
|
args.push("--output-format", "json");
|
|
958
958
|
}
|
|
959
959
|
else if (params.outputFormat === "stream-json") {
|
|
960
|
-
|
|
960
|
+
// Claude CLI 2.x rejects `--print --output-format stream-json` without
|
|
961
|
+
// `--verbose`: "When using --print, --output-format=stream-json requires
|
|
962
|
+
// --verbose". --verbose only affects what claude logs to stderr; the
|
|
963
|
+
// stream-json stdout payload is unchanged, so the gateway's NDJSON
|
|
964
|
+
// parser is unaffected.
|
|
965
|
+
args.push("--output-format", "stream-json", "--include-partial-messages", "--verbose");
|
|
961
966
|
}
|
|
962
967
|
if (params.allowedTools && params.allowedTools.length > 0) {
|
|
963
968
|
sanitizeCliArgValues(params.allowedTools, "allowedTools");
|
|
@@ -57,6 +57,10 @@ export const UPSTREAM_CLI_CONTRACTS = {
|
|
|
57
57
|
arity: "none",
|
|
58
58
|
description: "Include partial messages in stream-json output",
|
|
59
59
|
},
|
|
60
|
+
"--verbose": {
|
|
61
|
+
arity: "none",
|
|
62
|
+
description: "Claude CLI 2.x: required alongside --print + --output-format=stream-json; affects stderr only, stream-json stdout shape unchanged",
|
|
63
|
+
},
|
|
60
64
|
"--allowed-tools": { arity: "variadic", description: "Allowed tool names/patterns" },
|
|
61
65
|
"--disallowed-tools": { arity: "variadic", description: "Disallowed tool names/patterns" },
|
|
62
66
|
"--permission-mode": {
|
|
@@ -142,6 +146,23 @@ export const UPSTREAM_CLI_CONTRACTS = {
|
|
|
142
146
|
args: ["-p", "hello", "--add-dir", "/tmp/a", "--add-dir", "/tmp/b"],
|
|
143
147
|
expect: "pass",
|
|
144
148
|
},
|
|
149
|
+
{
|
|
150
|
+
// Claude CLI 2.x: stream-json requires --verbose alongside --print.
|
|
151
|
+
// The gateway emits all three together; this fixture pins the combo
|
|
152
|
+
// so a future removal of --verbose breaks loudly here instead of
|
|
153
|
+
// silently at runtime against the upstream CLI.
|
|
154
|
+
id: "claude-stream-json-requires-verbose",
|
|
155
|
+
description: "Claude CLI 2.x: --output-format stream-json + --include-partial-messages + --verbose accepted together",
|
|
156
|
+
args: [
|
|
157
|
+
"-p",
|
|
158
|
+
"hello",
|
|
159
|
+
"--output-format",
|
|
160
|
+
"stream-json",
|
|
161
|
+
"--include-partial-messages",
|
|
162
|
+
"--verbose",
|
|
163
|
+
],
|
|
164
|
+
expect: "pass",
|
|
165
|
+
},
|
|
145
166
|
],
|
|
146
167
|
},
|
|
147
168
|
codex: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "llm-cli-gateway",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.2",
|
|
4
4
|
"mcpName": "io.github.verivus-oss/llm-cli-gateway",
|
|
5
5
|
"description": "MCP server providing unified access to Claude Code, Codex, Gemini, Grok, and Mistral Vibe CLIs with session management, retry logic, async job orchestration, durable job results, and cross-LLM validation.",
|
|
6
6
|
"license": "MIT",
|