Variable: GenieWriterEventSchema
constGenieWriterEventSchema:ZodUnion<readonly [ZodDiscriminatedUnion<[ZodObject<{content:ZodString;conversation_id:ZodOptional<ZodString>;message_id:ZodOptional<ZodString>;space_id:ZodString;type:ZodLiteral<"question">; },$strip>,ZodObject<{conversation_id:ZodOptional<ZodString>;message:ZodObject<{attachments:ZodOptional<ZodArray<ZodObject<…, …>>>;auto_regenerate_count:ZodOptional<ZodNumber>;content:ZodString;conversation_id:ZodString;created_timestamp:ZodOptional<ZodNumber>;error:ZodOptional<ZodObject<{error: …;type: …; },$strip>>;feedback:ZodOptional<ZodObject<{rating: …; },$strip>>;id:ZodString;last_updated_timestamp:ZodOptional<ZodNumber>;message_id:ZodString;query_result:ZodOptional<ZodObject<{is_truncated: …;row_count: …;statement_id: …;statement_id_signature: …; },$strip>>;space_id:ZodString;status:ZodOptional<ZodUnion<readonly […, …, …, …, …, …, …, …, …, …]>>;user_id:ZodOptional<ZodNumber>; },$strip>;message_id:ZodOptional<ZodString>;space_id:ZodString;type:ZodLiteral<"message">; },$strip>,ZodObject<{conversation_id:ZodOptional<ZodString>;message_id:ZodOptional<ZodString>;previous_status:ZodOptional<ZodUnion<readonly [ZodLiteral<"ASKING_AI">,ZodLiteral<"CANCELLED">,ZodLiteral<"COMPLETED">,ZodLiteral<"EXECUTING_QUERY">,ZodLiteral<"FAILED">,ZodLiteral<"FETCHING_METADATA">,ZodLiteral<"FILTERING_CONTEXT">,ZodLiteral<"PENDING_WAREHOUSE">,ZodLiteral<"QUERY_RESULT_EXPIRED">,ZodLiteral<"SUBMITTED">]>>;space_id:ZodString;status:ZodUnion<readonly [ZodLiteral<"ASKING_AI">,ZodLiteral<"CANCELLED">,ZodLiteral<"COMPLETED">,ZodLiteral<"EXECUTING_QUERY">,ZodLiteral<"FAILED">,ZodLiteral<"FETCHING_METADATA">,ZodLiteral<"FILTERING_CONTEXT">,ZodLiteral<"PENDING_WAREHOUSE">,ZodLiteral<"QUERY_RESULT_EXPIRED">,ZodLiteral<"SUBMITTED">]>;type:ZodLiteral<"status">; },$strip>],"type">,ZodDiscriminatedUnion<[ZodObject<{content:ZodString;conversationId:ZodOptional<ZodString>;messageId:ZodOptional<ZodString>;spaceId:ZodString;type:ZodLiteral<"started">; },$strip>,ZodObject<{answer:ZodOptional<ZodString>;conversationId:ZodOptional<ZodString>;messageId:ZodOptional<ZodString>;spaceId:ZodString;statementIds:ZodArray<ZodString>;status:ZodCustom<"ASKING_AI"|"CANCELLED"|"COMPLETED"|"EXECUTING_QUERY"|"FAILED"|"FETCHING_METADATA"|"FILTERING_CONTEXT"|"PENDING_WAREHOUSE"|"QUERY_RESULT_EXPIRED"|"SUBMITTED","ASKING_AI"|"CANCELLED"|"COMPLETED"|"EXECUTING_QUERY"|"FAILED"|"FETCHING_METADATA"|"FILTERING_CONTEXT"|"PENDING_WAREHOUSE"|"QUERY_RESULT_EXPIRED"|"SUBMITTED">;type:ZodLiteral<"ask_genie_done">; },$strip>,ZodObject<{conversationId:ZodOptional<ZodString>;error:ZodString;messageId:ZodOptional<ZodString>;spaceId:ZodOptional<ZodString>;type:ZodLiteral<"error">; },$strip>,ZodObject<{dataItems:ZodNumber;items:ZodNumber;spaceId:ZodString;textItems:ZodNumber;type:ZodLiteral<"summary">; },$strip>],"type">]>
The unified writer-event vocabulary subscribers see on
ctx.writer: the wire-derived GenieChatEvent union
plus Mastra-only events from GenieAgentEvent. Each
variant is a flat {type, ...fields} object; consumers narrow
on type and read fields inline - there is no payload wrapper
and no writer-boundary translator.
Composed via z.union (not z.discriminatedUnion) because
both halves are themselves discriminated unions on the same
type key.