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.
- package/README.md +77 -28
- package/dist/build-info.json +2 -2
- package/dist/src/agent/agent-args.js +23 -0
- package/dist/src/agent/agent-backend.js +9 -7
- package/dist/src/agent/backend-traits.js +77 -0
- package/dist/src/agent/claude/claude-account.js +81 -161
- package/dist/src/agent/claude/claude-args.js +19 -19
- package/dist/src/agent/claude/claude-backend.js +58 -48
- package/dist/src/agent/claude/claude-env.js +7 -3
- package/dist/src/agent/claude/claude-stream.js +11 -19
- package/dist/src/agent/claude/claude-write-guard.js +49 -0
- package/dist/src/agent/claude/write-guard-hook.js +13 -0
- package/dist/src/agent/codex/codex-account.js +119 -0
- package/dist/src/agent/codex/codex-args.js +181 -0
- package/dist/src/agent/codex/codex-backend.js +279 -0
- package/dist/src/agent/codex/codex-catalog.js +97 -0
- package/dist/src/agent/codex/codex-env.js +18 -0
- package/dist/src/agent/codex/codex-hook-trust.js +246 -0
- package/dist/src/agent/codex/codex-patch-paths.js +36 -0
- package/dist/src/agent/codex/codex-rollout.js +179 -0
- package/dist/src/agent/codex/codex-stream.js +402 -0
- package/dist/src/agent/codex/codex-write-guard.js +86 -0
- package/dist/src/agent/codex/write-guard-hook.js +12 -0
- package/dist/src/agent/image-input.js +112 -0
- package/dist/src/agent/notes-shim.js +40 -0
- package/dist/src/agent/opencode/opencode-args.js +60 -0
- package/dist/src/agent/opencode/opencode-backend.js +258 -0
- package/dist/src/agent/opencode/opencode-catalog.js +210 -0
- package/dist/src/agent/opencode/opencode-config.js +193 -0
- package/dist/src/agent/opencode/opencode-env.js +35 -0
- package/dist/src/agent/opencode/opencode-session-id.js +36 -0
- package/dist/src/agent/opencode/opencode-stream.js +278 -0
- package/dist/src/agent/opencode/write-guard-plugin/index.js +48 -0
- package/dist/src/agent/role-notes-write.js +16 -33
- package/dist/src/agent/run-agent.js +475 -381
- package/dist/src/agent/run-settle.js +214 -0
- package/dist/src/agent/session-ledger.js +142 -16
- package/dist/src/agent/subscription-account.js +220 -0
- package/dist/src/agent/write-guard.js +148 -0
- package/dist/src/backlog/backlog-archive.js +487 -0
- package/dist/src/backlog/backlog-cli-view.js +280 -0
- package/dist/src/backlog/backlog-cli.js +384 -0
- package/dist/src/backlog/backlog-commit.js +4 -5
- package/dist/src/backlog/backlog-eligibility.js +354 -132
- package/dist/src/backlog/backlog-index.js +149 -0
- package/dist/src/backlog/backlog-md.js +132 -22
- package/dist/src/backlog/backlog-parts.js +254 -0
- package/dist/src/backlog/backlog-release.js +117 -0
- package/dist/src/backlog/backlog-render.js +89 -11
- package/dist/src/backlog/backlog-structure.js +271 -125
- package/dist/src/backlog/backlog-write.js +121 -471
- package/dist/src/backlog/backlog.js +129 -17
- package/dist/src/backlog/question-answer.js +345 -0
- package/dist/src/baseline/main-baseline.js +157 -101
- package/dist/src/baseline/main-culprit.js +94 -0
- package/dist/src/baseline/main-guardrails.js +209 -0
- package/dist/src/baseline/main-red.js +164 -55
- package/dist/src/baseline/main-revert.js +133 -0
- package/dist/src/baseline/main-watch.js +184 -0
- package/dist/src/brief/brief-edit.js +41 -0
- package/dist/src/{brief.js → brief/brief.js} +38 -33
- package/dist/src/budget/budget.js +55 -28
- package/dist/src/budget/fallback-breaker.js +31 -31
- package/dist/src/build/build-check-detect.js +25 -16
- package/dist/src/build/build-check-events.js +87 -22
- package/dist/src/build/build-check-report.js +66 -27
- package/dist/src/build/build-check-scoped.js +64 -68
- package/dist/src/build/build-check.js +17 -15
- package/dist/src/build/build-info.js +3 -3
- package/dist/src/build/build-stage.js +31 -35
- package/dist/src/build/dep-install.js +21 -21
- package/dist/src/build/host-sleep.js +1 -1
- package/dist/src/change/change-data.js +131 -37
- package/dist/src/change/change-render.js +56 -14
- package/dist/src/cli/brief-command.js +9 -8
- package/dist/src/cli/cli-args.js +133 -28
- package/dist/src/cli/cli-command-args.js +82 -21
- package/dist/src/cli/cli-editor.js +15 -2
- package/dist/src/cli/cli-flag-specs.js +180 -50
- package/dist/src/cli/cli-init.js +51 -0
- package/dist/src/cli/cli-marker-commands.js +14 -11
- package/dist/src/cli/cli-query-commands.js +325 -224
- package/dist/src/cli/cli-repo-gate.js +12 -2
- package/dist/src/cli/cli-role-command.js +420 -0
- package/dist/src/cli/cli-start-summary.js +160 -0
- package/dist/src/cli/cli-start.js +453 -0
- package/dist/src/cli/completion.js +202 -17
- package/dist/src/cli/config-commands.js +51 -25
- package/dist/src/cli/follow-view.js +75 -0
- package/dist/src/cli/help.js +413 -157
- package/dist/src/cli/log-commands.js +234 -62
- package/dist/src/cli/notify-command.js +33 -18
- package/dist/src/cli/question-commands.js +215 -231
- package/dist/src/cli.js +154 -49
- package/dist/src/collections.js +84 -18
- package/dist/src/concurrency/check-permit.js +35 -19
- package/dist/src/concurrency/lock.js +22 -17
- package/dist/src/concurrency/provider-lease.js +105 -0
- package/dist/src/concurrency/semaphore.js +344 -46
- package/dist/src/config/config-aliases.js +105 -0
- package/dist/src/config/config-editable-keys.js +16 -4
- package/dist/src/config/config-fallbacks.js +416 -0
- package/dist/src/config/config-field-checks.js +58 -19
- package/dist/src/config/config-keys.js +182 -0
- package/dist/src/config/config-live.js +113 -22
- package/dist/src/config/config-request.js +137 -0
- package/dist/src/config/config-schema.js +58 -39
- package/dist/src/config/config-selector-checks.js +123 -0
- package/dist/src/config/config-validation-agents.js +80 -0
- package/dist/src/config/config-validation-model.js +116 -0
- package/dist/src/config/config-validation.js +201 -175
- package/dist/src/config/config-views.js +202 -346
- package/dist/src/config/config-write-core.js +135 -0
- package/dist/src/config/config-write.js +219 -391
- package/dist/src/config/config.js +102 -81
- package/dist/src/config/model-selector.js +44 -18
- package/dist/src/doctor/doctor-backlog-bugs.js +287 -0
- package/dist/src/doctor/doctor-backlog-plans.js +263 -0
- package/dist/src/doctor/doctor-backlog.js +191 -161
- package/dist/src/doctor/doctor-check-names.js +81 -0
- package/dist/src/doctor/doctor-checks.js +229 -305
- package/dist/src/doctor/doctor-claude-checks.js +145 -0
- package/dist/src/doctor/doctor-codex-checks.js +279 -0
- package/dist/src/doctor/doctor-contention-checks.js +380 -0
- package/dist/src/doctor/doctor-holds.js +181 -104
- package/dist/src/doctor/doctor-install.js +31 -0
- package/dist/src/doctor/doctor-launch-services.js +2 -2
- package/dist/src/doctor/doctor-model-checks.js +496 -270
- package/dist/src/doctor/doctor-notify.js +5 -7
- package/dist/src/doctor/doctor-opencode-checks.js +162 -0
- package/dist/src/doctor/doctor-orphans.js +189 -69
- package/dist/src/doctor/doctor-project-checks.js +303 -0
- package/dist/src/doctor/doctor-render.js +36 -9
- package/dist/src/doctor/doctor.js +145 -50
- package/dist/src/doctor/image-probe.js +257 -0
- package/dist/src/doctor/outcome.js +3 -2
- package/dist/src/doctor/probe.js +60 -0
- package/dist/src/events/event-format.js +363 -155
- package/dist/src/events/event-labels.js +123 -0
- package/dist/src/events/event-legacy.js +164 -0
- package/dist/src/events/event-read.js +74 -38
- package/dist/src/events/event-tally.js +16 -0
- package/dist/src/events/event-window.js +83 -27
- package/dist/src/events/events.js +47 -26
- package/dist/src/events/notify.js +85 -35
- package/dist/src/failure/failure-cluster.js +23 -20
- package/dist/src/failure/failure-data.js +140 -92
- package/dist/src/failure/failure-render.js +97 -78
- package/dist/src/failure/failure-state-change.js +45 -33
- package/dist/src/failure/time-spend.js +166 -82
- package/dist/src/files/file-queue.js +16 -4
- package/dist/src/files/files.js +129 -41
- package/dist/src/files/json-files.js +3 -3
- package/dist/src/files/json-object.js +45 -9
- package/dist/src/files/stat-cache.js +2 -2
- package/dist/src/files/tail.js +2 -2
- package/dist/src/gates/bootstrap-gates.js +8 -8
- package/dist/src/gates/budget-gates.js +361 -52
- package/dist/src/gates/disk-gate.js +18 -18
- package/dist/src/gates/gate-polls.js +201 -103
- package/dist/src/gates/maintenance-quota.js +34 -37
- package/dist/src/gates/pause-gates.js +33 -15
- package/dist/src/gates/readiness.js +8 -3
- package/dist/src/gates/role-cap-gates.js +23 -28
- package/dist/src/gates/startup-gate.js +154 -48
- package/dist/src/gates/streak-gate.js +67 -41
- package/dist/src/git/commit-message.js +80 -48
- package/dist/src/git/git-diff.js +29 -23
- package/dist/src/git/git-run.js +87 -46
- package/dist/src/git/git.js +114 -92
- package/dist/src/git/slot-salvage.js +253 -0
- package/dist/src/git/slots-state.js +18 -9
- package/dist/src/git/worktree-pool.js +150 -49
- package/dist/src/git/worktree-use.js +14 -20
- package/dist/src/git/worktree.js +108 -51
- package/dist/src/gui/gui-admin-endpoints.js +96 -0
- package/dist/src/gui/gui-args.js +88 -21
- package/dist/src/gui/gui-backlog-commands.js +297 -0
- package/dist/src/gui/gui-backlog-endpoints.js +155 -0
- package/dist/src/gui/gui-command.js +9 -14
- package/dist/src/gui/gui-config-commands.js +462 -0
- package/dist/src/gui/gui-endpoint-commands.js +17 -716
- package/dist/src/gui/gui-endpoint-common.js +49 -0
- package/dist/src/gui/gui-endpoints.js +13 -331
- package/dist/src/gui/gui-history-endpoints.js +301 -0
- package/dist/src/gui/gui-operator-commands.js +240 -0
- package/dist/src/gui/gui-prompt-commands.js +231 -0
- package/dist/src/gui/gui-report-endpoints.js +90 -0
- package/dist/src/gui/gui-server.js +33 -9
- package/dist/src/gui/gui-team-commands.js +164 -0
- package/dist/src/gui/http-body.js +17 -1
- package/dist/src/history/history-data.js +166 -203
- package/dist/src/history/history-queued.js +147 -0
- package/dist/src/history/history-render.js +96 -0
- package/dist/src/history/history.js +206 -103
- package/dist/src/inbox/inbox-attachments.js +94 -39
- package/dist/src/inbox/inbox-cancel.js +16 -15
- package/dist/src/inbox/inbox-edit.js +10 -10
- package/dist/src/inbox/inbox-submit.js +54 -14
- package/dist/src/inbox/inbox-top.js +99 -0
- package/dist/src/inbox/inbox.js +49 -44
- package/dist/src/inbox/pending-prompt.js +27 -27
- package/dist/src/inbox/prompt-commands.js +154 -100
- package/dist/src/inbox/prompt-not-before.js +2 -2
- package/dist/src/init/init-templates.js +15 -14
- package/dist/src/init/init.js +35 -29
- package/dist/src/merge/backlog-conflicts.js +335 -0
- package/dist/src/{landing/landing-batch.js → merge/merge-batch.js} +100 -93
- package/dist/src/merge/merge-cancel.js +53 -0
- package/dist/src/merge/merge-check-failures.js +209 -0
- package/dist/src/{landing/landing-core.js → merge/merge-core.js} +183 -110
- package/dist/src/{landing/landing-diff.js → merge/merge-diff.js} +6 -5
- package/dist/src/merge/merge-drain.js +351 -0
- package/dist/src/merge/merge-git.js +403 -0
- package/dist/src/merge/merge-pipeline.js +111 -0
- package/dist/src/merge/merge-post-review.js +90 -0
- package/dist/src/{landing/landing-questions.js → merge/merge-questions.js} +9 -6
- package/dist/src/merge/merge-queue-render.js +113 -0
- package/dist/src/merge/merge-queue.js +224 -0
- package/dist/src/merge/merge-requeue.js +102 -0
- package/dist/src/merge/merge-slot.js +385 -0
- package/dist/src/{landing/landing-stack.js → merge/merge-stack.js} +97 -71
- package/dist/src/{landing/landing-merge.js → merge/merge-to-main.js} +151 -82
- package/dist/src/merge/merge-top.js +69 -0
- package/dist/src/merge/merge-verify.js +214 -0
- package/dist/src/notes-cli.js +112 -0
- package/dist/src/operator/operator-commands.js +268 -89
- package/dist/src/operator/operator-intent.js +130 -82
- package/dist/src/operator/operator-requests.js +82 -87
- package/dist/src/operator/retire.js +49 -31
- package/dist/src/operator/revert.js +179 -0
- package/dist/src/orchestrator/orchestrator-launch.js +116 -48
- package/dist/src/orchestrator/orchestrator-poll.js +320 -0
- package/dist/src/orchestrator/orchestrator-scheduling.js +78 -348
- package/dist/src/orchestrator/orchestrator.js +173 -361
- package/dist/src/orchestrator/retention.js +66 -15
- package/dist/src/orchestrator/scheduling-admit.js +116 -0
- package/dist/src/orchestrator/scheduling-scope.js +201 -0
- package/dist/src/orchestrator/scheduling-skip.js +185 -0
- package/dist/src/orchestrator/startup-migration-steps.js +52 -0
- package/dist/src/orchestrator/startup-migrations.js +44 -0
- package/dist/src/paths.js +228 -75
- package/dist/src/pi/command-shape.js +12 -1
- package/dist/src/pi/pi-args.js +30 -5
- package/dist/src/pi/pi-backend.js +19 -27
- package/dist/src/pi/pi-bin.js +64 -67
- package/dist/src/pi/pi-event-line.js +17 -1
- package/dist/src/pi/pi-failure.js +87 -0
- package/dist/src/pi/pi-listed-models.js +53 -0
- package/dist/src/pi/pi-models.js +163 -42
- package/dist/src/pi/pi-run-result.js +1 -1
- package/dist/src/pi/pi-settings.js +86 -0
- package/dist/src/pi/pi-stream.js +137 -113
- package/dist/src/pi/pi-watchdogs.js +20 -20
- package/dist/src/pi-extension/bounded-output.js +25 -8
- package/dist/src/pi-extension/context-budget.js +5 -3
- package/dist/src/pi-extension/context-shake.js +54 -21
- package/dist/src/pi-extension/context-window.js +36 -0
- package/dist/src/pi-extension/full-output.js +5 -12
- package/dist/src/pi-extension/strip-thinking.js +79 -0
- package/dist/src/pi-extension/trim-system-prompt.js +37 -0
- package/dist/src/pi-extension/write-guard.js +37 -0
- package/dist/src/process/launch-services.js +11 -11
- package/dist/src/process/node-bin.js +16 -0
- package/dist/src/process/process-group.js +8 -18
- package/dist/src/process/process-table.js +1 -1
- package/dist/src/process/process.js +48 -9
- package/dist/src/process/run-marker.js +42 -7
- package/dist/src/process/supervisor.js +47 -35
- package/dist/src/prompt/dialect.js +46 -11
- package/dist/src/prompt/gate-notes.js +203 -0
- package/dist/src/prompt/gate-prompts.js +201 -188
- package/dist/src/prompt/notes-backlog.js +181 -0
- package/dist/src/prompt/principles.js +1 -1
- package/dist/src/prompt/prompt-followup.js +43 -29
- package/dist/src/prompt/prompt.js +255 -172
- package/dist/src/redeploy/redeploy-policy.js +29 -24
- package/dist/src/redeploy/redeploy-probes.js +1 -1
- package/dist/src/redeploy/redeploy.js +7 -6
- package/dist/src/redeploy/redeployer.js +78 -70
- package/dist/src/redeploy/self-reload.js +3 -2
- package/dist/src/report/report-data.js +374 -285
- package/dist/src/report/report-fold.js +430 -0
- package/dist/src/report/report-main-red.js +55 -0
- package/dist/src/report/report-render.js +321 -61
- package/dist/src/report/report-types.js +1 -0
- package/dist/src/report/report.js +26 -9
- package/dist/src/request-timeouts.js +2 -2
- package/dist/src/review/known-flakes.js +133 -14
- package/dist/src/review/post-merge-review.js +106 -0
- package/dist/src/review/protected-edits.js +7 -7
- package/dist/src/review/review-followup.js +21 -9
- package/dist/src/review/review-precheck.js +77 -33
- package/dist/src/review/review-run.js +395 -0
- package/dist/src/review/review-verdict.js +16 -2
- package/dist/src/review/review.js +172 -356
- package/dist/src/review/secret-leaks.js +147 -0
- package/dist/src/review/suite-rerun.js +3 -3
- package/dist/src/roles/legacy-role-ids.js +21 -0
- package/dist/src/roles/legacy-role-migration.js +135 -0
- package/dist/src/roles/role-catalog.js +172 -137
- package/dist/src/roles/role-guidance.js +112 -44
- package/dist/src/roles/role-labels.js +9 -0
- package/dist/src/roles/role-render.js +221 -28
- package/dist/src/roles/role-view.js +244 -33
- package/dist/src/roles/roles.js +37 -35
- package/dist/src/roles/runner-ids.js +97 -0
- package/dist/src/run/acceptance-greps.js +119 -0
- package/dist/src/run/feedback-filings.js +51 -0
- package/dist/src/{tick → run}/qa-coverage.js +10 -27
- package/dist/src/{tick/tick-apply.js → run/run-apply.js} +166 -136
- package/dist/src/run/run-detail-data.js +179 -0
- package/dist/src/run/run-detail-render.js +98 -0
- package/dist/src/run/run-detail.js +168 -0
- package/dist/src/run/run-finalize.js +154 -0
- package/dist/src/{tick/tick-outcome.js → run/run-outcome.js} +6 -6
- package/dist/src/run/run-prompt.js +304 -0
- package/dist/src/{tick/tick-resume.js → run/run-resume.js} +80 -35
- package/dist/src/run/run-stage.js +295 -0
- package/dist/src/run/run-timing.js +198 -0
- package/dist/src/run/run-usage.js +180 -0
- package/dist/src/run/run-verdict.js +301 -0
- package/dist/src/run/selfcheck-digest.js +40 -0
- package/dist/src/run/stage-backlog-checks.js +249 -0
- package/dist/src/run/stage-check.js +172 -0
- package/dist/src/run/stage-path-checks.js +730 -0
- package/dist/src/runner/leftover.js +185 -0
- package/dist/src/{loop → runner}/model-fallback.js +13 -12
- package/dist/src/runner/revision.js +202 -0
- package/dist/src/{loop/loop-fallback.js → runner/runner-fallback.js} +10 -10
- package/dist/src/runner/runner-outcome.js +107 -0
- package/dist/src/runner/runner-pi.js +433 -0
- package/dist/src/{loop/loop-recovery.js → runner/runner-recovery.js} +34 -28
- package/dist/src/runner/runner-run.js +625 -0
- package/dist/src/runner/runner-state-load.js +268 -0
- package/dist/src/runner/runner-state.js +102 -0
- package/dist/src/runner/runner.js +350 -0
- package/dist/src/scheduling/backoff.js +64 -54
- package/dist/src/scheduling/claims.js +46 -26
- package/dist/src/scheduling/once-round.js +30 -30
- package/dist/src/scheduling/quiet-hours.js +26 -34
- package/dist/src/scheduling/scheduling.js +87 -74
- package/dist/src/scheduling/{work-landed-cache.js → work-merged-cache.js} +14 -14
- package/dist/src/status/status-budget.js +123 -0
- package/dist/src/status/status-data.js +106 -191
- package/dist/src/status/status-inbox.js +47 -0
- package/dist/src/status/status-install.js +26 -0
- package/dist/src/status/status-polls.js +70 -59
- package/dist/src/status/status-roles.js +131 -0
- package/dist/src/{fleet → team}/error-storm.js +16 -16
- package/dist/src/{fleet → team}/failure-spread.js +10 -10
- package/dist/src/{fleet → team}/orchestrator-info.js +97 -25
- package/dist/src/{fleet → team}/reclaim.js +9 -9
- package/dist/src/{fleet/fleet-hold.js → team/team-hold.js} +60 -26
- package/dist/src/team/team-polls.js +299 -0
- package/dist/src/{fleet/fleet-state.js → team/team-state.js} +47 -40
- package/dist/src/text/datetime.js +102 -16
- package/dist/src/text/format.js +49 -3
- package/dist/src/text/markdown.js +8 -5
- package/dist/src/text/phrases.js +89 -54
- package/dist/src/text/suggest.js +3 -2
- package/dist/src/text/text.js +68 -14
- package/dist/src/ui/badges.js +165 -93
- package/dist/src/ui/gui/gui-client-backlog.js +292 -0
- package/dist/src/ui/gui/gui-client-boot.js +221 -42
- package/dist/src/ui/gui/gui-client-composer.js +105 -27
- package/dist/src/ui/gui/gui-client-drawer-config.js +212 -0
- package/dist/src/ui/gui/gui-client-drawer.js +226 -130
- package/dist/src/ui/gui/gui-client-feed.js +271 -0
- package/dist/src/ui/gui/gui-client-history.js +492 -68
- package/dist/src/ui/gui/gui-client-labels.js +23 -0
- package/dist/src/ui/gui/gui-client-markdown.js +1 -1
- package/dist/src/ui/gui/gui-client-model.js +84 -76
- package/dist/src/ui/gui/gui-client-operator.js +112 -78
- package/dist/src/ui/gui/gui-client-pending.js +248 -41
- package/dist/src/ui/gui/gui-client-report-chart.js +464 -0
- package/dist/src/ui/gui/gui-client-report.js +122 -179
- package/dist/src/ui/gui/{gui-client-loops.js → gui-client-roles.js} +118 -76
- package/dist/src/ui/gui/gui-client-settings.js +180 -20
- package/dist/src/ui/gui/gui-client-team.js +252 -0
- package/dist/src/ui/gui/gui-client.js +48 -40
- package/dist/src/ui/gui/gui-icons.js +0 -2
- package/dist/src/ui/gui/gui-page.js +25 -24
- package/dist/src/ui/gui/gui-styles.js +46 -38
- package/dist/src/ui/progress-data.js +11 -11
- package/dist/src/ui/{tick-progress-model.js → run-progress-model.js} +40 -40
- package/dist/src/ui/status-model.js +276 -194
- package/dist/src/ui/status-payload.js +227 -62
- package/dist/src/ui/status-render.js +196 -108
- package/dist/src/ui/team-alerts.js +532 -0
- package/dist/src/ui/tone.js +11 -11
- package/dist/src/ui/transcript-run.js +58 -0
- package/dist/src/ui/transcript-tail.js +28 -19
- package/dist/src/ui/transcript.js +85 -38
- package/dist/src/ui/tui/tui-backlog.js +132 -21
- package/dist/src/ui/tui/tui-editor-answer.js +93 -0
- package/dist/src/ui/tui/tui-editor-attach.js +105 -0
- package/dist/src/ui/tui/tui-editor-backends.js +132 -0
- package/dist/src/ui/tui/tui-editor-brief.js +105 -0
- package/dist/src/ui/tui/tui-editor-budget.js +159 -0
- package/dist/src/ui/tui/tui-editor-claude-reserve.js +24 -0
- package/dist/src/ui/tui/tui-editor-concurrency.js +24 -0
- package/dist/src/ui/tui/tui-editor-config.js +86 -0
- package/dist/src/ui/tui/tui-editor-ctx.js +1 -0
- package/dist/src/ui/tui/tui-editor-entry.js +219 -0
- package/dist/src/ui/tui/tui-editor-fallback.js +31 -0
- package/dist/src/ui/tui/tui-editor-instances.js +37 -0
- package/dist/src/ui/tui/tui-editor-instructions.js +136 -0
- package/dist/src/ui/tui/tui-editor-interval.js +124 -0
- package/dist/src/ui/tui/tui-editor-model.js +29 -0
- package/dist/src/ui/tui/tui-editor-notes.js +112 -0
- package/dist/src/ui/tui/tui-editor-notify.js +25 -0
- package/dist/src/ui/tui/tui-editor-pause.js +255 -0
- package/dist/src/ui/tui/tui-editor-prompt.js +90 -0
- package/dist/src/ui/tui/tui-editor-provider-caps.js +27 -0
- package/dist/src/ui/tui/tui-editor-queued.js +94 -0
- package/dist/src/ui/tui/tui-editor-quiet.js +170 -0
- package/dist/src/ui/tui/tui-editor-retire.js +81 -0
- package/dist/src/ui/tui/tui-editor-role-key.js +76 -0
- package/dist/src/ui/tui/tui-editor-role-model.js +28 -0
- package/dist/src/ui/tui/tui-editor-search.js +85 -0
- package/dist/src/ui/tui/tui-editor-session.js +123 -0
- package/dist/src/ui/tui/tui-editor-slots.js +23 -0
- package/dist/src/ui/tui/tui-editors.js +185 -0
- package/dist/src/ui/tui/tui-frame.js +107 -58
- package/dist/src/ui/tui/tui-history.js +16 -12
- package/dist/src/ui/tui/tui-input.js +56 -60
- package/dist/src/ui/tui/tui-keys.js +106 -1825
- package/dist/src/ui/tui/tui-pane-activity.js +102 -0
- package/dist/src/ui/tui/tui-pane-backlog.js +269 -0
- package/dist/src/ui/tui/tui-pane-brief.js +29 -0
- package/dist/src/ui/tui/tui-pane-ctx.js +11 -0
- package/dist/src/ui/tui/tui-pane-health.js +174 -0
- package/dist/src/ui/tui/tui-pane-history.js +636 -0
- package/dist/src/ui/tui/tui-pane-pending.js +369 -0
- package/dist/src/ui/tui/tui-pane-queued.js +159 -0
- package/dist/src/ui/tui/tui-pane-report.js +154 -0
- package/dist/src/ui/tui/tui-pane-session.js +120 -0
- package/dist/src/ui/tui/tui-pane-transcript.js +224 -0
- package/dist/src/ui/tui/tui-pane.js +125 -44
- package/dist/src/ui/tui/tui-panes.js +364 -0
- package/dist/src/ui/tui/tui.js +52 -34
- package/dist/src/verdict/fix-claim.js +135 -62
- package/dist/src/verdict/no-change.js +19 -0
- package/dist/src/verdict/refusal.js +80 -24
- package/dist/src/verdict/reply-contract.js +51 -28
- package/dist/src/version.js +2 -2
- package/package.json +5 -2
- package/dist/src/agent/mcp/role-notes-server.js +0 -160
- package/dist/src/brief-edit.js +0 -42
- package/dist/src/cli/cli-run.js +0 -469
- package/dist/src/fleet/fleet-polls.js +0 -207
- package/dist/src/landing/backlog-conflicts.js +0 -116
- package/dist/src/landing/landing-check-failures.js +0 -141
- package/dist/src/landing/landing-drain.js +0 -204
- package/dist/src/landing/landing-git.js +0 -190
- package/dist/src/landing/landing-pipeline.js +0 -96
- package/dist/src/landing/landing-queue-render.js +0 -56
- package/dist/src/landing/landing-queue.js +0 -149
- package/dist/src/landing/landing-slot.js +0 -256
- package/dist/src/landing/landing-vetting.js +0 -196
- package/dist/src/loop/leftover.js +0 -129
- package/dist/src/loop/loop-pi.js +0 -370
- package/dist/src/loop/loop-state.js +0 -204
- package/dist/src/loop/loop-tick.js +0 -545
- package/dist/src/loop/loop.js +0 -315
- package/dist/src/loop/revision.js +0 -61
- package/dist/src/pi-extension/role-notes.js +0 -40
- package/dist/src/roles/loop-ids.js +0 -60
- package/dist/src/tick/stage-check.js +0 -302
- package/dist/src/tick/telemetry-digest.js +0 -24
- package/dist/src/tick/tick-detail-data.js +0 -107
- package/dist/src/tick/tick-detail.js +0 -150
- package/dist/src/tick/tick-finalize.js +0 -135
- package/dist/src/tick/tick-prompt.js +0 -201
- package/dist/src/tick/tick-stage.js +0 -223
- package/dist/src/tick/tick-timing.js +0 -195
- package/dist/src/tick/tick-usage.js +0 -142
- package/dist/src/tick/tick-verdict.js +0 -201
- package/dist/src/ui/fleet-alerts.js +0 -174
- package/dist/src/ui/gui/gui-client-fleet.js +0 -576
- package/dist/src/ui/gui/gui-client-sound.js +0 -52
|
@@ -1,24 +1,48 @@
|
|
|
1
|
-
/** The dashboard's
|
|
2
|
-
* doing (working,
|
|
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.
|
|
5
|
-
* from each /api/status poll;
|
|
6
|
-
* gui-client.ts's script, reaching its helpers (esc, icon, phaseInfo,
|
|
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
|
|
9
|
-
// ----
|
|
8
|
+
export const GUI_CLIENT_ROLES_JS = String.raw `
|
|
9
|
+
// ---- roles ----
|
|
10
10
|
// row-actions:start
|
|
11
|
-
|
|
12
|
-
|
|
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
|
|
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
|
-
//
|
|
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
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
//
|
|
60
|
-
// The status pill's second line: what the phase label carried, or when an idle
|
|
61
|
-
// The future operator wakes that name this
|
|
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 + " · " : "") + "
|
|
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("
|
|
82
|
-
// A yield-scaled clock: the
|
|
83
|
-
const note = slowed ? " · slowed ×" + slowed[1] + ", nothing
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
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
|
|
130
|
+
function roleCells(l, d) {
|
|
90
131
|
const info = phaseInfo(l.phase);
|
|
91
|
-
const paused = (d.
|
|
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='
|
|
96
|
-
(l.custom ? "<span class='tag' title='A
|
|
97
|
-
(l.modelTier ? "<span class='tag' title='The
|
|
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, "
|
|
100
|
-
"</div><div class='sub'>" + esc(plural(l.commits, "commit") + " · " + plural(l.
|
|
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'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
|
|
105
|
-
// claimed before the
|
|
106
|
-
const text = l.currentWork || l.claim ||
|
|
107
|
-
const pending = info.key === "working" ? "Starting up…" : info.key === "reviewing" ? "Reviewing 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
|
|
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.
|
|
119
|
-
} else activity = "<div class='muted'>No
|
|
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", "
|
|
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
|
|
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
|
|
129
|
-
: b("abort", "stop", "
|
|
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
|
-
//
|
|
139
|
-
const
|
|
140
|
-
let
|
|
141
|
-
// Rows are patched cell by cell: a working
|
|
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
|
|
144
|
-
const tbody = $("
|
|
185
|
+
function patchRoles(rows) {
|
|
186
|
+
const tbody = $("rolerows");
|
|
145
187
|
const keys = rows.map((r) => r.key).join("|");
|
|
146
|
-
if (keys !==
|
|
147
|
-
|
|
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='" +
|
|
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
|
|
163
|
-
$("
|
|
164
|
-
const byGroup =
|
|
165
|
-
for (const l of
|
|
166
|
-
const rank =
|
|
167
|
-
byGroup[
|
|
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 =
|
|
211
|
+
const selected = openRoleId();
|
|
170
212
|
const rows = [];
|
|
171
|
-
|
|
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 } =
|
|
176
|
-
rows.push({ key: "l:" + l.role, role: l.role, cls: "
|
|
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
|
|
180
|
-
|
|
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
|
-
$("
|
|
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)
|
|
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
|
|
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
|
|
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
|
|
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
|
-
["
|
|
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
|
|
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
|
|
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
|
-
"<
|
|
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
|
-
|
|
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
|
|
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 +
|
|
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
|
-
|
|
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 <id></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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
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>
|
|
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("
|
|
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 ? "
|
|
302
|
+
showFlash(!d.changed ? "Brief unchanged" : d.committed ? "Brief saved (committed to main)" : "Brief saved");
|
|
143
303
|
} catch (err) {
|
|
144
|
-
showFlash("error: " + (err
|
|
304
|
+
showFlash("error: " + clientErrorMessage(err));
|
|
145
305
|
}
|
|
146
306
|
}
|
|
147
307
|
// settings-view:end
|