From 1f52746bd95a213fa8247ee31077e5275864bbb8 Mon Sep 17 00:00:00 2001 From: iris Date: Wed, 20 May 2026 22:04:57 +0200 Subject: [PATCH] manager: add optional agent param to reminder RPCs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CountPendingReminders and ReminderRollup were hardcoded to MANAGER_AGENT. Both now take agent: Option — None keeps the current behavior (manager's own), Some(name) returns that agent's reminder stats. The broker functions already take an agent name, so this is a thin wire-protocol change. Callers (web UI stats page, post-turn counts) pass None. Closes #122 --- hive-ag3nt/src/bin/hive-m1nd.rs | 2 +- hive-ag3nt/src/web_ui.rs | 2 ++ hive-c0re/src/manager_server.rs | 10 ++++++---- hive-sh4re/src/lib.rs | 12 ++++++++++-- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/hive-ag3nt/src/bin/hive-m1nd.rs b/hive-ag3nt/src/bin/hive-m1nd.rs index 6ee1931..8346bed 100644 --- a/hive-ag3nt/src/bin/hive-m1nd.rs +++ b/hive-ag3nt/src/bin/hive-m1nd.rs @@ -343,7 +343,7 @@ async fn fetch_manager_post_turn_counts(socket: &Path) -> (Option, Option( socket, - &ManagerRequest::CountPendingReminders, + &ManagerRequest::CountPendingReminders { agent: None }, ) .await { diff --git a/hive-ag3nt/src/web_ui.rs b/hive-ag3nt/src/web_ui.rs index f7a1bb8..913e75b 100644 --- a/hive-ag3nt/src/web_ui.rs +++ b/hive-ag3nt/src/web_ui.rs @@ -529,6 +529,8 @@ async fn fetch_reminder_stats(socket: &std::path::Path, flavor: Flavor, window_s socket, &hive_sh4re::ManagerRequest::ReminderRollup { since_secs: window_secs, + // Manager's own stats page — its own reminders. + agent: None, }, ) .await diff --git a/hive-c0re/src/manager_server.rs b/hive-c0re/src/manager_server.rs index 11c82ee..3717f01 100644 --- a/hive-c0re/src/manager_server.rs +++ b/hive-c0re/src/manager_server.rs @@ -409,16 +409,18 @@ async fn dispatch(req: &ManagerRequest, coord: &Arc) -> ManagerResp }, } } - ManagerRequest::CountPendingReminders => { - match coord.broker.count_pending_reminders_for(MANAGER_AGENT) { + ManagerRequest::CountPendingReminders { agent } => { + let target = agent.as_deref().unwrap_or(MANAGER_AGENT); + match coord.broker.count_pending_reminders_for(target) { Ok(count) => ManagerResponse::PendingRemindersCount { count }, Err(e) => ManagerResponse::Err { message: format!("{e:#}"), }, } } - ManagerRequest::ReminderRollup { since_secs } => { - match coord.broker.reminder_rollup_for(MANAGER_AGENT, *since_secs) { + ManagerRequest::ReminderRollup { since_secs, agent } => { + let target = agent.as_deref().unwrap_or(MANAGER_AGENT); + match coord.broker.reminder_rollup_for(target, *since_secs) { Ok(stats) => ManagerResponse::ReminderRollup(stats), Err(e) => ManagerResponse::Err { message: format!("{e:#}"), diff --git a/hive-sh4re/src/lib.rs b/hive-sh4re/src/lib.rs index 9f20c05..57a81ee 100644 --- a/hive-sh4re/src/lib.rs +++ b/hive-sh4re/src/lib.rs @@ -804,9 +804,13 @@ pub enum ManagerRequest { #[serde(default)] agent: Option, }, - /// Count of the manager's own pending reminders. Mirror of + /// Count of pending reminders. `agent` selects whose: `None` = + /// the manager's own, `Some("")` = that agent's. Mirror of /// `AgentRequest::CountPendingReminders` on the manager surface. - CountPendingReminders, + CountPendingReminders { + #[serde(default)] + agent: Option, + }, /// Reminder statistics: counts of scheduled, delivered, and pending /// reminders (manager-flavour). Mirror of `AgentRequest::ReminderRollup`. ReminderRollup { @@ -814,6 +818,10 @@ pub enum ManagerRequest { /// Pass 0 to include all reminders. #[serde(default)] since_secs: u64, + /// Whose reminders to roll up: `None` = the manager's own, + /// `Some("")` = that agent's. + #[serde(default)] + agent: Option, }, /// Manager-flavour self-introspection. Same wire shape as /// `AgentRequest::Whoami`, but `role` is always `"manager"`.