crysk 0.4.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/README.md +26 -17
  2. package/config/models/anthropic.json +1 -1
  3. package/dist/SKILL-k4k0zn1w.md +143 -0
  4. package/dist/SKILL-vhb4c3vv.md +553 -0
  5. package/dist/SKILL-xpf6kmdw.md +74 -0
  6. package/dist/ci-admission-0ken6ehx.md +128 -0
  7. package/dist/cli.js +3056 -1623
  8. package/dist/index.js +1744 -938
  9. package/dist/opencode-ci-ac5zksdn.md +106 -0
  10. package/dist/workflow-4pkyck01.yml +160 -0
  11. package/package.json +1 -1
  12. package/prompts/default/PROVENANCE.md +1 -0
  13. package/skills/crysk/SKILL.md +16 -16
  14. package/skills/crysk-ci-setup/SKILL.md +41 -38
  15. package/skills/crysk-ci-setup/assets/workflow.yml +31 -22
  16. package/skills/crysk-ci-setup/references/ci-admission.md +1 -1
  17. package/skills/crysk-ci-setup/references/opencode-ci.md +53 -88
  18. package/skills/crysk-loop/SKILL.md +1 -1
  19. package/src/asset-manifest.ts +0 -4
  20. package/src/assets.ts +1 -1
  21. package/src/ci/admission-ledger.ts +4 -0
  22. package/src/ci/classify-error.ts +21 -24
  23. package/src/ci/cli-record.ts +53 -1
  24. package/src/ci/crysk-secrets.ts +409 -0
  25. package/src/ci/force-comment.ts +14 -1
  26. package/src/ci/gates.ts +86 -57
  27. package/src/ci/outcome.ts +421 -330
  28. package/src/ci/platform-config.ts +2 -2
  29. package/src/ci/platform-estimate.ts +111 -0
  30. package/src/ci/platform-report.ts +274 -41
  31. package/src/ci/platform-trace.ts +581 -0
  32. package/src/ci/platform.ts +58 -12
  33. package/src/ci/publish.ts +19 -6
  34. package/src/ci/reporter.ts +14 -4
  35. package/src/ci/review-levels.ts +8 -7
  36. package/src/ci/run.ts +88 -0
  37. package/src/ci/setup.ts +485 -118
  38. package/src/ci/trace-bundle.ts +1486 -0
  39. package/src/ci/trace-transcripts.ts +480 -0
  40. package/src/ci/trigger.ts +176 -33
  41. package/src/cli.ts +11 -3
  42. package/src/commands/ci-setup-questions.ts +3 -3
  43. package/src/commands/ci-setup.ts +152 -6
  44. package/src/commands/config.ts +3 -0
  45. package/src/commands/doctor.ts +15 -6
  46. package/src/config/config.ts +16 -3
  47. package/src/diversity/clustering.ts +0 -1
  48. package/src/diversity/identity.ts +4 -5
  49. package/src/diversity/pipeline-integration.ts +1 -9
  50. package/src/doctor.ts +3 -3
  51. package/src/execution/attempt-evidence.ts +10 -5
  52. package/src/execution/claude-session-trace.ts +480 -0
  53. package/src/execution/contracts.ts +21 -4
  54. package/src/execution/harness.ts +105 -8
  55. package/src/execution/model-fallback.ts +239 -0
  56. package/src/execution/usage-normalized.ts +6 -4
  57. package/src/home-preflight.ts +1 -1
  58. package/src/index.ts +1 -1
  59. package/src/model/catalog.ts +13 -37
  60. package/src/model/free-discovery.ts +117 -8
  61. package/src/model/model-name.ts +404 -0
  62. package/src/model/provider-capabilities.ts +22 -7
  63. package/src/model/routing.ts +346 -467
  64. package/src/pr/admission.ts +18 -0
  65. package/src/pr/ci-admission-gate.ts +2 -0
  66. package/src/pr/discovery.ts +18 -0
  67. package/src/pr/plan.ts +55 -5
  68. package/src/pr/preflight.ts +1 -1
  69. package/src/pr/publish-outcome.ts +1 -1
  70. package/src/pr/review-pr.ts +26 -1
  71. package/src/pr/target.ts +63 -11
  72. package/src/production-runtime.ts +760 -331
  73. package/src/review/pipeline.ts +277 -101
  74. package/src/review/preflight.ts +201 -294
  75. package/src/review/report.ts +30 -26
  76. package/src/review/review.ts +20 -3
  77. package/src/review/route-preflight.ts +79 -11
  78. package/src/review/run.ts +44 -6
  79. package/src/review/scout.ts +1 -1
  80. package/src/review/spec.ts +3 -3
  81. package/src/review/step-runner.ts +70 -1
  82. package/src/runner-authority.ts +127 -9
  83. package/src/security/binding-policy.ts +1 -2
  84. package/src/security/claude-credential.ts +355 -0
  85. package/src/security/credential-broker.ts +56 -40
  86. package/src/security/evidence-redaction.ts +179 -4
  87. package/src/security/opencode-secret-manifest.ts +114 -0
  88. package/src/security/redact.ts +45 -0
  89. package/src/system-tools.ts +48 -21
  90. package/src/transport-registry.ts +12 -2
  91. package/src/transports/claude-code-cli.ts +21 -2
  92. package/src/transports/opencode-sdk.ts +11 -9
  93. package/src/transports/opencode-server.ts +7 -10
  94. package/src/ui/config-edit.ts +9 -20
  95. package/src/ui/config.ts +32 -27
  96. package/src/ui/plan.ts +84 -50
  97. package/src/updater.ts +10 -7
  98. package/prompts/default/deep-review-lifecycle.md +0 -362
@@ -2,9 +2,13 @@ import { createHash } from "node:crypto";
2
2
  import { lstatSync, readFileSync } from "node:fs";
3
3
  import { isEffort } from "#model/catalog";
4
4
  import { CLAUDE_CAPABILITY_STATICS } from "#model/provider-capabilities";
5
- import { spawnModelForClaudeCli } from "#model/routing";
5
+ import { claudeCliModel } from "#model/routing";
6
6
  import type { BucketScope } from "../execution/bucket-id";
7
7
  import { deriveBucketId } from "../execution/bucket-id";
8
+ import {
9
+ newClaudeSessionId,
10
+ retainClaudeSession,
11
+ } from "../execution/claude-session-trace";
8
12
  import type {
9
13
  FailureCredential,
10
14
  ObservedModel,
@@ -745,7 +749,7 @@ export class ClaudeCodeCliTransport implements ProviderTransport {
745
749
  "--permission-mode",
746
750
  "bypassPermissions",
747
751
  "--model",
748
- spawnModelForClaudeCli(request.route, request.executionModel),
752
+ claudeCliModel(request.route),
749
753
  "--effort",
750
754
  request.effort,
751
755
  // Moves the per-machine sections (cwd, env info, git status) out of the
@@ -758,6 +762,13 @@ export class ClaudeCodeCliTransport implements ProviderTransport {
758
762
  "--exclude-dynamic-system-prompt-sections",
759
763
  );
760
764
 
765
+ // The engine names the session so its transcript can be found however
766
+ // the attempt ends, including a timeout, a kill or a cancel that leaves no
767
+ // result to read the id from. `-p` never resumes, so a fresh id per spawn
768
+ // cannot collide.
769
+ const claudeSessionId = newClaudeSessionId();
770
+ args.push("--session-id", claudeSessionId);
771
+
761
772
  const start = performance.now();
762
773
 
763
774
  // §6.3: hash/mode/symlink verification happens immediately before spawn;
@@ -821,6 +832,7 @@ export class ClaudeCodeCliTransport implements ProviderTransport {
821
832
  }
822
833
 
823
834
  ACTIVE_CHILD_PROCS.add(proc);
835
+ retainClaudeSession(request, claudeSessionId);
824
836
 
825
837
  let cascadePromise: Promise<CascadeResult> | undefined;
826
838
  let provenPgid: number | undefined;
@@ -969,6 +981,10 @@ export class ClaudeCodeCliTransport implements ProviderTransport {
969
981
  ...(escalatedToKill ? { signal: "SIGKILL" } : {}),
970
982
  };
971
983
 
984
+ // The result's `session_id` is not read for the transcript: the id passed
985
+ // as `--session-id` is the one retained at spawn, and it wins if the two
986
+ // ever differ, because only it exists on every way an attempt ends.
987
+ //
972
988
  // The CLI exits 0 when the API rejected the request, with the provider's message in
973
989
  // `result`. That message is not the agent's answer: it fails the attempt with its
974
990
  // typed cause, is never handed to the draft parser (which would spend a format retry
@@ -1292,6 +1308,9 @@ function oneLine(words: string, room: number): string {
1292
1308
 
1293
1309
  // The secret the child ran on. The per-token variables (the list envBillsMetered reads) win
1294
1310
  // over CLAUDE_CODE_OAUTH_TOKEN, and a whitespace-only value is no credential (the same trim).
1311
+ // Since S5 a review run's child holds exactly one of them (the credential chosen at run
1312
+ // start, security/claude-credential.ts), so the precedence below only decides for callers
1313
+ // that build their own env.
1295
1314
  //
1296
1315
  // The precedence is observed, not assumed. With CLI 2.1.312 and both an API key and an
1297
1316
  // OAuth login present, the CLI prints "claude.ai connectors are disabled because
@@ -1131,14 +1131,16 @@ export class OpenCodeSdkTransport implements ProviderTransport {
1131
1131
  });
1132
1132
  });
1133
1133
 
1134
- // `request.effort` is deliberately NOT forwarded. Effort is a Claude Code
1135
- // CLI control (`claude --effort`, #299); OpenCode's closest equivalent is
1136
- // per-model reasoning variants, whose levels differ by provider and are
1137
- // not the same scale, so mapping one onto the other here would invent a
1138
- // meaning. That is a separate decision. What this backend does instead is
1139
- // honest about it: the request plan still records the level the engine
1140
- // asked for, with `effortApplied: false` (attempt-evidence.ts), and
1141
- // pipeline.json says `effort_applied: false`.
1134
+ // `request.effort` is deliberately NOT forwarded. It is on the Claude
1135
+ // Code CLI's scale (`claude --effort`, #299); OpenCode's equivalent is
1136
+ // per-model reasoning variants, whose names differ by provider, so
1137
+ // mapping one onto the other here would invent a meaning. A variant
1138
+ // reaches OpenCode only when a `models` entry names one as its `effort`
1139
+ // (S7): it is the route's `modelVariant`, sent with the model by the
1140
+ // client (transport-registry.ts), and admission has checked it against
1141
+ // the model's variants. Without one, no variant is sent (D1), the
1142
+ // request plan records the level as intent with `effortApplied: false`
1143
+ // (attempt-evidence.ts), and pipeline.json says `effort_applied: false`.
1142
1144
  createPromise = this.client.createSession({
1143
1145
  correlation: { sessionId: request.sessionId, attempt: request.attempt },
1144
1146
  signal: operation.signal,
@@ -2245,7 +2247,7 @@ export class OpenCodeSdkTransport implements ProviderTransport {
2245
2247
  // true is the provider asking for another attempt; that is the transient
2246
2248
  // budget, never the format one.
2247
2249
  // A refusal whose slot reports HTTP 404 names a model the provider does not
2248
- // serve: no retry can make it exist, and PRH-MODEL-UNAVAILABLE says so with
2250
+ // serve: no retry can make it exist, and CRYSK-MODEL-UNAVAILABLE says so with
2249
2251
  // the provider's name. Only the status slot decides, never the message.
2250
2252
  if (
2251
2253
  witness.includes(MARKER_PROVIDER_REFUSAL) &&
@@ -455,16 +455,13 @@ export async function launchProjectedOpenCodeServer(
455
455
  // route by runner-authority.ts's credentialKindForRoute, and this server
456
456
  // is handed the one its binding resolved.
457
457
  //
458
- // SCOPE NOTE, not solved here: this server is ONE per backend and
459
- // outlives every step, so a plan mixing an `openai` OAuth route with a
460
- // `zai` API-token route needs two credentials behind one server. That
461
- // case is refused upstream — the metered route has no pricing table yet,
462
- // so the exact-binding gate blocks it per binding before anything
463
- // launches (test/production-runtime.test.ts, "a plan mixing an OAuth
464
- // provider and an API-token provider is refused per binding"). When #137
465
- // prices those routes, this becomes reachable and needs a server per
466
- // credential; until then it must fail LOUD, which it does — a broker
467
- // handed the wrong kind refuses it by name.
458
+ // U4 (S9): this server serves ONE route (the registry caches one
459
+ // transport, so one client and one server, per route fingerprint), and
460
+ // its broker is that route's own, forwarded by FrozenRuntimeBinding.
461
+ // acquire(). A plan naming several providers, or a free model beside a
462
+ // metered one, therefore gets one server per route, each projected with
463
+ // only its credential's record; a broker handed the wrong kind still
464
+ // refuses it by name.
468
465
  sessionId: "opencode-server",
469
466
  credentialRef: "opencode-auth",
470
467
  kind: credentialKind,
@@ -10,6 +10,9 @@ import { resolveHomeDir, resolveRepoDir } from "../brand-paths";
10
10
  import { bold, box, cyan, dim, sanitizeText, yellow } from "./primitives";
11
11
  import type { KeyReader } from "./select";
12
12
 
13
+ const SUMMARY_MODEL_GONE =
14
+ 'summary.model is gone: set the summary model per person, under models in ~/.crysk/config.json, e.g. "models": {"summary": ["claude:haiku-latest"]}';
15
+
13
16
  export interface ConfigEntry {
14
17
  key: string;
15
18
  value: string;
@@ -462,16 +465,9 @@ export async function setConfigValue(input: {
462
465
  enabled: b,
463
466
  };
464
467
  } else if (input.key === "summary.model") {
465
- if (typeof input.value !== "string" || input.value.trim().length === 0) {
466
- throw new Error("summary.model must be a non-empty string");
467
- }
468
- currentRepo.summary = {
469
- ...(typeof currentRepo.summary === "object" &&
470
- currentRepo.summary !== null
471
- ? (currentRepo.summary as Record<string, unknown>)
472
- : {}),
473
- model: input.value.trim(),
474
- };
468
+ // Gone (L6 item 1): writing it would plant the very key the parser now
469
+ // refuses. Say where the summary model lives instead.
470
+ throw new Error(SUMMARY_MODEL_GONE);
475
471
  } else if (input.key === "default_base") {
476
472
  if (typeof input.value !== "string" || input.value.trim().length === 0) {
477
473
  throw new Error("default_base must be a non-empty string");
@@ -629,16 +625,9 @@ export async function setConfigValue(input: {
629
625
  enabled: b,
630
626
  };
631
627
  } else if (input.key === "summary.model") {
632
- if (typeof input.value !== "string" || input.value.trim().length === 0) {
633
- throw new Error("summary.model must be a non-empty string");
634
- }
635
- currentPerson.summary = {
636
- ...(typeof currentPerson.summary === "object" &&
637
- currentPerson.summary !== null
638
- ? (currentPerson.summary as Record<string, unknown>)
639
- : {}),
640
- model: input.value.trim(),
641
- };
628
+ // Gone (L6 item 1): writing it would plant the very key the parser now
629
+ // refuses. Say where the summary model lives instead.
630
+ throw new Error(SUMMARY_MODEL_GONE);
642
631
  } else if (input.key === "agents_dir") {
643
632
  currentPerson.agents_dir = input.value.trim();
644
633
  } else if (input.key === "scout") {
package/src/ui/config.ts CHANGED
@@ -18,6 +18,7 @@
18
18
  // Here the exhaustive list IS the product — a key missing from the listing
19
19
  // would read as "pr-hero has no such setting".
20
20
 
21
+ import { modelEntry } from "#model/model-name";
21
22
  import type {
22
23
  ConfigSource,
23
24
  ConfigSources,
@@ -108,34 +109,38 @@ function priorsCell(
108
109
  );
109
110
  }
110
111
 
111
- function routingCell(
112
- routing: LocalConfig["routing"],
112
+ // One cell for the whole object, one `role=model,model` entry per role, in
113
+ // the order the file wrote them: the list order is the fallback order. An
114
+ // entry with an effort reads `model (effort <level>)` (S7); without one it is
115
+ // the bare name, whichever form the file used.
116
+ function modelsCell(
117
+ models: LocalConfig["models"],
113
118
  source: ConfigSource,
114
119
  ): ConfigCell {
115
- if (source === "default" || routing === undefined) {
116
- return { value: UNSET, source };
117
- }
118
- const mappingsCount = routing.mappings
119
- ? Array.isArray(routing.mappings)
120
- ? routing.mappings.length
121
- : Object.keys(routing.mappings).length
122
- : 0;
123
- if (mappingsCount === 0 && routing.default) {
124
- return {
125
- value: "default route",
126
- source,
127
- };
128
- }
129
- if (mappingsCount > 0 && routing.default) {
130
- return {
131
- value: `${mappingsCount} mapping${mappingsCount === 1 ? "" : "s"} (+ default)`,
132
- source,
133
- };
134
- }
135
- return {
136
- value: `${mappingsCount} mapping${mappingsCount === 1 ? "" : "s"}`,
120
+ return listCell(
121
+ Object.entries(models ?? {}).map(
122
+ ([role, list]) =>
123
+ `${role}=${list
124
+ .map((entry) => {
125
+ const { name, effort } = modelEntry(entry);
126
+ return effort === undefined ? name : `${name} (effort ${effort})`;
127
+ })
128
+ .join(",")}`,
129
+ ),
137
130
  source,
138
- };
131
+ );
132
+ }
133
+
134
+ function credentialsCell(
135
+ credentials: LocalConfig["credentials"],
136
+ source: ConfigSource,
137
+ ): ConfigCell {
138
+ return listCell(
139
+ credentials?.claude === undefined
140
+ ? []
141
+ : [`claude=${credentials.claude.join(",")}`],
142
+ source,
143
+ );
139
144
  }
140
145
 
141
146
  // One row per key, and the two Records below are what stops a key from
@@ -161,7 +166,8 @@ export function configRows(
161
166
  effective.suspicion_priors,
162
167
  sources.suspicion_priors,
163
168
  ),
164
- routing: routingCell(effective.routing, sources.routing),
169
+ models: modelsCell(effective.models, sources.models),
170
+ credentials: credentialsCell(effective.credentials, sources.credentials),
165
171
  max_verification_steps: cell(
166
172
  effective.max_verification_steps?.toString(),
167
173
  sources.max_verification_steps,
@@ -226,7 +232,6 @@ export function configRows(
226
232
  effective.summary?.enabled?.toString(),
227
233
  sources.summary.enabled,
228
234
  ),
229
- model: cell(effective.summary?.model, sources.summary.model),
230
235
  };
231
236
  // Object.entries over an object literal keeps declaration order, which is
232
237
  // the same guarantee CONFIG_DIRECTION already leans on for its derived key
package/src/ui/plan.ts CHANGED
@@ -6,6 +6,7 @@
6
6
 
7
7
  import { existsSync } from "node:fs";
8
8
  import path from "node:path";
9
+ import type { PlatformEstimateBasis } from "#ci/platform-estimate";
9
10
  import type { EffectiveConfig } from "#config/config";
10
11
  import { exclusionLines } from "#git/git";
11
12
  import { isFullCommitId } from "#git/refs";
@@ -152,7 +153,7 @@ function configTags(
152
153
  flagged.summary
153
154
  ? undefined
154
155
  : configTag("summary.enabled", s.summary.enabled),
155
- flagged.model ? undefined : configTag("summary.model", s.summary.model),
156
+ flagged.model ? undefined : configTag("models", s.models),
156
157
  configTag("max_verification_steps", s.max_verification_steps),
157
158
  ].filter((tag): tag is string => tag !== undefined);
158
159
  }
@@ -300,20 +301,43 @@ function agentRow(
300
301
  (s.role === "refuter" || s.stepKey === "refuter")),
301
302
  );
302
303
  if (stepRoute) {
303
- const formatted = formatStepRoute(stepRoute, model);
304
+ const formatted = formatStepRoute(stepRoute);
304
305
  return `${agent.key.padEnd(12)} ${formatted.padEnd(8)} ${fires}`;
305
306
  }
306
307
  }
307
308
  return `${agent.key.padEnd(12)} ${model.padEnd(8)} ${fires}`;
308
309
  }
309
310
 
310
- function summarizerRow(summary: SummarySettings): string {
311
- const model = summary.model ?? DEFAULT_SUMMARY_MODEL;
312
- return (
313
- `summarizer`.padEnd(12) +
314
- `${model}`.padEnd(8) +
315
- (summary.enabled ? "always" : "disabled")
316
- );
311
+ // The model a step will run, as the plan resolved it (`models`, `--model`, the
312
+ // prompt), or undefined with no plan or no such step. A row that guessed from
313
+ // the prompt's default would name `haiku` while `models.summary` runs another.
314
+ function plannedModel(
315
+ routePlan: ResolvedRoutePlan | undefined,
316
+ stepKey: string,
317
+ ): string | undefined {
318
+ const step = routePlan?.steps.find((s) => s.stepKey === stepKey);
319
+ return step === undefined ? undefined : formatStepRoute(step);
320
+ }
321
+
322
+ // What a stage left out of a re-review with nothing new to discover says in
323
+ // place of a model: the plan omits its step, so no model would be the one run.
324
+ const NOT_RUN_THIS_PASS = `${"-".padEnd(8)}not run this pass (nothing new to review)`;
325
+
326
+ // `skipped` is a re-review that skips discovery, which runs no summarizer. It
327
+ // is passed rather than read off a missing step: a plan with no route plan at
328
+ // all is the older path, where the default model is what runs.
329
+ function summarizerRow(
330
+ summary: SummarySettings,
331
+ routePlan?: ResolvedRoutePlan,
332
+ skipped = false,
333
+ ): string {
334
+ const label = "summarizer".padEnd(12);
335
+ if (summary.enabled && skipped) return `${label}${NOT_RUN_THIS_PASS}`;
336
+ const model =
337
+ plannedModel(routePlan, "summarizer") ??
338
+ summary.model ??
339
+ DEFAULT_SUMMARY_MODEL;
340
+ return `${label}${model.padEnd(8)} ${summary.enabled ? "always" : "disabled"}`;
317
341
  }
318
342
 
319
343
  export function summarizerLabel(summary: SummarySettings): string {
@@ -326,14 +350,21 @@ export function summarizerLabel(summary: SummarySettings): string {
326
350
  // only appears when it is on is a stage nobody notices arriving.
327
351
  function scoutRow(
328
352
  options: Pick<CliOptions, "scout" | "scoutModel" | "model">,
353
+ routePlan?: ResolvedRoutePlan,
354
+ skipped = false,
329
355
  ): string {
330
356
  const label = "scout".padEnd(12);
331
357
  if (!options.scout) return `${label}${"-".padEnd(8)}disabled`;
358
+ if (skipped) return `${label}${NOT_RUN_THIS_PASS}`;
332
359
  // The same chain the pipeline resolves, printed before the money is spent:
333
360
  // --model > --scout-model > the engine default (the bundled prompt pins no
334
361
  // model, so there is no frontmatter seat to show here).
335
- const model = options.model ?? options.scoutModel ?? DEFAULT_SCOUT_MODEL;
336
- return `${label}${model.padEnd(8)}diff-only, before the hunters (experimental)`;
362
+ const model =
363
+ plannedModel(routePlan, "scout") ??
364
+ options.model ??
365
+ options.scoutModel ??
366
+ DEFAULT_SCOUT_MODEL;
367
+ return `${label}${model.padEnd(8)} diff-only, before the hunters (experimental)`;
337
368
  }
338
369
 
339
370
  export function scoutLabel(options: Pick<CliOptions, "scout">): string {
@@ -462,7 +493,7 @@ export function freeRouteEstimateText(estimate: {
462
493
  // byte-identical. The band never reads $0 – $0 here: estimateCost clamps the
463
494
  // hunter seats (report.ts), so a free route is "not billed", never a zero estimate.
464
495
  export function planEstimateLine(input: {
465
- estimate: { low: number; high: number };
496
+ estimate: { low: number; high: number; platform?: PlatformEstimateBasis };
466
497
  hunterCount: number;
467
498
  summarizer: boolean;
468
499
  freeRoute?: FreeRouteBilling;
@@ -475,9 +506,13 @@ export function planEstimateLine(input: {
475
506
  if (billing === "free") {
476
507
  return `estimate: ${freeRouteEstimateText(input.estimate)}`;
477
508
  }
509
+ // The platform's range is not the band, so the line says where it came from
510
+ // instead of the agent count the band is built on (cryskai/platform#12).
478
511
  const line =
479
- `estimate ${low} – ${high} (${input.hunterCount} hunter(s) + refuter ` +
480
- `${input.summarizer ? "+ summarizer" : "+ summarizer disabled"})`;
512
+ input.estimate.platform === undefined
513
+ ? `estimate ${low} – ${high} (${input.hunterCount} hunter(s) + refuter ` +
514
+ `${input.summarizer ? "+ summarizer" : "+ summarizer disabled"})`
515
+ : `estimate ${low} – ${high} (platform: ${input.estimate.platform})`;
481
516
  return billing === "mixed" ? `${line} ${FREE_STEPS_NOTE}` : line;
482
517
  }
483
518
 
@@ -540,20 +575,7 @@ export function planDetails(ctx: PlanContext, styles: boolean): string[] {
540
575
  push("agents dir", ctx.agentsDir);
541
576
  if (ctx.routePlan) {
542
577
  for (const step of ctx.routePlan.steps) {
543
- const rawModel =
544
- step.role === "hunter"
545
- ? (ctx.options.model ??
546
- ctx.spec.agents.find(
547
- (a) =>
548
- a.key === step.stepKey || `hunter-${a.key}` === step.stepKey,
549
- )?.model ??
550
- ctx.agentFiles.get(step.stepKey.replace(/^hunter-/, ""))?.model)
551
- : step.role === "refuter"
552
- ? (ctx.options.model ??
553
- ctx.spec.agents.find((a) => a.role === "refuter")?.model ??
554
- ctx.agentFiles.get(step.stepKey)?.model)
555
- : undefined;
556
- push(`route ${step.stepKey}`, formatStepRoute(step, rawModel));
578
+ push(`route ${step.stepKey}`, formatStepRoute(step));
557
579
  }
558
580
  }
559
581
  if (ctx.configProvenance) {
@@ -561,8 +583,8 @@ export function planDetails(ctx: PlanContext, styles: boolean): string[] {
561
583
  }
562
584
  push("run dir", ctx.runDir);
563
585
  push("hop budget", String(ctx.options.hopBudget));
564
- push("summarizer", summarizerRow(ctx.summary));
565
- push("scout", scoutRow(ctx.options));
586
+ push("summarizer", summarizerRow(ctx.summary, ctx.routePlan));
587
+ push("scout", scoutRow(ctx.options, ctx.routePlan));
566
588
  push(
567
589
  "parity",
568
590
  ctx.config.parity_trigger_paths.length === 0
@@ -614,8 +636,12 @@ export function renderPlan(ctx: PlanContext, styles: boolean): string[] {
614
636
  lines.push(...row(label, agentRow(ctx, agent, fires), { styles, width }));
615
637
  label = "";
616
638
  }
617
- lines.push(...row(label, summarizerRow(ctx.summary), { styles, width }));
618
- lines.push(...row("", scoutRow(ctx.options), { styles, width }));
639
+ lines.push(
640
+ ...row(label, summarizerRow(ctx.summary, ctx.routePlan), { styles, width }),
641
+ );
642
+ lines.push(
643
+ ...row("", scoutRow(ctx.options, ctx.routePlan), { styles, width }),
644
+ );
619
645
  label = "";
620
646
  lines.push(
621
647
  "",
@@ -826,20 +852,7 @@ export function prPlanDetails(ctx: PrPlanContext, styles: boolean): string[] {
826
852
  push("agents dir", ctx.agentsDir);
827
853
  if (ctx.routePlan) {
828
854
  for (const step of ctx.routePlan.steps) {
829
- const rawModel =
830
- step.role === "hunter"
831
- ? (ctx.options.model ??
832
- ctx.spec.agents.find(
833
- (a) =>
834
- a.key === step.stepKey || `hunter-${a.key}` === step.stepKey,
835
- )?.model ??
836
- ctx.agentFiles.get(step.stepKey.replace(/^hunter-/, ""))?.model)
837
- : step.role === "refuter"
838
- ? (ctx.options.model ??
839
- ctx.spec.agents.find((a) => a.role === "refuter")?.model ??
840
- ctx.agentFiles.get(step.stepKey)?.model)
841
- : undefined;
842
- push(`route ${step.stepKey}`, formatStepRoute(step, rawModel));
855
+ push(`route ${step.stepKey}`, formatStepRoute(step));
843
856
  }
844
857
  }
845
858
  if (ctx.configProvenance) {
@@ -849,8 +862,9 @@ export function prPlanDetails(ctx: PrPlanContext, styles: boolean): string[] {
849
862
  }
850
863
  push("run dir", ctx.runDir);
851
864
  push("hop budget", String(ctx.options.hopBudget));
852
- push("summarizer", summarizerRow(ctx.summary));
853
- push("scout", scoutRow(ctx.options));
865
+ const skipped = ctx.rereview?.skipDiscovery === true;
866
+ push("summarizer", summarizerRow(ctx.summary, ctx.routePlan, skipped));
867
+ push("scout", scoutRow(ctx.options, ctx.routePlan, skipped));
854
868
  if (ctx.rereview) {
855
869
  const last =
856
870
  ctx.rereview.lastHead === null
@@ -934,8 +948,28 @@ export function renderPrPlan(ctx: PrPlanContext, styles: boolean): string[] {
934
948
  lines.push(...row(label, agentRow(ctx, agent, fires), { styles, width }));
935
949
  label = "";
936
950
  }
937
- lines.push(...row(label, summarizerRow(ctx.summary), { styles, width }));
938
- lines.push(...row("", scoutRow(ctx.options), { styles, width }));
951
+ lines.push(
952
+ ...row(
953
+ label,
954
+ summarizerRow(
955
+ ctx.summary,
956
+ ctx.routePlan,
957
+ ctx.rereview?.skipDiscovery === true,
958
+ ),
959
+ { styles, width },
960
+ ),
961
+ );
962
+ lines.push(
963
+ ...row(
964
+ "",
965
+ scoutRow(
966
+ ctx.options,
967
+ ctx.routePlan,
968
+ ctx.rereview?.skipDiscovery === true,
969
+ ),
970
+ { styles, width },
971
+ ),
972
+ );
939
973
  if (ctx.rereview) {
940
974
  lines.push(
941
975
  ...row(
package/src/updater.ts CHANGED
@@ -26,7 +26,7 @@ import { LEGACY_HOME_DIR_NAME, resolveHomeDir } from "./brand-paths";
26
26
  import { loadGlobalConfigLayer } from "./config/config";
27
27
  import { runDoctor } from "./doctor";
28
28
  import { prheroLayout } from "./home-preflight";
29
- import { type RoutingConfig, routingNeedsOpenCodeSdk } from "./model/routing";
29
+ import { type ModelsConfig, modelsNeedOpenCode } from "./model/model-name";
30
30
  import {
31
31
  readInstalledOpenCodeSdkVersion,
32
32
  SUPPORTED_OPENCODE_SDK_VERSION,
@@ -54,7 +54,7 @@ export function detectInstallMethod(
54
54
  ): InstallMethod {
55
55
  const home = options.home ?? os.homedir();
56
56
  const execPath = options.execPath ?? process.execPath;
57
- const version = options.version ?? "0.4.0";
57
+ const version = options.version ?? "0.5.1";
58
58
  const exists = options.exists ?? existsSync;
59
59
 
60
60
  const isSource =
@@ -656,11 +656,14 @@ export function spawnOpenCodeSdkInstaller(
656
656
  });
657
657
  }
658
658
 
659
- async function readReconcileRouting(
659
+ // The person file's `models`, the only layer that may hold them. A person
660
+ // file that no longer parses (a removed `routing` key) throws here, and the
661
+ // reconcile step records that message instead of crashing.
662
+ async function readReconcileModels(
660
663
  home: string,
661
- ): Promise<RoutingConfig | undefined> {
664
+ ): Promise<ModelsConfig | undefined> {
662
665
  const loaded = await loadGlobalConfigLayer(home);
663
- return loaded.layer?.routing;
666
+ return loaded.layer?.models;
664
667
  }
665
668
 
666
669
  async function ensureOpenCodeSdkInstalled(options: {
@@ -670,8 +673,8 @@ async function ensureOpenCodeSdkInstalled(options: {
670
673
  which?: (bin: string) => string | null;
671
674
  spawnInstaller?: (argv: readonly string[]) => Promise<OpenCodeSdkSpawnResult>;
672
675
  }): Promise<void> {
673
- const routing = await readReconcileRouting(options.home);
674
- if (!routingNeedsOpenCodeSdk(routing)) return;
676
+ const models = await readReconcileModels(options.home);
677
+ if (!modelsNeedOpenCode(models)) return;
675
678
  // Install and the version check share this home. The no-arg reader uses
676
679
  // os.homedir(), which is a different tree whenever reconcile was given one.
677
680
  const nodeModulesDir = prheroLayout(options.home).nodeModulesDir;