Stage file attachments for a conversation message, delete staged files, finalize uploads into the durable session store, and read bounded upload previews.
Use this file to discover all available pages before exploring further.
window.api.uploads manages the lifecycle of file attachments before they are sent to the agent. Files are staged in a temporary pending directory, then either finalized (moved to the durable session artifact store) when the message is sent, or deleted individually when the user removes them from the message composer. All file access is mediated through the main process — the renderer never receives raw filesystem access.
Copies one or more files into the app-managed upload staging area. Returns an UploadedAttachment for each file with a temporary sessionId of '.pending' until the session is finalized.The content field of each StageUploadFile must be a base64-encoded string of the file’s bytes.
Deletes a single staged upload file from the staging area. Call this when the user removes an attachment chip from the composer before sending the message.
Moves pending staged uploads into the durable session directory once an ACP session ID exists. Call this after window.api.acp.createSession() returns a sessionId and before (or alongside) sendPrompt. The returned attachments have their sessionId updated to the real session ID and their path updated to the durable location.
Reads a bounded preview of a staged upload file. Uses the same ArtifactPreviewResult shape as window.api.artifacts.readPreview so preview components can handle both artifact and upload previews uniformly.
The record returned by stageFiles and finalizeSession. Pass this directly to AcpPromptRequest.attachments.
Field
Type
Description
id
string
Unique attachment identifier
sessionId
string
'.pending' before finalization; real ACP session ID after
name
string
Safe filename used in storage
originalName
string
Original filename as provided by the user
path
string
Absolute path to the file on disk
mimeType
string | undefined
MIME type when provided
size
number
File size in bytes
Use the exported getUploadedAttachmentName helper from src/shared/uploads to display the best available filename — it returns originalName if present, falling back to name for older records.