Skip to content

Type Alias: MakaioSessionEvent

Makaio Framework


Makaio Framework / contracts / MakaioSessionEvent

MakaioSessionEvent = z.infer<typeof MakaioSessionEventSchema>

Defined in: ../../../packages/contracts/src/session/types.ts:58

A persisted session event — Zod-inferred type from MakaioSessionEventSchema.

This is the type returned by storage handlers and bus responses. It includes the plugin catch-all variant (type: string, payload: Record<string, unknown>) which prevents TypeScript switch narrowing.

For code that needs discriminated-union narrowing (switch/case on event.type), use isKnownSessionEvent to guard into KnownSessionEvent first.

  • KnownSessionEvent — narrowable discriminated union
  • isKnownSessionEvent — type guard for narrowing
  • MakaioSessionEvent
    • z.infer<typeof MakaioSessionEventSchema>
      • typeof MakaioSessionEventSchema
type MakaioSessionEvent = {
sessionId: string;
eventId: string;
timestamp: number;
type: string;
payload: Record<string, unknown> | { sessionId: string; turnId: string; turnNumber: number; messageId: string; agentIds: Array<string>; initiator?: { source: 'user' | 'system' | 'extension'; sourceId?: string | undefined; } | undefined; } | { sessionId: string; turnId: string; turnNumber: number; success: boolean; error?: string | undefined; initiator?: { source: 'user' | 'system' | 'extension'; sourceId?: string | undefined; } | undefined; } | { sessionId: string; turnId: string; turnNumber: number; messageId: string; content: string | { blocks: { type: 'text'; content: string; } | { type: 'image'; source: { type: 'base64'; data: string; mimeType: string; } | { type: 'url'; url: string; mimeType?: string | undefined; }; } | { type: 'document'; source: { type: 'base64'; data: string; mimeType: string; } | { type: 'url'; url: string; mimeType?: string | undefined; }; } | { type: 'attachment'; fileName: string; filePath: string; source: { type: 'base64'; data: string; mimeType: string; } | { type: 'url'; url: string; mimeType?: string | undefined; }; attachmentType: 'file' | 'directory'; displayName?: string | undefined; } | { type: 'reasoning'; content: string; metadata?: Record<string, unknown> | undefined; } | { type: 'tool_call'; toolCallId: string; name: string; args: Record<string, unknown>; } | { type: 'tool_output'; toolCallId: string; output: string; isError?: boolean | undefined; } | Array<{ type: 'text'; content: string; } | { type: 'image'; source: { type: 'base64'; data: string; mimeType: string; } | { type: 'url'; url: string; mimeType?: string | undefined; }; } | { type: 'document'; source: { type: 'base64'; data: string; mimeType: string; } | { type: 'url'; url: string; mimeType?: string | undefined; }; } | { type: 'attachment'; fileName: string; filePath: string; source: { type: 'base64'; data: string; mimeType: string; } | { type: 'url'; url: string; mimeType?: string | undefined; }; attachmentType: 'file' | 'directory'; displayName?: string | undefined; } | { type: 'reasoning'; content: string; metadata?: Record<string, unknown> | undefined; } | { type: 'tool_call'; toolCallId: string; name: string; args: Record<string, unknown>; } | { type: 'tool_output'; toolCallId: string; output: string; isError?: boolean | undefined; }>; role?: 'user' | 'assistant' | 'system' | undefined; }; agentIds: Array<string>; source?: 'user' | 'system' | 'extension' | undefined; origin?: 'text' | 'voice' | 'compact' | undefined; } | { sessionId: string; turnId: string; turnNumber: number; messageId: string; agentId: string; } | { sessionId: string; turnId: string; turnNumber: number; messageId: string; agentId: string; outcome: 'error' | 'completed' | 'superseded' | 'merged' | 'cancelled' | 'rejected'; supersededBy?: string | undefined; mergedInto?: string | undefined; error?: string | undefined; } | { sessionId: string; adapterSessionId: string; agentId: string; adapterId: string; adapterName: string; role?: 'lead' | 'member' | undefined; model?: string | undefined; cwd?: string | undefined; } | { messageId: string; turnId: string | null; role: 'user' | 'assistant'; } | { childSessionId: string; parentSessionId: string; kind: 'fork' | 'subagent' | 'compress' | 'branch' | 'aside' | 'rewrite' | 'coordinator'; forkPointMessageId?: string | undefined; } | { childSessionId: string; parentSessionId: string; resultJson?: string | undefined; resultMessageId?: string | undefined; } | { summaryJson: string; tokensBefore?: number | undefined; tokensAfter?: number | undefined; compressedMessageIds?: Array<string> | undefined; };
};