Expand description
Extracts the event surface from crates/ag-ui/src/event/**/*.rs.
Deliberately a text scanner, not a compiler: drift-check has to keep
working while ag-ui is mid-refactor and does not build. It reads
whichever of the two shapes the crate uses (or both at once):
- a
#[serde(tag = "type")]enum, where the wire tag is either an explicit#[serde(rename = "TEXT_MESSAGE_START")]or the variant name; - a macro table that generates that enum, whose entries pair a payload type
with its tag (
TextMessageStart(TextMessageStartEvent) => "TEXT_MESSAGE_START"); - per-event payload structs named
<Name>Event, where the wire tag follows from the type name.
It also reads the BaseEvent envelope on its own. That struct is not an
event type β it is flattened into every payload β so it belongs to none of
the shapes above, and its fields are fields of all 36 events.
StructsΒ§
- Item π
- Parsed
Fields π - Rust
Base Event - The envelope every event payload flattens in, as the Rust source declares it.
- Rust
Event - One event type as the Rust source declares it.
- Rust
Field - One field of an event payload, named as it appears on the wire.
- Rust
Surface - Everything the scan found.
- Union
Member π - One member of the tagged union, wherever it was declared.
EnumsΒ§
- Item
Kind π
ConstantsΒ§
- BASE_
EVENT - The envelope struct every payload flattens in. Not an event type itself, but its fields are fields of every event, so it is read separately.
- NOT_
EVENTS π - Structs that end in
Eventbut are envelope plumbing, not event types.
FunctionsΒ§
- arg_
value π rename = "X"inside a serde argument list.- collect_
rs_ πfiles - container_
rename_ πall - field_
head π pub message_id: MessageId,-> (message_id, offset ofMessageId).- find_
type_ πend - Length of the type expression at the start of
s, up to the,that ends the field. Generics, tuples and slices nest. - has_
flag π - A bare
flatten/skip/defaultflag inside a serde argument list. - is_
wire_ πtag - Whether a string has the shape of an AG-UI event tag.
- item_
body π - Body of the item whose name ends at
at, plus the offset just past it. - item_
head π - Recognises
pub struct Foo,enum Bar,pub(crate) mod bazandsome_macro! {heads. - parse_
fields π - Reads named fields out of a struct or struct-variant body.
- parse_
macro_ πtable - Reads a macro table that pairs payload types with wire tags, as in
TextMessageStart(TextMessageStartEvent) => "TEXT_MESSAGE_START",. - parse_
variants π - Reads the variants of a
#[serde(tag = "type")]enum. - relative π
- scan
- Scans
dirrecursively for the event surface. - scan_
items π - Walks top-level items, carrying each oneβs attributes with it.
- screaming_
snake_ πliteral - The first
"SCREAMING_SNAKE"string literal inentry. - serde_
args π - The argument lists of every
serde(...)attribute inattrs. - strip_
attributes π - Removes
#[...]attributes from a macro-table entry. - variant_
call π - The first
Variant(PayloadType)inentry, as(variant, payload).