parent
f6eb0442c4
commit
99752f81d9
1 changed files with 40 additions and 79 deletions
|
|
@ -1,8 +1,6 @@
|
|||
//! Reserved recipient names/senders and the out-of-band `HelperEvent`
|
||||
//! payload hive-c0re pushes into the manager's inbox.
|
||||
//! Reserved recipient names and senders.
|
||||
|
||||
use hive_types::Ident;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Logical name of the human operator: the sender of operator-authored
|
||||
/// messages. Not a recipient — `send` to it fails with
|
||||
|
|
@ -18,8 +16,7 @@ pub const OPERATOR_SEND_REFUSAL: &str = "send failed: `operator` is not a send r
|
|||
Without them there is no direct channel to the operator: they read your `set_status` \
|
||||
line and turn output on the dashboard, and your logs.";
|
||||
|
||||
/// Sender hive-c0re uses for events it pushes into the manager's inbox.
|
||||
/// Manager harness recognises this and parses the body as a `HelperEvent`.
|
||||
/// Sender hive-c0re uses for messages it pushes into an agent's inbox.
|
||||
pub const SYSTEM_SENDER: &str = "system";
|
||||
|
||||
/// Parse `s` as a [`Ident`] for use as `Message.from`, falling back to
|
||||
|
|
@ -41,17 +38,6 @@ pub fn trusted_sender(s: &str) -> Ident {
|
|||
.unwrap_or_else(|_| Ident::parse(SYSTEM_SENDER).expect("SYSTEM_SENDER is a valid Ident"))
|
||||
}
|
||||
|
||||
/// Out-of-band events the host-side daemon pushes to the manager's inbox.
|
||||
/// Serialised as JSON in `Message::body` (sender = `SYSTEM_SENDER`).
|
||||
/// Per-variant triggers + the optional `sha`/`tag` semantics live in
|
||||
/// `docs/agent-lifecycle/config-changes.md::Helper events`.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(tag = "event", rename_all = "snake_case")]
|
||||
pub enum HelperEvent {
|
||||
/// A sub-agent's recorded flake rev is stale relative to hyperhive.
|
||||
NeedsUpdate { agent: String },
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod reserved_name_tests {
|
||||
use super::{OPERATOR_RECIPIENT, SYSTEM_SENDER};
|
||||
|
|
|
|||
Loading…
Reference in a new issue