crysk 0.4.0 → 0.5.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.
Files changed (93) 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/gates.ts +22 -36
  26. package/src/ci/outcome.ts +421 -330
  27. package/src/ci/platform-config.ts +2 -2
  28. package/src/ci/platform-report.ts +274 -41
  29. package/src/ci/platform-trace.ts +551 -0
  30. package/src/ci/platform.ts +28 -12
  31. package/src/ci/publish.ts +19 -6
  32. package/src/ci/review-levels.ts +8 -7
  33. package/src/ci/run.ts +88 -0
  34. package/src/ci/setup.ts +453 -118
  35. package/src/ci/trace-bundle.ts +1282 -0
  36. package/src/ci/trace-transcripts.ts +415 -0
  37. package/src/ci/trigger.ts +176 -33
  38. package/src/cli.ts +11 -3
  39. package/src/commands/ci-setup-questions.ts +3 -3
  40. package/src/commands/ci-setup.ts +152 -6
  41. package/src/commands/config.ts +3 -0
  42. package/src/commands/doctor.ts +15 -6
  43. package/src/config/config.ts +16 -3
  44. package/src/diversity/clustering.ts +0 -1
  45. package/src/diversity/identity.ts +4 -5
  46. package/src/diversity/pipeline-integration.ts +1 -9
  47. package/src/doctor.ts +3 -3
  48. package/src/execution/attempt-evidence.ts +10 -5
  49. package/src/execution/claude-session-trace.ts +480 -0
  50. package/src/execution/contracts.ts +21 -4
  51. package/src/execution/harness.ts +105 -8
  52. package/src/execution/model-fallback.ts +239 -0
  53. package/src/execution/usage-normalized.ts +6 -4
  54. package/src/home-preflight.ts +1 -1
  55. package/src/index.ts +1 -1
  56. package/src/model/catalog.ts +13 -37
  57. package/src/model/free-discovery.ts +117 -8
  58. package/src/model/model-name.ts +404 -0
  59. package/src/model/provider-capabilities.ts +22 -7
  60. package/src/model/routing.ts +346 -467
  61. package/src/pr/admission.ts +18 -0
  62. package/src/pr/plan.ts +20 -4
  63. package/src/pr/preflight.ts +1 -1
  64. package/src/pr/publish-outcome.ts +1 -1
  65. package/src/pr/review-pr.ts +15 -1
  66. package/src/pr/target.ts +12 -3
  67. package/src/production-runtime.ts +760 -331
  68. package/src/review/pipeline.ts +277 -101
  69. package/src/review/preflight.ts +201 -294
  70. package/src/review/report.ts +26 -26
  71. package/src/review/review.ts +20 -3
  72. package/src/review/route-preflight.ts +79 -11
  73. package/src/review/run.ts +28 -6
  74. package/src/review/scout.ts +1 -1
  75. package/src/review/spec.ts +3 -3
  76. package/src/review/step-runner.ts +70 -1
  77. package/src/runner-authority.ts +127 -9
  78. package/src/security/binding-policy.ts +1 -2
  79. package/src/security/claude-credential.ts +355 -0
  80. package/src/security/credential-broker.ts +56 -40
  81. package/src/security/evidence-redaction.ts +179 -4
  82. package/src/security/opencode-secret-manifest.ts +114 -0
  83. package/src/security/redact.ts +45 -0
  84. package/src/system-tools.ts +48 -21
  85. package/src/transport-registry.ts +12 -2
  86. package/src/transports/claude-code-cli.ts +21 -2
  87. package/src/transports/opencode-sdk.ts +11 -9
  88. package/src/transports/opencode-server.ts +7 -10
  89. package/src/ui/config-edit.ts +9 -20
  90. package/src/ui/config.ts +32 -27
  91. package/src/ui/plan.ts +76 -47
  92. package/src/updater.ts +10 -7
  93. 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
@@ -152,7 +152,7 @@ function configTags(
152
152
  flagged.summary
153
153
  ? undefined
154
154
  : configTag("summary.enabled", s.summary.enabled),
155
- flagged.model ? undefined : configTag("summary.model", s.summary.model),
155
+ flagged.model ? undefined : configTag("models", s.models),
156
156
  configTag("max_verification_steps", s.max_verification_steps),
157
157
  ].filter((tag): tag is string => tag !== undefined);
158
158
  }
@@ -300,20 +300,43 @@ function agentRow(
300
300
  (s.role === "refuter" || s.stepKey === "refuter")),
301
301
  );
302
302
  if (stepRoute) {
303
- const formatted = formatStepRoute(stepRoute, model);
303
+ const formatted = formatStepRoute(stepRoute);
304
304
  return `${agent.key.padEnd(12)} ${formatted.padEnd(8)} ${fires}`;
305
305
  }
306
306
  }
307
307
  return `${agent.key.padEnd(12)} ${model.padEnd(8)} ${fires}`;
308
308
  }
309
309
 
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
- );
310
+ // The model a step will run, as the plan resolved it (`models`, `--model`, the
311
+ // prompt), or undefined with no plan or no such step. A row that guessed from
312
+ // the prompt's default would name `haiku` while `models.summary` runs another.
313
+ function plannedModel(
314
+ routePlan: ResolvedRoutePlan | undefined,
315
+ stepKey: string,
316
+ ): string | undefined {
317
+ const step = routePlan?.steps.find((s) => s.stepKey === stepKey);
318
+ return step === undefined ? undefined : formatStepRoute(step);
319
+ }
320
+
321
+ // What a stage left out of a re-review with nothing new to discover says in
322
+ // place of a model: the plan omits its step, so no model would be the one run.
323
+ const NOT_RUN_THIS_PASS = `${"-".padEnd(8)}not run this pass (nothing new to review)`;
324
+
325
+ // `skipped` is a re-review that skips discovery, which runs no summarizer. It
326
+ // is passed rather than read off a missing step: a plan with no route plan at
327
+ // all is the older path, where the default model is what runs.
328
+ function summarizerRow(
329
+ summary: SummarySettings,
330
+ routePlan?: ResolvedRoutePlan,
331
+ skipped = false,
332
+ ): string {
333
+ const label = "summarizer".padEnd(12);
334
+ if (summary.enabled && skipped) return `${label}${NOT_RUN_THIS_PASS}`;
335
+ const model =
336
+ plannedModel(routePlan, "summarizer") ??
337
+ summary.model ??
338
+ DEFAULT_SUMMARY_MODEL;
339
+ return `${label}${model.padEnd(8)} ${summary.enabled ? "always" : "disabled"}`;
317
340
  }
318
341
 
319
342
  export function summarizerLabel(summary: SummarySettings): string {
@@ -326,14 +349,21 @@ export function summarizerLabel(summary: SummarySettings): string {
326
349
  // only appears when it is on is a stage nobody notices arriving.
327
350
  function scoutRow(
328
351
  options: Pick<CliOptions, "scout" | "scoutModel" | "model">,
352
+ routePlan?: ResolvedRoutePlan,
353
+ skipped = false,
329
354
  ): string {
330
355
  const label = "scout".padEnd(12);
331
356
  if (!options.scout) return `${label}${"-".padEnd(8)}disabled`;
357
+ if (skipped) return `${label}${NOT_RUN_THIS_PASS}`;
332
358
  // The same chain the pipeline resolves, printed before the money is spent:
333
359
  // --model > --scout-model > the engine default (the bundled prompt pins no
334
360
  // 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)`;
361
+ const model =
362
+ plannedModel(routePlan, "scout") ??
363
+ options.model ??
364
+ options.scoutModel ??
365
+ DEFAULT_SCOUT_MODEL;
366
+ return `${label}${model.padEnd(8)} diff-only, before the hunters (experimental)`;
337
367
  }
338
368
 
339
369
  export function scoutLabel(options: Pick<CliOptions, "scout">): string {
@@ -540,20 +570,7 @@ export function planDetails(ctx: PlanContext, styles: boolean): string[] {
540
570
  push("agents dir", ctx.agentsDir);
541
571
  if (ctx.routePlan) {
542
572
  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));
573
+ push(`route ${step.stepKey}`, formatStepRoute(step));
557
574
  }
558
575
  }
559
576
  if (ctx.configProvenance) {
@@ -561,8 +578,8 @@ export function planDetails(ctx: PlanContext, styles: boolean): string[] {
561
578
  }
562
579
  push("run dir", ctx.runDir);
563
580
  push("hop budget", String(ctx.options.hopBudget));
564
- push("summarizer", summarizerRow(ctx.summary));
565
- push("scout", scoutRow(ctx.options));
581
+ push("summarizer", summarizerRow(ctx.summary, ctx.routePlan));
582
+ push("scout", scoutRow(ctx.options, ctx.routePlan));
566
583
  push(
567
584
  "parity",
568
585
  ctx.config.parity_trigger_paths.length === 0
@@ -614,8 +631,12 @@ export function renderPlan(ctx: PlanContext, styles: boolean): string[] {
614
631
  lines.push(...row(label, agentRow(ctx, agent, fires), { styles, width }));
615
632
  label = "";
616
633
  }
617
- lines.push(...row(label, summarizerRow(ctx.summary), { styles, width }));
618
- lines.push(...row("", scoutRow(ctx.options), { styles, width }));
634
+ lines.push(
635
+ ...row(label, summarizerRow(ctx.summary, ctx.routePlan), { styles, width }),
636
+ );
637
+ lines.push(
638
+ ...row("", scoutRow(ctx.options, ctx.routePlan), { styles, width }),
639
+ );
619
640
  label = "";
620
641
  lines.push(
621
642
  "",
@@ -826,20 +847,7 @@ export function prPlanDetails(ctx: PrPlanContext, styles: boolean): string[] {
826
847
  push("agents dir", ctx.agentsDir);
827
848
  if (ctx.routePlan) {
828
849
  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));
850
+ push(`route ${step.stepKey}`, formatStepRoute(step));
843
851
  }
844
852
  }
845
853
  if (ctx.configProvenance) {
@@ -849,8 +857,9 @@ export function prPlanDetails(ctx: PrPlanContext, styles: boolean): string[] {
849
857
  }
850
858
  push("run dir", ctx.runDir);
851
859
  push("hop budget", String(ctx.options.hopBudget));
852
- push("summarizer", summarizerRow(ctx.summary));
853
- push("scout", scoutRow(ctx.options));
860
+ const skipped = ctx.rereview?.skipDiscovery === true;
861
+ push("summarizer", summarizerRow(ctx.summary, ctx.routePlan, skipped));
862
+ push("scout", scoutRow(ctx.options, ctx.routePlan, skipped));
854
863
  if (ctx.rereview) {
855
864
  const last =
856
865
  ctx.rereview.lastHead === null
@@ -934,8 +943,28 @@ export function renderPrPlan(ctx: PrPlanContext, styles: boolean): string[] {
934
943
  lines.push(...row(label, agentRow(ctx, agent, fires), { styles, width }));
935
944
  label = "";
936
945
  }
937
- lines.push(...row(label, summarizerRow(ctx.summary), { styles, width }));
938
- lines.push(...row("", scoutRow(ctx.options), { styles, width }));
946
+ lines.push(
947
+ ...row(
948
+ label,
949
+ summarizerRow(
950
+ ctx.summary,
951
+ ctx.routePlan,
952
+ ctx.rereview?.skipDiscovery === true,
953
+ ),
954
+ { styles, width },
955
+ ),
956
+ );
957
+ lines.push(
958
+ ...row(
959
+ "",
960
+ scoutRow(
961
+ ctx.options,
962
+ ctx.routePlan,
963
+ ctx.rereview?.skipDiscovery === true,
964
+ ),
965
+ { styles, width },
966
+ ),
967
+ );
939
968
  if (ctx.rereview) {
940
969
  lines.push(
941
970
  ...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.0";
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;