Skip to main content

BrokerMessage

Enum BrokerMessage 

Source
pub enum BrokerMessage {
    Status {
        agent_id: String,
        payload: StatusPayload,
    },
    Artifact {
        agent_id: String,
        payload: ArtifactPayload,
    },
    Blocked {
        agent_id: String,
        payload: BlockedPayload,
    },
    Verified {
        agent_id: String,
        payload: VerifiedPayload,
    },
    Feedback {
        agent_id: String,
        payload: FeedbackPayload,
    },
    Question {
        agent_id: String,
        payload: QuestionPayload,
    },
    Intent {
        agent_id: String,
        payload: IntentPayload,
    },
    AdvancedMain {
        payload: AdvancedMainPayload,
    },
    Learning {
        payload: LearningPayload,
    },
    VerifyNow {
        branch_id: String,
    },
}
Expand description

Envelope for all inter-agent messages.

The wire format uses JSON with an internally tagged "type" discriminator whose values are "agent.status", "agent.artifact", "agent.blocked", "agent.verified", "agent.feedback", "agent.question", "agent.intent", "agent.advanced-main", "agent.learning", and "supervisor.verify-now". The last is broker-emitted rather than agent-published; see BrokerMessage::VerifyNow.

Eq is intentionally not derived: the agent.learning payload carries a serde_json::Value body, which is PartialEq but not Eq.

Variants§

§

Status

Status heartbeat – not routed to inboxes.

Fields

§agent_id: String

Sender agent ID (slugified branch name).

§payload: StatusPayload

Status payload.

§

Artifact

Artifact announcement – broadcast to all peers.

Fields

§agent_id: String

Sender agent ID.

§payload: ArtifactPayload

Artifact payload.

§

Blocked

Blocked notification – sent to the target agent.

Fields

§agent_id: String

Sender agent ID.

§payload: BlockedPayload

Blocked payload (contains from – the unblocking agent).

§

Verified

Verification acknowledgement – broadcast to all peers.

Fields

§agent_id: String

Target agent ID (the agent whose work was verified).

§payload: VerifiedPayload

Verified payload (contains verified_by – the sender).

§

Feedback

Feedback from a verifier – delivered to the target agent only.

Fields

§agent_id: String

Target agent ID (the agent receiving feedback).

§payload: FeedbackPayload

Feedback payload (contains from – the sender).

§

Question

Agent question – delivered to the "supervisor" inbox for human reply.

Fields

§agent_id: String

Sender agent ID (the agent asking the question).

§payload: QuestionPayload

Question payload.

§

Intent

Intent announcement – broadcast to every other registered agent’s inbox.

Lets peers (and the broker conflict detector) see which files an agent is about to modify before any commit lands.

Fields

§agent_id: String

Sender agent ID (the agent declaring the intent).

§payload: IntentPayload

Intent payload.

§

AdvancedMain

Main-advanced notification – published by the supervisor after a successful merge to the default branch, broadcast to every registered agent’s inbox so dependents learn the base moved.

The payload is flattened into the envelope (its fields sit at the top level alongside "type", not nested under a payload key) so the wire shape matches the curl example the supervisor skill teaches. The sender identity is the payload’s from field (typically "supervisor"), surfaced through BrokerMessage::agent_id.

Fields

§payload: AdvancedMainPayload

Flattened advanced-main payload (from, merged_branch, new_main_sha, base, merged_at, optional summary).

§

Learning

Structured learning record – published by the broker’s learnings aggregator when [supervisor] learnings = true and broker publish is active (see crate::broker::learnings). Carries a deterministic dedup id so consumers can collapse re-emissions. Routed to the scoped branch_id inbox when present, otherwise the supervisor inbox; always retained in the broker message log. The variant is additive – existing consumers ignore unknown types per the broker-messages contract.

Fields

§payload: LearningPayload

Learning payload (carries its own agent_id).

§

VerifyNow

Supervisor verification nudge – emitted by the broker (not by an agent) when an agent.artifact { status: "committed" } arrives and [supervisor].verify_on_commit_nudge is enabled. Delivered to the "supervisor" inbox so per-commit verification is triggered by an explicit event rather than relying on the supervisor’s sweep cadence to notice the commit.

Unlike the agent.* variants this carries a branch_id directly (the committing branch) rather than a sender agent_id plus a payload – the message originates from the broker itself, so there is no publishing agent.

Fields

§branch_id: String

The committing branch whose commit should be verified now. Copied verbatim from the triggering artifact’s agent_id.

Implementations§

Source§

impl BrokerMessage

Source

pub fn from_json(input: &str) -> Result<Self, MessageError>

Deserializes and validates a broker message from a JSON string.

Returns MessageError if the JSON is malformed or the agent_id is invalid.

Source

pub fn agent_id(&self) -> &str

Returns the agent_id field from whichever variant.

Source

pub fn status_label(&self) -> &str

Returns a short status label for the message.

  • Status returns payload.status (e.g. "working")
  • Artifact returns payload.status (e.g. "done")
  • Blocked returns "blocked"
  • Verified returns "verified"
  • Feedback returns "feedback"
  • Question returns "question"
  • Intent returns "intent"
  • AdvancedMain returns "advanced-main"
  • VerifyNow returns "verify-now"

Trait Implementations§

Source§

impl Clone for BrokerMessage

Source§

fn clone(&self) -> BrokerMessage

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BrokerMessage

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for BrokerMessage

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for BrokerMessage

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<&LearningRecord> for BrokerMessage

Source§

fn from(record: &LearningRecord) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for BrokerMessage

Source§

fn eq(&self, other: &BrokerMessage) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for BrokerMessage

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for BrokerMessage

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> ToCompactString for T
where T: Display,

Source§

impl<T> ToLine for T
where T: Display,

Source§

fn to_line(&self) -> Line<'_>

Converts the value to a Line.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToSpan for T
where T: Display,

Source§

fn to_span(&self) -> Span<'_>

Converts the value to a Span.
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T> ToText for T
where T: Display,

Source§

fn to_text(&self) -> Text<'_>

Converts the value to a Text.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more