@aiquants/enrichment-core 0.3.2 → 0.3.3
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.
- package/README.md +17 -10
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +104 -26
- package/dist/index.d.ts +104 -26
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,8 +11,11 @@ Transport- and DB-agnostic storage metadata AI enrichment core: canonical types,
|
|
|
11
11
|
- **EnrichmentClient**: ハイブリッド検索 (`POST /ai/search/hybrid`) を呼ぶ HTTP クライアント SDK。要求・応答のスキーマ (`SearchRequestSchema` / `SearchResponseSchema`) は Python 側 `HybridSearchRequest` / `HybridSearchResponse` と項目ごとに一致する。詳細は下の「Search client contract」。
|
|
12
12
|
- **Pipeline flow as data** (`flow.ts`): 文書種 (`DOCUMENT_KINDS` / `classifyDocumentKind`)、段 (`PIPELINE_STEPS`)、種類ごとの段の DAG (`PIPELINE_FLOWS` / `flowFor` / `orderedSteps`)。ワーカーの実行順とコンソールの図はこの 1 つの表から導く。段は自分を閉じるテナントのフラグ (`gates`) と、閉じたときの意味 (`skip` / `fail`) を宣言し、流れは段ごとにその意味を上書きできる (`FlowStep.gatePolicy`)。流れの中の門は `flowStepGates` で読む。詳細は下の「Pipeline flow contract」。
|
|
13
13
|
- **Pipeline records** (`pipelineRecord.ts`): 1 回の実行 (`PipelineRunRecordSchema`) と段ごとの記録 (`PipelineStepRecordSchema`)、段を除いた実行の要約 (`PipelineRunSummarySchema`、一覧向け)、段が自身について報告する値 (`StageProvenanceSchema`、Python 側の `StageProvenance` と項目ごとに一致)、段の集計 (`PipelineStepMetricSchema`)、飛ばした理由の文法 (`SkipReason` / `formatSkipReason` / `parseSkipReason`、読む対象が無かったときの値 `NOTHING_TO_READ_TOKENS` / `NothingToReadTokenSchema`)。測っていない値は `null` で、欠落させない。詳細は下の「Pipeline record contract」。
|
|
14
|
-
- **Integrity audit contract** (`integrity.ts`): Tri-Store 整合性監査の記録の語彙 (`IntegrityStoreSchema` を含む 12 の列挙と、所見を記録する区分 `IntegrityFindingItemClassSchema`)、区分の扱いと処置の表 (`INTEGRITY_CLASS_POLICY`)、概況 (`IntegrityAuditOverviewSchema`)、所見の頁と要求 (`IntegrityFindingPageSchema` / `IntegrityFindingsQuerySchema`)
|
|
14
|
+
- **Integrity audit contract** (`integrity.ts`): Tri-Store 整合性監査の記録の語彙 (`IntegrityStoreSchema` を含む 12 の列挙と、所見を記録する区分 `IntegrityFindingItemClassSchema`)、区分の扱いと処置の表 (`INTEGRITY_CLASS_POLICY`)、概況 (`IntegrityAuditOverviewSchema`)、所見の頁と要求 (`IntegrityFindingPageSchema` / `IntegrityFindingsQuerySchema`)、
|
|
15
|
+
`UNRECORDED` の組の一括の再同期の 1 回分の要求と答え (`IntegrityCellResyncRequestSchema` / `IntegrityCellResyncResultSchema`)、配置の所見が観測したドメイン (`IntegrityPlacementObservedSchema`)、開始・中止の命令と命令ごとの失敗の語彙 (`IntegrityCommandSchema` / `IntegrityCommandFailureSchema`) と (状態, 業務コード) の表 (`integrityCommandCodes.json` / `INTEGRITY_COMMAND_CODES` / `integrityCommandFailureCodeOf`)、ホストのストアの応答 (`IntegrityCommandReplySchema`)、契約の時刻の前後の比較 (`isStrictlyEarlier`)。
|
|
15
16
|
詳細は下の「Integrity audit contract」。
|
|
17
|
+
- **Enrichment stages** (`strategy.ts`): ドメインの戦略行が開閉できる段の唯一の表 (`ENRICHMENT_STAGES`、パイプラインの順) と段の型・キー (`EnrichmentStage` / `EnrichmentStageKey`、DB の列名と 1 対 1)、キーの判定と引き当て (`isEnrichmentStageKey` / `enrichmentStage`)。段はテナントの機能フラグと戦略行の 2 つの門を持ちうる (テナントの門の無い段は `featureFlagKey` が `null`)。ナレッジグラフのノードを閲覧するときの境界と既定値 (`GRAPH_INDEX_LIMITS`)。
|
|
18
|
+
- **Vocabularies & search modes** (`vocabulary.ts` / `search.ts`): DB が強制する閉じた語彙 (`ModelProviderSchema`・`ConfidentialityLevelSchema`、検索結果に現れない機密区分 `QUARANTINED_CONFIDENTIALITY_LEVEL`)、検索モードと各モードが走らせる層の表 (`SEARCH_MODES` / `MODE_TIERS` と、そこから導く `modeNeedsRemoteTiers` / `modeScoreIsSimilarity` / `narrowModeToAllowedTiers` / `modeFusesRankings`)、調整可能パラメータの境界と既定値 (`SEARCH_PARAM_LIMITS`)、絞り込める機密区分 (`FILTERABLE_CONFIDENTIALITY_LEVELS`)、遮断器の対象 (`CIRCUIT_BREAKER_SERVICES`) と縮退理由の全集合 (`SEARCH_DEGRADATION_REASONS`)。
|
|
16
19
|
- **System parameter ranges** (`systemParameterRanges.ts`): 値域を持つシステムパラメータの唯一の表 (`systemParameterRanges.json` / `SYSTEM_PARAMETER_RANGES`) と、書き手が当てる検査 (`assertSystemParameterInRange`) と読み手が当てる検査 (`assertBoundedSystemParameter`)。詳細は下の「System parameter ranges」。
|
|
17
20
|
|
|
18
21
|
## Search client contract / 検索クライアントの契約
|
|
@@ -95,7 +98,7 @@ Transport- and DB-agnostic storage metadata AI enrichment core: canonical types,
|
|
|
95
98
|
|
|
96
99
|
監査は API サーバーの中で走り、`td_integrity_audit_run` / `td_integrity_audit_quantity` / `td_integrity_audit_finding` へ記録する。ホストはその行を読み、次の形でコンソールへ渡す。記録の語彙 (下の表の `IntegrityStoreSchema` から `IntegrityRepairSkipReasonSchema` までの 12 の列挙と `IntegrityFindingItemClassSchema`) と区分の方針 (`INTEGRITY_CLASS_POLICY`) は各表の CHECK 制約の写しであり、実行の行の制約が持つ削除印の保持日数の範囲は、実行の見出しを検める `SYSTEM_PARAMETER_RANGES.INTEGRITY_TOMBSTONE_RETENTION_DAYS` の写しである。写しの一致はホストの試験が DDL を読んで確かめる (本パッケージはホストの DDL の置き場所を知らない)。
|
|
97
100
|
|
|
98
|
-
命令の語彙 (`IntegrityCommandSchema` / `IntegrityCommandFailureCodeSchema` と命令ごとのその部分集合) はコンソールの契約の持ち物で、DDL に写しを持たない。全てのスキーマは `.strict()` で、未知の鍵と鍵の欠落を拒む (最初の頁で省く `IntegrityFindingsQuerySchema.after` を除く)。`null` は宣言した項目 (測っていない・まだ無い) だけが持てる。
|
|
101
|
+
命令の語彙 (`IntegrityCommandSchema` / `IntegrityCommandFailureCodeSchema` と命令ごとのその部分集合) はコンソールの契約の持ち物で、DDL に写しを持たない。全てのスキーマは `.strict()` で、未知の鍵と鍵の欠落を拒む (最初の頁で省く `IntegrityFindingsQuerySchema.after` と最初の回で省く `IntegrityCellResyncRequestSchema.after`、`sotDomain` の他の観測値の鍵をそのまま通す `IntegrityPlacementObservedSchema` を除く)。`null` は宣言した項目 (測っていない・まだ無い) だけが持てる。
|
|
99
102
|
|
|
100
103
|
項目の間の規則の出所は 3 つ:
|
|
101
104
|
|
|
@@ -113,8 +116,8 @@ Transport- and DB-agnostic storage metadata AI enrichment core: canonical types,
|
|
|
113
116
|
| --- | --- |
|
|
114
117
|
| `IntegrityStoreSchema` | `QDRANT` / `NEO4J` |
|
|
115
118
|
| `IntegrityScopeRoleSchema` | `PRODUCTION` / `VARIANT` / `LABEL` |
|
|
116
|
-
| `IntegrityItemClassSchema` |
|
|
117
|
-
| `IntegrityFindingItemClassSchema` | 所見を記録する
|
|
119
|
+
| `IntegrityItemClassSchema` | 27 区分 (`EXPECTED`・`LIVE`・`HISTORY`・`TOMBSTONE`・`AWAITING_SUCCESSOR`・情報の 7 区分・不整合の 15 区分)。意味は監査の判定表 (S1 §6.5) が定める |
|
|
120
|
+
| `IntegrityFindingItemClassSchema` | 所見を記録する 24 区分 (`EXPECTED`・`LIVE`・`HISTORY` を除く。`CK_td_integrity_audit_finding_vocabulary`)。所見を開けるのはこの区分の組だけ |
|
|
118
121
|
| `IntegrityUnitSchema` | `POINT` / `NODE` / `CHUNK` / `DOCUMENT` |
|
|
119
122
|
| `IntegrityDispositionSchema` | `EXPECTED` / `HEALTHY` / `RETAINED` / `INFORMATIONAL` / `DISCREPANCY` |
|
|
120
123
|
| `IntegrityRepairActionSchema` | `NONE` / `PURGE` / `FLAG` / `REPROJECT` |
|
|
@@ -123,7 +126,7 @@ Transport- and DB-agnostic storage metadata AI enrichment core: canonical types,
|
|
|
123
126
|
| `IntegrityVerdictSchema` | `CONSISTENT` / `INCONSISTENT` / `UNDETERMINED` |
|
|
124
127
|
| `IntegrityPhaseSchema` | `QDRANT` / `NEO4J` / `DOCUMENTS` |
|
|
125
128
|
| `IntegrityRepairOutcomeSchema` | `APPLIED` / `SKIPPED` / `FAILED` |
|
|
126
|
-
| `IntegrityRepairSkipReasonSchema` | `RECLASSIFIED` / `IN_FLIGHT` / `DESTINATION_PENDING` / `BASIS_EXHAUSTED` / `PROJECTION_REFUSED` / `PIPELINE_FAILED` / `UNRECORDED` / `OUTSIDE` (後の 4 つは、文書の再投影で書き直す項目を、文書を再投影しないときに文書の所属で見送る理由:
|
|
129
|
+
| `IntegrityRepairSkipReasonSchema` | `RECLASSIFIED` / `IN_FLIGHT` / `DESTINATION_PENDING` / `BASIS_EXHAUSTED` / `PROJECTION_REFUSED` / `PIPELINE_FAILED` / `UNRECORDED` / `OUTSIDE` (後の 4 つは、文書の再投影で書き直す項目を、文書を再投影しないときに文書の所属で見送る理由: `PIPELINE_FAILED` は前段の失敗、`UNRECORDED` は投影記録なし、`PROJECTION_REFUSED` は機能フラグか機密区分の方針が投影を拒む、`OUTSIDE` は店が文書を期待しない (ドメインが不明・本番の戦略なし・その店の段が閉じている・生きたチャンクなし)) |
|
|
127
130
|
|
|
128
131
|
区分が扱いと処置を決める (`INTEGRITY_CLASS_POLICY`、`CK_td_integrity_audit_quantity_class_policy` の写し。表と各行は凍結してある):
|
|
129
132
|
|
|
@@ -133,12 +136,12 @@ Transport- and DB-agnostic storage metadata AI enrichment core: canonical types,
|
|
|
133
136
|
| `LIVE` | `HEALTHY` | `NONE` |
|
|
134
137
|
| `HISTORY`・`TOMBSTONE`・`AWAITING_SUCCESSOR` | `RETAINED` | `NONE` |
|
|
135
138
|
| `IN_FLIGHT`・`UNPLACED`・`UNRECORDED`・`UNREFERENCED`・`CHANGED_AFTER_START`・`PIPELINE_FAILED`・`PROJECTION_REFUSED` | `INFORMATIONAL` | `NONE` |
|
|
136
|
-
| `ORPHAN`・`TOMBSTONE_EXPIRED`・`STALE_REVISION`・`MISPLACED`・`OUT_OF_TIER` | `DISCREPANCY` | `PURGE` |
|
|
139
|
+
| `ORPHAN`・`TOMBSTONE_EXPIRED`・`STALE_REVISION`・`MISPLACED`・`OUT_OF_TIER`・`DETACHED`・`UNKEYED` | `DISCREPANCY` | `PURGE` |
|
|
137
140
|
| `UNPROPAGATED_DELETE`・`UNMARKED_SUPERSEDED` | `DISCREPANCY` | `FLAG` |
|
|
138
|
-
| `
|
|
139
|
-
| `FLAG_DRIFT`・`MISSING`・`COUNT_MISMATCH` | `DISCREPANCY` | `REPROJECT` |
|
|
141
|
+
| `VARIANT_FLAG_DRIFT`・`UNKEYED_ENTITY` | `DISCREPANCY` | `NONE` |
|
|
142
|
+
| `FLAG_DRIFT`・`MISSING`・`COUNT_MISMATCH`・`UNPROJECTED` | `DISCREPANCY` | `REPROJECT` |
|
|
140
143
|
|
|
141
|
-
`REPROJECT` は文書に働く。文書の区分 (`MISSING`・`COUNT_MISMATCH`) では文書を再投影し、項目の区分 (`FLAG_DRIFT`) では項目を文書の再投影で書き直し (修復済は文書の再投影が成功したことを表し、項目を読み直さない)、再投影しない文書の項目は理由 (`IntegrityRepairSkipReasonSchema`) を付けて見送る。`OUT_OF_TIER` は `ORPHAN`
|
|
144
|
+
`REPROJECT` は文書に働く。文書の区分 (`MISSING`・`COUNT_MISMATCH` と、段が開いているのにその店の投影の記録も生きた項目も無い文書の `UNPROJECTED`) では文書を再投影し、項目の区分 (`FLAG_DRIFT`) では項目を文書の再投影で書き直し (修復済は文書の再投影が成功したことを表し、項目を読み直さない)、再投影しない文書の項目は理由 (`IntegrityRepairSkipReasonSchema`) を付けて見送る。`OUT_OF_TIER` は `ORPHAN` と同じく除き、形の不整合の `DETACHED` (親の辺の無い旧版のノード) と `UNKEYED` (鍵の無いか記録に収まらない鍵の項目) も除く。どの除去もその数は根拠の走査の組の件数を上限とする。`UNKEYED_ENTITY` (鍵の無い共有の `Entity` のノード) は報告だけ (共有のノードは他の系のマスタの鍵を持ちうる)。
|
|
142
145
|
|
|
143
146
|
判定 (`IntegrityVerdictSchema`) は `DISCREPANCY` の量を数え、`CONSISTENT` になれるのは扱いに依らず全ての量が測れたときだけ (測れた不整合が 1 つでも正なら、他の量の未測定に依らず `INCONSISTENT`)。判定の規則は API サーバーが持ち、この契約は判定と量の突き合わせをしない。判定とタイルは単位 (`IntegrityUnitSchema`) の違う量を足さない。単位を混ぜた唯一の和は、不成功の修復の `repairAppliedItems` (除去したか印を付けた点とノードの数。処置が `PURGE` と `FLAG` の量の直した件数の和で、再投影で書き直した項目は数えない) である。
|
|
144
147
|
|
|
@@ -152,6 +155,8 @@ Transport- and DB-agnostic storage metadata AI enrichment core: canonical types,
|
|
|
152
155
|
| `IntegrityPlacementObservedSchema` | `UNPLACED` と `OUT_OF_TIER` の所見の `observed` を読む形。`sotDomain` (SoT が項目の現行の文書に与えるドメイン) は必須で文字列か `null`、他の観測値の鍵はそのまま通す。`null` は文書がドメインを持たないこと (再同期が導き直す)、`UNPLACED` の文字列は本番の戦略の無いドメイン、`OUT_OF_TIER` の文字列は戦略がその店の段を閉じたドメイン (`OUT_OF_TIER` は必ず文字列を持つ)。組はドメインを混ぜるので、ドメインは行ごとの値で組の値ではない。SoT が書いた値の写しなので空の文字列も拒まない |
|
|
153
156
|
| `IntegrityFindingPageSchema` | 行は `sequence` の昇順で重複しない。`nextAfter` は `null` か、この頁の最後の行の `sequence`。`recordedCount` は `totalCount` と突き合わせない (書き手は鍵の無いグラフのノードを数えた後に標本を取るので、その間に作られたノードで標本が全数を超えうる) |
|
|
154
157
|
| `IntegrityFindingsQuerySchema` | `itemClass` は所見を記録する区分 (`IntegrityFindingItemClassSchema`) だけ。`limit` は必須で 1〜`INTEGRITY_FINDINGS_PAGE_LIMIT_MAX` (100) の整数 (0・負・`NaN`・文字列を拒む)。`after` は 1 以上の整数で、最初の頁では省く |
|
|
158
|
+
| `IntegrityCellResyncRequestSchema` | 一括の再同期の 1 回分の要求 (`runUid`・`store`・`scopeKey`・`itemClass`・`after`)。`itemClass` は `UNRECORDED` だけ (再同期が片付ける唯一の区分。店は文書の生きた項目を持つがその店の投影の記録が無い)。`after` は 1 以上の整数で、最初の回では省く。1 回の件数は要求が選ばず、`INTEGRITY_FINDINGS_PAGE_LIMIT_MAX` (100) に固定する。ホストはテナントの直近の完了した実行にだけ答え、組の所見を記録順に読む |
|
|
159
|
+
| `IntegrityCellResyncResultSchema` | 1 回分の答え (`requeued`・`skipped: { metadataId, reason }[]`・`nextAfter`)。再投入の数と据え置いた文書の数の和 (読んだ文書の数) は 100 以下で、`nextAfter` はちょうど 100 を読んだときだけ在る (最後に読んだ記録順。100 に満たない回は組の終わり)。据え置いた文書は重複しない |
|
|
155
160
|
|
|
156
161
|
- コンソールが監査の実行について送る命令は `IntegrityCommandSchema` (`start` / `cancel`)。命令と失敗の語彙はコンソールの契約の持ち物で、DDL に写しを持たない。
|
|
157
162
|
- 開始・中止の失敗は `IntegrityCommandFailure` (`{command, code, status: 300〜599 の整数 | null}`、`command` で分かれる和の型) で運ぶ。`code` はコンソールが示す文ごとに 1 つ (`IntegrityCommandFailureCodeSchema`) で、各命令はその部分集合だけを持つ (もう一方の命令だけの語彙は `code` の問題として拒み、型でも持てない):
|
|
@@ -194,9 +199,11 @@ Transport- and DB-agnostic storage metadata AI enrichment core: canonical types,
|
|
|
194
199
|
## Installation / インストール
|
|
195
200
|
|
|
196
201
|
```bash
|
|
197
|
-
pnpm add @aiquants/enrichment-core
|
|
202
|
+
pnpm add @aiquants/enrichment-core 'zod@^3.25.0'
|
|
198
203
|
```
|
|
199
204
|
|
|
205
|
+
zod `^3.25.0` は peer dependency (素の `zod` は範囲外の `latest` (4.x) を入れる)。
|
|
206
|
+
|
|
200
207
|
## Usage / 利用例
|
|
201
208
|
|
|
202
209
|
```typescript
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var M=Object.defineProperty;var pt=Object.getOwnPropertyDescriptor;var dt=Object.getOwnPropertyNames;var ut=Object.prototype.hasOwnProperty;var mt=(e,t)=>{for(var n in t)M(e,n,{get:t[n],enumerable:!0})},yt=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of dt(t))!ut.call(e,s)&&s!==n&&M(e,s,{get:()=>t[s],enumerable:!(i=pt(t,s))||i.enumerable});return e};var ft=e=>yt(M({},"__esModule",{value:!0}),e);var xn={};mt(xn,{AmountEntrySchema:()=>me,BaseEnrichmentClient:()=>A,BodySourceSchema:()=>Ze,BoundingBoxSchema:()=>Ct,CIRCUIT_BREAKER_SERVICES:()=>ae,CanonicalDomainKeySchema:()=>Ee,ChapterSegmentSchema:()=>de,ChunkingStrategySchema:()=>xt,CircuitBreakerStatusSchema:()=>bt,ConfidentialityLevelSchema:()=>D,DISPATCH_DEGRADATION_REASONS:()=>ce,DOCUMENT_KINDS:()=>Y,DOCUMENT_KIND_LABELS:()=>Dt,DocumentKindSchema:()=>ne,DocumentStructuredDataSchema:()=>Tt,ENRICHMENT_STAGES:()=>re,EnrichmentClient:()=>H,EnrichmentClientError:()=>g,EnrichmentSyncStatusSchema:()=>Nt,FILTERABLE_CONFIDENTIALITY_LEVELS:()=>St,FileUriSchema:()=>At,GRAPH_INDEX_LIMITS:()=>Cn,GraphSearchHitSchema:()=>he,INTEGRITY_CLASS_POLICY:()=>we,INTEGRITY_COMMAND_CODES:()=>W,INTEGRITY_FINDINGS_PAGE_LIMIT_MAX:()=>Be,IntegrityActiveRunSchema:()=>$e,IntegrityAuditOverviewSchema:()=>Zt,IntegrityCancelFailureCodeSchema:()=>qe,IntegrityCommandFailureCodeSchema:()=>k,IntegrityCommandFailureSchema:()=>pn,IntegrityCommandReplySchema:()=>un,IntegrityCommandSchema:()=>X,IntegrityDispositionSchema:()=>ve,IntegrityFindingItemClassSchema:()=>Fe,IntegrityFindingPageSchema:()=>an,IntegrityFindingSchema:()=>Ve,IntegrityFindingsQuerySchema:()=>sn,IntegrityItemClassSchema:()=>Q,IntegrityPhaseSchema:()=>ze,IntegrityPlacementObservedSchema:()=>nn,IntegrityQuantitySchema:()=>je,IntegrityRepairActionSchema:()=>ke,IntegrityRepairOutcomeSchema:()=>Ke,IntegrityRepairSkipReasonSchema:()=>He,IntegrityRunHeaderSchema:()=>v,IntegrityRunModeSchema:()=>Me,IntegrityRunStatusSchema:()=>Ue,IntegrityScopeRoleSchema:()=>Pe,IntegrityStartFailureCodeSchema:()=>Xe,IntegrityStoreSchema:()=>J,IntegrityUnitSchema:()=>Le,IntegrityVerdictSchema:()=>Ge,LOCAL_DEGRADATION_REASONS:()=>se,MIME_KIND_RULES:()=>Ae,MODE_TIERS:()=>N,ModelProviderSchema:()=>oe,NOTHING_TO_READ_TOKENS:()=>tt,NothingToReadTokenSchema:()=>nt,PIPELINE_FLOWS:()=>Ne,PIPELINE_PHASES:()=>Pt,PIPELINE_STEPS:()=>$,PIPELINE_STEP_KEYS:()=>j,PipelineRunRecordSchema:()=>hn,PipelineRunStatusSchema:()=>Je,PipelineRunSummarySchema:()=>In,PipelineStepKeySchema:()=>x,PipelineStepMetricSchema:()=>Rn,PipelineStepRecordSchema:()=>it,PipelineStepStatusSchema:()=>Qe,PipelineTriggerSchema:()=>We,QUARANTINED_CONFIDENTIALITY_LEVEL:()=>O,REMOTE_DEGRADATION_REASONS:()=>le,SEARCH_DEGRADATION_REASONS:()=>_t,SEARCH_MODES:()=>G,SEARCH_PARAM_LIMITS:()=>Et,SYSTEM_PARAMETER_RANGES:()=>b,SearchHitSchema:()=>Se,SearchMetadataSchema:()=>fe,SearchModeSchema:()=>ye,SearchRequestSchema:()=>z,SearchResponseSchema:()=>K,StageProvenanceSchema:()=>et,TenantIdSchema:()=>pe,TranscriptSegmentSchema:()=>ue,assertBoundedSystemParameter:()=>Kt,assertSystemParameterInRange:()=>zt,classifyDocumentKind:()=>Ot,comparePhases:()=>kt,enrichmentStage:()=>Nn,flowFor:()=>Ft,flowStepGates:()=>Lt,formatSkipReason:()=>yn,generateUuidV7:()=>Tn,integrityCommandFailureCodeOf:()=>dn,isEnrichmentStageKey:()=>An,isStrictlyEarlier:()=>T,isValidUuidV7:()=>lt,modeFusesRankings:()=>Rt,modeNeedsRemoteTiers:()=>ht,modeScoreIsSimilarity:()=>It,narrowModeToAllowedTiers:()=>gt,orderedSteps:()=>vt,parseSkipReason:()=>ot,uuidv7ToDate:()=>bn});module.exports=ft(xn);var g=class extends Error{statusCode;responseBody;parsedBody;constructor(t,n,i,s){super(t),this.name="EnrichmentClientError",this.statusCode=n,this.responseBody=i,this.parsedBody=s}},A=class{baseUrl;apiKey;fetchFn;timeoutMs;constructor(t){if(!t||typeof t.baseUrl!="string"||t.baseUrl.trim().length===0)throw new Error("baseUrl is required and must be a non-empty string for EnrichmentClient.");let n=t.baseUrl.trim().replace(/\/$/,"");if(t.apiKey&&n.startsWith("http://")&&!n.includes("localhost")&&!n.includes("127.0.0.1"))throw new Error("Security Violation: Transmitting Bearer tokens over unencrypted HTTP to non-localhost hosts is strictly prohibited.");this.baseUrl=n,this.apiKey=t.apiKey,this.fetchFn=t.fetchFn??fetch,this.timeoutMs=t.timeoutMs&&t.timeoutMs>0?t.timeoutMs:3e4}async request(t,n,i){let s=`${this.baseUrl}${t}`,c={Accept:"application/json","Content-Type":"application/json","X-Tenant-Id":n};this.apiKey&&(c.Authorization=`Bearer ${this.apiKey}`);let d=new AbortController,m=setTimeout(()=>d.abort(),this.timeoutMs),f;try{f=await this.fetchFn(s,{method:"POST",headers:c,body:JSON.stringify(i),signal:d.signal})}catch(y){let I=y instanceof Error?y.message:String(y);throw new g(`Network request failed for POST ${s}: ${I}`,0,"")}finally{clearTimeout(m)}if(!f.ok){let y=await f.text().catch(()=>""),I;try{I=JSON.parse(y)}catch{}throw new g(`API request failed with status ${f.status}: ${y}`,f.status,y,I)}let R=await f.text().catch(()=>"");if(R.trim().length!==0)try{return JSON.parse(R)}catch(y){let I=y instanceof Error?y.message:String(y);throw new g(`Failed to parse response JSON from ${s}: ${I}`,f.status,R)}}};var r=require("zod");var U=require("zod"),oe=U.z.enum(["google_cloud","google_vision","yomitoku_local","faster_whisper_local","google_speech","ollama_local","openai","anthropic","azure_openai","bedrock","custom_openai_compatible"]),D=U.z.enum(["PUBLIC","INTERNAL","DEPARTMENT","CONFIDENTIAL","RESTRICTED"]),O="RESTRICTED";var Et={rrfK:{min:1,max:200,default:60},alpha:{min:0,max:1,default:.7},threshold:{min:0,max:1},limit:{min:1,max:50,default:10}},ie=D.options.filter(e=>e!==O);if(ie.length===0)throw new Error("The confidentiality vocabulary left nothing filterable after removing the quarantined level; a validator built from this list would reject every request.");var St=ie,G=["KEYWORD","SPARSE","DENSE","HYBRID","GRAPH_TRAVERSE"],N={KEYWORD:{dense:!1,sparse:!1,graph:!1,lexical:!0},SPARSE:{dense:!1,sparse:!0,graph:!1,lexical:!1},DENSE:{dense:!0,sparse:!1,graph:!1,lexical:!1},HYBRID:{dense:!0,sparse:!0,graph:!0,lexical:!0},GRAPH_TRAVERSE:{dense:!1,sparse:!1,graph:!0,lexical:!1}};function ht(e){let t=N[e];return t.dense||t.sparse||t.graph}function It(e){let t=N[e];return t.dense&&!t.sparse}function gt(e,t){let n=N[e],i=(n.dense||n.sparse)&&t.vector,s=n.graph&&t.graph;return i||s?i?s?{mode:e,discardGraph:!1}:n.dense&&n.sparse?{mode:e,discardGraph:!0}:{mode:n.dense?"DENSE":"SPARSE",discardGraph:!1}:{mode:"GRAPH_TRAVERSE",discardGraph:!1}:null}function Rt(e){let t=N[e];return[t.dense,t.sparse,t.graph,t.lexical].filter(Boolean).length>1}var ae=["vector","graph"],se=["empty_query","caller_token_unavailable","time_window_unsupported"],le=["vector_tier_not_configured","graph_tier_not_configured","no_active_vector_collection","vector_collections_missing"],ce=["remote_tiers_unavailable","remote_tiers_timed_out","remote_tiers_refused_caller","remote_tiers_rejected_request","remote_tiers_failed","remote_tiers_not_executed","vector_search_disabled","graph_search_disabled"],_t=[...se,...le,...ce,...ae.map(e=>`circuit_breaker_open:${e}`)];var pe=r.z.string().trim().min(1,"tenant_id must be a non-empty string"),At=r.z.string().trim().min(1,"file_uri must be a non-empty string"),Nt=r.z.enum(["PENDING","EXTRACTING","ENRICHING","PROJECTING","SYNCED","FAILED_EXTRACT","FAILED_ENRICH","FAILED_VECTOR","FAILED_GRAPH"]),Ct=r.z.object({page:r.z.number().int().positive().optional(),x:r.z.number().nonnegative().optional(),y:r.z.number().nonnegative().optional(),width:r.z.number().positive().optional(),height:r.z.number().positive().optional(),start_sec:r.z.number().nonnegative().optional(),end_sec:r.z.number().nonnegative().optional(),frame_index:r.z.number().int().nonnegative().optional(),timestamp_sec:r.z.number().nonnegative().optional(),scene_confidence:r.z.number().min(0).max(1).optional()}),de=r.z.object({title:r.z.string().trim().min(1),start_sec:r.z.number().nonnegative(),end_sec:r.z.number().nonnegative(),summary:r.z.string()}),ue=r.z.object({start_sec:r.z.number().nonnegative(),end_sec:r.z.number().nonnegative(),speaker:r.z.string().trim().min(1),text:r.z.string()}),me=r.z.object({label:r.z.string(),value:r.z.number(),currency:r.z.string()}),Tt=r.z.object({document_type:r.z.string().optional(),title:r.z.string().optional(),organization:r.z.string().optional(),key_entities:r.z.array(r.z.string()).optional(),dates:r.z.array(r.z.string()).optional(),amounts:r.z.array(me).optional(),media_type:r.z.enum(["video","audio"]).optional(),duration_sec:r.z.number().nonnegative().optional(),chapters:r.z.array(de).optional(),transcript_segments:r.z.array(ue).optional()}),bt=r.z.enum(["CLOSED","OPEN","HALF_OPEN"]),ye=r.z.enum(G),fe=r.z.object({circuit_breaker_status:r.z.string(),quality_tier:r.z.string(),latency_ms:r.z.number().nonnegative(),total_hits:r.z.number().int().nonnegative(),fallback_applied:r.z.boolean(),degraded_reason:r.z.string().nullable()}),Ee=r.z.enum(["CONTRACT_LEGAL","EMAIL_THREAD","DAILY_REPORT","FINANCIAL_REPORT","TECHNICAL_SPEC","MASTER_DATA","MEDIA_ASSET","GENERAL_DOCUMENT"]),xt=r.z.enum(["hierarchical","conversation","section","fixed_size","table_aware","semantic","none","multimodal"]),Se=r.z.object({metadata_id:r.z.number().int().positive(),chunk_index:r.z.number().int().nonnegative(),text:r.z.string(),score:r.z.number()}),he=r.z.object({metadata_id:r.z.number().int().positive(),relation:r.z.string(),target_name:r.z.string()}),z=r.z.object({query:r.z.string().trim().min(1,"query must not be empty"),tenant_id:pe,domain_key:Ee.optional(),limit:r.z.number().int().positive().optional(),department_id:r.z.number().int().positive().optional(),search_mode:ye.optional(),strategy_id:r.z.number().int().positive().optional()}).strict(),K=r.z.object({hits:r.z.array(Se),graph_hits:r.z.array(he),tiers:r.z.record(r.z.string(),r.z.boolean()),metadata:fe});var H=class extends A{async search(t){let n=z.parse(t),i=await this.request("/ai/search/hybrid",n.tenant_id,n);return K.parse(i)}};var Y=["email","pdf","office","image","media","text","google_native","other"],Dt={email:"\u30E1\u30FC\u30EB",pdf:"PDF",office:"Office \u6587\u66F8",image:"\u753B\u50CF",media:"\u97F3\u58F0\u30FB\u52D5\u753B",text:"\u30C6\u30AD\u30B9\u30C8",google_native:"Google \u30CD\u30A4\u30C6\u30A3\u30D6",other:"\u305D\u306E\u4ED6"},Ae=[["message/rfc822","email"],["application/pdf","pdf"],["application/vnd.openxmlformats-officedocument.*","office"],["application/msword","office"],["application/vnd.ms-excel","office"],["application/vnd.ms-powerpoint","office"],["application/vnd.google-apps.*","google_native"],["image/svg+xml","text"],["image/emf","other"],["image/x-emf","other"],["image/wmf","other"],["image/x-wmf","other"],["image/*","image"],["audio/*","media"],["video/*","media"],["text/*","text"],["application/json","text"],["application/xml","text"]];function Ot(e){let t=(e.split(";")[0]??"").trim().toLowerCase();for(let[n,i]of Ae)if(n.endsWith("*")?t.startsWith(n.slice(0,-1)):t===n)return i;return"other"}var j=["delete_child_assets","extract_text","analyze_media","extract_assets","ocr_children","ocr_document","resolve_body","enrich_document","project_to_indexes"],Pt=["EXTRACTING","ENRICHING","PROJECTING"],B=e=>({featureFlagKey:e,whenClosed:"skip",failureStatus:null}),Ie=(e,t)=>({featureFlagKey:e,whenClosed:"fail",failureStatus:t}),$={delete_child_assets:{key:"delete_child_assets",label:"\u65E7\u7248\u306E\u5B50\u30A2\u30BB\u30C3\u30C8\u524A\u9664",description:"\u3053\u306E\u7248\u3088\u308A\u524D\u306E\u7248\u304C\u751F\u3093\u3060\u5B50\u30A2\u30BB\u30C3\u30C8\u3092\u4FDD\u7BA1\u5C64\u3068\u7D22\u5F15\u304B\u3089\u5916\u3059\u3002",endpoint:"/ai/assets/delete",phase:"EXTRACTING",failureStatus:"FAILED_EXTRACT",gates:[],capability:null,fanOut:null},extract_text:{key:"extract_text",label:"\u6587\u5B57\u5C64\u306E\u62BD\u51FA",description:"\u6587\u66F8\u304C\u6301\u3064\u6587\u5B57\u5C64 (PDF \u306E\u6587\u5B57\u30FBOffice \u306E\u672C\u6587\u30FB\u30E1\u30FC\u30EB\u306E\u672C\u6587\u3068\u898B\u51FA\u3057) \u3092\u8AAD\u307F\u3001\u4F4D\u7F6E\u60C5\u5831\u3068\u5171\u306B\u4FDD\u5B58\u3059\u308B\u3002",endpoint:"/ai/enrichment/extract",phase:"EXTRACTING",failureStatus:"FAILED_EXTRACT",gates:[],capability:null,fanOut:null},analyze_media:{key:"analyze_media",label:"\u30E1\u30C7\u30A3\u30A2\u89E3\u6790",description:"\u97F3\u58F0\u30FB\u52D5\u753B\u3092\u8EE2\u5199\u3057\u3001\u767A\u8A71\u533A\u9593\u4ED8\u304D\u306E\u30C1\u30E3\u30F3\u30AF\u3068\u30AD\u30FC\u30D5\u30EC\u30FC\u30E0\u6570\u3092\u8A18\u9332\u3059\u308B\u3002",endpoint:"/ai/media/analyze",phase:"EXTRACTING",failureStatus:"FAILED_EXTRACT",gates:[B("ENABLE_MEDIA_ANALYSIS")],capability:"transcription",fanOut:null},extract_assets:{key:"extract_assets",label:"\u5B50\u30A2\u30BB\u30C3\u30C8\u306E\u62BD\u51FA",description:"\u57CB\u3081\u8FBC\u307F\u753B\u50CF\u3084\u30E1\u30FC\u30EB\u306E\u6DFB\u4ED8\u3092\u5B50\u30A2\u30BB\u30C3\u30C8\u3068\u3057\u3066\u5207\u308A\u51FA\u3057\u3001\u6587\u66F8\u306E\u96A3\u306B\u4FDD\u7BA1\u3057\u3066\u767B\u9332\u3059\u308B\u3002",endpoint:"/ai/assets/extract",phase:"EXTRACTING",failureStatus:"FAILED_EXTRACT",gates:[B("ENABLE_ASSET_EXTRACTION")],capability:"asset_extraction",fanOut:null},ocr_children:{key:"ocr_children",label:"\u5B50\u30A2\u30BB\u30C3\u30C8\u306E\u8AAD\u307F\u53D6\u308A",description:"\u5207\u308A\u51FA\u3057\u305F\u5B50\u30A2\u30BB\u30C3\u30C8\u3092\u62BD\u51FA\u9806\u306B 1 \u4EF6\u305A\u3064\u8AAD\u307F\u3001\u6587\u5B57\u5C64\u3092\u8AAD\u3081\u308B\u5B50 (\u30C6\u30AD\u30B9\u30C8\u30FB\u30E1\u30FC\u30EB\u30FBOffice\u30FBPDF) \u306F\u305D\u306E\u6587\u5B57\u5C64\u3092\u3001\u8AAD\u3081\u306A\u3044\u5B50\u306F\u7248\u9762\u3092\u5149\u5B66\u8A8D\u8B58\u3067\u8AAD\u3093\u3067\u3001\u5B50\u3054\u3068\u306B\u672C\u6587\u3068\u51FA\u6240\u3092\u4FDD\u5B58\u3059\u308B\u3002",endpoint:"/ai/ocr/run",phase:"EXTRACTING",failureStatus:"FAILED_EXTRACT",gates:[],capability:"ocr",fanOut:"children"},ocr_document:{key:"ocr_document",label:"\u6587\u66F8\u306E OCR",description:"\u6587\u66F8\u81EA\u8EAB\u306E\u7248\u9762 (\u753B\u50CF\u30FBPDF \u306E\u5404\u30DA\u30FC\u30B8) \u3092\u5149\u5B66\u8A8D\u8B58\u306B\u304B\u3051\u308B\u3002",endpoint:"/ai/ocr/run",phase:"EXTRACTING",failureStatus:"FAILED_EXTRACT",gates:[B("ENABLE_OCR")],capability:"ocr",fanOut:null},resolve_body:{key:"resolve_body",label:"\u672C\u6587\u306E\u78BA\u5B9A",description:"\u6587\u5B57\u5C64\u30FBOCR\u30FB\u8EE2\u5199\u306E\u3069\u308C\u3092\u672C\u6587\u3068\u3059\u308B\u304B\u3092\u6C7A\u3081\u3001\u51FA\u6240\u3092\u8A18\u9332\u3059\u308B\u3002",endpoint:"/ai/enrichment/body",phase:"ENRICHING",failureStatus:"FAILED_ENRICH",gates:[],capability:null,fanOut:null},enrich_document:{key:"enrich_document",label:"\u8981\u7D04\u3068\u69CB\u9020\u5316\u62BD\u51FA",description:"\u672C\u6587\u3092\u30E2\u30C7\u30EB\u3078\u6E21\u3057\u3001\u8981\u7D04\u30FB\u30BF\u30B0\u30FB\u69CB\u9020\u5316\u30C7\u30FC\u30BF\u30FB\u30C9\u30E1\u30A4\u30F3\u5206\u985E\u3092\u5F97\u308B\u3002",endpoint:"/ai/enrichment/document",phase:"ENRICHING",failureStatus:"FAILED_ENRICH",gates:[],capability:"enrichment",fanOut:null},project_to_indexes:{key:"project_to_indexes",label:"\u30D9\u30AF\u30C8\u30EB\u3068\u30B0\u30E9\u30D5\u3078\u306E\u6295\u5F71",description:"\u672C\u6587\u3092\u30C1\u30E3\u30F3\u30AF\u306B\u3057\u3066\u57CB\u3081\u8FBC\u307F\u3001\u30D9\u30AF\u30C8\u30EB\u7D22\u5F15\u3068\u30CA\u30EC\u30C3\u30B8\u30B0\u30E9\u30D5\u3078\u66F8\u304F\u3002",endpoint:"/ai/enrichment/project",phase:"PROJECTING",failureStatus:"FAILED_VECTOR",gates:[Ie("ENABLE_VECTOR_INDEXING","FAILED_VECTOR"),Ie("ENABLE_GRAPH_INDEXING","FAILED_GRAPH")],capability:null,fanOut:null}},ge={whenClosed:"fail",failureStatus:"FAILED_EXTRACT"},P=[{step:"delete_child_assets",dependsOn:[]},{step:"extract_text",dependsOn:["delete_child_assets"]},{step:"extract_assets",dependsOn:["extract_text"]},{step:"ocr_children",dependsOn:["extract_assets"]},{step:"ocr_document",dependsOn:["extract_text"]},{step:"resolve_body",dependsOn:["ocr_children","ocr_document"]},{step:"enrich_document",dependsOn:["resolve_body"]},{step:"project_to_indexes",dependsOn:["enrich_document"],chunkSource:"rebuild"}],Re=[{step:"delete_child_assets",dependsOn:[]},{step:"extract_text",dependsOn:["delete_child_assets"]},{step:"resolve_body",dependsOn:["extract_text"]},{step:"enrich_document",dependsOn:["resolve_body"]},{step:"project_to_indexes",dependsOn:["enrich_document"],chunkSource:"rebuild"}],Ne={email:{kind:"email",steps:P},pdf:{kind:"pdf",steps:P},office:{kind:"office",steps:P},google_native:{kind:"google_native",steps:P},image:{kind:"image",steps:[{step:"delete_child_assets",dependsOn:[]},{step:"ocr_document",dependsOn:["delete_child_assets"],gatePolicy:ge},{step:"resolve_body",dependsOn:["ocr_document"]},{step:"enrich_document",dependsOn:["resolve_body"]},{step:"project_to_indexes",dependsOn:["enrich_document"],chunkSource:"rebuild"}]},media:{kind:"media",steps:[{step:"delete_child_assets",dependsOn:[]},{step:"analyze_media",dependsOn:["delete_child_assets"],gatePolicy:ge},{step:"resolve_body",dependsOn:["analyze_media"]},{step:"enrich_document",dependsOn:["resolve_body"]},{step:"project_to_indexes",dependsOn:["enrich_document"],chunkSource:"existing"}]},text:{kind:"text",steps:Re},other:{kind:"other",steps:Re}};function Ft(e){return Ne[e]}function Lt(e){let{gates:t}=$[e.step],{gatePolicy:n}=e;return n===void 0?t:t.map(i=>({featureFlagKey:i.featureFlagKey,whenClosed:n.whenClosed,failureStatus:n.failureStatus}))}function vt(e){let t=new Map(e.steps.map(c=>[c.step,c]));for(let c of e.steps){if(c.gatePolicy!==void 0&&$[c.step].gates.length===0)throw new Error(`Flow ${e.kind}: step ${c.step} overrides its gate policy, but the step has no gate to close.`);for(let d of c.dependsOn)if(!t.has(d))throw new Error(`Flow ${e.kind}: step ${c.step} depends on ${d}, which the flow does not contain.`)}let n=[...e.steps],i=new Set,s=[];for(;n.length>0;){let c=n.findIndex(m=>m.dependsOn.every(f=>i.has(f)));if(c===-1)throw new Error(`Flow ${e.kind}: the steps ${n.map(m=>m.step).join(", ")} depend on each other in a cycle.`);let[d]=n.splice(c,1);i.add(d.step),s.push(d)}return s}var _e={EXTRACTING:0,ENRICHING:1,PROJECTING:2};function kt(e,t){return _e[e]-_e[t]}var o=require("zod");var Ce=[{code:"DEPLOYMENT_DISABLED",status:503,errorCode:5035},{code:"RUN_ALREADY_ACTIVE",status:409,errorCode:4091},{code:"BASIS_INVALID",status:409,errorCode:4092},{code:"RUN_ALREADY_FINISHED",status:409,errorCode:4093},{code:"FORBIDDEN",status:403,errorCode:null}];var F=require("zod"),C=F.z.string().uuid().transform(e=>e.toLowerCase()),u=F.z.string().datetime({offset:!0}),l=(e,t,n)=>{e.addIssue({code:F.z.ZodIssueCode.custom,path:[...t],message:n})},Mt=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?(?:Z|([+-])(\d{2}):?(\d{2}))$/,Te=e=>{let t=u.safeParse(e).success?Mt.exec(e):null;if(t===null)return null;let[,n,i,s,c,d,m,f,R,y,I]=t,w=new Date(0);w.setUTCFullYear(Number(n),Number(i)-1,Number(s)),w.setUTCHours(Number(c),Number(d),m===void 0?0:Number(m),0);let ct=R===void 0?0:(R==="+"?1:-1)*(Number(y)*3600+Number(I)*60);return{epochSeconds:w.getTime()/1e3-ct,fraction:f===void 0?"":f}},T=(e,t)=>{let n=Te(e),i=Te(t);if(n===null||i===null)return!1;if(n.epochSeconds!==i.epochSeconds)return n.epochSeconds<i.epochSeconds;let s=Math.max(n.fraction.length,i.fraction.length);return n.fraction.padEnd(s,"0")<i.fraction.padEnd(s,"0")};var be={INTEGRITY_TOMBSTONE_RETENTION_DAYS:{min:1,max:3650},INTEGRITY_FINDING_SAMPLE_LIMIT:{min:1,max:5e3},INTEGRITY_RUN_HEARTBEAT_TIMEOUT_SECONDS:{min:30,max:3600},INTEGRITY_RUN_RETENTION_COUNT:{min:2,max:100},POLICY_CONFLICT_MAX_TIE_GROUP_SIZE:{min:2,max:60}};var Gt=e=>{for(let t of Object.values(e))Object.freeze(t);return Object.freeze(e)},b=Gt(be),xe=e=>Object.hasOwn(b,e),De=(e,t)=>{let{min:n,max:i}=b[e];if(!Number.isInteger(t)||t<n||t>i)throw new RangeError(`${e} \u306F ${n}\u301C${i} \u306E\u6574\u6570\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002`)},zt=(e,t)=>{xe(e)&&De(e,t)},Kt=(e,t)=>{if(!xe(e))throw new TypeError(`The range table bounds no parameter named ${JSON.stringify(e)}.`);De(e,t)};var J=o.z.enum(["QDRANT","NEO4J"]),Pe=o.z.enum(["PRODUCTION","VARIANT","LABEL"]),Q=o.z.enum(["EXPECTED","LIVE","HISTORY","TOMBSTONE","AWAITING_SUCCESSOR","IN_FLIGHT","UNPLACED","UNRECORDED","UNREFERENCED","CHANGED_AFTER_START","PIPELINE_FAILED","PROJECTION_REFUSED","ORPHAN","TOMBSTONE_EXPIRED","UNPROPAGATED_DELETE","STALE_REVISION","MISPLACED","OUT_OF_TIER","UNMARKED_SUPERSEDED","FLAG_DRIFT","VARIANT_FLAG_DRIFT","DETACHED","UNKEYED","MISSING","COUNT_MISMATCH"]),Fe=Q.exclude(["EXPECTED","LIVE","HISTORY"]),Le=o.z.enum(["POINT","NODE","CHUNK","DOCUMENT"]),ve=o.z.enum(["EXPECTED","HEALTHY","RETAINED","INFORMATIONAL","DISCREPANCY"]),ke=o.z.enum(["NONE","PURGE","FLAG","REPROJECT"]),p=(e,t)=>Object.freeze({disposition:e,repairAction:t}),we=Object.freeze({EXPECTED:p("EXPECTED","NONE"),LIVE:p("HEALTHY","NONE"),HISTORY:p("RETAINED","NONE"),TOMBSTONE:p("RETAINED","NONE"),AWAITING_SUCCESSOR:p("RETAINED","NONE"),IN_FLIGHT:p("INFORMATIONAL","NONE"),UNPLACED:p("INFORMATIONAL","NONE"),UNRECORDED:p("INFORMATIONAL","NONE"),UNREFERENCED:p("INFORMATIONAL","NONE"),CHANGED_AFTER_START:p("INFORMATIONAL","NONE"),PIPELINE_FAILED:p("INFORMATIONAL","NONE"),PROJECTION_REFUSED:p("INFORMATIONAL","NONE"),ORPHAN:p("DISCREPANCY","PURGE"),TOMBSTONE_EXPIRED:p("DISCREPANCY","PURGE"),UNPROPAGATED_DELETE:p("DISCREPANCY","FLAG"),STALE_REVISION:p("DISCREPANCY","PURGE"),MISPLACED:p("DISCREPANCY","PURGE"),OUT_OF_TIER:p("DISCREPANCY","PURGE"),UNMARKED_SUPERSEDED:p("DISCREPANCY","FLAG"),FLAG_DRIFT:p("DISCREPANCY","REPROJECT"),VARIANT_FLAG_DRIFT:p("DISCREPANCY","NONE"),DETACHED:p("DISCREPANCY","NONE"),UNKEYED:p("DISCREPANCY","NONE"),MISSING:p("DISCREPANCY","REPROJECT"),COUNT_MISMATCH:p("DISCREPANCY","REPROJECT")}),Me=o.z.enum(["SCAN","REPAIR"]),Ue=o.z.enum(["RUNNING","COMPLETED","FAILED","CANCELLED","ABANDONED"]),Ge=o.z.enum(["CONSISTENT","INCONSISTENT","UNDETERMINED"]),ze=o.z.enum(["QDRANT","NEO4J","DOCUMENTS"]),Ke=o.z.enum(["APPLIED","SKIPPED","FAILED"]),He=o.z.enum(["RECLASSIFIED","IN_FLIGHT","DESTINATION_PENDING","BASIS_EXHAUSTED","PROJECTION_REFUSED","PIPELINE_FAILED","UNRECORDED","OUTSIDE"]),Be=100,E=o.z.number().int().nonnegative(),L=o.z.number().int().min(300).max(599),V=["repairedCount","repairFailedCount","repairSkippedCount"],Ye=o.z.string().regex(/^[0-9a-f]{64}$/,"A store fingerprint is 64 lowercase hexadecimal digits."),Oe=b.INTEGRITY_TOMBSTONE_RETENTION_DAYS,Ht=o.z.object({runUid:C,mode:Me,status:Ue,requestedBy:o.z.string().min(1),executor:o.z.string().min(1),basisRunUid:C.nullable(),storeFingerprint:Ye,tombstoneRetentionDays:o.z.number().int().min(Oe.min).max(Oe.max),startedAt:u,finishedAt:u.nullable(),verdict:Ge.nullable(),errorClass:o.z.string().min(1).nullable(),reprojectDocuments:E.nullable(),reprojectRebuildDocuments:E.nullable()}).strict(),Bt=(e,t)=>{let n=e.status==="COMPLETED";e.mode==="REPAIR"!=(e.basisRunUid!==null)&&l(t,["basisRunUid"],"A REPAIR run names its basis SCAN run, and a SCAN run names none."),n!==(e.verdict!==null)&&l(t,["verdict"],"Only a COMPLETED run has a verdict."),n!==(e.reprojectDocuments!==null)&&l(t,["reprojectDocuments"],"Only a COMPLETED run has the count of documents to re-project.");let{reprojectDocuments:i,reprojectRebuildDocuments:s}=e;i===null||s===null?i!==s&&l(t,["reprojectRebuildDocuments"],"The documents a re-projection embeds are counted together with the documents it re-projects."):s>i&&l(t,["reprojectRebuildDocuments"],"The documents a re-projection embeds are no more than the documents it re-projects."),e.status==="RUNNING"!=(e.finishedAt===null)&&l(t,["finishedAt"],"Only a RUNNING run has not finished."),e.finishedAt!==null&&T(e.finishedAt,e.startedAt)&&l(t,["finishedAt"],"A run does not finish before it starts."),(e.status==="FAILED"||e.status==="ABANDONED")!=(e.errorClass!==null)&&l(t,["errorClass"],"Only a FAILED or ABANDONED run names an error class.")},v=Ht.superRefine(Bt),Yt=o.z.object({store:J,scopeKey:o.z.string().min(1),scopeRole:Pe,itemClass:Q,unit:Le,disposition:ve,repairAction:ke,itemCount:E.nullable(),unmeasuredReason:o.z.string().min(1).nullable(),measuredAt:u.nullable(),repairedCount:E.nullable(),repairFailedCount:E.nullable(),repairSkippedCount:E.nullable()}).strict(),jt=(e,t)=>{let n=we[e.itemClass];e.disposition!==n.disposition&&l(t,["disposition"],`A ${e.itemClass} quantity is ${n.disposition}.`),e.repairAction!==n.repairAction&&l(t,["repairAction"],`A repair's action on ${e.itemClass} items is ${n.repairAction}.`);let i=e.itemCount===null;i!==(e.unmeasuredReason!==null)&&l(t,["unmeasuredReason"],"An unmeasured quantity (itemCount null) has a reason, and a measured one has none."),i!==(e.measuredAt===null)&&l(t,["measuredAt"],"Only a measured quantity has a measurement time.");let{repairedCount:s,repairFailedCount:c,repairSkippedCount:d}=e;if(s===null||c===null||d===null){if(V.some(m=>e[m]!==null))for(let m of V)e[m]===null&&l(t,[m],"The repaired, failed and skipped counts are recorded together or not at all.");return}e.repairAction==="NONE"&&l(t,["repairAction"],"Only a class with a repair action carries repair counts."),e.itemCount!==null&&s+c+d>e.itemCount&&l(t,["itemCount"],"The repaired, failed and skipped counts together do not exceed the measured count.")},je=Yt.superRefine(jt),$t=o.z.object({run:v,phase:ze.nullable(),phaseScope:o.z.string().min(1).nullable(),phaseDone:E.nullable(),phaseTotal:E.nullable(),heartbeatAt:u,isStale:o.z.boolean(),cancelRequestedAt:u.nullable()}).strict(),Vt=(e,t)=>{if(e.run.status!=="RUNNING"&&l(t,["run","status"],"The active run is a RUNNING run."),T(e.heartbeatAt,e.run.startedAt)&&l(t,["heartbeatAt"],"A run's heartbeat is not earlier than its start."),e.phase===null)for(let n of["phaseScope","phaseDone","phaseTotal"])e[n]!==null&&l(t,[n],"A run with no phase has no phase progress.");e.phase==="DOCUMENTS"&&e.phaseScope!==null&&l(t,["phaseScope"],"The DOCUMENTS phase scans no scope.")},$e=$t.superRefine(Vt),Xt=o.z.object({run:v,quantities:o.z.array(je),previousStoreFingerprint:Ye.nullable()}).strict(),qt=(e,t)=>{e.run.status!=="COMPLETED"&&l(t,["run","status"],"The last completed run is a COMPLETED run.");let n=new Set;for(let[i,s]of e.quantities.entries()){let c=JSON.stringify([s.store,s.scopeKey,s.itemClass]);if(n.has(c)&&l(t,["quantities",i],"A run records each (store, scope, class) cell once."),n.add(c),e.run.mode==="SCAN")for(let d of V)s[d]!==null&&l(t,["quantities",i,d],"A SCAN run repairs nothing, so its quantities carry no repair counts.")}},Jt=["FAILED","CANCELLED","ABANDONED"],Qt=o.z.object({run:v,repairAppliedItems:E.nullable(),hasNewerRepair:o.z.boolean()}).strict(),Wt=(e,t)=>{Jt.includes(e.run.status)||l(t,["run","status"],"A newer unsuccessful run is FAILED, CANCELLED or ABANDONED."),e.run.mode==="SCAN"&&e.repairAppliedItems!==null&&l(t,["repairAppliedItems"],"A SCAN run applies nothing."),e.run.mode==="REPAIR"&&!e.hasNewerRepair&&l(t,["hasNewerRepair"],"An unsuccessful REPAIR run is itself a repair newer than the last completed run.")},Zt=o.z.object({readAt:u,lastCompleted:Xt.superRefine(qt).nullable(),active:$e.nullable(),newerUnsuccessful:Qt.superRefine(Wt).nullable()}).strict(),en=o.z.object({sequence:o.z.number().int().min(1),itemKey:o.z.string().min(1),metadataId:o.z.number().int().positive().nullable(),fileUri:o.z.string().nullable(),revision:o.z.number().int().nullable(),observed:o.z.record(o.z.string(),o.z.unknown()),repairOutcome:Ke.nullable(),repairErrorClass:o.z.string().min(1).nullable(),repairSkipReason:He.nullable()}).strict(),tn=(e,t)=>{e.repairOutcome==="FAILED"!=(e.repairErrorClass!==null)&&l(t,["repairErrorClass"],"Only a FAILED finding names an error class."),e.repairOutcome==="SKIPPED"!=(e.repairSkipReason!==null)&&l(t,["repairSkipReason"],"Only a SKIPPED finding names a skip reason.")},Ve=en.superRefine(tn),nn=o.z.object({sotDomain:o.z.string().nullable()}).passthrough(),rn=o.z.object({rows:o.z.array(Ve),nextAfter:o.z.number().int().min(1).nullable(),recordedCount:E,totalCount:E.nullable()}).strict(),on=(e,t)=>{for(let[n,i]of e.rows.entries()){let s=e.rows[n-1];s!==void 0&&i.sequence<=s.sequence&&l(t,["rows",n,"sequence"],"A page lists its rows in ascending sequence.")}e.nextAfter!==null&&e.nextAfter!==e.rows.at(-1)?.sequence&&l(t,["nextAfter"],"The next page starts after the sequence of this page's last row.")},an=rn.superRefine(on),sn=o.z.object({runUid:C,store:J,scopeKey:o.z.string().min(1),itemClass:Fe,after:o.z.number().int().min(1).optional(),limit:o.z.number().int().min(1).max(Be)}).strict(),k=o.z.enum(["DEPLOYMENT_DISABLED","RUN_ALREADY_ACTIVE","BASIS_INVALID","RUN_ALREADY_FINISHED","FORBIDDEN","UPSTREAM_FAILED"]),X=o.z.enum(["start","cancel"]),Xe=k.extract(["DEPLOYMENT_DISABLED","RUN_ALREADY_ACTIVE","BASIS_INVALID","FORBIDDEN","UPSTREAM_FAILED"]),qe=k.extract(["DEPLOYMENT_DISABLED","RUN_ALREADY_FINISHED","FORBIDDEN","UPSTREAM_FAILED"]),q={start:Xe,cancel:qe},ln=o.z.object({code:k.exclude(["UPSTREAM_FAILED"]),status:L,errorCode:o.z.number().int().nullable()}).strict(),W=Object.freeze(o.z.array(ln).parse(Ce).map(e=>Object.freeze(e))),cn=(e,t)=>{e.code==="UPSTREAM_FAILED"||e.code==="FORBIDDEN"&&e.status===null||W.some(n=>n.code===e.code&&n.status===e.status)||l(t,["status"],`A ${e.code} failure carries the status of its row in the code table.`)},pn=o.z.discriminatedUnion("command",[o.z.object({command:X.extract(["start"]),code:q.start,status:L.nullable()}).strict(),o.z.object({command:X.extract(["cancel"]),code:q.cancel,status:L.nullable()}).strict()]).superRefine(cn),dn=(e,t,n)=>{let i=q[e],s=W.find(c=>c.status===t&&(c.errorCode===null||c.errorCode===n)&&i.safeParse(c.code).success);return s===void 0?"UPSTREAM_FAILED":s.code},un=o.z.discriminatedUnion("ok",[o.z.object({ok:o.z.literal(!0),runUid:C}).strict(),o.z.object({ok:o.z.literal(!1),status:L,errorCode:o.z.number().int().nullable()}).strict()]);var a=require("zod");var ne=a.z.enum(Y),x=a.z.enum(j),Je=a.z.enum(["RUNNING","SUCCEEDED","FAILED"]),Qe=a.z.enum(["RUNNING","SUCCEEDED","SKIPPED","FAILED"]),We=a.z.enum(["ingest","retry","resync"]),Ze=a.z.enum(["text_layer","ocr","transcript"]),S=a.z.number().int().nonnegative().nullable(),et=a.z.object({provider:a.z.string().nullable(),model:a.z.string().nullable(),engine:a.z.string().nullable(),prompt_key:a.z.string().nullable(),prompt_version:a.z.number().int().nullable(),duration_ms:S,input_chars:S,output_chars:S,pages_read:S,pages_total:S,chunk_count:S,points_upserted:S,collection:a.z.string().nullable(),embedding_model:a.z.string().nullable(),strategy_id:a.z.number().int().positive().nullable(),graph_nodes:S,body_source:Ze.nullable(),detail:a.z.record(a.z.string(),a.z.unknown())}).strict(),tt=["no_pages","no_pages_rendered"],nt=a.z.enum(tt),Z="gate_closed:",ee="source_skipped:",te="nothing_to_read:",rt="no_children",mn=/^[A-Z][A-Z0-9_]*$/;function ot(e){if(e===rt)return{kind:"no_children"};if(e.startsWith(Z)){let t=e.slice(Z.length);return mn.test(t)?{kind:"gate_closed",featureFlagKey:t}:null}if(e.startsWith(ee)){let t=x.safeParse(e.slice(ee.length));return t.success?{kind:"source_skipped",stepKey:t.data}:null}if(e.startsWith(te)){let t=nt.safeParse(e.slice(te.length));return t.success?{kind:"nothing_to_read",token:t.data}:null}return null}function yn(e){let t=fn(e);if(ot(t)===null)throw new RangeError(`Skip reason ${JSON.stringify(e)} has no text form: ${JSON.stringify(t)} is outside the skip-reason grammar.`);return t}function fn(e){switch(e.kind){case"gate_closed":return`${Z}${e.featureFlagKey}`;case"no_children":return rt;case"source_skipped":return`${ee}${e.stepKey}`;case"nothing_to_read":return`${te}${e.token}`;default:{let t=e;throw new RangeError(`Unknown skip reason kind: ${JSON.stringify(t)}`)}}}var En=a.z.object({id:a.z.number().int().positive(),runId:a.z.number().int().positive(),sequence:a.z.number().int().nonnegative(),stepKey:x,targetMetadataId:a.z.number().int().positive(),status:Qe,skipReason:a.z.string().nullable(),provenance:et.nullable(),strategyId:a.z.number().int().positive().nullable(),httpStatus:a.z.number().int().nullable(),errorCode:a.z.string().nullable(),errorMessage:a.z.string().nullable(),startedAt:u,finishedAt:u.nullable(),durationMs:S}).strict();function Sn(e,t){switch(e.status){case"SKIPPED":e.skipReason===null&&l(t,["skipReason"],"A SKIPPED step must record why it was skipped."),e.provenance!==null&&l(t,["provenance"],"A SKIPPED step read nothing, so it has no report.");return;case"SUCCEEDED":e.provenance===null&&l(t,["provenance"],"A SUCCEEDED step must carry its report."),e.skipReason!==null&&l(t,["skipReason"],"A SUCCEEDED step was not skipped.");return;case"RUNNING":e.finishedAt!==null&&l(t,["finishedAt"],"A RUNNING step has not finished.");return;case"FAILED":e.skipReason!==null&&l(t,["skipReason"],"A FAILED step was not skipped.");return}}var it=En.superRefine(Sn),at=a.z.object({id:a.z.number().int().positive(),tenantId:a.z.string().min(1),metadataId:a.z.number().int().positive(),revision:a.z.number().int().positive(),runUid:a.z.string().uuid(),jobId:a.z.string().min(1),attempt:a.z.number().int().positive(),trigger:We,documentKind:ne,flowKey:a.z.string().min(1),status:Je,retryScheduled:a.z.boolean(),failedStepKey:x.nullable(),errorMessage:a.z.string().nullable(),requestedBy:a.z.string().min(1),startedAt:u,finishedAt:u.nullable(),steps:a.z.array(it)}).strict();function st(e,t){e.retryScheduled&&e.status!=="FAILED"&&l(t,["retryScheduled"],"Only a FAILED run can have a retry scheduled.")}var hn=at.superRefine(st),In=at.omit({steps:!0}).superRefine(st);function gn(e,t){e.sampleCount>0||(e.durationP50Ms!==null&&l(t,["durationP50Ms"],"A step with no sample has no median latency."),e.durationP95Ms!==null&&l(t,["durationP95Ms"],"A step with no sample has no 95th-percentile latency."))}var Rn=a.z.object({documentKind:ne,stepKey:x,sampleCount:a.z.number().int().nonnegative(),succeeded:a.z.number().int().nonnegative(),failed:a.z.number().int().nonnegative(),skipped:a.z.number().int().nonnegative(),durationP50Ms:S,durationP95Ms:S,lastStartedAt:u.nullable()}).strict().superRefine(gn);var re=[{key:"enable_summary_generation",featureFlagKey:null,label:"\u8981\u7D04\u751F\u6210"},{key:"enable_structured_extraction",featureFlagKey:null,label:"\u69CB\u9020\u5316\u62BD\u51FA"},{key:"enable_asset_extraction",featureFlagKey:"ENABLE_ASSET_EXTRACTION",label:"\u30A2\u30BB\u30C3\u30C8\u62BD\u51FA"},{key:"enable_vector_indexing",featureFlagKey:"ENABLE_VECTOR_INDEXING",label:"\u30D9\u30AF\u30C8\u30EB\u7D22\u5F15"},{key:"enable_graph_indexing",featureFlagKey:"ENABLE_GRAPH_INDEXING",label:"\u30B0\u30E9\u30D5\u6295\u5F71"}],_n=new Set(re.map(e=>e.key));function An(e){return _n.has(e)}function Nn(e){let t=re.find(n=>n.key===e);if(t===void 0)throw new Error(`ENRICHMENT_STAGES does not carry ${e}; the canonical list and the key type have drifted apart.`);return t}var Cn={pageSize:{min:1,max:200,default:50},topologyLabels:{min:1,max:24,default:24}};var _=-1,h=0;function lt(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)}function Tn(){let e=typeof globalThis<"u"&&globalThis.crypto?globalThis.crypto:typeof crypto<"u"?crypto:void 0;if(!e||typeof e.getRandomValues!="function")throw new Error("Cryptographically secure random number generator (crypto.getRandomValues) is required but not available.");let t=new Uint8Array(16);e.getRandomValues(t);let n=Date.now();if(n===_){if(h++,h>4095){for(;Date.now()<=_;);n=Date.now(),_=n,h=(t[6]<<4|t[7]&15)&1023}}else n>_?(_=n,h=(t[6]<<4|t[7]&15)&1023):(n=_,h++,h>4095&&(h=0));t[0]=Math.floor(n/1099511627776)&255,t[1]=Math.floor(n/4294967296)&255,t[2]=n>>>24&255,t[3]=n>>>16&255,t[4]=n>>>8&255,t[5]=n&255,t[6]=112|h>>>8&15,t[7]=h&255,t[8]=128|t[8]&63;let i=Array.from(t,c=>c.toString(16).padStart(2,"0")).join("");return`${i.slice(0,8)}-${i.slice(8,12)}-${i.slice(12,16)}-${i.slice(16,20)}-${i.slice(20)}`}function bn(e){if(!lt(e))throw new Error(`Invalid RFC 9562 UUIDv7 string: "${e}"`);let t=e.slice(0,8)+e.slice(9,13),n=parseInt(t,16);if(Number.isNaN(n))throw new Error(`Invalid hex timestamp in UUIDv7: "${t}"`);return new Date(n)}0&&(module.exports={AmountEntrySchema,BaseEnrichmentClient,BodySourceSchema,BoundingBoxSchema,CIRCUIT_BREAKER_SERVICES,CanonicalDomainKeySchema,ChapterSegmentSchema,ChunkingStrategySchema,CircuitBreakerStatusSchema,ConfidentialityLevelSchema,DISPATCH_DEGRADATION_REASONS,DOCUMENT_KINDS,DOCUMENT_KIND_LABELS,DocumentKindSchema,DocumentStructuredDataSchema,ENRICHMENT_STAGES,EnrichmentClient,EnrichmentClientError,EnrichmentSyncStatusSchema,FILTERABLE_CONFIDENTIALITY_LEVELS,FileUriSchema,GRAPH_INDEX_LIMITS,GraphSearchHitSchema,INTEGRITY_CLASS_POLICY,INTEGRITY_COMMAND_CODES,INTEGRITY_FINDINGS_PAGE_LIMIT_MAX,IntegrityActiveRunSchema,IntegrityAuditOverviewSchema,IntegrityCancelFailureCodeSchema,IntegrityCommandFailureCodeSchema,IntegrityCommandFailureSchema,IntegrityCommandReplySchema,IntegrityCommandSchema,IntegrityDispositionSchema,IntegrityFindingItemClassSchema,IntegrityFindingPageSchema,IntegrityFindingSchema,IntegrityFindingsQuerySchema,IntegrityItemClassSchema,IntegrityPhaseSchema,IntegrityPlacementObservedSchema,IntegrityQuantitySchema,IntegrityRepairActionSchema,IntegrityRepairOutcomeSchema,IntegrityRepairSkipReasonSchema,IntegrityRunHeaderSchema,IntegrityRunModeSchema,IntegrityRunStatusSchema,IntegrityScopeRoleSchema,IntegrityStartFailureCodeSchema,IntegrityStoreSchema,IntegrityUnitSchema,IntegrityVerdictSchema,LOCAL_DEGRADATION_REASONS,MIME_KIND_RULES,MODE_TIERS,ModelProviderSchema,NOTHING_TO_READ_TOKENS,NothingToReadTokenSchema,PIPELINE_FLOWS,PIPELINE_PHASES,PIPELINE_STEPS,PIPELINE_STEP_KEYS,PipelineRunRecordSchema,PipelineRunStatusSchema,PipelineRunSummarySchema,PipelineStepKeySchema,PipelineStepMetricSchema,PipelineStepRecordSchema,PipelineStepStatusSchema,PipelineTriggerSchema,QUARANTINED_CONFIDENTIALITY_LEVEL,REMOTE_DEGRADATION_REASONS,SEARCH_DEGRADATION_REASONS,SEARCH_MODES,SEARCH_PARAM_LIMITS,SYSTEM_PARAMETER_RANGES,SearchHitSchema,SearchMetadataSchema,SearchModeSchema,SearchRequestSchema,SearchResponseSchema,StageProvenanceSchema,TenantIdSchema,TranscriptSegmentSchema,assertBoundedSystemParameter,assertSystemParameterInRange,classifyDocumentKind,comparePhases,enrichmentStage,flowFor,flowStepGates,formatSkipReason,generateUuidV7,integrityCommandFailureCodeOf,isEnrichmentStageKey,isStrictlyEarlier,isValidUuidV7,modeFusesRankings,modeNeedsRemoteTiers,modeScoreIsSimilarity,narrowModeToAllowedTiers,orderedSteps,parseSkipReason,uuidv7ToDate});
|
|
1
|
+
"use strict";var G=Object.defineProperty;var pt=Object.getOwnPropertyDescriptor;var dt=Object.getOwnPropertyNames;var ut=Object.prototype.hasOwnProperty;var mt=(e,t)=>{for(var n in t)G(e,n,{get:t[n],enumerable:!0})},yt=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of dt(t))!ut.call(e,s)&&s!==n&&G(e,s,{get:()=>t[s],enumerable:!(i=pt(t,s))||i.enumerable});return e};var ft=e=>yt(G({},"__esModule",{value:!0}),e);var Fn={};mt(Fn,{AmountEntrySchema:()=>fe,BaseEnrichmentClient:()=>N,BodySourceSchema:()=>Ze,BoundingBoxSchema:()=>Ct,CIRCUIT_BREAKER_SERVICES:()=>le,CanonicalDomainKeySchema:()=>he,ChapterSegmentSchema:()=>me,ChunkingStrategySchema:()=>xt,CircuitBreakerStatusSchema:()=>bt,ConfidentialityLevelSchema:()=>O,DISPATCH_DEGRADATION_REASONS:()=>de,DOCUMENT_KINDS:()=>$,DOCUMENT_KIND_LABELS:()=>Dt,DocumentKindSchema:()=>oe,DocumentStructuredDataSchema:()=>Tt,ENRICHMENT_STAGES:()=>ie,EnrichmentClient:()=>j,EnrichmentClientError:()=>R,EnrichmentSyncStatusSchema:()=>Nt,FILTERABLE_CONFIDENTIALITY_LEVELS:()=>St,FileUriSchema:()=>At,GRAPH_INDEX_LIMITS:()=>Dn,GraphSearchHitSchema:()=>Re,INTEGRITY_CLASS_POLICY:()=>we,INTEGRITY_COMMAND_CODES:()=>ee,INTEGRITY_FINDINGS_PAGE_LIMIT_MAX:()=>x,IntegrityActiveRunSchema:()=>$e,IntegrityAuditOverviewSchema:()=>Zt,IntegrityCancelFailureCodeSchema:()=>qe,IntegrityCellResyncRequestSchema:()=>ln,IntegrityCellResyncResultSchema:()=>dn,IntegrityCommandFailureCodeSchema:()=>w,IntegrityCommandFailureSchema:()=>yn,IntegrityCommandReplySchema:()=>En,IntegrityCommandSchema:()=>J,IntegrityDispositionSchema:()=>ke,IntegrityFindingItemClassSchema:()=>Z,IntegrityFindingPageSchema:()=>an,IntegrityFindingSchema:()=>Ve,IntegrityFindingsQuerySchema:()=>sn,IntegrityItemClassSchema:()=>W,IntegrityPhaseSchema:()=>Ke,IntegrityPlacementObservedSchema:()=>nn,IntegrityQuantitySchema:()=>Be,IntegrityRepairActionSchema:()=>Ue,IntegrityRepairOutcomeSchema:()=>He,IntegrityRepairSkipReasonSchema:()=>Ye,IntegrityRunHeaderSchema:()=>U,IntegrityRunModeSchema:()=>Me,IntegrityRunStatusSchema:()=>Ge,IntegrityScopeRoleSchema:()=>Le,IntegrityStartFailureCodeSchema:()=>Xe,IntegrityStoreSchema:()=>k,IntegrityUnitSchema:()=>ve,IntegrityVerdictSchema:()=>ze,LOCAL_DEGRADATION_REASONS:()=>ce,MIME_KIND_RULES:()=>Ce,MODE_TIERS:()=>C,ModelProviderSchema:()=>ae,NOTHING_TO_READ_TOKENS:()=>tt,NothingToReadTokenSchema:()=>nt,PIPELINE_FLOWS:()=>Te,PIPELINE_PHASES:()=>Pt,PIPELINE_STEPS:()=>X,PIPELINE_STEP_KEYS:()=>V,PipelineRunRecordSchema:()=>_n,PipelineRunStatusSchema:()=>Je,PipelineRunSummarySchema:()=>An,PipelineStepKeySchema:()=>D,PipelineStepMetricSchema:()=>Cn,PipelineStepRecordSchema:()=>it,PipelineStepStatusSchema:()=>Qe,PipelineTriggerSchema:()=>We,QUARANTINED_CONFIDENTIALITY_LEVEL:()=>P,REMOTE_DEGRADATION_REASONS:()=>pe,SEARCH_DEGRADATION_REASONS:()=>_t,SEARCH_MODES:()=>K,SEARCH_PARAM_LIMITS:()=>Et,SYSTEM_PARAMETER_RANGES:()=>b,SearchHitSchema:()=>Ie,SearchMetadataSchema:()=>Se,SearchModeSchema:()=>Ee,SearchRequestSchema:()=>H,SearchResponseSchema:()=>Y,StageProvenanceSchema:()=>et,TenantIdSchema:()=>ue,TranscriptSegmentSchema:()=>ye,assertBoundedSystemParameter:()=>Kt,assertSystemParameterInRange:()=>zt,classifyDocumentKind:()=>Ot,comparePhases:()=>kt,enrichmentStage:()=>xn,flowFor:()=>Ft,flowStepGates:()=>Lt,formatSkipReason:()=>hn,generateUuidV7:()=>On,integrityCommandFailureCodeOf:()=>fn,isEnrichmentStageKey:()=>bn,isStrictlyEarlier:()=>T,isValidUuidV7:()=>lt,modeFusesRankings:()=>gt,modeNeedsRemoteTiers:()=>ht,modeScoreIsSimilarity:()=>It,narrowModeToAllowedTiers:()=>Rt,orderedSteps:()=>vt,parseSkipReason:()=>ot,uuidv7ToDate:()=>Pn});module.exports=ft(Fn);var R=class extends Error{statusCode;responseBody;parsedBody;constructor(t,n,i,s){super(t),this.name="EnrichmentClientError",this.statusCode=n,this.responseBody=i,this.parsedBody=s}},N=class{baseUrl;apiKey;fetchFn;timeoutMs;constructor(t){if(!t||typeof t.baseUrl!="string"||t.baseUrl.trim().length===0)throw new Error("baseUrl is required and must be a non-empty string for EnrichmentClient.");let n=t.baseUrl.trim().replace(/\/$/,"");if(t.apiKey&&n.startsWith("http://")&&!n.includes("localhost")&&!n.includes("127.0.0.1"))throw new Error("Security Violation: Transmitting Bearer tokens over unencrypted HTTP to non-localhost hosts is strictly prohibited.");this.baseUrl=n,this.apiKey=t.apiKey,this.fetchFn=t.fetchFn??fetch,this.timeoutMs=t.timeoutMs&&t.timeoutMs>0?t.timeoutMs:3e4}async request(t,n,i){let s=`${this.baseUrl}${t}`,c={Accept:"application/json","Content-Type":"application/json","X-Tenant-Id":n};this.apiKey&&(c.Authorization=`Bearer ${this.apiKey}`);let d=new AbortController,m=setTimeout(()=>d.abort(),this.timeoutMs),f;try{f=await this.fetchFn(s,{method:"POST",headers:c,body:JSON.stringify(i),signal:d.signal})}catch(y){let I=y instanceof Error?y.message:String(y);throw new R(`Network request failed for POST ${s}: ${I}`,0,"")}finally{clearTimeout(m)}if(!f.ok){let y=await f.text().catch(()=>""),I;try{I=JSON.parse(y)}catch{}throw new R(`API request failed with status ${f.status}: ${y}`,f.status,y,I)}let g=await f.text().catch(()=>"");if(g.trim().length!==0)try{return JSON.parse(g)}catch(y){let I=y instanceof Error?y.message:String(y);throw new R(`Failed to parse response JSON from ${s}: ${I}`,f.status,g)}}};var o=require("zod");var z=require("zod"),ae=z.z.enum(["google_cloud","google_vision","yomitoku_local","faster_whisper_local","google_speech","ollama_local","openai","anthropic","azure_openai","bedrock","custom_openai_compatible"]),O=z.z.enum(["PUBLIC","INTERNAL","DEPARTMENT","CONFIDENTIAL","RESTRICTED"]),P="RESTRICTED";var Et={rrfK:{min:1,max:200,default:60},alpha:{min:0,max:1,default:.7},threshold:{min:0,max:1},limit:{min:1,max:50,default:10}},se=O.options.filter(e=>e!==P);if(se.length===0)throw new Error("The confidentiality vocabulary left nothing filterable after removing the quarantined level; a validator built from this list would reject every request.");var St=se,K=["KEYWORD","SPARSE","DENSE","HYBRID","GRAPH_TRAVERSE"],C={KEYWORD:{dense:!1,sparse:!1,graph:!1,lexical:!0},SPARSE:{dense:!1,sparse:!0,graph:!1,lexical:!1},DENSE:{dense:!0,sparse:!1,graph:!1,lexical:!1},HYBRID:{dense:!0,sparse:!0,graph:!0,lexical:!0},GRAPH_TRAVERSE:{dense:!1,sparse:!1,graph:!0,lexical:!1}};function ht(e){let t=C[e];return t.dense||t.sparse||t.graph}function It(e){let t=C[e];return t.dense&&!t.sparse}function Rt(e,t){let n=C[e],i=(n.dense||n.sparse)&&t.vector,s=n.graph&&t.graph;return i||s?i?s?{mode:e,discardGraph:!1}:n.dense&&n.sparse?{mode:e,discardGraph:!0}:{mode:n.dense?"DENSE":"SPARSE",discardGraph:!1}:{mode:"GRAPH_TRAVERSE",discardGraph:!1}:null}function gt(e){let t=C[e];return[t.dense,t.sparse,t.graph,t.lexical].filter(Boolean).length>1}var le=["vector","graph"],ce=["empty_query","caller_token_unavailable","time_window_unsupported"],pe=["vector_tier_not_configured","graph_tier_not_configured","no_active_vector_collection","vector_collections_missing"],de=["remote_tiers_unavailable","remote_tiers_timed_out","remote_tiers_refused_caller","remote_tiers_rejected_request","remote_tiers_failed","remote_tiers_not_executed","vector_search_disabled","graph_search_disabled"],_t=[...ce,...pe,...de,...le.map(e=>`circuit_breaker_open:${e}`)];var ue=o.z.string().trim().min(1,"tenant_id must be a non-empty string"),At=o.z.string().trim().min(1,"file_uri must be a non-empty string"),Nt=o.z.enum(["PENDING","EXTRACTING","ENRICHING","PROJECTING","SYNCED","FAILED_EXTRACT","FAILED_ENRICH","FAILED_VECTOR","FAILED_GRAPH"]),Ct=o.z.object({page:o.z.number().int().positive().optional(),x:o.z.number().nonnegative().optional(),y:o.z.number().nonnegative().optional(),width:o.z.number().positive().optional(),height:o.z.number().positive().optional(),start_sec:o.z.number().nonnegative().optional(),end_sec:o.z.number().nonnegative().optional(),frame_index:o.z.number().int().nonnegative().optional(),timestamp_sec:o.z.number().nonnegative().optional(),scene_confidence:o.z.number().min(0).max(1).optional()}),me=o.z.object({title:o.z.string().trim().min(1),start_sec:o.z.number().nonnegative(),end_sec:o.z.number().nonnegative(),summary:o.z.string()}),ye=o.z.object({start_sec:o.z.number().nonnegative(),end_sec:o.z.number().nonnegative(),speaker:o.z.string().trim().min(1),text:o.z.string()}),fe=o.z.object({label:o.z.string(),value:o.z.number(),currency:o.z.string()}),Tt=o.z.object({document_type:o.z.string().optional(),title:o.z.string().optional(),organization:o.z.string().optional(),key_entities:o.z.array(o.z.string()).optional(),dates:o.z.array(o.z.string()).optional(),amounts:o.z.array(fe).optional(),media_type:o.z.enum(["video","audio"]).optional(),duration_sec:o.z.number().nonnegative().optional(),chapters:o.z.array(me).optional(),transcript_segments:o.z.array(ye).optional()}),bt=o.z.enum(["CLOSED","OPEN","HALF_OPEN"]),Ee=o.z.enum(K),Se=o.z.object({circuit_breaker_status:o.z.string(),quality_tier:o.z.string(),latency_ms:o.z.number().nonnegative(),total_hits:o.z.number().int().nonnegative(),fallback_applied:o.z.boolean(),degraded_reason:o.z.string().nullable()}),he=o.z.enum(["CONTRACT_LEGAL","EMAIL_THREAD","DAILY_REPORT","FINANCIAL_REPORT","TECHNICAL_SPEC","MASTER_DATA","MEDIA_ASSET","GENERAL_DOCUMENT"]),xt=o.z.enum(["hierarchical","conversation","section","fixed_size","table_aware","semantic","none","multimodal"]),Ie=o.z.object({metadata_id:o.z.number().int().positive(),chunk_index:o.z.number().int().nonnegative(),text:o.z.string(),score:o.z.number()}),Re=o.z.object({metadata_id:o.z.number().int().positive(),relation:o.z.string(),target_name:o.z.string()}),H=o.z.object({query:o.z.string().trim().min(1,"query must not be empty"),tenant_id:ue,domain_key:he.optional(),limit:o.z.number().int().positive().optional(),department_id:o.z.number().int().positive().optional(),search_mode:Ee.optional(),strategy_id:o.z.number().int().positive().optional()}).strict(),Y=o.z.object({hits:o.z.array(Ie),graph_hits:o.z.array(Re),tiers:o.z.record(o.z.string(),o.z.boolean()),metadata:Se});var j=class extends N{async search(t){let n=H.parse(t),i=await this.request("/ai/search/hybrid",n.tenant_id,n);return Y.parse(i)}};var $=["email","pdf","office","image","media","text","google_native","other"],Dt={email:"\u30E1\u30FC\u30EB",pdf:"PDF",office:"Office \u6587\u66F8",image:"\u753B\u50CF",media:"\u97F3\u58F0\u30FB\u52D5\u753B",text:"\u30C6\u30AD\u30B9\u30C8",google_native:"Google \u30CD\u30A4\u30C6\u30A3\u30D6",other:"\u305D\u306E\u4ED6"},Ce=[["message/rfc822","email"],["application/pdf","pdf"],["application/vnd.openxmlformats-officedocument.*","office"],["application/msword","office"],["application/vnd.ms-excel","office"],["application/vnd.ms-powerpoint","office"],["application/vnd.google-apps.*","google_native"],["image/svg+xml","text"],["image/emf","other"],["image/x-emf","other"],["image/wmf","other"],["image/x-wmf","other"],["image/*","image"],["audio/*","media"],["video/*","media"],["text/*","text"],["application/json","text"],["application/xml","text"]];function Ot(e){let t=(e.split(";")[0]??"").trim().toLowerCase();for(let[n,i]of Ce)if(n.endsWith("*")?t.startsWith(n.slice(0,-1)):t===n)return i;return"other"}var V=["delete_child_assets","extract_text","analyze_media","extract_assets","ocr_children","ocr_document","resolve_body","enrich_document","project_to_indexes"],Pt=["EXTRACTING","ENRICHING","PROJECTING"],B=e=>({featureFlagKey:e,whenClosed:"skip",failureStatus:null}),ge=(e,t)=>({featureFlagKey:e,whenClosed:"fail",failureStatus:t}),X={delete_child_assets:{key:"delete_child_assets",label:"\u65E7\u7248\u306E\u5B50\u30A2\u30BB\u30C3\u30C8\u524A\u9664",description:"\u3053\u306E\u7248\u3088\u308A\u524D\u306E\u7248\u304C\u751F\u3093\u3060\u5B50\u30A2\u30BB\u30C3\u30C8\u3092\u4FDD\u7BA1\u5C64\u3068\u7D22\u5F15\u304B\u3089\u5916\u3059\u3002",endpoint:"/ai/assets/delete",phase:"EXTRACTING",failureStatus:"FAILED_EXTRACT",gates:[],capability:null,fanOut:null},extract_text:{key:"extract_text",label:"\u6587\u5B57\u5C64\u306E\u62BD\u51FA",description:"\u6587\u66F8\u304C\u6301\u3064\u6587\u5B57\u5C64 (PDF \u306E\u6587\u5B57\u30FBOffice \u306E\u672C\u6587\u30FB\u30E1\u30FC\u30EB\u306E\u672C\u6587\u3068\u898B\u51FA\u3057) \u3092\u8AAD\u307F\u3001\u4F4D\u7F6E\u60C5\u5831\u3068\u5171\u306B\u4FDD\u5B58\u3059\u308B\u3002",endpoint:"/ai/enrichment/extract",phase:"EXTRACTING",failureStatus:"FAILED_EXTRACT",gates:[],capability:null,fanOut:null},analyze_media:{key:"analyze_media",label:"\u30E1\u30C7\u30A3\u30A2\u89E3\u6790",description:"\u97F3\u58F0\u30FB\u52D5\u753B\u3092\u8EE2\u5199\u3057\u3001\u767A\u8A71\u533A\u9593\u4ED8\u304D\u306E\u30C1\u30E3\u30F3\u30AF\u3068\u30AD\u30FC\u30D5\u30EC\u30FC\u30E0\u6570\u3092\u8A18\u9332\u3059\u308B\u3002",endpoint:"/ai/media/analyze",phase:"EXTRACTING",failureStatus:"FAILED_EXTRACT",gates:[B("ENABLE_MEDIA_ANALYSIS")],capability:"transcription",fanOut:null},extract_assets:{key:"extract_assets",label:"\u5B50\u30A2\u30BB\u30C3\u30C8\u306E\u62BD\u51FA",description:"\u57CB\u3081\u8FBC\u307F\u753B\u50CF\u3084\u30E1\u30FC\u30EB\u306E\u6DFB\u4ED8\u3092\u5B50\u30A2\u30BB\u30C3\u30C8\u3068\u3057\u3066\u5207\u308A\u51FA\u3057\u3001\u6587\u66F8\u306E\u96A3\u306B\u4FDD\u7BA1\u3057\u3066\u767B\u9332\u3059\u308B\u3002",endpoint:"/ai/assets/extract",phase:"EXTRACTING",failureStatus:"FAILED_EXTRACT",gates:[B("ENABLE_ASSET_EXTRACTION")],capability:"asset_extraction",fanOut:null},ocr_children:{key:"ocr_children",label:"\u5B50\u30A2\u30BB\u30C3\u30C8\u306E\u8AAD\u307F\u53D6\u308A",description:"\u5207\u308A\u51FA\u3057\u305F\u5B50\u30A2\u30BB\u30C3\u30C8\u3092\u62BD\u51FA\u9806\u306B 1 \u4EF6\u305A\u3064\u8AAD\u307F\u3001\u6587\u5B57\u5C64\u3092\u8AAD\u3081\u308B\u5B50 (\u30C6\u30AD\u30B9\u30C8\u30FB\u30E1\u30FC\u30EB\u30FBOffice\u30FBPDF) \u306F\u305D\u306E\u6587\u5B57\u5C64\u3092\u3001\u8AAD\u3081\u306A\u3044\u5B50\u306F\u7248\u9762\u3092\u5149\u5B66\u8A8D\u8B58\u3067\u8AAD\u3093\u3067\u3001\u5B50\u3054\u3068\u306B\u672C\u6587\u3068\u51FA\u6240\u3092\u4FDD\u5B58\u3059\u308B\u3002",endpoint:"/ai/ocr/run",phase:"EXTRACTING",failureStatus:"FAILED_EXTRACT",gates:[],capability:"ocr",fanOut:"children"},ocr_document:{key:"ocr_document",label:"\u6587\u66F8\u306E OCR",description:"\u6587\u66F8\u81EA\u8EAB\u306E\u7248\u9762 (\u753B\u50CF\u30FBPDF \u306E\u5404\u30DA\u30FC\u30B8) \u3092\u5149\u5B66\u8A8D\u8B58\u306B\u304B\u3051\u308B\u3002",endpoint:"/ai/ocr/run",phase:"EXTRACTING",failureStatus:"FAILED_EXTRACT",gates:[B("ENABLE_OCR")],capability:"ocr",fanOut:null},resolve_body:{key:"resolve_body",label:"\u672C\u6587\u306E\u78BA\u5B9A",description:"\u6587\u5B57\u5C64\u30FBOCR\u30FB\u8EE2\u5199\u306E\u3069\u308C\u3092\u672C\u6587\u3068\u3059\u308B\u304B\u3092\u6C7A\u3081\u3001\u51FA\u6240\u3092\u8A18\u9332\u3059\u308B\u3002",endpoint:"/ai/enrichment/body",phase:"ENRICHING",failureStatus:"FAILED_ENRICH",gates:[],capability:null,fanOut:null},enrich_document:{key:"enrich_document",label:"\u8981\u7D04\u3068\u69CB\u9020\u5316\u62BD\u51FA",description:"\u672C\u6587\u3092\u30E2\u30C7\u30EB\u3078\u6E21\u3057\u3001\u8981\u7D04\u30FB\u30BF\u30B0\u30FB\u69CB\u9020\u5316\u30C7\u30FC\u30BF\u30FB\u30C9\u30E1\u30A4\u30F3\u5206\u985E\u3092\u5F97\u308B\u3002",endpoint:"/ai/enrichment/document",phase:"ENRICHING",failureStatus:"FAILED_ENRICH",gates:[],capability:"enrichment",fanOut:null},project_to_indexes:{key:"project_to_indexes",label:"\u30D9\u30AF\u30C8\u30EB\u3068\u30B0\u30E9\u30D5\u3078\u306E\u6295\u5F71",description:"\u672C\u6587\u3092\u30C1\u30E3\u30F3\u30AF\u306B\u3057\u3066\u57CB\u3081\u8FBC\u307F\u3001\u30D9\u30AF\u30C8\u30EB\u7D22\u5F15\u3068\u30CA\u30EC\u30C3\u30B8\u30B0\u30E9\u30D5\u3078\u66F8\u304F\u3002",endpoint:"/ai/enrichment/project",phase:"PROJECTING",failureStatus:"FAILED_VECTOR",gates:[ge("ENABLE_VECTOR_INDEXING","FAILED_VECTOR"),ge("ENABLE_GRAPH_INDEXING","FAILED_GRAPH")],capability:null,fanOut:null}},_e={whenClosed:"fail",failureStatus:"FAILED_EXTRACT"},F=[{step:"delete_child_assets",dependsOn:[]},{step:"extract_text",dependsOn:["delete_child_assets"]},{step:"extract_assets",dependsOn:["extract_text"]},{step:"ocr_children",dependsOn:["extract_assets"]},{step:"ocr_document",dependsOn:["extract_text"]},{step:"resolve_body",dependsOn:["ocr_children","ocr_document"]},{step:"enrich_document",dependsOn:["resolve_body"]},{step:"project_to_indexes",dependsOn:["enrich_document"],chunkSource:"rebuild"}],Ae=[{step:"delete_child_assets",dependsOn:[]},{step:"extract_text",dependsOn:["delete_child_assets"]},{step:"resolve_body",dependsOn:["extract_text"]},{step:"enrich_document",dependsOn:["resolve_body"]},{step:"project_to_indexes",dependsOn:["enrich_document"],chunkSource:"rebuild"}],Te={email:{kind:"email",steps:F},pdf:{kind:"pdf",steps:F},office:{kind:"office",steps:F},google_native:{kind:"google_native",steps:F},image:{kind:"image",steps:[{step:"delete_child_assets",dependsOn:[]},{step:"ocr_document",dependsOn:["delete_child_assets"],gatePolicy:_e},{step:"resolve_body",dependsOn:["ocr_document"]},{step:"enrich_document",dependsOn:["resolve_body"]},{step:"project_to_indexes",dependsOn:["enrich_document"],chunkSource:"rebuild"}]},media:{kind:"media",steps:[{step:"delete_child_assets",dependsOn:[]},{step:"analyze_media",dependsOn:["delete_child_assets"],gatePolicy:_e},{step:"resolve_body",dependsOn:["analyze_media"]},{step:"enrich_document",dependsOn:["resolve_body"]},{step:"project_to_indexes",dependsOn:["enrich_document"],chunkSource:"existing"}]},text:{kind:"text",steps:Ae},other:{kind:"other",steps:Ae}};function Ft(e){return Te[e]}function Lt(e){let{gates:t}=X[e.step],{gatePolicy:n}=e;return n===void 0?t:t.map(i=>({featureFlagKey:i.featureFlagKey,whenClosed:n.whenClosed,failureStatus:n.failureStatus}))}function vt(e){let t=new Map(e.steps.map(c=>[c.step,c]));for(let c of e.steps){if(c.gatePolicy!==void 0&&X[c.step].gates.length===0)throw new Error(`Flow ${e.kind}: step ${c.step} overrides its gate policy, but the step has no gate to close.`);for(let d of c.dependsOn)if(!t.has(d))throw new Error(`Flow ${e.kind}: step ${c.step} depends on ${d}, which the flow does not contain.`)}let n=[...e.steps],i=new Set,s=[];for(;n.length>0;){let c=n.findIndex(m=>m.dependsOn.every(f=>i.has(f)));if(c===-1)throw new Error(`Flow ${e.kind}: the steps ${n.map(m=>m.step).join(", ")} depend on each other in a cycle.`);let[d]=n.splice(c,1);i.add(d.step),s.push(d)}return s}var Ne={EXTRACTING:0,ENRICHING:1,PROJECTING:2};function kt(e,t){return Ne[e]-Ne[t]}var r=require("zod");var be=[{code:"DEPLOYMENT_DISABLED",status:503,errorCode:5035},{code:"RUN_ALREADY_ACTIVE",status:409,errorCode:4091},{code:"BASIS_INVALID",status:409,errorCode:4092},{code:"RUN_ALREADY_FINISHED",status:409,errorCode:4093},{code:"FORBIDDEN",status:403,errorCode:null}];var L=require("zod"),_=L.z.string().uuid().transform(e=>e.toLowerCase()),u=L.z.string().datetime({offset:!0}),l=(e,t,n)=>{e.addIssue({code:L.z.ZodIssueCode.custom,path:[...t],message:n})},wt=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?(?:Z|([+-])(\d{2}):?(\d{2}))$/,xe=e=>{let t=u.safeParse(e).success?wt.exec(e):null;if(t===null)return null;let[,n,i,s,c,d,m,f,g,y,I]=t,M=new Date(0);M.setUTCFullYear(Number(n),Number(i)-1,Number(s)),M.setUTCHours(Number(c),Number(d),m===void 0?0:Number(m),0);let ct=g===void 0?0:(g==="+"?1:-1)*(Number(y)*3600+Number(I)*60);return{epochSeconds:M.getTime()/1e3-ct,fraction:f===void 0?"":f}},T=(e,t)=>{let n=xe(e),i=xe(t);if(n===null||i===null)return!1;if(n.epochSeconds!==i.epochSeconds)return n.epochSeconds<i.epochSeconds;let s=Math.max(n.fraction.length,i.fraction.length);return n.fraction.padEnd(s,"0")<i.fraction.padEnd(s,"0")};var De={INTEGRITY_TOMBSTONE_RETENTION_DAYS:{min:1,max:3650},INTEGRITY_FINDING_SAMPLE_LIMIT:{min:1,max:5e3},INTEGRITY_RUN_HEARTBEAT_TIMEOUT_SECONDS:{min:30,max:3600},INTEGRITY_RUN_RETENTION_COUNT:{min:2,max:100},POLICY_CONFLICT_MAX_TIE_GROUP_SIZE:{min:2,max:60}};var Gt=e=>{for(let t of Object.values(e))Object.freeze(t);return Object.freeze(e)},b=Gt(De),Oe=e=>Object.hasOwn(b,e),Pe=(e,t)=>{let{min:n,max:i}=b[e];if(!Number.isInteger(t)||t<n||t>i)throw new RangeError(`${e} \u306F ${n}\u301C${i} \u306E\u6574\u6570\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002`)},zt=(e,t)=>{Oe(e)&&Pe(e,t)},Kt=(e,t)=>{if(!Oe(e))throw new TypeError(`The range table bounds no parameter named ${JSON.stringify(e)}.`);Pe(e,t)};var k=r.z.enum(["QDRANT","NEO4J"]),Le=r.z.enum(["PRODUCTION","VARIANT","LABEL"]),W=r.z.enum(["EXPECTED","LIVE","HISTORY","TOMBSTONE","AWAITING_SUCCESSOR","IN_FLIGHT","UNPLACED","UNRECORDED","UNREFERENCED","CHANGED_AFTER_START","PIPELINE_FAILED","PROJECTION_REFUSED","ORPHAN","TOMBSTONE_EXPIRED","UNPROPAGATED_DELETE","STALE_REVISION","MISPLACED","OUT_OF_TIER","UNMARKED_SUPERSEDED","FLAG_DRIFT","VARIANT_FLAG_DRIFT","DETACHED","UNKEYED","MISSING","COUNT_MISMATCH","UNPROJECTED","UNKEYED_ENTITY"]),Z=W.exclude(["EXPECTED","LIVE","HISTORY"]),ve=r.z.enum(["POINT","NODE","CHUNK","DOCUMENT"]),ke=r.z.enum(["EXPECTED","HEALTHY","RETAINED","INFORMATIONAL","DISCREPANCY"]),Ue=r.z.enum(["NONE","PURGE","FLAG","REPROJECT"]),p=(e,t)=>Object.freeze({disposition:e,repairAction:t}),we=Object.freeze({EXPECTED:p("EXPECTED","NONE"),LIVE:p("HEALTHY","NONE"),HISTORY:p("RETAINED","NONE"),TOMBSTONE:p("RETAINED","NONE"),AWAITING_SUCCESSOR:p("RETAINED","NONE"),IN_FLIGHT:p("INFORMATIONAL","NONE"),UNPLACED:p("INFORMATIONAL","NONE"),UNRECORDED:p("INFORMATIONAL","NONE"),UNREFERENCED:p("INFORMATIONAL","NONE"),CHANGED_AFTER_START:p("INFORMATIONAL","NONE"),PIPELINE_FAILED:p("INFORMATIONAL","NONE"),PROJECTION_REFUSED:p("INFORMATIONAL","NONE"),ORPHAN:p("DISCREPANCY","PURGE"),TOMBSTONE_EXPIRED:p("DISCREPANCY","PURGE"),UNPROPAGATED_DELETE:p("DISCREPANCY","FLAG"),STALE_REVISION:p("DISCREPANCY","PURGE"),MISPLACED:p("DISCREPANCY","PURGE"),OUT_OF_TIER:p("DISCREPANCY","PURGE"),UNMARKED_SUPERSEDED:p("DISCREPANCY","FLAG"),FLAG_DRIFT:p("DISCREPANCY","REPROJECT"),VARIANT_FLAG_DRIFT:p("DISCREPANCY","NONE"),DETACHED:p("DISCREPANCY","PURGE"),UNKEYED:p("DISCREPANCY","PURGE"),MISSING:p("DISCREPANCY","REPROJECT"),COUNT_MISMATCH:p("DISCREPANCY","REPROJECT"),UNPROJECTED:p("DISCREPANCY","REPROJECT"),UNKEYED_ENTITY:p("DISCREPANCY","NONE")}),Me=r.z.enum(["SCAN","REPAIR"]),Ge=r.z.enum(["RUNNING","COMPLETED","FAILED","CANCELLED","ABANDONED"]),ze=r.z.enum(["CONSISTENT","INCONSISTENT","UNDETERMINED"]),Ke=r.z.enum(["QDRANT","NEO4J","DOCUMENTS"]),He=r.z.enum(["APPLIED","SKIPPED","FAILED"]),Ye=r.z.enum(["RECLASSIFIED","IN_FLIGHT","DESTINATION_PENDING","BASIS_EXHAUSTED","PROJECTION_REFUSED","PIPELINE_FAILED","UNRECORDED","OUTSIDE"]),x=100,E=r.z.number().int().nonnegative(),v=r.z.number().int().min(300).max(599),q=["repairedCount","repairFailedCount","repairSkippedCount"],je=r.z.string().regex(/^[0-9a-f]{64}$/,"A store fingerprint is 64 lowercase hexadecimal digits."),Fe=b.INTEGRITY_TOMBSTONE_RETENTION_DAYS,Ht=r.z.object({runUid:_,mode:Me,status:Ge,requestedBy:r.z.string().min(1),executor:r.z.string().min(1),basisRunUid:_.nullable(),storeFingerprint:je,tombstoneRetentionDays:r.z.number().int().min(Fe.min).max(Fe.max),startedAt:u,finishedAt:u.nullable(),verdict:ze.nullable(),errorClass:r.z.string().min(1).nullable(),reprojectDocuments:E.nullable(),reprojectRebuildDocuments:E.nullable()}).strict(),Yt=(e,t)=>{let n=e.status==="COMPLETED";e.mode==="REPAIR"!=(e.basisRunUid!==null)&&l(t,["basisRunUid"],"A REPAIR run names its basis SCAN run, and a SCAN run names none."),n!==(e.verdict!==null)&&l(t,["verdict"],"Only a COMPLETED run has a verdict."),n!==(e.reprojectDocuments!==null)&&l(t,["reprojectDocuments"],"Only a COMPLETED run has the count of documents to re-project.");let{reprojectDocuments:i,reprojectRebuildDocuments:s}=e;i===null||s===null?i!==s&&l(t,["reprojectRebuildDocuments"],"The documents a re-projection embeds are counted together with the documents it re-projects."):s>i&&l(t,["reprojectRebuildDocuments"],"The documents a re-projection embeds are no more than the documents it re-projects."),e.status==="RUNNING"!=(e.finishedAt===null)&&l(t,["finishedAt"],"Only a RUNNING run has not finished."),e.finishedAt!==null&&T(e.finishedAt,e.startedAt)&&l(t,["finishedAt"],"A run does not finish before it starts."),(e.status==="FAILED"||e.status==="ABANDONED")!=(e.errorClass!==null)&&l(t,["errorClass"],"Only a FAILED or ABANDONED run names an error class.")},U=Ht.superRefine(Yt),jt=r.z.object({store:k,scopeKey:r.z.string().min(1),scopeRole:Le,itemClass:W,unit:ve,disposition:ke,repairAction:Ue,itemCount:E.nullable(),unmeasuredReason:r.z.string().min(1).nullable(),measuredAt:u.nullable(),repairedCount:E.nullable(),repairFailedCount:E.nullable(),repairSkippedCount:E.nullable()}).strict(),Bt=(e,t)=>{let n=we[e.itemClass];e.disposition!==n.disposition&&l(t,["disposition"],`A ${e.itemClass} quantity is ${n.disposition}.`),e.repairAction!==n.repairAction&&l(t,["repairAction"],`A repair's action on ${e.itemClass} items is ${n.repairAction}.`);let i=e.itemCount===null;i!==(e.unmeasuredReason!==null)&&l(t,["unmeasuredReason"],"An unmeasured quantity (itemCount null) has a reason, and a measured one has none."),i!==(e.measuredAt===null)&&l(t,["measuredAt"],"Only a measured quantity has a measurement time.");let{repairedCount:s,repairFailedCount:c,repairSkippedCount:d}=e;if(s===null||c===null||d===null){if(q.some(m=>e[m]!==null))for(let m of q)e[m]===null&&l(t,[m],"The repaired, failed and skipped counts are recorded together or not at all.");return}e.repairAction==="NONE"&&l(t,["repairAction"],"Only a class with a repair action carries repair counts."),e.itemCount!==null&&s+c+d>e.itemCount&&l(t,["itemCount"],"The repaired, failed and skipped counts together do not exceed the measured count.")},Be=jt.superRefine(Bt),$t=r.z.object({run:U,phase:Ke.nullable(),phaseScope:r.z.string().min(1).nullable(),phaseDone:E.nullable(),phaseTotal:E.nullable(),heartbeatAt:u,isStale:r.z.boolean(),cancelRequestedAt:u.nullable()}).strict(),Vt=(e,t)=>{if(e.run.status!=="RUNNING"&&l(t,["run","status"],"The active run is a RUNNING run."),T(e.heartbeatAt,e.run.startedAt)&&l(t,["heartbeatAt"],"A run's heartbeat is not earlier than its start."),e.phase===null)for(let n of["phaseScope","phaseDone","phaseTotal"])e[n]!==null&&l(t,[n],"A run with no phase has no phase progress.");e.phase==="DOCUMENTS"&&e.phaseScope!==null&&l(t,["phaseScope"],"The DOCUMENTS phase scans no scope.")},$e=$t.superRefine(Vt),Xt=r.z.object({run:U,quantities:r.z.array(Be),previousStoreFingerprint:je.nullable()}).strict(),qt=(e,t)=>{e.run.status!=="COMPLETED"&&l(t,["run","status"],"The last completed run is a COMPLETED run.");let n=new Set;for(let[i,s]of e.quantities.entries()){let c=JSON.stringify([s.store,s.scopeKey,s.itemClass]);if(n.has(c)&&l(t,["quantities",i],"A run records each (store, scope, class) cell once."),n.add(c),e.run.mode==="SCAN")for(let d of q)s[d]!==null&&l(t,["quantities",i,d],"A SCAN run repairs nothing, so its quantities carry no repair counts.")}},Jt=["FAILED","CANCELLED","ABANDONED"],Qt=r.z.object({run:U,repairAppliedItems:E.nullable(),hasNewerRepair:r.z.boolean()}).strict(),Wt=(e,t)=>{Jt.includes(e.run.status)||l(t,["run","status"],"A newer unsuccessful run is FAILED, CANCELLED or ABANDONED."),e.run.mode==="SCAN"&&e.repairAppliedItems!==null&&l(t,["repairAppliedItems"],"A SCAN run applies nothing."),e.run.mode==="REPAIR"&&!e.hasNewerRepair&&l(t,["hasNewerRepair"],"An unsuccessful REPAIR run is itself a repair newer than the last completed run.")},Zt=r.z.object({readAt:u,lastCompleted:Xt.superRefine(qt).nullable(),active:$e.nullable(),newerUnsuccessful:Qt.superRefine(Wt).nullable()}).strict(),en=r.z.object({sequence:r.z.number().int().min(1),itemKey:r.z.string().min(1),metadataId:r.z.number().int().positive().nullable(),fileUri:r.z.string().nullable(),revision:r.z.number().int().nullable(),observed:r.z.record(r.z.string(),r.z.unknown()),repairOutcome:He.nullable(),repairErrorClass:r.z.string().min(1).nullable(),repairSkipReason:Ye.nullable()}).strict(),tn=(e,t)=>{e.repairOutcome==="FAILED"!=(e.repairErrorClass!==null)&&l(t,["repairErrorClass"],"Only a FAILED finding names an error class."),e.repairOutcome==="SKIPPED"!=(e.repairSkipReason!==null)&&l(t,["repairSkipReason"],"Only a SKIPPED finding names a skip reason.")},Ve=en.superRefine(tn),nn=r.z.object({sotDomain:r.z.string().nullable()}).passthrough(),rn=r.z.object({rows:r.z.array(Ve),nextAfter:r.z.number().int().min(1).nullable(),recordedCount:E,totalCount:E.nullable()}).strict(),on=(e,t)=>{for(let[n,i]of e.rows.entries()){let s=e.rows[n-1];s!==void 0&&i.sequence<=s.sequence&&l(t,["rows",n,"sequence"],"A page lists its rows in ascending sequence.")}e.nextAfter!==null&&e.nextAfter!==e.rows.at(-1)?.sequence&&l(t,["nextAfter"],"The next page starts after the sequence of this page's last row.")},an=rn.superRefine(on),sn=r.z.object({runUid:_,store:k,scopeKey:r.z.string().min(1),itemClass:Z,after:r.z.number().int().min(1).optional(),limit:r.z.number().int().min(1).max(x)}).strict(),ln=r.z.object({runUid:_,store:k,scopeKey:r.z.string().min(1),itemClass:Z.extract(["UNRECORDED"]),after:r.z.number().int().min(1).optional()}).strict(),cn=r.z.object({requeued:E,skipped:r.z.array(r.z.object({metadataId:r.z.number().int().min(1),reason:r.z.string().min(1)}).strict()),nextAfter:r.z.number().int().min(1).nullable()}).strict(),pn=(e,t)=>{let n=e.requeued+e.skipped.length;n>x&&l(t,["requeued"],`One chunk settles at most ${x} documents.`),e.nextAfter!==null!=(n===x)&&l(t,["nextAfter"],"A chunk continues exactly when it read the limit.");let i=new Set;for(let[s,c]of e.skipped.entries())i.has(c.metadataId)&&l(t,["skipped",s,"metadataId"],"A chunk keeps a document back once."),i.add(c.metadataId)},dn=cn.superRefine(pn),w=r.z.enum(["DEPLOYMENT_DISABLED","RUN_ALREADY_ACTIVE","BASIS_INVALID","RUN_ALREADY_FINISHED","FORBIDDEN","UPSTREAM_FAILED"]),J=r.z.enum(["start","cancel"]),Xe=w.extract(["DEPLOYMENT_DISABLED","RUN_ALREADY_ACTIVE","BASIS_INVALID","FORBIDDEN","UPSTREAM_FAILED"]),qe=w.extract(["DEPLOYMENT_DISABLED","RUN_ALREADY_FINISHED","FORBIDDEN","UPSTREAM_FAILED"]),Q={start:Xe,cancel:qe},un=r.z.object({code:w.exclude(["UPSTREAM_FAILED"]),status:v,errorCode:r.z.number().int().nullable()}).strict(),ee=Object.freeze(r.z.array(un).parse(be).map(e=>Object.freeze(e))),mn=(e,t)=>{e.code==="UPSTREAM_FAILED"||e.code==="FORBIDDEN"&&e.status===null||ee.some(n=>n.code===e.code&&n.status===e.status)||l(t,["status"],`A ${e.code} failure carries the status of its row in the code table.`)},yn=r.z.discriminatedUnion("command",[r.z.object({command:J.extract(["start"]),code:Q.start,status:v.nullable()}).strict(),r.z.object({command:J.extract(["cancel"]),code:Q.cancel,status:v.nullable()}).strict()]).superRefine(mn),fn=(e,t,n)=>{let i=Q[e],s=ee.find(c=>c.status===t&&(c.errorCode===null||c.errorCode===n)&&i.safeParse(c.code).success);return s===void 0?"UPSTREAM_FAILED":s.code},En=r.z.discriminatedUnion("ok",[r.z.object({ok:r.z.literal(!0),runUid:_}).strict(),r.z.object({ok:r.z.literal(!1),status:v,errorCode:r.z.number().int().nullable()}).strict()]);var a=require("zod");var oe=a.z.enum($),D=a.z.enum(V),Je=a.z.enum(["RUNNING","SUCCEEDED","FAILED"]),Qe=a.z.enum(["RUNNING","SUCCEEDED","SKIPPED","FAILED"]),We=a.z.enum(["ingest","retry","resync"]),Ze=a.z.enum(["text_layer","ocr","transcript"]),S=a.z.number().int().nonnegative().nullable(),et=a.z.object({provider:a.z.string().nullable(),model:a.z.string().nullable(),engine:a.z.string().nullable(),prompt_key:a.z.string().nullable(),prompt_version:a.z.number().int().nullable(),duration_ms:S,input_chars:S,output_chars:S,pages_read:S,pages_total:S,chunk_count:S,points_upserted:S,collection:a.z.string().nullable(),embedding_model:a.z.string().nullable(),strategy_id:a.z.number().int().positive().nullable(),graph_nodes:S,body_source:Ze.nullable(),detail:a.z.record(a.z.string(),a.z.unknown())}).strict(),tt=["no_pages","no_pages_rendered"],nt=a.z.enum(tt),te="gate_closed:",ne="source_skipped:",re="nothing_to_read:",rt="no_children",Sn=/^[A-Z][A-Z0-9_]*$/;function ot(e){if(e===rt)return{kind:"no_children"};if(e.startsWith(te)){let t=e.slice(te.length);return Sn.test(t)?{kind:"gate_closed",featureFlagKey:t}:null}if(e.startsWith(ne)){let t=D.safeParse(e.slice(ne.length));return t.success?{kind:"source_skipped",stepKey:t.data}:null}if(e.startsWith(re)){let t=nt.safeParse(e.slice(re.length));return t.success?{kind:"nothing_to_read",token:t.data}:null}return null}function hn(e){let t=In(e);if(ot(t)===null)throw new RangeError(`Skip reason ${JSON.stringify(e)} has no text form: ${JSON.stringify(t)} is outside the skip-reason grammar.`);return t}function In(e){switch(e.kind){case"gate_closed":return`${te}${e.featureFlagKey}`;case"no_children":return rt;case"source_skipped":return`${ne}${e.stepKey}`;case"nothing_to_read":return`${re}${e.token}`;default:{let t=e;throw new RangeError(`Unknown skip reason kind: ${JSON.stringify(t)}`)}}}var Rn=a.z.object({id:a.z.number().int().positive(),runId:a.z.number().int().positive(),sequence:a.z.number().int().nonnegative(),stepKey:D,targetMetadataId:a.z.number().int().positive(),status:Qe,skipReason:a.z.string().nullable(),provenance:et.nullable(),strategyId:a.z.number().int().positive().nullable(),httpStatus:a.z.number().int().nullable(),errorCode:a.z.string().nullable(),errorMessage:a.z.string().nullable(),startedAt:u,finishedAt:u.nullable(),durationMs:S}).strict();function gn(e,t){switch(e.status){case"SKIPPED":e.skipReason===null&&l(t,["skipReason"],"A SKIPPED step must record why it was skipped."),e.provenance!==null&&l(t,["provenance"],"A SKIPPED step read nothing, so it has no report.");return;case"SUCCEEDED":e.provenance===null&&l(t,["provenance"],"A SUCCEEDED step must carry its report."),e.skipReason!==null&&l(t,["skipReason"],"A SUCCEEDED step was not skipped.");return;case"RUNNING":e.finishedAt!==null&&l(t,["finishedAt"],"A RUNNING step has not finished.");return;case"FAILED":e.skipReason!==null&&l(t,["skipReason"],"A FAILED step was not skipped.");return}}var it=Rn.superRefine(gn),at=a.z.object({id:a.z.number().int().positive(),tenantId:a.z.string().min(1),metadataId:a.z.number().int().positive(),revision:a.z.number().int().positive(),runUid:a.z.string().uuid(),jobId:a.z.string().min(1),attempt:a.z.number().int().positive(),trigger:We,documentKind:oe,flowKey:a.z.string().min(1),status:Je,retryScheduled:a.z.boolean(),failedStepKey:D.nullable(),errorMessage:a.z.string().nullable(),requestedBy:a.z.string().min(1),startedAt:u,finishedAt:u.nullable(),steps:a.z.array(it)}).strict();function st(e,t){e.retryScheduled&&e.status!=="FAILED"&&l(t,["retryScheduled"],"Only a FAILED run can have a retry scheduled.")}var _n=at.superRefine(st),An=at.omit({steps:!0}).superRefine(st);function Nn(e,t){e.sampleCount>0||(e.durationP50Ms!==null&&l(t,["durationP50Ms"],"A step with no sample has no median latency."),e.durationP95Ms!==null&&l(t,["durationP95Ms"],"A step with no sample has no 95th-percentile latency."))}var Cn=a.z.object({documentKind:oe,stepKey:D,sampleCount:a.z.number().int().nonnegative(),succeeded:a.z.number().int().nonnegative(),failed:a.z.number().int().nonnegative(),skipped:a.z.number().int().nonnegative(),durationP50Ms:S,durationP95Ms:S,lastStartedAt:u.nullable()}).strict().superRefine(Nn);var ie=[{key:"enable_summary_generation",featureFlagKey:null,label:"\u8981\u7D04\u751F\u6210"},{key:"enable_structured_extraction",featureFlagKey:null,label:"\u69CB\u9020\u5316\u62BD\u51FA"},{key:"enable_asset_extraction",featureFlagKey:"ENABLE_ASSET_EXTRACTION",label:"\u30A2\u30BB\u30C3\u30C8\u62BD\u51FA"},{key:"enable_vector_indexing",featureFlagKey:"ENABLE_VECTOR_INDEXING",label:"\u30D9\u30AF\u30C8\u30EB\u7D22\u5F15"},{key:"enable_graph_indexing",featureFlagKey:"ENABLE_GRAPH_INDEXING",label:"\u30B0\u30E9\u30D5\u6295\u5F71"}],Tn=new Set(ie.map(e=>e.key));function bn(e){return Tn.has(e)}function xn(e){let t=ie.find(n=>n.key===e);if(t===void 0)throw new Error(`ENRICHMENT_STAGES does not carry ${e}; the canonical list and the key type have drifted apart.`);return t}var Dn={pageSize:{min:1,max:200,default:50},topologyLabels:{min:1,max:24,default:24}};var A=-1,h=0;function lt(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)}function On(){let e=typeof globalThis<"u"&&globalThis.crypto?globalThis.crypto:typeof crypto<"u"?crypto:void 0;if(!e||typeof e.getRandomValues!="function")throw new Error("Cryptographically secure random number generator (crypto.getRandomValues) is required but not available.");let t=new Uint8Array(16);e.getRandomValues(t);let n=Date.now();if(n===A){if(h++,h>4095){for(;Date.now()<=A;);n=Date.now(),A=n,h=(t[6]<<4|t[7]&15)&1023}}else n>A?(A=n,h=(t[6]<<4|t[7]&15)&1023):(n=A,h++,h>4095&&(h=0));t[0]=Math.floor(n/1099511627776)&255,t[1]=Math.floor(n/4294967296)&255,t[2]=n>>>24&255,t[3]=n>>>16&255,t[4]=n>>>8&255,t[5]=n&255,t[6]=112|h>>>8&15,t[7]=h&255,t[8]=128|t[8]&63;let i=Array.from(t,c=>c.toString(16).padStart(2,"0")).join("");return`${i.slice(0,8)}-${i.slice(8,12)}-${i.slice(12,16)}-${i.slice(16,20)}-${i.slice(20)}`}function Pn(e){if(!lt(e))throw new Error(`Invalid RFC 9562 UUIDv7 string: "${e}"`);let t=e.slice(0,8)+e.slice(9,13),n=parseInt(t,16);if(Number.isNaN(n))throw new Error(`Invalid hex timestamp in UUIDv7: "${t}"`);return new Date(n)}0&&(module.exports={AmountEntrySchema,BaseEnrichmentClient,BodySourceSchema,BoundingBoxSchema,CIRCUIT_BREAKER_SERVICES,CanonicalDomainKeySchema,ChapterSegmentSchema,ChunkingStrategySchema,CircuitBreakerStatusSchema,ConfidentialityLevelSchema,DISPATCH_DEGRADATION_REASONS,DOCUMENT_KINDS,DOCUMENT_KIND_LABELS,DocumentKindSchema,DocumentStructuredDataSchema,ENRICHMENT_STAGES,EnrichmentClient,EnrichmentClientError,EnrichmentSyncStatusSchema,FILTERABLE_CONFIDENTIALITY_LEVELS,FileUriSchema,GRAPH_INDEX_LIMITS,GraphSearchHitSchema,INTEGRITY_CLASS_POLICY,INTEGRITY_COMMAND_CODES,INTEGRITY_FINDINGS_PAGE_LIMIT_MAX,IntegrityActiveRunSchema,IntegrityAuditOverviewSchema,IntegrityCancelFailureCodeSchema,IntegrityCellResyncRequestSchema,IntegrityCellResyncResultSchema,IntegrityCommandFailureCodeSchema,IntegrityCommandFailureSchema,IntegrityCommandReplySchema,IntegrityCommandSchema,IntegrityDispositionSchema,IntegrityFindingItemClassSchema,IntegrityFindingPageSchema,IntegrityFindingSchema,IntegrityFindingsQuerySchema,IntegrityItemClassSchema,IntegrityPhaseSchema,IntegrityPlacementObservedSchema,IntegrityQuantitySchema,IntegrityRepairActionSchema,IntegrityRepairOutcomeSchema,IntegrityRepairSkipReasonSchema,IntegrityRunHeaderSchema,IntegrityRunModeSchema,IntegrityRunStatusSchema,IntegrityScopeRoleSchema,IntegrityStartFailureCodeSchema,IntegrityStoreSchema,IntegrityUnitSchema,IntegrityVerdictSchema,LOCAL_DEGRADATION_REASONS,MIME_KIND_RULES,MODE_TIERS,ModelProviderSchema,NOTHING_TO_READ_TOKENS,NothingToReadTokenSchema,PIPELINE_FLOWS,PIPELINE_PHASES,PIPELINE_STEPS,PIPELINE_STEP_KEYS,PipelineRunRecordSchema,PipelineRunStatusSchema,PipelineRunSummarySchema,PipelineStepKeySchema,PipelineStepMetricSchema,PipelineStepRecordSchema,PipelineStepStatusSchema,PipelineTriggerSchema,QUARANTINED_CONFIDENTIALITY_LEVEL,REMOTE_DEGRADATION_REASONS,SEARCH_DEGRADATION_REASONS,SEARCH_MODES,SEARCH_PARAM_LIMITS,SYSTEM_PARAMETER_RANGES,SearchHitSchema,SearchMetadataSchema,SearchModeSchema,SearchRequestSchema,SearchResponseSchema,StageProvenanceSchema,TenantIdSchema,TranscriptSegmentSchema,assertBoundedSystemParameter,assertSystemParameterInRange,classifyDocumentKind,comparePhases,enrichmentStage,flowFor,flowStepGates,formatSkipReason,generateUuidV7,integrityCommandFailureCodeOf,isEnrichmentStageKey,isStrictlyEarlier,isValidUuidV7,modeFusesRankings,modeNeedsRemoteTiers,modeScoreIsSimilarity,narrowModeToAllowedTiers,orderedSteps,parseSkipReason,uuidv7ToDate});
|