import * as effect_Cause from 'effect/Cause'; import * as effect_Types from 'effect/Types'; import { Schema, Effect } from 'effect'; /** Scalar/structural type of a manifest field. `money`/`date` are scalars with * display semantics; `array`/`object` mark repeating/nested groups. */ type ContentTypeFieldType = 'string' | 'number' | 'boolean' | 'date' | 'money' | 'array' | 'object'; /** Evidence requirement — defaulted on the manifest, overridable per field. * `citation_required` ties to the okra differentiator: a field must carry a * `page_location` citation to be trusted. */ interface EvidencePolicy { citation_required: boolean; /** Require a precise element box (`bbox_source: 'node'`), not a page-level fallback. */ bbox_required: boolean; /** 0–1; a grounded value below this routes to review (P1). */ confidence_threshold: number; } interface ContentTypeField { /** JSONPath into `result.data` — matches the grounding field names * (`vendor.name`, `line_items[].amount`). */ path: string; label: string; type: ContentTypeFieldType; required: boolean; /** True for array/line-item fields. */ repeating?: boolean; /** Per-field override of the manifest's default evidence policy. */ evidence?: Partial; } /** P1 — declarative only; the durable queue / live streaming are out of scope. */ interface ReviewConfig { threshold: number; /** Registered review component to bind (see #332). */ component_id?: string; commit_policy?: 'auto' | 'manual'; allowed_actions?: Array<'correct' | 'approve' | 'reject'>; } type ExportFormat = 'csv' | 'xlsx' | 'webhook' | 'json'; interface ExtractionConfig { /** Prompt/guidance for the extractor. */ instructions: string; /** P1 — default provider + ordering. */ provider_policy?: { primary?: string; order?: string[]; }; /** P1 — behavior when the primary provider fails / is low-confidence. */ fallback?: 'none' | 'next_provider' | 'review'; } interface CliGenerationHints { /** Generated CLI noun (defaults to `id`). */ noun: string; aliases?: string[]; /** P1. */ default_output?: 'json' | 'table'; } interface SdkGenerationHints { /** Generated SDK namespace (`okra.invoice`); must not collide with a built-in * resource noun. */ namespace: string; /** P1 — method-name overrides. */ methods?: { extract?: string; review?: string; export?: string; }; } interface ContentTypeManifest { id: string; label: string; version: string; /** JSON Schema for the payload (`result.data`). */ schema: Record; fields: ContentTypeField[]; evidence: EvidencePolicy; extraction: ExtractionConfig; review?: ReviewConfig; export?: { formats: ExportFormat[]; }; cli: CliGenerationHints; sdk: SdkGenerationHints; } declare const contentTypeFieldTypeSchema: Schema.Literals; declare const evidencePolicySchema: Schema.Struct<{ readonly citation_required: Schema.Boolean; readonly bbox_required: Schema.Boolean; readonly confidence_threshold: Schema.Number; }>; declare const contentTypeFieldSchema: Schema.Struct<{ readonly path: Schema.String; readonly label: Schema.String; readonly type: Schema.Literals; readonly required: Schema.Boolean; readonly repeating: Schema.optionalKey; readonly evidence: Schema.optionalKey; readonly bbox_required: Schema.optionalKey; readonly confidence_threshold: Schema.optionalKey; }>>; }>; /** Effect Schema contract for local/SDK content-type manifests. */ declare const contentTypeManifestSchema: Schema.Struct<{ readonly id: Schema.String; readonly label: Schema.String; readonly version: Schema.String; readonly schema: Schema.$Record; readonly fields: Schema.$Array; readonly required: Schema.Boolean; readonly repeating: Schema.optionalKey; readonly evidence: Schema.optionalKey; readonly bbox_required: Schema.optionalKey; readonly confidence_threshold: Schema.optionalKey; }>>; }>>; readonly evidence: Schema.Struct<{ readonly citation_required: Schema.Boolean; readonly bbox_required: Schema.Boolean; readonly confidence_threshold: Schema.Number; }>; readonly extraction: Schema.Struct<{ readonly instructions: Schema.String; readonly provider_policy: Schema.optionalKey; readonly order: Schema.optionalKey>; }>>; readonly fallback: Schema.optionalKey>; }>; readonly review: Schema.optionalKey; readonly commit_policy: Schema.optionalKey>; readonly allowed_actions: Schema.optionalKey>>; }>>; readonly export: Schema.optionalKey>; }>>; readonly cli: Schema.Struct<{ readonly noun: Schema.String; readonly aliases: Schema.optionalKey>; readonly default_output: Schema.optionalKey>; }>; readonly sdk: Schema.Struct<{ readonly namespace: Schema.String; readonly methods: Schema.optionalKey; readonly review: Schema.optionalKey; readonly export: Schema.optionalKey; }>>; }>; }>; declare const ContentTypeManifestError_base: new = {}>(args: effect_Types.VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => effect_Cause.YieldableError & { readonly _tag: "ContentTypeManifestError"; } & Readonly; declare class ContentTypeManifestError extends ContentTypeManifestError_base<{ readonly violations: readonly string[]; readonly cause: unknown; }> { } /** Decode a manifest without losing legacy diagnostics or unknown JSON-Schema fields. */ declare function decodeContentTypeManifestEffect(value: unknown): Effect.Effect; /** Synchronous compatibility helper for static manifests and existing SDK callers. */ declare function defineContentTypeManifest(value: unknown): ContentTypeManifest; /** Built-in CLI/SDK resource nouns a generated content type must not shadow. */ declare const RESERVED_NOUNS: ReadonlySet; /** * Return the list of grammar violations for a candidate manifest (empty = valid). * Use as the TDD gate: `expect(contentTypeManifestViolations(m)).toEqual([])`. * Enforces P0 required fields, field/type vocabularies, the evidence policy, and * that the generated CLI noun / SDK namespace don't shadow a built-in resource. */ declare function contentTypeManifestViolations(value: unknown): string[]; /** Convenience boolean wrapper around {@link contentTypeManifestViolations}. */ declare function isContentTypeManifest(value: unknown): value is ContentTypeManifest; /** A compact, list-friendly view of a content type (no schema/fields dump). */ interface ContentTypeSummary { id: string; label: string; version: string; cli_noun: string; sdk_namespace: string; fields: number; citation_required: boolean; } declare const ContentTypeRegistryError_base: new = {}>(args: effect_Types.VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => effect_Cause.YieldableError & { readonly _tag: "ContentTypeRegistryError"; } & Readonly; declare class ContentTypeRegistryError extends ContentTypeRegistryError_base<{ readonly lookup: string; readonly existingId: string; readonly conflictingId: string; }> { } interface ContentTypeRegistry { readonly manifests: readonly ContentTypeManifest[]; list(): ContentTypeSummary[]; get(idOrNoun: string): ContentTypeManifest | undefined; } /** Build a lookup registry and fail if ids, nouns, or aliases collide. */ declare function createContentTypeRegistryEffect(manifests: readonly ContentTypeManifest[]): Effect.Effect; /** All registered content types as a native Effect program. */ declare function listContentTypesEffect(): Effect.Effect; /** All registered content types as compact summaries (stable id order). */ declare function listContentTypes(): ContentTypeSummary[]; /** Resolve a content type by id/noun/alias as a native Effect program. */ declare function getContentTypeEffect(idOrNoun: string): Effect.Effect; /** Resolve a content type by id (or its CLI noun / aliases). Undefined if unknown. */ declare function getContentType(idOrNoun: string): ContentTypeManifest | undefined; /** * Canonical `invoice` content-type manifest (W.4.24d.1 / #330). * * The reference example for the manifest grammar: header fields, repeating * `line_items[]`, and `summary` totals, each typed and evidence-bound, with a * default evidence policy (citation required), extraction instructions, a P1 * review config, CSV/XLSX/JSON exports, CLI noun `invoice`, and SDK namespace * `invoice`. Validated clean by `manifest.test.ts`. * * The `schema` mirrors the field set so a generated `okra invoice extract` is * exactly `okra extract --schema --cite`. */ declare const invoiceContentType: ContentTypeManifest; export { type CliGenerationHints as C, type EvidencePolicy as E, RESERVED_NOUNS as R, type SdkGenerationHints as S, type ContentTypeField as a, type ContentTypeFieldType as b, type ContentTypeManifest as c, ContentTypeManifestError as d, type ContentTypeRegistry as e, ContentTypeRegistryError as f, type ContentTypeSummary as g, type ExportFormat as h, type ExtractionConfig as i, type ReviewConfig as j, contentTypeFieldSchema as k, contentTypeFieldTypeSchema as l, contentTypeManifestSchema as m, contentTypeManifestViolations as n, createContentTypeRegistryEffect as o, decodeContentTypeManifestEffect as p, defineContentTypeManifest as q, evidencePolicySchema as r, getContentType as s, getContentTypeEffect as t, invoiceContentType as u, isContentTypeManifest as v, listContentTypes as w, listContentTypesEffect as x };