ConusAI vendor v0.1.0-dev.20261027+9b1131fb
ci / gate (push) Waiting to run

This commit is contained in:
ConusAI vendor v0.1.0-dev.20261027+9b1131fb
2026-10-27 18:05:17 +00:00
commit 3102273ec7
538 changed files with 80203 additions and 0 deletions
+54
View File
@@ -0,0 +1,54 @@
// The module's closed vocabularies, in a file with no import: the schemas build their enums from
// these, and a browser bundle can take them without loading the data layer the schemas live beside.
export const DOCUMENT_STATUSES = ["processing", "extracted", "failed"] as const
export type DocumentStatus = (typeof DOCUMENT_STATUSES)[number]
/** Why a document failed, as a code. A reason carrying document text would be a customer's value in a log. */
export const FAILURE_CODES = [
"file_missing",
"file_changed",
"ocr_failed",
"extraction_refused",
"extraction_truncated",
"extraction_invalid",
] as const
export type FailureCode = (typeof FAILURE_CODES)[number]
/**
* Whether the words an extractor quoted were found on the page they cite. A line whose quote is not
* there is not dropped and not trusted: it is `needs_review`, and says so to the reviewer.
*/
export const LINE_VERIFICATIONS = ["verified", "needs_review"] as const
export type LineVerification = (typeof LINE_VERIFICATIONS)[number]
/**
* What kind of page the reader found, from its own signals (ocr-service OCR3.15): `text` a born-digital
* text layer, `table`, `drawing` (a technical sheet: a few labels or hundreds of short fragments),
* `scan` (a recognised text page) and `empty`.
*/
export const PAGE_CLASSES = ["text", "table", "drawing", "scan", "empty"] as const
export type PageClass = (typeof PAGE_CLASSES)[number]
/** The page classes named, or the first name that is not one: a deployment's list is checked once, where it is read. */
export function pageClassesOf(names: readonly string[]): PageClass[] {
return names.map((name) => {
if (!(PAGE_CLASSES as readonly string[]).includes(name)) {
throw new Error(`"${name}" is not a page class: expected one of ${PAGE_CLASSES.join(", ")}`)
}
return name as PageClass
})
}
/** The page classes the extraction leaves out unless the deployment says otherwise: nothing on them is a specification. */
export const DEFAULT_EXCLUDED_PAGE_CLASSES: readonly PageClass[] = ["drawing", "empty"]
/**
* Why a reviewer should look at a line besides an unfound quote. `scanned_quote`: the words come from
* the image of a scanned page, and could not be found in its recognised text, so only the page image can vouch for them.
*/
export const LINE_NOTES = ["scanned_quote"] as const
export type LineNote = (typeof LINE_NOTES)[number]
export const LINE_STATUSES = ["pending", "approved", "rejected"] as const
export type LineStatus = (typeof LINE_STATUSES)[number]