Expand description
Turning a message’s attachments into what the agent receives (docs/specs/SPEC_AGENT_PANE_IMAGE_ATTACHMENTS_2026_09_26.md §6.6, SPEC_AGENT_PANE_FILE_ATTACHMENTS_2026_09_26.md §7):
- every provider gets a numbered list appended to the text, in an
<attached_files>block: each image’s send-copy, each other file as a copy under its real name, plus notes (type, pages, text version), so any agent that can open a local file can reach every attachment; - Claude (stream-json) additionally gets images inline as
imageblocks and PDFs of up to 100 pages asdocumentblocks, within a count and size budget.
The block is also how the pane rebuilds the tiles on reload: each line
names the attachment and ends with a path that carries the attachment id
(a <sha256>. file name or a named/<sha256>/ folder).
Structs§
- Prepared
- Everything a turn needs from its attachments.
- Resolved
- One attachment resolved to the file the agent gets.
Constants§
- BLOCK_
CLOSE - BLOCK_
OPEN - DEFAULT_
INLINE_ MAX_ COUNT - DEFAULT_
SESSION_ INLINE_ MB - Inline at most this much base64 across one Claude session. Claude Code keeps every inline image in its own session transcript.
- INLINE_
MAX_ B64_ BYTES - Inline at most this many base64 bytes in one Claude message. The API caps a request at 32 MB, and the whole conversation is resent each turn.
- INLINE_
PDF_ MAX_ PAGES - Claude’s PDF support takes at most 100 pages per request on models with less than a 1M-token context; longer PDFs go by path and text version.
Functions§
- append
- The user’s text with the attachment list after it.
- claude_
user_ line - A Claude stream-json user line. With no images,
contentis the plain string it always was; with images, the image blocks come first and the text last, as the Messages API recommends. - clean_
name 🔒 - Names go into a one-line list entry; keep them on one line and short.
- inline_
bytes - Base64 bytes carried by inline blocks, for the session budget.
- list_
block - The
<attached_files>block.inlinedholds the numbers of the items Claude was also given inline. - number_
list 🔒 - “1–3”, “2, 4 and 5”, “1 and 2”: runs of three or more consecutive numbers collapse to a range.
- persisted_
line - The form of a Claude stdin line that AgentMux stores for replay: image
blocks dropped and the content collapsed back to its text, which still
holds the
<attached_images>list. Every reader of stored user lines expectscontentto be a string, and a stored line should never carry megabytes of base64. Lines without an arraycontentpass through. - prepare
- Build the list and (when
inline_max_count > 0) the inline blocks, using at mostinline_budgetbase64 bytes (further capped atINLINE_MAX_B64_BYTESper message). Reads the inlined files from disk. Blocking. - resolve
- Resolve refs to what the agent gets. Refs whose files are gone (swept, or never finished processing) come back as names in the second list. Blocking.