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
package/dist/index.js
CHANGED
|
@@ -203,7 +203,6 @@ var init_claude = __esm(() => {
|
|
|
203
203
|
model: "claude:sonnet-latest",
|
|
204
204
|
effort: "high"
|
|
205
205
|
}),
|
|
206
|
-
scout: Object.freeze({ model: "claude:sonnet-latest", effort: "high" }),
|
|
207
206
|
summary: Object.freeze({ model: "claude:haiku-latest", effort: "high" }),
|
|
208
207
|
judge: Object.freeze({ model: "claude:sonnet-latest", effort: "high" })
|
|
209
208
|
}),
|
|
@@ -231,7 +230,6 @@ var init_openai = __esm(() => {
|
|
|
231
230
|
model: "opencode:openai/gpt-6.1-terra",
|
|
232
231
|
effort: "high"
|
|
233
232
|
}),
|
|
234
|
-
scout: Object.freeze({ model: "opencode:openai/gpt-6.1-terra" }),
|
|
235
233
|
summary: Object.freeze({ model: "opencode:openai/gpt-6-luna" }),
|
|
236
234
|
judge: Object.freeze({ model: "opencode:openai/gpt-6.1-terra" })
|
|
237
235
|
}),
|
|
@@ -321,7 +319,6 @@ var init_profiles = __esm(() => {
|
|
|
321
319
|
"hunter",
|
|
322
320
|
"refuter",
|
|
323
321
|
"consolidate",
|
|
324
|
-
"scout",
|
|
325
322
|
"summary",
|
|
326
323
|
"judge"
|
|
327
324
|
];
|
|
@@ -417,7 +414,6 @@ var init_catalog = __esm(() => {
|
|
|
417
414
|
hunter: profileRoleEffort(FALLBACK_PROFILE, "hunter"),
|
|
418
415
|
refuter: profileRoleEffort(FALLBACK_PROFILE, "refuter"),
|
|
419
416
|
summarizer: profileRoleEffort(FALLBACK_PROFILE, "summary"),
|
|
420
|
-
scout: profileRoleEffort(FALLBACK_PROFILE, "scout"),
|
|
421
417
|
verifier: "high",
|
|
422
418
|
other: "high"
|
|
423
419
|
});
|
|
@@ -602,12 +598,16 @@ function parseModelList(value, where, noEffortReason) {
|
|
|
602
598
|
}
|
|
603
599
|
return result;
|
|
604
600
|
}
|
|
605
|
-
function parseModelsConfig(value) {
|
|
601
|
+
function parseModelsConfig(value, onRemoved) {
|
|
606
602
|
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
607
603
|
throw new ModelNameError("models must be an object from role to a list of models");
|
|
608
604
|
}
|
|
609
605
|
const result = {};
|
|
610
606
|
for (const [role, list] of Object.entries(value)) {
|
|
607
|
+
if (REMOVED_MODEL_ROLES.includes(role)) {
|
|
608
|
+
onRemoved?.(role);
|
|
609
|
+
continue;
|
|
610
|
+
}
|
|
611
611
|
if (!isModelRole(role)) {
|
|
612
612
|
throw new ModelNameError(`models has an unknown role ${quoted(role)}: roles are ${ROLE_LIST}`);
|
|
613
613
|
}
|
|
@@ -627,7 +627,7 @@ function routingNeedsOpenCode(models, profile) {
|
|
|
627
627
|
return false;
|
|
628
628
|
return profileModels(profile).some((model) => model.startsWith(OPENCODE_PREFIX));
|
|
629
629
|
}
|
|
630
|
-
var ModelNameError, CLAUDE_PREFIX = "claude:", OPENCODE_PREFIX = "opencode:", LATEST_SUFFIX = "-latest", CLAUDE_ID_RE, OPENCODE_RE, OPENCODE_EFFORT_RE, CLAUDE_FORMS = "claude:sonnet-latest, claude:opus-latest, claude:haiku-latest, claude:fable-latest or a full claude-* model name", OPENCODE_FORM = "opencode:<provider>/<model>", FIXED_MODEL_ROLES, HUNTER_ROLE_PREFIX = "hunter.", HUNTER_KEY_RE, MAX_MODELS_PER_ROLE = 3, ENTRY_KEYS, ENTRY_FORM = '{"model": "<name>", "effort": "<level>"}', ULTRACODE = "ultracode", JUDGE_NO_EFFORT = "the materiality judge runs at the effort it was measured at, so models.judge takes model names only", ROLE_LIST = "default, hunter.<key>, consolidate,
|
|
630
|
+
var ModelNameError, CLAUDE_PREFIX = "claude:", OPENCODE_PREFIX = "opencode:", LATEST_SUFFIX = "-latest", CLAUDE_ID_RE, OPENCODE_RE, OPENCODE_EFFORT_RE, CLAUDE_FORMS = "claude:sonnet-latest, claude:opus-latest, claude:haiku-latest, claude:fable-latest or a full claude-* model name", OPENCODE_FORM = "opencode:<provider>/<model>", FIXED_MODEL_ROLES, HUNTER_ROLE_PREFIX = "hunter.", HUNTER_KEY_RE, MAX_MODELS_PER_ROLE = 3, ENTRY_KEYS, ENTRY_FORM = '{"model": "<name>", "effort": "<level>"}', ULTRACODE = "ultracode", JUDGE_NO_EFFORT = "the materiality judge runs at the effort it was measured at, so models.judge takes model names only", ROLE_LIST = "default, hunter.<key>, consolidate, judge, refuter, summary", REMOVED_MODEL_ROLES;
|
|
631
631
|
var init_model_name = __esm(() => {
|
|
632
632
|
init_redact();
|
|
633
633
|
init_catalog();
|
|
@@ -640,13 +640,13 @@ var init_model_name = __esm(() => {
|
|
|
640
640
|
FIXED_MODEL_ROLES = [
|
|
641
641
|
"default",
|
|
642
642
|
"consolidate",
|
|
643
|
-
"scout",
|
|
644
643
|
"judge",
|
|
645
644
|
"refuter",
|
|
646
645
|
"summary"
|
|
647
646
|
];
|
|
648
647
|
HUNTER_KEY_RE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
649
648
|
ENTRY_KEYS = ["model", "effort"];
|
|
649
|
+
REMOVED_MODEL_ROLES = ["scout"];
|
|
650
650
|
});
|
|
651
651
|
|
|
652
652
|
// src/model/routing.ts
|
|
@@ -800,16 +800,20 @@ function agentModelRole(agent) {
|
|
|
800
800
|
return "refuter";
|
|
801
801
|
return;
|
|
802
802
|
}
|
|
803
|
-
function
|
|
804
|
-
if (models === undefined)
|
|
805
|
-
return;
|
|
803
|
+
function unknownHunterRoles(models, agents) {
|
|
806
804
|
const hunters = [
|
|
807
805
|
...new Set(agents.filter((agent) => agent.role === "hunter").map((agent) => agent.specialty ?? agent.key))
|
|
808
806
|
];
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
807
|
+
const unknown = Object.keys(models ?? {}).filter((role) => role.startsWith("hunter.") && isModelRole(role) && !hunters.includes(role.slice("hunter.".length)));
|
|
808
|
+
return { hunters, unknown };
|
|
809
|
+
}
|
|
810
|
+
function removedHunterRoles(models, agents) {
|
|
811
|
+
return unknownHunterRoles(models, agents).unknown.filter((role) => REMOVED_HUNTER_ROLES.includes(role));
|
|
812
|
+
}
|
|
813
|
+
function assertHunterRolesExist(models, agents) {
|
|
814
|
+
const { hunters, unknown } = unknownHunterRoles(models, agents);
|
|
815
|
+
for (const role of unknown) {
|
|
816
|
+
if (REMOVED_HUNTER_ROLES.includes(role))
|
|
813
817
|
continue;
|
|
814
818
|
throw new InvalidModelError(`models.${role} names no hunter in this review: its hunters are ${hunters.join(", ")}`);
|
|
815
819
|
}
|
|
@@ -869,19 +873,6 @@ function buildResolvedRoutePlan(input) {
|
|
|
869
873
|
models: input.models
|
|
870
874
|
}));
|
|
871
875
|
}
|
|
872
|
-
if (input.scout) {
|
|
873
|
-
stepRoutes.push(resolveStepRoute({
|
|
874
|
-
stepKey: "scout",
|
|
875
|
-
role: "scout",
|
|
876
|
-
modelRole: "scout",
|
|
877
|
-
cliModel: input.cliModel ?? input.scout.model,
|
|
878
|
-
...input.scout.bundled === true ? {} : {
|
|
879
|
-
frontmatterModel: input.scout.frontmatterModel ?? input.scout.defaultModel
|
|
880
|
-
},
|
|
881
|
-
...profileSeat("scout"),
|
|
882
|
-
models: input.models
|
|
883
|
-
}));
|
|
884
|
-
}
|
|
885
876
|
if (input.consolidate) {
|
|
886
877
|
stepRoutes.push(resolveStepRoute({
|
|
887
878
|
stepKey: "consolidate",
|
|
@@ -904,7 +895,7 @@ function buildResolvedRoutePlan(input) {
|
|
|
904
895
|
}
|
|
905
896
|
return createResolvedRoutePlan(stepRoutes);
|
|
906
897
|
}
|
|
907
|
-
var ModelRoutingError, InvalidModelError, NEW_FORM_PREFIXES, MATERIALITY_STEP_KEY = "materiality", MATERIALITY_JUDGE_MODEL, MEASURED_JUDGE_MODELS;
|
|
898
|
+
var ModelRoutingError, InvalidModelError, NEW_FORM_PREFIXES, REMOVED_HUNTER_ROLES, MATERIALITY_STEP_KEY = "materiality", MATERIALITY_JUDGE_MODEL, MEASURED_JUDGE_MODELS;
|
|
908
899
|
var init_routing = __esm(() => {
|
|
909
900
|
init_model_name();
|
|
910
901
|
init_profiles();
|
|
@@ -913,6 +904,7 @@ var init_routing = __esm(() => {
|
|
|
913
904
|
InvalidModelError = class InvalidModelError extends ModelRoutingError {
|
|
914
905
|
};
|
|
915
906
|
NEW_FORM_PREFIXES = ["claude:", "opencode:"];
|
|
907
|
+
REMOVED_HUNTER_ROLES = ["hunter.parity"];
|
|
916
908
|
MATERIALITY_JUDGE_MODEL = profileModelAlias(profileRoute(FALLBACK_PROFILE, "judge").model);
|
|
917
909
|
MEASURED_JUDGE_MODELS = profileJudgeModels(FALLBACK_PROFILE);
|
|
918
910
|
});
|
|
@@ -1631,20 +1623,15 @@ function commandForms(command) {
|
|
|
1631
1623
|
if (!command.startsWith(`${COMMAND_PREFIX} `)) {
|
|
1632
1624
|
throw new Error(`not a crysk command: ${JSON.stringify(command)}`);
|
|
1633
1625
|
}
|
|
1634
|
-
return [
|
|
1635
|
-
command,
|
|
1636
|
-
LEGACY_COMMAND_PREFIX + command.slice(COMMAND_PREFIX.length)
|
|
1637
|
-
];
|
|
1626
|
+
return [command];
|
|
1638
1627
|
}
|
|
1639
1628
|
function isCommand(text, command) {
|
|
1640
1629
|
const trimmed = text.trim();
|
|
1641
1630
|
return commandForms(command).includes(trimmed);
|
|
1642
1631
|
}
|
|
1643
|
-
function legacyCommand(command) {
|
|
1644
|
-
return commandForms(command)[1];
|
|
1645
|
-
}
|
|
1646
1632
|
function commandHint(command, quote = "`") {
|
|
1647
|
-
|
|
1633
|
+
commandForms(command);
|
|
1634
|
+
return `${quote}${command}${quote}`;
|
|
1648
1635
|
}
|
|
1649
1636
|
function statusContextForms(context) {
|
|
1650
1637
|
if (context !== STATUS_CONTEXT && !context.startsWith(`${STATUS_CONTEXT}/`)) {
|
|
@@ -1662,12 +1649,13 @@ function isLegacyStatusContext(context) {
|
|
|
1662
1649
|
return context === LEGACY_STATUS_CONTEXT || context.startsWith(`${LEGACY_STATUS_CONTEXT}/`);
|
|
1663
1650
|
}
|
|
1664
1651
|
function canonicalStatusText(text) {
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1652
|
+
const commands = text.replace(LEGACY_STATUS_COMMAND, "/crysk $1");
|
|
1653
|
+
if (!commands.startsWith(LEGACY_STATUS_CONTEXT))
|
|
1654
|
+
return commands;
|
|
1655
|
+
const next = commands.charAt(LEGACY_STATUS_CONTEXT.length);
|
|
1668
1656
|
if (next !== ":" && next !== " ")
|
|
1669
|
-
return
|
|
1670
|
-
return STATUS_CONTEXT +
|
|
1657
|
+
return commands;
|
|
1658
|
+
return STATUS_CONTEXT + commands.slice(LEGACY_STATUS_CONTEXT.length);
|
|
1671
1659
|
}
|
|
1672
1660
|
function currentMcpToolName(name) {
|
|
1673
1661
|
return name.startsWith(LEGACY_MCP_TOOL_PREFIX) ? MCP_TOOL_PREFIX + name.slice(LEGACY_MCP_TOOL_PREFIX.length) : name;
|
|
@@ -1675,9 +1663,10 @@ function currentMcpToolName(name) {
|
|
|
1675
1663
|
function isAdmissionCheckRunName(name) {
|
|
1676
1664
|
return name === ADMISSION_CHECK_RUN_NAME || name === LEGACY_ADMISSION_CHECK_RUN_NAME;
|
|
1677
1665
|
}
|
|
1678
|
-
var ENV_PREFIX = "CRYSK_", LEGACY_ENV_PREFIX = "PRHERO_", MARKER_OPEN = "<!-- crysk-", LEGACY_MARKER_OPEN = "<!-- pr-hero-", MARKER_BRAND_PATTERN = "(?:crysk|pr-hero)", COMMAND_PREFIX = "/crysk",
|
|
1666
|
+
var ENV_PREFIX = "CRYSK_", LEGACY_ENV_PREFIX = "PRHERO_", MARKER_OPEN = "<!-- crysk-", LEGACY_MARKER_OPEN = "<!-- pr-hero-", MARKER_BRAND_PATTERN = "(?:crysk|pr-hero)", COMMAND_PREFIX = "/crysk", STATUS_CONTEXT = "crysk", LEGACY_STATUS_CONTEXT = "pr-hero", LOCAL_STATUS_CONTEXT, LEGACY_STATUS_COMMAND, SKILL_NAMES, LEGACY_SKILL_NAMES, MCP_SERVER_KEY = "crysk", LEGACY_MCP_SERVER_KEY = "pr-hero", MCP_TOOL_PREFIX = "crysk_", LEGACY_MCP_TOOL_PREFIX = "prhero_", BIN_NAME = "crysk", LEGACY_BIN_NAME = "pr-hero", WORKFLOW_FILE_NAME = "crysk.yml", LEGACY_WORKFLOW_FILE_NAME = "pr-hero.yml", ADMISSION_CHECK_RUN_NAME = "crysk/ci-admission", LEGACY_ADMISSION_CHECK_RUN_NAME = "pr-hero/ci-admission";
|
|
1679
1667
|
var init_brand = __esm(() => {
|
|
1680
1668
|
LOCAL_STATUS_CONTEXT = `${STATUS_CONTEXT}/local`;
|
|
1669
|
+
LEGACY_STATUS_COMMAND = /\/pr-hero (review|recheck|override|stop)\b/g;
|
|
1681
1670
|
SKILL_NAMES = {
|
|
1682
1671
|
triage: "crysk-loop",
|
|
1683
1672
|
ciSetup: "crysk-ci-setup",
|
|
@@ -1971,7 +1960,7 @@ function parseOutcomeCode(body) {
|
|
|
1971
1960
|
const code = `CRYSK-${heading[1]}`;
|
|
1972
1961
|
return ERROR_CODES.includes(code) ? code : null;
|
|
1973
1962
|
}
|
|
1974
|
-
var ERROR_CODES, CLI_RECORD_FILE = "cli.json", PENDING_AT_FILE = "pending-at", RUN_DIR_FILE = "run-dir", STATUS_DESCRIPTION_MAX = 140, TRANSPORT_CAUSE_LOOKUP, PROVIDER_NAME_PATTERN, MODEL_NAME_PATTERN, FAILURE_CREDENTIAL_LOOKUP, OPENCODE_FAILURE_CREDENTIAL_RE, FAILURE_DETAIL_MAX = 160, FAILURE_DETAIL_PATTERN, RECORD_PARAM_KEYS, CLI_OUTCOMES, CLI_SKIPS, CLI_HEAD_PATTERN, ENGINE_DEFECT_ISSUE = 'gh issue create -R cryskai/crysk --title "CRYSK-ENGINE-DEFECT {detail}" --body "{runUrl}"', RERUN_FAILED = "$ gh run rerun {runId} --failed", REVIEW_AGAIN = '$ gh pr comment {pr} --body "/crysk review"',
|
|
1963
|
+
var ERROR_CODES, CLI_RECORD_FILE = "cli.json", PENDING_AT_FILE = "pending-at", RUN_DIR_FILE = "run-dir", STATUS_DESCRIPTION_MAX = 140, TRANSPORT_CAUSE_LOOKUP, PROVIDER_NAME_PATTERN, MODEL_NAME_PATTERN, FAILURE_CREDENTIAL_LOOKUP, OPENCODE_FAILURE_CREDENTIAL_RE, FAILURE_DETAIL_MAX = 160, FAILURE_DETAIL_PATTERN, RECORD_PARAM_KEYS, CLI_OUTCOMES, CLI_SKIPS, CLI_HEAD_PATTERN, ENGINE_DEFECT_ISSUE = 'gh issue create -R cryskai/crysk --title "CRYSK-ENGINE-DEFECT {detail}" --body "{runUrl}"', RERUN_FAILED = "$ gh run rerun {runId} --failed", REVIEW_AGAIN = '$ gh pr comment {pr} --body "/crysk review"', OPENCODE_API_KEY_SECRET = "$ gh secret set CRYSK_OPENCODE_<PROVIDER>_API_KEY", OPENCODE_PROVIDER_TOKEN_NOTE = "<PROVIDER> is the provider id uppercased with `-` and `.` as `_` (`deepseek` is DEEPSEEK).", OPENAI_OAUTH_SECRET = "$ jq -c .openai ~/.local/share/opencode/auth.json | base64 -w0 | gh secret set CRYSK_OPENCODE_OPENAI_OAUTH", CRED_STORE_WHY = "the credential store does not hold what this route needs", CLAUDE_SUBSCRIPTION_FIXES, OPENAI_API_KEY_INSTEAD = "Or bill per token: set CRYSK_OPENCODE_OPENAI_API_KEY and stop passing {secret} in the crysk-secrets input (the subscription is used while it is passed):", OPENCODE_SUBSCRIPTION_FIXES, CRYSK_SECRETS_FIXES, EMPTY_SLOT_DETAIL = "CRYSK_OPENCODE__API_KEY has a value but no provider: an unused OpenCode slot must be empty", EMPTY_SLOT_FIXES, UNSUPPORTED_OAUTH_DETAIL_RE, MODEL_NOT_SERVED, PROVIDER_REFUSED_WHY = "the provider's safety system declined this input", UNCLASSIFIED_FIXES, UNCLASSIFIED_FIX = "re-run the failed jobs with `gh run rerun {runId} --failed`", GITHUB_TOKEN_INPUT, CLAUDE_CREDENTIAL_FIXES, OPENCODE_CREDENTIAL_FIXES, MODELS_INPUT_LINE, PROFILE_INPUT_LINE, CREDENTIALS_INPUT_LINE, REMOVED_INPUT_FIXES, PROVIDER_LIMITED, CREDENTIAL_UNUSABLE_ENV, RUNTIME_LOCAL, GITHUB_SERVER, ERROR_CATALOG, OUTCOME_MARKER_PREFIX;
|
|
1975
1964
|
var init_outcome = __esm(() => {
|
|
1976
1965
|
init_brand();
|
|
1977
1966
|
ERROR_CODES = [
|
|
@@ -2131,11 +2120,7 @@ var init_outcome = __esm(() => {
|
|
|
2131
2120
|
];
|
|
2132
2121
|
PROVIDER_LIMITED = {
|
|
2133
2122
|
why: "the provider has throttled this account or key, so an immediate retry would fail the same way",
|
|
2134
|
-
fixes: [
|
|
2135
|
-
"Wait, or raise the quota, then ask for a new review:",
|
|
2136
|
-
REVIEW_AGAIN,
|
|
2137
|
-
LEGACY_REVIEW_NOTE
|
|
2138
|
-
],
|
|
2123
|
+
fixes: ["Wait, or raise the quota, then ask for a new review:", REVIEW_AGAIN],
|
|
2139
2124
|
annotationFix: `wait for the limit to reset or raise the quota, then comment ${commandHint("/crysk review", "")} on the PR`
|
|
2140
2125
|
};
|
|
2141
2126
|
CREDENTIAL_UNUSABLE_ENV = {
|
|
@@ -2225,8 +2210,7 @@ var init_outcome = __esm(() => {
|
|
|
2225
2210
|
"$ gh secret set {secret}",
|
|
2226
2211
|
"Or run on the subscription: set CRYSK_CLAUDE_OAUTH_TOKEN and put subscription first in `credentials.claude` (the default order).",
|
|
2227
2212
|
"Then ask for a new review:",
|
|
2228
|
-
REVIEW_AGAIN
|
|
2229
|
-
LEGACY_REVIEW_NOTE
|
|
2213
|
+
REVIEW_AGAIN
|
|
2230
2214
|
],
|
|
2231
2215
|
annotationFix: "create a new key and run `gh secret set {secret}`, or set CRYSK_CLAUDE_OAUTH_TOKEN and put subscription first in `credentials.claude` (the default order)"
|
|
2232
2216
|
},
|
|
@@ -2235,8 +2219,7 @@ var init_outcome = __esm(() => {
|
|
|
2235
2219
|
fixes: [
|
|
2236
2220
|
"$ claude setup-token && gh secret set {secret}",
|
|
2237
2221
|
"Then ask for a new review:",
|
|
2238
|
-
REVIEW_AGAIN
|
|
2239
|
-
LEGACY_REVIEW_NOTE
|
|
2222
|
+
REVIEW_AGAIN
|
|
2240
2223
|
],
|
|
2241
2224
|
annotationFix: "log in again with `claude setup-token` and set `{secret}` (`gh secret set {secret}`)"
|
|
2242
2225
|
},
|
|
@@ -2246,8 +2229,7 @@ var init_outcome = __esm(() => {
|
|
|
2246
2229
|
"Create a new key with the provider and set it:",
|
|
2247
2230
|
"$ gh secret set {secret}",
|
|
2248
2231
|
"Then ask for a new review:",
|
|
2249
|
-
REVIEW_AGAIN
|
|
2250
|
-
LEGACY_REVIEW_NOTE
|
|
2232
|
+
REVIEW_AGAIN
|
|
2251
2233
|
],
|
|
2252
2234
|
annotationFix: "create a new key with the provider and run `gh secret set {secret}`"
|
|
2253
2235
|
},
|
|
@@ -2260,8 +2242,7 @@ var init_outcome = __esm(() => {
|
|
|
2260
2242
|
OPENAI_API_KEY_INSTEAD,
|
|
2261
2243
|
"$ gh secret set CRYSK_OPENCODE_OPENAI_API_KEY",
|
|
2262
2244
|
"Then ask for a new review:",
|
|
2263
|
-
REVIEW_AGAIN
|
|
2264
|
-
LEGACY_REVIEW_NOTE
|
|
2245
|
+
REVIEW_AGAIN
|
|
2265
2246
|
],
|
|
2266
2247
|
annotationFix: "log in again with `opencode auth login`, choose ChatGPT and set {secret} from its record, or set CRYSK_OPENCODE_OPENAI_API_KEY and stop passing {secret} to bill per token"
|
|
2267
2248
|
},
|
|
@@ -2274,8 +2255,7 @@ var init_outcome = __esm(() => {
|
|
|
2274
2255
|
"Or, for OpenCode, set the provider's key again:",
|
|
2275
2256
|
OPENCODE_API_KEY_SECRET,
|
|
2276
2257
|
"Then ask for a new review:",
|
|
2277
|
-
REVIEW_AGAIN
|
|
2278
|
-
LEGACY_REVIEW_NOTE
|
|
2258
|
+
REVIEW_AGAIN
|
|
2279
2259
|
],
|
|
2280
2260
|
annotationFix: "replace the credential in {secret} with a new one, then run `gh secret set {secret}`"
|
|
2281
2261
|
}
|
|
@@ -2493,8 +2473,7 @@ var init_outcome = __esm(() => {
|
|
|
2493
2473
|
fixes: [
|
|
2494
2474
|
"Add credit to the Anthropic account behind the API key (Claude Console \u2192 Plans & Billing), or run on the subscription: set CRYSK_CLAUDE_OAUTH_TOKEN and put subscription first in `credentials.claude` (the default order).",
|
|
2495
2475
|
"Then ask for a new review:",
|
|
2496
|
-
REVIEW_AGAIN
|
|
2497
|
-
LEGACY_REVIEW_NOTE
|
|
2476
|
+
REVIEW_AGAIN
|
|
2498
2477
|
],
|
|
2499
2478
|
annotationFix: "add credit to the Anthropic account behind the API key (Claude Console \u2192 Plans & Billing), or set CRYSK_CLAUDE_OAUTH_TOKEN and put subscription first in `credentials.claude` (the default order)"
|
|
2500
2479
|
},
|
|
@@ -2504,7 +2483,6 @@ var init_outcome = __esm(() => {
|
|
|
2504
2483
|
fixes: [
|
|
2505
2484
|
"Re-run after the limit resets (the reset time is in the sentence above):",
|
|
2506
2485
|
REVIEW_AGAIN,
|
|
2507
|
-
LEGACY_REVIEW_NOTE,
|
|
2508
2486
|
"Or bill per token: set CRYSK_CLAUDE_API_KEY and put api_key first in `credentials.claude` (the default order uses the subscription while it is set):",
|
|
2509
2487
|
"$ gh secret set CRYSK_CLAUDE_API_KEY"
|
|
2510
2488
|
],
|
|
@@ -2516,7 +2494,6 @@ var init_outcome = __esm(() => {
|
|
|
2516
2494
|
fixes: [
|
|
2517
2495
|
"Wait for the limit to reset, or add credit or raise the quota on the provider account behind the key, then ask for a new review:",
|
|
2518
2496
|
REVIEW_AGAIN,
|
|
2519
|
-
LEGACY_REVIEW_NOTE,
|
|
2520
2497
|
"Or set a key from an account that has quota:",
|
|
2521
2498
|
"$ gh secret set {secret}"
|
|
2522
2499
|
],
|
|
@@ -2528,7 +2505,6 @@ var init_outcome = __esm(() => {
|
|
|
2528
2505
|
fixes: [
|
|
2529
2506
|
"Re-run after the limit resets:",
|
|
2530
2507
|
REVIEW_AGAIN,
|
|
2531
|
-
LEGACY_REVIEW_NOTE,
|
|
2532
2508
|
OPENAI_API_KEY_INSTEAD,
|
|
2533
2509
|
"$ gh secret set CRYSK_OPENCODE_OPENAI_API_KEY"
|
|
2534
2510
|
],
|
|
@@ -2546,12 +2522,7 @@ var init_outcome = __esm(() => {
|
|
|
2546
2522
|
level: "error",
|
|
2547
2523
|
owner: "provider",
|
|
2548
2524
|
what: "the request was refused",
|
|
2549
|
-
variants: single(PROVIDER_REFUSED_WHY, [
|
|
2550
|
-
"Ask for a new review once:",
|
|
2551
|
-
REVIEW_AGAIN,
|
|
2552
|
-
LEGACY_REVIEW_NOTE,
|
|
2553
|
-
"If it repeats, report it."
|
|
2554
|
-
], "ask for a new review once, and report it if the provider refuses again")
|
|
2525
|
+
variants: single(PROVIDER_REFUSED_WHY, ["Ask for a new review once:", REVIEW_AGAIN, "If it repeats, report it."], "ask for a new review once, and report it if the provider refuses again")
|
|
2555
2526
|
},
|
|
2556
2527
|
"CRYSK-ENGINE-DEFECT": {
|
|
2557
2528
|
level: "error",
|
|
@@ -2578,8 +2549,7 @@ var init_outcome = __esm(() => {
|
|
|
2578
2549
|
why: "the review input is too large for the model, so every hunter was refused and a re-run would send the same request",
|
|
2579
2550
|
fixes: [
|
|
2580
2551
|
"Lower `max-changed-lines` in the workflow's `with:` block (or `max_changed_lines` in the repo config), or exclude paths in `.cryskignore` (`.prheroignore` in a repo set up before the rename), then ask for a new review:",
|
|
2581
|
-
REVIEW_AGAIN
|
|
2582
|
-
LEGACY_REVIEW_NOTE
|
|
2552
|
+
REVIEW_AGAIN
|
|
2583
2553
|
],
|
|
2584
2554
|
annotationFix: "lower `max-changed-lines` (or `max_changed_lines` in the repo config) or exclude paths in `.cryskignore` (`.prheroignore` before the rename)"
|
|
2585
2555
|
}
|
|
@@ -2609,11 +2579,7 @@ var init_outcome = __esm(() => {
|
|
|
2609
2579
|
lead: "Not reviewed:",
|
|
2610
2580
|
headline: "CRYSK-CANCELLED: not reviewed",
|
|
2611
2581
|
what: "The review was cancelled or superseded by a newer push",
|
|
2612
|
-
variants: single("a newer run replaces this one, so this result would describe an outdated head", [
|
|
2613
|
-
"Ask for a review of the current head:",
|
|
2614
|
-
REVIEW_AGAIN,
|
|
2615
|
-
LEGACY_REVIEW_NOTE
|
|
2616
|
-
], 'ask for a review of the current head with `gh pr comment {pr} --body "/crysk review"` (or "/pr-hero review" on a workflow set up before the rename)')
|
|
2582
|
+
variants: single("a newer run replaces this one, so this result would describe an outdated head", ["Ask for a review of the current head:", REVIEW_AGAIN], 'ask for a review of the current head with `gh pr comment {pr} --body "/crysk review"`')
|
|
2617
2583
|
}
|
|
2618
2584
|
};
|
|
2619
2585
|
OUTCOME_MARKER_PREFIX = `${MARKER_OPEN}outcome `;
|
|
@@ -2835,10 +2801,6 @@ var init_consolidate = () => {};
|
|
|
2835
2801
|
var deep_review_logic_default = "./deep-review-logic-fck5z4xe.md";
|
|
2836
2802
|
var init_deep_review_logic = () => {};
|
|
2837
2803
|
|
|
2838
|
-
// prompts/default/deep-review-parity.md
|
|
2839
|
-
var deep_review_parity_default = "./deep-review-parity-bwwe7cx6.md";
|
|
2840
|
-
var init_deep_review_parity = () => {};
|
|
2841
|
-
|
|
2842
2804
|
// prompts/default/deep-review-reliability.md
|
|
2843
2805
|
var deep_review_reliability_default = "./deep-review-reliability-ec7b5pbk.md";
|
|
2844
2806
|
var init_deep_review_reliability = () => {};
|
|
@@ -2859,10 +2821,6 @@ var init_review_refuter = () => {};
|
|
|
2859
2821
|
var materiality_default = "./materiality-f1qwnvg1.md";
|
|
2860
2822
|
var init_materiality2 = () => {};
|
|
2861
2823
|
|
|
2862
|
-
// prompts/scout.md
|
|
2863
|
-
var scout_default = "./scout-yvp153q7.md";
|
|
2864
|
-
var init_scout = () => {};
|
|
2865
|
-
|
|
2866
2824
|
// prompts/summarizer.md
|
|
2867
2825
|
var summarizer_default = "./summarizer-zca44nxa.md";
|
|
2868
2826
|
var init_summarizer = () => {};
|
|
@@ -2872,7 +2830,7 @@ var verifier_default = "./verifier-xf4xj701.md";
|
|
|
2872
2830
|
var init_verifier = () => {};
|
|
2873
2831
|
|
|
2874
2832
|
// skills/crysk/SKILL.md
|
|
2875
|
-
var SKILL_default = "./SKILL-
|
|
2833
|
+
var SKILL_default = "./SKILL-d1nzkhhr.md";
|
|
2876
2834
|
var init_SKILL = () => {};
|
|
2877
2835
|
|
|
2878
2836
|
// skills/crysk-ci-setup/assets/admission-config.example.json
|
|
@@ -2880,7 +2838,7 @@ var admission_config_example_default = "./admission-config.example-a9vqmmad.json
|
|
|
2880
2838
|
var init_admission_config_example = () => {};
|
|
2881
2839
|
|
|
2882
2840
|
// skills/crysk-ci-setup/assets/workflow.yml
|
|
2883
|
-
var workflow_default = "./workflow-
|
|
2841
|
+
var workflow_default = "./workflow-andv2dvm.yml";
|
|
2884
2842
|
var init_workflow = () => {};
|
|
2885
2843
|
|
|
2886
2844
|
// skills/crysk-ci-setup/references/ci-admission.md
|
|
@@ -2888,11 +2846,11 @@ var ci_admission_default = "./ci-admission-qn797a6c.md";
|
|
|
2888
2846
|
var init_ci_admission = () => {};
|
|
2889
2847
|
|
|
2890
2848
|
// skills/crysk-ci-setup/references/opencode-ci.md
|
|
2891
|
-
var opencode_ci_default = "./opencode-ci-
|
|
2849
|
+
var opencode_ci_default = "./opencode-ci-rdpcc7xc.md";
|
|
2892
2850
|
var init_opencode_ci = () => {};
|
|
2893
2851
|
|
|
2894
2852
|
// skills/crysk-ci-setup/SKILL.md
|
|
2895
|
-
var SKILL_default2 = "./SKILL-
|
|
2853
|
+
var SKILL_default2 = "./SKILL-4747bhne.md";
|
|
2896
2854
|
var init_SKILL2 = () => {};
|
|
2897
2855
|
|
|
2898
2856
|
// skills/crysk-loop/adjudicator.md
|
|
@@ -2900,25 +2858,23 @@ var adjudicator_default = "./adjudicator-eckqh14e.md";
|
|
|
2900
2858
|
var init_adjudicator = () => {};
|
|
2901
2859
|
|
|
2902
2860
|
// skills/crysk-loop/SKILL.md
|
|
2903
|
-
var SKILL_default3 = "./SKILL-
|
|
2861
|
+
var SKILL_default3 = "./SKILL-zze8zj5g.md";
|
|
2904
2862
|
var init_SKILL3 = () => {};
|
|
2905
2863
|
|
|
2906
2864
|
// skills/crysk-pr/SKILL.md
|
|
2907
|
-
var SKILL_default4 = "./SKILL-
|
|
2865
|
+
var SKILL_default4 = "./SKILL-rec41991.md";
|
|
2908
2866
|
var init_SKILL4 = () => {};
|
|
2909
2867
|
|
|
2910
2868
|
// src/asset-manifest.ts
|
|
2911
|
-
var BUNDLED_AGENT_FILES, PROFILE_PROMPT_FILES, CONSOLIDATE_PROMPT_PATH, MATERIALITY_PROMPT_PATH,
|
|
2869
|
+
var BUNDLED_AGENT_FILES, PROFILE_PROMPT_FILES, CONSOLIDATE_PROMPT_PATH, MATERIALITY_PROMPT_PATH, SUMMARIZER_PROMPT_PATH, VERIFIER_PROMPT_PATH, TRIAGE_SKILL_FILES, CI_SETUP_SKILL_FILES, PR_SKILL_FILES, GENERAL_SKILL_FILES;
|
|
2912
2870
|
var init_asset_manifest = __esm(() => {
|
|
2913
2871
|
init_consolidate();
|
|
2914
2872
|
init_deep_review_logic();
|
|
2915
|
-
init_deep_review_parity();
|
|
2916
2873
|
init_deep_review_reliability();
|
|
2917
2874
|
init_deep_review_resilience();
|
|
2918
2875
|
init_deep_review_security();
|
|
2919
2876
|
init_review_refuter();
|
|
2920
2877
|
init_materiality2();
|
|
2921
|
-
init_scout();
|
|
2922
2878
|
init_summarizer();
|
|
2923
2879
|
init_verifier();
|
|
2924
2880
|
init_SKILL();
|
|
@@ -2932,7 +2888,6 @@ var init_asset_manifest = __esm(() => {
|
|
|
2932
2888
|
init_SKILL4();
|
|
2933
2889
|
BUNDLED_AGENT_FILES = {
|
|
2934
2890
|
"deep-review-logic.md": deep_review_logic_default,
|
|
2935
|
-
"deep-review-parity.md": deep_review_parity_default,
|
|
2936
2891
|
"deep-review-reliability.md": deep_review_reliability_default,
|
|
2937
2892
|
"deep-review-resilience.md": deep_review_resilience_default,
|
|
2938
2893
|
"deep-review-security.md": deep_review_security_default,
|
|
@@ -2941,7 +2896,6 @@ var init_asset_manifest = __esm(() => {
|
|
|
2941
2896
|
PROFILE_PROMPT_FILES = {};
|
|
2942
2897
|
CONSOLIDATE_PROMPT_PATH = consolidate_default;
|
|
2943
2898
|
MATERIALITY_PROMPT_PATH = materiality_default;
|
|
2944
|
-
SCOUT_PROMPT_PATH = scout_default;
|
|
2945
2899
|
SUMMARIZER_PROMPT_PATH = summarizer_default;
|
|
2946
2900
|
VERIFIER_PROMPT_PATH = verifier_default;
|
|
2947
2901
|
TRIAGE_SKILL_FILES = {
|
|
@@ -3017,7 +2971,6 @@ function resolveEngineAssets() {
|
|
|
3017
2971
|
defaultAgentsDir,
|
|
3018
2972
|
consolidatePromptPath: resolveBundledFilePath(CONSOLIDATE_PROMPT_PATH),
|
|
3019
2973
|
materialityPromptPath: resolveBundledFilePath(MATERIALITY_PROMPT_PATH),
|
|
3020
|
-
scoutPromptPath: resolveBundledFilePath(SCOUT_PROMPT_PATH),
|
|
3021
2974
|
summarizerPromptPath: resolveBundledFilePath(SUMMARIZER_PROMPT_PATH),
|
|
3022
2975
|
verifierPromptPath: resolveBundledFilePath(VERIFIER_PROMPT_PATH),
|
|
3023
2976
|
triageSkillFiles: resolveBundledFileMap(TRIAGE_SKILL_FILES),
|
|
@@ -3152,12 +3105,10 @@ var init_prompt_set = __esm(() => {
|
|
|
3152
3105
|
AGENT_NAMES = [
|
|
3153
3106
|
"deep-review-reliability",
|
|
3154
3107
|
"deep-review-resilience",
|
|
3155
|
-
"deep-review-parity",
|
|
3156
3108
|
"review-refuter"
|
|
3157
3109
|
];
|
|
3158
3110
|
ENGINE_PROMPT_FILES = [
|
|
3159
3111
|
"consolidate.md",
|
|
3160
|
-
"scout.md",
|
|
3161
3112
|
"summarizer.md",
|
|
3162
3113
|
"materiality.md",
|
|
3163
3114
|
"verifier.md"
|
|
@@ -5235,6 +5186,14 @@ import path11 from "path";
|
|
|
5235
5186
|
function isCiEnvironment(options, env) {
|
|
5236
5187
|
return Boolean(env.GITHUB_ACTIONS || env.CI || options.ci);
|
|
5237
5188
|
}
|
|
5189
|
+
function removedFlagWarnings(options) {
|
|
5190
|
+
return (options.removedFlags ?? []).map((flag) => `${flag} ${SCOUT_REMOVED}`);
|
|
5191
|
+
}
|
|
5192
|
+
function noteRemovedFlag(options, flag) {
|
|
5193
|
+
const seen = options.removedFlags ?? [];
|
|
5194
|
+
if (!seen.includes(flag))
|
|
5195
|
+
options.removedFlags = [...seen, flag];
|
|
5196
|
+
}
|
|
5238
5197
|
function parseArgs(argv) {
|
|
5239
5198
|
const options = {
|
|
5240
5199
|
repo: ".",
|
|
@@ -5309,12 +5268,8 @@ function parseArgs(argv) {
|
|
|
5309
5268
|
options.summary = false;
|
|
5310
5269
|
continue;
|
|
5311
5270
|
}
|
|
5312
|
-
if (arg === "--scout") {
|
|
5313
|
-
options
|
|
5314
|
-
continue;
|
|
5315
|
-
}
|
|
5316
|
-
if (arg === "--no-scout") {
|
|
5317
|
-
options.scout = false;
|
|
5271
|
+
if (arg === "--scout" || arg === "--no-scout") {
|
|
5272
|
+
noteRemovedFlag(options, arg);
|
|
5318
5273
|
continue;
|
|
5319
5274
|
}
|
|
5320
5275
|
if (arg === "--no-shared-prefix") {
|
|
@@ -5540,15 +5495,9 @@ function parseArgs(argv) {
|
|
|
5540
5495
|
if (command === "ci" && options.ciSubcommand === undefined) {
|
|
5541
5496
|
throw new CliUsageError('the "ci" command requires a subcommand: "ci init"');
|
|
5542
5497
|
}
|
|
5543
|
-
if (command !== "review" && (options.scout !== undefined || options.scoutModel)) {
|
|
5544
|
-
throw new CliUsageError("--scout and --scout-model only apply to the review command");
|
|
5545
|
-
}
|
|
5546
5498
|
if (command !== "review" && options.full) {
|
|
5547
5499
|
throw new CliUsageError("--full only applies to the review command");
|
|
5548
5500
|
}
|
|
5549
|
-
if (options.scoutModel !== undefined && !options.scout) {
|
|
5550
|
-
throw new CliUsageError("--scout-model sets the model for the scout stage, so it requires --scout");
|
|
5551
|
-
}
|
|
5552
5501
|
if (command === "status") {
|
|
5553
5502
|
if (options.pr === undefined || options.pr === "current") {
|
|
5554
5503
|
throw new CliUsageError("status requires --pr <n> (a PR number)");
|
|
@@ -5573,7 +5522,7 @@ function parseArgs(argv) {
|
|
|
5573
5522
|
if (options.pr === undefined) {
|
|
5574
5523
|
throw new CliUsageError(`${command} requires --pr <n>`);
|
|
5575
5524
|
}
|
|
5576
|
-
if (options.from === undefined) {
|
|
5525
|
+
if (command === "post" && options.from === undefined) {
|
|
5577
5526
|
throw new CliUsageError(`${command} requires --from <run-dir>`);
|
|
5578
5527
|
}
|
|
5579
5528
|
} else if (options.from !== undefined) {
|
|
@@ -5726,7 +5675,7 @@ function applyValueFlag(options, flag, value) {
|
|
|
5726
5675
|
options.model = value;
|
|
5727
5676
|
return;
|
|
5728
5677
|
case "--scout-model":
|
|
5729
|
-
options
|
|
5678
|
+
noteRemovedFlag(options, flag);
|
|
5730
5679
|
return;
|
|
5731
5680
|
case "--from":
|
|
5732
5681
|
options.from = value;
|
|
@@ -6003,6 +5952,9 @@ function assertBasenameOnly(file, index) {
|
|
|
6003
5952
|
throw new CliUsageError(`spec.agents[${index}].file must be a plain basename (no "/", "\\", "..", or absolute paths), got: ${JSON.stringify(file)}`);
|
|
6004
5953
|
}
|
|
6005
5954
|
}
|
|
5955
|
+
function ignoredAgentFileWarnings(specFiles, presentFiles) {
|
|
5956
|
+
return [...IGNORED_AGENT_FILES].filter((file) => presentFiles.includes(file) && !specFiles.includes(file)).map((file) => `${file} ${PARITY_REMOVED}`);
|
|
5957
|
+
}
|
|
6006
5958
|
function agentsDirProblems(specFiles, presentFiles) {
|
|
6007
5959
|
const problems = [];
|
|
6008
5960
|
const present = new Set(presentFiles);
|
|
@@ -6013,7 +5965,7 @@ function agentsDirProblems(specFiles, presentFiles) {
|
|
|
6013
5965
|
}
|
|
6014
5966
|
}
|
|
6015
5967
|
for (const file of presentFiles) {
|
|
6016
|
-
if (!named.has(file)) {
|
|
5968
|
+
if (!named.has(file) && !IGNORED_AGENT_FILES.has(file)) {
|
|
6017
5969
|
problems.push(`the dir has "${file}" but no agent in the spec references it (it would never run)${RETIRED_AGENT_HINTS[file] ?? ""}`);
|
|
6018
5970
|
}
|
|
6019
5971
|
}
|
|
@@ -6061,6 +6013,7 @@ async function preflightAgentsDir(agents, specFiles) {
|
|
|
6061
6013
|
` + problems.map((p) => ` - ${p}`).join(`
|
|
6062
6014
|
`), { cls: { kind: "prompt-set" } });
|
|
6063
6015
|
}
|
|
6016
|
+
return ignoredAgentFileWarnings(specFiles, [...present]);
|
|
6064
6017
|
}
|
|
6065
6018
|
function parseExtraHunters(read) {
|
|
6066
6019
|
if (read === undefined)
|
|
@@ -6098,12 +6051,6 @@ function localReviewSpec(env = process.env) {
|
|
|
6098
6051
|
{ key: "resilience", file: "deep-review-resilience.md", role: "hunter" },
|
|
6099
6052
|
{ key: "logic", file: "deep-review-logic.md", role: "hunter" },
|
|
6100
6053
|
{ key: "security", file: "deep-review-security.md", role: "hunter" },
|
|
6101
|
-
{
|
|
6102
|
-
key: "parity",
|
|
6103
|
-
file: "deep-review-parity.md",
|
|
6104
|
-
role: "hunter",
|
|
6105
|
-
trigger: "input"
|
|
6106
|
-
},
|
|
6107
6054
|
...withUsageClass({ kind: "config-parse", source: "extra-hunters" }, () => parseExtraHunters(readBrandEnv(env, "EXTRA_HUNTERS"))),
|
|
6108
6055
|
{ key: "refuter", file: "review-refuter.md", role: "refuter" }
|
|
6109
6056
|
]
|
|
@@ -6141,6 +6088,14 @@ function parseConfigLayer(raw, file, admitted, isRepoFile, warnings) {
|
|
|
6141
6088
|
if (key === "routing") {
|
|
6142
6089
|
throw new CliUsageError(`${file}: ${REMOVED_ROUTING_MESSAGE}`);
|
|
6143
6090
|
}
|
|
6091
|
+
if (key === "scout") {
|
|
6092
|
+
warnings?.push(`${file}: scout ${SCOUT_REMOVED}`);
|
|
6093
|
+
continue;
|
|
6094
|
+
}
|
|
6095
|
+
if (key === "parity_trigger_paths") {
|
|
6096
|
+
warnings?.push(`${file}: parity_trigger_paths ${PARITY_REMOVED}`);
|
|
6097
|
+
continue;
|
|
6098
|
+
}
|
|
6144
6099
|
if (!KNOWN_CONFIG_KEYS.has(key)) {
|
|
6145
6100
|
throw new CliUsageError(`${file} unknown key: ${redactConfigValue(key)}`);
|
|
6146
6101
|
}
|
|
@@ -6151,10 +6106,6 @@ function parseConfigLayer(raw, file, admitted, isRepoFile, warnings) {
|
|
|
6151
6106
|
throw new CliUsageError(`${file}: ${key} is a per-repo key \u2014 put it in the repo config ` + "(<repo>/.crysk/config.json, or <repo>/.prhero/config.json in a repo set up before the rename)");
|
|
6152
6107
|
}
|
|
6153
6108
|
}
|
|
6154
|
-
const triggers = config.parity_trigger_paths ?? [];
|
|
6155
|
-
if (!Array.isArray(triggers) || !triggers.every((p) => typeof p === "string" && p.length > 0)) {
|
|
6156
|
-
throw new CliUsageError(`${file} parity_trigger_paths must be an array of non-empty strings`);
|
|
6157
|
-
}
|
|
6158
6109
|
const priors = config.suspicion_priors ?? [];
|
|
6159
6110
|
if (!Array.isArray(priors)) {
|
|
6160
6111
|
throw new CliUsageError(`${file} suspicion_priors must be an array`);
|
|
@@ -6177,7 +6128,7 @@ function parseConfigLayer(raw, file, admitted, isRepoFile, warnings) {
|
|
|
6177
6128
|
const profile = parseProfile(config.profile, file);
|
|
6178
6129
|
const summaryParse = parseSummaryConfig(config.summary, file);
|
|
6179
6130
|
const summary = summaryParse?.summary;
|
|
6180
|
-
let models = parseModels(config.models, file);
|
|
6131
|
+
let models = parseModels(config.models, file, warnings);
|
|
6181
6132
|
if (summaryParse?.initModel === true) {
|
|
6182
6133
|
if (isRepoFile) {
|
|
6183
6134
|
warnings?.push(`${file}: summary.model is gone and is ignored here: the summary model is set per person, under models.summary in your person config (~/.crysk/config.json). Delete summary.model from this file.`);
|
|
@@ -6200,7 +6151,6 @@ function parseConfigLayer(raw, file, admitted, isRepoFile, warnings) {
|
|
|
6200
6151
|
const maxConcurrentSteps = parsePositiveInteger(config.max_concurrent_steps, "max_concurrent_steps", file);
|
|
6201
6152
|
const maxChangedLines = parseNonNegativeInteger(config.max_changed_lines, "max_changed_lines", file);
|
|
6202
6153
|
const maxChangedFiles = parseNonNegativeInteger(config.max_changed_files, "max_changed_files", file);
|
|
6203
|
-
const scout = parseOptionalBoolean(config.scout, "scout", file);
|
|
6204
6154
|
const materialityGate = parseOptionalBoolean(config.materiality_gate, "materiality_gate", file);
|
|
6205
6155
|
const post = parseOptionalBoolean(config.post, "post", file);
|
|
6206
6156
|
const postMinSeverity = parsePostMinSeverity(config.post_min_severity, file);
|
|
@@ -6216,7 +6166,6 @@ function parseConfigLayer(raw, file, admitted, isRepoFile, warnings) {
|
|
|
6216
6166
|
}
|
|
6217
6167
|
const ciAdmissionObserveOnly = parseOptionalBoolean(config.ci_admission_observe_only, "ci_admission_observe_only", file);
|
|
6218
6168
|
return {
|
|
6219
|
-
...given(config.parity_trigger_paths) ? { parity_trigger_paths: triggers } : {},
|
|
6220
6169
|
...given(config.suspicion_priors) ? { suspicion_priors: priors } : {},
|
|
6221
6170
|
...optionalString(config, "agents_dir", file),
|
|
6222
6171
|
...optionalString(config, "default_base", file),
|
|
@@ -6228,7 +6177,6 @@ function parseConfigLayer(raw, file, admitted, isRepoFile, warnings) {
|
|
|
6228
6177
|
...maxConcurrentSteps === undefined ? {} : { max_concurrent_steps: maxConcurrentSteps },
|
|
6229
6178
|
...maxChangedLines === undefined ? {} : { max_changed_lines: maxChangedLines },
|
|
6230
6179
|
...maxChangedFiles === undefined ? {} : { max_changed_files: maxChangedFiles },
|
|
6231
|
-
...scout === undefined ? {} : { scout },
|
|
6232
6180
|
...materialityGate === undefined ? {} : { materiality_gate: materialityGate },
|
|
6233
6181
|
...post === undefined ? {} : { post },
|
|
6234
6182
|
...postMinSeverity === undefined ? {} : { post_min_severity: postMinSeverity },
|
|
@@ -6251,11 +6199,16 @@ function parseProfile(value, file) {
|
|
|
6251
6199
|
const got = typeof value === "string" ? ` (got "${redactConfigValue(value)}")` : "";
|
|
6252
6200
|
throw new CliUsageError(`${file} ${problem}${got}`);
|
|
6253
6201
|
}
|
|
6254
|
-
function parseModels(value, file) {
|
|
6202
|
+
function parseModels(value, file, warnings) {
|
|
6255
6203
|
if (value === undefined)
|
|
6256
6204
|
return;
|
|
6257
6205
|
try {
|
|
6258
|
-
|
|
6206
|
+
const removed = [];
|
|
6207
|
+
const models = parseModelsConfig(value, (role) => removed.push(role));
|
|
6208
|
+
for (const role of removed) {
|
|
6209
|
+
warnings?.push(`${file}: models.${role} ${SCOUT_REMOVED}`);
|
|
6210
|
+
}
|
|
6211
|
+
return removed.length > 0 && Object.keys(models).length === 0 ? undefined : models;
|
|
6259
6212
|
} catch (error) {
|
|
6260
6213
|
if (error instanceof ModelNameError) {
|
|
6261
6214
|
throw new CliUsageError(`${file} ${error.message}`);
|
|
@@ -6378,9 +6331,6 @@ function resolveSummary(options, config) {
|
|
|
6378
6331
|
function resolveSharedPrefix(options) {
|
|
6379
6332
|
return options.sharedPrefix !== false;
|
|
6380
6333
|
}
|
|
6381
|
-
function resolveScout(options, config) {
|
|
6382
|
-
return options.scout ?? config.scout ?? false;
|
|
6383
|
-
}
|
|
6384
6334
|
function resolveMaterialityGate(config) {
|
|
6385
6335
|
return config.materiality_gate ?? false;
|
|
6386
6336
|
}
|
|
@@ -6414,7 +6364,6 @@ function mergeConfig(global, repo) {
|
|
|
6414
6364
|
];
|
|
6415
6365
|
const agentsDir = foldKey(layers, CONFIG_DIRECTION.agents_dir, (layer) => layer.agents_dir);
|
|
6416
6366
|
const defaultBase = foldKey(layers, CONFIG_DIRECTION.default_base, (layer) => layer.default_base);
|
|
6417
|
-
const triggers = foldKey(layers, CONFIG_DIRECTION.parity_trigger_paths, (layer) => layer.parity_trigger_paths);
|
|
6418
6367
|
const priors = foldKey(layers, CONFIG_DIRECTION.suspicion_priors, (layer) => layer.suspicion_priors);
|
|
6419
6368
|
const summaryEnabled = foldKey(layers, SUMMARY_DIRECTION.enabled, (layer) => layer.summary?.enabled, (a, b) => a && b);
|
|
6420
6369
|
const maxSteps = foldKey(layers, CONFIG_DIRECTION.max_verification_steps, (layer) => layer.max_verification_steps, Math.min);
|
|
@@ -6428,7 +6377,6 @@ function mergeConfig(global, repo) {
|
|
|
6428
6377
|
};
|
|
6429
6378
|
const maxLines = foldKey(layers, CONFIG_DIRECTION.max_changed_lines, (layer) => layer.max_changed_lines, narrowSizeLimit);
|
|
6430
6379
|
const maxFiles = foldKey(layers, CONFIG_DIRECTION.max_changed_files, (layer) => layer.max_changed_files, narrowSizeLimit);
|
|
6431
|
-
const scout = foldKey(layers, CONFIG_DIRECTION.scout, (layer) => layer.scout, (a, b) => a && b);
|
|
6432
6380
|
const materialityGate = foldKey(layers, CONFIG_DIRECTION.materiality_gate, (layer) => layer.materiality_gate, (a, b) => a && b);
|
|
6433
6381
|
const post = foldKey(layers, CONFIG_DIRECTION.post, (layer) => layer.post, (a, b) => a && b);
|
|
6434
6382
|
const postMinSeverity = foldKey(layers, CONFIG_DIRECTION.post_min_severity, (layer) => layer.post_min_severity);
|
|
@@ -6447,7 +6395,6 @@ function mergeConfig(global, repo) {
|
|
|
6447
6395
|
...summaryEnabled.value === undefined ? {} : { enabled: summaryEnabled.value }
|
|
6448
6396
|
};
|
|
6449
6397
|
const effective = {
|
|
6450
|
-
parity_trigger_paths: triggers.value ?? [],
|
|
6451
6398
|
suspicion_priors: priors.value ?? [],
|
|
6452
6399
|
...agentsDir.value === undefined ? {} : { agents_dir: agentsDir.value },
|
|
6453
6400
|
...defaultBase.value === undefined ? {} : { default_base: defaultBase.value },
|
|
@@ -6459,7 +6406,6 @@ function mergeConfig(global, repo) {
|
|
|
6459
6406
|
...maxConcurrentSteps.value === undefined ? {} : { max_concurrent_steps: maxConcurrentSteps.value },
|
|
6460
6407
|
...maxLines.value === undefined ? {} : { max_changed_lines: maxLines.value },
|
|
6461
6408
|
...maxFiles.value === undefined ? {} : { max_changed_files: maxFiles.value },
|
|
6462
|
-
...scout.value === undefined ? {} : { scout: scout.value },
|
|
6463
6409
|
...materialityGate.value === undefined ? {} : { materiality_gate: materialityGate.value },
|
|
6464
6410
|
...post.value === undefined ? {} : { post: post.value },
|
|
6465
6411
|
...postMinSeverity.value === undefined ? {} : { post_min_severity: postMinSeverity.value },
|
|
@@ -6475,7 +6421,6 @@ function mergeConfig(global, repo) {
|
|
|
6475
6421
|
const sources = {
|
|
6476
6422
|
agents_dir: agentsDir.source,
|
|
6477
6423
|
default_base: defaultBase.source,
|
|
6478
|
-
parity_trigger_paths: triggers.source,
|
|
6479
6424
|
suspicion_priors: priors.source,
|
|
6480
6425
|
summary: { enabled: summaryEnabled.source },
|
|
6481
6426
|
models: models.source,
|
|
@@ -6485,7 +6430,6 @@ function mergeConfig(global, repo) {
|
|
|
6485
6430
|
max_concurrent_steps: maxConcurrentSteps.source,
|
|
6486
6431
|
max_changed_lines: maxLines.source,
|
|
6487
6432
|
max_changed_files: maxFiles.source,
|
|
6488
|
-
scout: scout.source,
|
|
6489
6433
|
materiality_gate: materialityGate.source,
|
|
6490
6434
|
post: post.source,
|
|
6491
6435
|
post_min_severity: postMinSeverity.source,
|
|
@@ -6530,7 +6474,6 @@ function initConfigTemplate(input) {
|
|
|
6530
6474
|
...omit.agentsDir ? {} : { agents_dir: input.agentsDir },
|
|
6531
6475
|
default_base: input.defaultBase,
|
|
6532
6476
|
...Object.keys(summary).length === 0 ? {} : { summary },
|
|
6533
|
-
parity_trigger_paths: [],
|
|
6534
6477
|
suspicion_priors: []
|
|
6535
6478
|
}, null, 2)}
|
|
6536
6479
|
`;
|
|
@@ -6650,7 +6593,7 @@ function gotchasErrorMessage(gotchasPath, reason, present) {
|
|
|
6650
6593
|
].join(`
|
|
6651
6594
|
`);
|
|
6652
6595
|
}
|
|
6653
|
-
var DEFAULT_HOP_BUDGET = 12, DEFAULT_WATCH_INTERVAL_MIN = 15, DEFAULT_GC_INTERVAL_MIN = 360, DEFAULT_HEAD_REF = "HEAD", DEFAULT_SUMMARY_MODEL, HELP_TEXT, VALUE_FLAGS, BUNDLED_AGENTS_DIR_LABEL = "bundled default (from engine)", AGENT_FILE_PATTERNS, RETIRED_AGENT_HINTS, ADDED_AGENT_HINTS, CONFIG_DIRECTION, SUMMARY_DIRECTION, CLAUDE_CREDENTIAL_KINDS, EMPTY_LOCAL_CONFIG, KNOWN_CONFIG_KEYS, PERSON_ONLY_KEYS, LOCAL_CONFIG_KEYS, GLOBAL_CONFIG_KEYS, REPO_CONFIG_LABEL = ".crysk/config.json", GLOBAL_CONFIG_LABEL = "~/.crysk/config.json", REMOVED_ROUTING_MESSAGE = '`routing` is gone: set models per role, e.g. `"models": {"hunter.logic": ["claude:sonnet-latest"]}`', SUMMARY_MODEL_EXAMPLE = '`"models": {"summary": ["claude:haiku-latest"]}`', SUMMARY_MODEL_INIT_VALUE = "haiku", SUMMARY_MODEL_CONVERTED, CREDENTIALS_EXAMPLE = '`"credentials": {"claude": ["subscription", "api_key"]}`', DEFAULT_MAX_VERIFICATION_STEPS = 8, GOTCHAS_PLACEHOLDER_MARKER = "human-attention-required", GOTCHAS_TEMPLATE, REVIEW_MD_TEMPLATE, SETUP_GOTCHAS_FALLBACK, RETIRED_SCAFFOLD_LINES, SCAFFOLD_BODY_LINES, NO_REVIEW_INSTRUCTIONS = "This repository provides no review instructions (no REVIEW.md or gotchas file).";
|
|
6596
|
+
var DEFAULT_HOP_BUDGET = 12, DEFAULT_WATCH_INTERVAL_MIN = 15, DEFAULT_GC_INTERVAL_MIN = 360, DEFAULT_HEAD_REF = "HEAD", DEFAULT_SUMMARY_MODEL, HELP_TEXT, SCOUT_REMOVED = "is ignored: the scout stage was removed", PARITY_REMOVED = "is ignored: the parity hunter was removed", VALUE_FLAGS, BUNDLED_AGENTS_DIR_LABEL = "bundled default (from engine)", AGENT_FILE_PATTERNS, RETIRED_AGENT_HINTS, ADDED_AGENT_HINTS, IGNORED_AGENT_FILES, CONFIG_DIRECTION, SUMMARY_DIRECTION, CLAUDE_CREDENTIAL_KINDS, EMPTY_LOCAL_CONFIG, KNOWN_CONFIG_KEYS, PERSON_ONLY_KEYS, LOCAL_CONFIG_KEYS, GLOBAL_CONFIG_KEYS, REPO_CONFIG_LABEL = ".crysk/config.json", GLOBAL_CONFIG_LABEL = "~/.crysk/config.json", REMOVED_ROUTING_MESSAGE = '`routing` is gone: set models per role, e.g. `"models": {"hunter.logic": ["claude:sonnet-latest"]}`', SUMMARY_MODEL_EXAMPLE = '`"models": {"summary": ["claude:haiku-latest"]}`', SUMMARY_MODEL_INIT_VALUE = "haiku", SUMMARY_MODEL_CONVERTED, CREDENTIALS_EXAMPLE = '`"credentials": {"claude": ["subscription", "api_key"]}`', DEFAULT_MAX_VERIFICATION_STEPS = 8, GOTCHAS_PLACEHOLDER_MARKER = "human-attention-required", GOTCHAS_TEMPLATE, REVIEW_MD_TEMPLATE, SETUP_GOTCHAS_FALLBACK, RETIRED_SCAFFOLD_LINES, SCAFFOLD_BODY_LINES, NO_REVIEW_INSTRUCTIONS = "This repository provides no review instructions (no REVIEW.md or gotchas file).";
|
|
6654
6597
|
var init_preflight2 = __esm(() => {
|
|
6655
6598
|
init_review_policy();
|
|
6656
6599
|
init_model_name();
|
|
@@ -6710,13 +6653,15 @@ Usage:
|
|
|
6710
6653
|
and posts nothing (the only way to preview a
|
|
6711
6654
|
plan, since --pr --dry-run returns before any
|
|
6712
6655
|
findings exist)
|
|
6713
|
-
crysk triage reply --pr <n> --from <run-dir> --finding <id> --tag <tag>
|
|
6656
|
+
crysk triage reply --pr <n> [--from <run-dir>] --finding <id> --tag <tag>
|
|
6714
6657
|
--body-file <path> [--verdict <v>] [--issue <n>] [--dry-run]
|
|
6715
6658
|
Post one triage reply. The driver resolves the
|
|
6716
6659
|
parent from the posted <!-- crysk-finding
|
|
6717
6660
|
marker (never path/line), renders the marker +
|
|
6718
6661
|
badge, posts, and resolves the inline review
|
|
6719
6662
|
thread. --body-file is reasoning prose only.
|
|
6663
|
+
Without --from, the finding is read off the PR
|
|
6664
|
+
by its R### id (crysk status --pr <n> --json).
|
|
6720
6665
|
--dry-run prints the parent and posts nothing
|
|
6721
6666
|
crysk status --pr <n> [--wait] [--json]
|
|
6722
6667
|
Read the PR's crysk gate, posted findings and
|
|
@@ -6864,8 +6809,8 @@ Options:
|
|
|
6864
6809
|
gotchas.md, else none); supply it from outside to review
|
|
6865
6810
|
a tree you cannot dirty
|
|
6866
6811
|
--config <file> Local config (default: <repo>/.crysk/config.json) with
|
|
6867
|
-
agents_dir, default_base
|
|
6868
|
-
|
|
6812
|
+
agents_dir, default_base and suspicion_priors,
|
|
6813
|
+
optional summary settings, and
|
|
6869
6814
|
optional max_verification_steps (re-review verify cap;
|
|
6870
6815
|
default 8; 0 pauses verification), and optional
|
|
6871
6816
|
max_concurrent_steps (cap on steps in flight at once;
|
|
@@ -6877,12 +6822,6 @@ Options:
|
|
|
6877
6822
|
their effort go in "models" in ~/.crysk/config.json
|
|
6878
6823
|
--summary Enable the engine-owned PR summary (default)
|
|
6879
6824
|
--no-summary Disable the engine-owned PR summary
|
|
6880
|
-
--scout review only: run the diff-only scout stage before the
|
|
6881
|
-
hunters, biasing their scan with unverified leads.
|
|
6882
|
-
EXPERIMENTAL and off by default \u2014 the A/B that decides
|
|
6883
|
-
whether it earns its cost has not run yet
|
|
6884
|
-
--scout-model <m> Model for the scout stage (default: the run's model).
|
|
6885
|
-
Requires --scout
|
|
6886
6825
|
--no-shared-prefix review only: turn off the shared hunter prefix. By
|
|
6887
6826
|
default the patch and output contract sit in each
|
|
6888
6827
|
hunter's system prompt, identical across hunters, and the
|
|
@@ -7003,10 +6942,12 @@ Exit codes of a review (findings never change them):
|
|
|
7003
6942
|
ADDED_AGENT_HINTS = {
|
|
7004
6943
|
"deep-review-security.md": "; the security hunter was added to the default spec: copy prompts/default/deep-review-security.md from the crysk package into this directory"
|
|
7005
6944
|
};
|
|
6945
|
+
IGNORED_AGENT_FILES = new Set([
|
|
6946
|
+
"deep-review-parity.md"
|
|
6947
|
+
]);
|
|
7006
6948
|
CONFIG_DIRECTION = {
|
|
7007
6949
|
agents_dir: "person",
|
|
7008
6950
|
default_base: "repo",
|
|
7009
|
-
parity_trigger_paths: "repo",
|
|
7010
6951
|
suspicion_priors: "repo",
|
|
7011
6952
|
summary: "capped",
|
|
7012
6953
|
models: "person",
|
|
@@ -7016,7 +6957,6 @@ Exit codes of a review (findings never change them):
|
|
|
7016
6957
|
max_concurrent_steps: "capped",
|
|
7017
6958
|
max_changed_lines: "capped",
|
|
7018
6959
|
max_changed_files: "capped",
|
|
7019
|
-
scout: "capped",
|
|
7020
6960
|
materiality_gate: "capped",
|
|
7021
6961
|
post: "capped",
|
|
7022
6962
|
post_min_severity: "person",
|
|
@@ -7034,7 +6974,6 @@ Exit codes of a review (findings never change them):
|
|
|
7034
6974
|
};
|
|
7035
6975
|
CLAUDE_CREDENTIAL_KINDS = ["subscription", "api_key"];
|
|
7036
6976
|
EMPTY_LOCAL_CONFIG = {
|
|
7037
|
-
parity_trigger_paths: [],
|
|
7038
6977
|
suspicion_priors: []
|
|
7039
6978
|
};
|
|
7040
6979
|
KNOWN_CONFIG_KEYS = new Set(Object.keys(CONFIG_DIRECTION));
|
|
@@ -7375,7 +7314,7 @@ function blockingCommitStatusRequest(input) {
|
|
|
7375
7314
|
return {
|
|
7376
7315
|
state: "failure",
|
|
7377
7316
|
context: input.context ?? LOCAL_COMMIT_STATUS_CONTEXT,
|
|
7378
|
-
description: clipStatusDescription(`${STATUS_CONTEXT}: ${input.blockingCount} blocking finding(s) \u2014 fix and push, or /
|
|
7317
|
+
description: clipStatusDescription(`${STATUS_CONTEXT}: ${input.blockingCount} blocking finding(s) \u2014 fix and push, or /crysk override`),
|
|
7379
7318
|
targetUrl: input.targetUrl
|
|
7380
7319
|
};
|
|
7381
7320
|
}
|
|
@@ -7384,7 +7323,7 @@ function skipCommitStatusRequest(input) {
|
|
|
7384
7323
|
return {
|
|
7385
7324
|
state: "failure",
|
|
7386
7325
|
context: input.context ?? LOCAL_COMMIT_STATUS_CONTEXT,
|
|
7387
|
-
description: clipStatusDescription(`${STATUS_CONTEXT} skipped the review: ${reason}. /
|
|
7326
|
+
description: clipStatusDescription(`${STATUS_CONTEXT} skipped the review: ${reason}. /crysk review reviews it anyway`),
|
|
7388
7327
|
targetUrl: input.targetUrl
|
|
7389
7328
|
};
|
|
7390
7329
|
}
|
|
@@ -7413,10 +7352,10 @@ function partialCountsSuffix(set) {
|
|
|
7413
7352
|
return set === undefined ? "" : `, set ${set}`;
|
|
7414
7353
|
}
|
|
7415
7354
|
function partialReviewDescription(failed, total, set) {
|
|
7416
|
-
return clipStatusDescription(`${STATUS_CONTEXT}: review partial (${failed} of ${total} hunters failed${partialCountsSuffix(set)}) \u2014 /
|
|
7355
|
+
return clipStatusDescription(`${STATUS_CONTEXT}: review partial (${failed} of ${total} hunters failed${partialCountsSuffix(set)}) \u2014 /crysk review retries it`);
|
|
7417
7356
|
}
|
|
7418
7357
|
function partialReviewAgainDescription(failed, total, set) {
|
|
7419
|
-
return clipStatusDescription(`${STATUS_CONTEXT}: review partial again (${failed} of ${total} hunters failed${partialCountsSuffix(set)}) \u2014 fix the failing route or /
|
|
7358
|
+
return clipStatusDescription(`${STATUS_CONTEXT}: review partial again (${failed} of ${total} hunters failed${partialCountsSuffix(set)}) \u2014 fix the failing route or /crysk override`);
|
|
7420
7359
|
}
|
|
7421
7360
|
function partialReviewCommitStatusRequest(input) {
|
|
7422
7361
|
return {
|
|
@@ -7477,15 +7416,15 @@ function latestStatusInContext(statuses, context) {
|
|
|
7477
7416
|
return latest;
|
|
7478
7417
|
}
|
|
7479
7418
|
function manualReviewHoldDescription(label, sha) {
|
|
7480
|
-
return clipStatusDescription(`${STATUS_CONTEXT}: waiting for a manual review (${label}); carried from ${sha.slice(0, 7)} \u2014 /
|
|
7419
|
+
return clipStatusDescription(`${STATUS_CONTEXT}: waiting for a manual review (${label}); carried from ${sha.slice(0, 7)} \u2014 /crysk review or /crysk override`);
|
|
7481
7420
|
}
|
|
7482
7421
|
function isManualReviewHold(status) {
|
|
7483
|
-
return status.state === "pending" && MANUAL_REVIEW_HOLD.test(status.description ?? "");
|
|
7422
|
+
return status.state === "pending" && MANUAL_REVIEW_HOLD.test(canonicalStatusText(status.description ?? ""));
|
|
7484
7423
|
}
|
|
7485
7424
|
function heldVerdictSha(status) {
|
|
7486
7425
|
if (!isManualReviewHold(status))
|
|
7487
7426
|
return null;
|
|
7488
|
-
const description = status.description ?? "";
|
|
7427
|
+
const description = canonicalStatusText(status.description ?? "");
|
|
7489
7428
|
const match = HELD_VERDICT.exec(description);
|
|
7490
7429
|
if (match === null)
|
|
7491
7430
|
return null;
|
|
@@ -8161,9 +8100,9 @@ init_materiality();
|
|
|
8161
8100
|
init_catalog();
|
|
8162
8101
|
init_profiles();
|
|
8163
8102
|
init_routing();
|
|
8164
|
-
import { existsSync as
|
|
8103
|
+
import { existsSync as existsSync14, readFileSync as readFileSync7 } from "fs";
|
|
8165
8104
|
import { chmod, mkdir as mkdir8, realpath as realpath4 } from "fs/promises";
|
|
8166
|
-
import
|
|
8105
|
+
import path25 from "path";
|
|
8167
8106
|
|
|
8168
8107
|
// src/rereview/adjudicate.ts
|
|
8169
8108
|
init_boundary();
|
|
@@ -10341,8 +10280,10 @@ async function copyRetainedClaudeSession(request, dest) {
|
|
|
10341
10280
|
}
|
|
10342
10281
|
var MAX_LINE_BYTES = 4 * 1024 * 1024;
|
|
10343
10282
|
var MAX_COPY_BYTES = 64 * 1024 * 1024;
|
|
10344
|
-
var
|
|
10345
|
-
var
|
|
10283
|
+
var SESSION_LINE_OMITTED = "session line omitted";
|
|
10284
|
+
var SESSION_TRUNCATED = "session truncated";
|
|
10285
|
+
var OMITTED_LINE = JSON.stringify({ crysk: SESSION_LINE_OMITTED });
|
|
10286
|
+
var TRUNCATED_LINE = `${JSON.stringify({ crysk: SESSION_TRUNCATED })}
|
|
10346
10287
|
`;
|
|
10347
10288
|
var NEWLINE = 10;
|
|
10348
10289
|
async function copySessionJsonl(source, dest) {
|
|
@@ -10608,8 +10549,10 @@ function isTransportFailureCause(value) {
|
|
|
10608
10549
|
}
|
|
10609
10550
|
|
|
10610
10551
|
// src/execution/harness.ts
|
|
10552
|
+
import { createReadStream, existsSync as existsSync13 } from "fs";
|
|
10611
10553
|
import { mkdir as mkdir7 } from "fs/promises";
|
|
10612
|
-
import
|
|
10554
|
+
import path24 from "path";
|
|
10555
|
+
import { createInterface } from "readline";
|
|
10613
10556
|
|
|
10614
10557
|
// src/model/exec-snapshots.ts
|
|
10615
10558
|
import { rmSync as rmSync2 } from "fs";
|
|
@@ -11947,7 +11890,7 @@ class WorkspaceReadBroker {
|
|
|
11947
11890
|
init_crysk_secrets();
|
|
11948
11891
|
import { readFile as readFile4 } from "fs/promises";
|
|
11949
11892
|
import os2 from "os";
|
|
11950
|
-
import
|
|
11893
|
+
import path22 from "path";
|
|
11951
11894
|
import { pathToFileURL } from "url";
|
|
11952
11895
|
init_routing();
|
|
11953
11896
|
init_assets();
|
|
@@ -12273,6 +12216,208 @@ function loadOrCreateBucketKey(home, deps = {}) {
|
|
|
12273
12216
|
}
|
|
12274
12217
|
}
|
|
12275
12218
|
|
|
12219
|
+
// src/execution/usage-facts.ts
|
|
12220
|
+
import path21 from "path";
|
|
12221
|
+
function usageFactsPath(outPath, stepName, attempt) {
|
|
12222
|
+
return path21.join(path21.dirname(outPath), `usage.${stepName}.attempt${attempt}.json`);
|
|
12223
|
+
}
|
|
12224
|
+
function credentialOfBillingMode(mode) {
|
|
12225
|
+
switch (mode) {
|
|
12226
|
+
case "metered":
|
|
12227
|
+
return "api";
|
|
12228
|
+
case "subscription":
|
|
12229
|
+
return "subscription";
|
|
12230
|
+
case "free":
|
|
12231
|
+
return "free";
|
|
12232
|
+
default:
|
|
12233
|
+
return;
|
|
12234
|
+
}
|
|
12235
|
+
}
|
|
12236
|
+
function isRecord(value) {
|
|
12237
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
12238
|
+
}
|
|
12239
|
+
function tokens(value) {
|
|
12240
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0 ? Math.round(value) : 0;
|
|
12241
|
+
}
|
|
12242
|
+
function nonEmpty(value) {
|
|
12243
|
+
return typeof value === "string" && value.trim() !== "" ? value : undefined;
|
|
12244
|
+
}
|
|
12245
|
+
function claudeUsageCounts(input) {
|
|
12246
|
+
const write1h = tokens(input.cacheWrite1h);
|
|
12247
|
+
const writeTotal = typeof input.cacheWriteTotal === "number" ? tokens(input.cacheWriteTotal) : tokens(input.cacheWrite5m) + write1h;
|
|
12248
|
+
const thinking = tokens(input.thinking);
|
|
12249
|
+
return [
|
|
12250
|
+
tokens(input.uncached),
|
|
12251
|
+
tokens(input.cacheRead),
|
|
12252
|
+
Math.max(0, writeTotal - write1h),
|
|
12253
|
+
write1h,
|
|
12254
|
+
Math.max(0, tokens(input.output) - thinking),
|
|
12255
|
+
thinking
|
|
12256
|
+
];
|
|
12257
|
+
}
|
|
12258
|
+
async function claudeSessionRequests(lines) {
|
|
12259
|
+
const byId = new Map;
|
|
12260
|
+
const requests = [];
|
|
12261
|
+
const gaps = new Set;
|
|
12262
|
+
for await (const line of lines) {
|
|
12263
|
+
if (!line.includes('"usage"') && !line.includes('"crysk"'))
|
|
12264
|
+
continue;
|
|
12265
|
+
let parsed;
|
|
12266
|
+
try {
|
|
12267
|
+
parsed = JSON.parse(line);
|
|
12268
|
+
} catch {
|
|
12269
|
+
continue;
|
|
12270
|
+
}
|
|
12271
|
+
if (!isRecord(parsed))
|
|
12272
|
+
continue;
|
|
12273
|
+
if (parsed.crysk === SESSION_LINE_OMITTED)
|
|
12274
|
+
gaps.add("line_omitted");
|
|
12275
|
+
if (parsed.crysk === SESSION_TRUNCATED)
|
|
12276
|
+
gaps.add("truncated");
|
|
12277
|
+
if (parsed.type !== "assistant" || !isRecord(parsed.message))
|
|
12278
|
+
continue;
|
|
12279
|
+
const { id, model, usage } = parsed.message;
|
|
12280
|
+
const modelId = nonEmpty(model);
|
|
12281
|
+
if (modelId === undefined || !isRecord(usage))
|
|
12282
|
+
continue;
|
|
12283
|
+
const creation = isRecord(usage.cache_creation) ? usage.cache_creation : {};
|
|
12284
|
+
const details = isRecord(usage.output_tokens_details) ? usage.output_tokens_details : {};
|
|
12285
|
+
const counts = claudeUsageCounts({
|
|
12286
|
+
uncached: usage.input_tokens,
|
|
12287
|
+
cacheRead: usage.cache_read_input_tokens,
|
|
12288
|
+
cacheWriteTotal: usage.cache_creation_input_tokens,
|
|
12289
|
+
cacheWrite1h: creation.ephemeral_1h_input_tokens,
|
|
12290
|
+
cacheWrite5m: creation.ephemeral_5m_input_tokens,
|
|
12291
|
+
output: usage.output_tokens,
|
|
12292
|
+
thinking: details.thinking_tokens
|
|
12293
|
+
});
|
|
12294
|
+
if (counts.every((n) => n === 0))
|
|
12295
|
+
continue;
|
|
12296
|
+
const request = { model: modelId, counts };
|
|
12297
|
+
const key = nonEmpty(id);
|
|
12298
|
+
if (key === undefined) {
|
|
12299
|
+
requests.push(request);
|
|
12300
|
+
continue;
|
|
12301
|
+
}
|
|
12302
|
+
const seen = byId.get(key);
|
|
12303
|
+
if (seen === undefined) {
|
|
12304
|
+
byId.set(key, request);
|
|
12305
|
+
requests.push(request);
|
|
12306
|
+
} else {
|
|
12307
|
+
requests[requests.indexOf(seen)] = request;
|
|
12308
|
+
byId.set(key, request);
|
|
12309
|
+
}
|
|
12310
|
+
}
|
|
12311
|
+
return { requests, gaps: [...gaps] };
|
|
12312
|
+
}
|
|
12313
|
+
function sumCounts(rows) {
|
|
12314
|
+
const total = [0, 0, 0, 0, 0, 0];
|
|
12315
|
+
for (const row of rows)
|
|
12316
|
+
for (let i = 0;i < 6; i++)
|
|
12317
|
+
total[i] += row[i] ?? 0;
|
|
12318
|
+
return total;
|
|
12319
|
+
}
|
|
12320
|
+
function beyond(total, seen) {
|
|
12321
|
+
const over = (a, b) => Math.max(0, a - b);
|
|
12322
|
+
const pair = (defaultLeaf, splitLeaf) => {
|
|
12323
|
+
const all = over(total[defaultLeaf] + total[splitLeaf], seen[defaultLeaf] + seen[splitLeaf]);
|
|
12324
|
+
const split = Math.min(all, over(total[splitLeaf], seen[splitLeaf]));
|
|
12325
|
+
return [all - split, split];
|
|
12326
|
+
};
|
|
12327
|
+
const [write, write1h] = pair(2, 3);
|
|
12328
|
+
const [output, reasoning] = pair(4, 5);
|
|
12329
|
+
return [
|
|
12330
|
+
over(total[0], seen[0]),
|
|
12331
|
+
over(total[1], seen[1]),
|
|
12332
|
+
write,
|
|
12333
|
+
write1h,
|
|
12334
|
+
output,
|
|
12335
|
+
reasoning
|
|
12336
|
+
];
|
|
12337
|
+
}
|
|
12338
|
+
function entry(provider, row) {
|
|
12339
|
+
return [provider, row.model, ...row.counts];
|
|
12340
|
+
}
|
|
12341
|
+
function facts(base, requests, remainders, gaps) {
|
|
12342
|
+
return {
|
|
12343
|
+
attempt: base.attempt,
|
|
12344
|
+
credential: base.credential,
|
|
12345
|
+
requests,
|
|
12346
|
+
...remainders.length === 0 ? {} : { remainders },
|
|
12347
|
+
...gaps.length === 0 ? {} : { gaps }
|
|
12348
|
+
};
|
|
12349
|
+
}
|
|
12350
|
+
async function claudeAttemptUsageFacts(input) {
|
|
12351
|
+
const read = input.session === undefined ? { requests: [], gaps: ["no_session"] } : await claudeSessionRequests(input.session);
|
|
12352
|
+
const remainders = [];
|
|
12353
|
+
for (const total of input.summary ?? []) {
|
|
12354
|
+
const seen = sumCounts(read.requests.filter((r) => r.model === total.model).map((r) => r.counts));
|
|
12355
|
+
const counts = beyond(total.counts, seen);
|
|
12356
|
+
if (counts.some((n) => n > 0)) {
|
|
12357
|
+
remainders.push(entry(input.provider, { model: total.model, counts }));
|
|
12358
|
+
}
|
|
12359
|
+
}
|
|
12360
|
+
return facts(input, read.requests.map((r) => entry(input.provider, r)), remainders, input.summary === undefined ? [...read.gaps, "no_summary"] : read.gaps);
|
|
12361
|
+
}
|
|
12362
|
+
function openCodeReadback(capture, route) {
|
|
12363
|
+
let parsed;
|
|
12364
|
+
try {
|
|
12365
|
+
parsed = JSON.parse(capture);
|
|
12366
|
+
} catch {
|
|
12367
|
+
return;
|
|
12368
|
+
}
|
|
12369
|
+
const records = isRecord(parsed) && Array.isArray(parsed.records) ? parsed.records.filter(isRecord) : [];
|
|
12370
|
+
const readbacks = records.filter((record) => record.kind === "readback");
|
|
12371
|
+
const readback = readbacks.filter((record) => isRecord(record.data) && Array.isArray(record.data.messages)).at(-1);
|
|
12372
|
+
if (readback === undefined || !isRecord(readback.data))
|
|
12373
|
+
return;
|
|
12374
|
+
const newest = readbacks.at(-1) === readback;
|
|
12375
|
+
const requests = [];
|
|
12376
|
+
for (const message of readback.data.messages.filter(isRecord)) {
|
|
12377
|
+
const info = isRecord(message.info) ? message.info : message;
|
|
12378
|
+
if (info.role !== "assistant")
|
|
12379
|
+
continue;
|
|
12380
|
+
const t = isRecord(info.tokens) ? info.tokens : {};
|
|
12381
|
+
const cache = isRecord(t.cache) ? t.cache : {};
|
|
12382
|
+
requests.push([
|
|
12383
|
+
nonEmpty(info.providerID) ?? route.provider,
|
|
12384
|
+
nonEmpty(info.modelID) ?? route.model,
|
|
12385
|
+
tokens(t.input),
|
|
12386
|
+
tokens(cache.read),
|
|
12387
|
+
tokens(cache.write),
|
|
12388
|
+
0,
|
|
12389
|
+
tokens(t.output),
|
|
12390
|
+
tokens(t.reasoning)
|
|
12391
|
+
]);
|
|
12392
|
+
}
|
|
12393
|
+
return {
|
|
12394
|
+
requests,
|
|
12395
|
+
complete: newest && readback.data.coverage === "complete"
|
|
12396
|
+
};
|
|
12397
|
+
}
|
|
12398
|
+
function openCodeAttemptUsageFacts(input) {
|
|
12399
|
+
const readback = input.capture === undefined ? undefined : openCodeReadback(input.capture.redactedJson, input.route);
|
|
12400
|
+
if (readback?.complete === true && input.capture?.status === "complete") {
|
|
12401
|
+
return facts(input, readback.requests, [], []);
|
|
12402
|
+
}
|
|
12403
|
+
const t = input.totals;
|
|
12404
|
+
const totals = [
|
|
12405
|
+
tokens(t.inputUncached) + tokens(t.inputOther),
|
|
12406
|
+
tokens(t.inputCacheRead),
|
|
12407
|
+
tokens(t.inputCacheWrite),
|
|
12408
|
+
0,
|
|
12409
|
+
tokens(t.outputVisible) + tokens(t.outputOther),
|
|
12410
|
+
tokens(t.outputReasoning)
|
|
12411
|
+
];
|
|
12412
|
+
if (input.capture === undefined && totals.every((n) => n === 0)) {
|
|
12413
|
+
return;
|
|
12414
|
+
}
|
|
12415
|
+
const requests = readback?.requests ?? [];
|
|
12416
|
+
const counts = beyond(totals, sumCounts(requests.map((r) => r.slice(2))));
|
|
12417
|
+
const lost = counts.some((n) => n > 0);
|
|
12418
|
+
return facts(input, requests, lost ? [entry(input.route.provider, { model: input.route.model, counts })] : [], readback === undefined || lost ? ["no_readback"] : []);
|
|
12419
|
+
}
|
|
12420
|
+
|
|
12276
12421
|
// src/transports/claude-code-cli.ts
|
|
12277
12422
|
var BUCKET_IDENTITY_PROVIDER = "anthropic";
|
|
12278
12423
|
var TERM_GRACE_MS = 5000;
|
|
@@ -12323,6 +12468,44 @@ function observedModelsFromCliResult(rawStdout) {
|
|
|
12323
12468
|
}
|
|
12324
12469
|
return observed.length === 0 ? undefined : observed;
|
|
12325
12470
|
}
|
|
12471
|
+
var CLI_MODEL_VARIANT = /\[[^\]]*\]$/;
|
|
12472
|
+
function modelUsageFromCliResult(rawStdout) {
|
|
12473
|
+
let parsed;
|
|
12474
|
+
try {
|
|
12475
|
+
parsed = JSON.parse(rawStdout);
|
|
12476
|
+
} catch {
|
|
12477
|
+
return;
|
|
12478
|
+
}
|
|
12479
|
+
const raw = parsed?.modelUsage;
|
|
12480
|
+
if (raw === undefined || raw === null || typeof raw !== "object") {
|
|
12481
|
+
return;
|
|
12482
|
+
}
|
|
12483
|
+
const models = new Map;
|
|
12484
|
+
for (const [key, entry] of Object.entries(raw)) {
|
|
12485
|
+
const model = key.replace(CLI_MODEL_VARIANT, "");
|
|
12486
|
+
if (model.trim().length === 0 || entry === null || typeof entry !== "object") {
|
|
12487
|
+
continue;
|
|
12488
|
+
}
|
|
12489
|
+
const counts = claudeUsageCounts({
|
|
12490
|
+
uncached: entry.inputTokens,
|
|
12491
|
+
cacheRead: entry.cacheReadInputTokens,
|
|
12492
|
+
cacheWriteTotal: entry.cacheCreationInputTokens,
|
|
12493
|
+
cacheWrite1h: entry.cacheCreationEphemeral1hInputTokens,
|
|
12494
|
+
cacheWrite5m: entry.cacheCreationEphemeral5mInputTokens,
|
|
12495
|
+
output: entry.outputTokens,
|
|
12496
|
+
thinking: entry.thinkingTokens
|
|
12497
|
+
});
|
|
12498
|
+
const sum = models.get(model) ?? [0, 0, 0, 0, 0, 0];
|
|
12499
|
+
counts.forEach((n, i) => {
|
|
12500
|
+
sum[i] = (sum[i] ?? 0) + n;
|
|
12501
|
+
});
|
|
12502
|
+
models.set(model, sum);
|
|
12503
|
+
}
|
|
12504
|
+
return models.size === 0 ? undefined : [...models].map(([model, counts]) => ({
|
|
12505
|
+
model,
|
|
12506
|
+
counts
|
|
12507
|
+
}));
|
|
12508
|
+
}
|
|
12326
12509
|
function toolInvocationsFromCliResult(rawStdout) {
|
|
12327
12510
|
let parsed;
|
|
12328
12511
|
try {
|
|
@@ -12691,6 +12874,7 @@ class ClaudeCodeCliTransport {
|
|
|
12691
12874
|
} catch {}
|
|
12692
12875
|
const usage = normalizeClaudeCliUsage(stdout, wallMs, request.isolation.env);
|
|
12693
12876
|
const observedModels = observedModelsFromCliResult(stdout);
|
|
12877
|
+
const modelUsage = modelUsageFromCliResult(stdout);
|
|
12694
12878
|
const toolInvocations = toolInvocationsFromCliResult(stdout);
|
|
12695
12879
|
let stderrTail = stderr.slice(-4096);
|
|
12696
12880
|
if (unreaped) {
|
|
@@ -12729,6 +12913,7 @@ class ClaudeCodeCliTransport {
|
|
|
12729
12913
|
usage,
|
|
12730
12914
|
stderrTail,
|
|
12731
12915
|
...observedModels === undefined ? {} : { observedModels },
|
|
12916
|
+
...modelUsage === undefined ? {} : { modelUsage },
|
|
12732
12917
|
...toolInvocations === undefined ? {} : { toolInvocations },
|
|
12733
12918
|
...exitCode !== undefined ? { exitCode } : {}
|
|
12734
12919
|
};
|
|
@@ -16285,7 +16470,7 @@ async function launchProjectedOpenCodeServer(options) {
|
|
|
16285
16470
|
var OPENCODE_SDK_PACKAGE_SPECIFIER = "@opencode-ai/sdk/package.json";
|
|
16286
16471
|
var OPENCODE_SDK_V2_SPECIFIER = "@opencode-ai/sdk/v2/client";
|
|
16287
16472
|
function openCodeSdkPackageJsonPath(nodeModulesDir) {
|
|
16288
|
-
return
|
|
16473
|
+
return path22.join(nodeModulesDir, "@opencode-ai", "sdk", "package.json");
|
|
16289
16474
|
}
|
|
16290
16475
|
function createDynamicImport() {
|
|
16291
16476
|
return new Function("specifier", "return import(specifier)");
|
|
@@ -16334,7 +16519,7 @@ function resolveOpenCodeSdkV2Entry(packageJson, packageDir) {
|
|
|
16334
16519
|
if (relative === undefined) {
|
|
16335
16520
|
throw new OpenCodeSdkUnavailableError(openCodeSdkUnavailableMessage());
|
|
16336
16521
|
}
|
|
16337
|
-
return pathToFileURL(
|
|
16522
|
+
return pathToFileURL(path22.resolve(packageDir, relative)).href;
|
|
16338
16523
|
}
|
|
16339
16524
|
function readOpenCodeV2Export(exportsField) {
|
|
16340
16525
|
if (typeof exportsField !== "object" || exportsField === null || Array.isArray(exportsField)) {
|
|
@@ -16399,7 +16584,7 @@ async function readOpenCodeSdkPackage(options, dynamicImport) {
|
|
|
16399
16584
|
return {
|
|
16400
16585
|
version: packageJson.version,
|
|
16401
16586
|
packageJson,
|
|
16402
|
-
packageDir: plan.packageJsonPath !== undefined ?
|
|
16587
|
+
packageDir: plan.packageJsonPath !== undefined ? path22.dirname(plan.packageJsonPath) : "",
|
|
16403
16588
|
plan
|
|
16404
16589
|
};
|
|
16405
16590
|
}
|
|
@@ -16894,7 +17079,7 @@ function sumUsage(a, b) {
|
|
|
16894
17079
|
import { createHash as createHash8 } from "crypto";
|
|
16895
17080
|
init_evidence_redaction();
|
|
16896
17081
|
import { mkdir as mkdir6, readFile as readFile5, realpath as realpath3 } from "fs/promises";
|
|
16897
|
-
import
|
|
17082
|
+
import path23 from "path";
|
|
16898
17083
|
var evidenceSha256 = (value) => createHash8("sha256").update(value).digest("hex");
|
|
16899
17084
|
function parseCaptureWrapper(redactedJson) {
|
|
16900
17085
|
let value;
|
|
@@ -16963,7 +17148,7 @@ async function persistAttemptEvidence(step, request, execution) {
|
|
|
16963
17148
|
}
|
|
16964
17149
|
if (evidence.delivered) {
|
|
16965
17150
|
evidence.outputSha256 = evidenceSha256(await readFile5(step.outPath));
|
|
16966
|
-
evidence.outputPath =
|
|
17151
|
+
evidence.outputPath = path23.basename(step.outPath);
|
|
16967
17152
|
}
|
|
16968
17153
|
const capture = outcome?.diagnosticEvidence;
|
|
16969
17154
|
if (capture) {
|
|
@@ -17007,14 +17192,14 @@ async function persistAttemptEvidence(step, request, execution) {
|
|
|
17007
17192
|
};
|
|
17008
17193
|
} else {
|
|
17009
17194
|
const captureFile = file.replace(/\.json$/, ".capture.json");
|
|
17010
|
-
await mkdir6(
|
|
17195
|
+
await mkdir6(path23.dirname(file), { recursive: true });
|
|
17011
17196
|
await writeJsonAtomically(captureFile, safe, { compact: true });
|
|
17012
17197
|
const bytes = await readFile5(captureFile);
|
|
17013
17198
|
evidence.capture = {
|
|
17014
17199
|
schema: capture.schema,
|
|
17015
17200
|
status: capture.status,
|
|
17016
17201
|
sha256: evidenceSha256(bytes),
|
|
17017
|
-
relativePath:
|
|
17202
|
+
relativePath: path23.basename(captureFile)
|
|
17018
17203
|
};
|
|
17019
17204
|
}
|
|
17020
17205
|
} catch (error) {
|
|
@@ -17026,7 +17211,7 @@ async function persistAttemptEvidence(step, request, execution) {
|
|
|
17026
17211
|
}
|
|
17027
17212
|
}
|
|
17028
17213
|
}
|
|
17029
|
-
await mkdir6(
|
|
17214
|
+
await mkdir6(path23.dirname(file), { recursive: true });
|
|
17030
17215
|
await writeJsonAtomically(file, redactEvidence(evidence));
|
|
17031
17216
|
}
|
|
17032
17217
|
async function freezeAttemptEvidenceIdentity(request, step) {
|
|
@@ -17056,16 +17241,16 @@ async function freezeAttemptEvidenceIdentity(request, step) {
|
|
|
17056
17241
|
route: request.route,
|
|
17057
17242
|
systemPromptSha256: request.systemPromptSha256,
|
|
17058
17243
|
userPromptSha256: evidenceSha256(request.userPrompt),
|
|
17059
|
-
systemPromptPath:
|
|
17244
|
+
systemPromptPath: path23.relative(path23.dirname(file), step.systemPromptPath),
|
|
17060
17245
|
toolNames: [...request.tools],
|
|
17061
17246
|
effort: request.effort,
|
|
17062
17247
|
effortApplied: effortApplied(request.route),
|
|
17063
17248
|
...frozen
|
|
17064
17249
|
};
|
|
17065
|
-
await mkdir6(
|
|
17250
|
+
await mkdir6(path23.dirname(file), { recursive: true });
|
|
17066
17251
|
await writeJsonAtomically(file, plan);
|
|
17067
17252
|
frozen.requestPlan = {
|
|
17068
|
-
relativePath:
|
|
17253
|
+
relativePath: path23.basename(file),
|
|
17069
17254
|
sha256: evidenceSha256(await readFile5(file))
|
|
17070
17255
|
};
|
|
17071
17256
|
})();
|
|
@@ -17659,16 +17844,57 @@ function projectionWarningAnnotation(failureClass) {
|
|
|
17659
17844
|
function copyClaudeSessionTrace(step, request, attempt) {
|
|
17660
17845
|
return copyRetainedClaudeSession(request, claudeSessionTracePath(step.outPath, step.name, attempt)).catch(() => "session trace write failed");
|
|
17661
17846
|
}
|
|
17662
|
-
|
|
17663
|
-
|
|
17664
|
-
if (reason === undefined)
|
|
17847
|
+
function withTraceMissAnnotation(outcome, miss) {
|
|
17848
|
+
if (miss === undefined)
|
|
17665
17849
|
return outcome;
|
|
17666
17850
|
return {
|
|
17667
17851
|
...outcome,
|
|
17668
17852
|
stderrTail: `${outcome.stderrTail}
|
|
17669
|
-
${claudeTraceCaptureAnnotation(
|
|
17853
|
+
${claudeTraceCaptureAnnotation(miss)}`
|
|
17670
17854
|
};
|
|
17671
17855
|
}
|
|
17856
|
+
async function writeAttemptUsageFacts(input) {
|
|
17857
|
+
const { step, route, attempt, outcome } = input;
|
|
17858
|
+
try {
|
|
17859
|
+
const credential = credentialOfBillingMode(input.billingMode);
|
|
17860
|
+
if (credential === undefined)
|
|
17861
|
+
return;
|
|
17862
|
+
let facts;
|
|
17863
|
+
if (input.transport.backend === "claude-code") {
|
|
17864
|
+
const trace = claudeSessionTracePath(step.outPath, step.name, attempt);
|
|
17865
|
+
const copied = input.miss === undefined && existsSync13(trace);
|
|
17866
|
+
if (!copied && input.miss === undefined && outcome?.modelUsage === undefined) {
|
|
17867
|
+
return;
|
|
17868
|
+
}
|
|
17869
|
+
const claude = (session) => claudeAttemptUsageFacts({
|
|
17870
|
+
attempt,
|
|
17871
|
+
credential,
|
|
17872
|
+
provider: route.provider,
|
|
17873
|
+
session,
|
|
17874
|
+
summary: outcome?.modelUsage
|
|
17875
|
+
});
|
|
17876
|
+
try {
|
|
17877
|
+
facts = await claude(copied ? createInterface({
|
|
17878
|
+
input: createReadStream(trace, "utf8"),
|
|
17879
|
+
crlfDelay: Number.POSITIVE_INFINITY
|
|
17880
|
+
}) : undefined);
|
|
17881
|
+
} catch {
|
|
17882
|
+
facts = await claude(undefined);
|
|
17883
|
+
}
|
|
17884
|
+
} else if (input.transport.backend === "opencode" && outcome !== undefined) {
|
|
17885
|
+
facts = openCodeAttemptUsageFacts({
|
|
17886
|
+
attempt,
|
|
17887
|
+
credential,
|
|
17888
|
+
route: { provider: route.provider, model: route.modelSnapshot },
|
|
17889
|
+
capture: outcome.diagnosticEvidence,
|
|
17890
|
+
totals: outcome.usage.tokens
|
|
17891
|
+
});
|
|
17892
|
+
}
|
|
17893
|
+
if (facts === undefined)
|
|
17894
|
+
return;
|
|
17895
|
+
await writeJsonAtomically(usageFactsPath(step.outPath, step.name, attempt), facts, { compact: true });
|
|
17896
|
+
} catch {}
|
|
17897
|
+
}
|
|
17672
17898
|
function isHarnessStderrAnnotation(line) {
|
|
17673
17899
|
const trimmed = line.trim();
|
|
17674
17900
|
return trimmed === DESTROY_FAILED_ANNOTATION || trimmed === AMBIENT_METERED_ANNOTATION || PROJECTION_WARNING_ANNOTATION.test(trimmed) || CLAUDE_TRACE_MISSES.some((reason) => trimmed === claudeTraceCaptureAnnotation(reason));
|
|
@@ -17685,7 +17911,7 @@ function formatRetryReminder(parseError) {
|
|
|
17685
17911
|
}
|
|
17686
17912
|
async function writeAttemptLog(step, attempt, kind, outcome, classification, cause, rejection) {
|
|
17687
17913
|
const logPath = attemptLogPath(step.outPath, step.name, attempt);
|
|
17688
|
-
await mkdir7(
|
|
17914
|
+
await mkdir7(path24.dirname(logPath), { recursive: true });
|
|
17689
17915
|
await Bun.write(logPath, [
|
|
17690
17916
|
`step: ${step.name}`,
|
|
17691
17917
|
`attempt: ${attempt}`,
|
|
@@ -18239,7 +18465,7 @@ ${line}`;
|
|
|
18239
18465
|
finalText: "",
|
|
18240
18466
|
usage: normalizeUnavailableUsage({
|
|
18241
18467
|
wallMs: harnessWatchdogMs ?? 0,
|
|
18242
|
-
billingMode:
|
|
18468
|
+
billingMode: this.attemptBillingMode(transport)
|
|
18243
18469
|
}),
|
|
18244
18470
|
stderrTail: `Step timed out after ${harnessWatchdogMs}ms`,
|
|
18245
18471
|
timedOut: true
|
|
@@ -18440,7 +18666,7 @@ ${line}`;
|
|
|
18440
18666
|
credentialProjectionId: fallbackCredentialProjectionId,
|
|
18441
18667
|
env: childEnv,
|
|
18442
18668
|
syntheticHome: childEnv.HOME ?? "",
|
|
18443
|
-
syntheticConfigHome: childEnv.CLAUDE_CONFIG_DIR ??
|
|
18669
|
+
syntheticConfigHome: childEnv.CLAUDE_CONFIG_DIR ?? path24.join(childEnv.HOME ?? "", ".claude"),
|
|
18444
18670
|
syntheticTmp: childEnv.TMPDIR ?? "",
|
|
18445
18671
|
verifiedBinaryPath
|
|
18446
18672
|
}
|
|
@@ -18560,6 +18786,12 @@ ${line}`;
|
|
|
18560
18786
|
resultText: lastOutcome?.finalText.slice(-8192) ?? ""
|
|
18561
18787
|
};
|
|
18562
18788
|
}
|
|
18789
|
+
attemptBillingMode(transport) {
|
|
18790
|
+
if (transport.backend !== "claude-code") {
|
|
18791
|
+
return transport.billingMode ?? "unknown";
|
|
18792
|
+
}
|
|
18793
|
+
return envBillsMetered(this.projectedEnv) ? "metered" : "subscription";
|
|
18794
|
+
}
|
|
18563
18795
|
async runAttempt(args) {
|
|
18564
18796
|
const {
|
|
18565
18797
|
step,
|
|
@@ -18827,10 +19059,30 @@ ${line}`;
|
|
|
18827
19059
|
this.attemptAdmissionGate?.reportUnconfirmedRemote?.(this.rateLimitBucketId);
|
|
18828
19060
|
}
|
|
18829
19061
|
if (execution.cancelled) {
|
|
18830
|
-
await copyClaudeSessionTrace(step, request, attempt);
|
|
19062
|
+
const miss = await copyClaudeSessionTrace(step, request, attempt);
|
|
19063
|
+
await writeAttemptUsageFacts({
|
|
19064
|
+
step,
|
|
19065
|
+
route: request.route,
|
|
19066
|
+
attempt,
|
|
19067
|
+
transport,
|
|
19068
|
+
miss,
|
|
19069
|
+
outcome: undefined,
|
|
19070
|
+
billingMode: this.attemptBillingMode(transport)
|
|
19071
|
+
});
|
|
18831
19072
|
return { kind: "cancelled" };
|
|
18832
19073
|
}
|
|
18833
|
-
const
|
|
19074
|
+
const settled = execution.outcome;
|
|
19075
|
+
const miss = await copyClaudeSessionTrace(step, request, attempt);
|
|
19076
|
+
await writeAttemptUsageFacts({
|
|
19077
|
+
step,
|
|
19078
|
+
route: request.route,
|
|
19079
|
+
attempt,
|
|
19080
|
+
transport,
|
|
19081
|
+
miss,
|
|
19082
|
+
outcome: settled,
|
|
19083
|
+
billingMode: settled.usage.billingMode
|
|
19084
|
+
});
|
|
19085
|
+
const outcome = withTraceMissAnnotation(settled, miss);
|
|
18834
19086
|
if (execution.delivery?.delivered) {
|
|
18835
19087
|
return { kind: "delivered", outcome, parsed: execution.delivery.parsed };
|
|
18836
19088
|
}
|
|
@@ -18990,90 +19242,6 @@ init_evidence_redaction();
|
|
|
18990
19242
|
init_redact();
|
|
18991
19243
|
init_preflight2();
|
|
18992
19244
|
|
|
18993
|
-
// src/review/scout.ts
|
|
18994
|
-
init_boundary();
|
|
18995
|
-
var SCOUT_OUTPUT_CONTRACT = [
|
|
18996
|
-
"Your final message must be exactly one JSON object \u2014 no prose, no code",
|
|
18997
|
-
"fences \u2014 of the shape",
|
|
18998
|
-
'{"leads":[{"path":"...","line":123,"why":"one sentence"}]}. A lead',
|
|
18999
|
-
"carries nothing else: no severity, no evidence class, no proof refs, no",
|
|
19000
|
-
'hop trail. If the diff hides no suspicious place, return {"leads":[]} \u2014',
|
|
19001
|
-
"an empty array is a valid, expected result, not a failure."
|
|
19002
|
-
].join(`
|
|
19003
|
-
`);
|
|
19004
|
-
function scoutPrompt(patch, nonce) {
|
|
19005
|
-
return [wrapBlock("patch", nonce, patch), "", SCOUT_OUTPUT_CONTRACT].join(`
|
|
19006
|
-
`);
|
|
19007
|
-
}
|
|
19008
|
-
|
|
19009
|
-
class ScoutValidationError extends Error {
|
|
19010
|
-
}
|
|
19011
|
-
function must4(condition, message) {
|
|
19012
|
-
if (!condition)
|
|
19013
|
-
throw new ScoutValidationError(message);
|
|
19014
|
-
}
|
|
19015
|
-
function validateScoutLeads(candidate) {
|
|
19016
|
-
must4(typeof candidate === "object" && candidate !== null, "scout output must be an object");
|
|
19017
|
-
const d = candidate;
|
|
19018
|
-
must4(Array.isArray(d.leads), "scout output .leads must be an array");
|
|
19019
|
-
return d.leads.map((entry, i) => {
|
|
19020
|
-
must4(typeof entry === "object" && entry !== null, `scout leads[${i}] must be an object`);
|
|
19021
|
-
const lead = entry;
|
|
19022
|
-
must4(typeof lead.path === "string" && lead.path.length > 0, `scout leads[${i}].path required`);
|
|
19023
|
-
must4(typeof lead.path === "string" && lead.path.length <= 400, `scout leads[${i}].path must be at most 400 characters`);
|
|
19024
|
-
const leadPath = lead.path.replace(/^[ab]\//, "");
|
|
19025
|
-
must4(leadPath.length > 0, `scout leads[${i}].path required`);
|
|
19026
|
-
must4(typeof lead.line === "number" && Number.isInteger(lead.line) && lead.line >= 1, `scout leads[${i}].line must be an integer >= 1`);
|
|
19027
|
-
must4(typeof lead.why === "string" && lead.why.length > 0, `scout leads[${i}].why required`);
|
|
19028
|
-
return {
|
|
19029
|
-
path: leadPath,
|
|
19030
|
-
line: lead.line,
|
|
19031
|
-
why: lead.why
|
|
19032
|
-
};
|
|
19033
|
-
});
|
|
19034
|
-
}
|
|
19035
|
-
var MAX_LEADS = 12;
|
|
19036
|
-
var MAX_LEADS_PER_PATH = 3;
|
|
19037
|
-
var MAX_WHY_CHARS = 240;
|
|
19038
|
-
var MAX_LEADS_BLOCK_CHARS = 3000;
|
|
19039
|
-
var LEADS_BLOCK_HEADER = [
|
|
19040
|
-
"Scout leads \u2014 UNVERIFIED suspicions from a diff-only pass that read no",
|
|
19041
|
-
"code. They are not findings, they carry no evidence, and confirming one",
|
|
19042
|
-
"still requires your own proof_refs. Their absence is not evidence of",
|
|
19043
|
-
"absence: your own scan of the whole diff is unchanged."
|
|
19044
|
-
].join(`
|
|
19045
|
-
`);
|
|
19046
|
-
function renderLeadsBlock(leads) {
|
|
19047
|
-
if (leads.length === 0)
|
|
19048
|
-
return "";
|
|
19049
|
-
const bullets = leads.map((l) => `- ${l.path}:${l.line} \u2014 ${l.why}`);
|
|
19050
|
-
return [LEADS_BLOCK_HEADER, "", ...bullets].join(`
|
|
19051
|
-
`);
|
|
19052
|
-
}
|
|
19053
|
-
function capScoutLeads(leads) {
|
|
19054
|
-
let whyTruncated = 0;
|
|
19055
|
-
const truncated = leads.map((lead) => {
|
|
19056
|
-
if (lead.why.length <= MAX_WHY_CHARS)
|
|
19057
|
-
return lead;
|
|
19058
|
-
whyTruncated++;
|
|
19059
|
-
return { ...lead, why: lead.why.slice(0, MAX_WHY_CHARS) };
|
|
19060
|
-
});
|
|
19061
|
-
const perPath = new Map;
|
|
19062
|
-
const pathCapped = [];
|
|
19063
|
-
for (const lead of truncated) {
|
|
19064
|
-
const seen = perPath.get(lead.path) ?? 0;
|
|
19065
|
-
if (seen >= MAX_LEADS_PER_PATH)
|
|
19066
|
-
continue;
|
|
19067
|
-
perPath.set(lead.path, seen + 1);
|
|
19068
|
-
pathCapped.push(lead);
|
|
19069
|
-
}
|
|
19070
|
-
const kept = pathCapped.slice(0, MAX_LEADS);
|
|
19071
|
-
while (kept.length > 0 && renderLeadsBlock(kept).length > MAX_LEADS_BLOCK_CHARS) {
|
|
19072
|
-
kept.pop();
|
|
19073
|
-
}
|
|
19074
|
-
return { leads: kept, dropped: leads.length - kept.length, whyTruncated };
|
|
19075
|
-
}
|
|
19076
|
-
|
|
19077
19245
|
// src/review/step-runner.ts
|
|
19078
19246
|
var DEFAULT_STEP_TIMEOUT_MS = 30 * 60 * 1000;
|
|
19079
19247
|
var DEFAULT_STEP_MAX_ATTEMPTS = 2;
|
|
@@ -19176,7 +19344,7 @@ function makeProofRefResolver(worktree, patch) {
|
|
|
19176
19344
|
const cached = memo.get(candidate);
|
|
19177
19345
|
if (cached !== undefined)
|
|
19178
19346
|
return cached;
|
|
19179
|
-
let resolved = named.has(candidate) ||
|
|
19347
|
+
let resolved = named.has(candidate) || existsSync14(path25.join(worktree, candidate));
|
|
19180
19348
|
if (!resolved && !candidate.includes("/")) {
|
|
19181
19349
|
baseNames ??= treeBaseNames(worktree, named);
|
|
19182
19350
|
if (baseNames === undefined) {
|
|
@@ -19193,11 +19361,11 @@ function treeBaseNames(worktree, named) {
|
|
|
19193
19361
|
if (listed === undefined)
|
|
19194
19362
|
return;
|
|
19195
19363
|
const paths = [...named, ...listed];
|
|
19196
|
-
return new Set(paths.filter(Boolean).map((p) =>
|
|
19364
|
+
return new Set(paths.filter(Boolean).map((p) => path25.posix.basename(p)));
|
|
19197
19365
|
}
|
|
19198
19366
|
function pathsHaveBaseName(paths, name) {
|
|
19199
19367
|
for (const p of paths)
|
|
19200
|
-
if (
|
|
19368
|
+
if (path25.posix.basename(p) === name)
|
|
19201
19369
|
return true;
|
|
19202
19370
|
return false;
|
|
19203
19371
|
}
|
|
@@ -19347,8 +19515,7 @@ function normalisePrIntent(input) {
|
|
|
19347
19515
|
[description cut at ${PR_DESCRIPTION_MAX_CHARS} characters]` : description.text
|
|
19348
19516
|
};
|
|
19349
19517
|
}
|
|
19350
|
-
function hunterPrompt(patch, hopBudget, nonce, toolsEnabled, codegraph,
|
|
19351
|
-
const wrappedLeads = wrapBlock("scout_leads", nonce, leadsBlock);
|
|
19518
|
+
function hunterPrompt(patch, hopBudget, nonce, toolsEnabled, codegraph, intent = { title: "", description: "" }) {
|
|
19352
19519
|
const wrappedTitle = wrapBlock("pr_title", nonce, intent.title);
|
|
19353
19520
|
const wrappedDescription = wrapBlock("pr_description", nonce, intent.description);
|
|
19354
19521
|
return [
|
|
@@ -19366,7 +19533,6 @@ function hunterPrompt(patch, hopBudget, nonce, toolsEnabled, codegraph, leadsBlo
|
|
|
19366
19533
|
"`hops_used` and `hop_trail` are self-reported and may be cross-checked",
|
|
19367
19534
|
"against this run's telemetry MCP-call counts.",
|
|
19368
19535
|
"",
|
|
19369
|
-
...wrappedLeads.length === 0 ? [] : [wrappedLeads, ""],
|
|
19370
19536
|
hunterOutputContract(toolsEnabled)
|
|
19371
19537
|
].join(`
|
|
19372
19538
|
`);
|
|
@@ -19544,7 +19710,7 @@ async function execute(input, deps, state) {
|
|
|
19544
19710
|
const frontmatterByKey = new Map;
|
|
19545
19711
|
for (const agent of reviewSpec.agents) {
|
|
19546
19712
|
try {
|
|
19547
|
-
const parsed = await parseAgentFile(
|
|
19713
|
+
const parsed = await parseAgentFile(path25.join(input.agentsDir, agent.file));
|
|
19548
19714
|
frontmatterByKey.set(agent.key, parsed.model);
|
|
19549
19715
|
} catch {}
|
|
19550
19716
|
}
|
|
@@ -19573,13 +19739,6 @@ async function execute(input, deps, state) {
|
|
|
19573
19739
|
summarizerFrontmatter = parsed.model;
|
|
19574
19740
|
} catch {}
|
|
19575
19741
|
}
|
|
19576
|
-
let scoutFrontmatter;
|
|
19577
|
-
if (input.scout && input.scout.bundled !== true) {
|
|
19578
|
-
try {
|
|
19579
|
-
const parsed = await parseAgentFile(input.scout.promptPath);
|
|
19580
|
-
scoutFrontmatter = parsed.model;
|
|
19581
|
-
} catch {}
|
|
19582
|
-
}
|
|
19583
19742
|
let consolidateFrontmatter;
|
|
19584
19743
|
if (input.consolidate && input.consolidate.bundled !== true) {
|
|
19585
19744
|
try {
|
|
@@ -19602,13 +19761,6 @@ async function execute(input, deps, state) {
|
|
|
19602
19761
|
bundled: input.summarizer.bundled === true
|
|
19603
19762
|
}
|
|
19604
19763
|
},
|
|
19605
|
-
...input.scout === undefined ? {} : {
|
|
19606
|
-
scout: {
|
|
19607
|
-
model: input.scout.model,
|
|
19608
|
-
frontmatterModel: scoutFrontmatter,
|
|
19609
|
-
bundled: input.scout.bundled === true
|
|
19610
|
-
}
|
|
19611
|
-
},
|
|
19612
19764
|
...input.consolidate === undefined ? {} : {
|
|
19613
19765
|
consolidate: {
|
|
19614
19766
|
model: input.consolidate.model,
|
|
@@ -19661,8 +19813,7 @@ async function execute(input, deps, state) {
|
|
|
19661
19813
|
]);
|
|
19662
19814
|
state.boundaryNonce = boundaryNonce;
|
|
19663
19815
|
state.reviewInstructions = gotchas;
|
|
19664
|
-
const stepsDir =
|
|
19665
|
-
const leadsBlock = skipDiscovery || ceilingAborted(deps, state) ? "" : await runScout(input, deps, state, patch, stepsDir, boundaryNonce);
|
|
19816
|
+
const stepsDir = path25.join(input.runDir, "steps");
|
|
19666
19817
|
const stepTimeoutMs = input.stepTimeoutMs ?? DEFAULT_STEP_TIMEOUT_MS;
|
|
19667
19818
|
const huntersAdmitted = !ceilingAborted(deps, state);
|
|
19668
19819
|
const codegraph = await codegraphGranted(input.mcpConfigPath);
|
|
@@ -19671,19 +19822,19 @@ async function execute(input, deps, state) {
|
|
|
19671
19822
|
const agent = await parseAgentFile(agentPromptPath(input, hunter.file));
|
|
19672
19823
|
const prompt = agentPromptChoice(input, hunter, agent);
|
|
19673
19824
|
const name = `hunter-${hunter.key}`;
|
|
19674
|
-
const systemPromptPath =
|
|
19825
|
+
const systemPromptPath = path25.join(stepsDir, `${name}.system.md`);
|
|
19675
19826
|
const shared = input.sharedPrefix === true && routeSharesPrefix(routeForStepKey(routePlan, name));
|
|
19676
19827
|
const body = renderAgentBody(agent.body, {
|
|
19677
19828
|
priors: input.suspicionPriors,
|
|
19678
19829
|
gotchas,
|
|
19679
19830
|
nonce: boundaryNonce
|
|
19680
19831
|
});
|
|
19681
|
-
const sharedBlock = hunterPrompt(patch, input.hopBudget, boundaryNonce, agent.tools.length > 0, codegraph && agent.tools.includes(CODEGRAPH_TOOL),
|
|
19832
|
+
const sharedBlock = hunterPrompt(patch, input.hopBudget, boundaryNonce, agent.tools.length > 0, codegraph && agent.tools.includes(CODEGRAPH_TOOL), prIntent);
|
|
19682
19833
|
if (shared) {
|
|
19683
19834
|
await writeSystemPrompt(systemPromptPath, `${SHARED_PREFIX_HEADER}
|
|
19684
19835
|
|
|
19685
19836
|
${sharedBlock}`);
|
|
19686
|
-
const bodyPath =
|
|
19837
|
+
const bodyPath = path25.join(stepsDir, `${name}.body.md`);
|
|
19687
19838
|
await Bun.write(bodyPath, body);
|
|
19688
19839
|
await chmod(bodyPath, 384);
|
|
19689
19840
|
} else {
|
|
@@ -19700,7 +19851,7 @@ ${SHARED_PREFIX_CLOSING}` : sharedBlock,
|
|
|
19700
19851
|
model: resolveModel(input, hunter.model, prompt.model, hunter.file),
|
|
19701
19852
|
...stepEffortFields(routePlan, name, prompt.effort, agentRoleEffort(input, hunter)),
|
|
19702
19853
|
cwd: input.worktree,
|
|
19703
|
-
outPath:
|
|
19854
|
+
outPath: path25.join(stepsDir, `${name}.draft.json`),
|
|
19704
19855
|
timeoutMs: stepTimeoutMs,
|
|
19705
19856
|
maxAttempts: DEFAULT_STEP_MAX_ATTEMPTS,
|
|
19706
19857
|
...stepRouteFields(routePlan, name),
|
|
@@ -19732,8 +19883,8 @@ ${SHARED_PREFIX_CLOSING}` : sharedBlock,
|
|
|
19732
19883
|
let summarizerConstructionFailed = false;
|
|
19733
19884
|
if (input.summarizer && !skipDiscovery && huntersAdmitted) {
|
|
19734
19885
|
const name = "summarizer";
|
|
19735
|
-
const systemPromptPath =
|
|
19736
|
-
const outPath =
|
|
19886
|
+
const systemPromptPath = path25.join(stepsDir, `${name}.system.md`);
|
|
19887
|
+
const outPath = path25.join(stepsDir, `${name}.summary.json`);
|
|
19737
19888
|
summarizerMeta = {
|
|
19738
19889
|
name,
|
|
19739
19890
|
model: input.summarizer.model ?? input.model ?? "unresolved",
|
|
@@ -19866,14 +20017,14 @@ ${SHARED_PREFIX_CLOSING}` : sharedBlock,
|
|
|
19866
20017
|
const warmName = `warmup-${index + 1}`;
|
|
19867
20018
|
const warmSpec = {
|
|
19868
20019
|
name: warmName,
|
|
19869
|
-
systemPromptPath:
|
|
20020
|
+
systemPromptPath: path25.join(stepsDir, `${warmName}.system.md`),
|
|
19870
20021
|
prompt: "Do not call any tool. This is a cache warm-up, not the review. Reply with exactly: OK",
|
|
19871
20022
|
tools: first.spec.tools,
|
|
19872
20023
|
mcpConfigPath: first.spec.mcpConfigPath,
|
|
19873
20024
|
model: first.spec.model,
|
|
19874
20025
|
effort: first.spec.effort,
|
|
19875
20026
|
cwd: first.spec.cwd,
|
|
19876
|
-
outPath:
|
|
20027
|
+
outPath: path25.join(stepsDir, `${warmName}.out.txt`),
|
|
19877
20028
|
...first.spec.route === undefined ? {} : { route: first.spec.route },
|
|
19878
20029
|
timeoutMs: 2 * 60 * 1000,
|
|
19879
20030
|
maxAttempts: 1,
|
|
@@ -20090,10 +20241,10 @@ async function runRefuter(input, deps, state, batch, options) {
|
|
|
20090
20241
|
claim: s.claim,
|
|
20091
20242
|
proof_refs: s.proof_refs
|
|
20092
20243
|
})), null, 2);
|
|
20093
|
-
await Bun.write(
|
|
20244
|
+
await Bun.write(path25.join(options.stepsDir, "refuter-batch.json"), `${batchJson}
|
|
20094
20245
|
`);
|
|
20095
20246
|
const agent = await parseAgentFile(agentPromptPath(input, options.agent.file));
|
|
20096
|
-
const systemPromptPath =
|
|
20247
|
+
const systemPromptPath = path25.join(options.stepsDir, "refuter.system.md");
|
|
20097
20248
|
await writeSystemPrompt(systemPromptPath, renderAgentBody(agent.body, {
|
|
20098
20249
|
priors: [],
|
|
20099
20250
|
gotchas: state.reviewInstructions ?? NO_REVIEW_INSTRUCTIONS,
|
|
@@ -20127,7 +20278,7 @@ async function runRefuter(input, deps, state, batch, options) {
|
|
|
20127
20278
|
model,
|
|
20128
20279
|
...effortFields,
|
|
20129
20280
|
cwd: input.worktree,
|
|
20130
|
-
outPath:
|
|
20281
|
+
outPath: path25.join(options.stepsDir, `refuter-${survivor.id}.result.json`),
|
|
20131
20282
|
timeoutMs: options.stepTimeoutMs,
|
|
20132
20283
|
maxAttempts: DEFAULT_STEP_MAX_ATTEMPTS,
|
|
20133
20284
|
...stepRouteFields(state.routePlan, agentStepKey(options.agent)),
|
|
@@ -20217,7 +20368,7 @@ async function runVerify(input, deps, state, queued, options) {
|
|
|
20217
20368
|
})), null, 2)}
|
|
20218
20369
|
`);
|
|
20219
20370
|
const agent = await parseAgentFile(agentPromptPath(input, options.agent.file));
|
|
20220
|
-
const systemPromptPath =
|
|
20371
|
+
const systemPromptPath = path25.join(options.stepsDir, "verifier.system.md");
|
|
20221
20372
|
const body = input.verifier === undefined ? agent.body : (await parseAgentFile(input.verifier.promptPath)).body;
|
|
20222
20373
|
await writeSystemPrompt(systemPromptPath, renderAgentBody(body, {
|
|
20223
20374
|
priors: [],
|
|
@@ -20246,7 +20397,7 @@ async function runVerify(input, deps, state, queued, options) {
|
|
|
20246
20397
|
model,
|
|
20247
20398
|
...effortFields,
|
|
20248
20399
|
cwd: input.worktree,
|
|
20249
|
-
outPath:
|
|
20400
|
+
outPath: path25.join(dir, "result.json"),
|
|
20250
20401
|
timeoutMs: options.stepTimeoutMs,
|
|
20251
20402
|
maxAttempts: DEFAULT_STEP_MAX_ATTEMPTS,
|
|
20252
20403
|
...stepRouteFields(state.routePlan, agentStepKey(options.agent)),
|
|
@@ -20349,7 +20500,7 @@ async function runAdjudicate(input, deps, state, queue, options) {
|
|
|
20349
20500
|
}
|
|
20350
20501
|
const body = await Bun.file(adjudicatorPrompt).text();
|
|
20351
20502
|
const agent = await parseAgentFile(agentPromptPath(input, options.agent.file));
|
|
20352
|
-
const systemPromptPath =
|
|
20503
|
+
const systemPromptPath = path25.join(options.stepsDir, "adjudicator.system.md");
|
|
20353
20504
|
await writeSystemPrompt(systemPromptPath, body);
|
|
20354
20505
|
const prompt = agentPromptChoice(input, options.agent, agent);
|
|
20355
20506
|
const model = resolveModel(input, options.agent.model, prompt.model, options.agent.file);
|
|
@@ -20359,7 +20510,7 @@ async function runAdjudicate(input, deps, state, queue, options) {
|
|
|
20359
20510
|
const prompt = composeAdjudicationPrompt(subject, options.nonce);
|
|
20360
20511
|
if (prompt === null)
|
|
20361
20512
|
continue;
|
|
20362
|
-
const dir =
|
|
20513
|
+
const dir = path25.join(options.stepsDir, "adjudicate", subject.priorId);
|
|
20363
20514
|
await mkdir8(dir, { recursive: true });
|
|
20364
20515
|
const spec = {
|
|
20365
20516
|
name: `adjudicate-${subject.priorId}`,
|
|
@@ -20370,7 +20521,7 @@ async function runAdjudicate(input, deps, state, queue, options) {
|
|
|
20370
20521
|
model,
|
|
20371
20522
|
...effortFields,
|
|
20372
20523
|
cwd: input.worktree,
|
|
20373
|
-
outPath:
|
|
20524
|
+
outPath: path25.join(dir, "result.json"),
|
|
20374
20525
|
timeoutMs: options.stepTimeoutMs,
|
|
20375
20526
|
maxAttempts: DEFAULT_STEP_MAX_ATTEMPTS,
|
|
20376
20527
|
...stepRouteFields(state.routePlan, agentStepKey(options.agent)),
|
|
@@ -20427,135 +20578,6 @@ async function runAdjudicate(input, deps, state, queue, options) {
|
|
|
20427
20578
|
state.partial = true;
|
|
20428
20579
|
return outcomes;
|
|
20429
20580
|
}
|
|
20430
|
-
var SCOUT_TIMEOUT_MS = 15 * 60 * 1000;
|
|
20431
|
-
var DEFAULT_SCOUT_MODEL = profileModelAlias(profileRoute(FALLBACK_PROFILE, "scout").model);
|
|
20432
|
-
async function runScout(input, deps, state, patch, stepsDir, nonce) {
|
|
20433
|
-
if (!input.scout) {
|
|
20434
|
-
state.scout = {
|
|
20435
|
-
enabled: false,
|
|
20436
|
-
status: "skipped",
|
|
20437
|
-
leads_count: 0,
|
|
20438
|
-
leads_truncated: 0,
|
|
20439
|
-
why_truncated: 0,
|
|
20440
|
-
duration_ms: 0
|
|
20441
|
-
};
|
|
20442
|
-
return "";
|
|
20443
|
-
}
|
|
20444
|
-
const name = "scout";
|
|
20445
|
-
const systemPromptPath = path24.join(stepsDir, `${name}.system.md`);
|
|
20446
|
-
const outPath = path24.join(stepsDir, `${name}.leads.json`);
|
|
20447
|
-
const meta = {
|
|
20448
|
-
name,
|
|
20449
|
-
model: input.scout.model ?? input.model ?? "unresolved",
|
|
20450
|
-
effort: profileRoleEffort(activeProfile(input), "scout"),
|
|
20451
|
-
tools: [],
|
|
20452
|
-
systemPromptPath,
|
|
20453
|
-
outPath,
|
|
20454
|
-
status: "unsettled"
|
|
20455
|
-
};
|
|
20456
|
-
const record = {
|
|
20457
|
-
enabled: true,
|
|
20458
|
-
model: meta.model,
|
|
20459
|
-
status: "failed",
|
|
20460
|
-
leads_count: 0,
|
|
20461
|
-
leads_truncated: 0,
|
|
20462
|
-
why_truncated: 0,
|
|
20463
|
-
duration_ms: 0
|
|
20464
|
-
};
|
|
20465
|
-
state.scout = record;
|
|
20466
|
-
const startedAt = Date.now();
|
|
20467
|
-
const abandon = (error) => {
|
|
20468
|
-
if ((meta.attempts === undefined || meta.attempts < 1) && meta.failure === undefined) {
|
|
20469
|
-
recordStepFailure(meta, error ?? "scout failed before its first attempt");
|
|
20470
|
-
} else {
|
|
20471
|
-
meta.status = "failed";
|
|
20472
|
-
}
|
|
20473
|
-
state.perAgent.scout ??= failedAgentEntry();
|
|
20474
|
-
record.duration_ms = Date.now() - startedAt;
|
|
20475
|
-
emit(deps, {
|
|
20476
|
-
kind: "scout-finished",
|
|
20477
|
-
ok: false,
|
|
20478
|
-
durationMs: record.duration_ms
|
|
20479
|
-
});
|
|
20480
|
-
return "";
|
|
20481
|
-
};
|
|
20482
|
-
let spec;
|
|
20483
|
-
try {
|
|
20484
|
-
const raw = await Bun.file(input.scout.promptPath).text();
|
|
20485
|
-
const agent = parseAgentSource(raw);
|
|
20486
|
-
await writeSystemPrompt(systemPromptPath, agent.body);
|
|
20487
|
-
const own = enginePromptChoice(input, input.scout, "scout", agent, true);
|
|
20488
|
-
meta.model = resolveModel(input, input.scout.model, own.model, input.scout.promptPath);
|
|
20489
|
-
record.model = meta.model;
|
|
20490
|
-
const scoutEffort = stepEffortFields(state.routePlan, name, own.effort, profileRoleEffort(activeProfile(input), "scout"));
|
|
20491
|
-
meta.effort = scoutEffort.effort;
|
|
20492
|
-
record.prompt_sha256 = new Bun.CryptoHasher("sha256").update(raw).digest("hex");
|
|
20493
|
-
spec = {
|
|
20494
|
-
name,
|
|
20495
|
-
systemPromptPath,
|
|
20496
|
-
prompt: scoutPrompt(patch, nonce),
|
|
20497
|
-
tools: meta.tools,
|
|
20498
|
-
mcpConfigPath: input.mcpConfigPath,
|
|
20499
|
-
model: meta.model,
|
|
20500
|
-
...scoutEffort,
|
|
20501
|
-
cwd: input.worktree,
|
|
20502
|
-
outPath,
|
|
20503
|
-
timeoutMs: SCOUT_TIMEOUT_MS,
|
|
20504
|
-
maxAttempts: 1,
|
|
20505
|
-
...stepRouteFields(state.routePlan, name),
|
|
20506
|
-
parse: (finalText) => {
|
|
20507
|
-
const extracted = extractJsonObject(finalText);
|
|
20508
|
-
if (extracted === undefined) {
|
|
20509
|
-
throw new Error("scout final message has no JSON object");
|
|
20510
|
-
}
|
|
20511
|
-
return validateScoutLeads(extracted);
|
|
20512
|
-
},
|
|
20513
|
-
onRetry: (info) => emit(deps, { kind: "step-retry", ...info })
|
|
20514
|
-
};
|
|
20515
|
-
} catch (error) {
|
|
20516
|
-
state.steps.push(meta);
|
|
20517
|
-
return abandon(error);
|
|
20518
|
-
}
|
|
20519
|
-
if (spec.route !== undefined) {
|
|
20520
|
-
meta.route = spec.route;
|
|
20521
|
-
Object.assign(meta, routeEffortFields(spec.route));
|
|
20522
|
-
const routedModel = effectiveExecutionModel(spec);
|
|
20523
|
-
meta.model = routedModel;
|
|
20524
|
-
record.model = routedModel;
|
|
20525
|
-
}
|
|
20526
|
-
state.steps.push(meta);
|
|
20527
|
-
emit(deps, { kind: "scout-started", model: meta.model });
|
|
20528
|
-
let result;
|
|
20529
|
-
try {
|
|
20530
|
-
result = await deps.runner.run(spec);
|
|
20531
|
-
} catch (error) {
|
|
20532
|
-
return abandon(error);
|
|
20533
|
-
}
|
|
20534
|
-
state.perAgent.scout = perAgentEntry(result);
|
|
20535
|
-
recordSettlement(meta, result, input.runDir);
|
|
20536
|
-
record.model = meta.model;
|
|
20537
|
-
state.usageTotal = sumUsage(state.usageTotal, result.usage);
|
|
20538
|
-
accumulateUsageV2(state, result);
|
|
20539
|
-
if (result.status !== "ok")
|
|
20540
|
-
return abandon();
|
|
20541
|
-
const capped = capScoutLeads(result.output);
|
|
20542
|
-
const block = renderLeadsBlock(capped.leads);
|
|
20543
|
-
if (blockForgesNonce(block, nonce))
|
|
20544
|
-
return abandon();
|
|
20545
|
-
meta.status = "ok";
|
|
20546
|
-
record.status = "ok";
|
|
20547
|
-
record.leads_count = capped.leads.length;
|
|
20548
|
-
record.leads_truncated = capped.dropped;
|
|
20549
|
-
record.why_truncated = capped.whyTruncated;
|
|
20550
|
-
record.duration_ms = Date.now() - startedAt;
|
|
20551
|
-
emit(deps, {
|
|
20552
|
-
kind: "scout-finished",
|
|
20553
|
-
ok: true,
|
|
20554
|
-
durationMs: record.duration_ms,
|
|
20555
|
-
leads: capped.leads.length
|
|
20556
|
-
});
|
|
20557
|
-
return renderLeadsBlock(capped.leads);
|
|
20558
|
-
}
|
|
20559
20581
|
var CONSOLIDATE_TIMEOUT_MS = 10 * 60 * 1000;
|
|
20560
20582
|
var CONSOLIDATE_MAX_ATTEMPTS = 2;
|
|
20561
20583
|
function ceilingGraceMs(input) {
|
|
@@ -20623,8 +20645,8 @@ async function runConsolidation(input, deps, state, stepsDir, nonce) {
|
|
|
20623
20645
|
return;
|
|
20624
20646
|
}
|
|
20625
20647
|
const name = "consolidate";
|
|
20626
|
-
const systemPromptPath =
|
|
20627
|
-
const outPath =
|
|
20648
|
+
const systemPromptPath = path25.join(stepsDir, `${name}.system.md`);
|
|
20649
|
+
const outPath = path25.join(stepsDir, `${name}.plan.json`);
|
|
20628
20650
|
const meta = {
|
|
20629
20651
|
name,
|
|
20630
20652
|
model: input.consolidate.model ?? input.model ?? "unresolved",
|
|
@@ -20736,13 +20758,13 @@ function skippedMateriality(input, state) {
|
|
|
20736
20758
|
};
|
|
20737
20759
|
}
|
|
20738
20760
|
async function materialityWindow(worktree, relPath, line) {
|
|
20739
|
-
if (
|
|
20761
|
+
if (path25.isAbsolute(relPath))
|
|
20740
20762
|
return null;
|
|
20741
20763
|
try {
|
|
20742
20764
|
const root = await realpath4(worktree);
|
|
20743
|
-
const target = await realpath4(
|
|
20744
|
-
const rel =
|
|
20745
|
-
if (rel === "" || rel === ".." || rel.startsWith(`..${
|
|
20765
|
+
const target = await realpath4(path25.join(root, relPath));
|
|
20766
|
+
const rel = path25.relative(root, target);
|
|
20767
|
+
if (rel === "" || rel === ".." || rel.startsWith(`..${path25.sep}`) || path25.isAbsolute(rel)) {
|
|
20746
20768
|
return null;
|
|
20747
20769
|
}
|
|
20748
20770
|
const file = Bun.file(target);
|
|
@@ -20807,8 +20829,8 @@ async function runMaterialityJudge(input, deps, state, stepsDir, nonce) {
|
|
|
20807
20829
|
judge.splice(waves * cap);
|
|
20808
20830
|
}
|
|
20809
20831
|
}
|
|
20810
|
-
const systemPromptPath =
|
|
20811
|
-
const mcpConfigPath =
|
|
20832
|
+
const systemPromptPath = path25.join(stepsDir, "materiality.system.md");
|
|
20833
|
+
const mcpConfigPath = path25.join(stepsDir, "materiality.mcp.json");
|
|
20812
20834
|
try {
|
|
20813
20835
|
const raw = await Bun.file(input.materiality.promptPath).text();
|
|
20814
20836
|
const agent = parseAgentSource(raw);
|
|
@@ -20838,7 +20860,7 @@ async function runMaterialityJudge(input, deps, state, stepsDir, nonce) {
|
|
|
20838
20860
|
record.skipped_unsafe++;
|
|
20839
20861
|
continue;
|
|
20840
20862
|
}
|
|
20841
|
-
const dir =
|
|
20863
|
+
const dir = path25.join(stepsDir, "materiality", finding.id);
|
|
20842
20864
|
await mkdir8(dir, { recursive: true });
|
|
20843
20865
|
const spec = {
|
|
20844
20866
|
name: `materiality-${finding.id}`,
|
|
@@ -20849,7 +20871,7 @@ async function runMaterialityJudge(input, deps, state, stepsDir, nonce) {
|
|
|
20849
20871
|
model: route?.modelSnapshot ?? MATERIALITY_JUDGE_MODEL,
|
|
20850
20872
|
effort,
|
|
20851
20873
|
cwd: input.worktree,
|
|
20852
|
-
outPath:
|
|
20874
|
+
outPath: path25.join(dir, "result.json"),
|
|
20853
20875
|
timeoutMs: MATERIALITY_TIMEOUT_MS,
|
|
20854
20876
|
maxAttempts: MATERIALITY_MAX_ATTEMPTS,
|
|
20855
20877
|
...route === undefined ? {} : { route },
|
|
@@ -21105,7 +21127,6 @@ async function writePipelinePlan(input, state) {
|
|
|
21105
21127
|
},
|
|
21106
21128
|
generated_at: new Date().toISOString(),
|
|
21107
21129
|
...state.boundaryNonce === undefined ? {} : { boundary_nonce: state.boundaryNonce },
|
|
21108
|
-
...state.scout === undefined ? {} : { scout: state.scout },
|
|
21109
21130
|
...state.consolidation === undefined ? {} : { consolidation: state.consolidation },
|
|
21110
21131
|
materiality: state.materiality ?? skippedMateriality(input, state),
|
|
21111
21132
|
...input.sharedPrefix === true ? { shared_prefix: true } : {},
|
|
@@ -21117,7 +21138,7 @@ async function writePipelinePlan(input, state) {
|
|
|
21117
21138
|
steps: state.steps
|
|
21118
21139
|
};
|
|
21119
21140
|
try {
|
|
21120
|
-
await writeJsonAtomically(
|
|
21141
|
+
await writeJsonAtomically(path25.join(input.runDir, "pipeline.json"), plan);
|
|
21121
21142
|
} catch (error) {
|
|
21122
21143
|
state.snapshotWritten = false;
|
|
21123
21144
|
throw error;
|
|
@@ -21317,18 +21338,29 @@ function recordSettlement(meta, result, runDir) {
|
|
|
21317
21338
|
}
|
|
21318
21339
|
return;
|
|
21319
21340
|
}
|
|
21320
|
-
meta.attemptEvidencePath =
|
|
21321
|
-
meta.attemptLogPath =
|
|
21322
|
-
meta.settlementReceiptPath =
|
|
21341
|
+
meta.attemptEvidencePath = path25.relative(runDir, attemptEvidencePath(meta.outPath, meta.name, result.attempts));
|
|
21342
|
+
meta.attemptLogPath = path25.relative(runDir, attemptLogPath(meta.outPath, meta.name, result.attempts));
|
|
21343
|
+
meta.settlementReceiptPath = path25.relative(runDir, settlementReceiptPath(meta.outPath, meta.name, result.attempts));
|
|
21323
21344
|
const tracePaths = [];
|
|
21324
21345
|
for (let attempt = 1;attempt <= result.attempts; attempt++) {
|
|
21325
21346
|
const absolute = claudeSessionTracePath(meta.outPath, meta.name, attempt);
|
|
21326
|
-
if (
|
|
21327
|
-
tracePaths.push(
|
|
21347
|
+
if (existsSync14(absolute)) {
|
|
21348
|
+
tracePaths.push(path25.relative(runDir, absolute));
|
|
21328
21349
|
}
|
|
21329
21350
|
}
|
|
21330
21351
|
if (tracePaths.length > 0)
|
|
21331
21352
|
meta.tracePaths = tracePaths;
|
|
21353
|
+
const usageFacts = [];
|
|
21354
|
+
for (let attempt = 1;attempt <= result.attempts; attempt++) {
|
|
21355
|
+
const file = usageFactsPath(meta.outPath, meta.name, attempt);
|
|
21356
|
+
if (!existsSync14(file))
|
|
21357
|
+
continue;
|
|
21358
|
+
try {
|
|
21359
|
+
usageFacts.push(JSON.parse(readFileSync7(file, "utf8")));
|
|
21360
|
+
} catch {}
|
|
21361
|
+
}
|
|
21362
|
+
if (usageFacts.length > 0)
|
|
21363
|
+
meta.usage_facts = usageFacts;
|
|
21332
21364
|
}
|
|
21333
21365
|
var FAILURE_REASON_MAX = 500;
|
|
21334
21366
|
function redactFailureText(raw) {
|
|
@@ -21359,17 +21391,17 @@ var USD_PER_CHANGED_LINE = 0.00021;
|
|
|
21359
21391
|
var USD_PER_FILE = 0.008;
|
|
21360
21392
|
var BAND_LOW = 0.65;
|
|
21361
21393
|
var BAND_HIGH = 1.4;
|
|
21362
|
-
function estimateCost(diffStat, hunterCount, summarizerEnabled = false,
|
|
21394
|
+
function estimateCost(diffStat, hunterCount, summarizerEnabled = false, verificationSteps = 0, consolidateEnabled = false) {
|
|
21363
21395
|
const files = Math.max(0, diffStat.files);
|
|
21364
21396
|
const lines = Math.max(0, diffStat.insertions) + Math.max(0, diffStat.deletions);
|
|
21365
|
-
const hunterSeats = Math.max(0, hunterCount + (summarizerEnabled ? 1 : 0) + (
|
|
21397
|
+
const hunterSeats = Math.max(0, hunterCount + (summarizerEnabled ? 1 : 0) + (consolidateEnabled ? 1 : 0));
|
|
21366
21398
|
const steps = Math.max(0, verificationSteps);
|
|
21367
21399
|
const agents = hunterSeats === 0 && steps === 0 ? 1 : hunterSeats;
|
|
21368
21400
|
const mid = agents * (USD_PER_AGENT_BASE + USD_PER_CHANGED_LINE * lines + USD_PER_FILE * files) + steps * USD_PER_AGENT_BASE;
|
|
21369
21401
|
return {
|
|
21370
21402
|
low: round2(mid * BAND_LOW),
|
|
21371
21403
|
high: round2(mid * BAND_HIGH),
|
|
21372
|
-
basis: "coarse band from measured runs (a 7-file / +21 \u22128 tree with 3 " + "hunters + refuter, $3.92\u2013$4.74 across two runs; a 45-file / " + "+2775 \u22121237 tree with 5 hunters + refuter, ~$11\u2013$14.78): a " + "per-agent floor for hunters + refuter" + `${summarizerEnabled ? " + summarizer" : ""}` + `${
|
|
21404
|
+
basis: "coarse band from measured runs (a 7-file / +21 \u22128 tree with 3 " + "hunters + refuter, $3.92\u2013$4.74 across two runs; a 45-file / " + "+2775 \u22121237 tree with 5 hunters + refuter, ~$11\u2013$14.78): a " + "per-agent floor for hunters + refuter" + `${summarizerEnabled ? " + summarizer" : ""}` + `${consolidateEnabled ? " + consolidation" : ""}` + `${steps > 0 ? ` + ${steps} verification step(s)` : ""} ` + "plus changed lines and files. An order-of-magnitude " + "guide, not a quote \u2014 the same tree has billed 34% apart across runs."
|
|
21373
21405
|
};
|
|
21374
21406
|
}
|
|
21375
21407
|
function agentRows(doc) {
|
|
@@ -21965,10 +21997,6 @@ function runLines(doc, meta) {
|
|
|
21965
21997
|
lines.push("");
|
|
21966
21998
|
lines.push(`Agents: ${rows.map((r) => `${r.key} ${r.status}`).join(" \xB7 ")}`);
|
|
21967
21999
|
}
|
|
21968
|
-
if (!doc.parity_hunter_fired) {
|
|
21969
|
-
lines.push("");
|
|
21970
|
-
lines.push("The parity hunter did not fire: no changed path matched its trigger.");
|
|
21971
|
-
}
|
|
21972
22000
|
return lines;
|
|
21973
22001
|
}
|
|
21974
22002
|
function section2(title, doc, tier, summary) {
|
|
@@ -22154,7 +22182,6 @@ export {
|
|
|
22154
22182
|
DEFAULT_HOP_BUDGET,
|
|
22155
22183
|
DEFAULT_MAX_VERIFICATION_STEPS,
|
|
22156
22184
|
DEFAULT_PIPELINE_TIMEOUT_MS,
|
|
22157
|
-
DEFAULT_SCOUT_MODEL,
|
|
22158
22185
|
DEFAULT_STEP_MAX_ATTEMPTS,
|
|
22159
22186
|
DEFAULT_STEP_TIMEOUT_MS,
|
|
22160
22187
|
DEFAULT_SUMMARY_MODEL,
|
|
@@ -22180,6 +22207,7 @@ export {
|
|
|
22180
22207
|
NO_REVIEW_INSTRUCTIONS,
|
|
22181
22208
|
OpenCodeProductionGatedError,
|
|
22182
22209
|
OpenCodeVersionAdmissionError,
|
|
22210
|
+
PARITY_REMOVED,
|
|
22183
22211
|
PIPELINE_SCHEMA_VERSION,
|
|
22184
22212
|
REMOVED_ROUTING_MESSAGE,
|
|
22185
22213
|
REVIEW_MD_TEMPLATE,
|
|
@@ -22283,6 +22311,8 @@ export {
|
|
|
22283
22311
|
readInstalledOpenCodeSdkVersion,
|
|
22284
22312
|
recordClassOf,
|
|
22285
22313
|
refuterPrompt,
|
|
22314
|
+
removedFlagWarnings,
|
|
22315
|
+
removedHunterRoles,
|
|
22286
22316
|
renderAgentBody,
|
|
22287
22317
|
renderInlineComment,
|
|
22288
22318
|
renderIssueFindingComment,
|
|
@@ -22304,7 +22334,6 @@ export {
|
|
|
22304
22334
|
resolveModelRoute,
|
|
22305
22335
|
resolveOpenCodeSdkV2Entry,
|
|
22306
22336
|
resolvePost,
|
|
22307
|
-
resolveScout,
|
|
22308
22337
|
resolveSharedPrefix,
|
|
22309
22338
|
resolveSpecialty,
|
|
22310
22339
|
resolveStepModel,
|