skip to content
$worker

document

v0.1.9

Convert Word, PowerPoint, Excel, OpenDocument, RTF, EPUB, CSV and PDF documents to markdown on this machine, detect the format from the bytes, pull out the images embedded in them, and transcribe a scan by rendering its pages and reading them with a vision model.

iiiverified
4 installs0 in 7d0 today
install
$iii trigger compose::add worker=document@0.1.9
  • macOS: arm64 · x64
  • Linux: arm64 · armv7 · x64
  • Windows: arm64 · x64

exact versions are immutable; binary and bundle artifacts are digest-pinned.

functions

1

document::detect

function

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.

request
  • 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 2
    valuenull
  • pathstring

    Filesystem path to the document. Mutually exclusive with `bytes_base64`.

response
  • 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 1
    one of (3)
    variant 1
    valuestringenum: requested
    variant 2
    valuestringenum: content
    variant 3
    valuestringenum: extension
    variant 2
    valuenull
  • 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 1
    one of (5)
    variant 1
    valuestringenum: prose
    variant 2
    valuestringenum: spreadsheet
    variant 3
    valuestringenum: presentation
    variant 4
    valuestringenum: book
    variant 5
    valuestringenum: pdf
    variant 2
    valuenull
  • 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 1
    one of (12)
    variant 1
    valuestringenum: doc
    variant 2
    valuestringenum: docx
    variant 3
    valuestringenum: odt
    variant 4
    valuestringenum: rtf
    variant 5
    valuestringenum: ppt
    variant 6
    valuestringenum: pptx
    variant 7
    valuestringenum: odp
    variant 8
    valuestringenum: excel
    variant 9
    valuestringenum: ods
    variant 10
    valuestringenum: csv
    variant 11
    valuestringenum: epub
    variant 12
    valuestringenum: pdf
    variant 2
    valuenull
  • 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.

triggers

0
no triggers registered