Skip to content

Variable: SessionMessageSchema

Makaio Framework


Makaio Framework / contracts / SessionMessageSchema

const SessionMessageSchema: ZodObject<{ adapterMessageId: ZodOptional<ZodString>; adapterSessionId: ZodOptional<ZodString>; agentId: ZodOptional<ZodString>; blocks: ZodArray<ZodDiscriminatedUnion<[ZodObject<{ content: ZodString; type: ZodLiteral<"text">; }, $strip>, ZodObject<{ source: ZodDiscriminatedUnion<[ZodObject<{ data: …; mimeType: …; type: …; }, $strip>, ZodObject<{ mimeType: …; type: …; url: …; }, $strip>], "type">; type: ZodLiteral<"image">; }, $strip>, ZodObject<{ source: ZodDiscriminatedUnion<[ZodObject<{ data: …; mimeType: …; type: …; }, $strip>, ZodObject<{ mimeType: …; type: …; url: …; }, $strip>], "type">; type: ZodLiteral<"document">; }, $strip>, ZodObject<{ attachmentType: ZodEnum<{ directory: "directory"; file: "file"; }>; displayName: ZodOptional<ZodString>; fileName: ZodString; filePath: ZodString; source: ZodDiscriminatedUnion<[ZodObject<{ data: …; mimeType: …; type: …; }, $strip>, ZodObject<{ mimeType: …; type: …; url: …; }, $strip>], "type">; type: ZodLiteral<"attachment">; }, $strip>], "type">>; contentText: ZodString; editOf: ZodOptional<ZodString>; messageId: ZodString; origin: ZodOptional<ZodEnum<{ compact: "compact"; text: "text"; voice: "voice"; }>>; role: ZodEnum<{ assistant: "assistant"; user: "user"; }>; sessionId: ZodString; timestamp: ZodNumber; turnId: ZodNullable<ZodString>; }, $strip>

Defined in: ../../../packages/contracts/src/session/schemas/message.ts:36

A stored message in a session conversation.

Distinct from shared/Message which is the SDK message format for runtime. SessionMessage includes storage metadata (messageId, turnId, timestamp, etc.).

Messages are first-class entities stored in the messages table.

Design principles:

  • Single source of truth for conversation content
  • Blocks preserve full response fidelity (reasoning, tools)
  • contentText extracted for FTS5 search
  • Events remain for lifecycle/audit only