crysk 0.6.1 → 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 +28 -22
- package/dist/SKILL-1q3658n0.md +74 -0
- package/dist/SKILL-25j4q9b8.md +143 -0
- package/dist/SKILL-32cmme3j.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/adjudicator-eckqh14e.md +78 -0
- package/dist/ci-admission-qn797a6c.md +128 -0
- package/dist/cli.js +18608 -18523
- package/dist/consolidate-4xw1pkg7.md +24 -0
- package/dist/deep-review-logic-dgr112y1.md +196 -0
- package/dist/deep-review-logic-fck5z4xe.md +197 -0
- package/dist/deep-review-logic-h1fpamfh.md +192 -0
- package/dist/deep-review-logic-m4vk5683.md +196 -0
- package/dist/deep-review-logic-z63kmgmc.md +157 -0
- package/dist/deep-review-parity-7x7s5d81.md +148 -0
- package/dist/deep-review-parity-9wxmynsc.md +115 -0
- package/dist/deep-review-parity-bwwe7cx6.md +152 -0
- package/dist/deep-review-parity-e50pw3pk.md +117 -0
- package/dist/deep-review-parity-ennmm9m1.md +151 -0
- package/{prompts/default/deep-review-parity.md → dist/deep-review-parity-h7y6y2he.md} +14 -16
- package/dist/deep-review-parity-xg6wy69c.md +151 -0
- package/dist/deep-review-reliability-6h3c4gmw.md +125 -0
- package/dist/deep-review-reliability-dcjab69x.md +122 -0
- package/dist/deep-review-reliability-ec7b5pbk.md +159 -0
- package/dist/deep-review-reliability-hvasvmt9.md +153 -0
- package/dist/deep-review-reliability-mjnayxmt.md +158 -0
- package/dist/deep-review-reliability-mm7fnayf.md +124 -0
- package/dist/deep-review-reliability-xk4xvc2w.md +158 -0
- package/dist/deep-review-resilience-0esd5qeh.md +148 -0
- package/dist/deep-review-resilience-envgcmpy.md +115 -0
- package/dist/deep-review-resilience-fgx8ythf.md +151 -0
- package/dist/deep-review-resilience-mq5qa6ad.md +152 -0
- package/dist/deep-review-resilience-pwh1gawp.md +151 -0
- package/dist/deep-review-resilience-s9n21dkx.md +117 -0
- package/dist/deep-review-resilience-vz4qskea.md +119 -0
- package/dist/deep-review-security-1vwjdc9q.md +205 -0
- package/dist/deep-review-security-x1cc1z00.md +205 -0
- package/dist/index.js +590 -485
- package/dist/opencode-ci-jc8mf4wn.md +106 -0
- 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/review-refuter-7qffwtzz.md +77 -0
- package/dist/verifier-tyh8r45v.md +40 -0
- package/dist/verifier-xf4xj701.md +40 -0
- package/dist/workflow-andv2dvm.yml +158 -0
- package/package.json +1 -1
- package/prompts/consolidate.md +1 -1
- package/prompts/default/PROVENANCE.md +6 -0
- package/prompts/default/deep-review-logic.md +56 -15
- package/prompts/default/deep-review-reliability.md +64 -30
- package/prompts/default/deep-review-resilience.md +71 -37
- package/prompts/default/deep-review-security.md +205 -0
- package/prompts/default/review-refuter.md +1 -1
- package/prompts/verifier.md +40 -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-loop/adjudicator.md +10 -18
- package/skills/crysk-pr/SKILL.md +1 -1
- package/src/asset-manifest.ts +6 -6
- package/src/assets.ts +4 -4
- package/src/brand.ts +20 -30
- package/src/ci/gates.ts +155 -192
- 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/compare/hunter-exam.ts +631 -0
- 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 +16 -5
- package/src/model/profiles/claude.ts +1 -2
- package/src/model/profiles/openai.ts +1 -2
- package/src/model/profiles.ts +2 -3
- 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/pr.ts +1 -1
- package/src/pr/preflight.ts +44 -15
- package/src/pr/publish-outcome.ts +1 -19
- package/src/pr/review-pr.ts +15 -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/rereview/verify.ts +15 -9
- package/src/review/boundary.ts +5 -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 +194 -407
- package/src/review/preflight.ts +175 -201
- package/src/review/prompt-set.ts +1 -2
- package/src/review/report.ts +2 -162
- package/src/review/review.ts +25 -74
- package/src/review/route-preflight.ts +19 -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/scout.md +0 -140
- package/src/ci/platform-estimate.ts +0 -111
- package/src/review/scout.ts +0 -323
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { NormalizedUsage } from "../execution/usage-normalized";
|
|
2
|
-
import { sumNormalizedUsage } from "../execution/usage-normalized";
|
|
3
2
|
import type { FindingObservation } from "./clustering";
|
|
4
3
|
|
|
5
4
|
export type DiversityAttemptStatus =
|
|
@@ -33,14 +32,6 @@ export interface DiversityLedger {
|
|
|
33
32
|
readonly failures: readonly DiversityAttemptRecord[];
|
|
34
33
|
}
|
|
35
34
|
|
|
36
|
-
export interface DiversityAccountingTotals {
|
|
37
|
-
readonly cashCostUsd: number;
|
|
38
|
-
readonly notionalCostUsd: number;
|
|
39
|
-
readonly attemptCount: number;
|
|
40
|
-
readonly observationCount: number;
|
|
41
|
-
readonly failureCount: number;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
35
|
export function appendAttempt(
|
|
45
36
|
ledger: DiversityLedger,
|
|
46
37
|
attempt: DiversityAttemptRecord,
|
|
@@ -67,23 +58,6 @@ export function emptyDiversityLedger(): DiversityLedger {
|
|
|
67
58
|
return { attempts: [], observations: [], failures: [] };
|
|
68
59
|
}
|
|
69
60
|
|
|
70
|
-
export function summarizeDiversityAccounting(
|
|
71
|
-
ledger: DiversityLedger,
|
|
72
|
-
): DiversityAccountingTotals {
|
|
73
|
-
const usage = ledger.attempts.map((attempt) => attempt.usage);
|
|
74
|
-
const summed =
|
|
75
|
-
usage.length === 0
|
|
76
|
-
? undefined
|
|
77
|
-
: usage.reduce((acc, current) => sumNormalizedUsage(acc, current));
|
|
78
|
-
return {
|
|
79
|
-
cashCostUsd: summed?.cashCostUsd ?? 0,
|
|
80
|
-
notionalCostUsd: summed?.notionalCostUsd ?? 0,
|
|
81
|
-
attemptCount: ledger.attempts.length,
|
|
82
|
-
observationCount: ledger.observations.length,
|
|
83
|
-
failureCount: ledger.failures.length,
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
|
|
87
61
|
export function retainPartialFailureEvidence(ledger: DiversityLedger): boolean {
|
|
88
62
|
if (ledger.failures.length === 0) return true;
|
|
89
63
|
return ledger.observations.length > 0 || ledger.failures.length > 0;
|
|
@@ -14,7 +14,6 @@ export interface DiversityBenchmarkPlan {
|
|
|
14
14
|
readonly buildFingerprint: string;
|
|
15
15
|
readonly promptFingerprint: string;
|
|
16
16
|
readonly interleaved: true;
|
|
17
|
-
readonly maxCashUsd: number;
|
|
18
17
|
readonly stopOnInvalidRun: true;
|
|
19
18
|
}
|
|
20
19
|
|
|
@@ -71,10 +70,6 @@ export function validateBenchmarkPlan(
|
|
|
71
70
|
"promptFingerprint required",
|
|
72
71
|
);
|
|
73
72
|
must(plan.stopOnInvalidRun === true, "stopOnInvalidRun must be true");
|
|
74
|
-
must(
|
|
75
|
-
typeof plan.maxCashUsd === "number" && plan.maxCashUsd > 0,
|
|
76
|
-
"maxCashUsd required",
|
|
77
|
-
);
|
|
78
73
|
return plan as unknown as DiversityBenchmarkPlan;
|
|
79
74
|
}
|
|
80
75
|
|
|
@@ -88,13 +83,10 @@ export interface BenchmarkRunEvidence {
|
|
|
88
83
|
readonly treatmentCompleted: boolean;
|
|
89
84
|
readonly blindingIntact: boolean;
|
|
90
85
|
readonly interleavingIntact: boolean;
|
|
91
|
-
readonly cashCostUsd: number;
|
|
92
|
-
readonly notionalCostUsd: number;
|
|
93
86
|
readonly uniqueTruePositives: number;
|
|
94
87
|
readonly recall: number;
|
|
95
88
|
readonly cleanPrRestraint: number;
|
|
96
89
|
readonly blindSpots: number;
|
|
97
|
-
readonly capExceeded?: boolean;
|
|
98
90
|
readonly replicateOmitted?: boolean;
|
|
99
91
|
}
|
|
100
92
|
|
|
@@ -106,13 +98,11 @@ export function deriveRunValidity(
|
|
|
106
98
|
run: BenchmarkRunEvidence,
|
|
107
99
|
plan: DiversityBenchmarkPlan,
|
|
108
100
|
): boolean {
|
|
109
|
-
if (run.capExceeded === true) return false;
|
|
110
101
|
if (run.replicateOmitted === true) return false;
|
|
111
102
|
if (!run.blindingIntact || !run.interleavingIntact) return false;
|
|
112
103
|
if (!run.controlCompleted || !run.treatmentCompleted) return false;
|
|
113
104
|
if (run.observedBuildFingerprint !== plan.buildFingerprint) return false;
|
|
114
105
|
if (run.observedPromptFingerprint !== plan.promptFingerprint) return false;
|
|
115
|
-
if (run.cashCostUsd > plan.maxCashUsd) return false;
|
|
116
106
|
if (run.replicate < 1 || run.replicate > plan.treatmentArm.replicates) {
|
|
117
107
|
return false;
|
|
118
108
|
}
|
|
@@ -120,8 +110,6 @@ export function deriveRunValidity(
|
|
|
120
110
|
}
|
|
121
111
|
|
|
122
112
|
export interface BenchmarkScoreReport {
|
|
123
|
-
readonly cashCostPerUniqueTp: number | null;
|
|
124
|
-
readonly notionalCostPerUniqueTp: number | null;
|
|
125
113
|
readonly recall: number;
|
|
126
114
|
readonly cleanPrRestraint: number;
|
|
127
115
|
readonly blindSpots: number;
|
|
@@ -141,12 +129,10 @@ export function scoreBenchmarkRuns(
|
|
|
141
129
|
}));
|
|
142
130
|
const validRuns = scored.filter((run) => run.valid);
|
|
143
131
|
const invalidRuns = scored.length - validRuns.length;
|
|
144
|
-
const
|
|
132
|
+
const _uniqueTp = validRuns.reduce(
|
|
145
133
|
(sum, run) => sum + run.uniqueTruePositives,
|
|
146
134
|
0,
|
|
147
135
|
);
|
|
148
|
-
const cash = validRuns.reduce((sum, run) => sum + run.cashCostUsd, 0);
|
|
149
|
-
const notional = validRuns.reduce((sum, run) => sum + run.notionalCostUsd, 0);
|
|
150
136
|
const recall =
|
|
151
137
|
validRuns.length === 0
|
|
152
138
|
? 0
|
|
@@ -158,8 +144,6 @@ export function scoreBenchmarkRuns(
|
|
|
158
144
|
validRuns.length;
|
|
159
145
|
const blindSpots = validRuns.reduce((sum, run) => sum + run.blindSpots, 0);
|
|
160
146
|
return {
|
|
161
|
-
cashCostPerUniqueTp: uniqueTp > 0 ? cash / uniqueTp : null,
|
|
162
|
-
notionalCostPerUniqueTp: uniqueTp > 0 ? notional / uniqueTp : null,
|
|
163
147
|
recall,
|
|
164
148
|
cleanPrRestraint,
|
|
165
149
|
blindSpots,
|
|
@@ -45,7 +45,6 @@ export interface DiversityPlan {
|
|
|
45
45
|
readonly promptFingerprint?: string;
|
|
46
46
|
readonly legs: readonly DiversityLeg[];
|
|
47
47
|
readonly maxLegs: number;
|
|
48
|
-
readonly cashCapUsd: number;
|
|
49
48
|
readonly planFingerprint: string;
|
|
50
49
|
}
|
|
51
50
|
|
|
@@ -94,7 +93,6 @@ function canonicalPlanPayload(
|
|
|
94
93
|
plan.buildFingerprint ?? "",
|
|
95
94
|
plan.promptFingerprint ?? "",
|
|
96
95
|
String(plan.maxLegs),
|
|
97
|
-
String(plan.cashCapUsd),
|
|
98
96
|
legs,
|
|
99
97
|
].join(";");
|
|
100
98
|
}
|
|
@@ -203,7 +201,6 @@ export function buildDiversityPlan(
|
|
|
203
201
|
promptFingerprint: input.promptFingerprint,
|
|
204
202
|
legs,
|
|
205
203
|
maxLegs: diversity.maxLegs,
|
|
206
|
-
cashCapUsd: diversity.cashCapUsd,
|
|
207
204
|
});
|
|
208
205
|
}
|
|
209
206
|
|
|
@@ -281,14 +278,3 @@ export function assertRouteFingerprintStable(
|
|
|
281
278
|
);
|
|
282
279
|
}
|
|
283
280
|
}
|
|
284
|
-
|
|
285
|
-
export function assertSpendUnderCap(
|
|
286
|
-
plan: DiversityPlan,
|
|
287
|
-
projectedCashUsd: number,
|
|
288
|
-
): void {
|
|
289
|
-
if (projectedCashUsd > plan.cashCapUsd) {
|
|
290
|
-
throw new DiversityAdmissionError(
|
|
291
|
-
`projected cash ${projectedCashUsd} exceeds cap ${plan.cashCapUsd}`,
|
|
292
|
-
);
|
|
293
|
-
}
|
|
294
|
-
}
|
|
@@ -15,7 +15,6 @@ import {
|
|
|
15
15
|
type DiversityAttemptRecord,
|
|
16
16
|
type DiversityLedger,
|
|
17
17
|
emptyDiversityLedger,
|
|
18
|
-
summarizeDiversityAccounting,
|
|
19
18
|
} from "./accounting";
|
|
20
19
|
import { synthesizeDeterministicAdjudication } from "./adjudication";
|
|
21
20
|
import {
|
|
@@ -27,7 +26,6 @@ import { buildAdjudicationGroups, type FindingObservation } from "./clustering";
|
|
|
27
26
|
import { DiversityAdmissionError } from "./errors";
|
|
28
27
|
import {
|
|
29
28
|
assertRouteFingerprintStable,
|
|
30
|
-
assertSpendUnderCap,
|
|
31
29
|
type BenchmarkTarget,
|
|
32
30
|
buildDiversityPlan,
|
|
33
31
|
type DiversityLeg,
|
|
@@ -46,8 +44,6 @@ export interface DiversityPipelineRecord {
|
|
|
46
44
|
readonly attemptCount?: number;
|
|
47
45
|
readonly observationCount?: number;
|
|
48
46
|
readonly failureCount?: number;
|
|
49
|
-
readonly cashCostUsd?: number;
|
|
50
|
-
readonly notionalCostUsd?: number;
|
|
51
47
|
}
|
|
52
48
|
|
|
53
49
|
export interface DiversityExecutionContext {
|
|
@@ -159,9 +155,6 @@ function usageFromStep(result: StepResult): NormalizedUsage {
|
|
|
159
155
|
inputTotal: result.usage.tokens_in,
|
|
160
156
|
outputTotal: result.usage.tokens_out,
|
|
161
157
|
billingMode: "unknown",
|
|
162
|
-
costSource: "unknown",
|
|
163
|
-
cashCostUsd: result.usage.cost_usd_est,
|
|
164
|
-
notionalCostUsd: result.usage.cost_usd_est,
|
|
165
158
|
});
|
|
166
159
|
}
|
|
167
160
|
|
|
@@ -173,8 +166,6 @@ function scaleUsageFraction(
|
|
|
173
166
|
value === undefined ? undefined : value * fraction;
|
|
174
167
|
return {
|
|
175
168
|
...usage,
|
|
176
|
-
cashCostUsd: scale(usage.cashCostUsd),
|
|
177
|
-
notionalCostUsd: scale(usage.notionalCostUsd),
|
|
178
169
|
tokens: {
|
|
179
170
|
...usage.tokens,
|
|
180
171
|
inputKnown: scale(usage.tokens.inputKnown),
|
|
@@ -206,14 +197,6 @@ export function assertDiversityLegRoutes(
|
|
|
206
197
|
}
|
|
207
198
|
}
|
|
208
199
|
|
|
209
|
-
export function assertDiversitySpendUnderCap(
|
|
210
|
-
plan: DiversityPlan,
|
|
211
|
-
ledger: DiversityLedger,
|
|
212
|
-
): void {
|
|
213
|
-
const totals = summarizeDiversityAccounting(ledger);
|
|
214
|
-
assertSpendUnderCap(plan, totals.cashCostUsd);
|
|
215
|
-
}
|
|
216
|
-
|
|
217
200
|
export function recordDiversityHunterFailure(
|
|
218
201
|
ledger: DiversityLedger,
|
|
219
202
|
plan: DiversityPlan,
|
|
@@ -239,7 +222,6 @@ export function recordDiversityHunterFailure(
|
|
|
239
222
|
inputTotal: 0,
|
|
240
223
|
outputTotal: 0,
|
|
241
224
|
billingMode: "unknown",
|
|
242
|
-
costSource: "unknown",
|
|
243
225
|
}),
|
|
244
226
|
};
|
|
245
227
|
return appendAttempt(ledger, attempt);
|
|
@@ -396,13 +378,6 @@ export function buildDiversityPipelineRecord(
|
|
|
396
378
|
if (!ctx.plan) {
|
|
397
379
|
return { enabled: true, status: "failed" };
|
|
398
380
|
}
|
|
399
|
-
const totals = ctx.ledger.attempts.reduce(
|
|
400
|
-
(acc, attempt) => ({
|
|
401
|
-
cash: acc.cash + (attempt.usage.cashCostUsd ?? 0),
|
|
402
|
-
notional: acc.notional + (attempt.usage.notionalCostUsd ?? 0),
|
|
403
|
-
}),
|
|
404
|
-
{ cash: 0, notional: 0 },
|
|
405
|
-
);
|
|
406
381
|
return {
|
|
407
382
|
enabled: true,
|
|
408
383
|
status: partial ? "partial" : "ok",
|
|
@@ -412,8 +387,6 @@ export function buildDiversityPipelineRecord(
|
|
|
412
387
|
attemptCount: ctx.ledger.attempts.length,
|
|
413
388
|
observationCount: ctx.ledger.observations.length,
|
|
414
389
|
failureCount: ctx.ledger.failures.length,
|
|
415
|
-
cashCostUsd: totals.cash,
|
|
416
|
-
notionalCostUsd: totals.notional,
|
|
417
390
|
};
|
|
418
391
|
}
|
|
419
392
|
|
|
@@ -431,8 +404,6 @@ export function diversityDebugFromLedger(
|
|
|
431
404
|
replicate: attempt.replicate,
|
|
432
405
|
attempt: attempt.attempt,
|
|
433
406
|
status: attempt.status,
|
|
434
|
-
cashCostUsd: attempt.usage.cashCostUsd ?? null,
|
|
435
|
-
notionalCostUsd: attempt.usage.notionalCostUsd ?? null,
|
|
436
407
|
})),
|
|
437
408
|
observations: ctx.ledger.observations.map((record) => ({
|
|
438
409
|
observationId: record.observation.observationId,
|
package/src/doctor.ts
CHANGED
|
@@ -96,8 +96,8 @@ export interface RunDoctorOptions {
|
|
|
96
96
|
// §11/D1-09: doctor consumes the SAME ProviderCapabilityReport execution
|
|
97
97
|
// gates on. Injectable so offline tests stay deterministic; the CLI's
|
|
98
98
|
// doctor command passes the real producer. Opt-in rather than default-on
|
|
99
|
-
// because the report always carries non-blocking
|
|
100
|
-
//
|
|
99
|
+
// because the report always carries a non-blocking gap (no bounded event
|
|
100
|
+
// sink), which would flip every existing "healthy"
|
|
101
101
|
// fixture to "degraded" for reasons unrelated to what those tests probe.
|
|
102
102
|
// Legacy injectable ProviderCapabilityReport. Ignored when
|
|
103
103
|
// probeExactBindings is provided.
|
|
@@ -110,7 +110,7 @@ export interface RunDoctorOptions {
|
|
|
110
110
|
|
|
111
111
|
// Whether a review under this configuration sends any step to the Claude CLI
|
|
112
112
|
// (model-profiles S6): the route plan a review would build, every hunter of
|
|
113
|
-
// the bundled spec, the refuter, consolidate,
|
|
113
|
+
// the bundled spec, the refuter, consolidate, summarizer and, with the
|
|
114
114
|
// gate on, the materiality judge, resolved through `models` and the active
|
|
115
115
|
// profile. True whenever the answer is not proven: neither `models` nor a
|
|
116
116
|
// `profile`, a plan that fails to build, or a bad CRYSK_EXTRA_HUNTERS. So zero-config and
|
|
@@ -137,7 +137,6 @@ export function reviewNeedsClaude(input: {
|
|
|
137
137
|
profile: resolveProfile(input.profile),
|
|
138
138
|
bundledAgents: true,
|
|
139
139
|
summarizer: { bundled: true },
|
|
140
|
-
scout: { bundled: true },
|
|
141
140
|
consolidate: { bundled: true },
|
|
142
141
|
// Unknown counts as on: the judge then joins only when it shares a
|
|
143
142
|
// backend with another step or `models.judge` names it.
|
|
@@ -218,8 +217,6 @@ export const PROVIDER_HINTS: Record<string, string> = {
|
|
|
218
217
|
"Await the dedicated codegraph sensitive-file policy (D1-05 residual); isolation currently relies on --strict-mcp-config with a codegraph-only mcp.json.",
|
|
219
218
|
bounded_events_sink_missing:
|
|
220
219
|
"Usage arrives as a final snapshot until the bounded event sink is wired (D1-08 residual).",
|
|
221
|
-
pricing_table_missing:
|
|
222
|
-
"Nothing is priced at this level: the report is produced before any route resolves. An attempt's cash cost is whatever its transport reports, and a metered route whose transport reports none is refused at admission.",
|
|
223
220
|
};
|
|
224
221
|
|
|
225
222
|
// fix/opencode-sdk-absent-degraded: OpenCodeSdkUnavailableError means
|
|
@@ -112,8 +112,13 @@ export async function copyRetainedClaudeSession(
|
|
|
112
112
|
// held, and the copy stops at MAX_COPY_BYTES with the truncated marker.
|
|
113
113
|
const MAX_LINE_BYTES = 4 * 1024 * 1024;
|
|
114
114
|
const MAX_COPY_BYTES = 64 * 1024 * 1024;
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
// The `crysk` value of the two marker lines. Exported for the usage-facts reader
|
|
116
|
+
// (usage-facts.ts), which turns them into gaps: one spelling, so a change here
|
|
117
|
+
// cannot silently stop those gaps from firing.
|
|
118
|
+
export const SESSION_LINE_OMITTED = "session line omitted";
|
|
119
|
+
export const SESSION_TRUNCATED = "session truncated";
|
|
120
|
+
const OMITTED_LINE = JSON.stringify({ crysk: SESSION_LINE_OMITTED });
|
|
121
|
+
const TRUNCATED_LINE = `${JSON.stringify({ crysk: SESSION_TRUNCATED })}\n`;
|
|
117
122
|
const NEWLINE = 0x0a;
|
|
118
123
|
|
|
119
124
|
async function copySessionJsonl(source: string, dest: string): Promise<void> {
|
|
@@ -10,6 +10,7 @@ import type {
|
|
|
10
10
|
import type { StepSpec } from "#review/step-runner";
|
|
11
11
|
import type { CredentialBroker } from "../security/credential-broker";
|
|
12
12
|
import type { WorkspaceDenialCode } from "../security/workspace-read-broker";
|
|
13
|
+
import type { ModelUsageCounts } from "./usage-facts";
|
|
13
14
|
import type {
|
|
14
15
|
NormalizedTokens,
|
|
15
16
|
NormalizedUsage,
|
|
@@ -107,13 +108,10 @@ export type ProviderEvent =
|
|
|
107
108
|
readonly mode: "snapshot" | "delta";
|
|
108
109
|
readonly final: boolean;
|
|
109
110
|
// D1-08 PR2 (§8): a streamed usage UPDATE, not a full snapshot — only
|
|
110
|
-
// the leaves this event actually reports are present.
|
|
111
|
-
// carries a per-event cost delta/snapshot alongside the token leaves;
|
|
111
|
+
// the leaves this event actually reports are present.
|
|
112
112
|
// `applyUsageUpdate` (usage-normalized.ts) folds a sequence of these
|
|
113
|
-
// through the same snapshot/delta state machine
|
|
114
|
-
readonly usage: Partial<NormalizedTokens
|
|
115
|
-
readonly cashCostUsd?: number;
|
|
116
|
-
};
|
|
113
|
+
// through the same snapshot/delta state machine.
|
|
114
|
+
readonly usage: Partial<NormalizedTokens>;
|
|
117
115
|
})
|
|
118
116
|
| (ProviderEventBase & {
|
|
119
117
|
readonly type: "diagnostic";
|
|
@@ -233,6 +231,11 @@ export interface TransportOutcome {
|
|
|
233
231
|
// `pipeline.json`, or the terminal report. Wiring it to provenance is a
|
|
234
232
|
// separate slice; parsing it and making it readable is this one.
|
|
235
233
|
readonly observedModels?: readonly ObservedModel[];
|
|
234
|
+
// platform-owned-cost T6: the provider's own token totals per model it ran (the Claude CLI's
|
|
235
|
+
// `modelUsage`), already split into the platform's disjoint leaves. The harness subtracts the
|
|
236
|
+
// session transcript's requests from them, so what the transcript lost or never held (a side
|
|
237
|
+
// model) is still reported. Absent, never `[]`, when the provider printed none, as above.
|
|
238
|
+
readonly modelUsage?: readonly ModelUsageCounts[];
|
|
236
239
|
readonly timedOut?: boolean;
|
|
237
240
|
readonly exitCode?: number;
|
|
238
241
|
}
|
|
@@ -430,9 +433,12 @@ export interface ExactBindingCapabilityReport {
|
|
|
430
433
|
readonly usage: UsageFacts;
|
|
431
434
|
readonly billing: {
|
|
432
435
|
readonly mode: BillingMode;
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
+
// False when the credential class could not be determined. The exact
|
|
437
|
+
// contract's `mode` is binary, so an unknown class narrows into
|
|
438
|
+
// "subscription" there; this flag is what keeps that narrowing honest
|
|
439
|
+
// (an unknown class is a blocking preflight result,
|
|
440
|
+
// `exactBindingCapabilityIssues`).
|
|
441
|
+
readonly modeKnown: boolean;
|
|
436
442
|
};
|
|
437
443
|
}
|
|
438
444
|
|