Function: normalizeToBlocks()
Makaio Framework / services-core / normalizeToBlocks
Function: normalizeToBlocks()
Section titled “Function: normalizeToBlocks()”normalizeToBlocks(
message): ({content:string;type:"text"; } | {source: {data:string;mimeType:string;type:"base64"; } | {mimeType?:string;type:"url";url:string; };type:"image"; } | {source: {data:string;mimeType:string;type:"base64"; } | {mimeType?:string;type:"url";url:string; };type:"document"; } | {attachmentType:"file"|"directory";displayName?:string;fileName:string;filePath:string;source: {data:string;mimeType:string;type:"base64"; } | {mimeType?:string;type:"url";url:string; };type:"attachment"; } | {content:string;metadata?:Record<string,unknown>;type:"reasoning"; } | {args:Record<string,unknown>;name:string;toolCallId:string;type:"tool_call"; } | {isError?:boolean;output:string;toolCallId:string;type:"tool_output"; })[]
Defined in: ../../../packages/services/core/src/session/utils/message-utils.ts:35
Normalize MessageInput to SessionMessageBlock[] for storage. Preserves structured blocks instead of flattening to a single text block.
Parameters
Section titled “Parameters”message
Section titled “message”string | { blocks: { content: string; type: "text"; } | { source: { data: string; mimeType: string; type: "base64"; } | { mimeType?: string; type: "url"; url: string; }; type: "image"; } | { source: { data: string; mimeType: string; type: "base64"; } | { mimeType?: string; type: "url"; url: string; }; type: "document"; } | { attachmentType: "file" | "directory"; displayName?: string; fileName: string; filePath: string; source: { data: string; mimeType: string; type: "base64"; } | { mimeType?: string; type: "url"; url: string; }; type: "attachment"; } | { content: string; metadata?: Record<string, unknown>; type: "reasoning"; } | { args: Record<string, unknown>; name: string; toolCallId: string; type: "tool_call"; } | { isError?: boolean; output: string; toolCallId: string; type: "tool_output"; } | ({ content: string; type: "text"; } | { source: { data: string; mimeType: string; type: "base64"; } | { mimeType?: string; type: "url"; url: string; }; type: "image"; } | { source: { data: string; mimeType: string; type: "base64"; } | { mimeType?: string; type: "url"; url: string; }; type: "document"; } | { attachmentType: "file" | "directory"; displayName?: string; fileName: string; filePath: string; source: { data: string; mimeType: string; type: "base64"; } | { mimeType?: string; type: "url"; url: string; }; type: "attachment"; } | { content: string; metadata?: Record<string, unknown>; type: "reasoning"; } | { args: Record<string, unknown>; name: string; toolCallId: string; type: "tool_call"; } | { isError?: boolean; output: string; toolCallId: string; type: "tool_output"; })[]; role?: "user" | "assistant" | "system"; }
The message input (string or structured)
Returns
Section titled “Returns”Array of SessionMessageBlock for storage