@claritylabs/cl-sdk 2.0.1 → 3.0.1
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 +12 -11
- package/dist/index.d.mts +692 -20
- package/dist/index.d.ts +692 -20
- package/dist/index.js +1385 -253
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1374 -253
- package/dist/index.mjs.map +1 -1
- package/dist/storage-sqlite.d.mts +104 -0
- package/dist/storage-sqlite.d.ts +104 -0
- package/dist/storage-sqlite.js +80 -0
- package/dist/storage-sqlite.js.map +1 -1
- package/dist/storage-sqlite.mjs +80 -0
- package/dist/storage-sqlite.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -98,6 +98,8 @@ declare const InsuranceDocumentSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObj
|
|
|
98
98
|
recordId?: string | undefined;
|
|
99
99
|
}>, "many">;
|
|
100
100
|
documentMetadata: z.ZodObject<{
|
|
101
|
+
sourceTreeVersion: z.ZodOptional<z.ZodString>;
|
|
102
|
+
sourceTreeCanonical: z.ZodOptional<z.ZodBoolean>;
|
|
101
103
|
formInventory: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
102
104
|
formNumber: z.ZodString;
|
|
103
105
|
editionDate: z.ZodOptional<z.ZodString>;
|
|
@@ -193,6 +195,8 @@ declare const InsuranceDocumentSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObj
|
|
|
193
195
|
sourceSpanIds?: string[] | undefined;
|
|
194
196
|
}>, "many">>;
|
|
195
197
|
}, "strip", z.ZodTypeAny, {
|
|
198
|
+
sourceTreeVersion?: string | undefined;
|
|
199
|
+
sourceTreeCanonical?: boolean | undefined;
|
|
196
200
|
formInventory?: {
|
|
197
201
|
formNumber: string;
|
|
198
202
|
formType: "other" | "declarations" | "endorsement" | "application" | "notice" | "coverage";
|
|
@@ -228,6 +232,8 @@ declare const InsuranceDocumentSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObj
|
|
|
228
232
|
sourceSpanIds?: string[] | undefined;
|
|
229
233
|
}[] | undefined;
|
|
230
234
|
}, {
|
|
235
|
+
sourceTreeVersion?: string | undefined;
|
|
236
|
+
sourceTreeCanonical?: boolean | undefined;
|
|
231
237
|
formInventory?: {
|
|
232
238
|
formNumber: string;
|
|
233
239
|
formType: "other" | "declarations" | "endorsement" | "application" | "notice" | "coverage";
|
|
@@ -3994,6 +4000,8 @@ declare const InsuranceDocumentSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObj
|
|
|
3994
4000
|
id: string;
|
|
3995
4001
|
insuredName: string;
|
|
3996
4002
|
documentMetadata: {
|
|
4003
|
+
sourceTreeVersion?: string | undefined;
|
|
4004
|
+
sourceTreeCanonical?: boolean | undefined;
|
|
3997
4005
|
formInventory?: {
|
|
3998
4006
|
formNumber: string;
|
|
3999
4007
|
formType: "other" | "declarations" | "endorsement" | "application" | "notice" | "coverage";
|
|
@@ -5043,6 +5051,8 @@ declare const InsuranceDocumentSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObj
|
|
|
5043
5051
|
id: string;
|
|
5044
5052
|
insuredName: string;
|
|
5045
5053
|
documentMetadata: {
|
|
5054
|
+
sourceTreeVersion?: string | undefined;
|
|
5055
|
+
sourceTreeCanonical?: boolean | undefined;
|
|
5046
5056
|
formInventory?: {
|
|
5047
5057
|
formNumber: string;
|
|
5048
5058
|
formType: "other" | "declarations" | "endorsement" | "application" | "notice" | "coverage";
|
|
@@ -6226,6 +6236,8 @@ declare const InsuranceDocumentSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObj
|
|
|
6226
6236
|
recordId?: string | undefined;
|
|
6227
6237
|
}>, "many">;
|
|
6228
6238
|
documentMetadata: z.ZodObject<{
|
|
6239
|
+
sourceTreeVersion: z.ZodOptional<z.ZodString>;
|
|
6240
|
+
sourceTreeCanonical: z.ZodOptional<z.ZodBoolean>;
|
|
6229
6241
|
formInventory: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
6230
6242
|
formNumber: z.ZodString;
|
|
6231
6243
|
editionDate: z.ZodOptional<z.ZodString>;
|
|
@@ -6321,6 +6333,8 @@ declare const InsuranceDocumentSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObj
|
|
|
6321
6333
|
sourceSpanIds?: string[] | undefined;
|
|
6322
6334
|
}>, "many">>;
|
|
6323
6335
|
}, "strip", z.ZodTypeAny, {
|
|
6336
|
+
sourceTreeVersion?: string | undefined;
|
|
6337
|
+
sourceTreeCanonical?: boolean | undefined;
|
|
6324
6338
|
formInventory?: {
|
|
6325
6339
|
formNumber: string;
|
|
6326
6340
|
formType: "other" | "declarations" | "endorsement" | "application" | "notice" | "coverage";
|
|
@@ -6356,6 +6370,8 @@ declare const InsuranceDocumentSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObj
|
|
|
6356
6370
|
sourceSpanIds?: string[] | undefined;
|
|
6357
6371
|
}[] | undefined;
|
|
6358
6372
|
}, {
|
|
6373
|
+
sourceTreeVersion?: string | undefined;
|
|
6374
|
+
sourceTreeCanonical?: boolean | undefined;
|
|
6359
6375
|
formInventory?: {
|
|
6360
6376
|
formNumber: string;
|
|
6361
6377
|
formType: "other" | "declarations" | "endorsement" | "application" | "notice" | "coverage";
|
|
@@ -10120,6 +10136,8 @@ declare const InsuranceDocumentSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObj
|
|
|
10120
10136
|
id: string;
|
|
10121
10137
|
insuredName: string;
|
|
10122
10138
|
documentMetadata: {
|
|
10139
|
+
sourceTreeVersion?: string | undefined;
|
|
10140
|
+
sourceTreeCanonical?: boolean | undefined;
|
|
10123
10141
|
formInventory?: {
|
|
10124
10142
|
formNumber: string;
|
|
10125
10143
|
formType: "other" | "declarations" | "endorsement" | "application" | "notice" | "coverage";
|
|
@@ -11202,6 +11220,8 @@ declare const InsuranceDocumentSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObj
|
|
|
11202
11220
|
id: string;
|
|
11203
11221
|
insuredName: string;
|
|
11204
11222
|
documentMetadata: {
|
|
11223
|
+
sourceTreeVersion?: string | undefined;
|
|
11224
|
+
sourceTreeCanonical?: boolean | undefined;
|
|
11205
11225
|
formInventory?: {
|
|
11206
11226
|
formNumber: string;
|
|
11207
11227
|
formType: "other" | "declarations" | "endorsement" | "application" | "notice" | "coverage";
|
|
@@ -12517,6 +12537,83 @@ declare const SourceChunkSchema: z.ZodObject<{
|
|
|
12517
12537
|
metadata?: Record<string, string> | undefined;
|
|
12518
12538
|
}>;
|
|
12519
12539
|
type SourceChunk = z.infer<typeof SourceChunkSchema>;
|
|
12540
|
+
declare const DocumentSourceNodeSchema: z.ZodObject<{
|
|
12541
|
+
id: z.ZodString;
|
|
12542
|
+
documentId: z.ZodString;
|
|
12543
|
+
parentId: z.ZodOptional<z.ZodString>;
|
|
12544
|
+
kind: z.ZodEnum<["document", "page_group", "page", "form", "endorsement", "section", "schedule", "clause", "table", "table_row", "table_cell", "text"]>;
|
|
12545
|
+
title: z.ZodString;
|
|
12546
|
+
description: z.ZodString;
|
|
12547
|
+
textExcerpt: z.ZodOptional<z.ZodString>;
|
|
12548
|
+
sourceSpanIds: z.ZodArray<z.ZodString, "many">;
|
|
12549
|
+
pageStart: z.ZodOptional<z.ZodNumber>;
|
|
12550
|
+
pageEnd: z.ZodOptional<z.ZodNumber>;
|
|
12551
|
+
bbox: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
12552
|
+
page: z.ZodNumber;
|
|
12553
|
+
x: z.ZodNumber;
|
|
12554
|
+
y: z.ZodNumber;
|
|
12555
|
+
width: z.ZodNumber;
|
|
12556
|
+
height: z.ZodNumber;
|
|
12557
|
+
}, "strip", z.ZodTypeAny, {
|
|
12558
|
+
page: number;
|
|
12559
|
+
x: number;
|
|
12560
|
+
y: number;
|
|
12561
|
+
width: number;
|
|
12562
|
+
height: number;
|
|
12563
|
+
}, {
|
|
12564
|
+
page: number;
|
|
12565
|
+
x: number;
|
|
12566
|
+
y: number;
|
|
12567
|
+
width: number;
|
|
12568
|
+
height: number;
|
|
12569
|
+
}>, "many">>;
|
|
12570
|
+
order: z.ZodNumber;
|
|
12571
|
+
path: z.ZodString;
|
|
12572
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
12573
|
+
}, "strip", z.ZodTypeAny, {
|
|
12574
|
+
title: string;
|
|
12575
|
+
path: string;
|
|
12576
|
+
sourceSpanIds: string[];
|
|
12577
|
+
description: string;
|
|
12578
|
+
kind: "endorsement" | "schedule" | "page" | "section" | "table" | "table_row" | "table_cell" | "text" | "document" | "page_group" | "form" | "clause";
|
|
12579
|
+
id: string;
|
|
12580
|
+
documentId: string;
|
|
12581
|
+
order: number;
|
|
12582
|
+
pageStart?: number | undefined;
|
|
12583
|
+
pageEnd?: number | undefined;
|
|
12584
|
+
bbox?: {
|
|
12585
|
+
page: number;
|
|
12586
|
+
x: number;
|
|
12587
|
+
y: number;
|
|
12588
|
+
width: number;
|
|
12589
|
+
height: number;
|
|
12590
|
+
}[] | undefined;
|
|
12591
|
+
metadata?: Record<string, unknown> | undefined;
|
|
12592
|
+
parentId?: string | undefined;
|
|
12593
|
+
textExcerpt?: string | undefined;
|
|
12594
|
+
}, {
|
|
12595
|
+
title: string;
|
|
12596
|
+
path: string;
|
|
12597
|
+
sourceSpanIds: string[];
|
|
12598
|
+
description: string;
|
|
12599
|
+
kind: "endorsement" | "schedule" | "page" | "section" | "table" | "table_row" | "table_cell" | "text" | "document" | "page_group" | "form" | "clause";
|
|
12600
|
+
id: string;
|
|
12601
|
+
documentId: string;
|
|
12602
|
+
order: number;
|
|
12603
|
+
pageStart?: number | undefined;
|
|
12604
|
+
pageEnd?: number | undefined;
|
|
12605
|
+
bbox?: {
|
|
12606
|
+
page: number;
|
|
12607
|
+
x: number;
|
|
12608
|
+
y: number;
|
|
12609
|
+
width: number;
|
|
12610
|
+
height: number;
|
|
12611
|
+
}[] | undefined;
|
|
12612
|
+
metadata?: Record<string, unknown> | undefined;
|
|
12613
|
+
parentId?: string | undefined;
|
|
12614
|
+
textExcerpt?: string | undefined;
|
|
12615
|
+
}>;
|
|
12616
|
+
type DocumentSourceNode = z.infer<typeof DocumentSourceNodeSchema>;
|
|
12520
12617
|
|
|
12521
12618
|
type SourceRetrievalMode = "graph_only" | "source_rag" | "long_context" | "hybrid";
|
|
12522
12619
|
interface SourceRetrievalQuery {
|
|
@@ -12531,8 +12628,15 @@ interface SourceRetrievalResult {
|
|
|
12531
12628
|
span: SourceSpan;
|
|
12532
12629
|
relevance: number;
|
|
12533
12630
|
}
|
|
12631
|
+
interface SourceNodeRetrievalResult {
|
|
12632
|
+
node: DocumentSourceNode;
|
|
12633
|
+
relevance: number;
|
|
12634
|
+
hierarchy: DocumentSourceNode[];
|
|
12635
|
+
spans: SourceSpan[];
|
|
12636
|
+
}
|
|
12534
12637
|
interface SourceRetriever {
|
|
12535
12638
|
searchSourceSpans(query: SourceRetrievalQuery): Promise<SourceRetrievalResult[]>;
|
|
12639
|
+
searchSourceNodes?(query: SourceRetrievalQuery): Promise<SourceNodeRetrievalResult[]>;
|
|
12536
12640
|
}
|
|
12537
12641
|
|
|
12538
12642
|
interface SourceStore extends SourceRetriever {
|
package/dist/storage-sqlite.d.ts
CHANGED
|
@@ -98,6 +98,8 @@ declare const InsuranceDocumentSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObj
|
|
|
98
98
|
recordId?: string | undefined;
|
|
99
99
|
}>, "many">;
|
|
100
100
|
documentMetadata: z.ZodObject<{
|
|
101
|
+
sourceTreeVersion: z.ZodOptional<z.ZodString>;
|
|
102
|
+
sourceTreeCanonical: z.ZodOptional<z.ZodBoolean>;
|
|
101
103
|
formInventory: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
102
104
|
formNumber: z.ZodString;
|
|
103
105
|
editionDate: z.ZodOptional<z.ZodString>;
|
|
@@ -193,6 +195,8 @@ declare const InsuranceDocumentSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObj
|
|
|
193
195
|
sourceSpanIds?: string[] | undefined;
|
|
194
196
|
}>, "many">>;
|
|
195
197
|
}, "strip", z.ZodTypeAny, {
|
|
198
|
+
sourceTreeVersion?: string | undefined;
|
|
199
|
+
sourceTreeCanonical?: boolean | undefined;
|
|
196
200
|
formInventory?: {
|
|
197
201
|
formNumber: string;
|
|
198
202
|
formType: "other" | "declarations" | "endorsement" | "application" | "notice" | "coverage";
|
|
@@ -228,6 +232,8 @@ declare const InsuranceDocumentSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObj
|
|
|
228
232
|
sourceSpanIds?: string[] | undefined;
|
|
229
233
|
}[] | undefined;
|
|
230
234
|
}, {
|
|
235
|
+
sourceTreeVersion?: string | undefined;
|
|
236
|
+
sourceTreeCanonical?: boolean | undefined;
|
|
231
237
|
formInventory?: {
|
|
232
238
|
formNumber: string;
|
|
233
239
|
formType: "other" | "declarations" | "endorsement" | "application" | "notice" | "coverage";
|
|
@@ -3994,6 +4000,8 @@ declare const InsuranceDocumentSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObj
|
|
|
3994
4000
|
id: string;
|
|
3995
4001
|
insuredName: string;
|
|
3996
4002
|
documentMetadata: {
|
|
4003
|
+
sourceTreeVersion?: string | undefined;
|
|
4004
|
+
sourceTreeCanonical?: boolean | undefined;
|
|
3997
4005
|
formInventory?: {
|
|
3998
4006
|
formNumber: string;
|
|
3999
4007
|
formType: "other" | "declarations" | "endorsement" | "application" | "notice" | "coverage";
|
|
@@ -5043,6 +5051,8 @@ declare const InsuranceDocumentSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObj
|
|
|
5043
5051
|
id: string;
|
|
5044
5052
|
insuredName: string;
|
|
5045
5053
|
documentMetadata: {
|
|
5054
|
+
sourceTreeVersion?: string | undefined;
|
|
5055
|
+
sourceTreeCanonical?: boolean | undefined;
|
|
5046
5056
|
formInventory?: {
|
|
5047
5057
|
formNumber: string;
|
|
5048
5058
|
formType: "other" | "declarations" | "endorsement" | "application" | "notice" | "coverage";
|
|
@@ -6226,6 +6236,8 @@ declare const InsuranceDocumentSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObj
|
|
|
6226
6236
|
recordId?: string | undefined;
|
|
6227
6237
|
}>, "many">;
|
|
6228
6238
|
documentMetadata: z.ZodObject<{
|
|
6239
|
+
sourceTreeVersion: z.ZodOptional<z.ZodString>;
|
|
6240
|
+
sourceTreeCanonical: z.ZodOptional<z.ZodBoolean>;
|
|
6229
6241
|
formInventory: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
6230
6242
|
formNumber: z.ZodString;
|
|
6231
6243
|
editionDate: z.ZodOptional<z.ZodString>;
|
|
@@ -6321,6 +6333,8 @@ declare const InsuranceDocumentSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObj
|
|
|
6321
6333
|
sourceSpanIds?: string[] | undefined;
|
|
6322
6334
|
}>, "many">>;
|
|
6323
6335
|
}, "strip", z.ZodTypeAny, {
|
|
6336
|
+
sourceTreeVersion?: string | undefined;
|
|
6337
|
+
sourceTreeCanonical?: boolean | undefined;
|
|
6324
6338
|
formInventory?: {
|
|
6325
6339
|
formNumber: string;
|
|
6326
6340
|
formType: "other" | "declarations" | "endorsement" | "application" | "notice" | "coverage";
|
|
@@ -6356,6 +6370,8 @@ declare const InsuranceDocumentSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObj
|
|
|
6356
6370
|
sourceSpanIds?: string[] | undefined;
|
|
6357
6371
|
}[] | undefined;
|
|
6358
6372
|
}, {
|
|
6373
|
+
sourceTreeVersion?: string | undefined;
|
|
6374
|
+
sourceTreeCanonical?: boolean | undefined;
|
|
6359
6375
|
formInventory?: {
|
|
6360
6376
|
formNumber: string;
|
|
6361
6377
|
formType: "other" | "declarations" | "endorsement" | "application" | "notice" | "coverage";
|
|
@@ -10120,6 +10136,8 @@ declare const InsuranceDocumentSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObj
|
|
|
10120
10136
|
id: string;
|
|
10121
10137
|
insuredName: string;
|
|
10122
10138
|
documentMetadata: {
|
|
10139
|
+
sourceTreeVersion?: string | undefined;
|
|
10140
|
+
sourceTreeCanonical?: boolean | undefined;
|
|
10123
10141
|
formInventory?: {
|
|
10124
10142
|
formNumber: string;
|
|
10125
10143
|
formType: "other" | "declarations" | "endorsement" | "application" | "notice" | "coverage";
|
|
@@ -11202,6 +11220,8 @@ declare const InsuranceDocumentSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObj
|
|
|
11202
11220
|
id: string;
|
|
11203
11221
|
insuredName: string;
|
|
11204
11222
|
documentMetadata: {
|
|
11223
|
+
sourceTreeVersion?: string | undefined;
|
|
11224
|
+
sourceTreeCanonical?: boolean | undefined;
|
|
11205
11225
|
formInventory?: {
|
|
11206
11226
|
formNumber: string;
|
|
11207
11227
|
formType: "other" | "declarations" | "endorsement" | "application" | "notice" | "coverage";
|
|
@@ -12517,6 +12537,83 @@ declare const SourceChunkSchema: z.ZodObject<{
|
|
|
12517
12537
|
metadata?: Record<string, string> | undefined;
|
|
12518
12538
|
}>;
|
|
12519
12539
|
type SourceChunk = z.infer<typeof SourceChunkSchema>;
|
|
12540
|
+
declare const DocumentSourceNodeSchema: z.ZodObject<{
|
|
12541
|
+
id: z.ZodString;
|
|
12542
|
+
documentId: z.ZodString;
|
|
12543
|
+
parentId: z.ZodOptional<z.ZodString>;
|
|
12544
|
+
kind: z.ZodEnum<["document", "page_group", "page", "form", "endorsement", "section", "schedule", "clause", "table", "table_row", "table_cell", "text"]>;
|
|
12545
|
+
title: z.ZodString;
|
|
12546
|
+
description: z.ZodString;
|
|
12547
|
+
textExcerpt: z.ZodOptional<z.ZodString>;
|
|
12548
|
+
sourceSpanIds: z.ZodArray<z.ZodString, "many">;
|
|
12549
|
+
pageStart: z.ZodOptional<z.ZodNumber>;
|
|
12550
|
+
pageEnd: z.ZodOptional<z.ZodNumber>;
|
|
12551
|
+
bbox: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
12552
|
+
page: z.ZodNumber;
|
|
12553
|
+
x: z.ZodNumber;
|
|
12554
|
+
y: z.ZodNumber;
|
|
12555
|
+
width: z.ZodNumber;
|
|
12556
|
+
height: z.ZodNumber;
|
|
12557
|
+
}, "strip", z.ZodTypeAny, {
|
|
12558
|
+
page: number;
|
|
12559
|
+
x: number;
|
|
12560
|
+
y: number;
|
|
12561
|
+
width: number;
|
|
12562
|
+
height: number;
|
|
12563
|
+
}, {
|
|
12564
|
+
page: number;
|
|
12565
|
+
x: number;
|
|
12566
|
+
y: number;
|
|
12567
|
+
width: number;
|
|
12568
|
+
height: number;
|
|
12569
|
+
}>, "many">>;
|
|
12570
|
+
order: z.ZodNumber;
|
|
12571
|
+
path: z.ZodString;
|
|
12572
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
12573
|
+
}, "strip", z.ZodTypeAny, {
|
|
12574
|
+
title: string;
|
|
12575
|
+
path: string;
|
|
12576
|
+
sourceSpanIds: string[];
|
|
12577
|
+
description: string;
|
|
12578
|
+
kind: "endorsement" | "schedule" | "page" | "section" | "table" | "table_row" | "table_cell" | "text" | "document" | "page_group" | "form" | "clause";
|
|
12579
|
+
id: string;
|
|
12580
|
+
documentId: string;
|
|
12581
|
+
order: number;
|
|
12582
|
+
pageStart?: number | undefined;
|
|
12583
|
+
pageEnd?: number | undefined;
|
|
12584
|
+
bbox?: {
|
|
12585
|
+
page: number;
|
|
12586
|
+
x: number;
|
|
12587
|
+
y: number;
|
|
12588
|
+
width: number;
|
|
12589
|
+
height: number;
|
|
12590
|
+
}[] | undefined;
|
|
12591
|
+
metadata?: Record<string, unknown> | undefined;
|
|
12592
|
+
parentId?: string | undefined;
|
|
12593
|
+
textExcerpt?: string | undefined;
|
|
12594
|
+
}, {
|
|
12595
|
+
title: string;
|
|
12596
|
+
path: string;
|
|
12597
|
+
sourceSpanIds: string[];
|
|
12598
|
+
description: string;
|
|
12599
|
+
kind: "endorsement" | "schedule" | "page" | "section" | "table" | "table_row" | "table_cell" | "text" | "document" | "page_group" | "form" | "clause";
|
|
12600
|
+
id: string;
|
|
12601
|
+
documentId: string;
|
|
12602
|
+
order: number;
|
|
12603
|
+
pageStart?: number | undefined;
|
|
12604
|
+
pageEnd?: number | undefined;
|
|
12605
|
+
bbox?: {
|
|
12606
|
+
page: number;
|
|
12607
|
+
x: number;
|
|
12608
|
+
y: number;
|
|
12609
|
+
width: number;
|
|
12610
|
+
height: number;
|
|
12611
|
+
}[] | undefined;
|
|
12612
|
+
metadata?: Record<string, unknown> | undefined;
|
|
12613
|
+
parentId?: string | undefined;
|
|
12614
|
+
textExcerpt?: string | undefined;
|
|
12615
|
+
}>;
|
|
12616
|
+
type DocumentSourceNode = z.infer<typeof DocumentSourceNodeSchema>;
|
|
12520
12617
|
|
|
12521
12618
|
type SourceRetrievalMode = "graph_only" | "source_rag" | "long_context" | "hybrid";
|
|
12522
12619
|
interface SourceRetrievalQuery {
|
|
@@ -12531,8 +12628,15 @@ interface SourceRetrievalResult {
|
|
|
12531
12628
|
span: SourceSpan;
|
|
12532
12629
|
relevance: number;
|
|
12533
12630
|
}
|
|
12631
|
+
interface SourceNodeRetrievalResult {
|
|
12632
|
+
node: DocumentSourceNode;
|
|
12633
|
+
relevance: number;
|
|
12634
|
+
hierarchy: DocumentSourceNode[];
|
|
12635
|
+
spans: SourceSpan[];
|
|
12636
|
+
}
|
|
12534
12637
|
interface SourceRetriever {
|
|
12535
12638
|
searchSourceSpans(query: SourceRetrievalQuery): Promise<SourceRetrievalResult[]>;
|
|
12639
|
+
searchSourceNodes?(query: SourceRetrievalQuery): Promise<SourceNodeRetrievalResult[]>;
|
|
12536
12640
|
}
|
|
12537
12641
|
|
|
12538
12642
|
interface SourceStore extends SourceRetriever {
|
package/dist/storage-sqlite.js
CHANGED
|
@@ -373,6 +373,86 @@ var SourceChunkSchema = import_zod.z.object({
|
|
|
373
373
|
pageEnd: import_zod.z.number().int().positive().optional(),
|
|
374
374
|
metadata: import_zod.z.record(import_zod.z.string(), import_zod.z.string()).default({})
|
|
375
375
|
});
|
|
376
|
+
var DocumentSourceNodeKindSchema = import_zod.z.enum([
|
|
377
|
+
"document",
|
|
378
|
+
"page_group",
|
|
379
|
+
"page",
|
|
380
|
+
"form",
|
|
381
|
+
"endorsement",
|
|
382
|
+
"section",
|
|
383
|
+
"schedule",
|
|
384
|
+
"clause",
|
|
385
|
+
"table",
|
|
386
|
+
"table_row",
|
|
387
|
+
"table_cell",
|
|
388
|
+
"text"
|
|
389
|
+
]);
|
|
390
|
+
var DocumentSourceNodeSchema = import_zod.z.object({
|
|
391
|
+
id: import_zod.z.string().min(1),
|
|
392
|
+
documentId: import_zod.z.string().min(1),
|
|
393
|
+
parentId: import_zod.z.string().optional(),
|
|
394
|
+
kind: DocumentSourceNodeKindSchema,
|
|
395
|
+
title: import_zod.z.string(),
|
|
396
|
+
description: import_zod.z.string(),
|
|
397
|
+
textExcerpt: import_zod.z.string().optional(),
|
|
398
|
+
sourceSpanIds: import_zod.z.array(import_zod.z.string().min(1)),
|
|
399
|
+
pageStart: import_zod.z.number().int().positive().optional(),
|
|
400
|
+
pageEnd: import_zod.z.number().int().positive().optional(),
|
|
401
|
+
bbox: import_zod.z.array(SourceSpanBBoxSchema).optional(),
|
|
402
|
+
order: import_zod.z.number().int().nonnegative(),
|
|
403
|
+
path: import_zod.z.string(),
|
|
404
|
+
metadata: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()).optional()
|
|
405
|
+
});
|
|
406
|
+
var SourceBackedValueSchema = import_zod.z.object({
|
|
407
|
+
value: import_zod.z.string(),
|
|
408
|
+
normalizedValue: import_zod.z.string().optional(),
|
|
409
|
+
confidence: import_zod.z.enum(["low", "medium", "high"]).default("medium"),
|
|
410
|
+
sourceNodeIds: import_zod.z.array(import_zod.z.string().min(1)).default([]),
|
|
411
|
+
sourceSpanIds: import_zod.z.array(import_zod.z.string().min(1)).default([])
|
|
412
|
+
});
|
|
413
|
+
var OperationalCoverageLineSchema = import_zod.z.object({
|
|
414
|
+
name: import_zod.z.string(),
|
|
415
|
+
coverageCode: import_zod.z.string().optional(),
|
|
416
|
+
limit: import_zod.z.string().optional(),
|
|
417
|
+
deductible: import_zod.z.string().optional(),
|
|
418
|
+
premium: import_zod.z.string().optional(),
|
|
419
|
+
formNumber: import_zod.z.string().optional(),
|
|
420
|
+
sectionRef: import_zod.z.string().optional(),
|
|
421
|
+
sourceNodeIds: import_zod.z.array(import_zod.z.string().min(1)).default([]),
|
|
422
|
+
sourceSpanIds: import_zod.z.array(import_zod.z.string().min(1)).default([])
|
|
423
|
+
});
|
|
424
|
+
var OperationalPartySchema = import_zod.z.object({
|
|
425
|
+
role: import_zod.z.string(),
|
|
426
|
+
name: import_zod.z.string(),
|
|
427
|
+
sourceNodeIds: import_zod.z.array(import_zod.z.string().min(1)).default([]),
|
|
428
|
+
sourceSpanIds: import_zod.z.array(import_zod.z.string().min(1)).default([])
|
|
429
|
+
});
|
|
430
|
+
var OperationalEndorsementSupportSchema = import_zod.z.object({
|
|
431
|
+
kind: import_zod.z.string(),
|
|
432
|
+
status: import_zod.z.enum(["supported", "excluded", "requires_review"]),
|
|
433
|
+
summary: import_zod.z.string(),
|
|
434
|
+
sourceNodeIds: import_zod.z.array(import_zod.z.string().min(1)).default([]),
|
|
435
|
+
sourceSpanIds: import_zod.z.array(import_zod.z.string().min(1)).default([])
|
|
436
|
+
});
|
|
437
|
+
var PolicyOperationalProfileSchema = import_zod.z.object({
|
|
438
|
+
documentType: import_zod.z.enum(["policy", "quote"]).default("policy"),
|
|
439
|
+
policyTypes: import_zod.z.array(import_zod.z.string()).default(["other"]),
|
|
440
|
+
policyNumber: SourceBackedValueSchema.optional(),
|
|
441
|
+
namedInsured: SourceBackedValueSchema.optional(),
|
|
442
|
+
insurer: SourceBackedValueSchema.optional(),
|
|
443
|
+
broker: SourceBackedValueSchema.optional(),
|
|
444
|
+
effectiveDate: SourceBackedValueSchema.optional(),
|
|
445
|
+
expirationDate: SourceBackedValueSchema.optional(),
|
|
446
|
+
retroactiveDate: SourceBackedValueSchema.optional(),
|
|
447
|
+
premium: SourceBackedValueSchema.optional(),
|
|
448
|
+
coverageTypes: import_zod.z.array(import_zod.z.string()).default([]),
|
|
449
|
+
coverages: import_zod.z.array(OperationalCoverageLineSchema).default([]),
|
|
450
|
+
parties: import_zod.z.array(OperationalPartySchema).default([]),
|
|
451
|
+
endorsementSupport: import_zod.z.array(OperationalEndorsementSupportSchema).default([]),
|
|
452
|
+
sourceNodeIds: import_zod.z.array(import_zod.z.string().min(1)).default([]),
|
|
453
|
+
sourceSpanIds: import_zod.z.array(import_zod.z.string().min(1)).default([]),
|
|
454
|
+
warnings: import_zod.z.array(import_zod.z.string()).default([])
|
|
455
|
+
});
|
|
376
456
|
|
|
377
457
|
// src/source/retrieval.ts
|
|
378
458
|
function evidenceTieBreakId(evidence) {
|