Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions sdks/typescript/packages/core/src/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,17 @@ export const EventSchemas = z.discriminatedUnion("type", [

export type BaseEvent = z.infer<typeof BaseEventSchema>;
export type AGUIEvent = z.infer<typeof EventSchemas>;
/**
* Input-side counterpart to {@link AGUIEvent}.
*
* `AGUIEvent` is the parsed/output shape (`z.infer`), where every field with a
* schema default is required. `AGUIEventInput` is the pre-parse shape
* (`z.input`), where defaulted fields are optional. Emitters constructing
* events to hand to `EventSchemas.parse` should type against this union so the
* compiler checks the discriminated payload without forcing them to restate
* defaults.
*/
export type AGUIEventInput = z.input<typeof EventSchemas>;
export type BaseEventFields = z.infer<typeof BaseEventSchema>;
export type AGUIEventByType = {
[EventType.TEXT_MESSAGE_START]: TextMessageStartEvent;
Expand Down
Loading