wire thalamus idle state into consciousness binary
The consciousness binary now has its own idle state machine, fed directly by TUI events: - Key press → user_activity() - Turn complete → response_activity() - Render tick → decay_ewma(), snapshot to TUI F5 thalamus screen shows presence/activity from the in-process state instead of shelling out to poc-daemon status. No tmux pane scraping, no socket RPC — the binary IS the presence. Co-Developed-By: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
e49b235957
commit
e7be2a3ba0
3 changed files with 66 additions and 28 deletions
|
|
@ -370,6 +370,19 @@ pub struct App {
|
|||
pub(crate) agent_state: Vec<crate::subconscious::subconscious::AgentSnapshot>,
|
||||
/// Cached channel info for F5 screen (refreshed on status tick).
|
||||
pub(crate) channel_status: Vec<ChannelStatus>,
|
||||
/// Cached idle state for F5 screen.
|
||||
pub(crate) idle_info: Option<IdleInfo>,
|
||||
}
|
||||
|
||||
/// Snapshot of thalamus idle state for display.
|
||||
#[derive(Clone)]
|
||||
pub(crate) struct IdleInfo {
|
||||
pub user_present: bool,
|
||||
pub since_activity: f64,
|
||||
pub activity_ewma: f64,
|
||||
pub block_reason: String,
|
||||
pub dreaming: bool,
|
||||
pub sleeping: bool,
|
||||
}
|
||||
|
||||
/// Channel info for display on F5 screen.
|
||||
|
|
@ -450,6 +463,7 @@ impl App {
|
|||
agent_log_view: false,
|
||||
agent_state: Vec::new(),
|
||||
channel_status: Vec::new(),
|
||||
idle_info: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -885,12 +899,25 @@ impl App {
|
|||
self.channel_status = status;
|
||||
}
|
||||
|
||||
/// Snapshot idle state for F5 display.
|
||||
pub fn update_idle(&mut self, state: &crate::thalamus::idle::State) {
|
||||
self.idle_info = Some(IdleInfo {
|
||||
user_present: state.user_present(),
|
||||
since_activity: state.since_activity(),
|
||||
activity_ewma: state.activity_ewma,
|
||||
block_reason: state.block_reason().to_string(),
|
||||
dreaming: state.dreaming,
|
||||
sleeping: state.sleep_until.is_some(),
|
||||
});
|
||||
}
|
||||
|
||||
pub(crate) fn set_screen(&mut self, screen: Screen) {
|
||||
self.screen = screen;
|
||||
self.debug_scroll = 0;
|
||||
// Refresh data for status screens on entry
|
||||
match screen {
|
||||
Screen::Thalamus => self.refresh_channels(),
|
||||
// idle_info is updated from the event loop, not here
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue