document::detect
Identify a document's file format from its bytes. Reports the family it belongs to and whether this worker can convert it, falling back to the file name for CSV, which carries no signature. Microseconds, and no conversion.
- bytes_base64string
Base64-encoded document bytes, for a document with no path — an attachment held in memory. Mutually exclusive with `path`.
- file_namestring
Original file name for `bytes_base64`, used only to recognise a format the content cannot name (`.csv`). Ignored when `path` is set.
- fs_scopeany of
Filesystem jail for this call. Stamped by the harness on an agent's call; absent on an operator or console call.
any of (2)variant 1- grantsstring[]
Additional directories or files explicitly granted to this session.
- rootstringrequired
The session's working directory.
variant 2valuenull - pathstring
Filesystem path to the document. Mutually exclusive with `bytes_base64`.
- convertiblebooleanrequired
`true` when `document::to-markdown` can convert this file.
- detected_fromany of
How the format was arrived at. `extension` is the weaker claim: the content matched nothing known, and only the file name suggested this.
any of (2)variant 1one of (3)variant 1valuestringenum: requestedvariant 2valuestringenum: contentvariant 3valuestringenum: extensionvariant 2valuenull - elapsed_msinteger· uint64requiredmin 0
Wall-clock time for the detection.
- familyany of
What the document is: prose, a spreadsheet, a presentation, a book, a PDF. Absent when the format is unknown.
any of (2)variant 1one of (5)variant 1valuestringenum: prosevariant 2valuestringenum: spreadsheetvariant 3valuestringenum: presentationvariant 4valuestringenum: bookvariant 5valuestringenum: pdfvariant 2valuenull - formatany of
The format, or `null` when nothing recognised it. A null means the file is not one of the formats this worker reads — an image, an archive, a plain text file — not that it is broken.
any of (2)variant 1one of (12)variant 1valuestringenum: docvariant 2valuestringenum: docxvariant 3valuestringenum: odtvariant 4valuestringenum: rtfvariant 5valuestringenum: pptvariant 6valuestringenum: pptxvariant 7valuestringenum: odpvariant 8valuestringenum: excelvariant 9valuestringenum: odsvariant 10valuestringenum: csvvariant 11valuestringenum: epubvariant 12valuestringenum: pdfvariant 2valuenull - has_assetsbooleanrequired
`true` when the format can carry embedded assets for `document::extract-assets` to pull out. False for a PDF, which converts straight to markdown without a document model, and for a CSV, which is rows of text with nowhere to put a picture. A caller routing on this should not spend a call to be told a spreadsheet has no images.
- size_bytesinteger· uint64requiredmin 0
Size of the document in bytes.
- sourcestringrequired
Source label: the file name, or `<inline>` for an in-memory document that arrived without one.