Skip to main content

Module protocol

Module protocol 

Source
Expand description

The kernel’s request/event interface — one protocol for every peer.

The kernel already exposes one half of a protocol: AgentEvent is a typed, serializable stream of everything a session does (text deltas, tool lifecycle, turn boundaries). This module adds the inbound half, Request, and a versioned, addressed envelope, Frame, so that a client and a peer become the same kind of thing:

  • a request goes into a session’s mailbox,
  • an event comes out of its stream.

A TUI client, a script, and another session differ only in which address (Frame::session) they hold and how they render the stream — not in the protocol they speak. That is what lets the client seam and the future agent-to-agent seam share one implementation.

Transport is deliberately absent: today the seam is an in-process tokio::mpsc; framing and sockets live above the kernel (a future wcode-protocol crate). This module is serde types only, so it adds no behavior — it is the shape the actor (S1) and the socket (S2) will speak.

See docs/interface-protocol-brainstorm.md for the design and the staged path that lands these types.

Structs§

Frame
Versioned, addressed envelope around a Request or an AgentEvent.
SessionId
A session’s stable address.
SessionInfo
A served session’s address plus the little metadata a roster shows: its effective model, reasoning effort, and context window (each None when the server does not know it). Carried by crate::event::AgentEvent::Sessions, so a client can label each member by its own model instead of substituting the root’s.

Enums§

MemberState
A session’s run-state — the server-side liveness fact (bug 2).
Request
Inbound intent: the requests a session’s mailbox accepts.

Constants§

PROTOCOL_VERSION
Wire-protocol major version. Bumped only by a breaking change; additive changes leave it alone. Request already carries a Request::Unknown fallback so an older peer survives a newer request; the matching catch-all on the event side lands with the actor (S1), where an unknown event can be handled rather than silently dropped.
USER
The well-known address of the human peer (brainstorm §5.2): the sender an in-process actor attributes an inbound message to until addressing lands (S4-2).

Functions§

is_inbound
Whether request is an A2A inbound message — the delivery verbs a peer sends (Notify/Interrupt/Wake), as opposed to a local command. The actor runs its before_inbound policy on exactly these.

Type Aliases§

EventFrame
A session-to-client frame.
RequestFrame
A client-to-session frame.