add reminder rollup RPC and broker query
Surface reminder activity statistics (scheduled, delivered, pending counts) for each agent over configurable time windows. Needed by the per-agent stats page to display reminder metrics. Adds: - ReminderStats struct and ReminderRollup request/response variants - Broker::reminder_rollup_for(agent, since_secs) method - Agent and manager socket handlers for the new RPC - SocketReply mapping for response conversion
This commit is contained in:
parent
4715e88fff
commit
91bfa269fd
5 changed files with 89 additions and 0 deletions
|
|
@ -110,6 +110,17 @@ pub enum ApprovalStatus {
|
|||
Failed,
|
||||
}
|
||||
|
||||
/// Reminder activity statistics for an agent over a time window.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct ReminderStats {
|
||||
/// Total reminders scheduled in the window (created_at >= cutoff).
|
||||
pub scheduled: u64,
|
||||
/// Reminders that have been delivered in the window (sent_at IS NOT NULL).
|
||||
pub delivered: u64,
|
||||
/// Reminders still pending in the window (sent_at IS NULL).
|
||||
pub pending: u64,
|
||||
}
|
||||
|
||||
impl HostResponse {
|
||||
pub fn success() -> Self {
|
||||
Self {
|
||||
|
|
@ -381,6 +392,16 @@ pub enum AgentRequest {
|
|||
/// by the harness's per-turn stats sink to snapshot "what was
|
||||
/// queued at turn-end time" without paying for a full list.
|
||||
CountPendingReminders,
|
||||
/// Reminder statistics for this agent: counts of scheduled, delivered,
|
||||
/// and pending reminders over a time window. Used by the stats page
|
||||
/// to display reminder activity. `since_secs` filters to reminders
|
||||
/// created in the last N seconds (0 = all reminders).
|
||||
ReminderRollup {
|
||||
/// Only count reminders created in the last N seconds from now.
|
||||
/// Pass 0 to include all reminders.
|
||||
#[serde(default)]
|
||||
since_secs: u64,
|
||||
},
|
||||
/// Self-introspection: who am I, what role, what rev. All values
|
||||
/// derive from coord state (no env access required); useful for
|
||||
/// agents to stamp notes / commits / messages with a trustworthy
|
||||
|
|
@ -445,6 +466,8 @@ pub enum AgentResponse {
|
|||
LooseEnds { loose_ends: Vec<LooseEnd> },
|
||||
/// `CountPendingReminders` result.
|
||||
PendingRemindersCount { count: u64 },
|
||||
/// `ReminderRollup` result: reminder activity stats for the agent.
|
||||
ReminderRollup(ReminderStats),
|
||||
/// `Whoami` result: identity + role + the current hyperhive rev
|
||||
/// hive-c0re is running against. `role` is `"agent"` for
|
||||
/// sub-agents (the only path that reaches this variant of the
|
||||
|
|
@ -730,6 +753,14 @@ pub enum ManagerRequest {
|
|||
/// Count of the manager's own pending reminders. Mirror of
|
||||
/// `AgentRequest::CountPendingReminders` on the manager surface.
|
||||
CountPendingReminders,
|
||||
/// Reminder statistics: counts of scheduled, delivered, and pending
|
||||
/// reminders (manager-flavour). Mirror of `AgentRequest::ReminderRollup`.
|
||||
ReminderRollup {
|
||||
/// Only count reminders created in the last N seconds from now.
|
||||
/// Pass 0 to include all reminders.
|
||||
#[serde(default)]
|
||||
since_secs: u64,
|
||||
},
|
||||
/// Manager-flavour self-introspection. Same wire shape as
|
||||
/// `AgentRequest::Whoami`, but `role` is always `"manager"`.
|
||||
Whoami,
|
||||
|
|
@ -788,6 +819,8 @@ pub enum ManagerResponse {
|
|||
PendingRemindersCount {
|
||||
count: u64,
|
||||
},
|
||||
/// `ReminderRollup` result: reminder activity stats for the manager.
|
||||
ReminderRollup(ReminderStats),
|
||||
/// `Whoami` result: manager identity. `role` is always
|
||||
/// `"manager"`. Mirror of `AgentResponse::Whoami`.
|
||||
Whoami {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue