cli: switch to clap, add notify-timeout, improve status display

Replace manual arg parsing with clap derive for the full command set.
Single source of truth for command names, args, and help text.

Add notify_timeout (default 2min) — controls how long after last
response before notifications inject via tmux instead of waiting
for the hook. Separate from idle_timeout (5min) which controls
autonomous prompts.

Improve `poc-daemon status` to show both timers with elapsed/configured
and block reason, replacing the terse one-liner.

Add new Status fields over capnp: idleTimeout, notifyTimeout,
sinceActivity, sinceUser, blockReason.

ExecStart in poc-daemon.service now uses `daemon` subcommand.

Co-Authored-By: ProofOfConcept <poc@bcachefs.org>
This commit is contained in:
ProofOfConcept 2026-03-05 21:32:27 -05:00
parent eab656aa64
commit d0080698f3
7 changed files with 416 additions and 170 deletions

View file

@ -27,18 +27,23 @@ enum Activity {
}
struct Status {
lastUserMsg @0 :Float64;
lastResponse @1 :Float64;
claudePane @2 :Text;
sleepUntil @3 :Float64; # 0 = not sleeping, -1 = indefinite
quietUntil @4 :Float64;
consolidating @5 :Bool;
dreaming @6 :Bool;
fired @7 :Bool;
kentPresent @8 :Bool;
uptime @9 :Float64;
activity @10 :Activity;
pendingCount @11 :UInt32;
lastUserMsg @0 :Float64;
lastResponse @1 :Float64;
claudePane @2 :Text;
sleepUntil @3 :Float64; # 0 = not sleeping, -1 = indefinite
quietUntil @4 :Float64;
consolidating @5 :Bool;
dreaming @6 :Bool;
fired @7 :Bool;
kentPresent @8 :Bool;
uptime @9 :Float64;
activity @10 :Activity;
pendingCount @11 :UInt32;
idleTimeout @12 :Float64; # configured idle timeout (secs)
notifyTimeout @13 :Float64; # configured notify-via-tmux timeout (secs)
sinceActivity @14 :Float64; # secs since max(lastUserMsg, lastResponse)
sinceUser @15 :Float64; # secs since lastUserMsg
blockReason @16 :Text; # why idle timer hasn't fired
}
interface Daemon {
@ -62,6 +67,7 @@ interface Daemon {
setThreshold @14 (type :Text, level :UInt8) -> ();
idleTimeout @16 (seconds :Float64) -> ();
notifyTimeout @19 (seconds :Float64) -> ();
save @17 () -> ();
debug @18 () -> (json :Text);