Skip to main content

HarnessOperatorAgentEventV1

Enum HarnessOperatorAgentEventV1 

Source
pub enum HarnessOperatorAgentEventV1 {
    AgentChunk {
        sequence: u64,
        session: HarnessRuntimeSessionAddressV1,
        chunk: HarnessAgentStreamChunkV1,
        published_at_ms: u64,
    },
    Lagged {
        sequence: u64,
        session: HarnessRuntimeSessionAddressV1,
        dropped: u64,
    },
    ReplayBoundary {
        session: HarnessRuntimeSessionAddressV1,
        replayed: u32,
        dropped_before_replay: u64,
    },
    Ping {
        sequence: u64,
    },
}
Expand description

Long-lived, server-push counterpart to a SubscribeAgentStream connection – see HarnessOperatorEventV1’s own doc comment for the shared framing this also uses. Deliberately its own type, not a variant of HarnessOperatorEventV1 and not a variant of HarnessOperatorTerminalEventV1 either, for two separate reasons this stream’s overflow story below has to hold at once:

  • Like HarnessOperatorTerminalEventV1, HarnessOperatorEventV1’s Lagged/SnapshotBaseline pair is wrong here: there is no task/run/node to resync, only content that is already self-contained.
  • Unlike HarnessOperatorTerminalEventV1, a dropped chunk here cannot be waved off with a diagnostic counter either. A terminal frame is always a full screen, so TerminalFrame’s own coalesced_since_last can silently supersede a stale frame with a fresher one and lose nothing real. An agent-stream chunk has no such property: a Text/Thinking delta or an InteractionPrompt is a fact about one instant, not a snapshot of the whole session, so a chunk this stream drops is gone – there is no later chunk that already contains it, and dropping an InteractionPrompt in particular would strand the operator unable to ever answer a correlation id they never saw.

So overflow here gets its own honest shape: Lagged reports a real, unrecoverable loss for one subscribed session – no snapshot follows it, because none could repair what was lost – and the client’s only correct response is to surface that loss to the operator, not to wait for a recovery frame that is never coming.

ReplayBoundary is a separate, narrower concession to the same “instants are gone once missed” rule: a subscriber routinely registers seconds after a session’s first turn already started (an operator can only address a session that has been spawned), and every Text/ Thinking/Blocked chunk published into that gap used to be gone for good. The harness now keeps a small bounded ring of the most recent ones per session and replays it once at subscribe time, immediately marked by this event so it is never mistaken for live content – see this field’s own doc comment on AgentChunk::published_at_ms for how a replayed chunk keeps proving it is history, not now.

Variants§

§

AgentChunk

Fields

§sequence: u64
§published_at_ms: u64

The harness’s own wall-clock reading of the moment this chunk was first published to AgentStreamSubscriberRegistry (hatchery-harness-service::agent_stream), carried unchanged through every delivery path – live, state seed, and the bounded replay ReplayBoundary marks the end of. A replayed chunk keeps the timestamp it was born with here; nothing ever restamps it to the moment it happened to be replayed.

§

Lagged

This subscriber’s outbound queue overflowed for the named session and dropped chunks were lost for it specifically – other subscribers, and this subscriber’s other subscribed sessions, are unaffected. See this type’s own doc comment for why there is no recovery frame to follow it.

Fields

§sequence: u64
§dropped: u64
§

ReplayBoundary

Sent at most once per SubscribeAgentStream subscription per session, right after that session’s replayed instant chunks (Text/Thinking/Blocked pulled from the harness’s own bounded replay ring – see hatchery-harness-service::agent_stream’s own doc comment) and before any live chunk for that session: the marker that lets the operator tell “recent history it missed” apart from “happening right now”. Sent for every session the harness has recorded ANYTHING for at all (state, replay, or both), even if the ring itself turned out empty for it (replayed: 0) – but never for a session the harness has not seen even once, since there is nothing to mark a boundary against there and the first thing that subscriber sees for it will just be live content, unambiguously so. dropped_before_replay is the ring’s own running eviction count – nonzero here means the replay itself is truncated, and it names that gap rather than silently handing back a partial history as if it were the whole one.

Fields

§replayed: u32
§dropped_before_replay: u64
§

Ping

Same keep-alive rationale as HarnessOperatorTerminalEventV1::Ping: this is a physically separate connection with its own dead-peer- detection problem, independent of the terminal and task/run/node subscriptions’ own.

Fields

§sequence: u64

Implementations§

Trait Implementations§

Source§

impl Clone for HarnessOperatorAgentEventV1

Source§

fn clone(&self) -> Self

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 HarnessOperatorAgentEventV1

Source§

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

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

impl<'de> Deserialize<'de> for HarnessOperatorAgentEventV1

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 Eq for HarnessOperatorAgentEventV1

Source§

impl PartialEq for HarnessOperatorAgentEventV1

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl Serialize for HarnessOperatorAgentEventV1

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 HarnessOperatorAgentEventV1

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.