Skip to content

storage:message

FieldValue
Prefixstorage:message
Namespace constantMessageStorageNamespace
Subjects constantMessageStorageSubjects
Kindstorage
Schema record<inline>
Tierframework
Package@makaio/contracts
Defined inpackages/contracts/src/session/message-storage-namespace.ts
KeyWireTypeSchema
appendstorage:message.appendrpc
ftsSearchstorage:message.ftsSearchrpc
getstorage:message.getrpc
getByAdapterMessageIdstorage:message.getByAdapterMessageIdrpc
getBySessionstorage:message.getBySessionrpc
getByTurnstorage:message.getByTurnrpc
searchstorage:message.searchrpc
storedstorage:message.storedevent
upsertByAdapterMessageIdstorage:message.upsertByAdapterMessageIdrpc

Append a message to a turn.

Subject: storage:message.append Type: Request (RPC)

Request:

FieldTypeRequired
emitEventboolean | undefinedno
message{ role: "user" | "assistant"; 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; })[]; sessionId: string; timestamp: number; turnId: string | null; contentText: string; origin?: "text" | "voice" | "compact" | undefined; adapterSessionId?: string | undefined; agentId?: string | undefined; adapterMessageId?: string | undefined; editOf?: string | undefined; messageId?: string | undefined; }yes

Response:

FieldTypeRequired
message{ messageId: string; turnId: string | null; sessionId: string; role: "user" | "assistant"; contentText: 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; })[]; timestamp: number; agentId?: string | undefined; adapterSessionId?: string | undefined; adapterMessageId?: string | undefined; editOf?: string | undefined; origin?: "text" | "voice" | "compact" | undefined; }yes

Full-text search over messages using FTS5 with BM25 scores and excerpts.

Subject: storage:message.ftsSearch Type: Request (RPC)

Unlike search, this subject returns scored results with highlighted excerpts — suitable for ranking and display in search UIs.

Request:

FieldTypeRequired
limitnumberyes
querystringyes
sessionIdstring | undefinedno

Response:

FieldTypeRequired
results{ messageId: string; sessionId: string; score: number; excerpt: string; }[]yes
totalnumberyes

Get a single message by ID.

Subject: storage:message.get Type: Request (RPC)

Request:

FieldTypeRequired
messageIdstringyes

Response:

FieldTypeRequired
message{ messageId: string; turnId: string | null; sessionId: string; role: "user" | "assistant"; contentText: 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; })[]; timestamp: number; agentId?: string | undefined; adapterSessionId?: string | undefined; adapterMessageId?: string | undefined; editOf?: string | undefined; origin?: "text" | "voice" | "compact" | undefined; } | nullyes

storage:message.getByAdapterMessageId (rpc)

Section titled “storage:message.getByAdapterMessageId (rpc)”

Get a message by adapter message ID.

Subject: storage:message.getByAdapterMessageId Type: Request (RPC)

Request:

FieldTypeRequired
adapterMessageIdstringyes

Response:

FieldTypeRequired
message{ messageId: string; turnId: string | null; sessionId: string; role: "user" | "assistant"; contentText: 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; })[]; timestamp: number; agentId?: string | undefined; adapterSessionId?: string | undefined; adapterMessageId?: string | undefined; editOf?: string | undefined; origin?: "text" | "voice" | "compact" | undefined; } | nullyes

Get messages for a session.

Subject: storage:message.getBySession Type: Request (RPC)

Request:

FieldTypeRequired
after{ timestamp: number; messageId: string; } | undefinedno
includeAfterboolean | undefinedno
limitnumber | undefinedno
order"asc" | "desc" | undefinedno
sessionIdstringyes

Response:

FieldTypeRequired
messages{ messageId: string; turnId: string | null; sessionId: string; role: "user" | "assistant"; contentText: 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; })[]; timestamp: number; agentId?: string | undefined; adapterSessionId?: string | undefined; adapterMessageId?: string | undefined; editOf?: string | undefined; origin?: "text" | "voice" | "compact" | undefined; }[]yes
nextCursor{ timestamp: number; messageId: string; } | nullyes

Get messages for a turn.

Subject: storage:message.getByTurn Type: Request (RPC)

Request:

FieldTypeRequired
turnIdstringyes

Response:

FieldTypeRequired
messages{ messageId: string; turnId: string | null; sessionId: string; role: "user" | "assistant"; contentText: 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; })[]; timestamp: number; agentId?: string | undefined; adapterSessionId?: string | undefined; adapterMessageId?: string | undefined; editOf?: string | undefined; origin?: "text" | "voice" | "compact" | undefined; }[]yes

Search messages using FTS5.

Subject: storage:message.search Type: Request (RPC)

Request:

FieldTypeRequired
limitnumber | undefinedno
querystringyes
sessionIdstring | undefinedno

Response:

FieldTypeRequired
messages{ messageId: string; turnId: string | null; sessionId: string; role: "user" | "assistant"; contentText: 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; })[]; timestamp: number; agentId?: string | undefined; adapterSessionId?: string | undefined; adapterMessageId?: string | undefined; editOf?: string | undefined; origin?: "text" | "voice" | "compact" | undefined; }[]yes
totalnumberyes

Emitted after a message is successfully persisted.

Subject: storage:message.stored Type: Event (fire-and-forget via bus.emit)

FieldTypeRequired
message{ messageId: string; turnId: string | null; sessionId: string; role: "user" | "assistant"; contentText: 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; })[]; timestamp: number; agentId?: string | undefined; adapterSessionId?: string | undefined; adapterMessageId?: string | undefined; editOf?: string | undefined; origin?: "text" | "voice" | "compact" | undefined; }yes

storage:message.upsertByAdapterMessageId (rpc)

Section titled “storage:message.upsertByAdapterMessageId (rpc)”

Upsert a message by adapterMessageId (for imports).

Subject: storage:message.upsertByAdapterMessageId Type: Request (RPC)

Request:

FieldTypeRequired
adapterMessageIdstringyes
adapterSessionIdstring | undefinedno
agentIdstring | undefinedno
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; })[]yes
contentTextstringyes
origin"text" | "voice" | "compact" | undefinedno
role"user" | "assistant"yes
sessionIdstringyes
timestampnumberyes
turnIdstring | nullyes

Response:

FieldTypeRequired
createdbooleanyes
messageIdstringyes

Auto-generated by yarn docs:bus. Do not edit manually.