whoami: new mcp tool returning name/role/pronouns/hyperhive_rev on both surfaces

This commit is contained in:
damocles 2026-05-17 23:31:23 +02:00
parent 4ec401a6c7
commit 3c66cb6707
9 changed files with 142 additions and 14 deletions

View file

@ -313,6 +313,12 @@ 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,
/// 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,
}
/// Responses on a per-agent socket.
@ -339,6 +345,18 @@ pub enum AgentResponse {
OpenThreads { threads: Vec<OpenThread> },
/// `CountPendingReminders` result.
PendingRemindersCount { count: u64 },
/// `Whoami` result: identity + role + operator pronouns + 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.
Whoami {
name: String,
role: String,
operator_pronouns: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
hyperhive_rev: Option<String>,
},
}
// -----------------------------------------------------------------------------
@ -605,6 +623,9 @@ pub enum ManagerRequest {
/// Count of the manager's own pending reminders. Mirror of
/// `AgentRequest::CountPendingReminders` on the manager surface.
CountPendingReminders,
/// Manager-flavour self-introspection. Same wire shape as
/// `AgentRequest::Whoami`, but `role` is always `"manager"`.
Whoami,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@ -647,4 +668,13 @@ pub enum ManagerResponse {
PendingRemindersCount {
count: u64,
},
/// `Whoami` result: manager identity. `role` is always
/// `"manager"`. Mirror of `AgentResponse::Whoami`.
Whoami {
name: String,
role: String,
operator_pronouns: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
hyperhive_rev: Option<String>,
},
}