Durable local Session Resources (ADR 0021).
Pixir treats attachments and ACP resource links as local resources owned by
the Session, not as Presenter blobs and not as ambient model context. When the
original bytes are available, they stay on disk under
.pixir/sessions/<session_id>/resources/; the Log records only a descriptor
with a Session-local resource_id and, for stored payloads, a byte identity
content_sha256.
Provider-specific shapes such as Responses input_image are projections across
the Leakage Boundary. They are assembled from descriptors only when Pixir
intentionally sends a resource to OpenAI.
Summary
Functions
Copy stored resource payloads referenced in replayed Events from parent to child Session.
Return the Provider-ready data URL for a resource descriptor.
Find one resource descriptor in folded History by Session resource id.
Ingest supported attachment maps into the Session Resource store.
Render a compact, text-only descriptor for default replay.
Build a text block for one or more descriptors.
Resolve a descriptor to an on-disk path without reading the payload.
Types
@type descriptor() :: map()
Functions
@spec copy_referenced_resources(String.t(), String.t(), [map()], keyword()) :: :ok | {:error, map()}
Copy stored resource payloads referenced in replayed Events from parent to child Session.
Link-only descriptors without content_sha256 are skipped. Payload copy uses the same
resource_id and checksum paths under the child Session store.
@spec data_url(String.t(), descriptor(), keyword()) :: {:ok, String.t()} | {:error, map()}
Return the Provider-ready data URL for a resource descriptor.
@spec find_descriptor([map()], String.t()) :: {:ok, descriptor()} | {:error, map()}
Find one resource descriptor in folded History by Session resource id.
@spec ingest_attachments(String.t(), [map()] | nil, keyword()) :: {:ok, [descriptor()]} | {:error, map()}
Ingest supported attachment maps into the Session Resource store.
Callers may pass T3-style image attachment maps (type, name, mimeType,
sizeBytes, dataUrl), Pixir-native snake-case variants, or ACP
resource_link blocks (uri, name, mimeType, size). Local file://
links are copied into Pixir's Session Resource store when readable. Remote or
unsupported links are recorded as link-only descriptors and are not
rehydratable until a later explicit import/fetch records bytes.
Raw base64 and local source paths never appear in the returned descriptors.
@spec render_descriptor(descriptor()) :: String.t()
Render a compact, text-only descriptor for default replay.
@spec render_descriptors([descriptor()]) :: String.t()
Build a text block for one or more descriptors.
@spec resource_path(String.t(), descriptor(), String.t()) :: {:ok, String.t()} | {:error, map()}
Resolve a descriptor to an on-disk path without reading the payload.