@vertesia/common 1.5.0-dev.20260717.131047Z → 1.5.0-dev.20260725.083715Z

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/lib/apps.d.ts +184 -48
  2. package/lib/apps.d.ts.map +1 -1
  3. package/lib/apps.js +21 -9
  4. package/lib/apps.js.map +1 -1
  5. package/lib/audit-trail.d.ts +61 -1
  6. package/lib/audit-trail.d.ts.map +1 -1
  7. package/lib/audit-trail.js +15 -0
  8. package/lib/audit-trail.js.map +1 -1
  9. package/lib/environment.d.ts +2 -0
  10. package/lib/environment.d.ts.map +1 -1
  11. package/lib/environment.js.map +1 -1
  12. package/lib/index.d.ts +7 -0
  13. package/lib/index.d.ts.map +1 -1
  14. package/lib/index.js +7 -0
  15. package/lib/index.js.map +1 -1
  16. package/lib/interaction.d.ts +77 -1
  17. package/lib/interaction.d.ts.map +1 -1
  18. package/lib/interaction.js +48 -0
  19. package/lib/interaction.js.map +1 -1
  20. package/lib/platform-event.d.ts +37 -3
  21. package/lib/platform-event.d.ts.map +1 -1
  22. package/lib/platform-event.js.map +1 -1
  23. package/lib/project.d.ts +119 -20
  24. package/lib/project.d.ts.map +1 -1
  25. package/lib/project.js +65 -0
  26. package/lib/project.js.map +1 -1
  27. package/lib/query.d.ts +6 -0
  28. package/lib/query.d.ts.map +1 -1
  29. package/lib/refs.d.ts +1 -0
  30. package/lib/refs.d.ts.map +1 -1
  31. package/lib/schema-for-extraction.d.ts +21 -0
  32. package/lib/schema-for-extraction.d.ts.map +1 -0
  33. package/lib/schema-for-extraction.js +205 -0
  34. package/lib/schema-for-extraction.js.map +1 -0
  35. package/lib/store/agent-run.d.ts +23 -1
  36. package/lib/store/agent-run.d.ts.map +1 -1
  37. package/lib/store/conversation-state.d.ts +3 -1
  38. package/lib/store/conversation-state.d.ts.map +1 -1
  39. package/lib/store/conversation-state.js.map +1 -1
  40. package/lib/store/doc-analyzer.d.ts +10 -67
  41. package/lib/store/doc-analyzer.d.ts.map +1 -1
  42. package/lib/store/dsl-workflow.d.ts +1 -0
  43. package/lib/store/dsl-workflow.d.ts.map +1 -1
  44. package/lib/store/dsl-workflow.js.map +1 -1
  45. package/lib/store/grounded-extraction.d.ts +146 -0
  46. package/lib/store/grounded-extraction.d.ts.map +1 -0
  47. package/lib/store/grounded-extraction.js +8 -0
  48. package/lib/store/grounded-extraction.js.map +1 -0
  49. package/lib/store/index.d.ts +1 -0
  50. package/lib/store/index.d.ts.map +1 -1
  51. package/lib/store/index.js +1 -0
  52. package/lib/store/index.js.map +1 -1
  53. package/lib/store/store.d.ts +314 -1
  54. package/lib/store/store.d.ts.map +1 -1
  55. package/lib/store/store.js +451 -0
  56. package/lib/store/store.js.map +1 -1
  57. package/lib/store/workflow.d.ts +8 -1
  58. package/lib/store/workflow.d.ts.map +1 -1
  59. package/lib/store/workflow.js +5 -0
  60. package/lib/store/workflow.js.map +1 -1
  61. package/lib/user.d.ts +14 -0
  62. package/lib/user.d.ts.map +1 -1
  63. package/lib/user.js +31 -0
  64. package/lib/user.js.map +1 -1
  65. package/lib/vertesia-common.js +2 -2
  66. package/lib/vertesia-common.js.map +1 -1
  67. package/lib/view-configuration-validation.d.ts +15 -0
  68. package/lib/view-configuration-validation.d.ts.map +1 -0
  69. package/lib/view-configuration-validation.js +63 -0
  70. package/lib/view-configuration-validation.js.map +1 -0
  71. package/lib/view-query-validation.d.ts +13 -0
  72. package/lib/view-query-validation.d.ts.map +1 -0
  73. package/lib/view-query-validation.js +266 -0
  74. package/lib/view-query-validation.js.map +1 -0
  75. package/lib/view-validation-helpers.d.ts +15 -0
  76. package/lib/view-validation-helpers.d.ts.map +1 -0
  77. package/lib/view-validation-helpers.js +25 -0
  78. package/lib/view-validation-helpers.js.map +1 -0
  79. package/lib/views-schema.d.ts +1992 -0
  80. package/lib/views-schema.d.ts.map +1 -0
  81. package/lib/views-schema.js +674 -0
  82. package/lib/views-schema.js.map +1 -0
  83. package/lib/views-validation.d.ts +21 -0
  84. package/lib/views-validation.d.ts.map +1 -0
  85. package/lib/views-validation.js +164 -0
  86. package/lib/views-validation.js.map +1 -0
  87. package/lib/views.d.ts +381 -0
  88. package/lib/views.d.ts.map +1 -0
  89. package/lib/views.js +41 -0
  90. package/lib/views.js.map +1 -0
  91. package/package.json +5 -5
  92. package/src/agent-resources.test.ts +100 -0
  93. package/src/apps.test.ts +9 -1
  94. package/src/apps.ts +220 -73
  95. package/src/audit-trail.ts +83 -0
  96. package/src/environment.ts +2 -0
  97. package/src/index.ts +12 -0
  98. package/src/interaction.ts +135 -1
  99. package/src/platform-event.ts +39 -2
  100. package/src/project.test.ts +44 -0
  101. package/src/project.ts +205 -22
  102. package/src/query.ts +6 -0
  103. package/src/refs.ts +1 -0
  104. package/src/schema-for-extraction.test.ts +191 -0
  105. package/src/schema-for-extraction.ts +231 -0
  106. package/src/store/agent-run.ts +29 -0
  107. package/src/store/content-type-editing.test.ts +17 -0
  108. package/src/store/conversation-state.ts +4 -1
  109. package/src/store/doc-analyzer.ts +10 -76
  110. package/src/store/dsl-workflow.ts +1 -0
  111. package/src/store/grounded-extraction.ts +154 -0
  112. package/src/store/index.ts +1 -0
  113. package/src/store/store.ts +800 -1
  114. package/src/store/workflow.ts +12 -0
  115. package/src/user.ts +46 -0
  116. package/src/view-configuration-validation.ts +74 -0
  117. package/src/view-query-validation.test.ts +21 -0
  118. package/src/view-query-validation.ts +319 -0
  119. package/src/view-validation-helpers.ts +28 -0
  120. package/src/views-schema.test.ts +364 -0
  121. package/src/views-schema.ts +689 -0
  122. package/src/views-validation.ts +234 -0
  123. package/src/views.ts +484 -0
@@ -0,0 +1,146 @@
1
+ import type { InteractionExecutionConfiguration } from '../interaction.js';
2
+ import type { WorkflowRunStatus } from './workflow.js';
3
+ /**
4
+ * Document-level trust verdict for a grounded extraction. `good_to_go` means the
5
+ * extracted content (after any review corrections) can be used without a human
6
+ * check; `needs_review` means a human should verify it. This reflects content
7
+ * correctness, not how many citation boxes rendered.
8
+ */
9
+ export type GroundedExtractionVerdict = 'good_to_go' | 'needs_review';
10
+ /**
11
+ * Canonical workflow id for object-scoped grounded extraction. Every entry point
12
+ * must use this id so Temporal prevents overlapping extraction runs per object.
13
+ */
14
+ export declare function getGroundedExtractionWorkflowId(accountId: string, objectId: string): string;
15
+ /**
16
+ * Request body to start a grounded extraction on a content object. All fields are
17
+ * optional: with none set, the object's own content-type schema drives the
18
+ * extraction with default models and settings.
19
+ */
20
+ export interface GroundedExtractionRequest {
21
+ /** JSON schema describing the data to extract. Takes precedence over type_ref. */
22
+ schema?: Record<string, unknown>;
23
+ /** Content type id or catalog ref whose object_schema drives the extraction. */
24
+ type_ref?: string;
25
+ /** Interaction to use. Defaults to sys:ExtractInformationGrounded. */
26
+ interaction_name?: string;
27
+ /** Maximum number of pages to process. */
28
+ max_pages?: number;
29
+ /** Run OCR on every page even when a text layer exists. */
30
+ force_ocr?: boolean;
31
+ /** Re-run OCR on pages that need it instead of restoring the stored OCR result. */
32
+ refresh_ocr?: boolean;
33
+ /** Attach clean page images for layout/semantic context; direct-vision pages also receive checkerboards. */
34
+ use_vision?: boolean;
35
+ /**
36
+ * A1 locate-grid cell size in PDF points for vision pages (drives both the drawn
37
+ * grid and cell→box resolution). Smaller = finer grid / more cells. Default: 14.
38
+ */
39
+ grid_cell_pt?: number;
40
+ /**
41
+ * How to read pages that have no digital text layer (scans / image-only pages).
42
+ * 'vision' (default): read them off the page image with the extraction model,
43
+ * skipping OCR entirely. 'ocr': legacy path — OCR those pages and block-ground on
44
+ * the (lossy) OCR text. Set to 'ocr' to revert to the pre-vision behavior.
45
+ */
46
+ raster_mode?: 'vision' | 'ocr';
47
+ /** Maximum pages per extraction call; larger documents are split into sequential windows. */
48
+ window_pages?: number;
49
+ /**
50
+ * Extract with an autonomous agent (views the whole document at once) instead of
51
+ * the deterministic windowed pipeline. Sidesteps window-boundary splits on long
52
+ * documents. The workflow stages the artifacts into an agent space, runs a
53
+ * conversation agent that writes the extraction, then folds it back.
54
+ */
55
+ agentic_extraction?: boolean;
56
+ /** Agent interaction for agentic_extraction. Defaults to sys:GeneralAgent. */
57
+ extract_agent?: string;
58
+ /** Update the object's properties with the extracted data. Default: true. */
59
+ update_properties?: boolean;
60
+ /** LLM execution configuration (model, environment, ...) for the main pass. */
61
+ config?: InteractionExecutionConfiguration;
62
+ /** Execution configuration used instead of `config` on hard content (scans, handwriting). */
63
+ hard_config?: InteractionExecutionConfiguration;
64
+ /** Hardness score (0..1) at or above which `hard_config` is used. Default: 0.5. */
65
+ hardness_threshold?: number;
66
+ /** Execution configuration for the post-extraction review pass. No review runs when absent. */
67
+ review_config?: InteractionExecutionConfiguration;
68
+ /** Hardness score (0..1) at or above which the review runs. Defaults to hardness_threshold. */
69
+ review_threshold?: number;
70
+ /** Review triggers when any page's citation coverage falls below this floor. Default: 0.2. */
71
+ coverage_review_threshold?: number;
72
+ /** Run the model review even when every citation was digitally verified. Requires review_config. */
73
+ force_review?: boolean;
74
+ /**
75
+ * Free-text operator guidance folded into the extraction prompt to steer a
76
+ * (re-)extraction, e.g. "part numbers are in the third column; some line items
77
+ * wrap onto the next row".
78
+ */
79
+ operator_instructions?: string;
80
+ /** Interactive assistant only: the operator's opening message for the assistant conversation. */
81
+ user_prompt?: string;
82
+ }
83
+ /**
84
+ * Response from starting the interactive grounded extraction assistant. The agent
85
+ * run + conversation workflow are launched server-side (recordRun -> stage the
86
+ * document into the agent space -> launch the interactive conversation); the
87
+ * client renders the conversation with `agent_run_id`.
88
+ */
89
+ export interface GroundedAssistantResponse {
90
+ /** The AgentRun id to stream/render the conversation. */
91
+ agent_run_id: string;
92
+ /** The conversation workflow id backing the run. */
93
+ workflow_id: string;
94
+ /** The object the assistant is scoped to. */
95
+ object_id: string;
96
+ }
97
+ /**
98
+ * Status of a grounded extraction workflow. Carries the doc-level verdict once the
99
+ * run has completed and written its result.
100
+ */
101
+ export interface GroundedExtractionRunStatusResponse extends WorkflowRunStatus {
102
+ /** The trust verdict, present once the run has completed. */
103
+ verdict?: GroundedExtractionVerdict;
104
+ }
105
+ /**
106
+ * How each extracted value was verified. Two kinds, both trustworthy:
107
+ * digitally verified (matched the document's text — digital layer or OCR) and
108
+ * AI verified (the reviewer confirmed it against the page image — the primary
109
+ * signal for scanned or handwritten content, which has no text layer to match).
110
+ */
111
+ export interface GroundedVerificationBreakdown {
112
+ /** Total number of cited values. */
113
+ total: number;
114
+ /** Values matched verbatim against the document's text (digital layer or OCR). */
115
+ digitally_verified: number;
116
+ /** Values the reviewer model confirmed against the page image. */
117
+ ai_verified: number;
118
+ /** Values read from the image but neither text-matched nor reviewer-confirmed. */
119
+ unverified: number;
120
+ }
121
+ /**
122
+ * Completed grounded extraction result: the extracted data with its trust verdict
123
+ * and verification breakdown, plus a download URL for the full citations artifact.
124
+ */
125
+ export interface GroundedExtractionResultResponse {
126
+ object_id: string;
127
+ /** The extracted data, shaped by the requested schema. */
128
+ data: Record<string, unknown>;
129
+ /** Document-level trust verdict. */
130
+ verdict?: GroundedExtractionVerdict;
131
+ /** One-sentence rationale for the verdict. */
132
+ verdict_reason?: string;
133
+ /** Mean citation confidence in [0,1]. */
134
+ confidence?: number;
135
+ /** Per-value verification breakdown. */
136
+ verification: GroundedVerificationBreakdown;
137
+ /** Review outcome, when a review pass ran. */
138
+ review?: {
139
+ assessment: 'complete' | 'issues_found';
140
+ summary?: string;
141
+ corrections_applied?: number;
142
+ };
143
+ /** Signed download URL for the full grounded-extraction.json (data + citations + boxes). */
144
+ result_url?: string | null;
145
+ }
146
+ //# sourceMappingURL=grounded-extraction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grounded-extraction.d.ts","sourceRoot":"","sources":["../../src/store/grounded-extraction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD;;;;;GAKG;AACH,M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C5F,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Canonical workflow id for object-scoped grounded extraction. Every entry point
3
+ * must use this id so Temporal prevents overlapping extraction runs per object.
4
+ */
5
+ export function getGroundedExtractionWorkflowId(accountId, objectId) {
6
+ return `${accountId.slice(0, 6)}:workflow_execution_request:${objectId}:grounded`;
7
+ }
8
+ //# sourceMappingURL=grounded-extraction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grounded-extraction.js","sourceRoot":"","sources":["../../src/store/grounded-extraction.ts"],"names":[],"mappings":"AAWA;;;GAGG;AACH,MAAM,UAAU,+BAA+B,CAAC,SAAiB,EAAE,QAAgB;IAC/E,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,+BAA+B,QAAQ,WAAW,CAAC;AACtF,CAAC"}
@@ -6,6 +6,7 @@ export * from './common.js';
6
6
  export * from './conversation-state.js';
7
7
  export * from './doc-analyzer.js';
8
8
  export * from './dsl-workflow.js';
9
+ export * from './grounded-extraction.js';
9
10
  export * from './hive-memory.js';
10
11
  export * from './object-types.js';
11
12
  export * from './process.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/store/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/store/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC"}
@@ -6,6 +6,7 @@ export * from './common.js';
6
6
  export * from './conversation-state.js';
7
7
  export * from './doc-analyzer.js';
8
8
  export * from './dsl-workflow.js';
9
+ export * from './grounded-extraction.js';
9
10
  export * from './hive-memory.js';
10
11
  export * from './object-types.js';
11
12
  export * from './process.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/store/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/store/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC"}
@@ -1,4 +1,6 @@
1
+ import type { JSONSchemaType } from 'ajv';
1
2
  import type { ComputedFacetResponse } from '../facets.js';
3
+ import type { InteractionExecutionConfiguration } from '../interaction.js';
2
4
  import type { JSONObject } from '../json.js';
3
5
  import type { SearchPayload } from '../payload.js';
4
6
  import type { SupportedEmbeddingTypes } from '../project.js';
@@ -378,6 +380,12 @@ export interface GenerationRunMetadata {
378
380
  date: string;
379
381
  model: string;
380
382
  target?: string;
383
+ /**
384
+ * Fingerprint of the inputs used by property extraction (content etag, type + its object
385
+ * schema, source, instructions, interaction). Lets a later run skip re-extraction when
386
+ * nothing changed.
387
+ */
388
+ extraction_fingerprint?: string;
381
389
  }
382
390
  export interface Rendition {
383
391
  name: string;
@@ -397,7 +405,86 @@ export interface ContentMetadata {
397
405
  location?: Location;
398
406
  generation_runs?: GenerationRunMetadata[];
399
407
  etag?: string;
408
+ /** ETag of text materialized from object properties by intake rendering. */
409
+ rendered_text_etag?: string;
400
410
  renditions?: Rendition[];
411
+ /**
412
+ * Embedded/technical metadata harvested from the source file by intake
413
+ * (office docProps, PDF docinfo). Free-form, nature-appropriate keys.
414
+ */
415
+ embedded?: Record<string, unknown>;
416
+ /** Type-detection provenance recorded by the intake sniff pipeline. */
417
+ type_detection?: TypeDetectionMetadata;
418
+ /** Locate-pass provenance: which pages the document map found relevant. */
419
+ locate?: LocateMetadata;
420
+ /** Vision-evidence provenance for the last visual extraction run. */
421
+ vision_evidence?: VisionEvidenceMetadata;
422
+ }
423
+ /**
424
+ * Provenance persisted at `metadata.locate` when the intake locate (document-map) pass runs.
425
+ * The page list doubles as navigation metadata for the UI.
426
+ */
427
+ export interface LocateMetadata {
428
+ /** Relevant pages proposed by the locate pass, in plan-ranked order (1-based). */
429
+ pages: number[];
430
+ /** Detail profile the plan requested for visual extraction. */
431
+ visual_detail?: 'low' | 'standard' | 'high';
432
+ /** Whether the plan asked for color rendering. */
433
+ needs_color?: boolean;
434
+ /** The model's one-line explanation of the selection. */
435
+ reason?: string;
436
+ page_count?: number;
437
+ /** Pages per contact sheet used for the pass (8 or 16). */
438
+ detail?: number;
439
+ sheet_count?: number;
440
+ located_at: string;
441
+ }
442
+ /**
443
+ * Provenance persisted at `metadata.vision_evidence` whenever intake prepares scoped page
444
+ * images for visual extraction (design: vision evidence spec — dropped pages are recorded,
445
+ * never silently batched).
446
+ */
447
+ export interface VisionEvidenceMetadata {
448
+ /** Extraction source that requested the evidence. */
449
+ source_requested?: 'auto' | 'text' | 'vision' | 'mixed';
450
+ /** Pages rendered and sent as evidence, in ranked order (1-based). */
451
+ pages_sent: number[];
452
+ /** Resolved detail profile name. */
453
+ detail: 'low' | 'standard' | 'high';
454
+ /** Candidate pages dropped by budget clamping (recorded, not batched). */
455
+ dropped_pages?: number[];
456
+ /** The locate plan's reason, when the plan drove the page selection. */
457
+ plan_reason?: string;
458
+ /** Which clamps fired (page_count, allowed_details, token budget, page caps, payload). */
459
+ clamps_applied?: string[];
460
+ /** Estimated image tokens for the pages sent. */
461
+ est_tokens?: number;
462
+ page_count?: number;
463
+ prepared_at: string;
464
+ }
465
+ /**
466
+ * Durable provenance persisted at `metadata.type_detection` whenever the intake sniff pipeline
467
+ * runs. `method` records which mechanism decides the type: the sniff itself (high confidence),
468
+ * the post-conversion selector (medium/low/other), or the post-conversion selector because the
469
+ * document was below the small-doc page threshold.
470
+ */
471
+ export interface TypeDetectionMetadata {
472
+ method: 'sniff' | 'post_conversion' | 'post_conversion_small_doc';
473
+ /** Sniffed type id, or 'other'. */
474
+ type?: string;
475
+ type_name?: string;
476
+ /** Sniff confidence, 0..1. */
477
+ confidence?: number;
478
+ band?: 'high' | 'medium' | 'low';
479
+ rationale?: string;
480
+ alternates?: string[];
481
+ /** Which evidence kinds the sniff saw. */
482
+ evidence?: 'text' | 'image' | 'both';
483
+ page_count?: number;
484
+ /** Why the sniff LLM call was skipped (e.g. 'below_min_pages'). */
485
+ skipped_reason?: string;
486
+ min_pages?: number;
487
+ detected_at: string;
401
488
  }
402
489
  export interface TemporalMediaMetadata extends ContentMetadata {
403
490
  duration?: number;
@@ -433,9 +520,32 @@ export interface DocumentMetadata extends ContentMetadata {
433
520
  image_count?: number;
434
521
  zone_count?: number;
435
522
  needs_ocr_count?: number;
523
+ /** Fingerprint of source+policy used for custom conversion, to skip re-converting unchanged docs. */
524
+ conversion_fingerprint?: string;
436
525
  };
526
+ /**
527
+ * Grounded-extraction trust signal + key data. Written by the grounded pipeline
528
+ * (verdict, confidence, citation counts, review status, source etag, ...) and
529
+ * queryable for list/filter. Open-ended so more grounded key-data can be stored
530
+ * without a type change.
531
+ */
532
+ grounded?: GroundedMetadata;
437
533
  sections?: TextSection[];
438
534
  }
535
+ /** Grounded-extraction summary stored on document metadata. Additional keys allowed. */
536
+ export interface GroundedMetadata {
537
+ verdict?: string;
538
+ confidence?: number;
539
+ citation_count?: number;
540
+ verified_citations?: number;
541
+ reviewed_at?: string;
542
+ generated_at?: string;
543
+ /** Source PDF content etag used by the grounded extraction. */
544
+ source_content_etag?: string | null;
545
+ /** @deprecated Grounded source identity is tracked by source_content_etag. */
546
+ source_text_etag?: string | null;
547
+ [key: string]: unknown;
548
+ }
439
549
  export interface Transcript {
440
550
  text?: string;
441
551
  segments?: TranscriptSegment[];
@@ -569,6 +679,12 @@ interface StoredTypeRef {
569
679
  */
570
680
  id: string;
571
681
  name: string;
682
+ /**
683
+ * Display hint from the type's intake policy (`intake.default_view`). Enriched by the
684
+ * API on single-object reads so clients can pick the initial view without fetching the
685
+ * type. Absent on list responses and older servers.
686
+ */
687
+ default_view?: ContentTypeIntakePolicy['default_view'];
572
688
  }
573
689
  interface InCodeTypeRef {
574
690
  ref_type: 'incode';
@@ -577,6 +693,12 @@ interface InCodeTypeRef {
577
693
  */
578
694
  id: string;
579
695
  name: string;
696
+ /**
697
+ * Display hint from the type's intake policy (`intake.default_view`). Enriched by the
698
+ * API on single-object reads so clients can pick the initial view without fetching the
699
+ * type. Absent on list responses and older servers.
700
+ */
701
+ default_view?: ContentTypeIntakePolicy['default_view'];
580
702
  }
581
703
  export interface ComplexSearchPayload extends Omit<SearchPayload, 'query'> {
582
704
  query?: ComplexSearchQuery;
@@ -601,10 +723,201 @@ export interface ColumnLayout {
601
723
  */
602
724
  default?: unknown;
603
725
  }
726
+ export type ContentObjectTypeStatus = 'active' | 'draft';
727
+ /** Vision detail level names referenced by intake policies. The rendering profiles behind the
728
+ * names (dpi, max size, quality, color mode) are PLATFORM-defined and project-overridable —
729
+ * a type only ever references a detail name. */
730
+ export type IntakeVisionDetail = 'low' | 'standard' | 'high';
731
+ /**
732
+ * Named page scope for intake conversion/extraction: everything or the locate-pass result.
733
+ * Static page ranges live in the sibling `page_ranges` field (which wins when set) — kept as
734
+ * a SEPARATE field because scalar-or-collection unions generate unstable API clients.
735
+ */
736
+ export type IntakePageScope = 'all' | 'located';
737
+ /**
738
+ * Static page ranges: inclusive [start, end] pairs; negative indexes count from the end of
739
+ * the document ([[1, 2], [-1, -1]] = first two pages plus the last page).
740
+ */
741
+ export type IntakePageRanges = [number, number][];
742
+ /** Rendering settings behind a vision detail name (platform defaults, project-overridable
743
+ * via `configuration.intake.vision_profiles`). */
744
+ export interface IntakeVisionProfileSettings {
745
+ /** Render resolution in dots per inch. */
746
+ dpi: number;
747
+ /** Maximum height/width of the rendered page image in pixels. */
748
+ max_hw: number;
749
+ /** JPEG quality (0-100). */
750
+ quality: number;
751
+ /** grayscale renders gray always; auto keeps color when the plan asks for it. */
752
+ color_mode: 'grayscale' | 'auto';
753
+ }
754
+ export interface ContentTypeExtractionGroundingReviewPolicy {
755
+ /** Set false to disable an inherited grounding review pass for this type. */
756
+ enabled?: boolean;
757
+ /** Model execution configuration for the review interaction. */
758
+ config?: InteractionExecutionConfiguration;
759
+ /** Hardness score at or above which review runs. Defaults to hardness_threshold. */
760
+ threshold?: number;
761
+ /**
762
+ * Review also runs when any page's citation coverage falls below this
763
+ * floor (evidence of missed content). Default 0.2.
764
+ */
765
+ coverage_threshold?: number;
766
+ /** Run review regardless of hardness. */
767
+ force?: boolean;
768
+ }
769
+ export interface ContentTypeExtractionGroundingPolicy {
770
+ /** Enable PDF block-level citation grounding for property extraction. */
771
+ enabled?: boolean;
772
+ /** Grounded extraction interaction. Defaults to the system grounded extractor. */
773
+ interaction?: string;
774
+ /** Maximum pages to process. */
775
+ max_pages?: number;
776
+ /** Run OCR on every page even when a text layer exists. */
777
+ force_ocr?: boolean;
778
+ /** Attach instrumented page images to the grounded extraction prompt. */
779
+ use_vision?: boolean;
780
+ /**
781
+ * How to read pages with no digital text layer (scans / image-only pages).
782
+ * 'vision' (default): read them off the page image and skip OCR. 'ocr': legacy
783
+ * path — OCR those pages and block-ground on the (lossy) OCR text.
784
+ */
785
+ raster_mode?: 'vision' | 'ocr';
786
+ /**
787
+ * A1 locate-grid cell size in PDF points for vision pages. Smaller = finer grid
788
+ * (more cells, tighter boxes) but can trip weaker models into over-reading;
789
+ * tune per the model in `config`. Default 15.
790
+ */
791
+ grid_cell_pt?: number;
792
+ /**
793
+ * Drop block bounding boxes from the extraction prompt. Only sound with
794
+ * use_vision (layout comes from the image).
795
+ */
796
+ omit_block_boxes?: boolean;
797
+ /** Maximum pages per grounded extraction call before windowing. */
798
+ window_pages?: number;
799
+ /** Update object properties with grounded extraction data. Default true. */
800
+ update_properties?: boolean;
801
+ /** Model execution configuration for the main grounded extraction interaction. */
802
+ config?: InteractionExecutionConfiguration;
803
+ /** Model execution configuration used for hard-to-read content. */
804
+ hard_config?: InteractionExecutionConfiguration;
805
+ /** Hardness score at or above which hard_config is used. Default 0.5. */
806
+ hardness_threshold?: number;
807
+ /**
808
+ * Minimum citations-per-leaf-value ratio; completions below it retry with
809
+ * escalation. Default 0.3.
810
+ */
811
+ min_citation_density?: number;
812
+ /** Re-run OCR instead of restoring durable OCR artifacts (stale pipeline output). */
813
+ refresh_ocr?: boolean;
814
+ /** Optional post-extraction review pass. */
815
+ review?: ContentTypeExtractionGroundingReviewPolicy;
816
+ }
817
+ /**
818
+ * Per-content-type policy for the standard intake workflows.
819
+ */
820
+ export interface ContentTypeIntakePolicy {
821
+ /** Intake orchestration mode for this type. */
822
+ mode?: 'programmatic' | 'agentic';
823
+ /** Guidance used when selecting or creating this content type. */
824
+ identification?: {
825
+ guidance?: string;
826
+ distinguish_from?: string;
827
+ examples?: string[];
828
+ };
829
+ /**
830
+ * Document-map ("locate") pass: page thumbnails tiled into labeled contact sheets, one
831
+ * vision call returns which pages matter for THIS type. The result can scope conversion
832
+ * and extraction, and doubles as the vision planner for visual extraction.
833
+ */
834
+ locate?: {
835
+ /** What to look for ("commercial terms, payment schedule, signature pages"). */
836
+ instructions: string;
837
+ /** Pages per contact sheet: 8 = bigger tiles (headings readable). Default 16. */
838
+ detail?: 8 | 16;
839
+ /** Only run when the page count is at least this. Default 8. */
840
+ min_pages?: number;
841
+ };
842
+ /** Controls source-to-text conversion before extraction and embedding. */
843
+ text_conversion?: {
844
+ enabled?: boolean;
845
+ method?: 'auto' | 'basic' | 'llm' | 'custom';
846
+ custom?: {
847
+ interaction?: string;
848
+ agent?: string;
849
+ };
850
+ instructions?: string;
851
+ output_format?: 'markdown' | 'text';
852
+ /** Which pages to convert: everything or the locate result. Default all. */
853
+ scope?: IntakePageScope;
854
+ /** Static page ranges to convert (wins over `scope` when set). */
855
+ page_ranges?: IntakePageRanges;
856
+ };
857
+ /** Controls schema-property extraction after type assignment. */
858
+ extraction?: {
859
+ enabled?: boolean;
860
+ source?: 'auto' | 'text' | 'vision' | 'mixed';
861
+ instructions?: string;
862
+ interaction?: string;
863
+ /** Which pages extraction sees: everything or the locate result. */
864
+ scope?: IntakePageScope;
865
+ /** Static page ranges extraction sees (wins over `scope` when set). */
866
+ page_ranges?: IntakePageRanges;
867
+ /** Cap on pages sent to extraction. Default 20. */
868
+ max_pages?: number;
869
+ /** Vision evidence budget for visual extraction. Detail names reference platform
870
+ * profiles; the type never defines dpi/quality/resolution. */
871
+ vision?: {
872
+ default_detail?: IntakeVisionDetail;
873
+ allowed_details?: IntakeVisionDetail[];
874
+ /** PRIMARY budget: estimated image tokens per extraction call. Default 16000. */
875
+ max_image_tokens?: number;
876
+ /** Transport guard in megabytes. Default 16. */
877
+ max_payload_mb?: number;
878
+ /** Cap on page images per extraction call. Default 8. */
879
+ max_pages_per_call?: number;
880
+ };
881
+ verification?: {
882
+ enabled?: boolean;
883
+ model?: string;
884
+ environment?: string;
885
+ materiality?: string;
886
+ threshold?: number;
887
+ max_retries?: number;
888
+ on_fail?: 'flag' | 'block';
889
+ };
890
+ /** Controls PDF block-level citation grounding with annotated proof output. */
891
+ grounding?: ContentTypeExtractionGroundingPolicy;
892
+ };
893
+ /** Handlebars template used to materialize extracted properties into object text. */
894
+ rendering_template?: string;
895
+ /** Per-type embedding switches. Unspecified values inherit the project policy. */
896
+ embeddings?: Partial<Record<SupportedEmbeddingTypes, boolean>>;
897
+ /** Whether intake should generate a table of contents for matching documents. */
898
+ generate_toc?: boolean;
899
+ /** Preferred first view for objects of this type. */
900
+ default_view?: 'auto' | 'text' | 'pdf' | 'image' | 'properties';
901
+ }
902
+ /** Per-content-type policy for collaborative document editing. */
903
+ export interface ContentTypeEditingPolicy {
904
+ /** Agent interaction used for new document-editing sessions. Defaults to sys:GeneralAgent. */
905
+ interaction?: string;
906
+ }
907
+ export declare const ContentTypeEditingPolicySchema: JSONSchemaType<ContentTypeEditingPolicy>;
908
+ /** JSON schema for validating ContentTypeIntakePolicy payloads at API/tool boundaries.
909
+ * NOTE: typed via a cast because AJV's strict `JSONSchemaType` mapping cannot express the
910
+ * `[number, number]` pair items of `page_ranges` as a uniform-items array. The runtime
911
+ * schema is compiled (and thus validated) by every consumer and by the schema-acceptance
912
+ * unit test in packages/workflows. */
913
+ export declare const ContentTypeIntakePolicySchema: JSONSchemaType<ContentTypeIntakePolicy>;
604
914
  export interface ContentObjectType extends ContentObjectTypeItem {
605
915
  }
606
916
  export interface ContentObjectTypeItem extends BaseObject {
917
+ status?: ContentObjectTypeStatus;
607
918
  is_chunkable?: boolean;
919
+ intake?: ContentTypeIntakePolicy;
920
+ editing?: ContentTypeEditingPolicy;
608
921
  /**
609
922
  * This is only included in ContentObjectTypeItem if explicitly requested
610
923
  * It is always included in ContentObjectType
@@ -620,7 +933,7 @@ export interface ContentObjectTypeItem extends BaseObject {
620
933
  */
621
934
  strict_mode?: boolean;
622
935
  }
623
- export type InCodeTypeDefinition = Pick<ContentObjectTypeItem, 'id' | 'name' | 'description' | 'tags' | 'object_schema' | 'table_layout' | 'is_chunkable' | 'strict_mode'>;
936
+ export type InCodeTypeDefinition = Pick<ContentObjectTypeItem, 'id' | 'name' | 'description' | 'tags' | 'object_schema' | 'table_layout' | 'is_chunkable' | 'strict_mode' | 'status' | 'intake' | 'editing'>;
624
937
  export interface ContentObjectTypeCatalogEntry extends InCodeTypeDefinition {
625
938
  updated_by?: string;
626
939
  created_by?: string;