rename: open_threads → loose_ends + cancel_thread → cancel_loose_end across wire / tools / web ui

This commit is contained in:
damocles 2026-05-18 18:22:49 +02:00
parent b1d0a62cb9
commit 6e23d087d2
16 changed files with 152 additions and 139 deletions

View file

@ -185,7 +185,7 @@ pub enum ReminderTiming {
At { unix_timestamp: i64 },
}
/// One row in the response to `GetOpenThreads`. Tagged enum so new
/// One row in the response to `GetLooseEnds`. Tagged enum so new
/// thread kinds (forge PRs, long-running approvals from a privileged
/// bot, etc) can land later without breaking existing handlers. The
/// caller (claude in the agent harness) is expected to render these
@ -193,13 +193,13 @@ pub enum ReminderTiming {
/// needed without a follow-up fetch.
///
/// `Question` and `Reminder` rows are cancellable via the
/// `CancelThread` request (and the `cancel_thread` MCP tool);
/// `CancelLooseEnd` request (and the `cancel_loose_end` MCP tool);
/// `Approval` rows are not (operator approves/denies via the
/// dashboard, manager has no withdraw path today).
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(tag = "kind", rename_all = "snake_case")]
pub enum OpenThread {
/// A pending approval. For agent-flavour `GetOpenThreads` calls
pub enum LooseEnd {
/// A pending approval. For agent-flavour `GetLooseEnds` calls
/// this only surfaces when the agent itself is the manager
/// (sub-agents don't submit approvals). For manager-flavour calls
/// it lists every pending approval in the swarm. `agent` is the
@ -245,14 +245,14 @@ pub enum OpenThread {
},
}
/// Kind discriminator for `CancelThread`. Maps to which underlying
/// Kind discriminator for `CancelLooseEnd`. Maps to which underlying
/// store the dispatcher reaches into (`OperatorQuestions` vs
/// `Broker::reminders`). Approvals are deliberately not cancellable
/// — the operator approves/denies via the dashboard, manager has no
/// withdraw path today.
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
pub enum CancelThreadKind {
pub enum CancelLooseEndKind {
Question,
Reminder,
}
@ -340,7 +340,7 @@ pub enum AgentRequest {
/// agent submitted them (which only ever happens for the
/// manager); questions surface where the agent is `asker` or
/// `target`. Cheap O(n) sweep server-side — no caching.
GetOpenThreads,
GetLooseEnds,
/// Count of this agent's pending (un-delivered) reminders. Used
/// by the harness's per-turn stats sink to snapshot "what was
/// queued at turn-end time" without paying for a full list.
@ -357,7 +357,7 @@ pub enum AgentRequest {
/// Authorisation on the sub-agent surface: caller must own the
/// row. The manager surface uses the same wire variant but
/// accepts any id.
CancelThread { kind: CancelThreadKind, id: i64 },
CancelLooseEnd { kind: CancelLooseEndKind, id: i64 },
}
/// Responses on a per-agent socket.
@ -379,9 +379,9 @@ pub enum AgentResponse {
/// `Ask` result: the queued question id. The answer lands later
/// as `HelperEvent::QuestionAnswered` in this agent's inbox.
QuestionQueued { id: i64 },
/// `GetOpenThreads` result: list of loose ends pending against
/// `GetLooseEnds` result: list of loose ends pending against
/// this agent. Ordered newest-first within each kind.
OpenThreads { threads: Vec<OpenThread> },
LooseEnds { loose_ends: Vec<LooseEnd> },
/// `CountPendingReminders` result.
PendingRemindersCount { count: u64 },
/// `Whoami` result: identity + role + the current hyperhive rev
@ -655,9 +655,9 @@ pub enum ManagerRequest {
/// Hive-wide loose-ends view: EVERY pending approval + EVERY
/// unanswered question in the swarm. Used by the manager to scan
/// for stalled coordination — the per-agent equivalent on the
/// sub-agent surface is `AgentRequest::GetOpenThreads` which
/// sub-agent surface is `AgentRequest::GetLooseEnds` which
/// only returns rows where the agent itself is asker / target.
GetOpenThreads,
GetLooseEnds,
/// Count of the manager's own pending reminders. Mirror of
/// `AgentRequest::CountPendingReminders` on the manager surface.
CountPendingReminders,
@ -666,8 +666,8 @@ pub enum ManagerRequest {
Whoami,
/// Cancel an open thread (question or reminder). Manager surface
/// can cancel any row (no owner check) — same dispatch as
/// `AgentRequest::CancelThread` but with privileged auth.
CancelThread { kind: CancelThreadKind, id: i64 },
/// `AgentRequest::CancelLooseEnd` but with privileged auth.
CancelLooseEnd { kind: CancelLooseEndKind, id: i64 },
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@ -700,11 +700,11 @@ pub enum ManagerResponse {
Logs {
content: String,
},
/// `GetOpenThreads` result: hive-wide loose ends (approvals +
/// unanswered questions). Same `OpenThread` variants as the
/// `GetLooseEnds` result: hive-wide loose ends (approvals +
/// unanswered questions). Same `LooseEnd` variants as the
/// agent surface; the manager's view is unfiltered.
OpenThreads {
threads: Vec<OpenThread>,
LooseEnds {
loose_ends: Vec<LooseEnd>,
},
/// `CountPendingReminders` result.
PendingRemindersCount {