Expand description
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.
Office files are ZIPs, so every read here is bounded: an entry-count cap, a declared compression-ratio cap, one decompressed-bytes budget shared by all parts (the zip crate never reads past an entry’s declared size, so the declared sizes bound the work), quick-xml with predefined entities only, a cap on the text produced, and a wall-clock deadline.
Parsing runs in a child process (CHILD_ARG): srv re-runs its own
executable, reads the result from its stdout and kills it after
DEADLINE. Whatever a hostile file does to a parser (panic, deep
recursion, a sheet that loads for minutes, memory) happens to the child.
Structs§
- Extract
Error - Why no text version was made.
- PdfFacts
- What can be read out of a PDF.
Constants§
- CHILD_
ARG - The hidden argument srv re-executes itself with to read a document in a
separate process:
srv __extract <pdf|text> <kind> <path> <name>(seerun_childandmain.rs). - DEADLINE
- MAX_
COMPRESSION_ RATIO - An entry claiming more than this ratio of uncompressed to compressed size is treated as a bomb.
- MAX_
DECOMPRESSED_ BYTES - Total bytes all parts of one document may decompress to.
- MAX_
PDF_ BYTES_ FOR_ COUNT - PDFs larger than this aren’t opened for a page count.
- MAX_
TEXT_ BYTES - Text versions are cut here (Codex refuses prompts over ~1M characters).
- MAX_
ZIP_ ENTRIES - PREVIEW_
BYTES - PREVIEW_
LINES
Functions§
- document_
text - Text version of a Word/Excel/PowerPoint/RTF document, in this process.
Production code calls
document_text_isolated. - document_
text_ isolated document_textin the child process.- has_
macros - Whether an OOXML package carries a VBA project, whatever its extension.
- office_
text - Text version of an Office document (
kindWord/Excel/PowerPoint), with a header saying where it came from.Ok(None)for kinds with no text version (legacy binary .doc/.ppt). - pdf_
facts_ in_ process - Page count and text of a PDF, in this process. PDF parsers can panic or
recurse deeply on malformed input: production code calls
pdf_facts_isolated, which runs this in the child process. - pdf_
facts_ isolated pdf_facts_in_processin the child process. A crash or timeout just means no facts.- rtf_
text - Plain text of an RTF document: control words dropped,
{\*…}and a few non-text destinations skipped,\par/\line/\tab,\'hhand\uNdecoded. - run_
child - Entry point for the child process:
srv __extract <mode> <kind> <path> <name>. PrintsPdfFacts(pdf) or a text outcome (text) as JSON. - text_
preview - The first lines of a text file, cut at a UTF-8 boundary.