crysk 0.5.1 → 0.6.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 +2 -1
- package/package.json +3 -2
- package/skills/crysk-ci-setup/assets/workflow.yml +3 -0
- package/src/asset-manifest.ts +11 -0
- package/src/assets.ts +1 -1
- package/src/ci/credential-refresh.ts +524 -0
- package/src/ci/crysk-secrets.ts +20 -6
- package/src/ci/outcome.ts +165 -15
- package/src/ci/platform.ts +155 -7
- package/src/ci/setup.ts +64 -6
- package/src/ci/trigger.ts +20 -4
- package/src/commands/ci-setup.ts +12 -3
- package/src/commands/doctor.ts +25 -23
- package/src/diversity/identity.ts +11 -1
- package/src/diversity/pipeline-integration.ts +19 -6
- package/src/doctor.ts +133 -4
- package/src/execution/contracts.ts +15 -3
- package/src/harness/materiality-judge.ts +153 -0
- package/src/harness/pipeline-plan.ts +133 -0
- package/src/harness/replay-rows.ts +172 -0
- package/src/harness/route-runner.ts +288 -0
- package/src/harness/single-step.ts +153 -0
- package/src/index.ts +1 -1
- package/src/model/catalog.ts +10 -7
- package/src/model/model-name.ts +14 -0
- package/src/model/profiles/claude.ts +34 -0
- package/src/model/profiles/openai.ts +44 -0
- package/src/model/profiles.ts +213 -0
- package/src/model/routing.ts +155 -50
- package/src/pr/plan.ts +6 -1
- package/src/pr/review-pr.ts +32 -6
- package/src/pr/target.ts +16 -7
- package/src/production-runtime.ts +100 -13
- package/src/review/pipeline.ts +193 -58
- package/src/review/preflight.ts +91 -9
- package/src/review/prompt-set.ts +68 -0
- package/src/review/review.ts +21 -11
- package/src/review/route-preflight.ts +117 -67
- package/src/review/run.ts +34 -4
- package/src/security/credential-broker.ts +21 -9
- package/src/security/oauth-providers.ts +101 -0
- package/src/transport-registry.ts +33 -0
- package/src/transports/opencode-sdk.ts +33 -1
- package/src/ui/config-edit.ts +9 -0
- package/src/ui/config.ts +1 -0
- package/src/ui/menu.ts +9 -2
- package/src/updater.ts +21 -13
- package/src/wizard.ts +23 -0
package/src/review/pipeline.ts
CHANGED
|
@@ -14,6 +14,14 @@ import {
|
|
|
14
14
|
import { defaultEffortForRole, type Effort, isEffort } from "#model/catalog";
|
|
15
15
|
import type { ModelsConfig } from "#model/model-name";
|
|
16
16
|
import {
|
|
17
|
+
FALLBACK_PROFILE,
|
|
18
|
+
type ModelProfile,
|
|
19
|
+
profileModelAlias,
|
|
20
|
+
profileRoleEffort,
|
|
21
|
+
profileRoute,
|
|
22
|
+
} from "#model/profiles";
|
|
23
|
+
import {
|
|
24
|
+
agentModelRole,
|
|
17
25
|
agentStepKey,
|
|
18
26
|
buildResolvedRoutePlan,
|
|
19
27
|
claudeCliModel,
|
|
@@ -102,6 +110,7 @@ import {
|
|
|
102
110
|
renderMaterialityPrompt,
|
|
103
111
|
} from "#review/materiality-gate";
|
|
104
112
|
import {
|
|
113
|
+
type ParsedAgent,
|
|
105
114
|
parseAgentFile,
|
|
106
115
|
parseAgentSource,
|
|
107
116
|
renderAgentBody,
|
|
@@ -246,6 +255,15 @@ export interface PipelineInput {
|
|
|
246
255
|
// the compiled path exactly as untestable as it was when it shipped unable
|
|
247
256
|
// to load a single prompt.
|
|
248
257
|
agentFiles?: Record<string, string>;
|
|
258
|
+
// The agents' prompt set is the engine's bundled one (model-profiles S3):
|
|
259
|
+
// its routing then comes from the active profile, never from its
|
|
260
|
+
// frontmatter. Absent: a user or lab set, whose frontmatter `model:` and
|
|
261
|
+
// `effort:` win over the profile, as they always did. Passed by the caller,
|
|
262
|
+
// which holds the agents-dir resolution, for agentFiles' reason.
|
|
263
|
+
bundledAgents?: boolean;
|
|
264
|
+
// The active model profile (S1). Absent: `claude`. Phase 1 has no config key
|
|
265
|
+
// for it; tests inject a fixture profile here.
|
|
266
|
+
modelProfile?: ModelProfile;
|
|
249
267
|
runDir: string;
|
|
250
268
|
// Where the CALLER will write the final findings document after merging the
|
|
251
269
|
// run envelope — the pipeline itself never writes it (it returns the
|
|
@@ -271,9 +289,15 @@ export interface PipelineInput {
|
|
|
271
289
|
// beside `pipelineTimeoutMs` and is injectable for the same reason: without
|
|
272
290
|
// it every ceiling test would sleep 8.5 real seconds.
|
|
273
291
|
ceilingGraceMs?: number;
|
|
292
|
+
// `bundled` on the summarizer, scout and consolidate inputs (set by the
|
|
293
|
+
// product paths' pipeline*Input, #review/route-preflight) marks the engine's
|
|
294
|
+
// own prompt, resolved through the active profile's prompt set: its model
|
|
295
|
+
// and effort then come from the profile, never from its frontmatter
|
|
296
|
+
// (model-profiles S3-S4). Unmarked, as the lab passes them, the frontmatter
|
|
297
|
+
// keeps its seats, unchanged.
|
|
274
298
|
// Optional engine-owned summary step. It is deliberately outside ReviewSpec:
|
|
275
299
|
// this prompt is bundled with pr-hero, not part of the benchmarked agent set.
|
|
276
|
-
summarizer?: { promptPath: string; model?: string };
|
|
300
|
+
summarizer?: { promptPath: string; model?: string; bundled?: boolean };
|
|
277
301
|
// Optional engine-owned scout step (ROADMAP-DOORDASH M5,
|
|
278
302
|
// `docs/scout-design.md` §3.3). Outside ReviewSpec for the summarizer's
|
|
279
303
|
// reason and one more of its own: `ReviewSpec.role` is
|
|
@@ -281,7 +305,7 @@ export interface PipelineInput {
|
|
|
281
305
|
// entry without widening that union — and widening it would re-fingerprint
|
|
282
306
|
// the prompt set, which is exactly what M6's one-variable property forbids.
|
|
283
307
|
// ABSENT means the control pipeline, byte for byte.
|
|
284
|
-
scout?: { promptPath: string; model?: string };
|
|
308
|
+
scout?: { promptPath: string; model?: string; bundled?: boolean };
|
|
285
309
|
// Optional engine-owned consolidation pass over the POSTED findings, after
|
|
286
310
|
// the refuter (prompts/consolidate.md, measured on the Martian 50: F1
|
|
287
311
|
// 39.7 -> 42.3, lab bench/METRICS.md 2026-10-27). Opt-in on the engine input
|
|
@@ -290,7 +314,7 @@ export interface PipelineInput {
|
|
|
290
314
|
// as before; pipeline.json still carries a `consolidation` record
|
|
291
315
|
// (`enabled: false`, `status: "skipped"`), the scout's rule, so the two
|
|
292
316
|
// arms are told apart from the artifact alone.
|
|
293
|
-
consolidate?: { promptPath: string; model?: string };
|
|
317
|
+
consolidate?: { promptPath: string; model?: string; bundled?: boolean };
|
|
294
318
|
// Optional engine-owned materiality gate (odd/tasks/materiality-gate.md):
|
|
295
319
|
// an isolated judge reads every finding that would post as blocking and
|
|
296
320
|
// demotes the immaterial ones to advisory. ABSENT means no judge step and
|
|
@@ -1054,6 +1078,77 @@ function agentPromptPath(input: PipelineInput, file: string): string {
|
|
|
1054
1078
|
);
|
|
1055
1079
|
}
|
|
1056
1080
|
|
|
1081
|
+
function activeProfile(input: PipelineInput): ModelProfile {
|
|
1082
|
+
return input.modelProfile ?? FALLBACK_PROFILE;
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
// The model and effort a spec agent's prompt contributes, in the seats its
|
|
1086
|
+
// frontmatter has always held (resolveModel, stepEffortFields). A bundled set
|
|
1087
|
+
// contributes the active profile's route for the agent's role instead of its
|
|
1088
|
+
// own frontmatter (S3), so the profile decides and the plan agrees with the
|
|
1089
|
+
// step (buildResolvedRoutePlan's bundledAgents). A user or lab set keeps its
|
|
1090
|
+
// frontmatter, unchanged.
|
|
1091
|
+
function agentPromptChoice(
|
|
1092
|
+
input: PipelineInput,
|
|
1093
|
+
agent: AgentSpec,
|
|
1094
|
+
parsed: ParsedAgent,
|
|
1095
|
+
): { model?: string; effort?: Effort } {
|
|
1096
|
+
if (input.bundledAgents !== true) {
|
|
1097
|
+
return {
|
|
1098
|
+
...(parsed.model === undefined ? {} : { model: parsed.model }),
|
|
1099
|
+
...(parsed.effort === undefined ? {} : { effort: parsed.effort }),
|
|
1100
|
+
};
|
|
1101
|
+
}
|
|
1102
|
+
const role = agentModelRole(agent);
|
|
1103
|
+
if (role === undefined) return {};
|
|
1104
|
+
const route = profileRoute(activeProfile(input), role);
|
|
1105
|
+
return {
|
|
1106
|
+
model: profileModelAlias(route.model),
|
|
1107
|
+
effort: profileRoleEffort(activeProfile(input), role),
|
|
1108
|
+
};
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
// The effort a step runs at when neither a `models` entry nor its prompt sets
|
|
1112
|
+
// one: the active profile's for the agent's role (S3). Under `claude` these
|
|
1113
|
+
// are ROLE_EFFORT's hunter and refuter levels, so nothing moves.
|
|
1114
|
+
function agentRoleEffort(input: PipelineInput, agent: AgentSpec): Effort {
|
|
1115
|
+
const role = agentModelRole(agent);
|
|
1116
|
+
return role === undefined
|
|
1117
|
+
? defaultEffortForRole("other")
|
|
1118
|
+
: profileRoleEffort(activeProfile(input), role);
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
// The model and effort an engine-owned root prompt contributes, the seats
|
|
1122
|
+
// agentPromptChoice fills for an agent. A prompt marked `bundled` (the
|
|
1123
|
+
// engine's own, resolved through the profile's set) contributes the active
|
|
1124
|
+
// profile's route for its role, never its frontmatter (S3), so the step
|
|
1125
|
+
// agrees with the plan (buildResolvedRoutePlan's `bundled`). Unmarked, its
|
|
1126
|
+
// frontmatter holds both seats; `profileFallback` says whether the profile
|
|
1127
|
+
// still backs an absent `model:` there (scout, consolidate) or not
|
|
1128
|
+
// (summarizer, which has always failed without one).
|
|
1129
|
+
function enginePromptChoice(
|
|
1130
|
+
input: PipelineInput,
|
|
1131
|
+
prompt: { bundled?: boolean },
|
|
1132
|
+
role: "summary" | "scout" | "consolidate",
|
|
1133
|
+
parsed: ParsedAgent,
|
|
1134
|
+
profileFallback: boolean,
|
|
1135
|
+
): { model?: string; effort?: Effort } {
|
|
1136
|
+
const route = profileRoute(activeProfile(input), role);
|
|
1137
|
+
if (prompt.bundled === true) {
|
|
1138
|
+
return {
|
|
1139
|
+
model: profileModelAlias(route.model),
|
|
1140
|
+
effort: profileRoleEffort(activeProfile(input), role),
|
|
1141
|
+
};
|
|
1142
|
+
}
|
|
1143
|
+
const model =
|
|
1144
|
+
parsed.model ??
|
|
1145
|
+
(profileFallback ? profileModelAlias(route.model) : undefined);
|
|
1146
|
+
return {
|
|
1147
|
+
...(model === undefined ? {} : { model }),
|
|
1148
|
+
...(parsed.effort === undefined ? {} : { effort: parsed.effort }),
|
|
1149
|
+
};
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1057
1152
|
// A conditional hunter's trigger, resolved against the ReviewSpec: the
|
|
1058
1153
|
// "input" sentinel reads PipelineInput.parityTriggerPaths (the trigger PATHS
|
|
1059
1154
|
// stay lab config; the spec only wires "this hunter is conditional").
|
|
@@ -1615,7 +1710,7 @@ async function execute(
|
|
|
1615
1710
|
let routePlan = input.routePlan;
|
|
1616
1711
|
if (!routePlan) {
|
|
1617
1712
|
let summarizerFrontmatter: string | undefined;
|
|
1618
|
-
if (input.summarizer) {
|
|
1713
|
+
if (input.summarizer && input.summarizer.bundled !== true) {
|
|
1619
1714
|
try {
|
|
1620
1715
|
const parsed = await parseAgentFile(input.summarizer.promptPath);
|
|
1621
1716
|
summarizerFrontmatter = parsed.model;
|
|
@@ -1624,7 +1719,7 @@ async function execute(
|
|
|
1624
1719
|
}
|
|
1625
1720
|
}
|
|
1626
1721
|
let scoutFrontmatter: string | undefined;
|
|
1627
|
-
if (input.scout) {
|
|
1722
|
+
if (input.scout && input.scout.bundled !== true) {
|
|
1628
1723
|
try {
|
|
1629
1724
|
const parsed = await parseAgentFile(input.scout.promptPath);
|
|
1630
1725
|
scoutFrontmatter = parsed.model;
|
|
@@ -1633,7 +1728,7 @@ async function execute(
|
|
|
1633
1728
|
}
|
|
1634
1729
|
}
|
|
1635
1730
|
let consolidateFrontmatter: string | undefined;
|
|
1636
|
-
if (input.consolidate) {
|
|
1731
|
+
if (input.consolidate && input.consolidate.bundled !== true) {
|
|
1637
1732
|
try {
|
|
1638
1733
|
const parsed = await parseAgentFile(input.consolidate.promptPath);
|
|
1639
1734
|
consolidateFrontmatter = parsed.model;
|
|
@@ -1646,6 +1741,8 @@ async function execute(
|
|
|
1646
1741
|
agents: diversityCtx.routeAgents,
|
|
1647
1742
|
cliModel: input.model,
|
|
1648
1743
|
models: effectiveModels,
|
|
1744
|
+
profile: activeProfile(input),
|
|
1745
|
+
...(input.bundledAgents === true ? { bundledAgents: true } : {}),
|
|
1649
1746
|
frontmatterModel: (agentKey) => frontmatterByKey.get(agentKey),
|
|
1650
1747
|
...(input.summarizer === undefined
|
|
1651
1748
|
? {}
|
|
@@ -1653,6 +1750,7 @@ async function execute(
|
|
|
1653
1750
|
summarizer: {
|
|
1654
1751
|
model: input.summarizer.model,
|
|
1655
1752
|
frontmatterModel: summarizerFrontmatter,
|
|
1753
|
+
bundled: input.summarizer.bundled === true,
|
|
1656
1754
|
},
|
|
1657
1755
|
}),
|
|
1658
1756
|
...(input.scout === undefined
|
|
@@ -1661,7 +1759,7 @@ async function execute(
|
|
|
1661
1759
|
scout: {
|
|
1662
1760
|
model: input.scout.model,
|
|
1663
1761
|
frontmatterModel: scoutFrontmatter,
|
|
1664
|
-
|
|
1762
|
+
bundled: input.scout.bundled === true,
|
|
1665
1763
|
},
|
|
1666
1764
|
}),
|
|
1667
1765
|
...(input.consolidate === undefined
|
|
@@ -1670,7 +1768,7 @@ async function execute(
|
|
|
1670
1768
|
consolidate: {
|
|
1671
1769
|
model: input.consolidate.model,
|
|
1672
1770
|
frontmatterModel: consolidateFrontmatter,
|
|
1673
|
-
|
|
1771
|
+
bundled: input.consolidate.bundled === true,
|
|
1674
1772
|
},
|
|
1675
1773
|
}),
|
|
1676
1774
|
...(input.materiality === undefined
|
|
@@ -1821,6 +1919,7 @@ async function execute(
|
|
|
1821
1919
|
}> = [];
|
|
1822
1920
|
for (const hunter of huntersAdmitted ? hunters : []) {
|
|
1823
1921
|
const agent = await parseAgentFile(agentPromptPath(input, hunter.file));
|
|
1922
|
+
const prompt = agentPromptChoice(input, hunter, agent);
|
|
1824
1923
|
const name = `hunter-${hunter.key}`;
|
|
1825
1924
|
const systemPromptPath = path.join(stepsDir, `${name}.system.md`);
|
|
1826
1925
|
const shared =
|
|
@@ -1861,12 +1960,12 @@ async function execute(
|
|
|
1861
1960
|
prompt: shared ? `${body}\n\n${SHARED_PREFIX_CLOSING}` : sharedBlock,
|
|
1862
1961
|
tools: agent.tools,
|
|
1863
1962
|
mcpConfigPath: input.mcpConfigPath,
|
|
1864
|
-
model: resolveModel(input, hunter.model,
|
|
1963
|
+
model: resolveModel(input, hunter.model, prompt.model, hunter.file),
|
|
1865
1964
|
...stepEffortFields(
|
|
1866
1965
|
routePlan,
|
|
1867
1966
|
name,
|
|
1868
|
-
|
|
1869
|
-
|
|
1967
|
+
prompt.effort,
|
|
1968
|
+
agentRoleEffort(input, hunter),
|
|
1870
1969
|
),
|
|
1871
1970
|
cwd: input.worktree,
|
|
1872
1971
|
outPath: path.join(stepsDir, `${name}.draft.json`),
|
|
@@ -1916,7 +2015,7 @@ async function execute(
|
|
|
1916
2015
|
summarizerMeta = {
|
|
1917
2016
|
name,
|
|
1918
2017
|
model: input.summarizer.model ?? input.model ?? "unresolved",
|
|
1919
|
-
effort:
|
|
2018
|
+
effort: profileRoleEffort(activeProfile(input), "summary"),
|
|
1920
2019
|
tools: [],
|
|
1921
2020
|
systemPromptPath,
|
|
1922
2021
|
outPath,
|
|
@@ -1925,17 +2024,24 @@ async function execute(
|
|
|
1925
2024
|
try {
|
|
1926
2025
|
const agent = await parseAgentFile(input.summarizer.promptPath);
|
|
1927
2026
|
await writeSystemPrompt(systemPromptPath, agent.body);
|
|
2027
|
+
const own = enginePromptChoice(
|
|
2028
|
+
input,
|
|
2029
|
+
input.summarizer,
|
|
2030
|
+
"summary",
|
|
2031
|
+
agent,
|
|
2032
|
+
false,
|
|
2033
|
+
);
|
|
1928
2034
|
summarizerMeta.model = resolveModel(
|
|
1929
2035
|
input,
|
|
1930
2036
|
input.summarizer.model,
|
|
1931
|
-
|
|
2037
|
+
own.model,
|
|
1932
2038
|
input.summarizer.promptPath,
|
|
1933
2039
|
);
|
|
1934
2040
|
const summarizerEffort = stepEffortFields(
|
|
1935
2041
|
routePlan,
|
|
1936
2042
|
name,
|
|
1937
|
-
|
|
1938
|
-
|
|
2043
|
+
own.effort,
|
|
2044
|
+
profileRoleEffort(activeProfile(input), "summary"),
|
|
1939
2045
|
);
|
|
1940
2046
|
summarizerMeta.effort = summarizerEffort.effort;
|
|
1941
2047
|
summarizerMeta.tools = agent.tools;
|
|
@@ -2506,17 +2612,18 @@ async function runRefuter(
|
|
|
2506
2612
|
nonce: options.nonce,
|
|
2507
2613
|
}),
|
|
2508
2614
|
);
|
|
2615
|
+
const prompt = agentPromptChoice(input, options.agent, agent);
|
|
2509
2616
|
const model = resolveModel(
|
|
2510
2617
|
input,
|
|
2511
2618
|
options.agent.model,
|
|
2512
|
-
|
|
2619
|
+
prompt.model,
|
|
2513
2620
|
options.agent.file,
|
|
2514
2621
|
);
|
|
2515
2622
|
const effortFields = stepEffortFields(
|
|
2516
2623
|
state.routePlan,
|
|
2517
2624
|
agentStepKey(options.agent),
|
|
2518
|
-
|
|
2519
|
-
|
|
2625
|
+
prompt.effort,
|
|
2626
|
+
agentRoleEffort(input, options.agent),
|
|
2520
2627
|
);
|
|
2521
2628
|
// A finding's content is composed LONG after the run's nonce was committed
|
|
2522
2629
|
// — the hunters wrote its `claim` and `proof_refs` from the patch — so it is
|
|
@@ -2734,19 +2841,20 @@ async function runVerify(
|
|
|
2734
2841
|
nonce: options.nonce,
|
|
2735
2842
|
}),
|
|
2736
2843
|
);
|
|
2844
|
+
const prompt = agentPromptChoice(input, options.agent, agent);
|
|
2737
2845
|
const model = resolveModel(
|
|
2738
2846
|
input,
|
|
2739
2847
|
options.agent.model,
|
|
2740
|
-
|
|
2848
|
+
prompt.model,
|
|
2741
2849
|
options.agent.file,
|
|
2742
2850
|
);
|
|
2743
2851
|
// The verifier re-reads the REFUTER's prompt file, so a frontmatter `effort:`
|
|
2744
|
-
// there applies to it as well
|
|
2745
|
-
// that omits the key.
|
|
2852
|
+
// there applies to it as well (on the bundled set, the profile's refuter
|
|
2853
|
+
// effort); `verifier` is only the fallback for a prompt that omits the key.
|
|
2746
2854
|
const effortFields = stepEffortFields(
|
|
2747
2855
|
state.routePlan,
|
|
2748
2856
|
agentStepKey(options.agent),
|
|
2749
|
-
|
|
2857
|
+
prompt.effort,
|
|
2750
2858
|
defaultEffortForRole("verifier"),
|
|
2751
2859
|
);
|
|
2752
2860
|
const forged: VerifySubject[] = [];
|
|
@@ -2933,17 +3041,18 @@ async function runAdjudicate(
|
|
|
2933
3041
|
);
|
|
2934
3042
|
const systemPromptPath = path.join(options.stepsDir, "adjudicator.system.md");
|
|
2935
3043
|
await writeSystemPrompt(systemPromptPath, body);
|
|
3044
|
+
const prompt = agentPromptChoice(input, options.agent, agent);
|
|
2936
3045
|
const model = resolveModel(
|
|
2937
3046
|
input,
|
|
2938
3047
|
options.agent.model,
|
|
2939
|
-
|
|
3048
|
+
prompt.model,
|
|
2940
3049
|
options.agent.file,
|
|
2941
3050
|
);
|
|
2942
3051
|
const effortFields = stepEffortFields(
|
|
2943
3052
|
state.routePlan,
|
|
2944
3053
|
agentStepKey(options.agent),
|
|
2945
|
-
|
|
2946
|
-
|
|
3054
|
+
prompt.effort,
|
|
3055
|
+
agentRoleEffort(input, options.agent),
|
|
2947
3056
|
);
|
|
2948
3057
|
const specs: Array<{
|
|
2949
3058
|
index: number;
|
|
@@ -3054,8 +3163,11 @@ const SCOUT_TIMEOUT_MS = 15 * 60 * 1000;
|
|
|
3054
3163
|
// the prompt's frontmatter), and M6's whole control corpus is sonnet (§1.2) —
|
|
3055
3164
|
// so this is the model the scout has actually been measured on, and the model
|
|
3056
3165
|
// the A/B will run it on. `--scout-model` is the documented exit; the cheap
|
|
3057
|
-
// tier is its own later experiment (§3.13), not a variable inside M6.
|
|
3058
|
-
|
|
3166
|
+
// tier is its own later experiment (§3.13), not a variable inside M6. Read
|
|
3167
|
+
// from the `claude` profile, which holds the value now (model-profiles S2).
|
|
3168
|
+
export const DEFAULT_SCOUT_MODEL = profileModelAlias(
|
|
3169
|
+
profileRoute(FALLBACK_PROFILE, "scout").model,
|
|
3170
|
+
);
|
|
3059
3171
|
|
|
3060
3172
|
// Runs the scout and returns the block to append to every hunter prompt —
|
|
3061
3173
|
// the EMPTY STRING whenever there is nothing to append, which covers all four
|
|
@@ -3100,7 +3212,7 @@ async function runScout(
|
|
|
3100
3212
|
const meta: StepMeta = {
|
|
3101
3213
|
name,
|
|
3102
3214
|
model: input.scout.model ?? input.model ?? "unresolved",
|
|
3103
|
-
effort:
|
|
3215
|
+
effort: profileRoleEffort(activeProfile(input), "scout"),
|
|
3104
3216
|
// FORCED to empty here, never read from the prompt file's frontmatter.
|
|
3105
3217
|
// §3.5 mechanism 1 — "the scout cannot open a file, grep, or walk a call
|
|
3106
3218
|
// graph" — is the guarantee this whole design rests on, and a guarantee a
|
|
@@ -3164,20 +3276,22 @@ async function runScout(
|
|
|
3164
3276
|
const agent = parseAgentSource(raw);
|
|
3165
3277
|
await writeSystemPrompt(systemPromptPath, agent.body);
|
|
3166
3278
|
// Precedence, the JD rule extended one seat: --model > --scout-model >
|
|
3167
|
-
// the prompt's frontmatter > the
|
|
3168
|
-
// a frontmatter model added later still outranks it
|
|
3279
|
+
// the prompt's frontmatter > the active profile's scout. The profile sits
|
|
3280
|
+
// LAST so a frontmatter model added later still outranks it, unless the
|
|
3281
|
+
// prompt is the engine's own (`bundled`), whose seat is the profile's.
|
|
3282
|
+
const own = enginePromptChoice(input, input.scout, "scout", agent, true);
|
|
3169
3283
|
meta.model = resolveModel(
|
|
3170
3284
|
input,
|
|
3171
3285
|
input.scout.model,
|
|
3172
|
-
|
|
3286
|
+
own.model,
|
|
3173
3287
|
input.scout.promptPath,
|
|
3174
3288
|
);
|
|
3175
3289
|
record.model = meta.model;
|
|
3176
3290
|
const scoutEffort = stepEffortFields(
|
|
3177
3291
|
state.routePlan,
|
|
3178
3292
|
name,
|
|
3179
|
-
|
|
3180
|
-
|
|
3293
|
+
own.effort,
|
|
3294
|
+
profileRoleEffort(activeProfile(input), "scout"),
|
|
3181
3295
|
);
|
|
3182
3296
|
meta.effort = scoutEffort.effort;
|
|
3183
3297
|
// FULL sha256, not the 12 chars the probe prints: the probe's artifact
|
|
@@ -3278,17 +3392,6 @@ async function runScout(
|
|
|
3278
3392
|
const CONSOLIDATE_TIMEOUT_MS = 10 * 60 * 1000;
|
|
3279
3393
|
const CONSOLIDATE_MAX_ATTEMPTS = 2;
|
|
3280
3394
|
|
|
3281
|
-
// Last resort in the model chain, the scout's rule: the frontmatter of
|
|
3282
|
-
// prompts/consolidate.md names sonnet too, and the Martian 50 measurement
|
|
3283
|
-
// ran on sonnet, so a frontmatter edit that drops the line cannot silently
|
|
3284
|
-
// move the stage onto an unmeasured model.
|
|
3285
|
-
export const DEFAULT_CONSOLIDATE_MODEL = "sonnet";
|
|
3286
|
-
|
|
3287
|
-
// The effort the stage was measured at, pinned here rather than taken from the
|
|
3288
|
-
// "other" role default: a prompt edit that drops `effort:` must not silently
|
|
3289
|
-
// move the stage to an unmeasured level if that role default ever changes.
|
|
3290
|
-
const DEFAULT_CONSOLIDATE_EFFORT: Effort = "high";
|
|
3291
|
-
|
|
3292
3395
|
// The ceiling's settle grace: the caller's override, else the harness's own
|
|
3293
3396
|
// bound. One helper so runPipeline and the consolidation budget check cannot
|
|
3294
3397
|
// disagree about it.
|
|
@@ -3442,18 +3545,30 @@ async function runConsolidation(
|
|
|
3442
3545
|
const raw = await Bun.file(input.consolidate.promptPath).text();
|
|
3443
3546
|
const agent = parseAgentSource(raw);
|
|
3444
3547
|
await writeSystemPrompt(systemPromptPath, agent.body);
|
|
3548
|
+
// The profile's consolidate route is the last seat, model AND effort: the
|
|
3549
|
+
// effort is the level the stage was measured at, not the "other" role
|
|
3550
|
+
// default, so a prompt edit that drops `effort:` cannot move the stage to
|
|
3551
|
+
// an unmeasured level if that role default ever changes.
|
|
3552
|
+
// A `bundled` prompt (the engine's own) takes both from the profile.
|
|
3553
|
+
const own = enginePromptChoice(
|
|
3554
|
+
input,
|
|
3555
|
+
input.consolidate,
|
|
3556
|
+
"consolidate",
|
|
3557
|
+
agent,
|
|
3558
|
+
true,
|
|
3559
|
+
);
|
|
3445
3560
|
meta.model = resolveModel(
|
|
3446
3561
|
input,
|
|
3447
3562
|
input.consolidate.model,
|
|
3448
|
-
|
|
3563
|
+
own.model,
|
|
3449
3564
|
input.consolidate.promptPath,
|
|
3450
3565
|
);
|
|
3451
3566
|
record.model = meta.model;
|
|
3452
3567
|
const consolidateEffort = stepEffortFields(
|
|
3453
3568
|
state.routePlan,
|
|
3454
3569
|
name,
|
|
3455
|
-
|
|
3456
|
-
|
|
3570
|
+
own.effort,
|
|
3571
|
+
profileRoleEffort(activeProfile(input), "consolidate"),
|
|
3457
3572
|
);
|
|
3458
3573
|
meta.effort = consolidateEffort.effort;
|
|
3459
3574
|
record.prompt_sha256 = new Bun.CryptoHasher("sha256")
|
|
@@ -3620,7 +3735,9 @@ async function runMaterialityJudge(
|
|
|
3620
3735
|
protected: 0,
|
|
3621
3736
|
failed: 0,
|
|
3622
3737
|
skipped_unsafe: 0,
|
|
3623
|
-
|
|
3738
|
+
// The active profile's judge, so a run on another profile never records
|
|
3739
|
+
// a Claude model it did not run (under `claude`, MATERIALITY_JUDGE_MODEL).
|
|
3740
|
+
model: profileModelAlias(profileRoute(activeProfile(input), "judge").model),
|
|
3624
3741
|
duration_ms: 0,
|
|
3625
3742
|
};
|
|
3626
3743
|
state.materiality = record;
|
|
@@ -3637,10 +3754,11 @@ async function runMaterialityJudge(
|
|
|
3637
3754
|
);
|
|
3638
3755
|
record.protected = protectedCount;
|
|
3639
3756
|
|
|
3640
|
-
// S14. A routed run whose plan does not carry a
|
|
3641
|
-
//
|
|
3642
|
-
//
|
|
3643
|
-
//
|
|
3757
|
+
// S14. A routed run whose plan does not carry a judge on a route the active
|
|
3758
|
+
// profile measured (model-profiles S5; on `claude`, the claude-code sonnet
|
|
3759
|
+
// or opus) would run some other model, or nothing at all: a different,
|
|
3760
|
+
// unmeasured judge is worse than no judge, so the stage stands down and
|
|
3761
|
+
// every finding keeps its tier. A run with no route plan is the legacy Claude-only path, where
|
|
3644
3762
|
// the step goes to the Claude Code runner exactly as the judge was
|
|
3645
3763
|
// measured. A plan WITHOUT the key also stands down rather than spawning a
|
|
3646
3764
|
// route-less step inside a routed run: that is a caller that never threaded
|
|
@@ -3648,7 +3766,10 @@ async function runMaterialityJudge(
|
|
|
3648
3766
|
let route: ResolvedModelRoute | undefined;
|
|
3649
3767
|
if (state.routePlan !== undefined) {
|
|
3650
3768
|
route = routeForStepKey(state.routePlan, MATERIALITY_STEP_KEY);
|
|
3651
|
-
if (
|
|
3769
|
+
if (
|
|
3770
|
+
route === undefined ||
|
|
3771
|
+
!isMeasuredJudgeRoute(route, activeProfile(input))
|
|
3772
|
+
) {
|
|
3652
3773
|
record.status = "unsupported_route";
|
|
3653
3774
|
// A route in hand that fails the check names itself; only a plan with
|
|
3654
3775
|
// no judge step asks the config whether the step was left out because
|
|
@@ -3657,6 +3778,7 @@ async function runMaterialityJudge(
|
|
|
3657
3778
|
route !== undefined ||
|
|
3658
3779
|
resolveMaterialityJudgeRoute(
|
|
3659
3780
|
input.models ?? input.config?.effective?.models,
|
|
3781
|
+
activeProfile(input),
|
|
3660
3782
|
) === undefined
|
|
3661
3783
|
? "judge route is not the measured claude-code route"
|
|
3662
3784
|
: "route plan carries no judge step";
|
|
@@ -3732,7 +3854,7 @@ async function runMaterialityJudge(
|
|
|
3732
3854
|
state.routePlan,
|
|
3733
3855
|
MATERIALITY_STEP_KEY,
|
|
3734
3856
|
undefined,
|
|
3735
|
-
|
|
3857
|
+
profileRoleEffort(activeProfile(input), "judge"),
|
|
3736
3858
|
);
|
|
3737
3859
|
const specs: Array<{ id: string; spec: StepSpec; meta: StepMeta }> = [];
|
|
3738
3860
|
// The owner's file as posting policy, or undefined when it holds nothing of
|
|
@@ -4199,6 +4321,19 @@ async function writePipelinePlan(
|
|
|
4199
4321
|
// a ledger's run ordering into guesswork once already (§2.6).
|
|
4200
4322
|
...(input.engine === undefined ? {} : { engine: input.engine }),
|
|
4201
4323
|
...(input.promptSet === undefined ? {} : { prompt_set: input.promptSet }),
|
|
4324
|
+
// model-profiles S4, additive: the profile's prompt set, laid file by file
|
|
4325
|
+
// over the default one. Absent when the profile names none (`claude`), so
|
|
4326
|
+
// a default run's artifact keeps its keys byte for byte. `prompt_set`
|
|
4327
|
+
// above fingerprints the agent files only; this names the set that every
|
|
4328
|
+
// step's prompt, the engine-owned ones included, was looked up through.
|
|
4329
|
+
...(activeProfile(input).promptSet === undefined
|
|
4330
|
+
? {}
|
|
4331
|
+
: {
|
|
4332
|
+
profile_prompt_set: {
|
|
4333
|
+
profile: activeProfile(input).id,
|
|
4334
|
+
name: activeProfile(input).promptSet,
|
|
4335
|
+
},
|
|
4336
|
+
}),
|
|
4202
4337
|
// C5 O-6. Beside the other two provenance blocks on purpose: the question
|
|
4203
4338
|
// "which inputs made this run what it was" has one place to look.
|
|
4204
4339
|
...(input.config === undefined ? {} : { config: input.config }),
|
|
@@ -4371,8 +4506,8 @@ function resolveModel(
|
|
|
4371
4506
|
// level as intent only, as before.
|
|
4372
4507
|
//
|
|
4373
4508
|
// `roleDefault` is a level, not a StepRole, because the consolidation pass has
|
|
4374
|
-
// its own default (
|
|
4375
|
-
function stepEffortFields(
|
|
4509
|
+
// its own default (the profile's consolidate effort) outside the role table.
|
|
4510
|
+
export function stepEffortFields(
|
|
4376
4511
|
routePlan: ResolvedRoutePlan | undefined,
|
|
4377
4512
|
stepKey: string,
|
|
4378
4513
|
frontmatterEffort: Effort | undefined,
|
|
@@ -4470,7 +4605,7 @@ export function routeSharesPrefix(
|
|
|
4470
4605
|
);
|
|
4471
4606
|
}
|
|
4472
4607
|
|
|
4473
|
-
function routeForStepKey(
|
|
4608
|
+
export function routeForStepKey(
|
|
4474
4609
|
routePlan: ResolvedRoutePlan | undefined,
|
|
4475
4610
|
stepKey: string,
|
|
4476
4611
|
): ResolvedModelRoute | undefined {
|
|
@@ -4480,7 +4615,7 @@ function routeForStepKey(
|
|
|
4480
4615
|
// A step's route AND its fallbacks (S4), from the plan, as StepSpec fields.
|
|
4481
4616
|
// One spread at every site that routes a step, so no site can hand a runner
|
|
4482
4617
|
// the first model without the rest of the list.
|
|
4483
|
-
function stepRouteFields(
|
|
4618
|
+
export function stepRouteFields(
|
|
4484
4619
|
routePlan: ResolvedRoutePlan | undefined,
|
|
4485
4620
|
stepKey: string,
|
|
4486
4621
|
): Pick<StepSpec, "route" | "fallbackRoutes"> {
|