Skip to main content

Module attachments

Module attachments 

Source
Expand description

Attachments for the agent composer: ingest from paths, process on a bounded blocking pool, report progress on the event bus, and keep a content-addressed store with retention by last use. docs/specs/SPEC_AGENT_PANE_IMAGE_ATTACHMENTS_2026_09_26.md §6, SPEC_AGENT_PANE_FILE_ATTACHMENTS_2026_09_26.md.

Re-exports§

pub use kind::FileKind;
pub use store::is_valid_id;
pub use store::Kind;
pub use store::Store;

Modules§

extract
Everything derived from a non-image attachment: a short text preview for the tile, a text version of Office documents (no agent reads those), the page count of a PDF, and whether an Office file carries macros. docs/specs/SPEC_AGENT_PANE_FILE_ATTACHMENTS_2026_09_26.md §6.
kind
What kind of file an attachment is, decided by content first and the name’s extension second (a .txt that is really a ZIP is not text). docs/specs/SPEC_AGENT_PANE_FILE_ATTACHMENTS_2026_09_26.md §5.
process
Sniff, decode and derive the two files an attachment needs besides its original: a small thumbnail for the composer and transcript, and the “send-copy” the agent actually receives. SPEC_AGENT_PANE_IMAGE_ATTACHMENTS_2026_09_26.md §6.4.
prompt
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):
store
The on-disk attachment store: content-addressed originals, derived files, and the retention sweep. SPEC_AGENT_PANE_IMAGE_ATTACHMENTS_2026_09_26.md §6.3.

Structs§

InflightGuard 🔒
One job’s claim on an id in Service::inflight, released on drop.
Limits
Limits and knobs, read from settings on every ingest.
Plan
The outcome of classifying an ingest request against the limits.
SendTarget
One attachment as delivered to an agent.
Service

Constants§

DECODE_BUDGET_MIB 🔒
Estimated decode memory all running jobs may hold at once, in MiB. A job reserves process::decode_cost_bytes of it from the image header before decoding; one bigger than the whole budget takes all of it and runs alone.
DEFAULT_MAX_FILES
DEFAULT_MAX_TOTAL_MB
DEFAULT_RETENTION_DAYS
DEFAULT_SEND_MAX_EDGE
MAX_WALK_ENTRIES 🔒
Folder drops are walked for images; stop after this many entries so a drop of a home directory can’t hang the server.
PROGRESS_INTERVAL 🔒
Minimum gap between two progress events for the same item.
SKIPPED_DIRS 🔒
Folders skipped when a dropped folder is expanded: dependency, build and VCS trees that would fill the 128-file limit with noise. SPEC_AGENT_PANE_FILE_ATTACHMENTS_2026_09_26.md §8.
SWEEP_INTERVAL 🔒

Statics§

SERVICE 🔒

Functions§

blocking 🔒
Run blocking work off the async workers, turning a panic into an error.
display_name 🔒
file_note 🔒
“PDF, 12 pages; text version: /…/text.txt”, “Word document; no text version, save it as .docx”, “spreadsheet; contains macros”. None for images and for kinds with nothing to add.
files_in_dir 🔒
Files under dir, depth-first, sorted by name. Hidden files and folders (a leading dot: .git, .env, …) and SKIPPED_DIRS are left out — only a file dropped on its own is attached whatever its name.
format_limit 🔒
get
The service when it has been initialised (by the RPC or HTTP layer). Prompt delivery uses this: it has no AppState to initialise from.
init
The process-wide service. The first call creates the store and starts the retention timer; later calls return the same instance.
plan
Every dropped file (and every file in a dropped folder) against the limits. non_images is always empty now that any file can be attached; the field stays for older frontends. Pure apart from reading metadata.