@claritylabs/cl-sdk 4.2.0 → 4.3.0
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 +1 -1
- package/dist/application.d.mts +1 -1
- package/dist/application.d.ts +1 -1
- package/dist/application.js +2 -0
- package/dist/application.js.map +1 -1
- package/dist/application.mjs +2 -0
- package/dist/application.mjs.map +1 -1
- package/dist/{index-C9XfOdmx.d.mts → index-DhA-5jZy.d.mts} +369 -0
- package/dist/{index-C9XfOdmx.d.ts → index-DhA-5jZy.d.ts} +369 -0
- package/dist/index.d.mts +40 -2
- package/dist/index.d.ts +40 -2
- package/dist/index.js +128 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +128 -23
- package/dist/index.mjs.map +1 -1
- package/dist/storage-sqlite.d.mts +108 -0
- package/dist/storage-sqlite.d.ts +108 -0
- package/dist/storage-sqlite.js +2 -0
- package/dist/storage-sqlite.js.map +1 -1
- package/dist/storage-sqlite.mjs +2 -0
- package/dist/storage-sqlite.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { L as LogFn, M as ModelTaskKind, a as ModelBudgetResolution, b as ModelCallTrace, G as GenerateObject, T as TokenUsage, O as OperationalCoverageLine, S as SourceSpanLocation, c as SourceSpan, D as DocumentSourceNode, d as SourceKind, e as SourceSpanUnit, f as SourceSpanTableLocation, g as SourceChunk, h as SourceSpanBBox, U as UnifiedQualityReport, B as BaseQualityIssue, Q as QualityGateStatus, P as PdfInput, I as InsuranceDocument, i as DocumentChunk, j as PolicyOperationalProfile, k as PerformanceReport, l as QualityGateMode, m as ModelCapabilities, n as ModelBudgetConstraint, A as AgentContext, o as GenerateText, p as DocumentStore, q as MemoryStore, r as Platform } from './index-
|
|
2
|
-
export { s as AcroFormMapping, t as AcroFormMappingSchema, u as AnswerParsingResult, v as AnswerParsingResultSchema, w as ApplicationClassifyResult, x as ApplicationClassifyResultSchema, y as ApplicationContextProposal, z as ApplicationContextProposalSchema, C as ApplicationEmailReviewSchema, E as ApplicationField, F as ApplicationFieldSchema, H as ApplicationListFilters, J as ApplicationNextQuestions, K as ApplicationPacket, N as ApplicationPacketAnswer, R as ApplicationPacketAnswerSchema, V as ApplicationPacketSchema, W as ApplicationPipelineConfig, X as ApplicationQualityArtifactSchema, Y as ApplicationQualityIssueSchema, Z as ApplicationQualityReportSchema, _ as ApplicationQualityRoundSchema, $ as ApplicationQuestionCondition, a0 as ApplicationQuestionConditionSchema, a1 as ApplicationQuestionGraph, a2 as ApplicationQuestionGraphSchema, a3 as ApplicationQuestionNode, a4 as ApplicationQuestionNodeSchema, a5 as ApplicationRepeat, a6 as ApplicationRepeatSchema, a7 as ApplicationState, a8 as ApplicationStateSchema, a9 as ApplicationStore, aa as ApplicationTemplate, ab as ApplicationTemplateListFilters, ac as ApplicationTemplateSchema, ad as ApplicationTemplateStore, ae as AutoFillMatch, af as AutoFillMatchSchema, ag as AutoFillResult, ah as AutoFillResultSchema, ai as AuxiliaryFact, aj as AuxiliaryFactSchema, ak as BackfillProvider, al as BuildApplicationPacketInput, am as BuildApplicationPacketResult, an as ChunkFilter, ao as CommunicationIntent, ap as CommunicationIntentSchema, aq as ContextProposalResult, ar as ConversationTurn, as as ConvertPdfToImagesFn, at as CoveredReason, au as CoveredReasonSchema, av as CreateApplicationRunInput, aw as Definition, ax as DefinitionSchema, ay as DocumentAgentGuidance, az as DocumentAgentGuidanceSchema, aA as DocumentFilters, aB as DocumentMetadata, aC as DocumentMetadataSchema, aD as DocumentNode, aE as DocumentNodeSchema, aF as DocumentPageMapEntry, aG as DocumentPageMapEntrySchema, aH as DocumentSourceNodeKind, aI as DocumentSourceNodeKindSchema, aJ as DocumentSourceNodeSchema, aK as DocumentTableOfContentsEntry, aL as DocumentTableOfContentsEntrySchema, aM as EmbedText, aN as FieldExtractionResult, aO as FieldExtractionResultSchema, aP as FieldType, aQ as FieldTypeSchema, aR as FlatPdfPlacement, aS as FlatPdfPlacementSchema, aT as InsuranceDocumentSchema, aU as LookupFill, aV as LookupFillResult, aW as LookupFillResultSchema, aX as LookupFillSchema, aY as LookupRequest, aZ as LookupRequestSchema, a_ as ModelCallReport, a$ as OperationalAddress, b0 as OperationalAddressSchema, b1 as OperationalCoverageLineSchema, b2 as OperationalCoverageTerm, b3 as OperationalCoverageTermSchema, b4 as OperationalDeclarationFact, b5 as OperationalDeclarationFactSchema, b6 as OperationalEndorsementSupport, b7 as OperationalEndorsementSupportSchema, b8 as OperationalParty, b9 as OperationalPartySchema, ba as PLATFORM_CONFIGS, bb as ParsedAnswer, bc as ParsedAnswerSchema, bd as PlatformConfig, be as PlatformSchema, bf as PolicyDocument, bg as PolicyDocumentSchema, bh as PolicyOperationalProfileSchema, bi as PremiumLine, bj as PremiumLineSchema, bk as PriorAnswer, bl as ProcessApplicationInput, bm as ProcessApplicationResult, bn as ProcessReplyInput, bo as ProcessReplyResult, bp as QuestionBatchResult, bq as QuestionBatchResultSchema, br as QuoteDocument, bs as QuoteDocumentSchema, bt as ReplyIntent, bu as ReplyIntentSchema, bv as ResolveModelBudgetParams, bw as Section, bx as SectionSchema, by as SourceBackedValue, bz as SourceBackedValueSchema, bA as SourceChunkSchema, bB as SourceKindSchema, bC as SourceSpanBBoxSchema, bD as SourceSpanKind, bE as SourceSpanKindSchema, bF as SourceSpanLocationSchema, bG as SourceSpanRef, bH as SourceSpanRefSchema, bI as SourceSpanSchema, bJ as SourceSpanTableLocationSchema, bK as SourceSpanUnitSchema, bL as Subjectivity, bM as SubjectivitySchema, bN as Subsection, bO as SubsectionSchema, bP as UnderwritingCondition, bQ as UnderwritingConditionSchema, bR as applyApplicationAnswers, bS as buildApplicationPacket, bT as buildQuestionGraphFromFields, bU as createApplicationPipeline, bV as createApplicationRun, bW as extractQuestionGraphFromFields, bX as flattenQuestionGraph, bY as getActiveApplicationFields, bZ as getNextApplicationQuestions, b_ as normalizeApplicationQuestionGraph, b$ as planNextApplicationQuestions, c0 as proposeContextWrites, c1 as resolveModelBudget, c2 as validateApplicationPacket } from './index-
|
|
1
|
+
import { L as LogFn, M as ModelTaskKind, a as ModelBudgetResolution, b as ModelCallTrace, G as GenerateObject, T as TokenUsage, O as OperationalCoverageLine, S as SourceSpanLocation, c as SourceSpan, D as DocumentSourceNode, d as SourceKind, e as SourceSpanUnit, f as SourceSpanTableLocation, g as SourceChunk, h as SourceSpanBBox, U as UnifiedQualityReport, B as BaseQualityIssue, Q as QualityGateStatus, P as PdfInput, I as InsuranceDocument, i as DocumentChunk, j as PolicyOperationalProfile, k as PerformanceReport, l as QualityGateMode, m as ModelCapabilities, n as ModelBudgetConstraint, A as AgentContext, o as GenerateText, p as DocumentStore, q as MemoryStore, r as Platform } from './index-DhA-5jZy.js';
|
|
2
|
+
export { s as AcroFormMapping, t as AcroFormMappingSchema, u as AnswerParsingResult, v as AnswerParsingResultSchema, w as ApplicationClassifyResult, x as ApplicationClassifyResultSchema, y as ApplicationContextProposal, z as ApplicationContextProposalSchema, C as ApplicationEmailReviewSchema, E as ApplicationField, F as ApplicationFieldSchema, H as ApplicationListFilters, J as ApplicationNextQuestions, K as ApplicationPacket, N as ApplicationPacketAnswer, R as ApplicationPacketAnswerSchema, V as ApplicationPacketSchema, W as ApplicationPipelineConfig, X as ApplicationQualityArtifactSchema, Y as ApplicationQualityIssueSchema, Z as ApplicationQualityReportSchema, _ as ApplicationQualityRoundSchema, $ as ApplicationQuestionCondition, a0 as ApplicationQuestionConditionSchema, a1 as ApplicationQuestionGraph, a2 as ApplicationQuestionGraphSchema, a3 as ApplicationQuestionNode, a4 as ApplicationQuestionNodeSchema, a5 as ApplicationRepeat, a6 as ApplicationRepeatSchema, a7 as ApplicationState, a8 as ApplicationStateSchema, a9 as ApplicationStore, aa as ApplicationTemplate, ab as ApplicationTemplateListFilters, ac as ApplicationTemplateSchema, ad as ApplicationTemplateStore, ae as AutoFillMatch, af as AutoFillMatchSchema, ag as AutoFillResult, ah as AutoFillResultSchema, ai as AuxiliaryFact, aj as AuxiliaryFactSchema, ak as BackfillProvider, al as BuildApplicationPacketInput, am as BuildApplicationPacketResult, an as ChunkFilter, ao as CommunicationIntent, ap as CommunicationIntentSchema, aq as ContextProposalResult, ar as ConversationTurn, as as ConvertPdfToImagesFn, at as CoveredReason, au as CoveredReasonSchema, av as CreateApplicationRunInput, aw as Definition, ax as DefinitionSchema, ay as DocumentAgentGuidance, az as DocumentAgentGuidanceSchema, aA as DocumentFilters, aB as DocumentMetadata, aC as DocumentMetadataSchema, aD as DocumentNode, aE as DocumentNodeSchema, aF as DocumentPageMapEntry, aG as DocumentPageMapEntrySchema, aH as DocumentSourceNodeKind, aI as DocumentSourceNodeKindSchema, aJ as DocumentSourceNodeSchema, aK as DocumentTableOfContentsEntry, aL as DocumentTableOfContentsEntrySchema, aM as EmbedText, aN as FieldExtractionResult, aO as FieldExtractionResultSchema, aP as FieldType, aQ as FieldTypeSchema, aR as FlatPdfPlacement, aS as FlatPdfPlacementSchema, aT as InsuranceDocumentSchema, aU as LookupFill, aV as LookupFillResult, aW as LookupFillResultSchema, aX as LookupFillSchema, aY as LookupRequest, aZ as LookupRequestSchema, a_ as ModelCallReport, a$ as OperationalAddress, b0 as OperationalAddressSchema, b1 as OperationalCoverageLineSchema, b2 as OperationalCoverageTerm, b3 as OperationalCoverageTermSchema, b4 as OperationalDeclarationFact, b5 as OperationalDeclarationFactSchema, b6 as OperationalEndorsementSupport, b7 as OperationalEndorsementSupportSchema, b8 as OperationalParty, b9 as OperationalPartySchema, ba as PLATFORM_CONFIGS, bb as ParsedAnswer, bc as ParsedAnswerSchema, bd as PlatformConfig, be as PlatformSchema, bf as PolicyDocument, bg as PolicyDocumentSchema, bh as PolicyOperationalProfileSchema, bi as PremiumLine, bj as PremiumLineSchema, bk as PriorAnswer, bl as ProcessApplicationInput, bm as ProcessApplicationResult, bn as ProcessReplyInput, bo as ProcessReplyResult, bp as QuestionBatchResult, bq as QuestionBatchResultSchema, br as QuoteDocument, bs as QuoteDocumentSchema, bt as ReplyIntent, bu as ReplyIntentSchema, bv as ResolveModelBudgetParams, bw as Section, bx as SectionSchema, by as SourceBackedValue, bz as SourceBackedValueSchema, bA as SourceChunkSchema, bB as SourceKindSchema, bC as SourceSpanBBoxSchema, bD as SourceSpanKind, bE as SourceSpanKindSchema, bF as SourceSpanLocationSchema, bG as SourceSpanRef, bH as SourceSpanRefSchema, bI as SourceSpanSchema, bJ as SourceSpanTableLocationSchema, bK as SourceSpanUnitSchema, bL as Subjectivity, bM as SubjectivitySchema, bN as Subsection, bO as SubsectionSchema, bP as UnderwritingCondition, bQ as UnderwritingConditionSchema, bR as applyApplicationAnswers, bS as buildApplicationPacket, bT as buildQuestionGraphFromFields, bU as createApplicationPipeline, bV as createApplicationRun, bW as extractQuestionGraphFromFields, bX as flattenQuestionGraph, bY as getActiveApplicationFields, bZ as getNextApplicationQuestions, b_ as normalizeApplicationQuestionGraph, b$ as planNextApplicationQuestions, c0 as proposeContextWrites, c1 as resolveModelBudget, c2 as validateApplicationPacket } from './index-DhA-5jZy.js';
|
|
3
3
|
import * as zod from 'zod';
|
|
4
4
|
import { ZodTypeAny, z, ZodSchema } from 'zod';
|
|
5
5
|
import { PDFDocument } from 'pdf-lib';
|
|
@@ -1080,6 +1080,28 @@ declare const InsurerInfoSchema: z.ZodObject<{
|
|
|
1080
1080
|
amBestNumber: z.ZodOptional<z.ZodString>;
|
|
1081
1081
|
admittedStatus: z.ZodOptional<z.ZodEnum<["admitted", "non_admitted", "surplus_lines"]>>;
|
|
1082
1082
|
stateOfDomicile: z.ZodOptional<z.ZodString>;
|
|
1083
|
+
address: z.ZodOptional<z.ZodObject<{
|
|
1084
|
+
street1: z.ZodString;
|
|
1085
|
+
street2: z.ZodOptional<z.ZodString>;
|
|
1086
|
+
city: z.ZodString;
|
|
1087
|
+
state: z.ZodString;
|
|
1088
|
+
zip: z.ZodString;
|
|
1089
|
+
country: z.ZodOptional<z.ZodString>;
|
|
1090
|
+
}, "strip", z.ZodTypeAny, {
|
|
1091
|
+
street1: string;
|
|
1092
|
+
city: string;
|
|
1093
|
+
state: string;
|
|
1094
|
+
zip: string;
|
|
1095
|
+
street2?: string | undefined;
|
|
1096
|
+
country?: string | undefined;
|
|
1097
|
+
}, {
|
|
1098
|
+
street1: string;
|
|
1099
|
+
city: string;
|
|
1100
|
+
state: string;
|
|
1101
|
+
zip: string;
|
|
1102
|
+
street2?: string | undefined;
|
|
1103
|
+
country?: string | undefined;
|
|
1104
|
+
}>>;
|
|
1083
1105
|
} & {
|
|
1084
1106
|
sourceSpanIds: z.ZodArray<z.ZodString, "many">;
|
|
1085
1107
|
documentNodeId: z.ZodOptional<z.ZodString>;
|
|
@@ -1093,6 +1115,14 @@ declare const InsurerInfoSchema: z.ZodObject<{
|
|
|
1093
1115
|
sourceTextHash?: string | undefined;
|
|
1094
1116
|
pageStart?: number | undefined;
|
|
1095
1117
|
pageEnd?: number | undefined;
|
|
1118
|
+
address?: {
|
|
1119
|
+
street1: string;
|
|
1120
|
+
city: string;
|
|
1121
|
+
state: string;
|
|
1122
|
+
zip: string;
|
|
1123
|
+
street2?: string | undefined;
|
|
1124
|
+
country?: string | undefined;
|
|
1125
|
+
} | undefined;
|
|
1096
1126
|
naicNumber?: string | undefined;
|
|
1097
1127
|
amBestRating?: string | undefined;
|
|
1098
1128
|
amBestNumber?: string | undefined;
|
|
@@ -1105,6 +1135,14 @@ declare const InsurerInfoSchema: z.ZodObject<{
|
|
|
1105
1135
|
sourceTextHash?: string | undefined;
|
|
1106
1136
|
pageStart?: number | undefined;
|
|
1107
1137
|
pageEnd?: number | undefined;
|
|
1138
|
+
address?: {
|
|
1139
|
+
street1: string;
|
|
1140
|
+
city: string;
|
|
1141
|
+
state: string;
|
|
1142
|
+
zip: string;
|
|
1143
|
+
street2?: string | undefined;
|
|
1144
|
+
country?: string | undefined;
|
|
1145
|
+
} | undefined;
|
|
1108
1146
|
naicNumber?: string | undefined;
|
|
1109
1147
|
amBestRating?: string | undefined;
|
|
1110
1148
|
amBestNumber?: string | undefined;
|
package/dist/index.js
CHANGED
|
@@ -1451,7 +1451,8 @@ var InsurerInfoSchema = import_zod9.z.object({
|
|
|
1451
1451
|
amBestRating: import_zod9.z.string().optional(),
|
|
1452
1452
|
amBestNumber: import_zod9.z.string().optional(),
|
|
1453
1453
|
admittedStatus: AdmittedStatusSchema.optional(),
|
|
1454
|
-
stateOfDomicile: import_zod9.z.string().optional()
|
|
1454
|
+
stateOfDomicile: import_zod9.z.string().optional(),
|
|
1455
|
+
address: AddressSchema.optional()
|
|
1455
1456
|
}).merge(SourceProvenanceSchema);
|
|
1456
1457
|
var ProducerInfoSchema = import_zod9.z.object({
|
|
1457
1458
|
agencyName: import_zod9.z.string(),
|
|
@@ -2823,6 +2824,7 @@ var OperationalCoverageLineSchema = import_zod21.z.object({
|
|
|
2823
2824
|
var OperationalPartySchema = import_zod21.z.object({
|
|
2824
2825
|
role: import_zod21.z.string(),
|
|
2825
2826
|
name: import_zod21.z.string(),
|
|
2827
|
+
address: OperationalAddressSchema.optional(),
|
|
2826
2828
|
sourceNodeIds: import_zod21.z.array(import_zod21.z.string().min(1)).default([]),
|
|
2827
2829
|
sourceSpanIds: import_zod21.z.array(import_zod21.z.string().min(1)).default([])
|
|
2828
2830
|
});
|
|
@@ -2860,6 +2862,7 @@ var PolicyOperationalProfileSchema = import_zod21.z.preprocess(
|
|
|
2860
2862
|
expirationDate: SourceBackedValueSchema.optional(),
|
|
2861
2863
|
retroactiveDate: SourceBackedValueSchema.optional(),
|
|
2862
2864
|
premium: SourceBackedValueSchema.optional(),
|
|
2865
|
+
operationsDescription: SourceBackedValueSchema.optional(),
|
|
2863
2866
|
declarationFacts: import_zod21.z.array(OperationalDeclarationFactSchema).default([]),
|
|
2864
2867
|
coverages: import_zod21.z.array(OperationalCoverageLineSchema).default([]),
|
|
2865
2868
|
parties: import_zod21.z.array(OperationalPartySchema).default([]),
|
|
@@ -4238,6 +4241,34 @@ function cleanCoverageLineOfBusiness(value) {
|
|
|
4238
4241
|
function normalizedFactValue(value) {
|
|
4239
4242
|
return value.toLowerCase().replace(/&/g, " and ").replace(/[.,#]/g, " ").replace(/\s+/g, " ").trim();
|
|
4240
4243
|
}
|
|
4244
|
+
var OPERATIONAL_ADDRESS_FIELDS = [
|
|
4245
|
+
"street1",
|
|
4246
|
+
"street2",
|
|
4247
|
+
"city",
|
|
4248
|
+
"state",
|
|
4249
|
+
"zip",
|
|
4250
|
+
"country",
|
|
4251
|
+
"formatted"
|
|
4252
|
+
];
|
|
4253
|
+
function normalizeOperationalAddress(value) {
|
|
4254
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
|
|
4255
|
+
const record = value;
|
|
4256
|
+
const address = Object.fromEntries(
|
|
4257
|
+
OPERATIONAL_ADDRESS_FIELDS.flatMap((field) => {
|
|
4258
|
+
const cleaned = typeof record[field] === "string" ? cleanValue(record[field]) : void 0;
|
|
4259
|
+
return cleaned ? [[field, cleaned]] : [];
|
|
4260
|
+
})
|
|
4261
|
+
);
|
|
4262
|
+
return Object.keys(address).length > 0 ? address : void 0;
|
|
4263
|
+
}
|
|
4264
|
+
function normalizeOperationalPartyRole(value) {
|
|
4265
|
+
const normalized = value.toLowerCase().replace(/[\s-]+/g, "_");
|
|
4266
|
+
if (normalized === "namedinsured" || normalized === "insured") return "named_insured";
|
|
4267
|
+
if (normalized === "managing_general_agent") return "mga";
|
|
4268
|
+
if (normalized === "managing_general_underwriter") return "mga";
|
|
4269
|
+
if (normalized === "third_party_administrator") return "administrator";
|
|
4270
|
+
return normalized;
|
|
4271
|
+
}
|
|
4241
4272
|
var OPERATIONAL_COVERAGE_TERM_KINDS = /* @__PURE__ */ new Set([
|
|
4242
4273
|
"each_claim_limit",
|
|
4243
4274
|
"each_occurrence_limit",
|
|
@@ -4336,6 +4367,7 @@ function mergeOperationalProfile(base, candidate, validNodeIds, validSpanIds) {
|
|
|
4336
4367
|
const expirationDate = mergeValue(base.expirationDate, candidate.expirationDate);
|
|
4337
4368
|
const retroactiveDate = mergeValue(base.retroactiveDate, candidate.retroactiveDate);
|
|
4338
4369
|
const premium = mergeValue(base.premium, candidate.premium);
|
|
4370
|
+
const operationsDescription = mergeValue(base.operationsDescription, candidate.operationsDescription);
|
|
4339
4371
|
const candidateDeclarationFacts = Array.isArray(candidate.declarationFacts) ? candidate.declarationFacts.map(mergeDeclarationFact).filter((fact) => Boolean(fact)) : [];
|
|
4340
4372
|
const declarationFacts = [
|
|
4341
4373
|
...base.declarationFacts,
|
|
@@ -4360,7 +4392,8 @@ function mergeOperationalProfile(base, candidate, validNodeIds, validSpanIds) {
|
|
|
4360
4392
|
effectiveDate,
|
|
4361
4393
|
expirationDate,
|
|
4362
4394
|
retroactiveDate,
|
|
4363
|
-
premium
|
|
4395
|
+
premium,
|
|
4396
|
+
operationsDescription
|
|
4364
4397
|
].filter((value) => Boolean(value));
|
|
4365
4398
|
const coverages = base.coverages.length > 0 ? base.coverages : Array.isArray(candidate.coverages) ? candidate.coverages.map((coverage) => {
|
|
4366
4399
|
const record = coverage;
|
|
@@ -4419,14 +4452,21 @@ function mergeOperationalProfile(base, candidate, validNodeIds, validSpanIds) {
|
|
|
4419
4452
|
const record = party;
|
|
4420
4453
|
const role = typeof record.role === "string" ? cleanValue(record.role) : void 0;
|
|
4421
4454
|
const name = typeof record.name === "string" ? cleanValue(record.name) : void 0;
|
|
4455
|
+
const address = normalizeOperationalAddress(record.address);
|
|
4422
4456
|
const sourceNodeIds2 = keepIds(record.sourceNodeIds, validNodeIds);
|
|
4423
4457
|
const sourceSpanIds2 = keepIds(record.sourceSpanIds, validSpanIds);
|
|
4424
4458
|
if (!role || !name || sourceNodeIds2.length === 0 && sourceSpanIds2.length === 0) return [];
|
|
4425
|
-
return [{
|
|
4459
|
+
return [{
|
|
4460
|
+
role: normalizeOperationalPartyRole(role),
|
|
4461
|
+
name,
|
|
4462
|
+
address,
|
|
4463
|
+
sourceNodeIds: sourceNodeIds2,
|
|
4464
|
+
sourceSpanIds: sourceSpanIds2
|
|
4465
|
+
}];
|
|
4426
4466
|
}) : [];
|
|
4427
4467
|
const parties = [
|
|
4428
|
-
...base.parties,
|
|
4429
4468
|
...candidateParties,
|
|
4469
|
+
...base.parties,
|
|
4430
4470
|
sourceBackedParty("named_insured", namedInsured),
|
|
4431
4471
|
sourceBackedParty("insurer", insurer),
|
|
4432
4472
|
sourceBackedParty("broker", broker)
|
|
@@ -4500,6 +4540,7 @@ function mergeOperationalProfile(base, candidate, validNodeIds, validSpanIds) {
|
|
|
4500
4540
|
expirationDate,
|
|
4501
4541
|
retroactiveDate,
|
|
4502
4542
|
premium,
|
|
4543
|
+
operationsDescription,
|
|
4503
4544
|
declarationFacts,
|
|
4504
4545
|
coverages: annotatedCoverages,
|
|
4505
4546
|
parties,
|
|
@@ -4973,7 +5014,8 @@ function sourceIdsFromOperationalProfile(profile) {
|
|
|
4973
5014
|
profile.effectiveDate,
|
|
4974
5015
|
profile.expirationDate,
|
|
4975
5016
|
profile.retroactiveDate,
|
|
4976
|
-
profile.premium
|
|
5017
|
+
profile.premium,
|
|
5018
|
+
profile.operationsDescription
|
|
4977
5019
|
].filter(Boolean);
|
|
4978
5020
|
return {
|
|
4979
5021
|
sourceNodeIds: uniqueStrings([
|
|
@@ -5057,6 +5099,21 @@ var OperationalDeclarationFactForPromptSchema = import_zod23.z.object({
|
|
|
5057
5099
|
sourceNodeIds: import_zod23.z.array(import_zod23.z.string()),
|
|
5058
5100
|
sourceSpanIds: import_zod23.z.array(import_zod23.z.string())
|
|
5059
5101
|
});
|
|
5102
|
+
var OperationalPartyForPromptSchema = import_zod23.z.object({
|
|
5103
|
+
role: import_zod23.z.enum([
|
|
5104
|
+
"named_insured",
|
|
5105
|
+
"producer",
|
|
5106
|
+
"broker",
|
|
5107
|
+
"insurer",
|
|
5108
|
+
"carrier",
|
|
5109
|
+
"mga",
|
|
5110
|
+
"administrator"
|
|
5111
|
+
]),
|
|
5112
|
+
name: import_zod23.z.string(),
|
|
5113
|
+
address: OperationalAddressForPromptSchema.optional(),
|
|
5114
|
+
sourceNodeIds: import_zod23.z.array(import_zod23.z.string()),
|
|
5115
|
+
sourceSpanIds: import_zod23.z.array(import_zod23.z.string())
|
|
5116
|
+
});
|
|
5060
5117
|
var OperationalProfilePromptSchema = import_zod23.z.object({
|
|
5061
5118
|
documentType: import_zod23.z.enum(["policy", "quote"]).optional(),
|
|
5062
5119
|
linesOfBusiness: import_zod23.z.array(import_zod23.z.string()).optional(),
|
|
@@ -5068,7 +5125,9 @@ var OperationalProfilePromptSchema = import_zod23.z.object({
|
|
|
5068
5125
|
expirationDate: SourceBackedValueForPromptSchema.optional(),
|
|
5069
5126
|
retroactiveDate: SourceBackedValueForPromptSchema.optional(),
|
|
5070
5127
|
premium: SourceBackedValueForPromptSchema.optional(),
|
|
5128
|
+
operationsDescription: SourceBackedValueForPromptSchema.optional(),
|
|
5071
5129
|
declarationFacts: import_zod23.z.array(OperationalDeclarationFactForPromptSchema).optional(),
|
|
5130
|
+
parties: import_zod23.z.array(OperationalPartyForPromptSchema).optional(),
|
|
5072
5131
|
coverages: import_zod23.z.array(import_zod23.z.object({
|
|
5073
5132
|
name: import_zod23.z.string(),
|
|
5074
5133
|
lineOfBusiness: import_zod23.z.string().optional(),
|
|
@@ -5980,6 +6039,9 @@ function operationalEvidenceScore(span) {
|
|
|
5980
6039
|
if (span.metadata?.elementType === "title") score += 4;
|
|
5981
6040
|
if (span.sourceUnit === "page") score -= 3;
|
|
5982
6041
|
if (/\b(policy\s*(number|period|term)|effective date|expiration date|expiry date|named insured|insurer|carrier|security|broker|producer|premium|total due)\b/i.test(text)) score += 12;
|
|
6042
|
+
if (/\b(mailing address|business address|address|managing general (?:agent|underwriter)|mga|administrator|description of operations|operations description|nature of business|business description)\b/i.test(text)) score += 12;
|
|
6043
|
+
if (/\b\d{1,6}\s+[A-Z0-9][^\n,]{1,80}\b(?:street|st|avenue|ave|road|rd|boulevard|blvd|drive|dr|lane|ln|way|court|ct|highway|hwy)\b/i.test(text)) score += 10;
|
|
6044
|
+
if (/\b[A-Za-z][A-Za-z .'-]+,\s*[A-Z]{2}\s+\d{5}(?:-\d{4})?\b/.test(text)) score += 10;
|
|
5983
6045
|
if (/\b(coverage part|limit(?:s)? of liability|deductible|retention|retroactive date|aggregate|sublimit|sub-limit|each claim|each loss|each occurrence|coinsurance)\b/i.test(text)) score += 14;
|
|
5984
6046
|
if (/\bendorsement\s+(?:no\.?|number|#)?\s*[A-Z0-9]|forms? and endorsements?|attached at inception|schedule\b/i.test(text)) score += 8;
|
|
5985
6047
|
if (/\bitem\s+\d+\.?\s*(?:named insured|policy number|policy period|renewal|form of business|coverage parts?|premium|extended reporting|producer|forms? and endorsements?)\b/i.test(text)) score += 10;
|
|
@@ -5999,10 +6061,13 @@ function isOperationalEvidenceAnchor(span) {
|
|
|
5999
6061
|
const text = cleanText([span.text, span.formNumber].filter(Boolean).join(" "), "");
|
|
6000
6062
|
if (!text) return false;
|
|
6001
6063
|
if (sourceUnit3 === "page") {
|
|
6002
|
-
return hasSubstantiveDeclarationsScheduleText(text) || /\b(declarations?|named insured|policy number|policy period|effective date|expiration date|premium|total due|producer)\b/i.test(text);
|
|
6064
|
+
return hasSubstantiveDeclarationsScheduleText(text) || /\b(declarations?|named insured|policy number|policy period|effective date|expiration date|premium|total due|producer|mailing address|mga|administrator|description of operations|nature of business|business description)\b/i.test(text);
|
|
6003
6065
|
}
|
|
6004
6066
|
if (/\bitem\s+\d+\.?\s*(?:named insured|policy number|policy period|renewal|form of business|coverage parts?|premium|extended reporting|producer|forms? and endorsements?)\b/i.test(text)) return true;
|
|
6005
6067
|
if (/\b(policy\s*(number|period)|effective date|expiration date|expiry date|named insured|insurer|carrier|broker|producer|premium|total due)\b/i.test(text)) return true;
|
|
6068
|
+
if (/\b(mailing address|business address|address|managing general (?:agent|underwriter)|mga|administrator|description of operations|operations description|nature of business|business description)\b/i.test(text)) return true;
|
|
6069
|
+
if (/\b\d{1,6}\s+[A-Z0-9][^\n,]{1,80}\b(?:street|st|avenue|ave|road|rd|boulevard|blvd|drive|dr|lane|ln|way|court|ct|highway|hwy)\b/i.test(text)) return true;
|
|
6070
|
+
if (/\b[A-Za-z][A-Za-z .'-]+,\s*[A-Z]{2}\s+\d{5}(?:-\d{4})?\b/.test(text)) return true;
|
|
6006
6071
|
if (/\b(coverage part|forms? and endorsements?|attached at inception|endorsement\s+(?:no\.?|number|#)?\s*[A-Z0-9])\b/i.test(text)) return true;
|
|
6007
6072
|
if (/\$[\d,.]+|[0-9]{1,2}\/[0-9]{1,2}\/[0-9]{2,4}|[0-9]{1,2}\s+[A-Za-z]{3,9}\s+[0-9]{4}/.test(text)) return true;
|
|
6008
6073
|
return false;
|
|
@@ -6020,6 +6085,7 @@ function operationalEvidencePages(sourceSpans) {
|
|
|
6020
6085
|
if (/\bcoverage parts?,?\s+limits? of liability,?\s+deductibles?,?\s+and retroactive dates\b/i.test(text)) score += 24;
|
|
6021
6086
|
if (/\b(policy\s*(number|period|term)|effective date|expiration date|expiry date|named insured|insurer|carrier|security)\b/i.test(text)) score += 12;
|
|
6022
6087
|
if (/\b(premium|total due|tax|fee|producer|broker)\b/i.test(text)) score += 10;
|
|
6088
|
+
if (/\b(mailing address|business address|managing general (?:agent|underwriter)|mga|administrator|description of operations|operations description|nature of business|business description)\b/i.test(text)) score += 16;
|
|
6023
6089
|
if (/\b(endorsement\s+(?:no\.?|number|#)?\s*[A-Z0-9]|attached at inception|forms? and endorsements?)\b/i.test(text)) score += 8;
|
|
6024
6090
|
if (/\b(definitions?|exclusions?|conditions?|duties in the event|action against|cancellation by)\b/i.test(text)) score -= 12;
|
|
6025
6091
|
if (score > 0) scores.set(page, (scores.get(page) ?? 0) + score);
|
|
@@ -6094,7 +6160,7 @@ function operationalProfilePromptNodes(sourceTree) {
|
|
|
6094
6160
|
return true;
|
|
6095
6161
|
}
|
|
6096
6162
|
const text = [node.title, node.path, node.description, node.textExcerpt].filter(Boolean).join(" ");
|
|
6097
|
-
return /\b(policy\s*(number|period)|named insured|insurer|carrier|broker|producer|premium|coverage|limit|liability|deductible|retention|retroactive|aggregate|sublimit|sub-limit|endorsement)\b/i.test(text);
|
|
6163
|
+
return /\b(policy\s*(number|period)|named insured|insurer|carrier|broker|producer|managing general (?:agent|underwriter)|mga|administrator|mailing address|description of operations|operations description|nature of business|business description|premium|coverage|limit|liability|deductible|retention|retroactive|aggregate|sublimit|sub-limit|endorsement)\b/i.test(text);
|
|
6098
6164
|
}).slice(0, 420);
|
|
6099
6165
|
}
|
|
6100
6166
|
function emptyOperationalProfile() {
|
|
@@ -6118,7 +6184,8 @@ function buildOperationalProfilePrompt(sourceTree, sourceSpans) {
|
|
|
6118
6184
|
return `Extract a source-backed operational profile for an insurance policy.
|
|
6119
6185
|
|
|
6120
6186
|
Return only high-value operational facts needed for policy lists, Q&A, compliance, and certificate generation:
|
|
6121
|
-
- policy number, named insured, insurer/carrier/security, broker/producer, policy period, retroactive date, premium
|
|
6187
|
+
- policy number, named insured, insurer/carrier/security, broker/producer, policy period, retroactive date, premium, and the insured's description of operations
|
|
6188
|
+
- parties[] rows for named insured, producer/broker, insurer/carrier, and MGA/administrator identities and their mailing addresses
|
|
6122
6189
|
- source-backed declarationFacts for named-insured identity details: named insured, mailing address, DBA, entity type, tax ID/FEIN, additional named insureds, and other durable declaration-page identity facts
|
|
6123
6190
|
- coverage units with their own nested limit terms, deductibles/retentions, retroactive dates, premiums, and form references
|
|
6124
6191
|
- coverage type labels
|
|
@@ -6130,6 +6197,9 @@ Rules:
|
|
|
6130
6197
|
- If a value is not directly supported, omit it.
|
|
6131
6198
|
- Prefer declarations, schedules, premium tables, and endorsement schedules over generic policy wording.
|
|
6132
6199
|
- Put named-insured mailing address in declarationFacts[] with field "mailingAddress", valueKind "address", a user-facing value string, and structured address fields when present. Do not put producer, broker, insurer, mortgagee, loss-payee, or certificate-holder addresses in mailingAddress.
|
|
6200
|
+
- Put every source-backed policy party in parties[] using only these canonical roles: "named_insured", "producer", "broker", "insurer", "carrier", "mga", or "administrator". Keep producer/broker, insurer/carrier, and MGA/administrator addresses policy-scoped in parties[]; never represent them as the named-insured mailingAddress declaration fact.
|
|
6201
|
+
- When a party's address is present, return its available street1, street2, city, state, zip, country, and formatted parts under parties[].address. Partial addresses are allowed in parties[], but never guess a missing component. The party row must cite the source node or source span that supports both the identity and address.
|
|
6202
|
+
- Put the insured's directly stated business or operations description in operationsDescription. Do not synthesize it from coverages, industry inference, website research, or generic policy wording.
|
|
6133
6203
|
- Put DBA or trade name in declarationFacts[] with field "dba"; entity/legal form in field "entityType"; FEIN/tax ID in field "taxId"; each additional named insured in field "additionalNamedInsured".
|
|
6134
6204
|
- For effective, expiration, retroactive, and other date fields, return a normalized YYYY-MM-DD value when the source date is unambiguous, including month-name dates such as "20 Feb 2026". Do not emit fragmented date text such as "20 2 2026".
|
|
6135
6205
|
- For broker/producer, extract the agency or company legal name, not the license role, credential, or type. In a block like "Bayshore Insurance Brokers, LLC" followed by "Surplus Lines Broker - CA License No. ...", broker.value must be "Bayshore Insurance Brokers, LLC"; the surplus-lines role and license number are not the broker name.
|
|
@@ -6199,13 +6269,6 @@ function valueOf(profile, key) {
|
|
|
6199
6269
|
}
|
|
6200
6270
|
return String(value.value);
|
|
6201
6271
|
}
|
|
6202
|
-
function provenanceOf(value) {
|
|
6203
|
-
if (!value?.sourceSpanIds.length) return void 0;
|
|
6204
|
-
return {
|
|
6205
|
-
sourceSpanIds: value.sourceSpanIds,
|
|
6206
|
-
...value.sourceNodeIds[0] ? { documentNodeId: value.sourceNodeIds[0] } : {}
|
|
6207
|
-
};
|
|
6208
|
-
}
|
|
6209
6272
|
function provenanceFromIds(sourceSpanIds, sourceNodeIds) {
|
|
6210
6273
|
if (sourceSpanIds.length === 0) return void 0;
|
|
6211
6274
|
return {
|
|
@@ -6213,6 +6276,33 @@ function provenanceFromIds(sourceSpanIds, sourceNodeIds) {
|
|
|
6213
6276
|
...sourceNodeIds[0] ? { documentNodeId: sourceNodeIds[0] } : {}
|
|
6214
6277
|
};
|
|
6215
6278
|
}
|
|
6279
|
+
function combinedProvenance(...values) {
|
|
6280
|
+
const sourceSpanIds = [...new Set(values.flatMap((value) => value?.sourceSpanIds ?? []))];
|
|
6281
|
+
const sourceNodeIds = [...new Set(values.flatMap((value) => value?.sourceNodeIds ?? []))];
|
|
6282
|
+
return provenanceFromIds(sourceSpanIds, sourceNodeIds);
|
|
6283
|
+
}
|
|
6284
|
+
function firstOperationalParty(profile, roles) {
|
|
6285
|
+
const candidates = roles.flatMap(
|
|
6286
|
+
(role) => profile.parties.filter((candidate) => candidate.role === role && candidate.name.trim())
|
|
6287
|
+
);
|
|
6288
|
+
return candidates.find((candidate) => candidate.address) ?? candidates[0];
|
|
6289
|
+
}
|
|
6290
|
+
function completeOperationalAddress(address) {
|
|
6291
|
+
if (!address?.street1 || !address.city || !address.state || !address.zip) return void 0;
|
|
6292
|
+
return {
|
|
6293
|
+
street1: address.street1,
|
|
6294
|
+
street2: address.street2,
|
|
6295
|
+
city: address.city,
|
|
6296
|
+
state: address.state,
|
|
6297
|
+
zip: address.zip,
|
|
6298
|
+
country: address.country
|
|
6299
|
+
};
|
|
6300
|
+
}
|
|
6301
|
+
function sourceBackedAddressFromParty(party) {
|
|
6302
|
+
const address = completeOperationalAddress(party?.address);
|
|
6303
|
+
const provenance = party ? provenanceFromIds(party.sourceSpanIds, party.sourceNodeIds) : void 0;
|
|
6304
|
+
return address && provenance ? { ...address, ...provenance } : void 0;
|
|
6305
|
+
}
|
|
6216
6306
|
function declarationFactsByField(profile, field) {
|
|
6217
6307
|
return profile.declarationFacts.filter((fact) => fact.field === field && fact.value.trim());
|
|
6218
6308
|
}
|
|
@@ -6263,16 +6353,21 @@ function declarationFieldName(fact) {
|
|
|
6263
6353
|
function materializeDocument(params) {
|
|
6264
6354
|
const profile = params.operationalProfile;
|
|
6265
6355
|
const policyNumber = valueOf(profile, "policyNumber") ?? "Unknown";
|
|
6266
|
-
const
|
|
6267
|
-
const
|
|
6356
|
+
const namedInsuredParty = firstOperationalParty(profile, ["named_insured"]);
|
|
6357
|
+
const insurerParty = firstOperationalParty(profile, ["insurer", "carrier"]);
|
|
6358
|
+
const producerParty = firstOperationalParty(profile, ["producer", "broker"]);
|
|
6359
|
+
const insuredName = valueOf(profile, "namedInsured") ?? namedInsuredParty?.name ?? "Unknown";
|
|
6360
|
+
const carrier = valueOf(profile, "insurer") ?? insurerParty?.name ?? "Unknown";
|
|
6268
6361
|
const effectiveDate = valueOf(profile, "effectiveDate") ?? "Unknown";
|
|
6269
6362
|
const expirationDate = valueOf(profile, "expirationDate") ?? "Unknown";
|
|
6270
6363
|
const premium = valueOf(profile, "premium");
|
|
6271
|
-
const insurerProvenance =
|
|
6272
|
-
const
|
|
6273
|
-
const
|
|
6364
|
+
const insurerProvenance = combinedProvenance(profile.insurer, insurerParty);
|
|
6365
|
+
const insurerAddress = completeOperationalAddress(insurerParty?.address);
|
|
6366
|
+
const broker = valueOf(profile, "broker") ?? producerParty?.name;
|
|
6367
|
+
const brokerProvenance = combinedProvenance(profile.broker, producerParty);
|
|
6368
|
+
const producerAddress = completeOperationalAddress(producerParty?.address);
|
|
6274
6369
|
const mailingAddressFact = firstDeclarationFact(profile, "mailingAddress");
|
|
6275
|
-
const insuredAddress = sourceBackedAddressFromFact(mailingAddressFact);
|
|
6370
|
+
const insuredAddress = sourceBackedAddressFromParty(namedInsuredParty) ?? sourceBackedAddressFromFact(mailingAddressFact);
|
|
6276
6371
|
const insuredDba = firstDeclarationFact(profile, "dba")?.value;
|
|
6277
6372
|
const insuredEntityType = normalizedEntityType(firstDeclarationFact(profile, "entityType")?.value);
|
|
6278
6373
|
const insuredFein = firstDeclarationFact(profile, "taxId")?.value;
|
|
@@ -6336,10 +6431,20 @@ function materializeDocument(params) {
|
|
|
6336
6431
|
insuredEntityType,
|
|
6337
6432
|
insuredFein,
|
|
6338
6433
|
...additionalNamedInsureds.length > 0 ? { additionalNamedInsureds } : {},
|
|
6339
|
-
...insurerProvenance ? {
|
|
6434
|
+
...insurerProvenance ? {
|
|
6435
|
+
insurer: {
|
|
6436
|
+
legalName: carrier,
|
|
6437
|
+
...insurerAddress ? { address: insurerAddress } : {},
|
|
6438
|
+
...insurerProvenance
|
|
6439
|
+
}
|
|
6440
|
+
} : {},
|
|
6340
6441
|
...broker && brokerProvenance ? {
|
|
6341
6442
|
brokerAgency: broker,
|
|
6342
|
-
producer: {
|
|
6443
|
+
producer: {
|
|
6444
|
+
agencyName: broker,
|
|
6445
|
+
...producerAddress ? { address: producerAddress } : {},
|
|
6446
|
+
...brokerProvenance
|
|
6447
|
+
}
|
|
6343
6448
|
} : {},
|
|
6344
6449
|
linesOfBusiness: profile.linesOfBusiness,
|
|
6345
6450
|
formInventory: params.formInventory.filter((form) => typeof form.formNumber === "string" && form.formNumber.trim().length > 0).map((form) => ({
|