Expand description
Extracts the AG-UI event surface from the upstream TypeScript source of
truth (sdks/typescript/packages/core/src/events.ts).
The upstream file is Zod, not a schema format, so this is deliberately a narrow reader rather than a TypeScript parser. It understands exactly the shapes the event declarations use:
export enum EventType { NAME = "VALUE", ... }
export const XEventSchema = BaseEventSchema.extend({ field: z.string().optional(), ... });
export const YEventSchema = XEventSchema.omit({ a: true }).extend({ ... });Anything else is recorded as unparsed and reported as a warning, never as
a failure โ a drift check that cries wolf is a drift check that gets
disabled, which is the outcome this crate exists to prevent.
Structsยง
- Field
- One field of an event payload, as declared upstream.
- Parsed
Schema ๐ - A Zod object schema reduced to an ordered list of
(field, value expression). - Upstream
- The whole upstream event surface.
- Upstream
Event - One event type and the payload the upstream schema declares for it.
Functionsยง
- bare_
ident ๐ - The whole value when it is one identifier and nothing else, as in
metadata: OptionalMetadataSchema. - brief ๐
- Shortens an expression for an error message.
- build_
event ๐ - collect_
const_ ๐decls - Every
const NAME = <expr>;in the file, mapped to its expression text. - event_
type_ ๐literal z.literal(EventType.RAW)->RAW;z.literal("RAW")->RAW.- extract
- Reads
events.tsand returns the event surface it declares. - field_
optionality ๐ - Whether a field is required, and how that was decided when the Zod chain could not decide it.
- is_
required ๐ - A field is optional when its own chain carries
.optional()or.default(). - parse_
event_ ๐type_ enum - Parses
export enum EventType { ... }. - parse_
expr ๐ - Parses
z.object({...})orOtherSchema, followed by a chain of.extend()/.omit()/.pick()/ no-op modifiers. - parse_
object_ ๐literal - Parses
{ key: <expr>, "quoted": <expr> }into ordered pairs. - parse_
primary ๐ - Splits the head of a schema expression from the method chain that follows.
- resolve ๐
- Resolves a schema const to its field list, following
extend/omit/pickchains through other consts. - to_
fields ๐ - Turns
(field, value expression)pairs into fields, dropping the ones every event inherits and deciding required-ness from the Zod chain.