tumwater 0.3.0 → 0.4.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 (217) hide show
  1. package/README.md +1 -1
  2. package/dist/build-info.json +2 -2
  3. package/dist/src/agent/backend-traits.js +13 -0
  4. package/dist/src/agent/claude/claude-backend.js +2 -2
  5. package/dist/src/agent/claude/claude-stream.js +3 -2
  6. package/dist/src/agent/codex/codex-backend.js +3 -3
  7. package/dist/src/agent/codex/codex-stream.js +3 -1
  8. package/dist/src/agent/opencode/opencode-backend.js +2 -2
  9. package/dist/src/backlog/backlog-archive.js +60 -25
  10. package/dist/src/backlog/backlog-cli-view.js +3 -28
  11. package/dist/src/backlog/backlog-cli.js +9 -64
  12. package/dist/src/backlog/backlog-commit.js +17 -9
  13. package/dist/src/backlog/backlog-eligibility.js +44 -26
  14. package/dist/src/backlog/backlog-parts.js +23 -13
  15. package/dist/src/backlog/backlog-release.js +33 -16
  16. package/dist/src/baseline/main-guardrails.js +0 -73
  17. package/dist/src/baseline/main-red.js +31 -21
  18. package/dist/src/baseline/main-watch.js +82 -34
  19. package/dist/src/brief/brief-edit.js +3 -1
  20. package/dist/src/budget/budget-fallback-view.js +288 -0
  21. package/dist/src/budget/budget-wiring.js +158 -0
  22. package/dist/src/budget/budget.js +2 -1
  23. package/dist/src/build/dep-install.js +64 -1
  24. package/dist/src/cli/cli-args.js +63 -0
  25. package/dist/src/cli/cli-flag-specs.js +33 -0
  26. package/dist/src/cli/cli-query-commands.js +16 -41
  27. package/dist/src/cli/cli-review-commands.js +113 -0
  28. package/dist/src/cli/cli-role-command.js +118 -13
  29. package/dist/src/cli/cli-start-summary.js +10 -3
  30. package/dist/src/cli/cli-start.js +33 -5
  31. package/dist/src/cli/completion.js +21 -1
  32. package/dist/src/cli/config-commands.js +17 -8
  33. package/dist/src/cli/help.js +74 -14
  34. package/dist/src/cli/log-commands.js +26 -13
  35. package/dist/src/cli/question-commands.js +7 -1
  36. package/dist/src/cli.js +71 -6
  37. package/dist/src/collections.js +31 -4
  38. package/dist/src/config/config-editable-keys.js +3 -0
  39. package/dist/src/config/config-fallbacks.js +3 -2
  40. package/dist/src/config/config-validation.js +47 -42
  41. package/dist/src/config/config-views.js +10 -2
  42. package/dist/src/config/config-write.js +33 -1
  43. package/dist/src/config/config.js +7 -2
  44. package/dist/src/doctor/doctor-backlog-bugs.js +85 -42
  45. package/dist/src/doctor/doctor-backlog-plans.js +214 -79
  46. package/dist/src/doctor/doctor-backlog.js +155 -22
  47. package/dist/src/doctor/doctor-check-names.js +5 -1
  48. package/dist/src/doctor/doctor-checks.js +10 -15
  49. package/dist/src/doctor/doctor-claude-checks.js +6 -9
  50. package/dist/src/doctor/doctor-codex-checks.js +6 -9
  51. package/dist/src/doctor/doctor-contention-checks.js +244 -118
  52. package/dist/src/doctor/doctor-fallback-checks.js +130 -0
  53. package/dist/src/doctor/doctor-holds.js +4 -6
  54. package/dist/src/doctor/doctor-model-checks.js +45 -200
  55. package/dist/src/doctor/doctor-notify.js +7 -2
  56. package/dist/src/doctor/doctor-opencode-checks.js +7 -5
  57. package/dist/src/doctor/doctor-pi-checks.js +62 -0
  58. package/dist/src/doctor/doctor-project-checks.js +106 -12
  59. package/dist/src/doctor/doctor.js +10 -5
  60. package/dist/src/doctor/probe.js +14 -1
  61. package/dist/src/events/event-format.js +7 -6
  62. package/dist/src/events/event-labels.js +0 -1
  63. package/dist/src/events/event-read.js +13 -0
  64. package/dist/src/events/event-window.js +20 -2
  65. package/dist/src/failure/failure-data.js +9 -4
  66. package/dist/src/failure/failure-render.js +8 -8
  67. package/dist/src/failure/time-spend.js +0 -64
  68. package/dist/src/files/file-queue.js +17 -0
  69. package/dist/src/gates/budget-gates.js +27 -257
  70. package/dist/src/gates/gate-polls.js +49 -141
  71. package/dist/src/gates/maintenance-quota.js +27 -17
  72. package/dist/src/git/commit-message.js +12 -0
  73. package/dist/src/git/git.js +18 -0
  74. package/dist/src/git/slot-salvage.js +3 -3
  75. package/dist/src/gui/gui-backlog-commands.js +3 -3
  76. package/dist/src/gui/gui-backlog-endpoints.js +5 -4
  77. package/dist/src/gui/gui-command.js +19 -1
  78. package/dist/src/gui/gui-config-commands.js +75 -9
  79. package/dist/src/gui/gui-endpoint-commands.js +2 -2
  80. package/dist/src/gui/gui-operator-commands.js +134 -7
  81. package/dist/src/gui/gui-prompt-commands.js +15 -6
  82. package/dist/src/gui/gui-report-endpoints.js +10 -3
  83. package/dist/src/gui/gui-server.js +16 -2
  84. package/dist/src/history/history-queued.js +8 -0
  85. package/dist/src/history/history.js +2 -5
  86. package/dist/src/inbox/inbox-top.js +4 -9
  87. package/dist/src/merge/merge-core.js +2 -25
  88. package/dist/src/merge/merge-drain.js +22 -135
  89. package/dist/src/merge/merge-pipeline.js +1 -1
  90. package/dist/src/merge/merge-post-review.js +154 -30
  91. package/dist/src/merge/merge-queue-render.js +11 -12
  92. package/dist/src/merge/merge-queue.js +22 -1
  93. package/dist/src/merge/merge-requeue.js +1 -0
  94. package/dist/src/merge/merge-stack.js +1 -7
  95. package/dist/src/merge/merge-to-main.js +1 -9
  96. package/dist/src/merge/merge-top.js +33 -19
  97. package/dist/src/merge/merge-verify.js +64 -9
  98. package/dist/src/notes-cli.js +8 -3
  99. package/dist/src/orchestrator/orchestrator-poll.js +47 -15
  100. package/dist/src/orchestrator/orchestrator-scheduling.js +4 -2
  101. package/dist/src/orchestrator/orchestrator.js +5 -4
  102. package/dist/src/orchestrator/scheduling-scope.js +51 -7
  103. package/dist/src/orchestrator/scheduling-skip.js +15 -5
  104. package/dist/src/paths.js +16 -6
  105. package/dist/src/pi/pi-backend.js +2 -2
  106. package/dist/src/process/run-marker.js +8 -0
  107. package/dist/src/prompt/gate-notes.js +1 -1
  108. package/dist/src/prompt/gate-prompts.js +30 -7
  109. package/dist/src/prompt/notes-backlog.js +13 -10
  110. package/dist/src/prompt/prompt.js +3 -1
  111. package/dist/src/report/report-data.js +49 -69
  112. package/dist/src/report/report-fold.js +11 -12
  113. package/dist/src/report/report-render.js +6 -4
  114. package/dist/src/report/report.js +2 -5
  115. package/dist/src/review/diff-rules.js +53 -0
  116. package/dist/src/review/known-flakes.js +12 -0
  117. package/dist/src/review/post-merge-review-accept.js +51 -0
  118. package/dist/src/review/post-merge-review-render.js +112 -0
  119. package/dist/src/review/post-merge-review.js +157 -24
  120. package/dist/src/review/protected-edits.js +22 -7
  121. package/dist/src/review/quarantine-render.js +65 -0
  122. package/dist/src/review/review.js +33 -49
  123. package/dist/src/roles/role-catalog.js +60 -2
  124. package/dist/src/roles/role-guidance.js +10 -0
  125. package/dist/src/roles/role-labels.js +6 -3
  126. package/dist/src/roles/role-render.js +43 -8
  127. package/dist/src/roles/role-view.js +36 -9
  128. package/dist/src/roles/roles.js +3 -3
  129. package/dist/src/run/ci-parity.js +121 -0
  130. package/dist/src/run/qa-coverage.js +50 -15
  131. package/dist/src/run/run-detail-data.js +9 -13
  132. package/dist/src/run/run-detail-render.js +1 -8
  133. package/dist/src/run/run-finalize.js +1 -0
  134. package/dist/src/run/run-prompt.js +14 -0
  135. package/dist/src/run/run-stage.js +66 -37
  136. package/dist/src/run/run-verdict.js +14 -1
  137. package/dist/src/run/stage-check.js +17 -11
  138. package/dist/src/run/stage-checks-shared.js +65 -0
  139. package/dist/src/run/stage-name-checks.js +204 -0
  140. package/dist/src/run/stage-path-checks.js +16 -515
  141. package/dist/src/run/stage-prose-checks.js +261 -0
  142. package/dist/src/runner/leftover.js +50 -19
  143. package/dist/src/runner/revision.js +12 -23
  144. package/dist/src/runner/runner-outcome.js +4 -2
  145. package/dist/src/runner/runner-recovery.js +18 -3
  146. package/dist/src/runner/runner-run.js +21 -8
  147. package/dist/src/runner/runner-state.js +4 -3
  148. package/dist/src/scheduling/claim-entries.js +49 -0
  149. package/dist/src/status/status-data.js +6 -1
  150. package/dist/src/status/status-polls.js +15 -0
  151. package/dist/src/status/status-roles.js +11 -0
  152. package/dist/src/team/reclaim.js +2 -2
  153. package/dist/src/text/datetime.js +3 -2
  154. package/dist/src/text/phrases.js +6 -3
  155. package/dist/src/text/text.js +11 -0
  156. package/dist/src/ui/badges.js +34 -1
  157. package/dist/src/ui/gui/gui-client-backlog.js +25 -3
  158. package/dist/src/ui/gui/gui-client-boot.js +63 -41
  159. package/dist/src/ui/gui/gui-client-drawer-config.js +56 -14
  160. package/dist/src/ui/gui/gui-client-drawer.js +29 -4
  161. package/dist/src/ui/gui/gui-client-feed.js +1 -1
  162. package/dist/src/ui/gui/gui-client-history.js +74 -72
  163. package/dist/src/ui/gui/gui-client-labels.js +5 -1
  164. package/dist/src/ui/gui/gui-client-operator.js +6 -2
  165. package/dist/src/ui/gui/gui-client-pending.js +188 -11
  166. package/dist/src/ui/gui/gui-client-report-chart.js +36 -8
  167. package/dist/src/ui/gui/gui-client-report.js +20 -5
  168. package/dist/src/ui/gui/gui-client-settings.js +109 -3
  169. package/dist/src/ui/gui/gui-client-team.js +11 -0
  170. package/dist/src/ui/gui/gui-client.js +11 -1
  171. package/dist/src/ui/gui/gui-page.js +1 -0
  172. package/dist/src/ui/gui/gui-styles.js +4 -0
  173. package/dist/src/ui/run-progress-model.js +2 -1
  174. package/dist/src/ui/status-payload.js +237 -9
  175. package/dist/src/ui/status-render.js +12 -4
  176. package/dist/src/ui/team-alerts.js +512 -37
  177. package/dist/src/ui/tone.js +7 -0
  178. package/dist/src/ui/tui/tui-backlog.js +7 -5
  179. package/dist/src/ui/tui/tui-editor-attach.js +1 -7
  180. package/dist/src/ui/tui/tui-editor-backends.js +1 -6
  181. package/dist/src/ui/tui/tui-editor-brief.js +4 -24
  182. package/dist/src/ui/tui/tui-editor-budget.js +1 -8
  183. package/dist/src/ui/tui/tui-editor-check.js +29 -0
  184. package/dist/src/ui/tui/tui-editor-checks.js +28 -0
  185. package/dist/src/ui/tui/tui-editor-concurrency.js +1 -0
  186. package/dist/src/ui/tui/tui-editor-config.js +19 -6
  187. package/dist/src/ui/tui/tui-editor-entry.js +3 -17
  188. package/dist/src/ui/tui/tui-editor-instances.js +9 -0
  189. package/dist/src/ui/tui/tui-editor-instructions.js +7 -26
  190. package/dist/src/ui/tui/tui-editor-interval.js +18 -7
  191. package/dist/src/ui/tui/tui-editor-notes.js +6 -24
  192. package/dist/src/ui/tui/tui-editor-quiet.js +2 -12
  193. package/dist/src/ui/tui/tui-editor-retire.js +1 -7
  194. package/dist/src/ui/tui/tui-editor-role-enabled.js +126 -0
  195. package/dist/src/ui/tui/tui-editor-role-key.js +1 -6
  196. package/dist/src/ui/tui/tui-editor-session.js +41 -0
  197. package/dist/src/ui/tui/tui-editor-slots.js +1 -0
  198. package/dist/src/ui/tui/tui-editors.js +10 -1
  199. package/dist/src/ui/tui/tui-frame.js +18 -6
  200. package/dist/src/ui/tui/tui-keys.js +9 -0
  201. package/dist/src/ui/tui/tui-pane-activity.js +21 -8
  202. package/dist/src/ui/tui/tui-pane-backlog.js +36 -9
  203. package/dist/src/ui/tui/tui-pane-ctx.js +1 -1
  204. package/dist/src/ui/tui/tui-pane-health.js +113 -3
  205. package/dist/src/ui/tui/tui-pane-history.js +44 -0
  206. package/dist/src/ui/tui/tui-pane-pending.js +285 -56
  207. package/dist/src/ui/tui/tui-pane-queued.js +7 -2
  208. package/dist/src/ui/tui/tui-pane-report.js +9 -3
  209. package/dist/src/ui/tui/tui-pane-session.js +9 -0
  210. package/dist/src/ui/tui/tui-pane.js +16 -10
  211. package/dist/src/ui/tui/tui-panes.js +56 -7
  212. package/dist/src/ui/tui/tui.js +8 -5
  213. package/dist/src/verdict/fix-claim.js +47 -1
  214. package/dist/src/verdict/reply-contract.js +35 -0
  215. package/package.json +1 -1
  216. package/dist/src/baseline/main-culprit.js +0 -94
  217. package/dist/src/baseline/main-revert.js +0 -133
@@ -57,15 +57,18 @@ export const DOCTOR_CHECK_NAMES = [
57
57
  "tumwater pins",
58
58
  "disk space",
59
59
  "check",
60
+ "ci parity",
61
+ "qa coverage",
60
62
  "root install",
61
63
  "flaky checks",
64
+ "post-merge churn",
62
65
  "claimed bugs",
63
66
  "validation gaps",
64
67
  "plans stuck in Planned",
65
68
  "backlog headings",
66
69
  "backlog archive",
67
70
  "refusals",
68
- "stalled plans",
71
+ "stalled entries",
69
72
  "plan dependencies",
70
73
  "stale questions",
71
74
  "stale bugs",
@@ -73,6 +76,7 @@ export const DOCTOR_CHECK_NAMES = [
73
76
  "regressed fixes",
74
77
  "stale merge-queue entries",
75
78
  "merge-queue files",
79
+ "post-merge reviews",
76
80
  "stale prompts",
77
81
  "uncommitted backlog",
78
82
  "update",
@@ -18,9 +18,9 @@ import { formatBytes } from "../text/format.js";
18
18
  import { briefFile } from "../brief/brief.js";
19
19
  import { plural } from "../text/phrases.js";
20
20
  import { backendsInUse, unregisteredBackendInUse } from "../gates/startup-gate.js";
21
- import { claudeSeamsInUse, minVersionOutcome, opencodeSeamsInUse, piSeamsInUse, AUTH_CHECK_MAX_OUTPUT_BYTES, AUTH_CHECK_TIMEOUT_MS } from "./doctor-model-checks.js";
21
+ import { claudeSeamsInUse, minVersionOutcome, opencodeSeamsInUse, versionFromProbe, piSeamsInUse } from "./doctor-model-checks.js";
22
22
  import { claudeConfigDir } from "../agent/claude/claude-backend.js";
23
- import { boundedProbe } from "./probe.js";
23
+ import { AUTH_CHECK_MAX_OUTPUT_BYTES, AUTH_CHECK_TIMEOUT_MS, boundedProbe } from "./probe.js";
24
24
  import { childEnv } from "../process/process.js";
25
25
  import { opencodeBackend, OPENCODE_MIN_VERSION } from "../agent/opencode/opencode-backend.js";
26
26
  import { failOutcome, okOutcome, warnOutcome } from "./outcome.js";
@@ -219,18 +219,6 @@ export function checkBackendBinary(root, pathEnv = envPath()) {
219
219
  return checks[0].outcome;
220
220
  return okOutcome(checks.map(({ agent, outcome }) => `${agent}: ${outcome.detail}`).join("; "));
221
221
  }
222
- /** claude transcript disk — the total size of the claude config dir's `projects/`
223
- * (plans/agent-backends.md "Sessions" retention): the perf adapter ages transcripts out under
224
- * its own cleanupPeriodDays, so an operator asking where claude's disk went gets the number
225
- * without `du`. Informational (ok) in every case — a large transcript tree is a fact, not a
226
- * misconfiguration. Stands down when no seam routes to claude: a pi-only team reads no claude
227
- * state, and the report must not walk a host directory that has nothing to do with the team.
228
- * `homeDir` and `env` are test seams. */
229
- /** The dotted version in `opencode --version` (prints `opencode v2.0.32`), or undefined when it
230
- * names none. */
231
- function parseOpencodeCliVersion(output) {
232
- return /v(\d+\.\d+\.\d+)/.exec(output)?.[1];
233
- }
234
222
  /** OpenCode CLI-version readiness (plans/opencode-backend.md "Which OpenCode", part 7/7): the
235
223
  * team targets V2 at 2.0.32 or later, the version H1 verified live. An installed CLI below that
236
224
  * (a 1.x binary included) fails naming `brew install opencode`; at or above it reads the
@@ -243,9 +231,16 @@ export async function checkOpencodeVersion(root, pathEnv = envPath(), timeoutMs
243
231
  return okOutcome("no model jobs run on opencode");
244
232
  const resolved = opencodeBackend.resolveBin(config);
245
233
  const result = await boundedProbe(resolved.bin, ["--version"], childEnv({ PATH: pathEnv }), timeoutMs, AUTH_CHECK_MAX_OUTPUT_BYTES);
246
- const found = result !== null && result.code === 0 ? parseOpencodeCliVersion(result.stdout) : undefined;
234
+ const found = versionFromProbe(result, true);
247
235
  return minVersionOutcome("opencode", found, OPENCODE_MIN_VERSION, "run `brew install opencode`");
248
236
  }
237
+ /** claude transcript disk — the total size of the claude config dir's `projects/`
238
+ * (plans/agent-backends.md "Sessions" retention): the perf adapter ages transcripts out under
239
+ * its own cleanupPeriodDays, so an operator asking where claude's disk went gets the number
240
+ * without `du`. Informational (ok) in every case — a large transcript tree is a fact, not a
241
+ * misconfiguration. Stands down when no seam routes to claude: a pi-only team reads no claude
242
+ * state, and the report must not walk a host directory that has nothing to do with the team.
243
+ * `homeDir` and `env` are test seams. */
249
244
  export function checkClaudeTranscripts(config, homeDir = os.homedir(), env = process.env) {
250
245
  if (!config)
251
246
  return okOutcome("no readable tumwater.json — nothing to verify");
@@ -1,6 +1,6 @@
1
1
  import os from "node:os";
2
2
  import { childEnv } from "../process/process.js";
3
- import { boundedProbe } from "./probe.js";
3
+ import { AUTH_CHECK_MAX_OUTPUT_BYTES, AUTH_CHECK_TIMEOUT_MS, boundedProbe } from "./probe.js";
4
4
  import { claudeBackend, claudeConfigDir } from "../agent/claude/claude-backend.js";
5
5
  import { claudeEnv } from "../agent/claude/claude-env.js";
6
6
  import { claudeAuthUsesSubscription, parseClaudeAuthStatus } from "../agent/claude/claude-account.js";
@@ -8,7 +8,7 @@ import { resolvedBackendConfig } from "../config/config-views.js";
8
8
  import { envPath } from "../files/files.js";
9
9
  import { belowNodeFloor } from "../version.js";
10
10
  import { failOutcome, okOutcome, warnOutcome } from "./outcome.js";
11
- import { AUTH_CHECK_MAX_OUTPUT_BYTES, AUTH_CHECK_TIMEOUT_MS, claudeSeamsInUse, loadConfigForCheck, seamedModels, } from "./doctor-model-checks.js";
11
+ import { claudeSeamsInUse, loadConfigForCheck, versionFromProbe, seamedModels, } from "./doctor-model-checks.js";
12
12
  /** The doctor's claude credential and version readiness checks, split out of
13
13
  * doctor-model-checks.ts (whose shared seam/model framework and the pi, tier-models and
14
14
  * image-input checks stay there): checkClaudeAuth, checkAnthroApiKey and checkClaudeVersion.
@@ -16,8 +16,9 @@ import { AUTH_CHECK_MAX_OUTPUT_BYTES, AUTH_CHECK_TIMEOUT_MS, claudeSeamsInUse, l
16
16
  * distinct concern from the filesystem/git checks, kept together so a change to how doctor
17
17
  * spawns or scrubs claude does not touch the other model checks. The shared report contract
18
18
  * (CheckOutcome) and the seam/model framework (loadConfigForCheck, claudeSeamsInUse,
19
- * seamPairs, the AUTH_CHECK_* budgets) come from doctor-model-checks.ts and outcome.ts,
20
- * exactly as the other doctor-* modules share them. */
19
+ * seamPairs) come from doctor-model-checks.ts, and the AUTH_CHECK_* probe budgets from probe.ts,
20
+ * with the shared report contract (CheckOutcome) from outcome.ts, exactly as the other doctor-*
21
+ * modules share them. */
21
22
  /** One bounded probe of the resolved `claude` binary under the scrubbed run environment a real
22
23
  * run gets: resolve the binary through the claude adapter that would spawn it and run `args`
23
24
  * with a short deadline. Null when the probe could not run, the child errored, or the deadline
@@ -94,10 +95,6 @@ export async function checkAnthroApiKey(root, env = process.env, pathEnv = envPa
94
95
  return okOutcome("ANTHROPIC_API_KEY is set, but claude reports no claude.ai login");
95
96
  return warnOutcome("ANTHROPIC_API_KEY is set while claude reports a claude.ai login — model jobs on claude will bill the API key, not the subscription; unset it or route every anthropic model job on pi explicitly");
96
97
  }
97
- /** The dotted version in `claude --version`'s output, or undefined when it names none. */
98
- function parseClaudeCliVersion(output) {
99
- return /(\d+\.\d+\.\d+)/.exec(output)?.[1];
100
- }
101
98
  /** claude CLI-version readiness (plans/agent-backends.md finding 9): an installed CLI below a
102
99
  * configured model's minimum fails or misprices that model, and team runs disable the
103
100
  * auto-updater, so the version an operator has is the version agent runs use. Fails below the
@@ -120,7 +117,7 @@ export async function checkClaudeVersion(root, pathEnv = envPath(), timeoutMs =
120
117
  floors.set(seam.model, min);
121
118
  }
122
119
  const result = await claudeProbe(config, ["--version"], pathEnv, timeoutMs);
123
- const found = result !== null && result.code === 0 ? parseClaudeCliVersion(result.stdout) : undefined;
120
+ const found = versionFromProbe(result);
124
121
  if (found === undefined)
125
122
  return warnOutcome("could not check — `claude --version` did not run or its output was unreadable");
126
123
  const clamped = seams.some((seam) => seam.thinking === "off" || seam.thinking === "minimal");
@@ -1,7 +1,7 @@
1
1
  import fs from "node:fs";
2
2
  import path from "node:path";
3
3
  import { childEnv } from "../process/process.js";
4
- import { boundedProbe } from "./probe.js";
4
+ import { AUTH_CHECK_MAX_OUTPUT_BYTES, AUTH_CHECK_TIMEOUT_MS, boundedProbe } from "./probe.js";
5
5
  import { codexBackend, CODEX_MIN_VERSION } from "../agent/codex/codex-backend.js";
6
6
  import { codexEffort, EFFORT_BY_THINKING } from "../agent/codex/codex-args.js";
7
7
  import { codexEnv } from "../agent/codex/codex-env.js";
@@ -14,7 +14,7 @@ import { envPath, isDirectory, readTextOrNull, statOrNull, treeBytes } from "../
14
14
  import { formatBytes, tokenWindowLabel } from "../text/format.js";
15
15
  import { errorMessage } from "../text/text.js";
16
16
  import { failOutcome, okOutcome, warnOutcome } from "./outcome.js";
17
- import { AUTH_CHECK_MAX_OUTPUT_BYTES, AUTH_CHECK_TIMEOUT_MS, codexSeamsInUse, loadConfigForCheck, minVersionOutcome, seamedModels, } from "./doctor-model-checks.js";
17
+ import { codexSeamsInUse, loadConfigForCheck, minVersionOutcome, versionFromProbe, seamedModels, } from "./doctor-model-checks.js";
18
18
  /** The doctor's codex rows (part 9a/9, plans/codex-backend.md §4, §7, "Hand steps"): one
19
19
  * exported check per row — install/version, login, home, models, account, leaks, sessions
20
20
  * size and the write guard. These are the doctor's only checks that spawn the `codex` CLI and
@@ -24,8 +24,9 @@ import { AUTH_CHECK_MAX_OUTPUT_BYTES, AUTH_CHECK_TIMEOUT_MS, codexSeamsInUse, lo
24
24
  * other model checks. Each returns null (omitting its row) when no seam routes to codex, so a
25
25
  * pi-only team shows no codex row and spawns nothing and reads nothing. The shared
26
26
  * report contract (CheckOutcome) and the seam/model framework (loadConfigForCheck,
27
- * codexSeamsInUse, seamPairs, the AUTH_CHECK_* budgets) come from doctor-model-checks.ts and
28
- * outcome.ts, as the other doctor-* modules share them. */
27
+ * codexSeamsInUse, seamPairs) come from doctor-model-checks.ts, the AUTH_CHECK_* probe budgets
28
+ * from probe.ts, and the shared report contract (CheckOutcome) from outcome.ts, as the other
29
+ * doctor-* modules share them. */
29
30
  /** The config and codex home a codex readiness row reads, or the warn outcome a broken
30
31
  * `tumwater.json` earns, or null when no seam routes to codex (the row's stand-down). All
31
32
  * eight rows repeat the same three-line guard and the same home lookup
@@ -52,10 +53,6 @@ function codexProbe(config, args, pathEnv, timeoutMs) {
52
53
  const env = codexEnv(childEnv({ PATH: pathEnv }), { home });
53
54
  return boundedProbe(resolved.bin, args, env, timeoutMs, AUTH_CHECK_MAX_OUTPUT_BYTES);
54
55
  }
55
- /** The dotted version in `codex --version`'s output, or undefined when it names none. */
56
- function parseCodexCliVersion(output) {
57
- return /(\d+\.\d+\.\d+)/.exec(output)?.[1];
58
- }
59
56
  /** codex CLI-version readiness (plans/codex-backend.md "Hand steps", H1): the team targets
60
57
  * `CODEX_MIN_VERSION` or later, the version H1 verified live. An installed CLI below that fails
61
58
  * naming the floor and the upgrade; at or above it reads the version. Stands down when no seam
@@ -65,7 +62,7 @@ export async function checkCodexVersion(root, pathEnv = envPath(), timeoutMs = A
65
62
  if (base === null || "level" in base)
66
63
  return base;
67
64
  const result = await codexProbe(base.config, ["--version"], pathEnv, timeoutMs);
68
- const found = result?.code === 0 ? parseCodexCliVersion(result.stdout) : undefined;
65
+ const found = versionFromProbe(result);
69
66
  return minVersionOutcome("codex", found, CODEX_MIN_VERSION, "upgrade the codex CLI");
70
67
  }
71
68
  /** codex login readiness (plans/codex-backend.md §4, §7): a ChatGPT login is subscription