crysk 0.7.0 → 0.8.0
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/README.md +27 -23
- package/dist/SKILL-1q3658n0.md +74 -0
- package/dist/SKILL-25j4q9b8.md +143 -0
- package/dist/SKILL-4747bhne.md +143 -0
- package/dist/SKILL-4jc3sv23.md +74 -0
- package/dist/SKILL-c0492rch.md +540 -0
- package/dist/SKILL-d1nzkhhr.md +74 -0
- package/dist/SKILL-f8p7kvx0.md +143 -0
- package/dist/SKILL-gxd45g38.md +553 -0
- package/dist/SKILL-rec41991.md +66 -0
- package/dist/SKILL-zze8zj5g.md +536 -0
- package/dist/cli.js +24658 -24654
- package/dist/index.js +492 -463
- package/dist/opencode-ci-qrcv7a99.md +106 -0
- package/dist/opencode-ci-rdpcc7xc.md +106 -0
- package/dist/opencode-ci-yt0k74t0.md +106 -0
- package/dist/workflow-andv2dvm.yml +158 -0
- package/package.json +1 -1
- package/prompts/default/PROVENANCE.md +1 -0
- package/skills/crysk/SKILL.md +6 -6
- package/skills/crysk-ci-setup/SKILL.md +32 -33
- package/skills/crysk-ci-setup/assets/workflow.yml +5 -10
- package/skills/crysk-ci-setup/references/ci-admission.md +5 -5
- package/skills/crysk-ci-setup/references/opencode-ci.md +6 -6
- package/skills/crysk-loop/SKILL.md +37 -54
- package/skills/crysk-pr/SKILL.md +1 -1
- package/src/asset-manifest.ts +0 -6
- package/src/assets.ts +1 -4
- package/src/brand.ts +20 -30
- package/src/ci/gates.ts +155 -201
- package/src/ci/outcome.ts +4 -31
- package/src/ci/platform-limits.ts +135 -0
- package/src/ci/platform-report.ts +212 -126
- package/src/ci/platform.ts +28 -26
- package/src/ci/reporter.ts +25 -26
- package/src/ci/review-admission.ts +1 -2
- package/src/ci/review-levels.ts +12 -53
- package/src/ci/setup.ts +96 -66
- package/src/ci/trace-bundle.ts +11 -27
- package/src/ci/trace-transcripts.ts +4 -6
- package/src/ci/trigger.ts +3 -5
- package/src/cli.ts +6 -5
- package/src/commands/ci-setup-questions.ts +2 -55
- package/src/commands/ci-setup.ts +2 -26
- package/src/commands/triage.ts +131 -38
- package/src/commands/usage.ts +0 -1
- package/src/compare/compare.ts +3 -3
- package/src/compare/floor-test.ts +30 -201
- package/src/config/config.ts +6 -30
- package/src/diversity/accounting.ts +0 -26
- package/src/diversity/benchmark.ts +1 -17
- package/src/diversity/identity.ts +0 -14
- package/src/diversity/pipeline-integration.ts +0 -29
- package/src/doctor.ts +3 -6
- package/src/execution/claude-session-trace.ts +7 -2
- package/src/execution/contracts.ts +15 -9
- package/src/execution/harness.ts +165 -187
- package/src/execution/spend-limiter.ts +39 -131
- package/src/execution/usage-facts.ts +397 -0
- package/src/execution/usage-normalized.ts +33 -86
- package/src/harness/materiality-judge.ts +0 -5
- package/src/harness/pipeline-plan.ts +0 -3
- package/src/harness/replay-rows.ts +0 -5
- package/src/harness/route-runner.ts +2 -2
- package/src/harness/single-step.ts +3 -9
- package/src/index.ts +1 -1
- package/src/mcp/preflight.ts +2 -2
- package/src/model/catalog.ts +1 -3
- package/src/model/free-discovery.ts +11 -78
- package/src/model/model-name.ts +14 -4
- package/src/model/profiles/claude.ts +1 -2
- package/src/model/profiles/openai.ts +1 -2
- package/src/model/profiles.ts +1 -2
- package/src/model/provider-capabilities.ts +16 -55
- package/src/model/routing.ts +39 -36
- package/src/pr/admission.ts +6 -6
- package/src/pr/answered-findings.ts +8 -4
- package/src/pr/ci-publish.ts +0 -2
- package/src/pr/discovery.ts +4 -25
- package/src/pr/plan.ts +40 -121
- package/src/pr/pr-status.ts +14 -2
- package/src/pr/preflight.ts +15 -12
- package/src/pr/publish-outcome.ts +1 -19
- package/src/pr/review-pr.ts +10 -47
- package/src/pr/target.ts +76 -82
- package/src/production-runtime.ts +52 -114
- package/src/progress.ts +0 -54
- package/src/rereview/prepare.ts +4 -1
- package/src/rereview/state.ts +1 -1
- package/src/review/boundary.ts +4 -8
- package/src/review/drafts.ts +3 -3
- package/src/review/findings-conformance.ts +1 -1
- package/src/review/findings.ts +0 -4
- package/src/review/pipeline.ts +57 -395
- package/src/review/preflight.ts +162 -201
- package/src/review/prompt-set.ts +0 -2
- package/src/review/report.ts +2 -162
- package/src/review/review.ts +16 -65
- package/src/review/route-preflight.ts +3 -35
- package/src/review/run.ts +37 -73
- package/src/review/size-gate.ts +3 -3
- package/src/review/spec.ts +6 -11
- package/src/review/step-runner.ts +4 -4
- package/src/runner-authority.ts +10 -9
- package/src/security/credential-broker.ts +5 -6
- package/src/server/preflight.ts +0 -1
- package/src/server/server.ts +17 -6
- package/src/store/activity.ts +1 -2
- package/src/store/backfill-preflight.ts +0 -3
- package/src/store/backfill.ts +0 -1
- package/src/store/metrics-preflight.ts +4 -14
- package/src/store/metrics.ts +5 -5
- package/src/store/preflight.ts +0 -13
- package/src/store/store.ts +11 -12
- package/src/transport-registry.ts +6 -30
- package/src/transports/claude-code-cli.ts +149 -215
- package/src/transports/opencode-client.ts +4 -24
- package/src/transports/opencode-sdk.ts +17 -112
- package/src/triage/plain-reply.ts +37 -0
- package/src/ui/activity.ts +1 -6
- package/src/ui/config-edit.ts +14 -67
- package/src/ui/config.ts +3 -8
- package/src/ui/plan.ts +11 -198
- package/src/ui/progress.ts +3 -49
- package/src/ui/result.ts +18 -77
- package/src/ui/review-menu.ts +3 -12
- package/src/ui/select.ts +9 -79
- package/src/updater.ts +1 -1
- package/src/usage.ts +1 -7
- package/prompts/default/deep-review-parity.md +0 -152
- package/prompts/scout.md +0 -140
- package/src/ci/platform-estimate.ts +0 -111
- package/src/review/scout.ts +0 -323
|
@@ -24,6 +24,10 @@ import {
|
|
|
24
24
|
ACTIVE_CHILD_PROCS,
|
|
25
25
|
type SpawnedProcess,
|
|
26
26
|
} from "../execution/spawned-process";
|
|
27
|
+
import {
|
|
28
|
+
claudeUsageCounts,
|
|
29
|
+
type ModelUsageCounts,
|
|
30
|
+
} from "../execution/usage-facts";
|
|
27
31
|
import type { NormalizedUsage } from "../execution/usage-normalized";
|
|
28
32
|
import {
|
|
29
33
|
envBillsMetered,
|
|
@@ -73,78 +77,45 @@ function hashPromptFile(promptPath: string): string {
|
|
|
73
77
|
return createHash("sha256").update(readFileSync(promptPath)).digest("hex");
|
|
74
78
|
}
|
|
75
79
|
|
|
76
|
-
// #177, 2026-09-02. WHICH
|
|
77
|
-
// the env the CHILD is spawned with — the one fact that
|
|
78
|
-
// subscription run (quota
|
|
79
|
-
//
|
|
80
|
+
// #177, 2026-09-02. WHICH credential class this attempt's usage is filed
|
|
81
|
+
// under, decided from the env the CHILD is spawned with — the one fact that
|
|
82
|
+
// separates a subscription run (quota) from an API-key run (a per-token
|
|
83
|
+
// credential).
|
|
80
84
|
//
|
|
81
85
|
// #173 applied the subscription rule STATICALLY here and was right about its
|
|
82
86
|
// reasoning and wrong about its premise. Its premise was
|
|
83
87
|
// `credentialKindForRoute` (runner-authority.ts), which returns
|
|
84
88
|
// `claude_subscription_oauth` for this backend UNCONDITIONALLY without ever
|
|
85
89
|
// reading the environment — so it cannot distinguish the two, and taking it as
|
|
86
|
-
// proof made every API-key user's
|
|
87
|
-
//
|
|
88
|
-
// ceiling read $0 and effectively stopped existing. Under-reporting, shipped by
|
|
89
|
-
// the change that set out to stop it.
|
|
90
|
+
// proof made every API-key user's usage file as subscription. Under-reporting,
|
|
91
|
+
// shipped by the change that set out to stop it.
|
|
90
92
|
//
|
|
91
93
|
// The fix is deliberately NARROW: it does not derive `credentialKindForRoute`,
|
|
92
|
-
// and it does not touch route admission. See the guard on `envBillsMetered
|
|
93
|
-
//
|
|
94
|
-
//
|
|
95
|
-
//
|
|
96
|
-
// runs on is `credentialKindForRoute`'s single decision (#161), and
|
|
97
|
-
// deriving it from the env HERE would fork it. This only decides how an
|
|
98
|
-
// attempt that already ran gets FILED.
|
|
99
|
-
//
|
|
100
|
-
// What each arm claims:
|
|
101
|
-
// * metered — `costSource: "provider"` because the CLI's own figure is what
|
|
102
|
-
// the API bills at (its per-model `costBasis` is `"list"`, and on a
|
|
103
|
-
// per-token key list price IS the charge). This restores #173's cash
|
|
104
|
-
// filing for this credential; `billingMode` is a truthful UPGRADE over the
|
|
105
|
-
// pre-#173 shape, which said "subscription" on every route.
|
|
106
|
-
// * subscription — #173's rule, unchanged: nothing is charged, so the list
|
|
107
|
-
// figure is notional and `costSource` is `"subscription"` (not "provider":
|
|
108
|
-
// it is not what the provider charged; not "versioned_rate_table": we
|
|
109
|
-
// computed nothing).
|
|
94
|
+
// and it does not touch route admission. See the guard on `envBillsMetered`:
|
|
95
|
+
// which credential a route runs on is `credentialKindForRoute`'s single
|
|
96
|
+
// decision (#161), and deriving it from the env HERE would fork it. This only
|
|
97
|
+
// decides how an attempt that already ran gets FILED.
|
|
110
98
|
//
|
|
111
|
-
// Returned
|
|
112
|
-
//
|
|
113
|
-
//
|
|
114
|
-
|
|
115
|
-
function claudeCliCostBasis(
|
|
99
|
+
// Returned from ONE function so `noSpawnUsage` and the two parse arms cannot
|
|
100
|
+
// drift: `sumNormalizedUsage` collapses `billingMode` to "unknown" the moment
|
|
101
|
+
// two attempts of one step disagree, and this transport retries.
|
|
102
|
+
function claudeCliBillingMode(
|
|
116
103
|
env: Readonly<Record<string, string | undefined>>,
|
|
117
|
-
): {
|
|
118
|
-
|
|
119
|
-
readonly costSource: NormalizedUsage["costSource"];
|
|
120
|
-
} {
|
|
121
|
-
return envBillsMetered(env)
|
|
122
|
-
? { billingMode: "metered", costSource: "provider" }
|
|
123
|
-
: { billingMode: "subscription", costSource: "subscription" };
|
|
104
|
+
): NormalizedUsage["billingMode"] {
|
|
105
|
+
return envBillsMetered(env) ? "metered" : "subscription";
|
|
124
106
|
}
|
|
125
107
|
|
|
126
108
|
// A denial before spawn, or a PGID proof failure that refuses to signal a
|
|
127
|
-
// child we never trust,
|
|
128
|
-
//
|
|
129
|
-
//
|
|
130
|
-
//
|
|
131
|
-
// once PR5's spend ledger reads completeness.
|
|
109
|
+
// child we never trust, used nothing — no attempt reached the provider. This
|
|
110
|
+
// is deliberately NOT `normalizeUnavailableUsage`: "unavailable" means an
|
|
111
|
+
// attempt ran and its usage is unknown, which would misfile a refusal as an
|
|
112
|
+
// unresolved spend once the spend ledger reads completeness.
|
|
132
113
|
//
|
|
133
|
-
//
|
|
134
|
-
//
|
|
135
|
-
//
|
|
136
|
-
//
|
|
137
|
-
//
|
|
138
|
-
// collapses `costSource` to "unknown" whenever two attempts disagree. Leaving
|
|
139
|
-
// this one behind would have erased the run's cost basis on exactly the retry
|
|
140
|
-
// path this transport already supports.
|
|
141
|
-
//
|
|
142
|
-
// #177, 2026-09-02: that obligation is now owed on TWO bases, so the basis is
|
|
143
|
-
// no longer written out here — `claudeCliCostBasis` is the single source both
|
|
144
|
-
// this function and the parse arms consume. Only `cashCostUsd: 0` stays local,
|
|
145
|
-
// and it is a genuine zero on either basis: no attempt reached the provider.
|
|
146
|
-
// With `tokens: {}` it also cannot trip the metered-zero rule
|
|
147
|
-
// (`settlementFromUsage`), which needs output tokens to fire.
|
|
114
|
+
// It has to carry the same billing mode as the parse arms below, for a
|
|
115
|
+
// mechanical reason: an unclassified failure legacy-classifies as "format"
|
|
116
|
+
// (step-runner.ts `classifyFailure`), which has a retry, so a denied attempt 1
|
|
117
|
+
// can be summed with a spawned attempt 2 — and `sumNormalizedUsage` collapses
|
|
118
|
+
// `billingMode` to "unknown" whenever two attempts disagree.
|
|
148
119
|
function noSpawnUsage(
|
|
149
120
|
wallMs: number,
|
|
150
121
|
env: Readonly<Record<string, string | undefined>>,
|
|
@@ -153,13 +124,11 @@ function noSpawnUsage(
|
|
|
153
124
|
wallMs,
|
|
154
125
|
tokens: {},
|
|
155
126
|
completeness: "complete",
|
|
156
|
-
|
|
157
|
-
cashCostUsd: 0,
|
|
127
|
+
billingMode: claudeCliBillingMode(env),
|
|
158
128
|
};
|
|
159
129
|
}
|
|
160
130
|
|
|
161
131
|
interface RawClaudeCliResult {
|
|
162
|
-
readonly total_cost_usd?: number;
|
|
163
132
|
// #299. Read through `toolInvocationsFromCliResult`, never directly: the
|
|
164
133
|
// type is `unknown` because the only trustworthy shape is an integer >= 1.
|
|
165
134
|
readonly num_turns?: unknown;
|
|
@@ -170,27 +139,28 @@ interface RawClaudeCliResult {
|
|
|
170
139
|
readonly cache_read_input_tokens?: number;
|
|
171
140
|
};
|
|
172
141
|
// #175 half 2. The CLI reports, per model it actually ran, an entry keyed
|
|
173
|
-
// on the exact snapshot.
|
|
174
|
-
// `canonicalModel`
|
|
175
|
-
//
|
|
176
|
-
// The
|
|
177
|
-
//
|
|
178
|
-
//
|
|
179
|
-
// decision; a second reader of a second cost field is exactly how two
|
|
180
|
-
// numbers for one attempt start disagreeing.
|
|
181
|
-
//
|
|
182
|
-
// #173 closed the `costBasis: "list"` problem this comment used to defer,
|
|
183
|
-
// and closed it WITHOUT reading the field. `costBasis` is in the response,
|
|
184
|
-
// but the FILING decision follows the credential's billing mode rather than
|
|
185
|
-
// the response's label: `normalizeClaudeCliUsage` files `total_cost_usd` as
|
|
186
|
-
// notional on the strength of the route being a subscription, which is true
|
|
187
|
-
// whatever any per-model entry says. Parsing `costBasis` per model would add
|
|
188
|
-
// the second cost reader this paragraph exists to refuse. What is still unread and still
|
|
189
|
-
// wanted is the per-model SPLIT (#173 records it): one `--model sonnet`
|
|
190
|
-
// invocation ran two models, so a single route-level cost is an incomplete
|
|
191
|
-
// provenance claim in the same way a single `modelSnapshot` is.
|
|
142
|
+
// on the exact snapshot. Read here: the two identity fields
|
|
143
|
+
// (`canonicalModel` and the key itself, `observedModelsFromCliResult`) and,
|
|
144
|
+
// since platform-owned-cost T6, the token counts (`modelUsageFromCliResult`).
|
|
145
|
+
// The CLI's per-model cost fields are never read: the engine reports usage
|
|
146
|
+
// facts and the platform prices them. One `--model sonnet` invocation can
|
|
147
|
+
// run two models, which is why the counts are per model.
|
|
192
148
|
readonly modelUsage?: Readonly<
|
|
193
|
-
Record<
|
|
149
|
+
Record<
|
|
150
|
+
string,
|
|
151
|
+
| {
|
|
152
|
+
readonly canonicalModel?: unknown;
|
|
153
|
+
readonly inputTokens?: unknown;
|
|
154
|
+
readonly outputTokens?: unknown;
|
|
155
|
+
readonly cacheReadInputTokens?: unknown;
|
|
156
|
+
readonly cacheCreationInputTokens?: unknown;
|
|
157
|
+
readonly cacheCreationEphemeral1hInputTokens?: unknown;
|
|
158
|
+
readonly cacheCreationEphemeral5mInputTokens?: unknown;
|
|
159
|
+
readonly thinkingTokens?: unknown;
|
|
160
|
+
}
|
|
161
|
+
| null
|
|
162
|
+
| undefined
|
|
163
|
+
>
|
|
194
164
|
>;
|
|
195
165
|
}
|
|
196
166
|
|
|
@@ -201,7 +171,7 @@ interface RawClaudeCliResult {
|
|
|
201
171
|
// key, and an EMPTY `modelUsage` all answer `undefined`. An empty array would
|
|
202
172
|
// assert "we looked and nothing ran", which is a claim about the provider we
|
|
203
173
|
// have no basis for — the same distinction `normalizeUnavailableUsage` draws
|
|
204
|
-
// between
|
|
174
|
+
// between unknown usage and a zero one.
|
|
205
175
|
//
|
|
206
176
|
// Parsed separately from `normalizeClaudeCliUsage` rather than folded into
|
|
207
177
|
// it: that function's contract is the §8 numeric shape, and its every branch
|
|
@@ -242,6 +212,66 @@ function observedModelsFromCliResult(
|
|
|
242
212
|
return observed.length === 0 ? undefined : observed;
|
|
243
213
|
}
|
|
244
214
|
|
|
215
|
+
// platform-owned-cost T6: the token counts of the same `modelUsage` block, per
|
|
216
|
+
// model, split into the platform's disjoint leaves (thinking out of output, the
|
|
217
|
+
// one-hour write out of the total write). The same absence rule as above: no
|
|
218
|
+
// parse, no block, or no usable entry answers `undefined`.
|
|
219
|
+
//
|
|
220
|
+
// The model is the provider's id, as the session transcript's `message.model`
|
|
221
|
+
// spells it, so the two can be joined: the CLI marks a context-window variant on
|
|
222
|
+
// its own model names with a bracketed suffix (`requestedModel:
|
|
223
|
+
// "claude-opus-5[1m]"` beside `message.model: "claude-opus-5"` in a real
|
|
224
|
+
// session), which names no provider model. A key carrying one is filed under the
|
|
225
|
+
// id without it, and entries that meet there are summed, so a summary key can
|
|
226
|
+
// never miss its transcript requests and count them twice as a remainder.
|
|
227
|
+
const CLI_MODEL_VARIANT = /\[[^\]]*\]$/;
|
|
228
|
+
|
|
229
|
+
function modelUsageFromCliResult(
|
|
230
|
+
rawStdout: string,
|
|
231
|
+
): readonly ModelUsageCounts[] | undefined {
|
|
232
|
+
let parsed: RawClaudeCliResult;
|
|
233
|
+
try {
|
|
234
|
+
parsed = JSON.parse(rawStdout);
|
|
235
|
+
} catch {
|
|
236
|
+
return undefined;
|
|
237
|
+
}
|
|
238
|
+
const raw = parsed?.modelUsage;
|
|
239
|
+
if (raw === undefined || raw === null || typeof raw !== "object") {
|
|
240
|
+
return undefined;
|
|
241
|
+
}
|
|
242
|
+
const models = new Map<string, number[]>();
|
|
243
|
+
for (const [key, entry] of Object.entries(raw)) {
|
|
244
|
+
const model = key.replace(CLI_MODEL_VARIANT, "");
|
|
245
|
+
if (
|
|
246
|
+
model.trim().length === 0 ||
|
|
247
|
+
entry === null ||
|
|
248
|
+
typeof entry !== "object"
|
|
249
|
+
) {
|
|
250
|
+
continue;
|
|
251
|
+
}
|
|
252
|
+
const counts = claudeUsageCounts({
|
|
253
|
+
uncached: entry.inputTokens,
|
|
254
|
+
cacheRead: entry.cacheReadInputTokens,
|
|
255
|
+
cacheWriteTotal: entry.cacheCreationInputTokens,
|
|
256
|
+
cacheWrite1h: entry.cacheCreationEphemeral1hInputTokens,
|
|
257
|
+
cacheWrite5m: entry.cacheCreationEphemeral5mInputTokens,
|
|
258
|
+
output: entry.outputTokens,
|
|
259
|
+
thinking: entry.thinkingTokens,
|
|
260
|
+
});
|
|
261
|
+
const sum = models.get(model) ?? [0, 0, 0, 0, 0, 0];
|
|
262
|
+
counts.forEach((n, i) => {
|
|
263
|
+
sum[i] = (sum[i] ?? 0) + n;
|
|
264
|
+
});
|
|
265
|
+
models.set(model, sum);
|
|
266
|
+
}
|
|
267
|
+
return models.size === 0
|
|
268
|
+
? undefined
|
|
269
|
+
: [...models].map(([model, counts]) => ({
|
|
270
|
+
model,
|
|
271
|
+
counts: counts as unknown as ModelUsageCounts["counts"],
|
|
272
|
+
}));
|
|
273
|
+
}
|
|
274
|
+
|
|
245
275
|
// #299 (2026-10-01): how many tool calls the model made, as far as the CLI's
|
|
246
276
|
// result lets us say. `num_turns` counts ASSISTANT turns, and every turn after
|
|
247
277
|
// the first begins from tool results, so `num_turns - 1` is a LOWER BOUND on
|
|
@@ -271,35 +301,6 @@ function toolInvocationsFromCliResult(rawStdout: string): number | undefined {
|
|
|
271
301
|
: undefined;
|
|
272
302
|
}
|
|
273
303
|
|
|
274
|
-
// #173 (§8, docs/multi-runtime-model-diversity-design.md:462): "Subscription
|
|
275
|
-
// OAuth may truthfully report `cashCostUsd: 0`; optional catalog cost is
|
|
276
|
-
// `notionalCostUsd` and never mixed with cash." This is the one site that
|
|
277
|
-
// applies that rule for this transport.
|
|
278
|
-
//
|
|
279
|
-
// #177, 2026-09-02: it is applied per-credential, NOT statically. #173 applied
|
|
280
|
-
// it statically on the strength of `credentialKindForRoute`
|
|
281
|
-
// (runner-authority.ts) returning `claude_subscription_oauth` for this backend
|
|
282
|
-
// unconditionally — and "unconditionally" is the whole problem: that function
|
|
283
|
-
// never reads the environment, so it says subscription for an
|
|
284
|
-
// ANTHROPIC_API_KEY route that is spending real per-token money. The branch is
|
|
285
|
-
// therefore neither unreachable nor untestable, and `claudeCliCostBasis` above
|
|
286
|
-
// is what decides it, from the env this transport spawns the child with.
|
|
287
|
-
//
|
|
288
|
-
// The figure itself is list-basis, verified live 2026-09-02 rather than
|
|
289
|
-
// inferred: the CLI's `modelUsage` block labels each model's `costUSD` with
|
|
290
|
-
// `"costBasis": "list"`, and `total_cost_usd` is their sum. On a subscription
|
|
291
|
-
// nothing is charged, so filing it as cash recorded spend that never happened.
|
|
292
|
-
// On a per-token key, list price IS the charge, so cash is exactly where it
|
|
293
|
-
// belongs — and `notionalCostUsd` stays absent rather than duplicating it,
|
|
294
|
-
// because the same figure in both fields would report one attempt's tokens as
|
|
295
|
-
// real spend AND as an untaken list price.
|
|
296
|
-
//
|
|
297
|
-
// Note the two fields answer to different things. `notionalCostUsd` follows
|
|
298
|
-
// the provider: absent when the CLI reported no total, because inventing 0
|
|
299
|
-
// there would claim the attempt consumed nothing. `cashCostUsd` follows the
|
|
300
|
-
// CREDENTIAL: it is 0 on the subscription arm because the subscription charges
|
|
301
|
-
// nothing, whatever the CLI said.
|
|
302
|
-
//
|
|
303
304
|
// §8: `--output-format json`'s usage block is already disjoint-additive —
|
|
304
305
|
// input_tokens (uncached), cache_read_input_tokens, and
|
|
305
306
|
// cache_creation_input_tokens sum to total input (verified against the real
|
|
@@ -307,50 +308,26 @@ function toolInvocationsFromCliResult(rawStdout: string): number | undefined {
|
|
|
307
308
|
// leaves are read straight across rather than split from a total via
|
|
308
309
|
// `normalizeInclusiveUsage`. Corrupted stdout, and valid JSON carrying no
|
|
309
310
|
// `usage` block at all (a safety-blocked or otherwise usage-less response),
|
|
310
|
-
// both yield `normalizeUnavailableUsage` — never a fabricated zero leaf
|
|
311
|
-
//
|
|
311
|
+
// both yield `normalizeUnavailableUsage` — never a fabricated zero leaf.
|
|
312
|
+
//
|
|
313
|
+
// The credential class (`billingMode`) is filed per attempt from the env the
|
|
314
|
+
// child ran with (`claudeCliBillingMode`); the CLI's own cost figure is not
|
|
315
|
+
// read — the platform prices a run from the tokens and models reported here.
|
|
312
316
|
function normalizeClaudeCliUsage(
|
|
313
317
|
rawStdout: string,
|
|
314
318
|
wallMs: number,
|
|
315
319
|
env: Readonly<Record<string, string | undefined>>,
|
|
316
320
|
): NormalizedUsage {
|
|
317
|
-
const
|
|
318
|
-
// The two cost fields decided TOGETHER, so no future editor can move cash
|
|
319
|
-
// without moving notional. `total_cost_usd` lands in exactly ONE of them —
|
|
320
|
-
// as CASH when a per-token credential is paying for it, as NOTIONAL when a
|
|
321
|
-
// subscription is — and never in both: the same figure in both fields would
|
|
322
|
-
// report one attempt's tokens as spend AND as an untaken list price.
|
|
323
|
-
//
|
|
324
|
-
// Absence stays absence on either arm. A CLI that reported no
|
|
325
|
-
// `total_cost_usd` gives a subscription no list figure to record, and gives
|
|
326
|
-
// a metered route no answer to "how much real money was this?" — so the
|
|
327
|
-
// metered arm leaves cash undefined and `settlementFromUsage` calls the
|
|
328
|
-
// attempt unresolved, rather than settling a fabricated $0. That is the
|
|
329
|
-
// same "$0 on parse failure" collapse §8 exists to kill, one door over.
|
|
330
|
-
//
|
|
331
|
-
// `cashCostUsd` on the subscription arm is the one unconditional value: it
|
|
332
|
-
// is 0 because the subscription charges nothing, whatever the CLI said.
|
|
333
|
-
const costFor = (
|
|
334
|
-
total: number | undefined,
|
|
335
|
-
): { cashCostUsd?: number; notionalCostUsd?: number } =>
|
|
336
|
-
basis.billingMode === "metered"
|
|
337
|
-
? { cashCostUsd: total }
|
|
338
|
-
: { cashCostUsd: 0, notionalCostUsd: total };
|
|
321
|
+
const billingMode = claudeCliBillingMode(env);
|
|
339
322
|
let parsed: RawClaudeCliResult;
|
|
340
323
|
try {
|
|
341
324
|
parsed = JSON.parse(rawStdout);
|
|
342
325
|
} catch {
|
|
343
|
-
return normalizeUnavailableUsage({
|
|
344
|
-
wallMs,
|
|
345
|
-
billingMode: basis.billingMode,
|
|
346
|
-
});
|
|
326
|
+
return normalizeUnavailableUsage({ wallMs, billingMode });
|
|
347
327
|
}
|
|
348
328
|
const raw = parsed.usage;
|
|
349
329
|
if (raw === undefined) {
|
|
350
|
-
return normalizeUnavailableUsage({
|
|
351
|
-
wallMs,
|
|
352
|
-
billingMode: basis.billingMode,
|
|
353
|
-
});
|
|
330
|
+
return normalizeUnavailableUsage({ wallMs, billingMode });
|
|
354
331
|
}
|
|
355
332
|
const leafValues = [
|
|
356
333
|
raw.input_tokens,
|
|
@@ -367,8 +344,7 @@ function normalizeClaudeCliUsage(
|
|
|
367
344
|
return normalizePartialUsage({
|
|
368
345
|
wallMs,
|
|
369
346
|
providerReportedTotal,
|
|
370
|
-
|
|
371
|
-
...costFor(parsed.total_cost_usd),
|
|
347
|
+
billingMode,
|
|
372
348
|
});
|
|
373
349
|
}
|
|
374
350
|
const inputUncached = leafValues[0] as number;
|
|
@@ -389,8 +365,7 @@ function normalizeClaudeCliUsage(
|
|
|
389
365
|
providerReportedTotal: inputKnown + outputVisible,
|
|
390
366
|
},
|
|
391
367
|
completeness: "complete",
|
|
392
|
-
|
|
393
|
-
...costFor(parsed.total_cost_usd),
|
|
368
|
+
billingMode,
|
|
394
369
|
};
|
|
395
370
|
}
|
|
396
371
|
|
|
@@ -482,7 +457,7 @@ export class ClaudeCodeCliTransport implements ProviderTransport {
|
|
|
482
457
|
modelSnapshot: "sonnet",
|
|
483
458
|
};
|
|
484
459
|
get billingMode(): NormalizedUsage["billingMode"] {
|
|
485
|
-
return
|
|
460
|
+
return claudeCliBillingMode(process.env);
|
|
486
461
|
}
|
|
487
462
|
private readonly spawnFn: typeof Bun.spawn;
|
|
488
463
|
private readonly getPgid: (pid: number) => number | undefined;
|
|
@@ -535,9 +510,8 @@ export class ClaudeCodeCliTransport implements ProviderTransport {
|
|
|
535
510
|
// contractual here, not probed: every execute() request must carry an
|
|
536
511
|
// IsolationProjection (credentialProjectionId + syntheticHome) or admission
|
|
537
512
|
// denies it. Unproven features are claimed false with a
|
|
538
|
-
//
|
|
539
|
-
//
|
|
540
|
-
// exists — hence status "degraded", not "ready".
|
|
513
|
+
// yet and no dedicated codegraph policy is enforced — hence status
|
|
514
|
+
// "degraded", not "ready".
|
|
541
515
|
async capabilities(
|
|
542
516
|
input?: ClaudeCliCapabilitiesInput,
|
|
543
517
|
): Promise<ProviderCapabilityReport> {
|
|
@@ -564,71 +538,29 @@ export class ClaudeCodeCliTransport implements ProviderTransport {
|
|
|
564
538
|
conformance: CLAUDE_CAPABILITY_STATICS.cancellationConformance,
|
|
565
539
|
},
|
|
566
540
|
billing: {
|
|
541
|
+
// The backend-wide report is a STATIC claim made at admission, before
|
|
542
|
+
// any spawn and before any route (and so any credential) resolves.
|
|
543
|
+
// The per-route credential class lives on the exact binding
|
|
544
|
+
// (`FrozenRuntimeBinding.capabilities()`, production-runtime.ts),
|
|
545
|
+
// which upgrades this mode through `credentialKindBillsMetered`.
|
|
546
|
+
// That is #161's rule: `credentialKindForRoute` (runner-authority.ts)
|
|
547
|
+
// derives `provider_api_token` — a metered kind — for a claude-code
|
|
548
|
+
// route whose environment carries ANTHROPIC_API_KEY or
|
|
549
|
+
// ANTHROPIC_AUTH_TOKEN AND that has no credential broker projecting
|
|
550
|
+
// for it, because with no broker nothing strips the key before the
|
|
551
|
+
// child sees it (the common case on Linux/CI, which has no Keychain
|
|
552
|
+
// to project from). A route with a broker whose projection SUCCEEDS
|
|
553
|
+
// stays subscription whatever its env carries. A degraded projection
|
|
554
|
+
// is #279's known exception: admission cannot see that a projection
|
|
555
|
+
// failed and fell back to the unstripped env, so that route keeps
|
|
556
|
+
// saying subscription while the key reaches the child. That
|
|
557
|
+
// ADMISSION-time answer is deliberately left that way: the fix lives
|
|
558
|
+
// downstream, in `StepExecutionHarness.run` (harness.ts), which
|
|
559
|
+
// re-applies `envBillsMetered` to this SAME child env this module
|
|
560
|
+
// stamps `billingMode: "metered"` from, and opens a spend-ledger
|
|
561
|
+
// reservation for that one attempt so it is settled or fenced exactly
|
|
562
|
+
// like a metered route.
|
|
567
563
|
mode: CLAUDE_CAPABILITY_STATICS.billingMode,
|
|
568
|
-
// #197. WHAT THIS FLAG ASSERTS, which is narrower than it reads.
|
|
569
|
-
// `pricingReady` lives inside `capabilities()`, built from
|
|
570
|
-
// CLAUDE_CAPABILITY_STATICS — a STATIC claim made at admission,
|
|
571
|
-
// before any spawn. No cost figure exists at the moment it is asked,
|
|
572
|
-
// for any transport, so it cannot be answering "is this attempt's
|
|
573
|
-
// cost a provider invoice?". It answers "will this transport tell you
|
|
574
|
-
// what the attempt cost?", and this one will: the CLI reports
|
|
575
|
-
// `total_cost_usd`, which #177 files as cash on a metered credential
|
|
576
|
-
// and as notional on a subscription.
|
|
577
|
-
//
|
|
578
|
-
// That is why the list-vs-invoice objection this comment used to
|
|
579
|
-
// carry does not survive. It rejected the CLI's figure for being a
|
|
580
|
-
// LIST computation (`costBasis: "list"`) while the alternative it
|
|
581
|
-
// preferred — the bundled `config/models/*-pricing.json` — was a
|
|
582
|
-
// hand-transcribed snapshot of the same published list prices. The
|
|
583
|
-
// choice was never invoice-over-list; it was OUR list price over the
|
|
584
|
-
// CLI's, on a ground that convicted our own. The tables are gone
|
|
585
|
-
// (#197); the CLI's figure tracks the tool the user already upgrades.
|
|
586
|
-
//
|
|
587
|
-
// THIS DELIBERATELY WIDENS ADMISSION, and that is the intent rather
|
|
588
|
-
// than a side effect to discover later. `tokenPricingAvailable`
|
|
589
|
-
// (production-runtime.ts) is now this flag and nothing else, so a
|
|
590
|
-
// metered claude-code route that the old gate refused for a missing
|
|
591
|
-
// or expired table is admitted and runs on the cost the CLI reports.
|
|
592
|
-
// #161 landed on top of this: `credentialKindForRoute`
|
|
593
|
-
// (runner-authority.ts) now derives `provider_api_token` — a metered
|
|
594
|
-
// kind — for a claude-code route whose environment carries
|
|
595
|
-
// ANTHROPIC_API_KEY or ANTHROPIC_AUTH_TOKEN AND that has no
|
|
596
|
-
// credential broker projecting for it (no broker means nothing
|
|
597
|
-
// strips the key before the child sees it — the common case being
|
|
598
|
-
// Linux/CI, which has no Keychain to project from). A route that
|
|
599
|
-
// DOES have a broker attached, and whose projection SUCCEEDS, stays
|
|
600
|
-
// subscription regardless of what its env carries, because a
|
|
601
|
-
// successful projection strips the key before spawn — so a
|
|
602
|
-
// claude-code route CAN resolve metered today, not just in the
|
|
603
|
-
// gate's hypothetical, but only when nothing is about to project a
|
|
604
|
-
// credential for it. A degraded projection is #279's known
|
|
605
|
-
// exception: `credentialKindForRoute` still cannot see that a
|
|
606
|
-
// broker's projection failed and fell back to the unstripped env, so
|
|
607
|
-
// that one route keeps saying subscription while the key actually
|
|
608
|
-
// reaches and pays for the child — this ADMISSION-time answer is
|
|
609
|
-
// deliberately left that way (#279, fixed 2026-09-24, option 2: the
|
|
610
|
-
// fix lives downstream, in `StepExecutionHarness.run`, harness.ts,
|
|
611
|
-
// which re-applies `envBillsMetered` to this SAME child env this
|
|
612
|
-
// module stamps `billingMode: "metered"` from, and opens a
|
|
613
|
-
// spend-ledger reservation for that one attempt so it is settled or
|
|
614
|
-
// fenced exactly like a metered route). `pricingReady: true` here is what
|
|
615
|
-
// makes a metered route ADMITTED rather than refused for lack of
|
|
616
|
-
// pricing; #161 is what makes the route exist in the first place.
|
|
617
|
-
// This BACKEND-WIDE report still claims `mode: "subscription"`
|
|
618
|
-
// unconditionally — it is produced before any route resolves and has
|
|
619
|
-
// no per-route credential to read — and it is the EXACT binding
|
|
620
|
-
// (`FrozenRuntimeBinding.capabilities()`, production-runtime.ts) that
|
|
621
|
-
// upgrades to the real per-route mode via
|
|
622
|
-
// `credentialKindBillsMetered(credential.kind)`.
|
|
623
|
-
//
|
|
624
|
-
// The one gap this opens is settled, not hand-waved: `total_cost_usd`
|
|
625
|
-
// is OPTIONAL on `RawClaudeCliResult`, so a metered attempt can
|
|
626
|
-
// complete with no figure. It settles `unresolved` with no
|
|
627
|
-
// `knownUsd` rather than a fabricated $0 (`costFor` above,
|
|
628
|
-
// `settlementFromUsage` in spend-limiter.ts), pinned by "a metered
|
|
629
|
-
// run reporting no cash figure at all" in
|
|
630
|
-
// test/conformance/claude-cli-transport.test.ts.
|
|
631
|
-
pricingReady: true,
|
|
632
564
|
},
|
|
633
565
|
...(input !== undefined
|
|
634
566
|
? {
|
|
@@ -960,6 +892,7 @@ export class ClaudeCodeCliTransport implements ProviderTransport {
|
|
|
960
892
|
request.isolation.env,
|
|
961
893
|
);
|
|
962
894
|
const observedModels = observedModelsFromCliResult(stdout);
|
|
895
|
+
const modelUsage = modelUsageFromCliResult(stdout);
|
|
963
896
|
const toolInvocations = toolInvocationsFromCliResult(stdout);
|
|
964
897
|
|
|
965
898
|
let stderrTail = stderr.slice(-4096);
|
|
@@ -1035,6 +968,7 @@ export class ClaudeCodeCliTransport implements ProviderTransport {
|
|
|
1035
968
|
usage,
|
|
1036
969
|
stderrTail,
|
|
1037
970
|
...(observedModels === undefined ? {} : { observedModels }),
|
|
971
|
+
...(modelUsage === undefined ? {} : { modelUsage }),
|
|
1038
972
|
...(toolInvocations === undefined ? {} : { toolInvocations }),
|
|
1039
973
|
...(exitCode !== undefined ? { exitCode } : {}),
|
|
1040
974
|
};
|
|
@@ -387,7 +387,6 @@ export interface OpenCodeTurnState {
|
|
|
387
387
|
interface StepUsage {
|
|
388
388
|
readonly inputTokens?: number;
|
|
389
389
|
readonly outputTokens?: number;
|
|
390
|
-
readonly costUsd?: number;
|
|
391
390
|
// OpenCode's `info.tokens` leaves are disjoint-additive
|
|
392
391
|
// (packages/schema/src/token-usage.ts): total = input + output + reasoning
|
|
393
392
|
// + cache.read + cache.write. Carried so cache use is measurable on this
|
|
@@ -662,7 +661,6 @@ function addField(
|
|
|
662
661
|
function addUsage(base: StepUsage, step: StepUsage): StepUsage {
|
|
663
662
|
const inputTokens = addField(base.inputTokens, step.inputTokens);
|
|
664
663
|
const outputTokens = addField(base.outputTokens, step.outputTokens);
|
|
665
|
-
const costUsd = addField(base.costUsd, step.costUsd);
|
|
666
664
|
const cacheReadTokens = addField(base.cacheReadTokens, step.cacheReadTokens);
|
|
667
665
|
const cacheWriteTokens = addField(
|
|
668
666
|
base.cacheWriteTokens,
|
|
@@ -672,7 +670,6 @@ function addUsage(base: StepUsage, step: StepUsage): StepUsage {
|
|
|
672
670
|
return {
|
|
673
671
|
...(inputTokens !== undefined ? { inputTokens } : {}),
|
|
674
672
|
...(outputTokens !== undefined ? { outputTokens } : {}),
|
|
675
|
-
...(costUsd !== undefined ? { costUsd } : {}),
|
|
676
673
|
...(cacheReadTokens !== undefined ? { cacheReadTokens } : {}),
|
|
677
674
|
...(cacheWriteTokens !== undefined ? { cacheWriteTokens } : {}),
|
|
678
675
|
...(reasoningTokens !== undefined ? { reasoningTokens } : {}),
|
|
@@ -703,11 +700,6 @@ function rememberUsage(
|
|
|
703
700
|
const wasCompleted = state.completedUsage.has(messageId);
|
|
704
701
|
if (completed) state.completedUsage.add(messageId);
|
|
705
702
|
if (existing !== undefined) {
|
|
706
|
-
const costConflict =
|
|
707
|
-
existing.costUsd !== undefined &&
|
|
708
|
-
usage.costUsd !== undefined &&
|
|
709
|
-
(usage.costUsd < existing.costUsd ||
|
|
710
|
-
(wasCompleted && usage.costUsd !== existing.costUsd));
|
|
711
703
|
const tokenConflict =
|
|
712
704
|
(existing.inputTokens !== undefined &&
|
|
713
705
|
usage.inputTokens !== undefined &&
|
|
@@ -717,7 +709,7 @@ function rememberUsage(
|
|
|
717
709
|
usage.outputTokens !== undefined &&
|
|
718
710
|
(usage.outputTokens < existing.outputTokens ||
|
|
719
711
|
(wasCompleted && usage.outputTokens !== existing.outputTokens)));
|
|
720
|
-
if (
|
|
712
|
+
if (tokenConflict) {
|
|
721
713
|
state.usageConflict = true;
|
|
722
714
|
state.usageIncomplete = true;
|
|
723
715
|
}
|
|
@@ -729,10 +721,6 @@ function rememberUsage(
|
|
|
729
721
|
existing.outputTokens !== undefined || usage.outputTokens !== undefined
|
|
730
722
|
? Math.max(existing.outputTokens ?? 0, usage.outputTokens ?? 0)
|
|
731
723
|
: undefined;
|
|
732
|
-
const mergedCost =
|
|
733
|
-
existing.costUsd !== undefined || usage.costUsd !== undefined
|
|
734
|
-
? Math.max(existing.costUsd ?? 0, usage.costUsd ?? 0)
|
|
735
|
-
: undefined;
|
|
736
724
|
// Cache and reasoning leaves merge like input/output (Math.max) but are
|
|
737
725
|
// deliberately left out of the conflict check above: a snapshot that
|
|
738
726
|
// momentarily reports fewer cache tokens must not flag the whole turn as
|
|
@@ -752,7 +740,6 @@ function rememberUsage(
|
|
|
752
740
|
state.usage.set(messageId, {
|
|
753
741
|
...(mergedInput !== undefined ? { inputTokens: mergedInput } : {}),
|
|
754
742
|
...(mergedOutput !== undefined ? { outputTokens: mergedOutput } : {}),
|
|
755
|
-
...(mergedCost !== undefined ? { costUsd: mergedCost } : {}),
|
|
756
743
|
...(mergedCacheRead !== undefined
|
|
757
744
|
? { cacheReadTokens: mergedCacheRead }
|
|
758
745
|
: {}),
|
|
@@ -1273,14 +1260,12 @@ export function reconcileMessages(
|
|
|
1273
1260
|
const tokens = asRecord(info.tokens);
|
|
1274
1261
|
const inputTokens = asNumber(tokens?.input);
|
|
1275
1262
|
const outputTokens = asNumber(tokens?.output);
|
|
1276
|
-
const costUsd = asNumber(info.cost);
|
|
1277
1263
|
const cacheReadTokens = asNumber(asRecord(tokens?.cache)?.read);
|
|
1278
1264
|
const cacheWriteTokens = asNumber(asRecord(tokens?.cache)?.write);
|
|
1279
1265
|
const reasoningTokens = asNumber(tokens?.reasoning);
|
|
1280
1266
|
if (
|
|
1281
1267
|
inputTokens !== undefined ||
|
|
1282
1268
|
outputTokens !== undefined ||
|
|
1283
|
-
costUsd !== undefined ||
|
|
1284
1269
|
cacheReadTokens !== undefined ||
|
|
1285
1270
|
cacheWriteTokens !== undefined ||
|
|
1286
1271
|
reasoningTokens !== undefined
|
|
@@ -1291,7 +1276,6 @@ export function reconcileMessages(
|
|
|
1291
1276
|
{
|
|
1292
1277
|
...(inputTokens !== undefined ? { inputTokens } : {}),
|
|
1293
1278
|
...(outputTokens !== undefined ? { outputTokens } : {}),
|
|
1294
|
-
...(costUsd !== undefined ? { costUsd } : {}),
|
|
1295
1279
|
...(cacheReadTokens !== undefined ? { cacheReadTokens } : {}),
|
|
1296
1280
|
...(cacheWriteTokens !== undefined ? { cacheWriteTokens } : {}),
|
|
1297
1281
|
...(reasoningTokens !== undefined ? { reasoningTokens } : {}),
|
|
@@ -1415,7 +1399,6 @@ export function reconcileMessages(
|
|
|
1415
1399
|
if (
|
|
1416
1400
|
msg.time?.completed === undefined ||
|
|
1417
1401
|
stepUsage === undefined ||
|
|
1418
|
-
stepUsage.costUsd === undefined ||
|
|
1419
1402
|
stepUsage.inputTokens === undefined ||
|
|
1420
1403
|
stepUsage.outputTokens === undefined
|
|
1421
1404
|
) {
|
|
@@ -1659,14 +1642,12 @@ export function mapOpenCodeEvents(
|
|
|
1659
1642
|
const tokens = asRecord(info.tokens);
|
|
1660
1643
|
const inputTokens = asNumber(tokens?.input);
|
|
1661
1644
|
const outputTokens = asNumber(tokens?.output);
|
|
1662
|
-
const costUsd = asNumber(info.cost);
|
|
1663
1645
|
const cacheReadTokens = asNumber(asRecord(tokens?.cache)?.read);
|
|
1664
1646
|
const cacheWriteTokens = asNumber(asRecord(tokens?.cache)?.write);
|
|
1665
1647
|
const reasoningTokens = asNumber(tokens?.reasoning);
|
|
1666
1648
|
if (
|
|
1667
1649
|
inputTokens !== undefined ||
|
|
1668
1650
|
outputTokens !== undefined ||
|
|
1669
|
-
costUsd !== undefined ||
|
|
1670
1651
|
cacheReadTokens !== undefined ||
|
|
1671
1652
|
cacheWriteTokens !== undefined ||
|
|
1672
1653
|
reasoningTokens !== undefined
|
|
@@ -1677,7 +1658,6 @@ export function mapOpenCodeEvents(
|
|
|
1677
1658
|
{
|
|
1678
1659
|
...(inputTokens !== undefined ? { inputTokens } : {}),
|
|
1679
1660
|
...(outputTokens !== undefined ? { outputTokens } : {}),
|
|
1680
|
-
...(costUsd !== undefined ? { costUsd } : {}),
|
|
1681
1661
|
...(cacheReadTokens !== undefined ? { cacheReadTokens } : {}),
|
|
1682
1662
|
...(cacheWriteTokens !== undefined ? { cacheWriteTokens } : {}),
|
|
1683
1663
|
...(reasoningTokens !== undefined ? { reasoningTokens } : {}),
|
|
@@ -2139,7 +2119,7 @@ const MCP_TOOL_ID_SET: ReadonlySet<string> = new Set(ALL_MCP_TOOL_IDS);
|
|
|
2139
2119
|
// `tool.ids()`. "bash" has no entry in that table at all (no AgentSpec has
|
|
2140
2120
|
// ever granted it), so it is unconditionally denied whenever this is called
|
|
2141
2121
|
// with a non-empty gate; "read" is denied exactly when this call's canonical
|
|
2142
|
-
// tools omit "Read" (a tool-less step: summarizer
|
|
2122
|
+
// tools omit "Read" (a tool-less step: the summarizer).
|
|
2143
2123
|
function deniedFreeTierGatewayTools(
|
|
2144
2124
|
canonicalTools: readonly string[],
|
|
2145
2125
|
freeTierGatewayTools: readonly string[],
|
|
@@ -2382,11 +2362,11 @@ export function createOpenCodeClient(
|
|
|
2382
2362
|
// FREE_TIER_GATEWAY_TOOLS). The registry caches ONE opencode client per
|
|
2383
2363
|
// route (transport-registry.ts), so every step routed to the same
|
|
2384
2364
|
// provider_free model shares this server — a hunter-shaped step (grants
|
|
2385
|
-
// read) and a tool-less step (summarizer
|
|
2365
|
+
// read) and a tool-less step (the summarizer) on that SAME route would
|
|
2386
2366
|
// otherwise silently ride whichever one's ask set the server happened to be
|
|
2387
2367
|
// launched with. This is fixed at spawn exactly like the MCP registry
|
|
2388
2368
|
// above, and the pipeline's own phase boundaries (hunters all finish before
|
|
2389
|
-
// dedupe releases the idle server, refuter
|
|
2369
|
+
// dedupe releases the idle server, the refuter runs in a later phase)
|
|
2390
2370
|
// mean a real run only ever asks this server to relaunch, never to change
|
|
2391
2371
|
// shape mid-flight — a genuine concurrent mismatch fails loud instead of
|
|
2392
2372
|
// silently weakening.
|