idle: EWMA activity tracking
Track activity level as an EWMA (exponentially weighted moving average) driven by turn duration. Long turns (engaged work) produce large boosts; short turns (bored responses) barely register. Asymmetric time constants: 60s boost half-life for fast wake-up, 5-minute decay half-life for gradual wind-down. Self-limiting boost formula converges toward 0.75 target — can't overshoot. - Add activity_ewma, turn_start, last_nudge to persisted state - Boost on handle_response proportional to turn duration - Decay on every tick and state transition - Fix kent_present: self-nudge responses (fired=true) don't update last_user_msg, so kent_present stays false during autonomous mode - Nudge only when Kent is away, minimum 15s between nudges - CLI: `poc-daemon ewma [VALUE]` to query or set - Status output shows activity percentage
This commit is contained in:
parent
7ea7c78a35
commit
22a9fdabdb
4 changed files with 157 additions and 24 deletions
|
|
@ -166,6 +166,17 @@ impl daemon::Server for DaemonImpl {
|
|||
Promise::ok(())
|
||||
}
|
||||
|
||||
fn ewma(
|
||||
&mut self,
|
||||
params: daemon::EwmaParams,
|
||||
mut results: daemon::EwmaResults,
|
||||
) -> Promise<(), capnp::Error> {
|
||||
let value = pry!(params.get()).get_value();
|
||||
let current = self.state.borrow_mut().handle_ewma(value);
|
||||
results.get().set_current(current);
|
||||
Promise::ok(())
|
||||
}
|
||||
|
||||
fn stop(
|
||||
&mut self,
|
||||
_params: daemon::StopParams,
|
||||
|
|
@ -211,6 +222,7 @@ impl daemon::Server for DaemonImpl {
|
|||
status.set_since_activity(s.since_activity());
|
||||
status.set_since_user(crate::now() - s.last_user_msg);
|
||||
status.set_block_reason(s.block_reason());
|
||||
status.set_activity_ewma(s.activity_ewma);
|
||||
|
||||
Promise::ok(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue