crysk 0.0.0 → 0.3.1
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/LICENSE +176 -0
- package/README.md +611 -3
- package/bin/pr-hero.js +166 -0
- package/config/models/anthropic.json +5 -0
- package/dist/SKILL-7e3725zn.md +496 -0
- package/dist/SKILL-7q35wcaz.md +66 -0
- package/dist/SKILL-9at22381.md +74 -0
- package/dist/SKILL-ex2hxxh3.md +134 -0
- package/dist/SKILL-y8rv8msh.md +134 -0
- package/dist/SKILL-ygka1bs0.md +515 -0
- package/dist/adjudicator-dtg2axnh.md +86 -0
- package/dist/admission-config.example-a9vqmmad.json +9 -0
- package/dist/ci-admission-camfbx2b.md +122 -0
- package/dist/ci-admission-qk9r9taq.md +124 -0
- package/dist/cli.js +42501 -0
- package/dist/consolidate-ac0mnfyj.md +24 -0
- package/dist/deep-review-lifecycle-m698ybjp.md +362 -0
- package/dist/deep-review-logic-a6b1gczf.md +156 -0
- package/dist/deep-review-parity-0ec904db.md +120 -0
- package/dist/deep-review-reliability-qyakbjb9.md +125 -0
- package/dist/deep-review-resilience-3tz8y26e.md +118 -0
- package/dist/index.js +20190 -0
- package/dist/opencode-ci-7b0be64p.md +141 -0
- package/dist/review-refuter-j4e9gezy.md +71 -0
- package/dist/scout-yvp153q7.md +140 -0
- package/dist/summarizer-zca44nxa.md +18 -0
- package/dist/workflow-w1g9szna.yml +151 -0
- package/package.json +81 -4
- package/prompts/consolidate.md +24 -0
- package/prompts/default/PROVENANCE.md +18 -0
- package/prompts/default/deep-review-lifecycle.md +362 -0
- package/prompts/default/deep-review-logic.md +156 -0
- package/prompts/default/deep-review-parity.md +120 -0
- package/prompts/default/deep-review-reliability.md +125 -0
- package/prompts/default/deep-review-resilience.md +118 -0
- package/prompts/default/review-refuter.md +71 -0
- package/prompts/scout.md +140 -0
- package/prompts/summarizer.md +18 -0
- package/skills/crysk/SKILL.md +74 -0
- package/skills/crysk-ci-setup/SKILL.md +134 -0
- package/skills/crysk-ci-setup/assets/admission-config.example.json +9 -0
- package/skills/crysk-ci-setup/assets/workflow.yml +151 -0
- package/skills/crysk-ci-setup/references/ci-admission.md +124 -0
- package/skills/crysk-ci-setup/references/opencode-ci.md +141 -0
- package/skills/crysk-loop/SKILL.md +515 -0
- package/skills/crysk-loop/adjudicator.md +86 -0
- package/skills/crysk-pr/SKILL.md +66 -0
- package/src/agent-env.ts +1084 -0
- package/src/asset-manifest.ts +83 -0
- package/src/assets.d.ts +6 -0
- package/src/assets.ts +183 -0
- package/src/brand-paths.ts +155 -0
- package/src/brand.ts +255 -0
- package/src/ci/admission-ledger.ts +350 -0
- package/src/ci/classify-error.ts +73 -0
- package/src/ci/cli-record.ts +271 -0
- package/src/ci/force-comment.ts +39 -0
- package/src/ci/gates.ts +945 -0
- package/src/ci/outcome.ts +2181 -0
- package/src/ci/override.ts +187 -0
- package/src/ci/publish.ts +1639 -0
- package/src/ci/reporter.ts +626 -0
- package/src/ci/review-admission.ts +910 -0
- package/src/ci/review-levels.ts +310 -0
- package/src/ci/review-policy.ts +18 -0
- package/src/ci/review-risk.ts +184 -0
- package/src/ci/setup.ts +844 -0
- package/src/ci/trigger.ts +1353 -0
- package/src/cli.ts +348 -0
- package/src/commands/activity.ts +67 -0
- package/src/commands/ci-setup-questions.ts +397 -0
- package/src/commands/ci-setup.ts +381 -0
- package/src/commands/config.ts +99 -0
- package/src/commands/doctor.ts +108 -0
- package/src/commands/init.ts +139 -0
- package/src/commands/mcp.ts +10 -0
- package/src/commands/menu.ts +129 -0
- package/src/commands/post.ts +302 -0
- package/src/commands/skills.ts +83 -0
- package/src/commands/status.ts +173 -0
- package/src/commands/triage.ts +342 -0
- package/src/commands/uninstall.ts +37 -0
- package/src/commands/upgrade.ts +214 -0
- package/src/commands/usage.ts +98 -0
- package/src/compare/compare.ts +28 -0
- package/src/compare/floor-test.ts +471 -0
- package/src/compare/martian-adapter.ts +80 -0
- package/src/config/config.ts +267 -0
- package/src/corpus/corpus.ts +1094 -0
- package/src/corpus/preflight.ts +1789 -0
- package/src/diversity/accounting.ts +90 -0
- package/src/diversity/adjudication.ts +145 -0
- package/src/diversity/admission.ts +60 -0
- package/src/diversity/benchmark.ts +195 -0
- package/src/diversity/clustering.ts +285 -0
- package/src/diversity/errors.ts +7 -0
- package/src/diversity/identity.ts +285 -0
- package/src/diversity/index.ts +11 -0
- package/src/diversity/pipeline-integration.ts +448 -0
- package/src/diversity/projection.ts +57 -0
- package/src/diversity/self-contained.ts +68 -0
- package/src/diversity/target-validation.ts +179 -0
- package/src/doctor-migration.ts +209 -0
- package/src/doctor.ts +723 -0
- package/src/errors.ts +83 -0
- package/src/execution/admission.ts +75 -0
- package/src/execution/atomic-write.ts +35 -0
- package/src/execution/attempt-evidence.ts +415 -0
- package/src/execution/bucket-id.ts +136 -0
- package/src/execution/concurrency-limiter.ts +175 -0
- package/src/execution/contracts.ts +443 -0
- package/src/execution/failure-classification.ts +42 -0
- package/src/execution/failure-policy.ts +240 -0
- package/src/execution/harness.ts +2548 -0
- package/src/execution/settlement.ts +348 -0
- package/src/execution/spawned-process.ts +66 -0
- package/src/execution/spend-limiter.ts +424 -0
- package/src/execution/step-artifacts.ts +55 -0
- package/src/execution/usage-normalized.ts +469 -0
- package/src/git/git.ts +396 -0
- package/src/git/identity.ts +64 -0
- package/src/git/refs.ts +140 -0
- package/src/home-preflight.ts +443 -0
- package/src/home.ts +243 -0
- package/src/ignore-file.ts +336 -0
- package/src/ignore-read.ts +118 -0
- package/src/index.ts +34 -0
- package/src/legacy-launchd.ts +29 -0
- package/src/mcp/mcp.ts +150 -0
- package/src/mcp/preflight.ts +407 -0
- package/src/menu-context.ts +192 -0
- package/src/model/catalog.ts +251 -0
- package/src/model/exec-snapshots.ts +390 -0
- package/src/model/free-discovery.ts +302 -0
- package/src/model/provider-capabilities.ts +814 -0
- package/src/model/routing.ts +600 -0
- package/src/pr/admission.ts +984 -0
- package/src/pr/answered-findings.ts +169 -0
- package/src/pr/ci-admission-gate.ts +743 -0
- package/src/pr/ci-publish.ts +76 -0
- package/src/pr/discovery.ts +432 -0
- package/src/pr/inline.ts +507 -0
- package/src/pr/plan.ts +366 -0
- package/src/pr/posting.ts +115 -0
- package/src/pr/pr-status.ts +845 -0
- package/src/pr/pr.ts +3642 -0
- package/src/pr/preflight.ts +1031 -0
- package/src/pr/publish-outcome.ts +361 -0
- package/src/pr/range.ts +119 -0
- package/src/pr/reverts-preflight.ts +606 -0
- package/src/pr/reverts.ts +377 -0
- package/src/pr/review-pr.ts +927 -0
- package/src/pr/status.ts +154 -0
- package/src/pr/target.ts +388 -0
- package/src/pr/teardown.ts +437 -0
- package/src/pr/worktree-setup.ts +60 -0
- package/src/production-runtime.ts +1877 -0
- package/src/progress.ts +487 -0
- package/src/rereview/adjudicate.ts +89 -0
- package/src/rereview/classify.ts +362 -0
- package/src/rereview/identity.ts +211 -0
- package/src/rereview/plan.ts +308 -0
- package/src/rereview/prepare.ts +1025 -0
- package/src/rereview/state.ts +767 -0
- package/src/rereview/verify.ts +241 -0
- package/src/review/boundary.ts +105 -0
- package/src/review/consolidate.ts +246 -0
- package/src/review/dedupe.ts +368 -0
- package/src/review/drafts.ts +448 -0
- package/src/review/findings-conformance.ts +120 -0
- package/src/review/findings.ts +714 -0
- package/src/review/pipeline.ts +3977 -0
- package/src/review/preflight.ts +3575 -0
- package/src/review/prompt-set.ts +177 -0
- package/src/review/proof-refs.ts +187 -0
- package/src/review/report.ts +1821 -0
- package/src/review/review.ts +490 -0
- package/src/review/root-cause.ts +120 -0
- package/src/review/route-preflight.ts +289 -0
- package/src/review/run.ts +601 -0
- package/src/review/scout.ts +323 -0
- package/src/review/size-gate.ts +595 -0
- package/src/review/spec.ts +235 -0
- package/src/review/step-runner.ts +233 -0
- package/src/runner-authority.ts +596 -0
- package/src/security/binding-policy.ts +115 -0
- package/src/security/credential-broker.ts +773 -0
- package/src/security/evidence-redaction.ts +62 -0
- package/src/security/execution-authority.ts +27 -0
- package/src/security/redact.ts +71 -0
- package/src/security/workspace-read-broker.ts +466 -0
- package/src/server/client.ts +190 -0
- package/src/server/preflight.ts +217 -0
- package/src/server/server.ts +327 -0
- package/src/signal-handler.ts +50 -0
- package/src/store/activity.ts +413 -0
- package/src/store/backfill-preflight.ts +49 -0
- package/src/store/backfill.ts +141 -0
- package/src/store/gc-preflight.ts +206 -0
- package/src/store/gc.ts +424 -0
- package/src/store/metrics-preflight.ts +229 -0
- package/src/store/metrics.ts +236 -0
- package/src/store/preflight.ts +748 -0
- package/src/store/store.ts +693 -0
- package/src/system-tools.ts +355 -0
- package/src/transport-registry.ts +1124 -0
- package/src/transports/claude-code-cli.ts +1348 -0
- package/src/transports/opencode-admission.ts +515 -0
- package/src/transports/opencode-client.ts +3328 -0
- package/src/transports/opencode-evidence.ts +557 -0
- package/src/transports/opencode-mcp.ts +248 -0
- package/src/transports/opencode-sdk.ts +2294 -0
- package/src/transports/opencode-server.ts +535 -0
- package/src/triage/adjudication.ts +113 -0
- package/src/triage/reply.ts +125 -0
- package/src/triage/triage.ts +255 -0
- package/src/ui/activity.ts +173 -0
- package/src/ui/config-edit.ts +816 -0
- package/src/ui/config.ts +462 -0
- package/src/ui/menu.ts +1325 -0
- package/src/ui/plan.ts +1039 -0
- package/src/ui/primitives.ts +300 -0
- package/src/ui/progress.ts +298 -0
- package/src/ui/result.ts +552 -0
- package/src/ui/review-menu.ts +312 -0
- package/src/ui/select.ts +528 -0
- package/src/ui/tree.ts +178 -0
- package/src/uninstaller.ts +479 -0
- package/src/updater.ts +836 -0
- package/src/usage.ts +77 -0
- package/src/watch/preflight.ts +1389 -0
- package/src/watch/watch.ts +1235 -0
- package/src/wizard.ts +877 -0
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
// Route and provider capability preflights: resolve logical route plans,
|
|
2
|
+
// enforce executable and provider capability gates, and admit production
|
|
3
|
+
// routes across Claude and OpenCode runners before confirming or spending tokens.
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
capabilityGateDecision,
|
|
7
|
+
produceClaudeCapabilityReport,
|
|
8
|
+
} from "#model/provider-capabilities";
|
|
9
|
+
import {
|
|
10
|
+
buildResolvedRoutePlan,
|
|
11
|
+
type ResolvedRoutePlan,
|
|
12
|
+
type RoutingConfig,
|
|
13
|
+
} from "#model/routing";
|
|
14
|
+
import { resolveEngineAssets } from "../assets";
|
|
15
|
+
import { CliError } from "../errors";
|
|
16
|
+
import type { RunnerBackend } from "../execution/contracts";
|
|
17
|
+
import {
|
|
18
|
+
type ProductionAdmissionContext,
|
|
19
|
+
prepareProductionAdmissionContext,
|
|
20
|
+
probeBindingsReadiness,
|
|
21
|
+
} from "../production-runtime";
|
|
22
|
+
import type {
|
|
23
|
+
ResolveRunnerAuthorityDeps,
|
|
24
|
+
RunnerAuthorityOptions,
|
|
25
|
+
RunnerAuthorityResolution,
|
|
26
|
+
} from "../runner-authority";
|
|
27
|
+
import {
|
|
28
|
+
admitRoutePlan,
|
|
29
|
+
createDefaultTransportRegistry,
|
|
30
|
+
type D1_11ReadinessEvidence,
|
|
31
|
+
type TransportRegistry,
|
|
32
|
+
} from "../transport-registry";
|
|
33
|
+
import type { OpenCodeSdkLike } from "../transports/opencode-client";
|
|
34
|
+
import { DEFAULT_CONSOLIDATE_MODEL, DEFAULT_SCOUT_MODEL } from "./pipeline";
|
|
35
|
+
import type { CliOptions, SummarySettings } from "./preflight";
|
|
36
|
+
import { type ParsedAgent, parseAgentFile } from "./prompt-set";
|
|
37
|
+
import type { ReviewSpec } from "./spec";
|
|
38
|
+
|
|
39
|
+
export function pipelineSummarizerInput(
|
|
40
|
+
summary: SummarySettings,
|
|
41
|
+
):
|
|
42
|
+
| { summarizer: { promptPath: string; model?: string } }
|
|
43
|
+
| Record<string, never> {
|
|
44
|
+
return summary.enabled
|
|
45
|
+
? {
|
|
46
|
+
summarizer: {
|
|
47
|
+
promptPath: resolveEngineAssets().summarizerPromptPath,
|
|
48
|
+
...(summary.model === undefined ? {} : { model: summary.model }),
|
|
49
|
+
},
|
|
50
|
+
}
|
|
51
|
+
: {};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// The scout's prompt is ENGINE-owned and lives outside the agents dir, on
|
|
55
|
+
// purpose and twice over (§3.7): a `review-scout.md` dropped in the agents dir
|
|
56
|
+
// without a spec entry is a hard CliError, and a new prompt-set directory
|
|
57
|
+
// holding byte-identical hunter files would be a new fingerprint — which is
|
|
58
|
+
// exactly the one-variable property M6 needs to be true by construction rather
|
|
59
|
+
// than argued. `prompts/` is the door the summarizer already walked through.
|
|
60
|
+
export function pipelineScoutInput(
|
|
61
|
+
options: Pick<CliOptions, "scout" | "scoutModel">,
|
|
62
|
+
): { scout: { promptPath: string; model?: string } } | Record<string, never> {
|
|
63
|
+
return options.scout
|
|
64
|
+
? {
|
|
65
|
+
scout: {
|
|
66
|
+
promptPath: resolveEngineAssets().scoutPromptPath,
|
|
67
|
+
...(options.scoutModel === undefined
|
|
68
|
+
? {}
|
|
69
|
+
: { model: options.scoutModel }),
|
|
70
|
+
},
|
|
71
|
+
}
|
|
72
|
+
: {};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// The consolidation pass is ENGINE-owned like the scout, and on by default in
|
|
76
|
+
// both product paths (local and PR/CI) with no flag: it was measured as a net
|
|
77
|
+
// gain on the Martian 50 (lab bench/METRICS.md 2026-10-27), and a failed pass
|
|
78
|
+
// falls back to the unconsolidated findings. The lab's direct `runPipeline`
|
|
79
|
+
// callers do not go through here, so their pipeline is unchanged.
|
|
80
|
+
export function pipelineConsolidateInput(): {
|
|
81
|
+
consolidate: { promptPath: string; model?: string };
|
|
82
|
+
} {
|
|
83
|
+
return {
|
|
84
|
+
consolidate: { promptPath: resolveEngineAssets().consolidatePromptPath },
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export async function buildCliRoutePlan(params: {
|
|
89
|
+
spec: ReviewSpec;
|
|
90
|
+
options: CliOptions;
|
|
91
|
+
agentFiles: Map<string, ParsedAgent>;
|
|
92
|
+
routingConfig?: RoutingConfig;
|
|
93
|
+
summary: SummarySettings;
|
|
94
|
+
summarizerEnabled?: boolean;
|
|
95
|
+
scoutEnabled?: boolean;
|
|
96
|
+
// Defaults ON, like the stage itself in both product paths; a re-review
|
|
97
|
+
// that skips discovery passes false, the scout's condition, so the plan
|
|
98
|
+
// never carries a route for a step that will not run.
|
|
99
|
+
consolidateEnabled?: boolean;
|
|
100
|
+
}): Promise<ResolvedRoutePlan> {
|
|
101
|
+
const summarizerEnabled = params.summarizerEnabled ?? params.summary.enabled;
|
|
102
|
+
const scoutEnabled = params.scoutEnabled ?? params.options.scout;
|
|
103
|
+
const consolidateEnabled = params.consolidateEnabled ?? true;
|
|
104
|
+
let summarizerFrontmatter: string | undefined;
|
|
105
|
+
if (summarizerEnabled) {
|
|
106
|
+
try {
|
|
107
|
+
const parsed = await parseAgentFile(
|
|
108
|
+
resolveEngineAssets().summarizerPromptPath,
|
|
109
|
+
);
|
|
110
|
+
summarizerFrontmatter = parsed.model;
|
|
111
|
+
} catch {
|
|
112
|
+
// Engine-owned prompt may be unreadable in tests; route resolution still
|
|
113
|
+
// falls through CLI > spec > frontmatter precedence without it.
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
let scoutFrontmatter: string | undefined;
|
|
117
|
+
if (scoutEnabled) {
|
|
118
|
+
try {
|
|
119
|
+
const parsed = await parseAgentFile(
|
|
120
|
+
resolveEngineAssets().scoutPromptPath,
|
|
121
|
+
);
|
|
122
|
+
scoutFrontmatter = parsed.model;
|
|
123
|
+
} catch {
|
|
124
|
+
// Same contract as the summarizer branch above.
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
let consolidateFrontmatter: string | undefined;
|
|
128
|
+
if (consolidateEnabled) {
|
|
129
|
+
try {
|
|
130
|
+
const parsed = await parseAgentFile(
|
|
131
|
+
resolveEngineAssets().consolidatePromptPath,
|
|
132
|
+
);
|
|
133
|
+
consolidateFrontmatter = parsed.model;
|
|
134
|
+
} catch {
|
|
135
|
+
// Same contract as the summarizer branch above.
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return buildResolvedRoutePlan({
|
|
139
|
+
agents: params.spec.agents,
|
|
140
|
+
cliModel: params.options.model,
|
|
141
|
+
routingConfig: params.routingConfig,
|
|
142
|
+
frontmatterModel: (agentKey) => params.agentFiles.get(agentKey)?.model,
|
|
143
|
+
...(summarizerEnabled
|
|
144
|
+
? {
|
|
145
|
+
summarizer: {
|
|
146
|
+
model: params.summary.model,
|
|
147
|
+
frontmatterModel: summarizerFrontmatter,
|
|
148
|
+
},
|
|
149
|
+
}
|
|
150
|
+
: {}),
|
|
151
|
+
...(scoutEnabled
|
|
152
|
+
? {
|
|
153
|
+
scout: {
|
|
154
|
+
model: params.options.scoutModel,
|
|
155
|
+
frontmatterModel: scoutFrontmatter,
|
|
156
|
+
defaultModel: DEFAULT_SCOUT_MODEL,
|
|
157
|
+
},
|
|
158
|
+
}
|
|
159
|
+
: {}),
|
|
160
|
+
...(consolidateEnabled
|
|
161
|
+
? {
|
|
162
|
+
consolidate: {
|
|
163
|
+
frontmatterModel: consolidateFrontmatter,
|
|
164
|
+
defaultModel: DEFAULT_CONSOLIDATE_MODEL,
|
|
165
|
+
},
|
|
166
|
+
}
|
|
167
|
+
: {}),
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// Pre-confirm route resolution: legacy runs without operator routing may omit
|
|
172
|
+
// route provenance when the plan cannot be built, but admission failures must
|
|
173
|
+
// always surface before confirm — never be swallowed into routePlan = undefined.
|
|
174
|
+
export async function resolveRoutePlanAtConfirm(input: {
|
|
175
|
+
routingConfigured: boolean;
|
|
176
|
+
buildRoutePlan: () => Promise<ResolvedRoutePlan>;
|
|
177
|
+
registry?: TransportRegistry;
|
|
178
|
+
}): Promise<ResolvedRoutePlan | undefined> {
|
|
179
|
+
const registry =
|
|
180
|
+
input.registry ?? createDefaultTransportRegistry({ mode: "production" });
|
|
181
|
+
let routePlan: ResolvedRoutePlan;
|
|
182
|
+
try {
|
|
183
|
+
routePlan = await input.buildRoutePlan();
|
|
184
|
+
} catch (error) {
|
|
185
|
+
if (input.routingConfigured) throw error;
|
|
186
|
+
return undefined;
|
|
187
|
+
}
|
|
188
|
+
await admitRoutePlan(routePlan, registry);
|
|
189
|
+
return routePlan;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export interface ProductionRoutePlanResult {
|
|
193
|
+
readonly routePlan: ResolvedRoutePlan;
|
|
194
|
+
readonly productionAdmission: ProductionAdmissionContext;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// Production admission: discover per-backend executable authority, derive
|
|
198
|
+
// D1-11 evidence from exact-binding probes, and admit with one shared registry.
|
|
199
|
+
export async function resolveProductionRoutePlanAtConfirm(input: {
|
|
200
|
+
routingConfigured: boolean;
|
|
201
|
+
workspaceRoot: string;
|
|
202
|
+
buildRoutePlan: () => Promise<ResolvedRoutePlan>;
|
|
203
|
+
authorityDeps?: ResolveRunnerAuthorityDeps;
|
|
204
|
+
loadSdk?: () => Promise<OpenCodeSdkLike>;
|
|
205
|
+
env?: RunnerAuthorityOptions["env"];
|
|
206
|
+
}): Promise<ProductionRoutePlanResult | undefined> {
|
|
207
|
+
let routePlan: ResolvedRoutePlan;
|
|
208
|
+
try {
|
|
209
|
+
routePlan = await input.buildRoutePlan();
|
|
210
|
+
} catch (error) {
|
|
211
|
+
if (input.routingConfigured) throw error;
|
|
212
|
+
return undefined;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
const productionAdmission = await prepareProductionAdmissionContext({
|
|
216
|
+
workspaceRoot: input.workspaceRoot,
|
|
217
|
+
plan: routePlan,
|
|
218
|
+
authorityDeps: input.authorityDeps,
|
|
219
|
+
loadSdk: input.loadSdk,
|
|
220
|
+
env: input.env,
|
|
221
|
+
});
|
|
222
|
+
if ("error" in productionAdmission) {
|
|
223
|
+
throw new CliError(
|
|
224
|
+
`production admission failed: ${productionAdmission.error}`,
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
await admitRoutePlan(routePlan, productionAdmission.registry, {
|
|
228
|
+
mode: "production",
|
|
229
|
+
evidence: productionAdmission.evidence,
|
|
230
|
+
});
|
|
231
|
+
return { routePlan, productionAdmission };
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export async function enforceProviderCapabilityGate(input: {
|
|
235
|
+
routePlan: ResolvedRoutePlan | undefined;
|
|
236
|
+
workspaceRoot: string;
|
|
237
|
+
runnerAuthority?: RunnerAuthorityResolution;
|
|
238
|
+
authorityOptions?: RunnerAuthorityOptions;
|
|
239
|
+
admissionRegistry?: TransportRegistry;
|
|
240
|
+
productionEvidence?: Map<RunnerBackend, D1_11ReadinessEvidence>;
|
|
241
|
+
}): Promise<void> {
|
|
242
|
+
if (input.routePlan === undefined) {
|
|
243
|
+
if (input.runnerAuthority?.error !== undefined) {
|
|
244
|
+
throw new CliError(
|
|
245
|
+
`execution authority unavailable: ${input.runnerAuthority.error}`,
|
|
246
|
+
);
|
|
247
|
+
}
|
|
248
|
+
const capabilityReport = await produceClaudeCapabilityReport({});
|
|
249
|
+
const capabilityGate = capabilityGateDecision(capabilityReport);
|
|
250
|
+
if (!capabilityGate.ok) {
|
|
251
|
+
throw new CliError(
|
|
252
|
+
`provider capability gate failed: ${capabilityGate.reason}`,
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
const authorityOptions =
|
|
258
|
+
input.authorityOptions ??
|
|
259
|
+
(input.runnerAuthority?.error !== undefined
|
|
260
|
+
? undefined
|
|
261
|
+
: {
|
|
262
|
+
workspaceRoot: input.workspaceRoot,
|
|
263
|
+
binaryPath: input.runnerAuthority?.runnerOptions.binaryPath,
|
|
264
|
+
executableAllowlists: {
|
|
265
|
+
"claude-code":
|
|
266
|
+
input.runnerAuthority?.runnerOptions.executableAllowlist ?? [],
|
|
267
|
+
},
|
|
268
|
+
});
|
|
269
|
+
if (authorityOptions === undefined) {
|
|
270
|
+
throw new CliError(
|
|
271
|
+
`execution authority unavailable: ${input.runnerAuthority?.error ?? "missing production authority options"}`,
|
|
272
|
+
);
|
|
273
|
+
}
|
|
274
|
+
const probe = await probeBindingsReadiness({
|
|
275
|
+
...authorityOptions,
|
|
276
|
+
plan: input.routePlan,
|
|
277
|
+
workspaceRoot: input.workspaceRoot,
|
|
278
|
+
registry: input.admissionRegistry,
|
|
279
|
+
mode: "production",
|
|
280
|
+
evidence: input.productionEvidence,
|
|
281
|
+
});
|
|
282
|
+
if (!probe.decision.ok) {
|
|
283
|
+
await probe.dispose();
|
|
284
|
+
throw new CliError(
|
|
285
|
+
`provider capability gate failed: ${probe.decision.reason}`,
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
await probe.dispose();
|
|
289
|
+
}
|