Skip to content

Variable: ATTACHMENT\_TYPES

const ATTACHMENT_TYPES: readonly ["query", "text", "suggested_questions"]

Discriminator for what’s inside a GenieAttachment. Genie only ever populates one of query / text / suggested_questions per attachment. Open via (string & {}) so a new server-side type doesn’t break compilation; the three known types still narrow correctly under switch.

Lifted into the schema as the optional GenieAttachmentSchema.attachment_type field (compute it with detectAttachmentType) so consumers can branch on a literal instead of probing which sub-object key is present. Also surfaced on AttachmentEvent’s payload as attachment_type (vs a bare type) to keep the field clear of the event-union discriminator key.