diff options
| author | Igor Soarez <igor@soarez.org> | 2026-11-01 10:22:01 +0200 |
|---|---|---|
| committer | Igor Soarez <igor@soarez.org> | 2026-11-01 10:22:01 +0200 |
| commit | 8146d1db419e8bdacd75920da6f3761abf724853 (patch) | |
| tree | 921a1d609d96bb2129f7ac2d80635fd3c0c41691 /crates/dinggerd/src/watcher.rs | |
| parent | 959f0d46cac1a09d0821da599d8dff54d1147892 (diff) | |
show what pi agents cost today, this week and this month, counting forked replies once
Diffstat (limited to 'crates/dinggerd/src/watcher.rs')
| -rw-r--r-- | crates/dinggerd/src/watcher.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/crates/dinggerd/src/watcher.rs b/crates/dinggerd/src/watcher.rs index b0acc1d..1aec88e 100644 --- a/crates/dinggerd/src/watcher.rs +++ b/crates/dinggerd/src/watcher.rs @@ -27,6 +27,7 @@ //! - `@dingger_extension`, `@dingger_control` the version of pi's extension //! and its control socket, for reloading agents on an old one //! - `@dingger_draft` the draft in the agent's input box, as one line +//! - `@dingger_cost` what the agent's session spent today (see `cost`) use std::collections::HashMap; @@ -509,6 +510,17 @@ impl Watcher { change("@dingger_control", &pane.written_control, String::new()); } } + // What its session spent today; the cost thread reads every session + // file in pi's directory, and these wherever they are. + let session = hooks::session(&pane.pane_id).unwrap_or_else(|| pane.written_session.clone()); + let cost = match pane.agent { + Some(_) if !session.is_empty() => { + crate::cost::note_session(&session); + crate::cost::option_value(crate::cost::session_today(&session)) + } + _ => String::new(), + }; + change("@dingger_cost", &pane.written_cost, cost); // The draft goes with the agent too. match (pane.agent, hooks::draft(&pane.pane_id)) { (Some(_), Some(draft)) => change("@dingger_draft", &pane.written_draft, draft), |
