Skip to content

Function: createAttachmentArtifacts()

Makaio Framework


Makaio Framework / services-core / createAttachmentArtifacts

createAttachmentArtifacts(storeArtifact, sessionId, messageId, blocks): Promise<void>

Defined in: ../../../packages/services/core/src/session/attachment-artifacts.ts:84

Creates session-scoped artifacts for attachment blocks in a user message.

Called after message storage. Delegates persistence to storeArtifact so this function remains free of host plugin dependencies — the host (host layer) owns the storage subject and wires the bus call.

Breaking change: previously accepted IMakaioBus and relied on the artifacts storage subject from @makaio/contracts. The callback signature decouples the framework from that bus + subject wiring.

Each attachment block becomes a user-upload artifact in the session scope, with metadata linking it back to the originating message.

StoreArtifactFn

Host-provided callback to persist one artifact

string

Session containing the message

string

Message containing the attachments

({ 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"; })[]

Normalized message blocks (already stored)

Promise<void>