Skip to content

feat(tui): surface build & turn completion via toast + bell#11

Merged
BunsDev merged 1 commit into
mainfrom
feat/build-complete-signals
May 31, 2026
Merged

feat(tui): surface build & turn completion via toast + bell#11
BunsDev merged 1 commit into
mainfrom
feat/build-complete-signals

Conversation

@BunsDev
Copy link
Copy Markdown
Member

@BunsDev BunsDev commented May 30, 2026

Summary

  • Long-running bash tasks launched with notify_on_complete: true now push a green ✓ / red ✗ toast into the TUI the moment they finish — so you can step away during a build and notice when it's done.
  • Assistant turns that ran ≥ 8s do the same on TurnComplete, and the idle "✽ Worked for…" status line is brightened into a bold green ✓ that reads as done at a glance instead of dim gray.
  • Two new settings in ~/.coven-code/settings.json:
    • completionToast (default true) — show the toast
    • bellOnComplete (default false) — also ring \x07

Implementation

  • CompletionNotifier now carries a structured BgTaskCompletion { task_id, command, success, exit_info, output_tail, duration_secs } instead of a flat string, so consumers can fan out to system-message injection, TUI toasts, and the terminal bell from one source of truth.
  • The CLI main loop drains a new bg_completion_rx channel each tick and calls App::signal_bg_task_completion, which routes Success (auto-expires 8s) vs Error (sticky until acknowledged).
  • Settings merge hierarchically and the completionToast Option<bool> cleanly distinguishes "default" from "explicitly disabled," sidestepping the bool-default-false bug that affects sibling fields like notifications.

Test plan

  • cargo check clean across claurst-core, claurst-tools, claurst-tui, claurst
  • 4 new unit tests pass: bg_task_success_pushes_success_toast, bg_task_failure_pushes_error_toast_no_autoexpire, bg_task_toast_disabled_pushes_nothing, format_duration_secs_buckets
  • Pre-existing test failures in claurst-tui/claurst-core confirmed to fail on clean main — not regressions from this change
  • Manual: launch a long cargo build via Bash with run_in_background: true, notify_on_complete: true and confirm the toast appears
  • Manual: confirm the brighter "Worked for…" status line is visible after a short turn
  • Manual: set "bellOnComplete": true in settings.json and confirm the terminal beeps on a long turn

🤖 Generated with Claude Code

Long-running bash tasks (`notify_on_complete: true`) now push a
green/red toast into the TUI when they finish, and assistant turns
that ran ≥8s do the same — so you can step away during a build or a
long agent turn and notice the moment it's done.

- core: add `completionToast` (Option<bool>, default true) and
  `bellOnComplete` (default false) settings, merged hierarchically.
- tools: replace `CompletionNotifier(Fn(String))` with a structured
  `BgTaskCompletion` payload (task_id, command, success, exit_info,
  output_tail, duration_secs) so consumers can fan-out to system-
  message injection, TUI toasts, and a terminal bell from one source
  of truth.
- cli: drain a new `bg_completion_rx` channel each main-loop tick and
  feed `App::signal_bg_task_completion`, which pushes a Success/Error
  notification (sticky on failure, 8s on success) and rings `\x07` when
  the bell flag is on.
- tui: same toast+bell on `QueryEvent::TurnComplete` for turns past
  `completion_toast_min_secs` (8s). Brighten the idle "✽ Worked for…"
  status line into a bold green ✓ so it reads as "done" at a glance
  instead of dim gray.

Four new unit tests cover the toast routing and duration formatting.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 30, 2026 22:03
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@BunsDev BunsDev merged commit fe8f9b1 into main May 31, 2026
1 check failed
@BunsDev BunsDev deleted the feat/build-complete-signals branch May 31, 2026 02:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants