Description
Add a dispatch watch command that reports session attention state without opening the TUI. It prints a snapshot or streams changes, and rings the terminal bell when a session starts waiting for input.
Use Case
Attention state (waiting, working, thinking, interrupted, idle) is only visible inside the running TUI, and notify_on_waiting only rings the bell while that TUI is focused. People running several Copilot sessions want a lightweight signal in a spare pane, a shell prompt, or a status bar that tells them when an agent is waiting on them. Tools like Agent Deck and gh-dash treat this at-a-glance waiting or finished view as a core feature. The scanning logic already exists in data.ScanAttention and runs fully from the filesystem, so it does not depend on the TUI.
Proposed Solution
Add cmd/dispatch/watch.go:
dispatch watch --once prints a one-shot summary of attention counts and the sessions that are waiting or interrupted, then exits.
dispatch watch (default) polls data.ScanAttention on an interval and prints a timestamped line when a session transitions into waiting or interrupted, ringing the terminal bell once per transition (reusing the existing bellFn pattern).
--json emits a JSON snapshot for --once and newline-delimited JSON events while streaming.
--interval <dur> sets the poll interval (default from attention_threshold conventions, minimum one second).
--repo, --branch, --folder scope which sessions count by joining scanned IDs with the session store.
- Ctrl-C exits cleanly.
Acceptance criteria
dispatch watch --once prints attention counts plus the waiting and interrupted sessions; --json prints a stable object.
dispatch watch streams transitions and rings the bell only on a new waiting or interrupted session, not on every scan.
--interval controls the poll cadence and is clamped to a sane minimum.
--repo, --branch, and --folder limit the sessions considered.
- Tests cover the snapshot output, JSON output, transition detection, and filter scoping without touching real session directories.
Alternatives Considered
Extending dispatch stats with a live mode, rejected because stats is a point-in-time report and watch is a monitor. A background daemon with OS notifications, deferred as a possible follow-up on top of this foundation.
Complexity
M
Description
Add a
dispatch watchcommand that reports session attention state without opening the TUI. It prints a snapshot or streams changes, and rings the terminal bell when a session starts waiting for input.Use Case
Attention state (waiting, working, thinking, interrupted, idle) is only visible inside the running TUI, and
notify_on_waitingonly rings the bell while that TUI is focused. People running several Copilot sessions want a lightweight signal in a spare pane, a shell prompt, or a status bar that tells them when an agent is waiting on them. Tools like Agent Deck and gh-dash treat this at-a-glance waiting or finished view as a core feature. The scanning logic already exists indata.ScanAttentionand runs fully from the filesystem, so it does not depend on the TUI.Proposed Solution
Add
cmd/dispatch/watch.go:dispatch watch --onceprints a one-shot summary of attention counts and the sessions that are waiting or interrupted, then exits.dispatch watch(default) pollsdata.ScanAttentionon an interval and prints a timestamped line when a session transitions into waiting or interrupted, ringing the terminal bell once per transition (reusing the existingbellFnpattern).--jsonemits a JSON snapshot for--onceand newline-delimited JSON events while streaming.--interval <dur>sets the poll interval (default fromattention_thresholdconventions, minimum one second).--repo,--branch,--folderscope which sessions count by joining scanned IDs with the session store.Acceptance criteria
dispatch watch --onceprints attention counts plus the waiting and interrupted sessions;--jsonprints a stable object.dispatch watchstreams transitions and rings the bell only on a new waiting or interrupted session, not on every scan.--intervalcontrols the poll cadence and is clamped to a sane minimum.--repo,--branch, and--folderlimit the sessions considered.Alternatives Considered
Extending
dispatch statswith a live mode, rejected because stats is a point-in-time report and watch is a monitor. A background daemon with OS notifications, deferred as a possible follow-up on top of this foundation.Complexity
M