tumwater 0.1.3 → 0.3.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 (482) hide show
  1. package/README.md +77 -28
  2. package/dist/build-info.json +2 -2
  3. package/dist/src/agent/agent-args.js +23 -0
  4. package/dist/src/agent/agent-backend.js +9 -7
  5. package/dist/src/agent/backend-traits.js +77 -0
  6. package/dist/src/agent/claude/claude-account.js +81 -161
  7. package/dist/src/agent/claude/claude-args.js +19 -19
  8. package/dist/src/agent/claude/claude-backend.js +58 -48
  9. package/dist/src/agent/claude/claude-env.js +7 -3
  10. package/dist/src/agent/claude/claude-stream.js +11 -19
  11. package/dist/src/agent/claude/claude-write-guard.js +49 -0
  12. package/dist/src/agent/claude/write-guard-hook.js +13 -0
  13. package/dist/src/agent/codex/codex-account.js +119 -0
  14. package/dist/src/agent/codex/codex-args.js +181 -0
  15. package/dist/src/agent/codex/codex-backend.js +279 -0
  16. package/dist/src/agent/codex/codex-catalog.js +97 -0
  17. package/dist/src/agent/codex/codex-env.js +18 -0
  18. package/dist/src/agent/codex/codex-hook-trust.js +246 -0
  19. package/dist/src/agent/codex/codex-patch-paths.js +36 -0
  20. package/dist/src/agent/codex/codex-rollout.js +179 -0
  21. package/dist/src/agent/codex/codex-stream.js +402 -0
  22. package/dist/src/agent/codex/codex-write-guard.js +86 -0
  23. package/dist/src/agent/codex/write-guard-hook.js +12 -0
  24. package/dist/src/agent/image-input.js +112 -0
  25. package/dist/src/agent/notes-shim.js +40 -0
  26. package/dist/src/agent/opencode/opencode-args.js +60 -0
  27. package/dist/src/agent/opencode/opencode-backend.js +258 -0
  28. package/dist/src/agent/opencode/opencode-catalog.js +210 -0
  29. package/dist/src/agent/opencode/opencode-config.js +193 -0
  30. package/dist/src/agent/opencode/opencode-env.js +35 -0
  31. package/dist/src/agent/opencode/opencode-session-id.js +36 -0
  32. package/dist/src/agent/opencode/opencode-stream.js +278 -0
  33. package/dist/src/agent/opencode/write-guard-plugin/index.js +48 -0
  34. package/dist/src/agent/role-notes-write.js +16 -33
  35. package/dist/src/agent/run-agent.js +475 -381
  36. package/dist/src/agent/run-settle.js +214 -0
  37. package/dist/src/agent/session-ledger.js +142 -16
  38. package/dist/src/agent/subscription-account.js +220 -0
  39. package/dist/src/agent/write-guard.js +148 -0
  40. package/dist/src/backlog/backlog-archive.js +487 -0
  41. package/dist/src/backlog/backlog-cli-view.js +280 -0
  42. package/dist/src/backlog/backlog-cli.js +384 -0
  43. package/dist/src/backlog/backlog-commit.js +4 -5
  44. package/dist/src/backlog/backlog-eligibility.js +354 -132
  45. package/dist/src/backlog/backlog-index.js +149 -0
  46. package/dist/src/backlog/backlog-md.js +132 -22
  47. package/dist/src/backlog/backlog-parts.js +254 -0
  48. package/dist/src/backlog/backlog-release.js +117 -0
  49. package/dist/src/backlog/backlog-render.js +89 -11
  50. package/dist/src/backlog/backlog-structure.js +271 -125
  51. package/dist/src/backlog/backlog-write.js +121 -471
  52. package/dist/src/backlog/backlog.js +129 -17
  53. package/dist/src/backlog/question-answer.js +345 -0
  54. package/dist/src/baseline/main-baseline.js +157 -101
  55. package/dist/src/baseline/main-culprit.js +94 -0
  56. package/dist/src/baseline/main-guardrails.js +209 -0
  57. package/dist/src/baseline/main-red.js +164 -55
  58. package/dist/src/baseline/main-revert.js +133 -0
  59. package/dist/src/baseline/main-watch.js +184 -0
  60. package/dist/src/brief/brief-edit.js +41 -0
  61. package/dist/src/{brief.js → brief/brief.js} +38 -33
  62. package/dist/src/budget/budget.js +55 -28
  63. package/dist/src/budget/fallback-breaker.js +31 -31
  64. package/dist/src/build/build-check-detect.js +25 -16
  65. package/dist/src/build/build-check-events.js +87 -22
  66. package/dist/src/build/build-check-report.js +66 -27
  67. package/dist/src/build/build-check-scoped.js +64 -68
  68. package/dist/src/build/build-check.js +17 -15
  69. package/dist/src/build/build-info.js +3 -3
  70. package/dist/src/build/build-stage.js +31 -35
  71. package/dist/src/build/dep-install.js +21 -21
  72. package/dist/src/build/host-sleep.js +1 -1
  73. package/dist/src/change/change-data.js +131 -37
  74. package/dist/src/change/change-render.js +56 -14
  75. package/dist/src/cli/brief-command.js +9 -8
  76. package/dist/src/cli/cli-args.js +133 -28
  77. package/dist/src/cli/cli-command-args.js +82 -21
  78. package/dist/src/cli/cli-editor.js +15 -2
  79. package/dist/src/cli/cli-flag-specs.js +180 -50
  80. package/dist/src/cli/cli-init.js +51 -0
  81. package/dist/src/cli/cli-marker-commands.js +14 -11
  82. package/dist/src/cli/cli-query-commands.js +325 -224
  83. package/dist/src/cli/cli-repo-gate.js +12 -2
  84. package/dist/src/cli/cli-role-command.js +420 -0
  85. package/dist/src/cli/cli-start-summary.js +160 -0
  86. package/dist/src/cli/cli-start.js +453 -0
  87. package/dist/src/cli/completion.js +202 -17
  88. package/dist/src/cli/config-commands.js +51 -25
  89. package/dist/src/cli/follow-view.js +75 -0
  90. package/dist/src/cli/help.js +413 -157
  91. package/dist/src/cli/log-commands.js +234 -62
  92. package/dist/src/cli/notify-command.js +33 -18
  93. package/dist/src/cli/question-commands.js +215 -231
  94. package/dist/src/cli.js +154 -49
  95. package/dist/src/collections.js +84 -18
  96. package/dist/src/concurrency/check-permit.js +35 -19
  97. package/dist/src/concurrency/lock.js +22 -17
  98. package/dist/src/concurrency/provider-lease.js +105 -0
  99. package/dist/src/concurrency/semaphore.js +344 -46
  100. package/dist/src/config/config-aliases.js +105 -0
  101. package/dist/src/config/config-editable-keys.js +16 -4
  102. package/dist/src/config/config-fallbacks.js +416 -0
  103. package/dist/src/config/config-field-checks.js +58 -19
  104. package/dist/src/config/config-keys.js +182 -0
  105. package/dist/src/config/config-live.js +113 -22
  106. package/dist/src/config/config-request.js +137 -0
  107. package/dist/src/config/config-schema.js +58 -39
  108. package/dist/src/config/config-selector-checks.js +123 -0
  109. package/dist/src/config/config-validation-agents.js +80 -0
  110. package/dist/src/config/config-validation-model.js +116 -0
  111. package/dist/src/config/config-validation.js +201 -175
  112. package/dist/src/config/config-views.js +202 -346
  113. package/dist/src/config/config-write-core.js +135 -0
  114. package/dist/src/config/config-write.js +219 -391
  115. package/dist/src/config/config.js +102 -81
  116. package/dist/src/config/model-selector.js +44 -18
  117. package/dist/src/doctor/doctor-backlog-bugs.js +287 -0
  118. package/dist/src/doctor/doctor-backlog-plans.js +263 -0
  119. package/dist/src/doctor/doctor-backlog.js +191 -161
  120. package/dist/src/doctor/doctor-check-names.js +81 -0
  121. package/dist/src/doctor/doctor-checks.js +229 -305
  122. package/dist/src/doctor/doctor-claude-checks.js +145 -0
  123. package/dist/src/doctor/doctor-codex-checks.js +279 -0
  124. package/dist/src/doctor/doctor-contention-checks.js +380 -0
  125. package/dist/src/doctor/doctor-holds.js +181 -104
  126. package/dist/src/doctor/doctor-install.js +31 -0
  127. package/dist/src/doctor/doctor-launch-services.js +2 -2
  128. package/dist/src/doctor/doctor-model-checks.js +496 -270
  129. package/dist/src/doctor/doctor-notify.js +5 -7
  130. package/dist/src/doctor/doctor-opencode-checks.js +162 -0
  131. package/dist/src/doctor/doctor-orphans.js +189 -69
  132. package/dist/src/doctor/doctor-project-checks.js +303 -0
  133. package/dist/src/doctor/doctor-render.js +36 -9
  134. package/dist/src/doctor/doctor.js +145 -50
  135. package/dist/src/doctor/image-probe.js +257 -0
  136. package/dist/src/doctor/outcome.js +3 -2
  137. package/dist/src/doctor/probe.js +60 -0
  138. package/dist/src/events/event-format.js +363 -155
  139. package/dist/src/events/event-labels.js +123 -0
  140. package/dist/src/events/event-legacy.js +164 -0
  141. package/dist/src/events/event-read.js +74 -38
  142. package/dist/src/events/event-tally.js +16 -0
  143. package/dist/src/events/event-window.js +83 -27
  144. package/dist/src/events/events.js +47 -26
  145. package/dist/src/events/notify.js +85 -35
  146. package/dist/src/failure/failure-cluster.js +23 -20
  147. package/dist/src/failure/failure-data.js +140 -92
  148. package/dist/src/failure/failure-render.js +97 -78
  149. package/dist/src/failure/failure-state-change.js +45 -33
  150. package/dist/src/failure/time-spend.js +166 -82
  151. package/dist/src/files/file-queue.js +16 -4
  152. package/dist/src/files/files.js +129 -41
  153. package/dist/src/files/json-files.js +3 -3
  154. package/dist/src/files/json-object.js +45 -9
  155. package/dist/src/files/stat-cache.js +2 -2
  156. package/dist/src/files/tail.js +2 -2
  157. package/dist/src/gates/bootstrap-gates.js +8 -8
  158. package/dist/src/gates/budget-gates.js +361 -52
  159. package/dist/src/gates/disk-gate.js +18 -18
  160. package/dist/src/gates/gate-polls.js +201 -103
  161. package/dist/src/gates/maintenance-quota.js +34 -37
  162. package/dist/src/gates/pause-gates.js +33 -15
  163. package/dist/src/gates/readiness.js +8 -3
  164. package/dist/src/gates/role-cap-gates.js +23 -28
  165. package/dist/src/gates/startup-gate.js +154 -48
  166. package/dist/src/gates/streak-gate.js +67 -41
  167. package/dist/src/git/commit-message.js +80 -48
  168. package/dist/src/git/git-diff.js +29 -23
  169. package/dist/src/git/git-run.js +87 -46
  170. package/dist/src/git/git.js +114 -92
  171. package/dist/src/git/slot-salvage.js +253 -0
  172. package/dist/src/git/slots-state.js +18 -9
  173. package/dist/src/git/worktree-pool.js +150 -49
  174. package/dist/src/git/worktree-use.js +14 -20
  175. package/dist/src/git/worktree.js +108 -51
  176. package/dist/src/gui/gui-admin-endpoints.js +96 -0
  177. package/dist/src/gui/gui-args.js +88 -21
  178. package/dist/src/gui/gui-backlog-commands.js +297 -0
  179. package/dist/src/gui/gui-backlog-endpoints.js +155 -0
  180. package/dist/src/gui/gui-command.js +9 -14
  181. package/dist/src/gui/gui-config-commands.js +462 -0
  182. package/dist/src/gui/gui-endpoint-commands.js +17 -716
  183. package/dist/src/gui/gui-endpoint-common.js +49 -0
  184. package/dist/src/gui/gui-endpoints.js +13 -331
  185. package/dist/src/gui/gui-history-endpoints.js +301 -0
  186. package/dist/src/gui/gui-operator-commands.js +240 -0
  187. package/dist/src/gui/gui-prompt-commands.js +231 -0
  188. package/dist/src/gui/gui-report-endpoints.js +90 -0
  189. package/dist/src/gui/gui-server.js +33 -9
  190. package/dist/src/gui/gui-team-commands.js +164 -0
  191. package/dist/src/gui/http-body.js +17 -1
  192. package/dist/src/history/history-data.js +166 -203
  193. package/dist/src/history/history-queued.js +147 -0
  194. package/dist/src/history/history-render.js +96 -0
  195. package/dist/src/history/history.js +206 -103
  196. package/dist/src/inbox/inbox-attachments.js +94 -39
  197. package/dist/src/inbox/inbox-cancel.js +16 -15
  198. package/dist/src/inbox/inbox-edit.js +10 -10
  199. package/dist/src/inbox/inbox-submit.js +54 -14
  200. package/dist/src/inbox/inbox-top.js +99 -0
  201. package/dist/src/inbox/inbox.js +49 -44
  202. package/dist/src/inbox/pending-prompt.js +27 -27
  203. package/dist/src/inbox/prompt-commands.js +154 -100
  204. package/dist/src/inbox/prompt-not-before.js +2 -2
  205. package/dist/src/init/init-templates.js +15 -14
  206. package/dist/src/init/init.js +35 -29
  207. package/dist/src/merge/backlog-conflicts.js +335 -0
  208. package/dist/src/{landing/landing-batch.js → merge/merge-batch.js} +100 -93
  209. package/dist/src/merge/merge-cancel.js +53 -0
  210. package/dist/src/merge/merge-check-failures.js +209 -0
  211. package/dist/src/{landing/landing-core.js → merge/merge-core.js} +183 -110
  212. package/dist/src/{landing/landing-diff.js → merge/merge-diff.js} +6 -5
  213. package/dist/src/merge/merge-drain.js +351 -0
  214. package/dist/src/merge/merge-git.js +403 -0
  215. package/dist/src/merge/merge-pipeline.js +111 -0
  216. package/dist/src/merge/merge-post-review.js +90 -0
  217. package/dist/src/{landing/landing-questions.js → merge/merge-questions.js} +9 -6
  218. package/dist/src/merge/merge-queue-render.js +113 -0
  219. package/dist/src/merge/merge-queue.js +224 -0
  220. package/dist/src/merge/merge-requeue.js +102 -0
  221. package/dist/src/merge/merge-slot.js +385 -0
  222. package/dist/src/{landing/landing-stack.js → merge/merge-stack.js} +97 -71
  223. package/dist/src/{landing/landing-merge.js → merge/merge-to-main.js} +151 -82
  224. package/dist/src/merge/merge-top.js +69 -0
  225. package/dist/src/merge/merge-verify.js +214 -0
  226. package/dist/src/notes-cli.js +112 -0
  227. package/dist/src/operator/operator-commands.js +268 -89
  228. package/dist/src/operator/operator-intent.js +130 -82
  229. package/dist/src/operator/operator-requests.js +82 -87
  230. package/dist/src/operator/retire.js +49 -31
  231. package/dist/src/operator/revert.js +179 -0
  232. package/dist/src/orchestrator/orchestrator-launch.js +116 -48
  233. package/dist/src/orchestrator/orchestrator-poll.js +320 -0
  234. package/dist/src/orchestrator/orchestrator-scheduling.js +78 -348
  235. package/dist/src/orchestrator/orchestrator.js +173 -361
  236. package/dist/src/orchestrator/retention.js +66 -15
  237. package/dist/src/orchestrator/scheduling-admit.js +116 -0
  238. package/dist/src/orchestrator/scheduling-scope.js +201 -0
  239. package/dist/src/orchestrator/scheduling-skip.js +185 -0
  240. package/dist/src/orchestrator/startup-migration-steps.js +52 -0
  241. package/dist/src/orchestrator/startup-migrations.js +44 -0
  242. package/dist/src/paths.js +228 -75
  243. package/dist/src/pi/command-shape.js +12 -1
  244. package/dist/src/pi/pi-args.js +30 -5
  245. package/dist/src/pi/pi-backend.js +19 -27
  246. package/dist/src/pi/pi-bin.js +64 -67
  247. package/dist/src/pi/pi-event-line.js +17 -1
  248. package/dist/src/pi/pi-failure.js +87 -0
  249. package/dist/src/pi/pi-listed-models.js +53 -0
  250. package/dist/src/pi/pi-models.js +163 -42
  251. package/dist/src/pi/pi-run-result.js +1 -1
  252. package/dist/src/pi/pi-settings.js +86 -0
  253. package/dist/src/pi/pi-stream.js +137 -113
  254. package/dist/src/pi/pi-watchdogs.js +20 -20
  255. package/dist/src/pi-extension/bounded-output.js +25 -8
  256. package/dist/src/pi-extension/context-budget.js +5 -3
  257. package/dist/src/pi-extension/context-shake.js +54 -21
  258. package/dist/src/pi-extension/context-window.js +36 -0
  259. package/dist/src/pi-extension/full-output.js +5 -12
  260. package/dist/src/pi-extension/strip-thinking.js +79 -0
  261. package/dist/src/pi-extension/trim-system-prompt.js +37 -0
  262. package/dist/src/pi-extension/write-guard.js +37 -0
  263. package/dist/src/process/launch-services.js +11 -11
  264. package/dist/src/process/node-bin.js +16 -0
  265. package/dist/src/process/process-group.js +8 -18
  266. package/dist/src/process/process-table.js +1 -1
  267. package/dist/src/process/process.js +48 -9
  268. package/dist/src/process/run-marker.js +42 -7
  269. package/dist/src/process/supervisor.js +47 -35
  270. package/dist/src/prompt/dialect.js +46 -11
  271. package/dist/src/prompt/gate-notes.js +203 -0
  272. package/dist/src/prompt/gate-prompts.js +201 -188
  273. package/dist/src/prompt/notes-backlog.js +181 -0
  274. package/dist/src/prompt/principles.js +1 -1
  275. package/dist/src/prompt/prompt-followup.js +43 -29
  276. package/dist/src/prompt/prompt.js +255 -172
  277. package/dist/src/redeploy/redeploy-policy.js +29 -24
  278. package/dist/src/redeploy/redeploy-probes.js +1 -1
  279. package/dist/src/redeploy/redeploy.js +7 -6
  280. package/dist/src/redeploy/redeployer.js +78 -70
  281. package/dist/src/redeploy/self-reload.js +3 -2
  282. package/dist/src/report/report-data.js +374 -285
  283. package/dist/src/report/report-fold.js +430 -0
  284. package/dist/src/report/report-main-red.js +55 -0
  285. package/dist/src/report/report-render.js +321 -61
  286. package/dist/src/report/report-types.js +1 -0
  287. package/dist/src/report/report.js +26 -9
  288. package/dist/src/request-timeouts.js +2 -2
  289. package/dist/src/review/known-flakes.js +133 -14
  290. package/dist/src/review/post-merge-review.js +106 -0
  291. package/dist/src/review/protected-edits.js +7 -7
  292. package/dist/src/review/review-followup.js +21 -9
  293. package/dist/src/review/review-precheck.js +77 -33
  294. package/dist/src/review/review-run.js +395 -0
  295. package/dist/src/review/review-verdict.js +16 -2
  296. package/dist/src/review/review.js +172 -356
  297. package/dist/src/review/secret-leaks.js +147 -0
  298. package/dist/src/review/suite-rerun.js +3 -3
  299. package/dist/src/roles/legacy-role-ids.js +21 -0
  300. package/dist/src/roles/legacy-role-migration.js +135 -0
  301. package/dist/src/roles/role-catalog.js +172 -137
  302. package/dist/src/roles/role-guidance.js +112 -44
  303. package/dist/src/roles/role-labels.js +9 -0
  304. package/dist/src/roles/role-render.js +221 -28
  305. package/dist/src/roles/role-view.js +244 -33
  306. package/dist/src/roles/roles.js +37 -35
  307. package/dist/src/roles/runner-ids.js +97 -0
  308. package/dist/src/run/acceptance-greps.js +119 -0
  309. package/dist/src/run/feedback-filings.js +51 -0
  310. package/dist/src/{tick → run}/qa-coverage.js +10 -27
  311. package/dist/src/{tick/tick-apply.js → run/run-apply.js} +166 -136
  312. package/dist/src/run/run-detail-data.js +179 -0
  313. package/dist/src/run/run-detail-render.js +98 -0
  314. package/dist/src/run/run-detail.js +168 -0
  315. package/dist/src/run/run-finalize.js +154 -0
  316. package/dist/src/{tick/tick-outcome.js → run/run-outcome.js} +6 -6
  317. package/dist/src/run/run-prompt.js +304 -0
  318. package/dist/src/{tick/tick-resume.js → run/run-resume.js} +80 -35
  319. package/dist/src/run/run-stage.js +295 -0
  320. package/dist/src/run/run-timing.js +198 -0
  321. package/dist/src/run/run-usage.js +180 -0
  322. package/dist/src/run/run-verdict.js +301 -0
  323. package/dist/src/run/selfcheck-digest.js +40 -0
  324. package/dist/src/run/stage-backlog-checks.js +249 -0
  325. package/dist/src/run/stage-check.js +172 -0
  326. package/dist/src/run/stage-path-checks.js +730 -0
  327. package/dist/src/runner/leftover.js +185 -0
  328. package/dist/src/{loop → runner}/model-fallback.js +13 -12
  329. package/dist/src/runner/revision.js +202 -0
  330. package/dist/src/{loop/loop-fallback.js → runner/runner-fallback.js} +10 -10
  331. package/dist/src/runner/runner-outcome.js +107 -0
  332. package/dist/src/runner/runner-pi.js +433 -0
  333. package/dist/src/{loop/loop-recovery.js → runner/runner-recovery.js} +34 -28
  334. package/dist/src/runner/runner-run.js +625 -0
  335. package/dist/src/runner/runner-state-load.js +268 -0
  336. package/dist/src/runner/runner-state.js +102 -0
  337. package/dist/src/runner/runner.js +350 -0
  338. package/dist/src/scheduling/backoff.js +64 -54
  339. package/dist/src/scheduling/claims.js +46 -26
  340. package/dist/src/scheduling/once-round.js +30 -30
  341. package/dist/src/scheduling/quiet-hours.js +26 -34
  342. package/dist/src/scheduling/scheduling.js +87 -74
  343. package/dist/src/scheduling/{work-landed-cache.js → work-merged-cache.js} +14 -14
  344. package/dist/src/status/status-budget.js +123 -0
  345. package/dist/src/status/status-data.js +106 -191
  346. package/dist/src/status/status-inbox.js +47 -0
  347. package/dist/src/status/status-install.js +26 -0
  348. package/dist/src/status/status-polls.js +70 -59
  349. package/dist/src/status/status-roles.js +131 -0
  350. package/dist/src/{fleet → team}/error-storm.js +16 -16
  351. package/dist/src/{fleet → team}/failure-spread.js +10 -10
  352. package/dist/src/{fleet → team}/orchestrator-info.js +97 -25
  353. package/dist/src/{fleet → team}/reclaim.js +9 -9
  354. package/dist/src/{fleet/fleet-hold.js → team/team-hold.js} +60 -26
  355. package/dist/src/team/team-polls.js +299 -0
  356. package/dist/src/{fleet/fleet-state.js → team/team-state.js} +47 -40
  357. package/dist/src/text/datetime.js +102 -16
  358. package/dist/src/text/format.js +49 -3
  359. package/dist/src/text/markdown.js +8 -5
  360. package/dist/src/text/phrases.js +89 -54
  361. package/dist/src/text/suggest.js +3 -2
  362. package/dist/src/text/text.js +68 -14
  363. package/dist/src/ui/badges.js +165 -93
  364. package/dist/src/ui/gui/gui-client-backlog.js +292 -0
  365. package/dist/src/ui/gui/gui-client-boot.js +221 -42
  366. package/dist/src/ui/gui/gui-client-composer.js +105 -27
  367. package/dist/src/ui/gui/gui-client-drawer-config.js +212 -0
  368. package/dist/src/ui/gui/gui-client-drawer.js +226 -130
  369. package/dist/src/ui/gui/gui-client-feed.js +271 -0
  370. package/dist/src/ui/gui/gui-client-history.js +492 -68
  371. package/dist/src/ui/gui/gui-client-labels.js +23 -0
  372. package/dist/src/ui/gui/gui-client-markdown.js +1 -1
  373. package/dist/src/ui/gui/gui-client-model.js +84 -76
  374. package/dist/src/ui/gui/gui-client-operator.js +112 -78
  375. package/dist/src/ui/gui/gui-client-pending.js +248 -41
  376. package/dist/src/ui/gui/gui-client-report-chart.js +464 -0
  377. package/dist/src/ui/gui/gui-client-report.js +122 -179
  378. package/dist/src/ui/gui/{gui-client-loops.js → gui-client-roles.js} +118 -76
  379. package/dist/src/ui/gui/gui-client-settings.js +180 -20
  380. package/dist/src/ui/gui/gui-client-team.js +252 -0
  381. package/dist/src/ui/gui/gui-client.js +48 -40
  382. package/dist/src/ui/gui/gui-icons.js +0 -2
  383. package/dist/src/ui/gui/gui-page.js +25 -24
  384. package/dist/src/ui/gui/gui-styles.js +46 -38
  385. package/dist/src/ui/progress-data.js +11 -11
  386. package/dist/src/ui/{tick-progress-model.js → run-progress-model.js} +40 -40
  387. package/dist/src/ui/status-model.js +276 -194
  388. package/dist/src/ui/status-payload.js +227 -62
  389. package/dist/src/ui/status-render.js +196 -108
  390. package/dist/src/ui/team-alerts.js +532 -0
  391. package/dist/src/ui/tone.js +11 -11
  392. package/dist/src/ui/transcript-run.js +58 -0
  393. package/dist/src/ui/transcript-tail.js +28 -19
  394. package/dist/src/ui/transcript.js +85 -38
  395. package/dist/src/ui/tui/tui-backlog.js +132 -21
  396. package/dist/src/ui/tui/tui-editor-answer.js +93 -0
  397. package/dist/src/ui/tui/tui-editor-attach.js +105 -0
  398. package/dist/src/ui/tui/tui-editor-backends.js +132 -0
  399. package/dist/src/ui/tui/tui-editor-brief.js +105 -0
  400. package/dist/src/ui/tui/tui-editor-budget.js +159 -0
  401. package/dist/src/ui/tui/tui-editor-claude-reserve.js +24 -0
  402. package/dist/src/ui/tui/tui-editor-concurrency.js +24 -0
  403. package/dist/src/ui/tui/tui-editor-config.js +86 -0
  404. package/dist/src/ui/tui/tui-editor-ctx.js +1 -0
  405. package/dist/src/ui/tui/tui-editor-entry.js +219 -0
  406. package/dist/src/ui/tui/tui-editor-fallback.js +31 -0
  407. package/dist/src/ui/tui/tui-editor-instances.js +37 -0
  408. package/dist/src/ui/tui/tui-editor-instructions.js +136 -0
  409. package/dist/src/ui/tui/tui-editor-interval.js +124 -0
  410. package/dist/src/ui/tui/tui-editor-model.js +29 -0
  411. package/dist/src/ui/tui/tui-editor-notes.js +112 -0
  412. package/dist/src/ui/tui/tui-editor-notify.js +25 -0
  413. package/dist/src/ui/tui/tui-editor-pause.js +255 -0
  414. package/dist/src/ui/tui/tui-editor-prompt.js +90 -0
  415. package/dist/src/ui/tui/tui-editor-provider-caps.js +27 -0
  416. package/dist/src/ui/tui/tui-editor-queued.js +94 -0
  417. package/dist/src/ui/tui/tui-editor-quiet.js +170 -0
  418. package/dist/src/ui/tui/tui-editor-retire.js +81 -0
  419. package/dist/src/ui/tui/tui-editor-role-key.js +76 -0
  420. package/dist/src/ui/tui/tui-editor-role-model.js +28 -0
  421. package/dist/src/ui/tui/tui-editor-search.js +85 -0
  422. package/dist/src/ui/tui/tui-editor-session.js +123 -0
  423. package/dist/src/ui/tui/tui-editor-slots.js +23 -0
  424. package/dist/src/ui/tui/tui-editors.js +185 -0
  425. package/dist/src/ui/tui/tui-frame.js +107 -58
  426. package/dist/src/ui/tui/tui-history.js +16 -12
  427. package/dist/src/ui/tui/tui-input.js +56 -60
  428. package/dist/src/ui/tui/tui-keys.js +106 -1825
  429. package/dist/src/ui/tui/tui-pane-activity.js +102 -0
  430. package/dist/src/ui/tui/tui-pane-backlog.js +269 -0
  431. package/dist/src/ui/tui/tui-pane-brief.js +29 -0
  432. package/dist/src/ui/tui/tui-pane-ctx.js +11 -0
  433. package/dist/src/ui/tui/tui-pane-health.js +174 -0
  434. package/dist/src/ui/tui/tui-pane-history.js +636 -0
  435. package/dist/src/ui/tui/tui-pane-pending.js +369 -0
  436. package/dist/src/ui/tui/tui-pane-queued.js +159 -0
  437. package/dist/src/ui/tui/tui-pane-report.js +154 -0
  438. package/dist/src/ui/tui/tui-pane-session.js +120 -0
  439. package/dist/src/ui/tui/tui-pane-transcript.js +224 -0
  440. package/dist/src/ui/tui/tui-pane.js +125 -44
  441. package/dist/src/ui/tui/tui-panes.js +364 -0
  442. package/dist/src/ui/tui/tui.js +52 -34
  443. package/dist/src/verdict/fix-claim.js +135 -62
  444. package/dist/src/verdict/no-change.js +19 -0
  445. package/dist/src/verdict/refusal.js +80 -24
  446. package/dist/src/verdict/reply-contract.js +51 -28
  447. package/dist/src/version.js +2 -2
  448. package/package.json +5 -2
  449. package/dist/src/agent/mcp/role-notes-server.js +0 -160
  450. package/dist/src/brief-edit.js +0 -42
  451. package/dist/src/cli/cli-run.js +0 -469
  452. package/dist/src/fleet/fleet-polls.js +0 -207
  453. package/dist/src/landing/backlog-conflicts.js +0 -116
  454. package/dist/src/landing/landing-check-failures.js +0 -141
  455. package/dist/src/landing/landing-drain.js +0 -204
  456. package/dist/src/landing/landing-git.js +0 -190
  457. package/dist/src/landing/landing-pipeline.js +0 -96
  458. package/dist/src/landing/landing-queue-render.js +0 -56
  459. package/dist/src/landing/landing-queue.js +0 -149
  460. package/dist/src/landing/landing-slot.js +0 -256
  461. package/dist/src/landing/landing-vetting.js +0 -196
  462. package/dist/src/loop/leftover.js +0 -129
  463. package/dist/src/loop/loop-pi.js +0 -370
  464. package/dist/src/loop/loop-state.js +0 -204
  465. package/dist/src/loop/loop-tick.js +0 -545
  466. package/dist/src/loop/loop.js +0 -315
  467. package/dist/src/loop/revision.js +0 -61
  468. package/dist/src/pi-extension/role-notes.js +0 -40
  469. package/dist/src/roles/loop-ids.js +0 -60
  470. package/dist/src/tick/stage-check.js +0 -302
  471. package/dist/src/tick/telemetry-digest.js +0 -24
  472. package/dist/src/tick/tick-detail-data.js +0 -107
  473. package/dist/src/tick/tick-detail.js +0 -150
  474. package/dist/src/tick/tick-finalize.js +0 -135
  475. package/dist/src/tick/tick-prompt.js +0 -201
  476. package/dist/src/tick/tick-stage.js +0 -223
  477. package/dist/src/tick/tick-timing.js +0 -195
  478. package/dist/src/tick/tick-usage.js +0 -142
  479. package/dist/src/tick/tick-verdict.js +0 -201
  480. package/dist/src/ui/fleet-alerts.js +0 -174
  481. package/dist/src/ui/gui/gui-client-fleet.js +0 -576
  482. package/dist/src/ui/gui/gui-client-sound.js +0 -52
@@ -1,24 +1,48 @@
1
- /** The dashboard's loops table, browser-side — the fleet's rows grouped by what the loops are
2
- * doing (working, landing, needs-attention, paused, idle), each with its status pill, current
1
+ /** The dashboard's roles table, browser-side — the team's rows grouped by what the roles are
2
+ * doing (working, merge, needs-attention, paused, idle), each with its status pill, current
3
3
  * work, spend, and per-row operator controls (prompt, wake, pause/resume, and the two-click
4
- * abort), patched cell by cell so a ticking row keeps focus and hover. renderLoops repaints it
5
- * from each /api/status poll; renderFleet (gui-client-fleet.ts) calls it. Spliced into
6
- * gui-client.ts's script, reaching its helpers (esc, icon, phaseInfo, sortLoops, postAction,
4
+ * abort), patched cell by cell so a ticking row keeps focus and hover. renderRoles repaints it
5
+ * from each /api/status poll; renderTeam (gui-client-team.ts) calls it. Spliced into
6
+ * gui-client.ts's script, reaching its helpers (esc, icon, phaseInfo, sortRoles, postAction,
7
7
  * setTarget, focusComposer, rerender, …) through that concatenation. */
8
- export const GUI_CLIENT_LOOPS_JS = String.raw `
9
- // ---- loops ----
8
+ export const GUI_CLIENT_ROLES_JS = String.raw `
9
+ // ---- roles ----
10
10
  // row-actions:start
11
- let confirmAbort = null; // { role, until } while an abort waits for its confirming click
12
- const abortConfirming = (role) => Boolean(confirmAbort && confirmAbort.role === role && confirmAbort.until > Date.now());
11
+ // A two-click confirm, the confirmSlot shape the drawer's note-clear/entry-cancel also use:
12
+ // the first click stores a { id, title?, until } record and repaints; armed() fires a second
13
+ // click inside the 5 s window; a 5100 ms auto-disarm drops an unconfirmed record past its
14
+ // expiry. Defined here (the earliest consumer splice) so the roles' abort in this file, an
15
+ // earlier splice, and the drawer's notes-clear/entry-cancel in a later splice all share
16
+ // one arm, guard, and disarm instead of three copies.
17
+ function confirmSlot(repaint) {
18
+ let confirm = null; // { id, title?, until }
19
+ return {
20
+ armed: (id, title) => Boolean(confirm && confirm.id === id && (title === undefined || confirm.title === title) && confirm.until > Date.now()),
21
+ disarm: () => { confirm = null; },
22
+ arm(id, title) {
23
+ confirm = { id, title, until: Date.now() + 5000 };
24
+ repaint();
25
+ setTimeout(() => { if (confirm && confirm.id === id && confirm.until <= Date.now()) { confirm = null; repaint(); } }, 5100);
26
+ },
27
+ };
28
+ }
29
+ // The abort slot: keyed by role, so arming is per role — a second click on the same role's
30
+ // abort fires, while a first click on another role's abort re-arms instead of posting.
31
+ const confirmAbortSlot = confirmSlot(rerender);
32
+ const abortConfirming = (role) => confirmAbortSlot.armed(role);
33
+ // The drawer's Disable slot: a second click on the same role's Disable fires, a first click
34
+ // on another role's re-arms — the same per-role keying as the abort slot it sits beside.
35
+ const confirmDisableSlot = confirmSlot(rerender);
36
+ const disableConfirming = (role) => confirmDisableSlot.armed(role);
13
37
  let roleChooser = null; // { role, action, until }: the one open duration chooser ("pause-for" or "wake-in")
14
38
  const roleChooserOpen = (role, action) => Boolean(roleChooser && roleChooser.role === role && roleChooser.action === action && roleChooser.until > Date.now());
15
39
  const rolePauseMenuOpen = (role) => roleChooserOpen(role, "pause-for");
16
40
  const roleWakeMenuOpen = (role) => roleChooserOpen(role, "wake-in");
17
41
  const ROLE_PAUSE_CHOICES = [[1800, "30m"], [3600, "1h"], [7200, "2h"], [28800, "8h"], [0, "standing"]];
18
42
  const ROLE_WAKE_CHOICES = ROLE_PAUSE_CHOICES.filter((c) => c[0] > 0); // a wake has no "standing" choice
19
- // A loop's controls, from its table row or its drawer: prompt (aims the composer at the loop),
43
+ // A role's controls, from its table row or its drawer: prompt (aims the composer at the role),
20
44
  // wake, pause/resume (the target state is always explicit), and abort, which discards the
21
- // tick's work — the first click arms it, a second within 5 s fires it.
45
+ // run's work — the first click arms it, a second within 5 s fires it.
22
46
  async function rowAction(action, role, forSeconds) {
23
47
  if (action === "prompt") {
24
48
  setTarget(role);
@@ -26,9 +50,11 @@ export const GUI_CLIENT_LOOPS_JS = String.raw `
26
50
  return;
27
51
  }
28
52
  if (action === "abort" && !abortConfirming(role)) {
29
- confirmAbort = { role, until: Date.now() + 5000 };
30
- rerender();
31
- setTimeout(() => { if (confirmAbort && confirmAbort.role === role && confirmAbort.until <= Date.now()) { confirmAbort = null; rerender(); } }, 5100);
53
+ confirmAbortSlot.arm(role);
54
+ return;
55
+ }
56
+ if (action === "disable" && !disableConfirming(role)) {
57
+ confirmDisableSlot.arm(role);
32
58
  return;
33
59
  }
34
60
  if ((action === "pause-for" || action === "wake-in") && forSeconds === undefined) {
@@ -36,29 +62,36 @@ export const GUI_CLIENT_LOOPS_JS = String.raw `
36
62
  rerender();
37
63
  return;
38
64
  }
39
- confirmAbort = null;
65
+ confirmAbortSlot.disarm();
66
+ confirmDisableSlot.disarm();
40
67
  roleChooser = null;
41
68
  const pausing = action === "pause" || action === "pause-for";
42
69
  const timed = action === "pause-for" && forSeconds > 0;
43
- const path = action === "abort" ? "/api/abort" : action === "reset-counters" ? "/api/reset-counters" : action === "wake-cancel" ? "/api/wake-cancel" : pausing || action === "resume" ? "/api/pause-role" : "/api/wake";
70
+ const path = action === "abort" ? "/api/abort" : action === "disable" ? "/api/role-disable" : action === "reset-counters" ? "/api/reset-counters" : action === "wake-cancel" ? "/api/wake-cancel" : pausing || action === "resume" ? "/api/pause-role" : "/api/wake";
44
71
  const wakeIn = action === "wake-in";
45
72
  const body = pausing || action === "resume" ? { role, paused: pausing, ...(timed ? { forSeconds } : {}) } : wakeIn ? { role, inSeconds: forSeconds } : { role };
46
73
  await postAction(path, body, (d) => {
74
+ if (action === "disable") {
75
+ // The role drops out of d.roles on the next poll, so without closing it the open
76
+ // drawer would fall to its "no longer part of the team" head.
77
+ closeDrawer();
78
+ return d && typeof d.message === "string" ? d.message : role + ": done";
79
+ }
47
80
  let msg = d && typeof d.message === "string" ? d.message : action === "wake-cancel" ? role + ": scheduled wake cancelled" : role + ": done";
48
81
  if (wakeIn && !(d && typeof d.message === "string")) msg = role + " wakes in " + humanSeconds(forSeconds);
49
82
  else if (timed) msg = role + " paused for " + humanSeconds(forSeconds);
50
83
  else if (pausing || action === "resume") {
51
84
  msg = role + (d && d.changed
52
- ? (pausing ? " paused — it starts no new ticks" : " resumed")
85
+ ? (pausing ? " paused — it starts no new runs" : " resumed")
53
86
  : (pausing ? " was already paused" : " was not paused"));
54
87
  }
55
88
  return msg;
56
89
  });
57
90
  }
58
91
  // row-actions:end
59
- // loops-table:start
60
- // The status pill's second line: what the phase label carried, or when an idle loop runs next.
61
- // The future operator wakes that name this loop (or its base role), earliest first. Reads the
92
+ // roles-table:start
93
+ // The status pill's second line: what the phase label carried, or when an idle role runs next.
94
+ // The future operator wakes that name this role (or its base role), earliest first. Reads the
62
95
  // payload's scheduledWakes, falling back to the lone scheduledWake of an older server.
63
96
  function scheduledWakesFor(l, d) {
64
97
  const all = d.scheduledWakes || (d.scheduledWake ? [d.scheduledWake] : []);
@@ -72,81 +105,90 @@ export const GUI_CLIENT_LOOPS_JS = String.raw `
72
105
  const detail = phaseDetailBase(l, info, d);
73
106
  const w = scheduledWakeFor(l, d);
74
107
  if (!w) return detail;
75
- return (detail ? detail + " · " : "") + "operator wake in " + humanSeconds(Math.max(0, Math.round((w.atMs - Date.now()) / 1000)));
108
+ return (detail ? detail + " · " : "") + "your wake in " + humanSeconds(Math.max(0, Math.round((w.atMs - Date.now()) / 1000)));
76
109
  }
77
110
  function phaseDetailBase(l, info, d) {
78
111
  const raw = fmtNextRun(l, d.running);
79
112
  const slowed = / ×(\d+)$/.exec(raw);
80
113
  const next = slowed ? raw.slice(0, slowed.index) : raw;
81
- const backoff = next.startsWith("backoff ") ? "backing off — retries in " + next.slice(8) : "";
82
- // A yield-scaled clock: the loop's recent ticks landed nothing, so it ticks less often.
83
- const note = slowed ? " · slowed ×" + slowed[1] + ", nothing landed lately" : "";
84
- if (info.key === "sleeping") return (backoff || (next === "-" ? "" : next === "now" ? "wakes now" : "wakes in " + next)) + note;
85
- if (info.key === "queued") return (backoff || info.detail) + note;
86
- if (info.key === "paused" && d.pausedRolesUntil && !d.paused && (d.pausedRoles || []).includes(l.role)) return info.detail + " · resumes in " + humanSeconds(Math.max(0, Math.round((d.pausedRolesUntil - Date.now()) / 1000)));
87
- return info.detail;
114
+ const backoff = next.startsWith("sleeping ") ? "sleeping — next check in " + next.slice(9) : "";
115
+ // A yield-scaled clock: the role's recent runs merged nothing, so it runs less often.
116
+ const note = slowed ? " · slowed ×" + slowed[1] + ", nothing merged lately" : "";
117
+ // The consecutive no-change streak (status-payload noChangeStreak, mirrored from
118
+ // status-model rolePhase's · no change ×N suffix): how many completed runs in a row
119
+ // returned nothing to do. Shown only on a resting idle cell (sleeping/queued/idle/
120
+ // deferred) — never on live work, a pause, a failure, or main-red, which the status
121
+ // label likewise leaves bare. Observational only: a legitimately idle maintenance role
122
+ // can hold a long streak.
123
+ const noChange = ["sleeping", "queued", "idle", "deferred"].includes(info.key) && (l.noChangeStreak || 0) >= 2
124
+ ? " · no change ×" + l.noChangeStreak : "";
125
+ if (info.key === "sleeping") return (backoff || (next === "-" ? "" : next === "now" ? "wakes now" : "wakes in " + next)) + note + noChange;
126
+ if (info.key === "queued") return (backoff || info.detail) + note + noChange;
127
+ if (info.key === "paused" && d.pausedRolesUntil && !d.paused && (d.pausedLoops || []).includes(l.role)) return info.detail + " · resumes in " + humanSeconds(Math.max(0, Math.round((d.pausedRolesUntil - Date.now()) / 1000))); // retired-name-ok: serialized /api key
128
+ return info.detail + noChange;
88
129
  }
89
- function loopCells(l, d) {
130
+ function roleCells(l, d) {
90
131
  const info = phaseInfo(l.phase);
91
- const paused = (d.pausedRoles || []).includes(l.role);
132
+ const paused = (d.pausedLoops || []).includes(l.role); // retired-name-ok: serialized /api key
92
133
  const queued = (d.roleInbox || {})[l.role] || 0;
93
134
  const detail = phaseDetail(l, info, d);
94
135
  const stalled = info.live && STALL.test(l.phase);
95
- const name = "<div class='loop-name'><button type='button' class='linkish role' data-open='" + esc(l.role) + "' title='Open " + esc(l.role) + "'>" + esc(l.role) + "</button>" +
96
- (l.custom ? "<span class='tag' title='A user-defined loop from tumwater.json'>custom</span>" : "") +
97
- (l.modelTier ? "<span class='tag' title='The tier of the top-level model map this loop resolves at'>" + esc(l.modelTier) + "</span>" : "") +
136
+ const name = "<div class='role-name'><button type='button' class='linkish role' data-open='" + esc(l.role) + "' title='Open " + esc(roleLabel(l.role)) + "'>" + esc(roleLabel(l.role)) + "</button>" +
137
+ (l.custom ? "<span class='tag' title='A custom role from tumwater.json'>custom</span>" : "") +
138
+ (l.modelTier ? "<span class='tag' title='The model tier this role resolves at'>" + esc(l.modelTier) + "</span>" : "") +
98
139
  (l.fallback ? "<span class='tag t-amber' title='Running on the model fallback while its primary keeps failing provider-class errors'>fallback</span>" : "") +
99
- (queued ? "<span class='tag t-indigo' title='" + esc(plural(queued, "prompt") + " queued for this loop") + "'>" + icon("chat") + queued + "</span>" : "") +
100
- "</div><div class='sub'>" + esc(plural(l.commits, "commit") + " · " + plural(l.ticks, "tick")) + (l.model ? " · " + esc(l.model) : "") + "</div>";
140
+ (queued ? "<span class='tag t-indigo' title='" + esc(plural(queued, "message") + " in this role's inbox") + "'>" + icon("chat") + queued + "</span>" : "") +
141
+ "</div><div class='sub'>" + esc(plural(l.commits, "commit") + " · " + plural(l.runs, "run") + " · merged " + (l.lastMergedAt ? fmtAgo(l.lastMergedAt) : "never")) + (l.model ? " · " + esc(l.model) : "") +
142
+ (l.modelFromPi ? " <span class='tag' title='pi&#39;s own default model, from its settings.json: tumwater.json names no model'>(pi default)</span>" : "") + "</div>";
101
143
  const status = pill(info) + (detail ? "<div class='sub" + (stalled ? " t-red" : "") + "' title='" + esc(l.phase) + "'>" + esc(detail) + "</div>" : "");
102
144
  let activity;
103
- if (info.live || info.key === "vetted") {
104
- // Parallel work instances, part 6/7: while idle or landing, show the entry the instance
105
- // claimed before the landing summary placeholder.
106
- const text = l.currentWork || l.claim || landingSummary(d, l.role);
107
- const pending = info.key === "working" ? "Starting up…" : info.key === "reviewing" ? "Reviewing the change…" : "Landing the change…";
145
+ if (info.live || info.key === "vetted") { // vocabulary-ok: internal phase key
146
+ // Parallel work instances, part 6/7: while idle or merge, show the entry the instance
147
+ // claimed before the merge summary placeholder.
148
+ const text = l.currentWork || l.claim || mergeSummary(d, l.role);
149
+ const pending = info.key === "working" ? "Starting up…" : info.key === "reviewing" ? "Reviewing the change…" : "Merging the change…";
108
150
  activity = text ? "<div class='now clamp2' title='" + esc(text) + "'>" + esc(text) + "</div>" : "<div class='muted'>" + pending + "</div>";
109
151
  } else if (l.claim) {
110
152
  // An idle instance holding a claim names its entry; the pill detail carries why an
111
- // idle loop with none is idle.
153
+ // idle role with none is idle.
112
154
  const text = l.claim;
113
155
  activity = "<div class='now clamp2' title='" + esc(text) + "'>" + esc(text) + "</div>";
114
156
  } else if (l.lastResult) {
115
157
  const r = resultInfo(l.lastResult);
116
158
  const why = resultWhy(l);
117
159
  activity = "<div class='clamp2' title='" + esc(why || r.label) + "'><span class='res t-" + r.tone + "'>" + esc(r.label) + "</span>" +
118
- (why ? " <span class='now'>" + esc(why) + "</span>" : "") + "</div><div class='sub'>" + esc(fmtAgo(l.lastTickEndedAt)) + "</div>";
119
- } else activity = "<div class='muted'>No ticks yet</div>";
160
+ (why ? " <span class='now'>" + esc(why) + "</span>" : "") + "</div><div class='sub'>" + esc(fmtAgo(l.lastRunEndedAt)) + "</div>";
161
+ } else activity = "<div class='muted'>No runs yet</div>";
120
162
  const spent = "<div>" + esc(fmtUsd(l.todayUsd)) + "</div><div class='sub'>" + esc(fmtUsd(l.costUsd)) + " total</div>";
121
163
  const b = (action, ic, title, cls) => "<button type='button' class='icon-btn rowaction" + (cls ? " " + cls : "") + "' data-action='" + action +
122
164
  "' data-role='" + esc(l.role) + "' title='" + esc(title) + "' aria-label='" + esc(title) + "'>" + icon(ic) + "</button>";
123
- let actions = b("prompt", "chat", "Prompt " + l.role);
165
+ let actions = b("prompt", "chat", "Message " + roleLabel(l.role));
124
166
  // The running set (info.live), not the permit-holder inFlight: the exempt running director
125
- // has an abortable tick without holding a maxConcurrent permit (BUGS.md 2026-10-06).
167
+ // has an abortable run without holding a maxConcurrent permit (BUGS.md 2026-10-06).
126
168
  if (info.live) {
127
169
  actions += abortConfirming(l.role)
128
- ? "<button type='button' class='icon-btn rowaction confirming' data-action='abort' data-role='" + esc(l.role) + "' title='Click again to abort the running tick'>" + icon("stop") + "Abort?</button>"
129
- : b("abort", "stop", "Abort " + l.role + "'s running tick", "danger");
130
- } else actions += b("wake", "bolt", "Wake " + l.role + " now");
131
- if (paused) actions += b("resume", "play", "Resume " + l.role);
170
+ ? "<button type='button' class='icon-btn rowaction confirming' data-action='abort' data-role='" + esc(l.role) + "' title='Click again to stop this run'>" + icon("stop") + "Stop?</button>"
171
+ : b("abort", "stop", "Stop " + roleLabel(l.role) + "'s run", "danger");
172
+ } else actions += b("wake", "bolt", "Wake " + roleLabel(l.role) + " now");
173
+ if (paused) actions += b("resume", "play", "Resume " + roleLabel(l.role));
132
174
  else if (rolePauseMenuOpen(l.role)) {
133
175
  actions += ROLE_PAUSE_CHOICES.map((c) => "<button type='button' class='icon-btn rowaction' data-action='pause-for' data-for='" + c[0] +
134
- "' data-role='" + esc(l.role) + "' title='Pause " + esc(l.role) + " " + (c[0] ? "for " + c[1] : "until resumed") + "'>" + esc(c[1]) + "</button>").join("");
135
- } else actions += b("pause", "pause", "Pause " + l.role) + b("pause-for", "clock", "Pause " + l.role + " for a duration");
176
+ "' data-role='" + esc(l.role) + "' title='Pause " + esc(roleLabel(l.role)) + " " + (c[0] ? "for " + c[1] : "until resumed") + "'>" + esc(c[1]) + "</button>").join("");
177
+ } else actions += b("pause", "pause", "Pause " + roleLabel(l.role)) + b("pause-for", "clock", "Pause " + roleLabel(l.role) + " for a duration");
136
178
  return { info, cells: [name, status, activity, spent, "<div class='actions'>" + actions + "</div>"] };
137
179
  }
138
- // loops-table:end
139
- const LOOP_TDS = ["c-loop", "c-status", "c-activity", "c-today num", "c-actions"];
140
- let loopKeys = "";
141
- // Rows are patched cell by cell: a working loop's elapsed time changes every second, and
180
+ // roles-table:end
181
+ const ROLE_TDS = ["c-role", "c-status", "c-activity", "c-today num", "c-actions"];
182
+ let roleKeys = "";
183
+ // Rows are patched cell by cell: a working role's elapsed time changes every second, and
142
184
  // rewriting only that cell keeps focus and hover on the row's buttons.
143
- function patchLoops(rows) {
144
- const tbody = $("loops");
185
+ function patchRoles(rows) {
186
+ const tbody = $("rolerows");
145
187
  const keys = rows.map((r) => r.key).join("|");
146
- if (keys !== loopKeys) {
147
- loopKeys = keys;
188
+ if (keys !== roleKeys) {
189
+ roleKeys = keys;
148
190
  tbody.innerHTML = rows.map((r) => "<tr class='" + r.cls + "'" + (r.role ? " data-role='" + esc(r.role) + "'" : "") + ">" +
149
- r.cells.map((c, j) => (r.group ? "<td colspan='5'>" : "<td class='" + LOOP_TDS[j] + "'>") + c + "</td>").join("") + "</tr>").join("");
191
+ r.cells.map((c, j) => (r.group ? "<td colspan='5'>" : "<td class='" + ROLE_TDS[j] + "'>") + c + "</td>").join("") + "</tr>").join("");
150
192
  Array.from(tbody.rows).forEach((tr, i) => Array.from(tr.cells).forEach((td, j) => { td._html = rows[i].cells[j]; }));
151
193
  return;
152
194
  }
@@ -159,43 +201,43 @@ export const GUI_CLIENT_LOOPS_JS = String.raw `
159
201
  });
160
202
  });
161
203
  }
162
- function renderLoops(d) {
163
- $("loopstable").classList.toggle("free", Boolean(d.budget && d.budget.free));
164
- const byGroup = LOOP_GROUPS.map(() => []);
165
- for (const l of sortLoops(d.loops || [])) {
166
- const rank = loopRank(l.phase);
167
- byGroup[LOOP_GROUPS.findIndex((g) => g.slice(1).includes(rank))].push(l);
204
+ function renderRoles(d) {
205
+ $("rolestable").classList.toggle("free", Boolean(d.budget && d.budget.free));
206
+ const byGroup = ROLE_GROUPS.map(() => []);
207
+ for (const l of sortRoles(d.roles || [])) {
208
+ const rank = roleRank(l.phase);
209
+ byGroup[ROLE_GROUPS.findIndex((g) => g.slice(1).includes(rank))].push(l);
168
210
  }
169
- const selected = openLoopRole();
211
+ const selected = openRoleId();
170
212
  const rows = [];
171
- LOOP_GROUPS.forEach((g, gi) => {
213
+ ROLE_GROUPS.forEach((g, gi) => {
172
214
  if (!byGroup[gi].length) return;
173
215
  rows.push({ key: "g" + gi, cls: "group", group: true, cells: [esc(g[0]) + "<span class='badge'>" + byGroup[gi].length + "</span>"] });
174
216
  for (const l of byGroup[gi]) {
175
- const { info, cells } = loopCells(l, d);
176
- rows.push({ key: "l:" + l.role, role: l.role, cls: "loop clickable" + (info.live ? " live" : "") + (selected === l.role ? " selected" : ""), cells });
217
+ const { info, cells } = roleCells(l, d);
218
+ rows.push({ key: "l:" + l.role, role: l.role, cls: "role-row clickable" + (info.live ? " live" : "") + (selected === l.role ? " selected" : ""), cells });
177
219
  }
178
220
  });
179
- if (!rows.length) rows.push({ key: "empty", cls: "group", group: true, cells: ["No loops are enabled in tumwater.json"] });
180
- patchLoops(rows);
221
+ if (!rows.length) rows.push({ key: "empty", cls: "group", group: true, cells: ["No roles are enabled in tumwater.json"] });
222
+ patchRoles(rows);
181
223
  }
182
- $("loops").addEventListener("click", (ev) => {
224
+ $("rolerows").addEventListener("click", (ev) => {
183
225
  const b = clickClosest(ev, "button.rowaction");
184
226
  if (b) { ev.preventDefault(); rowAction(b.dataset.action, b.dataset.role, b.dataset.for === undefined ? undefined : Number(b.dataset.for)); return; }
185
227
  const tr = clickClosest(ev, "tr[data-role]");
186
- if (tr) toggleLoop(tr.dataset.role);
228
+ if (tr) toggleRole(tr.dataset.role);
187
229
  });
188
230
  $("resetall").addEventListener("click", () =>
189
231
  postAction("/api/reset-counters", {}, (d) => (d && typeof d.message === "string" ? d.message : "counters reset")));
190
232
  $("wakeall").addEventListener("click", () =>
191
- postAction("/api/wake", {}, (d) => (d && typeof d.message === "string" ? d.message : "every loop woken")));
233
+ postAction("/api/wake", {}, (d) => (d && typeof d.message === "string" ? d.message : "every role woken")));
192
234
  // wake-later:start
193
235
  const WAKE_LATER_CHOICES = [[1800, "In 30 minutes"], [3600, "In 1 hour"], [7200, "In 2 hours"], [28800, "In 8 hours"]];
194
236
  function openWakeLaterMenu() {
195
237
  openPopover("wakelaterwrap", {
196
238
  menu: true,
197
239
  role: "menu",
198
- html: "<div class='menu-title'>Wake every loop</div>" +
240
+ html: "<div class='menu-title'>Wake every role</div>" +
199
241
  WAKE_LATER_CHOICES.map((c) => "<button type='button' class='menu-item' role='menuitem' data-wakein='" + c[0] + "'>" +
200
242
  icon("clock") + esc(c[1]) + "</button>").join("") +
201
243
  "<button type='button' class='menu-item' role='menuitem' data-wakecancel='1'>" + icon("x") + "Cancel scheduled wakes</button>",
@@ -1,6 +1,7 @@
1
1
  /** The dashboard's Settings view, browser-side: the curated top-level config keys
2
2
  * (EDITABLE_CONFIG_KEYS's set, mirrored here for the labels) as label + current value +
3
- * inline field + Save + Clear, one row per key. Values load once through GET /api/config when
3
+ * inline field + Save + Clear, one row per key (the Notify row also has Send test, which
4
+ * posts to POST /api/notify-test). Values load once through GET /api/config when
4
5
  * the view is first opened — no polling loop of its own; a re-click of the tab refetches, like
5
6
  * the other views' refresh-on-open. Save posts {key, value} to POST /api/config-set — the
6
7
  * same setConfigKey write path `tumwater config set` uses — and Clear posts {key} to
@@ -9,8 +10,19 @@
9
10
  * success/error toast pattern the composer's send uses (showFlash). Spliced into
10
11
  * gui-client.ts's script, reaching its helpers (esc, $, getJson, postJson, showFlash) through
11
12
  * that concatenation. A second card, "Health check", runs the same checks as `tumwater doctor`
12
- * through GET /api/doctor on each open (and on its Re-run button) and paints the report. */
13
+ * through GET /api/doctor on each open (and on its Re-run button) and paints the report (its
14
+ * Re-probe models button POSTs /api/doctor-reprobe instead, spending the image probes); a
15
+ * third, "Disabled roles", lists every disabled role (GET /api/retire), each with an Enable
16
+ * button (POST /api/role-enable) and — for a role that still keeps worktree/branch leftovers — a
17
+ * two-click Retire button (POST /api/retire). */
13
18
  export const GUI_CLIENT_SETTINGS_JS = String.raw ` // settings-view:start
19
+ // One home for turning a thrown value into the message a flash shows: the fetch/parse/post
20
+ // helpers throw the server's JSON-decoded value, which for the server's own errors is an
21
+ // {error} object (its message on the .message field) — the three Save/Clear/Brief catch
22
+ // blocks that flash the outcome share this coercion so the wording cannot drift.
23
+ function clientErrorMessage(err) {
24
+ return err && err.message ? err.message : String(err);
25
+ }
14
26
  // The curated keys, in display order: [key, label]. Mirrors the server's
15
27
  // EDITABLE_CONFIG_KEYS (src/config/config-editable-keys.ts) by hand — the settings test pins
16
28
  // this list's keys and order to that constant.
@@ -19,9 +31,14 @@ export const GUI_CLIENT_SETTINGS_JS = String.raw ` // settings-view:start
19
31
  ["model", "Model"],
20
32
  ["fallback", "Fallback (free at the spend cap)"],
21
33
  ["maxDailyCostUsd", "Daily spend cap (USD)"],
34
+ ["maxConcurrent", "Max concurrent runs"],
35
+ ["maxConcurrentPerProvider", "Provider concurrency caps (JSON)"],
36
+ ["maxConcurrentChecks", "Max concurrent checks"],
37
+ ["worktreeSlots", "Worktree slots"],
38
+ ["claudeWindowReserve", "Claude window reserve (backends.claude.windowReserve)"],
22
39
  ["quietHours", "Quiet hours"],
23
40
  ["notify", "Notify hook"],
24
- ["agents", "Agent backends (JSON)"],
41
+ ["backends", "Agent backends (JSON)"],
25
42
  ];
26
43
  // One row per key: the current value into an inline field (esc'd, like every rendered
27
44
  // value on the page), Save submits the row's form. A null (unset) key renders empty —
@@ -39,39 +56,170 @@ export const GUI_CLIENT_SETTINGS_JS = String.raw ` // settings-view:start
39
56
  "<input class='field' id='set-" + k[0] + "' value='" + esc(settingsFieldValue(d[k[0]])) + "'>" +
40
57
  "<button type='submit' class='btn btn-sm'>Save</button>" +
41
58
  "<button type='button' class='btn btn-sm rowaction' data-action='unset'>Clear</button>" +
59
+ (k[0] === "notify" ? "<button type='button' class='btn btn-sm rowaction' data-action='notify-test' title='Runs the saved hook once with a synthetic merge_failed event'>Send test</button>" : "") +
42
60
  "</form>").join("");
43
61
  }
44
62
  // The view's one panel: built once, values fetched on each open of the tab (the boot's
45
63
  // switchView calls fetchSettings) — no polling loop of its own.
46
64
  function buildSettingsView() {
47
65
  buildOnce("settings-view", "<div class='view-head'><div><h1>Settings</h1>" +
48
- "<p>The fleet-wide settings an operator edits from here; everything else lives in tumwater.json or the CLI.</p></div></div>" +
66
+ "<p>The team-wide settings you edit from here; everything else lives in tumwater.json or the CLI.</p></div></div>" +
49
67
  "<div class='card' id='settingscard'><div class='empty'>Loading…</div></div>" +
50
- "<div class='card' id='doctorcard'><div class='settings-row'><strong>Health check</strong>" +
68
+ "<div class='card' id='doctorcard'><div class='settings-row'><strong>Health</strong>" +
51
69
  "<span>The same checks as <code>tumwater doctor</code>.</span>" +
52
- "<button type='button' class='btn btn-sm' data-action='doctor-rerun'>Re-run</button></div>" +
70
+ "<label><input type='checkbox' data-action='doctor-problems'> Problems only</label>" +
71
+ "<button type='button' class='btn btn-sm' data-action='doctor-rerun'>Re-run</button>" +
72
+ "<button type='button' class='btn btn-sm' data-action='doctor-reprobe' title='Re-probe every image-input model (spends one model call each), like tumwater doctor --reprobe'>Re-probe models</button>" +
73
+ "<button type='button' class='btn btn-sm' data-action='doctor-kill-orphans'>Kill orphans</button></div>" +
53
74
  "<div id='doctorbody'><div class='empty'>Checking…</div></div></div>" +
75
+ "<div class='card' id='retirecard'><div class='empty'>Loading…</div></div>" +
54
76
  "<div class='card' id='briefcard'><div class='empty'>Loading…</div></div>");
55
77
  }
56
78
  // The Health check card's body: header, one row per check (level badge, name, detail), the
57
79
  // verdict — everything esc'd. The pill is built inline (gui-client.ts's pill sits outside
58
- // this region). A missing checks array renders no rows.
59
- function renderDoctorReport(d) {
80
+ // this region). A missing checks array renders no rows. With problems (the Problems only
81
+ // checkbox), only the warn and fail rows render and a hidden-count line names how many ok
82
+ // rows were cut, mirroring tumwater doctor --problems's problemsOnly/renderDoctorProblems.
83
+ function renderDoctorReport(d, problems) {
60
84
  const tones = { ok: "green", warn: "amber", fail: "red" };
61
- const rows = (Array.isArray(d.checks) ? d.checks : []).map((c) =>
85
+ const all = Array.isArray(d.checks) ? d.checks : [];
86
+ const checks = problems ? all.filter((c) => c.level !== "ok") : all;
87
+ const hidden = all.length - checks.length;
88
+ const rows = checks.map((c) =>
62
89
  "<div class='settings-row'><span class='pill t-" + (tones[c.level] || "amber") + "'>" + esc(c.level) + "</span>" +
63
90
  "<strong>" + esc(c.name) + "</strong><span>" + esc(c.detail) + "</span></div>").join("");
64
- return "<p>" + esc(d.header) + "</p>" + rows + "<p>" + esc(d.verdict) + "</p>";
91
+ return "<p>" + esc(d.header) + "</p>" + rows +
92
+ (problems && hidden > 0 ? "<p class='empty'>" + hidden + " " + (hidden === 1 ? "ok check" : "ok checks") + " hidden</p>" : "") +
93
+ "<p>" + esc(d.verdict) + "</p>";
65
94
  }
95
+ // The last resolved doctor report and whether the card paints only its problems; the
96
+ // Problems only checkbox toggles the latter and repaints the cached body without rerunning
97
+ // the checks.
98
+ let lastDoctor = null;
99
+ let doctorProblems = false;
66
100
  async function fetchDoctor() {
67
101
  buildSettingsView();
68
102
  const body = $("doctorbody");
69
103
  body.innerHTML = "<div class='empty'>Checking…</div>";
70
104
  try {
71
- body.innerHTML = renderDoctorReport(await getJson("/api/doctor"));
105
+ const report = await getJson("/api/doctor");
106
+ lastDoctor = report;
107
+ body.innerHTML = renderDoctorReport(report, doctorProblems);
108
+ } catch (err) {
109
+ body.innerHTML = errorPanel("Health checks could not run", err, "empty");
110
+ }
111
+ }
112
+ let doctorReprobing = false;
113
+ async function reprobeDoctorClick() {
114
+ if (doctorReprobing) return;
115
+ doctorReprobing = true;
116
+ try {
117
+ buildSettingsView();
118
+ const body = $("doctorbody");
119
+ body.innerHTML = "<div class='empty'>Re-probing…</div>";
120
+ showFlash("Re-probing image-input models…");
121
+ try {
122
+ const report = await postJson("/api/doctor-reprobe", {});
123
+ lastDoctor = report;
124
+ body.innerHTML = renderDoctorReport(report, doctorProblems);
125
+ } catch (err) {
126
+ body.innerHTML = errorPanel("Health checks could not run", err, "empty");
127
+ showFlash("error: " + clientErrorMessage(err));
128
+ }
129
+ } finally {
130
+ doctorReprobing = false;
131
+ }
132
+ }
133
+ function toggleDoctorProblems(checked) {
134
+ doctorProblems = checked;
135
+ const body = $("doctorbody");
136
+ if (lastDoctor !== null) body.innerHTML = renderDoctorReport(lastDoctor, doctorProblems);
137
+ }
138
+ // The Disabled roles card: every role set to enabled: false (GET /api/retire), each with an
139
+ // Enable button (POST /api/role-enable) and — for a role that still keeps a worktree, branch,
140
+ // merge ref, or paused marker — a two-click Retire button (POST /api/retire), the same removal
141
+ // as tumwater retire --role <id>. A role the safety rails object to shows the objections and
142
+ // the CLI's --force command instead: the dashboard never forces.
143
+ let lastRetirable = null;
144
+ const retireSlot = confirmSlot(paintRetirable);
145
+ function renderRetirable(d, armed) {
146
+ const rows = (d.roles || []).map((r) => {
147
+ const hasLeftovers = (r.wouldRemove || []).length > 0;
148
+ const head = "<strong>" + esc(r.role) + "</strong>" +
149
+ (hasLeftovers ? "<span>would remove " + r.phrases.map(esc).join(", ") + "</span>" : "<span>no leftovers to remove</span>") +
150
+ "<button type='button' class='btn btn-sm' data-action='enable' data-role='" + esc(r.role) + "'>Enable</button>";
151
+ if (r.objections.length > 0) {
152
+ return "<div class='settings-row'>" + head + r.objections.map((o) => "<span>" + esc(o) + "</span>").join("") +
153
+ "<code>tumwater retire --role " + esc(r.role) + " --force</code></div>";
154
+ }
155
+ const retireBtn = hasLeftovers ? "<button type='button' class='btn btn-sm' data-action='retire' data-role='" + esc(r.role) + "'>" +
156
+ (armed(r.role) ? "Confirm retire" : "Retire") + "</button>" : "";
157
+ return "<div class='settings-row'>" + head + retireBtn + "</div>";
158
+ }).join("");
159
+ return "<div class='settings-row'><strong>Disabled roles</strong><span>Roles set to enabled: false — re-enable one, or remove the leftovers " +
160
+ "the same way <code>tumwater retire --role &lt;id&gt;</code> does.</span></div>" +
161
+ (rows || "<div class='empty'>No role is disabled.</div>");
162
+ }
163
+ function paintRetirable() {
164
+ if (lastRetirable) $("retirecard").innerHTML = renderRetirable(lastRetirable, retireSlot.armed);
165
+ }
166
+ async function fetchRetirable() {
167
+ buildSettingsView();
168
+ try {
169
+ lastRetirable = await getJson("/api/retire");
170
+ paintRetirable();
171
+ } catch (err) {
172
+ $("retirecard").innerHTML = errorPanel("Disabled roles could not load", err, "empty");
173
+ }
174
+ }
175
+ // The row's Enable button: re-enable the role through POST /api/role-enable (writing
176
+ // roles.<base>.enabled), flash the server's message, and refetch so the card drops the row.
177
+ async function enableRole(role) {
178
+ try {
179
+ const d = await postJson("/api/role-enable", { role: role });
180
+ showFlash(d.message);
181
+ } catch (err) {
182
+ showFlash("error: " + clientErrorMessage(err));
183
+ }
184
+ await fetchRetirable();
185
+ }
186
+ // First click arms the role's button; a second within the confirm window posts the retire.
187
+ async function confirmRetire(role) {
188
+ if (!retireSlot.armed(role)) {
189
+ retireSlot.arm(role);
190
+ return;
191
+ }
192
+ retireSlot.disarm();
193
+ try {
194
+ const d = await postJson("/api/retire", { role: role });
195
+ showFlash(d.message);
196
+ } catch (err) {
197
+ showFlash("error: " + clientErrorMessage(err));
198
+ }
199
+ await fetchRetirable();
200
+ }
201
+ // The Health card's Kill orphans button: a two-click confirm, then POST /api/kill-orphans runs
202
+ // the same kill as "tumwater doctor --kill-orphans" and the card re-runs its checks.
203
+ function paintKillButton() {
204
+ const btn = document.querySelector("button[data-action='doctor-kill-orphans']");
205
+ if (btn) btn.textContent = killSlot.armed("orphans") ? "Confirm kill" : "Kill orphans";
206
+ }
207
+ const killSlot = confirmSlot(paintKillButton);
208
+ async function killOrphansClick() {
209
+ if (!killSlot.armed("orphans")) {
210
+ killSlot.arm("orphans");
211
+ return;
212
+ }
213
+ killSlot.disarm();
214
+ paintKillButton();
215
+ showFlash("Killing orphaned processes…");
216
+ try {
217
+ const d = await postJson("/api/kill-orphans", {});
218
+ showFlash((d.ok ? "" : "error: ") + d.message);
72
219
  } catch (err) {
73
- body.innerHTML = errorPanel("Health check could not run", err, "empty");
220
+ showFlash("error: " + clientErrorMessage(err));
74
221
  }
222
+ await fetchDoctor();
75
223
  }
76
224
  async function fetchSettings() {
77
225
  buildSettingsView();
@@ -100,9 +248,10 @@ export const GUI_CLIENT_SETTINGS_JS = String.raw ` // settings-view:start
100
248
  try { value = JSON.parse(input.value); } catch { value = input.value; }
101
249
  try {
102
250
  const d = await postJson("/api/config-set", { key: key, value: value });
103
- showFlash(d && d.oldValue === null ? "Saved " + key + " (was unset)" : "Saved " + key);
251
+ if (d && d.unchanged) showFlash(key + " is already that value — nothing saved");
252
+ else showFlash(d && d.oldValue === null ? "Saved " + key + " (was unset)" : "Saved " + key);
104
253
  } catch (err) {
105
- showFlash("error: " + (err && err.message ? err.message : String(err)));
254
+ showFlash("error: " + clientErrorMessage(err));
106
255
  }
107
256
  }
108
257
  // The row's Clear button: retract the key through /api/config-unset, then refetch so the
@@ -116,10 +265,21 @@ export const GUI_CLIENT_SETTINGS_JS = String.raw ` // settings-view:start
116
265
  showFlash(d && d.oldValue !== undefined ? "Unset " + key + " (was " + JSON.stringify(d.oldValue) + ")" : "Nothing to unset for " + key + " — it was already the default");
117
266
  await fetchSettings();
118
267
  } catch (err) {
119
- showFlash("error: " + (err && err.message ? err.message : String(err)));
268
+ showFlash("error: " + clientErrorMessage(err));
269
+ }
270
+ }
271
+ // The Notify row's Send test button: POST /api/notify-test runs the saved hook once, the same
272
+ // test that "tumwater notify --test" runs. The hook can take up to 10 s, so say so first.
273
+ async function testNotify() {
274
+ showFlash("Sending a test notification…");
275
+ try {
276
+ const d = await postJson("/api/notify-test", {});
277
+ showFlash((d.passed ? "" : "error: ") + d.message);
278
+ } catch (err) {
279
+ showFlash("error: " + clientErrorMessage(err));
120
280
  }
121
281
  }
122
- // The Initial prompt card: the brief file's name and the prompt in a textarea, filled from
282
+ // The Brief card: the brief file's name and the prompt in a textarea, filled from
123
283
  // GET /api/brief on each open. The form is deliberately not a settings-row, so the boot's
124
284
  // delegated settings submit listener never routes it to saveSetting.
125
285
  async function fetchBrief() {
@@ -127,11 +287,11 @@ export const GUI_CLIENT_SETTINGS_JS = String.raw ` // settings-view:start
127
287
  const card = $("briefcard");
128
288
  try {
129
289
  const d = await getJson("/api/brief");
130
- card.innerHTML = "<form class='brief-form'><strong>Initial prompt</strong> <span class='settings-key'>" + esc(d.file) + "</span>" +
290
+ card.innerHTML = "<form class='brief-form'><strong>Brief</strong> <span class='settings-key'>" + esc(d.file) + "</span>" +
131
291
  "<textarea class='field' id='brief-text' rows='12'>" + esc(d.prompt) + "</textarea>" +
132
292
  "<button type='submit' class='btn btn-sm'>Save</button></form>";
133
293
  } catch (err) {
134
- card.innerHTML = errorPanel("Initial prompt could not load", err, "empty");
294
+ card.innerHTML = errorPanel("Brief could not load", err, "empty");
135
295
  }
136
296
  }
137
297
  // Save posts the textarea's text to POST /api/brief — the same checks and commit as
@@ -139,9 +299,9 @@ export const GUI_CLIENT_SETTINGS_JS = String.raw ` // settings-view:start
139
299
  async function saveBrief(form) {
140
300
  try {
141
301
  const d = await postJson("/api/brief", { prompt: form.querySelector("textarea").value });
142
- showFlash(!d.changed ? "Initial prompt unchanged" : d.committed ? "Initial prompt saved (committed to main)" : "Initial prompt saved");
302
+ showFlash(!d.changed ? "Brief unchanged" : d.committed ? "Brief saved (committed to main)" : "Brief saved");
143
303
  } catch (err) {
144
- showFlash("error: " + (err && err.message ? err.message : String(err)));
304
+ showFlash("error: " + clientErrorMessage(err));
145
305
  }
146
306
  }
147
307
  // settings-view:end