add reminder ops to the in-agent socket protocol (#2635 inc 1)

This commit is contained in:
damocles 2026-07-22 20:19:10 +02:00 committed by mara
commit 18d21237bf

View file

@ -1,14 +1,15 @@
//! Wire types for the *in-agent* socket, served by the hive-agent harness
//! to the in-container producers (matrix / bash MCP daemons) and
//! `forge_notify`. Currently carries the loose-ends-v2 *todo* op family;
//! more in-agent request families may be added over time (the socket is
//! deliberately named for the agent, not the todos).
//! `forge_notify`. Carries the loose-ends-v2 *todo* op family plus the
//! harness-local *reminder* op family (#2635 increment 1); more in-agent
//! request families may be added over time (the socket is deliberately
//! named for the agent, not the todos).
//!
//! Distinct from `hive-core-agent-sock`, the *host*-served core↔agent
//! protocol on `/run/hive/mcp.sock`: this socket never leaves the
//! container. The harness owns the todo store locally and signals its own
//! turn loop directly, so hive-c0re is not in the todo path — no broker
//! round-trip, no long-poll, no marker files.
//! container. The harness owns the todo + reminder stores locally and
//! signals its own turn loop directly, so hive-c0re is not in either path —
//! no broker round-trip, no long-poll, no marker files.
use serde::{Deserialize, Serialize};
@ -58,6 +59,25 @@ pub enum Request {
},
/// The agent marks one of its own todos done, by id.
MarkTodoDone { id: i64 },
/// Schedule a reminder that fires into this agent's own turn loop at
/// `timing` (harness-local — no broker round-trip). Same semantics as
/// the old broker `Remind` request. `file_path`, when set, is where the
/// harness persists an over-cap body instead of inlining it.
StoreReminder {
message: String,
timing: hive_sh4re::ReminderTiming,
#[serde(default, skip_serializing_if = "Option::is_none")]
file_path: Option<String>,
},
/// List this agent's pending reminders (single-agent scope — unlike
/// the old broker query, there's no cross-agent `agent` filter here).
ListReminders,
/// Cancel one of this agent's own pending reminders by id, before it
/// fires.
CancelReminder { id: i64 },
/// This agent's pending-reminder count — used by the pre-`remind` cap
/// check and the harness's own turn-stats sink.
CountPendingReminders,
}
/// A response on the in-agent socket. Serialised with a `kind` tag,
@ -69,8 +89,11 @@ pub enum Response {
Ok,
/// Op succeeded and touched `count` rows (clear / mark-done).
Acked { count: u64 },
/// `ListTodos` result.
/// `ListTodos` / `ListReminders` result (the latter wraps each row as
/// [`LooseEnd::Reminder`]).
LooseEnds { loose_ends: Vec<LooseEnd> },
/// `CountPendingReminders` result.
PendingRemindersCount { count: u64 },
/// Op failed; `message` is operator-facing.
Err { message: String },
}