ExtractedDocument
@forge/monorepo / backend/src / ExtractedDocument
Type Alias: ExtractedDocument
ExtractedDocument =
object
Defined in: backend/src/documents/index.ts:73
What a parser produces when it succeeds.
Properties
blocks
readonlyblocks: readonlyDocumentBlock[]
Defined in: backend/src/documents/index.ts:74
confidence?
readonlyoptionalconfidence?:number
Defined in: backend/src/documents/index.ts:107
How confident the extraction is, 0–1 (#132).
Present only for extraction that has a confidence — OCR and vision. A PDF's text layer is not recognised, it is read, so a confidence there would be a number with nothing behind it. Absent therefore means "not a probabilistic extraction", which is a different fact from "confidence unknown".
frontMatter?
readonlyoptionalfrontMatter?:Readonly<Record<string,string>>
Defined in: backend/src/documents/index.ts:99
YAML front matter, when the source had a leading --- block — REQ-050 (#209), task #220.
Scalar keys only, and deliberately not a YAML parser. A nested mapping, a list of mappings or a flow
collection is reported in warnings and otherwise dropped, because a half-correct parse of provenance
metadata is worse than none: generated: { by: x, at: y } silently read as the string { by: x, at: y }
would be recorded as if it had been understood.
It exists because the alternative was worse. Front matter used to reach the block stream as content: a
document's sidebar_position and type became a paragraph, got chunked, embedded, and could be returned as
a retrieval hit and cited. #220 found it while reading the Open Knowledge Format — whose concept files carry
far more metadata than ours — and it was already happening to this repository's own documentation site.
pageCount?
readonlyoptionalpageCount?:number
Defined in: backend/src/documents/index.ts:76
Pages seen. Absent for formats with no pagination — a CSV does not have pages.
truncated
readonlytruncated:boolean
Defined in: backend/src/documents/index.ts:78
True when a limit stopped extraction early. The content is usable; it is just not all of it.
usage?
readonlyoptionalusage?: readonlyobject[]
Defined in: backend/src/documents/index.ts:117
Priced operations this extraction performed (#132, AC-4).
Transport only. The pipeline reports each entry to onPricedOperation and then strips the field
before storing the blob, so a stored document never carries billing data. It lives on the result rather
than in a callback because only the pipeline knows which file and tenant a parse belonged to — a callback
handed to the parser at construction is shared across every file it ever parses, and correlating one
would mean trusting that parses never interleave.
warnings
readonlywarnings: readonlystring[]
Defined in: backend/src/documents/index.ts:85
Things the caller should know that are not failures.
Surfaced rather than logged: "three pages had no text layer" changes how much a user should trust an answer, and a log line does not reach them.