set_status: consolidate whoami into get_agent_meta with optional name
This commit is contained in:
parent
77fdaf0d1e
commit
73871f18c3
10 changed files with 118 additions and 204 deletions
|
|
@ -437,20 +437,23 @@ pub enum AgentRequest {
|
|||
#[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
|
||||
/// identity after a rename or session-continue boundary where the
|
||||
/// system-prompt-substituted label is no longer reliable.
|
||||
Whoami,
|
||||
/// Set a free-text status string visible on the dashboard. Persisted
|
||||
/// to `{state_dir}/hyperhive-status` so it survives harness restarts.
|
||||
/// Pass an empty string to clear the status.
|
||||
SetStatus { text: String },
|
||||
/// Fetch the current status of another agent by name. Returns
|
||||
/// `AgentResponse::AgentMeta` with the target's status fields.
|
||||
/// If the agent does not exist or has never set a status, fields are `None`.
|
||||
GetAgentMeta { name: String },
|
||||
/// Fetch metadata for an agent: identity (name + role + hyperhive
|
||||
/// rev) and current status. When `name` is `None` the caller's own
|
||||
/// identity is returned (self-introspection — replaces the old
|
||||
/// `Whoami` request). When `name` is `Some`, the target agent's
|
||||
/// status fields are populated but `role`/`hyperhive_rev` reflect
|
||||
/// the responding daemon's view (`role` is best-effort: `"manager"`
|
||||
/// for the manager agent, `"agent"` for everyone else).
|
||||
/// `status_text` / `status_set_at` are `None` when the target has
|
||||
/// never set a status or the agent name is unknown.
|
||||
GetAgentMeta {
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
name: Option<String>,
|
||||
},
|
||||
/// Cancel an open thread the agent owns: a `Question` they asked
|
||||
/// (returns `[cancelled by <self>]` as the answer to the asker)
|
||||
/// or a `Reminder` they scheduled (hard-deletes the row).
|
||||
|
|
@ -511,15 +514,15 @@ pub enum AgentResponse {
|
|||
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
|
||||
/// response). `hyperhive_rev` is `None` only when the configured
|
||||
/// flake URL has no canonical path. `status_text` is the last
|
||||
/// value written via `SetStatus`, or `None` if none has been set.
|
||||
/// `status_set_at` is a Unix timestamp (seconds since epoch) of
|
||||
/// when the status was last written; `None` when no status is set.
|
||||
Whoami {
|
||||
/// `GetAgentMeta` result: identity + status metadata for an agent.
|
||||
/// `role` is `"agent"` for sub-agents and `"manager"` for the
|
||||
/// manager. `hyperhive_rev` is `None` only when the configured
|
||||
/// flake URL has no canonical path. `status_text` is the last value
|
||||
/// written via `SetStatus`, or `None` when none has been set or the
|
||||
/// agent name is unknown. `status_set_at` is a Unix timestamp
|
||||
/// (seconds since epoch) of when the status was last written;
|
||||
/// `None` when no status is set.
|
||||
AgentMeta {
|
||||
name: String,
|
||||
role: String,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
|
|
@ -529,16 +532,6 @@ pub enum AgentResponse {
|
|||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
status_set_at: Option<i64>,
|
||||
},
|
||||
/// `GetAgentMeta` result: status metadata for a named agent.
|
||||
/// `status_text` / `status_set_at` are `None` when the agent has
|
||||
/// not set a status or the agent name is unknown.
|
||||
AgentMeta {
|
||||
name: String,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
status_text: Option<String>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
status_set_at: Option<i64>,
|
||||
},
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
@ -865,13 +858,15 @@ pub enum ManagerRequest {
|
|||
#[serde(default)]
|
||||
agent: Option<String>,
|
||||
},
|
||||
/// Manager-flavour self-introspection. Same wire shape as
|
||||
/// `AgentRequest::Whoami`, but `role` is always `"manager"`.
|
||||
Whoami,
|
||||
/// Mirror of `AgentRequest::SetStatus` on the manager surface.
|
||||
SetStatus { text: String },
|
||||
/// Mirror of `AgentRequest::GetAgentMeta` on the manager surface.
|
||||
GetAgentMeta { name: String },
|
||||
/// `None` returns the manager's own identity (replaces the old
|
||||
/// `Whoami` request).
|
||||
GetAgentMeta {
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
name: Option<String>,
|
||||
},
|
||||
/// Cancel an open thread (question or reminder). Manager surface
|
||||
/// can cancel any row (no owner check) — same dispatch as
|
||||
/// `AgentRequest::CancelLooseEnd` but with privileged auth.
|
||||
|
|
@ -947,9 +942,10 @@ pub enum ManagerResponse {
|
|||
},
|
||||
/// `ReminderRollup` result: reminder activity stats for the manager.
|
||||
ReminderRollup(ReminderStats),
|
||||
/// `Whoami` result: manager identity. `role` is always
|
||||
/// `"manager"`. Mirror of `AgentResponse::Whoami`.
|
||||
Whoami {
|
||||
/// Mirror of `AgentResponse::AgentMeta` on the manager surface.
|
||||
/// `role` is `"manager"` for the manager and `"agent"` for any
|
||||
/// sub-agent looked up by name.
|
||||
AgentMeta {
|
||||
name: String,
|
||||
role: String,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
|
|
@ -959,12 +955,4 @@ pub enum ManagerResponse {
|
|||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
status_set_at: Option<i64>,
|
||||
},
|
||||
/// Mirror of `AgentResponse::AgentMeta` on the manager surface.
|
||||
AgentMeta {
|
||||
name: String,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
status_text: Option<String>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
status_set_at: Option<i64>,
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue