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
.txtthat 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§
- Inflight
Guard 🔒 - 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.
- Send
Target - 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_bytesof 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”.
Nonefor 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, …) andSKIPPED_DIRSare 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
AppStateto 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_imagesis always empty now that any file can be attached; the field stays for older frontends. Pure apart from reading metadata.