@claritylabs/cl-sdk 0.2.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/LICENSE +190 -0
- package/README.md +293 -0
- package/dist/index.d.mts +1384 -0
- package/dist/index.d.ts +1384 -0
- package/dist/index.js +2888 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2806 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +53 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1384 @@
|
|
|
1
|
+
import { LanguageModel } from 'ai';
|
|
2
|
+
import { ProviderOptions } from '@ai-sdk/provider-utils';
|
|
3
|
+
import { PDFDocument } from 'pdf-lib';
|
|
4
|
+
|
|
5
|
+
/** Commercial + Personal lines (42 values) */
|
|
6
|
+
type PolicyType = "general_liability" | "commercial_property" | "commercial_auto" | "non_owned_auto" | "workers_comp" | "umbrella" | "excess_liability" | "professional_liability" | "cyber" | "epli" | "directors_officers" | "fiduciary_liability" | "crime_fidelity" | "inland_marine" | "builders_risk" | "environmental" | "ocean_marine" | "surety" | "product_liability" | "bop" | "management_liability_package" | "property" | "homeowners_ho3" | "homeowners_ho5" | "renters_ho4" | "condo_ho6" | "dwelling_fire" | "mobile_home" | "personal_auto" | "personal_umbrella" | "flood_nfip" | "flood_private" | "earthquake" | "personal_inland_marine" | "watercraft" | "recreational_vehicle" | "farm_ranch" | "pet" | "travel" | "identity_theft" | "title" | "other";
|
|
7
|
+
/** All policy types as a runtime array for use in prompts */
|
|
8
|
+
declare const POLICY_TYPES: PolicyType[];
|
|
9
|
+
type EndorsementType = "additional_insured" | "waiver_of_subrogation" | "primary_noncontributory" | "blanket_additional_insured" | "loss_payee" | "mortgage_holder" | "broadening" | "restriction" | "exclusion" | "amendatory" | "notice_of_cancellation" | "designated_premises" | "classification_change" | "schedule_update" | "deductible_change" | "limit_change" | "territorial_extension" | "other";
|
|
10
|
+
type ConditionType = "duties_after_loss" | "notice_requirements" | "other_insurance" | "cancellation" | "nonrenewal" | "transfer_of_rights" | "liberalization" | "arbitration" | "concealment_fraud" | "examination_under_oath" | "legal_action" | "loss_payment" | "appraisal" | "mortgage_holders" | "policy_territory" | "separation_of_insureds" | "other";
|
|
11
|
+
type PolicySectionType = "declarations" | "insuring_agreement" | "policy_form" | "endorsement" | "application" | "exclusion" | "condition" | "definition" | "schedule" | "notice" | "regulatory" | "other";
|
|
12
|
+
type QuoteSectionType = "terms_summary" | "premium_indication" | "underwriting_condition" | "subjectivity" | "coverage_summary" | "exclusion" | "other";
|
|
13
|
+
type CoverageForm = "occurrence" | "claims_made" | "accident";
|
|
14
|
+
type PolicyTermType = "fixed" | "continuous";
|
|
15
|
+
type CoverageTrigger = "occurrence" | "claims_made" | "accident";
|
|
16
|
+
type LimitType = "per_occurrence" | "per_claim" | "aggregate" | "per_person" | "per_accident" | "statutory" | "blanket" | "scheduled";
|
|
17
|
+
type DeductibleType = "per_occurrence" | "per_claim" | "aggregate" | "percentage" | "waiting_period";
|
|
18
|
+
type ValuationMethod = "replacement_cost" | "actual_cash_value" | "agreed_value" | "functional_replacement";
|
|
19
|
+
type DefenseCostTreatment = "inside_limits" | "outside_limits" | "supplementary";
|
|
20
|
+
type EntityType = "corporation" | "llc" | "partnership" | "sole_proprietor" | "joint_venture" | "trust" | "nonprofit" | "municipality" | "individual" | "married_couple" | "other";
|
|
21
|
+
type AdmittedStatus = "admitted" | "non_admitted" | "surplus_lines";
|
|
22
|
+
type AuditType = "annual" | "semi_annual" | "quarterly" | "monthly" | "self" | "physical" | "none";
|
|
23
|
+
type EndorsementPartyRole = "additional_insured" | "loss_payee" | "mortgage_holder" | "certificate_holder" | "notice_recipient" | "other";
|
|
24
|
+
type ClaimStatus = "open" | "closed" | "reopened";
|
|
25
|
+
type SubjectivityCategory = "pre_binding" | "post_binding" | "information";
|
|
26
|
+
type DocumentType = "policy" | "quote" | "binder" | "endorsement" | "certificate";
|
|
27
|
+
type ChunkType = "declarations" | "coverage_form" | "endorsement" | "schedule" | "conditions" | "mixed";
|
|
28
|
+
type RatingBasisType = "payroll" | "revenue" | "area" | "units" | "vehicle_count" | "employee_count" | "per_capita" | "dwelling_value" | "vehicle_value" | "contents_value" | "other";
|
|
29
|
+
type VehicleCoverageType = "liability" | "collision" | "comprehensive" | "uninsured_motorist" | "underinsured_motorist" | "medical_payments" | "hired_auto" | "non_owned_auto" | "cargo" | "physical_damage";
|
|
30
|
+
type HomeownersFormType = "HO-3" | "HO-5" | "HO-4" | "HO-6" | "HO-7" | "HO-8";
|
|
31
|
+
type DwellingFireFormType = "DP-1" | "DP-2" | "DP-3";
|
|
32
|
+
type FloodZone = "A" | "AE" | "AH" | "AO" | "AR" | "V" | "VE" | "B" | "C" | "X" | "D";
|
|
33
|
+
type ConstructionType = "frame" | "masonry" | "superior" | "mixed" | "other";
|
|
34
|
+
type RoofType = "asphalt_shingle" | "tile" | "metal" | "slate" | "flat" | "wood_shake" | "other";
|
|
35
|
+
type FoundationType = "basement" | "crawl_space" | "slab" | "pier" | "other";
|
|
36
|
+
type PersonalAutoUsage = "pleasure" | "commute" | "business" | "farm";
|
|
37
|
+
type LossSettlement = "replacement_cost" | "actual_cash_value" | "extended_replacement_cost" | "guaranteed_replacement_cost";
|
|
38
|
+
type BoatType = "sailboat" | "powerboat" | "pontoon" | "jet_ski" | "kayak_canoe" | "yacht" | "other";
|
|
39
|
+
type RVType = "rv_motorhome" | "travel_trailer" | "atv" | "snowmobile" | "golf_cart" | "dirt_bike" | "other";
|
|
40
|
+
type ScheduledItemCategory = "jewelry" | "fine_art" | "musical_instruments" | "silverware" | "furs" | "cameras" | "collectibles" | "firearms" | "golf_equipment" | "other";
|
|
41
|
+
type TitlePolicyType = "owners" | "lenders";
|
|
42
|
+
type PetSpecies = "dog" | "cat" | "other";
|
|
43
|
+
|
|
44
|
+
interface Address {
|
|
45
|
+
street1: string;
|
|
46
|
+
street2?: string;
|
|
47
|
+
city: string;
|
|
48
|
+
state: string;
|
|
49
|
+
zip: string;
|
|
50
|
+
country?: string;
|
|
51
|
+
}
|
|
52
|
+
interface Contact {
|
|
53
|
+
name?: string;
|
|
54
|
+
title?: string;
|
|
55
|
+
type?: string;
|
|
56
|
+
phone?: string;
|
|
57
|
+
fax?: string;
|
|
58
|
+
email?: string;
|
|
59
|
+
address?: Address;
|
|
60
|
+
hours?: string;
|
|
61
|
+
}
|
|
62
|
+
interface FormReference {
|
|
63
|
+
formNumber: string;
|
|
64
|
+
editionDate?: string;
|
|
65
|
+
title?: string;
|
|
66
|
+
formType: "coverage" | "endorsement" | "declarations" | "application" | "notice" | "other";
|
|
67
|
+
}
|
|
68
|
+
interface TaxFeeItem {
|
|
69
|
+
name: string;
|
|
70
|
+
amount: string;
|
|
71
|
+
type?: "tax" | "fee" | "surcharge" | "assessment";
|
|
72
|
+
description?: string;
|
|
73
|
+
}
|
|
74
|
+
interface RatingBasis {
|
|
75
|
+
type: RatingBasisType;
|
|
76
|
+
amount?: string;
|
|
77
|
+
description?: string;
|
|
78
|
+
}
|
|
79
|
+
interface Sublimit {
|
|
80
|
+
name: string;
|
|
81
|
+
limit: string;
|
|
82
|
+
appliesTo?: string;
|
|
83
|
+
deductible?: string;
|
|
84
|
+
}
|
|
85
|
+
interface SharedLimit {
|
|
86
|
+
description: string;
|
|
87
|
+
limit: string;
|
|
88
|
+
coverageParts: string[];
|
|
89
|
+
}
|
|
90
|
+
interface ExtendedReportingPeriod {
|
|
91
|
+
basicDays?: number;
|
|
92
|
+
supplementalYears?: number;
|
|
93
|
+
supplementalPremium?: string;
|
|
94
|
+
}
|
|
95
|
+
interface NamedInsured {
|
|
96
|
+
name: string;
|
|
97
|
+
relationship?: string;
|
|
98
|
+
address?: Address;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
interface EnrichedCoverage {
|
|
102
|
+
name: string;
|
|
103
|
+
coverageCode?: string;
|
|
104
|
+
formNumber?: string;
|
|
105
|
+
formEditionDate?: string;
|
|
106
|
+
limit: string;
|
|
107
|
+
limitType?: LimitType;
|
|
108
|
+
deductible?: string;
|
|
109
|
+
deductibleType?: DeductibleType;
|
|
110
|
+
sir?: string;
|
|
111
|
+
sublimit?: string;
|
|
112
|
+
coinsurance?: string;
|
|
113
|
+
valuation?: ValuationMethod;
|
|
114
|
+
territory?: string;
|
|
115
|
+
trigger?: CoverageTrigger;
|
|
116
|
+
retroactiveDate?: string;
|
|
117
|
+
included: boolean;
|
|
118
|
+
premium?: string;
|
|
119
|
+
pageNumber?: number;
|
|
120
|
+
sectionRef?: string;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
interface EndorsementParty {
|
|
124
|
+
name: string;
|
|
125
|
+
role: EndorsementPartyRole;
|
|
126
|
+
address?: Address;
|
|
127
|
+
relationship?: string;
|
|
128
|
+
scope?: string;
|
|
129
|
+
}
|
|
130
|
+
interface Endorsement {
|
|
131
|
+
formNumber: string;
|
|
132
|
+
editionDate?: string;
|
|
133
|
+
title: string;
|
|
134
|
+
endorsementType: EndorsementType;
|
|
135
|
+
effectiveDate?: string;
|
|
136
|
+
affectedCoverageParts?: string[];
|
|
137
|
+
namedParties?: EndorsementParty[];
|
|
138
|
+
keyTerms?: string[];
|
|
139
|
+
premiumImpact?: string;
|
|
140
|
+
content: string;
|
|
141
|
+
pageStart: number;
|
|
142
|
+
pageEnd?: number;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
interface Exclusion {
|
|
146
|
+
name: string;
|
|
147
|
+
formNumber?: string;
|
|
148
|
+
excludedPerils?: string[];
|
|
149
|
+
isAbsolute?: boolean;
|
|
150
|
+
exceptions?: string[];
|
|
151
|
+
buybackAvailable?: boolean;
|
|
152
|
+
buybackEndorsement?: string;
|
|
153
|
+
appliesTo?: string[];
|
|
154
|
+
content: string;
|
|
155
|
+
pageNumber?: number;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
interface PolicyCondition {
|
|
159
|
+
name: string;
|
|
160
|
+
conditionType: ConditionType;
|
|
161
|
+
content: string;
|
|
162
|
+
keyValues?: Record<string, string>;
|
|
163
|
+
pageNumber?: number;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
interface EmployersLiabilityLimits {
|
|
167
|
+
eachAccident: string;
|
|
168
|
+
diseasePolicyLimit: string;
|
|
169
|
+
diseaseEachEmployee: string;
|
|
170
|
+
}
|
|
171
|
+
interface LimitSchedule {
|
|
172
|
+
perOccurrence?: string;
|
|
173
|
+
generalAggregate?: string;
|
|
174
|
+
productsCompletedOpsAggregate?: string;
|
|
175
|
+
personalAdvertisingInjury?: string;
|
|
176
|
+
eachEmployee?: string;
|
|
177
|
+
fireDamage?: string;
|
|
178
|
+
medicalExpense?: string;
|
|
179
|
+
combinedSingleLimit?: string;
|
|
180
|
+
bodilyInjuryPerPerson?: string;
|
|
181
|
+
bodilyInjuryPerAccident?: string;
|
|
182
|
+
propertyDamage?: string;
|
|
183
|
+
eachOccurrenceUmbrella?: string;
|
|
184
|
+
umbrellaAggregate?: string;
|
|
185
|
+
umbrellaRetention?: string;
|
|
186
|
+
statutory?: boolean;
|
|
187
|
+
employersLiability?: EmployersLiabilityLimits;
|
|
188
|
+
sublimits?: Sublimit[];
|
|
189
|
+
sharedLimits?: SharedLimit[];
|
|
190
|
+
defenseCostTreatment?: DefenseCostTreatment;
|
|
191
|
+
}
|
|
192
|
+
interface DeductibleSchedule {
|
|
193
|
+
perClaim?: string;
|
|
194
|
+
perOccurrence?: string;
|
|
195
|
+
aggregateDeductible?: string;
|
|
196
|
+
selfInsuredRetention?: string;
|
|
197
|
+
corridorDeductible?: string;
|
|
198
|
+
waitingPeriod?: string;
|
|
199
|
+
appliesTo?: "damages_only" | "damages_and_defense" | "defense_only";
|
|
200
|
+
}
|
|
201
|
+
interface InsuredLocation {
|
|
202
|
+
number: number;
|
|
203
|
+
address: Address;
|
|
204
|
+
description?: string;
|
|
205
|
+
buildingValue?: string;
|
|
206
|
+
contentsValue?: string;
|
|
207
|
+
businessIncomeValue?: string;
|
|
208
|
+
constructionType?: string;
|
|
209
|
+
yearBuilt?: number;
|
|
210
|
+
squareFootage?: number;
|
|
211
|
+
protectionClass?: string;
|
|
212
|
+
sprinklered?: boolean;
|
|
213
|
+
alarmType?: string;
|
|
214
|
+
occupancy?: string;
|
|
215
|
+
}
|
|
216
|
+
interface VehicleCoverage {
|
|
217
|
+
type: VehicleCoverageType;
|
|
218
|
+
limit?: string;
|
|
219
|
+
deductible?: string;
|
|
220
|
+
included: boolean;
|
|
221
|
+
}
|
|
222
|
+
interface InsuredVehicle {
|
|
223
|
+
number: number;
|
|
224
|
+
year: number;
|
|
225
|
+
make: string;
|
|
226
|
+
model: string;
|
|
227
|
+
vin: string;
|
|
228
|
+
costNew?: string;
|
|
229
|
+
statedValue?: string;
|
|
230
|
+
garageLocation?: number;
|
|
231
|
+
coverages?: VehicleCoverage[];
|
|
232
|
+
radius?: string;
|
|
233
|
+
vehicleType?: string;
|
|
234
|
+
}
|
|
235
|
+
interface ClassificationCode {
|
|
236
|
+
code: string;
|
|
237
|
+
description: string;
|
|
238
|
+
premiumBasis: string;
|
|
239
|
+
basisAmount?: string;
|
|
240
|
+
rate?: string;
|
|
241
|
+
premium?: string;
|
|
242
|
+
locationNumber?: number;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
interface HomeownersDeclarations {
|
|
246
|
+
line: "homeowners";
|
|
247
|
+
formType: HomeownersFormType;
|
|
248
|
+
coverageA?: string;
|
|
249
|
+
coverageB?: string;
|
|
250
|
+
coverageC?: string;
|
|
251
|
+
coverageD?: string;
|
|
252
|
+
coverageE?: string;
|
|
253
|
+
coverageF?: string;
|
|
254
|
+
allPerilDeductible?: string;
|
|
255
|
+
windHailDeductible?: string;
|
|
256
|
+
hurricaneDeductible?: string;
|
|
257
|
+
lossSettlement?: LossSettlement;
|
|
258
|
+
dwelling: DwellingDetails;
|
|
259
|
+
mortgagee?: EndorsementParty;
|
|
260
|
+
additionalMortgagees?: EndorsementParty[];
|
|
261
|
+
}
|
|
262
|
+
interface PersonalAutoDeclarations {
|
|
263
|
+
line: "personal_auto";
|
|
264
|
+
vehicles: PersonalVehicleDetails[];
|
|
265
|
+
drivers: DriverRecord[];
|
|
266
|
+
liabilityLimits?: {
|
|
267
|
+
bodilyInjuryPerPerson?: string;
|
|
268
|
+
bodilyInjuryPerAccident?: string;
|
|
269
|
+
propertyDamage?: string;
|
|
270
|
+
combinedSingleLimit?: string;
|
|
271
|
+
};
|
|
272
|
+
umLimits?: {
|
|
273
|
+
bodilyInjuryPerPerson?: string;
|
|
274
|
+
bodilyInjuryPerAccident?: string;
|
|
275
|
+
};
|
|
276
|
+
uimLimits?: {
|
|
277
|
+
bodilyInjuryPerPerson?: string;
|
|
278
|
+
bodilyInjuryPerAccident?: string;
|
|
279
|
+
};
|
|
280
|
+
pipLimit?: string;
|
|
281
|
+
medPayLimit?: string;
|
|
282
|
+
}
|
|
283
|
+
interface DwellingFireDeclarations {
|
|
284
|
+
line: "dwelling_fire";
|
|
285
|
+
formType: DwellingFireFormType;
|
|
286
|
+
dwellingLimit?: string;
|
|
287
|
+
otherStructuresLimit?: string;
|
|
288
|
+
personalPropertyLimit?: string;
|
|
289
|
+
fairRentalValueLimit?: string;
|
|
290
|
+
liabilityLimit?: string;
|
|
291
|
+
medicalPaymentsLimit?: string;
|
|
292
|
+
deductible?: string;
|
|
293
|
+
dwelling: DwellingDetails;
|
|
294
|
+
}
|
|
295
|
+
interface FloodDeclarations {
|
|
296
|
+
line: "flood";
|
|
297
|
+
programType: "nfip" | "private";
|
|
298
|
+
floodZone?: FloodZone;
|
|
299
|
+
communityNumber?: string;
|
|
300
|
+
communityRating?: number;
|
|
301
|
+
buildingCoverage?: string;
|
|
302
|
+
contentsCoverage?: string;
|
|
303
|
+
iccCoverage?: string;
|
|
304
|
+
deductible?: string;
|
|
305
|
+
waitingPeriodDays?: number;
|
|
306
|
+
elevationCertificate?: boolean;
|
|
307
|
+
elevationDifference?: string;
|
|
308
|
+
buildingDiagramNumber?: number;
|
|
309
|
+
basementOrEnclosure?: boolean;
|
|
310
|
+
postFirmConstruction?: boolean;
|
|
311
|
+
}
|
|
312
|
+
interface EarthquakeDeclarations {
|
|
313
|
+
line: "earthquake";
|
|
314
|
+
dwellingCoverage?: string;
|
|
315
|
+
contentsCoverage?: string;
|
|
316
|
+
lossOfUseCoverage?: string;
|
|
317
|
+
deductiblePercent?: number;
|
|
318
|
+
retrofitDiscount?: boolean;
|
|
319
|
+
masonryVeneerCoverage?: boolean;
|
|
320
|
+
}
|
|
321
|
+
interface PersonalUmbrellaDeclarations {
|
|
322
|
+
line: "personal_umbrella";
|
|
323
|
+
perOccurrenceLimit?: string;
|
|
324
|
+
aggregateLimit?: string;
|
|
325
|
+
retainedLimit?: string;
|
|
326
|
+
underlyingPolicies: Array<{
|
|
327
|
+
carrier?: string;
|
|
328
|
+
policyNumber?: string;
|
|
329
|
+
policyType?: string;
|
|
330
|
+
limits?: string;
|
|
331
|
+
}>;
|
|
332
|
+
}
|
|
333
|
+
interface PersonalArticlesDeclarations {
|
|
334
|
+
line: "personal_articles";
|
|
335
|
+
scheduledItems: Array<{
|
|
336
|
+
itemNumber?: number;
|
|
337
|
+
category?: ScheduledItemCategory;
|
|
338
|
+
description: string;
|
|
339
|
+
appraisedValue: string;
|
|
340
|
+
appraisalDate?: string;
|
|
341
|
+
}>;
|
|
342
|
+
blanketCoverage?: string;
|
|
343
|
+
deductible?: string;
|
|
344
|
+
worldwideCoverage?: boolean;
|
|
345
|
+
breakageCoverage?: boolean;
|
|
346
|
+
}
|
|
347
|
+
interface WatercraftDeclarations {
|
|
348
|
+
line: "watercraft";
|
|
349
|
+
boatType?: BoatType;
|
|
350
|
+
year?: number;
|
|
351
|
+
make?: string;
|
|
352
|
+
model?: string;
|
|
353
|
+
length?: string;
|
|
354
|
+
hullMaterial?: "fiberglass" | "aluminum" | "wood" | "steel" | "inflatable" | "other";
|
|
355
|
+
hullValue?: string;
|
|
356
|
+
motorHorsepower?: number;
|
|
357
|
+
motorType?: "outboard" | "inboard" | "inboard_outboard" | "jet";
|
|
358
|
+
navigationLimits?: string;
|
|
359
|
+
layupPeriod?: string;
|
|
360
|
+
liabilityLimit?: string;
|
|
361
|
+
medicalPaymentsLimit?: string;
|
|
362
|
+
physicalDamageDeductible?: string;
|
|
363
|
+
uninsuredBoaterLimit?: string;
|
|
364
|
+
trailerCovered?: boolean;
|
|
365
|
+
trailerValue?: string;
|
|
366
|
+
}
|
|
367
|
+
interface RecreationalVehicleDeclarations {
|
|
368
|
+
line: "recreational_vehicle";
|
|
369
|
+
vehicleType: RVType;
|
|
370
|
+
year?: number;
|
|
371
|
+
make?: string;
|
|
372
|
+
model?: string;
|
|
373
|
+
vin?: string;
|
|
374
|
+
value?: string;
|
|
375
|
+
liabilityLimit?: string;
|
|
376
|
+
collisionDeductible?: string;
|
|
377
|
+
comprehensiveDeductible?: string;
|
|
378
|
+
personalEffectsCoverage?: string;
|
|
379
|
+
fullTimerCoverage?: boolean;
|
|
380
|
+
}
|
|
381
|
+
interface FarmRanchDeclarations {
|
|
382
|
+
line: "farm_ranch";
|
|
383
|
+
dwellingCoverage?: string;
|
|
384
|
+
farmPersonalPropertyCoverage?: string;
|
|
385
|
+
farmLiabilityLimit?: string;
|
|
386
|
+
farmAutoIncluded?: boolean;
|
|
387
|
+
livestock?: Array<{
|
|
388
|
+
type: string;
|
|
389
|
+
headCount: number;
|
|
390
|
+
value?: string;
|
|
391
|
+
}>;
|
|
392
|
+
equipmentSchedule?: Array<{
|
|
393
|
+
description: string;
|
|
394
|
+
value: string;
|
|
395
|
+
}>;
|
|
396
|
+
acreage?: number;
|
|
397
|
+
dwelling?: DwellingDetails;
|
|
398
|
+
}
|
|
399
|
+
interface TitleDeclarations {
|
|
400
|
+
line: "title";
|
|
401
|
+
policyType: TitlePolicyType;
|
|
402
|
+
policyAmount: string;
|
|
403
|
+
legalDescription?: string;
|
|
404
|
+
propertyAddress?: Address;
|
|
405
|
+
effectiveDate?: string;
|
|
406
|
+
exceptions?: Array<{
|
|
407
|
+
number: number;
|
|
408
|
+
description: string;
|
|
409
|
+
}>;
|
|
410
|
+
underwriter?: string;
|
|
411
|
+
}
|
|
412
|
+
interface PetDeclarations {
|
|
413
|
+
line: "pet";
|
|
414
|
+
species: PetSpecies;
|
|
415
|
+
breed?: string;
|
|
416
|
+
petName?: string;
|
|
417
|
+
age?: number;
|
|
418
|
+
annualLimit?: string;
|
|
419
|
+
perIncidentLimit?: string;
|
|
420
|
+
deductible?: string;
|
|
421
|
+
reimbursementPercent?: number;
|
|
422
|
+
waitingPeriodDays?: number;
|
|
423
|
+
preExistingConditionsExcluded?: boolean;
|
|
424
|
+
wellnessCoverage?: boolean;
|
|
425
|
+
}
|
|
426
|
+
interface TravelDeclarations {
|
|
427
|
+
line: "travel";
|
|
428
|
+
tripDepartureDate?: string;
|
|
429
|
+
tripReturnDate?: string;
|
|
430
|
+
destinations?: string[];
|
|
431
|
+
travelers?: Array<{
|
|
432
|
+
name: string;
|
|
433
|
+
age?: number;
|
|
434
|
+
}>;
|
|
435
|
+
tripCost?: string;
|
|
436
|
+
tripCancellationLimit?: string;
|
|
437
|
+
medicalLimit?: string;
|
|
438
|
+
evacuationLimit?: string;
|
|
439
|
+
baggageLimit?: string;
|
|
440
|
+
}
|
|
441
|
+
interface IdentityTheftDeclarations {
|
|
442
|
+
line: "identity_theft";
|
|
443
|
+
coverageLimit?: string;
|
|
444
|
+
expenseReimbursement?: string;
|
|
445
|
+
creditMonitoring?: boolean;
|
|
446
|
+
restorationServices?: boolean;
|
|
447
|
+
lostWagesLimit?: string;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
interface ClaimRecord {
|
|
451
|
+
dateOfLoss: string;
|
|
452
|
+
claimNumber?: string;
|
|
453
|
+
description: string;
|
|
454
|
+
status: ClaimStatus;
|
|
455
|
+
paid?: string;
|
|
456
|
+
reserved?: string;
|
|
457
|
+
incurred?: string;
|
|
458
|
+
claimant?: string;
|
|
459
|
+
coverageLine?: string;
|
|
460
|
+
}
|
|
461
|
+
interface LossSummary {
|
|
462
|
+
period?: string;
|
|
463
|
+
totalClaims?: number;
|
|
464
|
+
totalIncurred?: string;
|
|
465
|
+
totalPaid?: string;
|
|
466
|
+
totalReserved?: string;
|
|
467
|
+
lossRatio?: string;
|
|
468
|
+
}
|
|
469
|
+
interface ExperienceMod {
|
|
470
|
+
factor: number;
|
|
471
|
+
effectiveDate?: string;
|
|
472
|
+
state?: string;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
interface GLDeclarations {
|
|
476
|
+
line: "gl";
|
|
477
|
+
coverageForm?: CoverageForm;
|
|
478
|
+
perOccurrenceLimit?: string;
|
|
479
|
+
generalAggregate?: string;
|
|
480
|
+
productsCompletedOpsAggregate?: string;
|
|
481
|
+
personalAdvertisingInjury?: string;
|
|
482
|
+
fireDamage?: string;
|
|
483
|
+
medicalExpense?: string;
|
|
484
|
+
defenseCostTreatment?: DefenseCostTreatment;
|
|
485
|
+
deductible?: string;
|
|
486
|
+
classifications?: ClassificationCode[];
|
|
487
|
+
retroactiveDate?: string;
|
|
488
|
+
}
|
|
489
|
+
interface CommercialPropertyDeclarations {
|
|
490
|
+
line: "commercial_property";
|
|
491
|
+
causesOfLossForm?: "basic" | "broad" | "special";
|
|
492
|
+
coinsurancePercent?: number;
|
|
493
|
+
valuationMethod?: ValuationMethod;
|
|
494
|
+
locations: InsuredLocation[];
|
|
495
|
+
blanketLimit?: string;
|
|
496
|
+
businessIncomeLimit?: string;
|
|
497
|
+
extraExpenseLimit?: string;
|
|
498
|
+
}
|
|
499
|
+
interface CommercialAutoDeclarations {
|
|
500
|
+
line: "commercial_auto";
|
|
501
|
+
vehicles: InsuredVehicle[];
|
|
502
|
+
coveredAutoSymbols?: number[];
|
|
503
|
+
liabilityLimit?: string;
|
|
504
|
+
umLimit?: string;
|
|
505
|
+
uimLimit?: string;
|
|
506
|
+
hiredAutoLiability?: boolean;
|
|
507
|
+
nonOwnedAutoLiability?: boolean;
|
|
508
|
+
}
|
|
509
|
+
interface WorkersCompDeclarations {
|
|
510
|
+
line: "workers_comp";
|
|
511
|
+
coveredStates?: string[];
|
|
512
|
+
classifications: ClassificationCode[];
|
|
513
|
+
experienceMod?: ExperienceMod;
|
|
514
|
+
employersLiability?: EmployersLiabilityLimits;
|
|
515
|
+
}
|
|
516
|
+
interface UmbrellaExcessDeclarations {
|
|
517
|
+
line: "umbrella_excess";
|
|
518
|
+
perOccurrenceLimit?: string;
|
|
519
|
+
aggregateLimit?: string;
|
|
520
|
+
retention?: string;
|
|
521
|
+
underlyingPolicies: Array<{
|
|
522
|
+
carrier?: string;
|
|
523
|
+
policyNumber?: string;
|
|
524
|
+
policyType?: string;
|
|
525
|
+
limits?: string;
|
|
526
|
+
}>;
|
|
527
|
+
}
|
|
528
|
+
interface ProfessionalLiabilityDeclarations {
|
|
529
|
+
line: "professional_liability";
|
|
530
|
+
perClaimLimit?: string;
|
|
531
|
+
aggregateLimit?: string;
|
|
532
|
+
retroactiveDate?: string;
|
|
533
|
+
defenseCostTreatment?: DefenseCostTreatment;
|
|
534
|
+
extendedReportingPeriod?: ExtendedReportingPeriod;
|
|
535
|
+
}
|
|
536
|
+
interface CyberDeclarations {
|
|
537
|
+
line: "cyber";
|
|
538
|
+
aggregateLimit?: string;
|
|
539
|
+
retroactiveDate?: string;
|
|
540
|
+
waitingPeriodHours?: number;
|
|
541
|
+
sublimits?: Array<{
|
|
542
|
+
coverageName: string;
|
|
543
|
+
limit: string;
|
|
544
|
+
}>;
|
|
545
|
+
}
|
|
546
|
+
interface DODeclarations {
|
|
547
|
+
line: "directors_officers";
|
|
548
|
+
sideALimit?: string;
|
|
549
|
+
sideBLimit?: string;
|
|
550
|
+
sideCLimit?: string;
|
|
551
|
+
sideARetention?: string;
|
|
552
|
+
sideBRetention?: string;
|
|
553
|
+
sideCRetention?: string;
|
|
554
|
+
continuityDate?: string;
|
|
555
|
+
}
|
|
556
|
+
interface CrimeDeclarations {
|
|
557
|
+
line: "crime";
|
|
558
|
+
formType?: "discovery" | "loss_sustained";
|
|
559
|
+
agreements: Array<{
|
|
560
|
+
agreement: string;
|
|
561
|
+
coverageName: string;
|
|
562
|
+
limit: string;
|
|
563
|
+
deductible: string;
|
|
564
|
+
}>;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
/** Residential dwelling details — shared by homeowners, dwelling fire, farm/ranch */
|
|
568
|
+
interface DwellingDetails {
|
|
569
|
+
constructionType?: ConstructionType;
|
|
570
|
+
yearBuilt?: number;
|
|
571
|
+
squareFootage?: number;
|
|
572
|
+
stories?: number;
|
|
573
|
+
roofType?: RoofType;
|
|
574
|
+
roofAge?: number;
|
|
575
|
+
heatingType?: "central" | "baseboard" | "radiant" | "space_heater" | "heat_pump" | "other";
|
|
576
|
+
foundationType?: FoundationType;
|
|
577
|
+
plumbingType?: "copper" | "pex" | "galvanized" | "polybutylene" | "cpvc" | "other";
|
|
578
|
+
electricalType?: "circuit_breaker" | "fuse_box" | "knob_and_tube" | "other";
|
|
579
|
+
electricalAmps?: number;
|
|
580
|
+
hasSwimmingPool?: boolean;
|
|
581
|
+
poolType?: "in_ground" | "above_ground";
|
|
582
|
+
hasTrampoline?: boolean;
|
|
583
|
+
hasDog?: boolean;
|
|
584
|
+
dogBreed?: string;
|
|
585
|
+
protectiveDevices?: string[];
|
|
586
|
+
distanceToFireStation?: string;
|
|
587
|
+
distanceToHydrant?: string;
|
|
588
|
+
fireProtectionClass?: string;
|
|
589
|
+
}
|
|
590
|
+
/** Personal auto driver record */
|
|
591
|
+
interface DriverRecord {
|
|
592
|
+
name: string;
|
|
593
|
+
dateOfBirth?: string;
|
|
594
|
+
licenseNumber?: string;
|
|
595
|
+
licenseState?: string;
|
|
596
|
+
relationship?: "named_insured" | "spouse" | "child" | "other_household" | "other";
|
|
597
|
+
yearsLicensed?: number;
|
|
598
|
+
gender?: string;
|
|
599
|
+
maritalStatus?: string;
|
|
600
|
+
goodStudentDiscount?: boolean;
|
|
601
|
+
defensiveDriverDiscount?: boolean;
|
|
602
|
+
violations?: Array<{
|
|
603
|
+
date?: string;
|
|
604
|
+
type?: string;
|
|
605
|
+
description?: string;
|
|
606
|
+
}>;
|
|
607
|
+
accidents?: Array<{
|
|
608
|
+
date?: string;
|
|
609
|
+
atFault?: boolean;
|
|
610
|
+
description?: string;
|
|
611
|
+
amountPaid?: string;
|
|
612
|
+
}>;
|
|
613
|
+
sr22Required?: boolean;
|
|
614
|
+
}
|
|
615
|
+
/** Personal auto vehicle details */
|
|
616
|
+
interface PersonalVehicleDetails {
|
|
617
|
+
number?: number;
|
|
618
|
+
year?: number;
|
|
619
|
+
make?: string;
|
|
620
|
+
model?: string;
|
|
621
|
+
vin?: string;
|
|
622
|
+
bodyType?: string;
|
|
623
|
+
garagingAddress?: Address;
|
|
624
|
+
usage?: PersonalAutoUsage;
|
|
625
|
+
annualMileage?: number;
|
|
626
|
+
odometerReading?: number;
|
|
627
|
+
driverAssignment?: string;
|
|
628
|
+
lienHolder?: EndorsementParty;
|
|
629
|
+
collisionDeductible?: string;
|
|
630
|
+
comprehensiveDeductible?: string;
|
|
631
|
+
rentalReimbursement?: boolean;
|
|
632
|
+
towing?: boolean;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
/** Discriminated union of all line-specific declarations variants */
|
|
636
|
+
type Declarations = HomeownersDeclarations | PersonalAutoDeclarations | DwellingFireDeclarations | FloodDeclarations | EarthquakeDeclarations | PersonalUmbrellaDeclarations | PersonalArticlesDeclarations | WatercraftDeclarations | RecreationalVehicleDeclarations | FarmRanchDeclarations | TitleDeclarations | PetDeclarations | TravelDeclarations | IdentityTheftDeclarations | GLDeclarations | CommercialPropertyDeclarations | CommercialAutoDeclarations | WorkersCompDeclarations | UmbrellaExcessDeclarations | ProfessionalLiabilityDeclarations | CyberDeclarations | DODeclarations | CrimeDeclarations;
|
|
637
|
+
|
|
638
|
+
interface InsurerInfo {
|
|
639
|
+
legalName: string;
|
|
640
|
+
naicNumber?: string;
|
|
641
|
+
amBestRating?: string;
|
|
642
|
+
amBestNumber?: string;
|
|
643
|
+
admittedStatus?: AdmittedStatus;
|
|
644
|
+
stateOfDomicile?: string;
|
|
645
|
+
}
|
|
646
|
+
interface ProducerInfo {
|
|
647
|
+
agencyName: string;
|
|
648
|
+
contactName?: string;
|
|
649
|
+
licenseNumber?: string;
|
|
650
|
+
phone?: string;
|
|
651
|
+
email?: string;
|
|
652
|
+
address?: Address;
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
interface PaymentInstallment {
|
|
656
|
+
dueDate: string;
|
|
657
|
+
amount: string;
|
|
658
|
+
description?: string;
|
|
659
|
+
}
|
|
660
|
+
interface PaymentPlan {
|
|
661
|
+
installments: PaymentInstallment[];
|
|
662
|
+
financeCharge?: string;
|
|
663
|
+
}
|
|
664
|
+
interface LocationPremium {
|
|
665
|
+
locationNumber: number;
|
|
666
|
+
premium: string;
|
|
667
|
+
description?: string;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
interface EnrichedSubjectivity {
|
|
671
|
+
description: string;
|
|
672
|
+
category?: SubjectivityCategory;
|
|
673
|
+
dueDate?: string;
|
|
674
|
+
status?: "open" | "satisfied" | "waived";
|
|
675
|
+
pageNumber?: number;
|
|
676
|
+
}
|
|
677
|
+
interface EnrichedUnderwritingCondition {
|
|
678
|
+
description: string;
|
|
679
|
+
category?: string;
|
|
680
|
+
pageNumber?: number;
|
|
681
|
+
}
|
|
682
|
+
interface BindingAuthority {
|
|
683
|
+
authorizedBy?: string;
|
|
684
|
+
method?: string;
|
|
685
|
+
expiration?: string;
|
|
686
|
+
conditions?: string[];
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
interface Coverage {
|
|
690
|
+
name: string;
|
|
691
|
+
limit: string;
|
|
692
|
+
deductible?: string;
|
|
693
|
+
pageNumber?: number;
|
|
694
|
+
sectionRef?: string;
|
|
695
|
+
}
|
|
696
|
+
interface Subsection {
|
|
697
|
+
title: string;
|
|
698
|
+
sectionNumber?: string;
|
|
699
|
+
pageNumber?: number;
|
|
700
|
+
content: string;
|
|
701
|
+
}
|
|
702
|
+
interface Section {
|
|
703
|
+
title: string;
|
|
704
|
+
sectionNumber?: string;
|
|
705
|
+
pageStart: number;
|
|
706
|
+
pageEnd?: number;
|
|
707
|
+
type: string;
|
|
708
|
+
coverageType?: string;
|
|
709
|
+
content: string;
|
|
710
|
+
subsections?: Subsection[];
|
|
711
|
+
}
|
|
712
|
+
interface Subjectivity {
|
|
713
|
+
description: string;
|
|
714
|
+
category?: string;
|
|
715
|
+
}
|
|
716
|
+
interface UnderwritingCondition {
|
|
717
|
+
description: string;
|
|
718
|
+
}
|
|
719
|
+
interface PremiumLine {
|
|
720
|
+
line: string;
|
|
721
|
+
amount: string;
|
|
722
|
+
}
|
|
723
|
+
interface BaseDocument {
|
|
724
|
+
id: string;
|
|
725
|
+
type: "policy" | "quote";
|
|
726
|
+
carrier: string;
|
|
727
|
+
security?: string;
|
|
728
|
+
insuredName: string;
|
|
729
|
+
premium?: string;
|
|
730
|
+
summary?: string;
|
|
731
|
+
policyTypes?: string[];
|
|
732
|
+
coverages: Coverage[];
|
|
733
|
+
sections?: Section[];
|
|
734
|
+
/** Legal name of insurance carrier */
|
|
735
|
+
carrierLegalName?: string;
|
|
736
|
+
/** NAIC company code */
|
|
737
|
+
carrierNaicNumber?: string;
|
|
738
|
+
/** AM Best financial strength rating */
|
|
739
|
+
carrierAmBestRating?: string;
|
|
740
|
+
/** Admitted / non-admitted / surplus lines */
|
|
741
|
+
carrierAdmittedStatus?: string;
|
|
742
|
+
/** Managing General Agent */
|
|
743
|
+
mga?: string;
|
|
744
|
+
/** Named underwriter */
|
|
745
|
+
underwriter?: string;
|
|
746
|
+
/** Broker/producer agency name */
|
|
747
|
+
brokerAgency?: string;
|
|
748
|
+
/** Individual producer name */
|
|
749
|
+
brokerContactName?: string;
|
|
750
|
+
/** Producer license number */
|
|
751
|
+
brokerLicenseNumber?: string;
|
|
752
|
+
/** Prior policy number (if renewal) */
|
|
753
|
+
priorPolicyNumber?: string;
|
|
754
|
+
/** Named program */
|
|
755
|
+
programName?: string;
|
|
756
|
+
/** Whether this is a renewal */
|
|
757
|
+
isRenewal?: boolean;
|
|
758
|
+
/** Whether this is a commercial package policy */
|
|
759
|
+
isPackage?: boolean;
|
|
760
|
+
/** Primary insured DBA name */
|
|
761
|
+
insuredDba?: string;
|
|
762
|
+
/** Primary insured mailing address */
|
|
763
|
+
insuredAddress?: Address;
|
|
764
|
+
/** Legal entity type */
|
|
765
|
+
insuredEntityType?: EntityType;
|
|
766
|
+
/** Additional named insureds */
|
|
767
|
+
additionalNamedInsureds?: NamedInsured[];
|
|
768
|
+
/** SIC code */
|
|
769
|
+
insuredSicCode?: string;
|
|
770
|
+
/** NAICS code */
|
|
771
|
+
insuredNaicsCode?: string;
|
|
772
|
+
/** Federal Employer ID Number */
|
|
773
|
+
insuredFein?: string;
|
|
774
|
+
/** Enriched coverage details */
|
|
775
|
+
enrichedCoverages?: EnrichedCoverage[];
|
|
776
|
+
/** Structured endorsements */
|
|
777
|
+
endorsements?: Endorsement[];
|
|
778
|
+
/** Structured exclusions */
|
|
779
|
+
exclusions?: Exclusion[];
|
|
780
|
+
/** Structured conditions */
|
|
781
|
+
conditions?: PolicyCondition[];
|
|
782
|
+
/** @deprecated Use declarations instead. Structured limits schedule */
|
|
783
|
+
limits?: LimitSchedule;
|
|
784
|
+
/** @deprecated Use declarations instead. Structured deductible schedule */
|
|
785
|
+
deductibles?: DeductibleSchedule;
|
|
786
|
+
/** @deprecated Use declarations instead. Insured locations/premises */
|
|
787
|
+
locations?: InsuredLocation[];
|
|
788
|
+
/** @deprecated Use declarations instead. Insured vehicles */
|
|
789
|
+
vehicles?: InsuredVehicle[];
|
|
790
|
+
/** @deprecated Use declarations instead. Rating classification codes */
|
|
791
|
+
classifications?: ClassificationCode[];
|
|
792
|
+
/** All form numbers in the policy */
|
|
793
|
+
formInventory?: FormReference[];
|
|
794
|
+
/** Typed declarations union — line-specific structured data */
|
|
795
|
+
declarations?: Declarations;
|
|
796
|
+
/** Coverage trigger type */
|
|
797
|
+
coverageForm?: CoverageForm;
|
|
798
|
+
/** Retroactive date (claims-made) */
|
|
799
|
+
retroactiveDate?: string;
|
|
800
|
+
/** Extended reporting period options */
|
|
801
|
+
extendedReportingPeriod?: ExtendedReportingPeriod;
|
|
802
|
+
/** Full insurer entity details */
|
|
803
|
+
insurer?: InsurerInfo;
|
|
804
|
+
/** Producer/broker details */
|
|
805
|
+
producer?: ProducerInfo;
|
|
806
|
+
/** Claims contact information */
|
|
807
|
+
claimsContacts?: Contact[];
|
|
808
|
+
/** Regulatory contacts */
|
|
809
|
+
regulatoryContacts?: Contact[];
|
|
810
|
+
/** Third-party administrators */
|
|
811
|
+
thirdPartyAdministrators?: Contact[];
|
|
812
|
+
/** All additional insureds across endorsements */
|
|
813
|
+
additionalInsureds?: EndorsementParty[];
|
|
814
|
+
/** All loss payees across endorsements */
|
|
815
|
+
lossPayees?: EndorsementParty[];
|
|
816
|
+
/** All mortgage holders across endorsements */
|
|
817
|
+
mortgageHolders?: EndorsementParty[];
|
|
818
|
+
/** Taxes and fees breakdown */
|
|
819
|
+
taxesAndFees?: TaxFeeItem[];
|
|
820
|
+
/** Total cost (premium + taxes + fees) */
|
|
821
|
+
totalCost?: string;
|
|
822
|
+
/** Minimum earned premium */
|
|
823
|
+
minimumPremium?: string;
|
|
824
|
+
/** Deposit premium */
|
|
825
|
+
depositPremium?: string;
|
|
826
|
+
/** Payment plan */
|
|
827
|
+
paymentPlan?: PaymentPlan;
|
|
828
|
+
/** Premium audit type */
|
|
829
|
+
auditType?: AuditType;
|
|
830
|
+
/** Rating basis */
|
|
831
|
+
ratingBasis?: RatingBasis[];
|
|
832
|
+
/** Premium allocated by location */
|
|
833
|
+
premiumByLocation?: LocationPremium[];
|
|
834
|
+
/** Loss history summary */
|
|
835
|
+
lossSummary?: LossSummary;
|
|
836
|
+
/** Individual claim records */
|
|
837
|
+
individualClaims?: ClaimRecord[];
|
|
838
|
+
/** Experience modification factor (WC) */
|
|
839
|
+
experienceMod?: ExperienceMod;
|
|
840
|
+
/** Cancellation notice days */
|
|
841
|
+
cancellationNoticeDays?: number;
|
|
842
|
+
/** Nonrenewal notice days */
|
|
843
|
+
nonrenewalNoticeDays?: number;
|
|
844
|
+
}
|
|
845
|
+
interface PolicyDocument extends BaseDocument {
|
|
846
|
+
type: "policy";
|
|
847
|
+
policyNumber: string;
|
|
848
|
+
effectiveDate: string;
|
|
849
|
+
/** Expiration date — absent for continuous ("until cancelled") policies */
|
|
850
|
+
expirationDate?: string;
|
|
851
|
+
/** "fixed" = standard term policy, "continuous" = until cancelled or replaced */
|
|
852
|
+
policyTermType?: PolicyTermType;
|
|
853
|
+
/** Next annual review/renewal date (primarily for continuous policies) */
|
|
854
|
+
nextReviewDate?: string;
|
|
855
|
+
/** Time of day coverage begins */
|
|
856
|
+
effectiveTime?: string;
|
|
857
|
+
}
|
|
858
|
+
interface QuoteDocument extends BaseDocument {
|
|
859
|
+
type: "quote";
|
|
860
|
+
quoteNumber: string;
|
|
861
|
+
proposedEffectiveDate?: string;
|
|
862
|
+
proposedExpirationDate?: string;
|
|
863
|
+
quoteExpirationDate?: string;
|
|
864
|
+
subjectivities?: Subjectivity[];
|
|
865
|
+
underwritingConditions?: UnderwritingCondition[];
|
|
866
|
+
premiumBreakdown?: PremiumLine[];
|
|
867
|
+
/** Enriched subjectivities with category, due date, status */
|
|
868
|
+
enrichedSubjectivities?: EnrichedSubjectivity[];
|
|
869
|
+
/** Enriched underwriting conditions */
|
|
870
|
+
enrichedUnderwritingConditions?: EnrichedUnderwritingCondition[];
|
|
871
|
+
/** Warranty requirements */
|
|
872
|
+
warrantyRequirements?: string[];
|
|
873
|
+
/** Loss control recommendations */
|
|
874
|
+
lossControlRecommendations?: string[];
|
|
875
|
+
/** Binding authority details */
|
|
876
|
+
bindingAuthority?: BindingAuthority;
|
|
877
|
+
}
|
|
878
|
+
type InsuranceDocument = PolicyDocument | QuoteDocument;
|
|
879
|
+
|
|
880
|
+
interface ContextKeyMapping {
|
|
881
|
+
extractedField: string;
|
|
882
|
+
category: "company_info" | "operations" | "financial" | "coverage" | "loss_history" | "premises" | "vehicles" | "employees" | "property_info" | "driver_info" | "vehicle_info" | "pet_info";
|
|
883
|
+
contextKey: string;
|
|
884
|
+
description: string;
|
|
885
|
+
}
|
|
886
|
+
declare const CONTEXT_KEY_MAP: ContextKeyMapping[];
|
|
887
|
+
|
|
888
|
+
type Platform = "email" | "chat" | "sms" | "slack" | "discord";
|
|
889
|
+
type CommunicationIntent = "direct" | "mediated" | "observed";
|
|
890
|
+
interface PlatformConfig {
|
|
891
|
+
supportsMarkdown: boolean;
|
|
892
|
+
supportsLinks: boolean;
|
|
893
|
+
supportsRichFormatting: boolean;
|
|
894
|
+
maxResponseLength?: number;
|
|
895
|
+
signOff?: boolean;
|
|
896
|
+
}
|
|
897
|
+
declare const PLATFORM_CONFIGS: Record<Platform, PlatformConfig>;
|
|
898
|
+
interface AgentContext {
|
|
899
|
+
platform: Platform;
|
|
900
|
+
intent: CommunicationIntent;
|
|
901
|
+
platformConfig?: PlatformConfig;
|
|
902
|
+
companyName?: string;
|
|
903
|
+
companyContext?: string;
|
|
904
|
+
siteUrl: string;
|
|
905
|
+
userName?: string;
|
|
906
|
+
coiHandling?: "broker" | "user" | "member" | "ignore";
|
|
907
|
+
brokerName?: string;
|
|
908
|
+
brokerContactName?: string;
|
|
909
|
+
brokerContactEmail?: string;
|
|
910
|
+
/** Display name for the AI agent. Defaults to "CL-0 Agent" if not set. */
|
|
911
|
+
agentName?: string;
|
|
912
|
+
/** Custom link guidance for the AI. Replaces the default policy/quote link examples.
|
|
913
|
+
* Should include markdown link examples showing the AI how to format document links.
|
|
914
|
+
* Only used when the platform supports links and intent is "direct". */
|
|
915
|
+
linkGuidance?: string;
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
interface ModelConfig {
|
|
919
|
+
/** Pass 0: document type classification (fast, cheap model) */
|
|
920
|
+
classification: LanguageModel;
|
|
921
|
+
/** Pass 1: metadata extraction (capable model) */
|
|
922
|
+
metadata: LanguageModel;
|
|
923
|
+
/** Pass 2: chunked section extraction (fast, cheap model) */
|
|
924
|
+
sections: LanguageModel;
|
|
925
|
+
/** Pass 2 fallback when sections model truncates */
|
|
926
|
+
sectionsFallback: LanguageModel;
|
|
927
|
+
/** Pass 3: supplementary field enrichment (fast, cheap model) */
|
|
928
|
+
enrichment: LanguageModel;
|
|
929
|
+
}
|
|
930
|
+
/**
|
|
931
|
+
* Format for sending PDF content to the model.
|
|
932
|
+
*
|
|
933
|
+
* - `file` (default): Send PDF as a native file `{ type: "file", data, mediaType }`.
|
|
934
|
+
* Most providers support this (Anthropic, Google, OpenAI, Mistral, Bedrock, etc.).
|
|
935
|
+
* Most efficient — no conversion needed.
|
|
936
|
+
*
|
|
937
|
+
* - `image`: Convert PDF pages to base64-encoded images. Fallback for models that
|
|
938
|
+
* don't support native PDF file input. Requires providing `convertPdfToImages` callback.
|
|
939
|
+
*/
|
|
940
|
+
type PdfContentFormat = "file" | "image";
|
|
941
|
+
/**
|
|
942
|
+
* Callback function to convert PDF pages to base64-encoded images.
|
|
943
|
+
*
|
|
944
|
+
* @param pdfBase64 - Base64-encoded PDF document
|
|
945
|
+
* @param startPage - First page to convert (1-indexed)
|
|
946
|
+
* @param endPage - Last page to convert (1-indexed)
|
|
947
|
+
* @returns Array of base64-encoded images (one per page) with MIME type
|
|
948
|
+
*/
|
|
949
|
+
type ConvertPdfToImagesFn = (pdfBase64: string, startPage: number, endPage: number) => Promise<Array<{
|
|
950
|
+
imageBase64: string;
|
|
951
|
+
mimeType: string;
|
|
952
|
+
}>>;
|
|
953
|
+
/** Create a ModelConfig where every role uses the same model. */
|
|
954
|
+
declare function createUniformModelConfig(model: LanguageModel): ModelConfig;
|
|
955
|
+
/** Token limits per extraction role. All fields optional — defaults applied by resolveTokenLimits. */
|
|
956
|
+
type TokenLimits = {
|
|
957
|
+
classification?: number;
|
|
958
|
+
metadata?: number;
|
|
959
|
+
sections?: number;
|
|
960
|
+
sectionsFallback?: number;
|
|
961
|
+
enrichment?: number;
|
|
962
|
+
};
|
|
963
|
+
/** Default token limits per role. Override via ExtractOptions.tokenLimits. */
|
|
964
|
+
declare const DEFAULT_TOKEN_LIMITS: Required<TokenLimits>;
|
|
965
|
+
/** Resolve token limits with overrides merged over defaults. */
|
|
966
|
+
declare function resolveTokenLimits(overrides?: TokenLimits): Required<TokenLimits>;
|
|
967
|
+
/**
|
|
968
|
+
* @deprecated Use DEFAULT_TOKEN_LIMITS instead. Kept for backward compatibility.
|
|
969
|
+
*/
|
|
970
|
+
declare const MODEL_TOKEN_LIMITS: Required<TokenLimits>;
|
|
971
|
+
|
|
972
|
+
/**
|
|
973
|
+
* Extraction prompt for insurance policy documents.
|
|
974
|
+
* Single source of truth — used by extractPolicy, retryExtraction, and reExtractFromFile.
|
|
975
|
+
*/
|
|
976
|
+
/**
|
|
977
|
+
* @deprecated No longer used for new extractions. Kept for backward compatibility
|
|
978
|
+
* with rawExtractionResponse reparse (older extractions may have used this format).
|
|
979
|
+
* New extractions use two-pass flow: METADATA_PROMPT (Sonnet) + buildSectionsPrompt (Haiku).
|
|
980
|
+
*/
|
|
981
|
+
declare const EXTRACTION_PROMPT = "You are an expert insurance document analyst. Extract comprehensive structured data from this insurance document. Preserve original language verbatim \u2014 do not summarize or paraphrase section content.\n\nRespond with JSON only. The JSON must follow this exact structure:\n\n{\n \"metadata\": {\n \"carrier\": \"primary insurance company name (for display purposes)\",\n \"security\": \"insurer or underwriter entity providing coverage, e.g. 'Lloyd's Underwriters' \u2014 the legal entity on risk\",\n \"underwriter\": \"named individual underwriter if listed, or null\",\n \"mga\": \"Managing General Agent or Program Administrator name if applicable (e.g. 'CFC Underwriting'), or null\",\n \"broker\": \"insurance broker name if identifiable, or null\",\n \"policyNumber\": \"policy or quote reference number\",\n \"documentType\": \"policy\" or \"quote\",\n \"policyTypes\": [\"general_liability\", \"commercial_property\", \"commercial_auto\", \"non_owned_auto\", \"workers_comp\", \"umbrella\", \"excess_liability\", \"professional_liability\", \"cyber\", \"epli\", \"directors_officers\", \"fiduciary_liability\", \"crime_fidelity\", \"inland_marine\", \"builders_risk\", \"environmental\", \"ocean_marine\", \"surety\", \"product_liability\", \"bop\", \"management_liability_package\", \"property\", \"other\"],\n \"policyYear\": number,\n \"effectiveDate\": \"MM/DD/YYYY\",\n \"expirationDate\": \"MM/DD/YYYY\",\n \"isRenewal\": boolean,\n \"premium\": \"$X,XXX\",\n \"insuredName\": \"name of insured party\",\n \"summary\": \"1-2 sentence summary of the document\"\n },\n \"metadataSource\": {\n \"carrierPage\": number or null,\n \"policyNumberPage\": number or null,\n \"premiumPage\": number or null,\n \"effectiveDatePage\": number or null\n },\n \"coverages\": [\n {\n \"name\": \"coverage name\",\n \"limit\": \"$X,XXX,XXX\",\n \"deductible\": \"$X,XXX or null\",\n \"pageNumber\": number,\n \"sectionRef\": \"section number reference or null\"\n }\n ],\n \"document\": {\n \"sections\": [\n {\n \"title\": \"section title\",\n \"sectionNumber\": \"e.g. 'I', '1.1', 'A' \u2014 or null if unnumbered\",\n \"pageStart\": number,\n \"pageEnd\": number or null,\n \"type\": \"one of: declarations, insuring_agreement, exclusion, condition, definition, endorsement, schedule, subjectivity, warranty, notice, regulatory, other\",\n \"coverageType\": \"links to policyTypes value if section is coverage-specific, or null\",\n \"content\": \"full verbatim text of the section\",\n \"subsections\": [\n {\n \"title\": \"subsection title\",\n \"sectionNumber\": \"subsection number or null\",\n \"pageNumber\": number or null,\n \"content\": \"full verbatim text\"\n }\n ]\n }\n ],\n \"regulatoryContext\": {\n \"content\": \"all regulatory context, governing law, jurisdiction clauses \u2014 verbatim\",\n \"pageNumber\": number\n },\n \"complaintContact\": {\n \"content\": \"complaint contact information and instructions \u2014 verbatim\",\n \"pageNumber\": number\n },\n \"costsAndFees\": {\n \"content\": \"other costs, fees, surcharges, and charges \u2014 verbatim\",\n \"pageNumber\": number\n }\n },\n \"totalPages\": number\n}\n\nIMPORTANT INSTRUCTIONS:\n- policyTypes should include ALL coverage types found in the document\n- documentType should be \"quote\" if this is a quote/proposal, \"policy\" if it is a bound policy\n- For carrier, use the primary company name. For security, use the full legal entity providing coverage\n- Extract EVERY section, clause, endorsement, and schedule from the document as a separate entry in document.sections\n- Preserve the original language exactly as written in the document \u2014 do not summarize\n- Include accurate page numbers for every section and data point\n- Classify each section by type (declarations, insuring_agreement, exclusion, condition, etc.)\n- If a section relates to a specific coverage type, set coverageType to match the policyTypes value\n- For regulatoryContext, complaintContact, and costsAndFees: set to null if not found in the document\n- subsections within a section are optional \u2014 only include if the section has clearly defined subsections";
|
|
982
|
+
/**
|
|
983
|
+
* Pass 0: Document classification prompt (Haiku).
|
|
984
|
+
* Quick classification to determine if a document is a policy or a quote.
|
|
985
|
+
*/
|
|
986
|
+
declare const CLASSIFY_DOCUMENT_PROMPT = "You are an expert insurance document analyst. Classify this document as either a bound insurance POLICY or a QUOTE/PROPOSAL.\n\nRespond with JSON only:\n\n{\n \"documentType\": \"policy\" or \"quote\",\n \"confidence\": number between 0 and 1,\n \"signals\": [\"signal 1\", \"signal 2\"]\n}\n\nCLASSIFICATION SIGNALS:\n- POLICY signals: declarations page, ISO form numbers (e.g. CG 00 01, HO 00 03, PP 00 01), binding language (\"This policy is issued to\"), endorsement schedules, \"Certificate of Insurance\"\n- POLICY (personal lines) signals: HO form numbers (HO 00 03/04/05/06/07/08), PAP form numbers (PP 00 01), NFIP flood policy headers, Auto ID card format, title commitment or title policy headers, pet/travel policy declarations\n- QUOTE signals: \"quote\", \"proposal\", \"indication\" wording, subjectivities, \"subject to\" conditions, quote expiration date, \"proposed premium\", \"terms and conditions may vary\"\n\nIf uncertain, lean toward \"policy\" for documents with declarations pages and binding language, \"quote\" for everything else.";
|
|
987
|
+
/**
|
|
988
|
+
* Chunked extraction: metadata-only prompt for the first pass on long documents.
|
|
989
|
+
* Used for both policy and quote extractions (documentType already known from pass 0).
|
|
990
|
+
*/
|
|
991
|
+
declare const METADATA_PROMPT = "You are an expert insurance document analyst. Extract the high-level metadata AND structured declarations data from this insurance document. Do NOT extract full section content \u2014 that will be done in a separate pass.\n\nRespond with JSON only:\n\n{\n \"metadata\": {\n \"carrier\": \"primary insurance company name\",\n \"carrierLegalName\": \"legal entity name of insurer, or null\",\n \"carrierNaicNumber\": \"NAIC company code, or null\",\n \"carrierAmBestRating\": \"AM Best rating (e.g. 'A+ XV'), or null\",\n \"carrierAdmittedStatus\": \"admitted\" or \"non_admitted\" or \"surplus_lines\" or null,\n \"security\": \"insurer or underwriter entity providing coverage, or null\",\n \"underwriter\": \"named individual underwriter, or null\",\n \"mga\": \"MGA or Program Administrator, or null\",\n \"broker\": \"insurance broker agency name, or null\",\n \"brokerContactName\": \"individual producer name, or null\",\n \"brokerLicenseNumber\": \"producer license number, or null\",\n \"policyNumber\": \"policy number\",\n \"priorPolicyNumber\": \"previous policy number if renewal, or null\",\n \"documentType\": \"policy\" or \"quote\",\n \"policyTypes\": [\"general_liability\", \"commercial_property\", \"commercial_auto\", \"non_owned_auto\", \"workers_comp\", \"umbrella\", \"excess_liability\", \"professional_liability\", \"cyber\", \"epli\", \"directors_officers\", \"fiduciary_liability\", \"crime_fidelity\", \"inland_marine\", \"builders_risk\", \"environmental\", \"ocean_marine\", \"surety\", \"product_liability\", \"bop\", \"management_liability_package\", \"property\", \"homeowners_ho3\", \"homeowners_ho5\", \"renters_ho4\", \"condo_ho6\", \"dwelling_fire\", \"mobile_home\", \"personal_auto\", \"personal_umbrella\", \"flood_nfip\", \"flood_private\", \"earthquake\", \"personal_inland_marine\", \"watercraft\", \"recreational_vehicle\", \"farm_ranch\", \"pet\", \"travel\", \"identity_theft\", \"title\", \"other\"],\n \"coverageForm\": \"occurrence\" or \"claims_made\" or \"accident\" or null,\n \"policyYear\": number,\n \"effectiveDate\": \"MM/DD/YYYY\",\n \"expirationDate\": \"MM/DD/YYYY, or null if continuous/open-ended policy\",\n \"policyTermType\": \"fixed\" or \"continuous\",\n \"nextReviewDate\": \"MM/DD/YYYY \u2014 next annual review or renewal date, or null\",\n \"effectiveTime\": \"e.g. 12:01 AM, or null\",\n \"retroactiveDate\": \"MM/DD/YYYY for claims-made policies, or null\",\n \"isRenewal\": boolean,\n \"isPackage\": boolean,\n \"programName\": \"named program, or null\",\n \"premium\": \"$X,XXX\",\n \"insuredName\": \"name of primary named insured\",\n \"insuredDba\": \"doing-business-as name, or null\",\n \"insuredAddress\": { \"street1\": \"\", \"city\": \"\", \"state\": \"\", \"zip\": \"\" } or null,\n \"insuredEntityType\": \"corporation\" or \"llc\" or \"partnership\" or \"sole_proprietor\" or \"joint_venture\" or \"trust\" or \"nonprofit\" or \"municipality\" or \"individual\" or \"married_couple\" or \"other\" or null,\n \"insuredFein\": \"FEIN, or null\",\n \"summary\": \"1-2 sentence summary\"\n },\n \"metadataSource\": {\n \"carrierPage\": number or null,\n \"policyNumberPage\": number or null,\n \"premiumPage\": number or null,\n \"effectiveDatePage\": number or null\n },\n \"additionalNamedInsureds\": [\n { \"name\": \"insured name\", \"relationship\": \"subsidiary, affiliate, etc., or null\" }\n ],\n \"coverages\": [\n { \"name\": \"coverage name\", \"limit\": \"$X,XXX,XXX\", \"deductible\": \"$X,XXX or null\", \"pageNumber\": number, \"sectionRef\": \"section ref or null\" }\n ],\n \"limits\": {\n \"perOccurrence\": \"$X,XXX,XXX or null\",\n \"generalAggregate\": \"$X,XXX,XXX or null\",\n \"productsCompletedOpsAggregate\": \"or null\",\n \"personalAdvertisingInjury\": \"or null\",\n \"fireDamage\": \"or null\",\n \"medicalExpense\": \"or null\",\n \"combinedSingleLimit\": \"or null\",\n \"bodilyInjuryPerPerson\": \"or null\",\n \"bodilyInjuryPerAccident\": \"or null\",\n \"propertyDamage\": \"or null\",\n \"eachOccurrenceUmbrella\": \"or null\",\n \"umbrellaAggregate\": \"or null\",\n \"umbrellaRetention\": \"or null\",\n \"statutory\": boolean or null,\n \"employersLiability\": { \"eachAccident\": \"\", \"diseasePolicyLimit\": \"\", \"diseaseEachEmployee\": \"\" } or null,\n \"defenseCostTreatment\": \"inside_limits\" or \"outside_limits\" or \"supplementary\" or null\n },\n \"deductibles\": {\n \"perClaim\": \"or null\",\n \"perOccurrence\": \"or null\",\n \"selfInsuredRetention\": \"or null\",\n \"waitingPeriod\": \"or null\"\n },\n \"locations\": [\n { \"number\": 1, \"address\": { \"street1\": \"\", \"city\": \"\", \"state\": \"\", \"zip\": \"\" }, \"description\": \"or null\", \"buildingValue\": \"or null\", \"contentsValue\": \"or null\" }\n ],\n \"vehicles\": [\n { \"number\": 1, \"year\": 2024, \"make\": \"\", \"model\": \"\", \"vin\": \"\", \"vehicleType\": \"or null\" }\n ],\n \"classifications\": [\n { \"code\": \"12345\", \"description\": \"class description\", \"premiumBasis\": \"payroll or revenue or area\", \"basisAmount\": \"or null\", \"rate\": \"or null\", \"premium\": \"or null\" }\n ],\n \"formInventory\": [\n { \"formNumber\": \"CG 00 01\", \"editionDate\": \"04 13\", \"title\": \"or null\", \"formType\": \"coverage or endorsement or declarations or application or notice or other\" }\n ],\n \"taxesAndFees\": [\n { \"name\": \"fee name\", \"amount\": \"$X,XXX\", \"type\": \"tax or fee or surcharge or assessment or null\" }\n ],\n \"totalPages\": number,\n \"tableOfContents\": [\n { \"title\": \"section title\", \"pageStart\": number, \"pageEnd\": number }\n ]\n}\n\nIMPORTANT:\n- policyTypes should include ALL coverage types found in the document\n- coverageForm is the primary trigger type: \"occurrence\" for occurrence-based, \"claims_made\" for claims-made, \"accident\" for auto/WC\n- isPackage is true if this is a Commercial Package Policy (CPP) with multiple coverage parts\n- Extract locations ONLY if a location/premises schedule is visible on the declarations\n- Extract vehicles ONLY if a vehicle schedule is visible\n- Extract classifications ONLY if a classification/rating schedule is visible\n- formInventory: list ALL form numbers found in any forms schedule or endorsement schedule\n- For limits, extract the standard limit fields that appear on the declarations page\n- For deductibles, extract from the declarations or deductible schedule\n- For PERSONAL LINES: Use personal line-specific policyTypes (homeowners_ho3, personal_auto, etc.)\n- For homeowners policies (HO forms), extract Coverage A through F limits if visible on declarations\n- For personal auto (PAP), extract per-vehicle coverages and driver list if visible\n- For flood (NFIP), extract flood zone, community number, building/contents coverage\n- For personal articles, extract scheduled items list if visible\n- CONTINUOUS POLICIES: If the policy term says \"until cancelled\", \"until cancelled or replaced\", or has no fixed expiration date, set policyTermType to \"continuous\" and expirationDate to null. Extract the \"next policy review date\" or \"renewal date\" into nextReviewDate if present. Otherwise set policyTermType to \"fixed\"";
|
|
992
|
+
/**
|
|
993
|
+
* Quote-specific metadata prompt (Sonnet).
|
|
994
|
+
* Extracts quote-specific fields like subjectivities, underwriting conditions, premium breakdown.
|
|
995
|
+
*/
|
|
996
|
+
declare const QUOTE_METADATA_PROMPT = "You are an expert insurance document analyst. Extract the high-level metadata AND structured data from this insurance QUOTE or PROPOSAL. Do NOT extract full section content \u2014 that will be done in a separate pass.\n\nRespond with JSON only:\n\n{\n \"metadata\": {\n \"carrier\": \"primary insurance company name\",\n \"carrierLegalName\": \"legal entity name, or null\",\n \"carrierNaicNumber\": \"NAIC code, or null\",\n \"carrierAdmittedStatus\": \"admitted or non_admitted or surplus_lines, or null\",\n \"security\": \"insurer or underwriter entity, or null\",\n \"underwriter\": \"named individual underwriter, or null\",\n \"mga\": \"MGA or Program Administrator, or null\",\n \"broker\": \"insurance broker, or null\",\n \"brokerContactName\": \"individual producer, or null\",\n \"quoteNumber\": \"quote or proposal reference number\",\n \"policyTypes\": [\"general_liability\", \"commercial_property\", \"commercial_auto\", \"non_owned_auto\", \"workers_comp\", \"umbrella\", \"excess_liability\", \"professional_liability\", \"cyber\", \"epli\", \"directors_officers\", \"fiduciary_liability\", \"crime_fidelity\", \"inland_marine\", \"builders_risk\", \"environmental\", \"ocean_marine\", \"surety\", \"product_liability\", \"bop\", \"management_liability_package\", \"property\", \"homeowners_ho3\", \"homeowners_ho5\", \"renters_ho4\", \"condo_ho6\", \"dwelling_fire\", \"mobile_home\", \"personal_auto\", \"personal_umbrella\", \"flood_nfip\", \"flood_private\", \"earthquake\", \"personal_inland_marine\", \"watercraft\", \"recreational_vehicle\", \"farm_ranch\", \"pet\", \"travel\", \"identity_theft\", \"title\", \"other\"],\n \"coverageForm\": \"occurrence or claims_made or accident, or null\",\n \"quoteYear\": number,\n \"proposedEffectiveDate\": \"MM/DD/YYYY or null\",\n \"proposedExpirationDate\": \"MM/DD/YYYY or null\",\n \"quoteExpirationDate\": \"MM/DD/YYYY \u2014 when this quote offer expires, or null\",\n \"retroactiveDate\": \"MM/DD/YYYY for claims-made, or null\",\n \"isRenewal\": boolean,\n \"premium\": \"$X,XXX \u2014 total proposed premium\",\n \"insuredName\": \"name of insured party\",\n \"insuredAddress\": { \"street1\": \"\", \"city\": \"\", \"state\": \"\", \"zip\": \"\" } or null,\n \"summary\": \"1-2 sentence summary of the quote\"\n },\n \"metadataSource\": {\n \"carrierPage\": number or null,\n \"quoteNumberPage\": number or null,\n \"premiumPage\": number or null,\n \"effectiveDatePage\": number or null\n },\n \"coverages\": [\n { \"name\": \"coverage name\", \"proposedLimit\": \"$X,XXX,XXX\", \"proposedDeductible\": \"$X,XXX or null\", \"pageNumber\": number, \"sectionRef\": \"or null\" }\n ],\n \"limits\": {\n \"perOccurrence\": \"or null\",\n \"generalAggregate\": \"or null\",\n \"defenseCostTreatment\": \"inside_limits or outside_limits or supplementary, or null\"\n },\n \"deductibles\": {\n \"perClaim\": \"or null\",\n \"perOccurrence\": \"or null\",\n \"selfInsuredRetention\": \"or null\",\n \"waitingPeriod\": \"or null\"\n },\n \"premiumBreakdown\": [\n { \"line\": \"coverage line name\", \"amount\": \"$X,XXX\" }\n ],\n \"subjectivities\": [\n { \"description\": \"subjectivity description\", \"category\": \"pre_binding or post_binding or information, or null\", \"dueDate\": \"or null\", \"pageNumber\": number or null }\n ],\n \"underwritingConditions\": [\n { \"description\": \"condition description\", \"category\": \"or null\", \"pageNumber\": number or null }\n ],\n \"warrantyRequirements\": [\"warranty text\"],\n \"taxesAndFees\": [\n { \"name\": \"fee name\", \"amount\": \"$X,XXX\", \"type\": \"tax or fee or surcharge, or null\" }\n ],\n \"totalPages\": number,\n \"tableOfContents\": [\n { \"title\": \"section title\", \"pageStart\": number, \"pageEnd\": number }\n ]\n}\n\nIMPORTANT:\n- quoteExpirationDate is when the quote offer itself expires (not the proposed policy period)\n- subjectivities are conditions that must be met before or after binding\n- premiumBreakdown should list each coverage line's individual premium if available\n- warrantyRequirements: extract any warranty provisions required for coverage\n- For limits and deductibles, extract the proposed structure from the quote";
|
|
997
|
+
/**
|
|
998
|
+
* Chunked extraction: sections prompt for a specific page range (policies).
|
|
999
|
+
*/
|
|
1000
|
+
declare function buildSectionsPrompt(pageStart: number, pageEnd: number): string;
|
|
1001
|
+
/** Alias for backward compatibility */
|
|
1002
|
+
declare const buildPolicySectionsPrompt: typeof buildSectionsPrompt;
|
|
1003
|
+
/**
|
|
1004
|
+
* Chunked extraction: sections prompt for quote documents.
|
|
1005
|
+
*/
|
|
1006
|
+
declare function buildQuoteSectionsPrompt(pageStart: number, pageEnd: number): string;
|
|
1007
|
+
/**
|
|
1008
|
+
* Pass 3: Supplementary field enrichment prompt.
|
|
1009
|
+
* Text-only (no PDF) — parses raw text blobs into structured data.
|
|
1010
|
+
*/
|
|
1011
|
+
declare function buildSupplementaryEnrichmentPrompt(fields: {
|
|
1012
|
+
regulatoryContext?: string;
|
|
1013
|
+
complaintContact?: string;
|
|
1014
|
+
costsAndFees?: string;
|
|
1015
|
+
claimsContact?: string;
|
|
1016
|
+
}): string;
|
|
1017
|
+
/**
|
|
1018
|
+
* Build a context hint for personal lines extraction based on detected policyType.
|
|
1019
|
+
* Returns null for commercial lines or unknown types.
|
|
1020
|
+
*/
|
|
1021
|
+
declare function buildPersonalLinesHint(policyType: string): string | null;
|
|
1022
|
+
|
|
1023
|
+
declare const APPLICATION_CLASSIFY_PROMPT = "You are classifying a PDF document. Determine if this is an insurance APPLICATION FORM (a form to be filled out to apply for insurance) versus a policy document, quote, certificate, or other document.\n\nInsurance applications typically:\n- Have blank fields, checkboxes, or spaces to fill in\n- Ask for company information, coverage limits, loss history\n- Include ACORD form numbers or \"Application for\" in the title\n- Request signatures and dates\n\nRespond with JSON only:\n{\n \"isApplication\": boolean,\n \"confidence\": number (0-1),\n \"applicationType\": string | null // e.g. \"General Liability\", \"Professional Liability\", \"Commercial Property\", \"Workers Compensation\", \"ACORD 125\", etc.\n}";
|
|
1024
|
+
declare function buildFieldExtractionPrompt(): string;
|
|
1025
|
+
declare function buildAutoFillPrompt(fields: {
|
|
1026
|
+
id: string;
|
|
1027
|
+
label: string;
|
|
1028
|
+
fieldType: string;
|
|
1029
|
+
section: string;
|
|
1030
|
+
}[], orgContext: {
|
|
1031
|
+
key: string;
|
|
1032
|
+
value: string;
|
|
1033
|
+
category: string;
|
|
1034
|
+
}[]): string;
|
|
1035
|
+
declare function buildQuestionBatchPrompt(unfilledFields: {
|
|
1036
|
+
id: string;
|
|
1037
|
+
label?: string;
|
|
1038
|
+
text?: string;
|
|
1039
|
+
fieldType: string;
|
|
1040
|
+
section: string;
|
|
1041
|
+
required: boolean;
|
|
1042
|
+
condition?: {
|
|
1043
|
+
dependsOn: string;
|
|
1044
|
+
whenValue: string;
|
|
1045
|
+
};
|
|
1046
|
+
}[]): string;
|
|
1047
|
+
declare function buildAnswerParsingPrompt(questions: {
|
|
1048
|
+
id: string;
|
|
1049
|
+
label?: string;
|
|
1050
|
+
text?: string;
|
|
1051
|
+
fieldType: string;
|
|
1052
|
+
}[], emailBody: string): string;
|
|
1053
|
+
declare function buildConfirmationSummaryPrompt(fields: {
|
|
1054
|
+
id: string;
|
|
1055
|
+
label?: string;
|
|
1056
|
+
text?: string;
|
|
1057
|
+
section: string;
|
|
1058
|
+
fieldType: string;
|
|
1059
|
+
value?: string;
|
|
1060
|
+
}[], applicationTitle: string): string;
|
|
1061
|
+
declare function buildBatchEmailGenerationPrompt(batchFields: {
|
|
1062
|
+
id: string;
|
|
1063
|
+
label: string;
|
|
1064
|
+
fieldType: string;
|
|
1065
|
+
options?: string[];
|
|
1066
|
+
condition?: {
|
|
1067
|
+
dependsOn: string;
|
|
1068
|
+
whenValue: string;
|
|
1069
|
+
};
|
|
1070
|
+
}[], batchIndex: number, totalBatches: number, appTitle: string | undefined, totalFieldCount: number, filledFieldCount: number, previousBatchSummary?: string, companyName?: string): string;
|
|
1071
|
+
declare function buildReplyIntentClassificationPrompt(questions: {
|
|
1072
|
+
id: string;
|
|
1073
|
+
label: string;
|
|
1074
|
+
}[], emailBody: string): string;
|
|
1075
|
+
declare function buildFieldExplanationPrompt(field: {
|
|
1076
|
+
id: string;
|
|
1077
|
+
label: string;
|
|
1078
|
+
fieldType: string;
|
|
1079
|
+
options?: string[];
|
|
1080
|
+
}, question: string, policyContext?: string): string;
|
|
1081
|
+
declare function buildFlatPdfMappingPrompt(extractedFields: {
|
|
1082
|
+
id: string;
|
|
1083
|
+
label: string;
|
|
1084
|
+
value: string;
|
|
1085
|
+
fieldType: string;
|
|
1086
|
+
}[]): string;
|
|
1087
|
+
declare function buildAcroFormMappingPrompt(extractedFields: {
|
|
1088
|
+
id: string;
|
|
1089
|
+
label: string;
|
|
1090
|
+
value?: string;
|
|
1091
|
+
}[], acroFormFields: {
|
|
1092
|
+
name: string;
|
|
1093
|
+
type: string;
|
|
1094
|
+
options?: string[];
|
|
1095
|
+
}[]): string;
|
|
1096
|
+
declare function buildLookupFillPrompt(requests: {
|
|
1097
|
+
type: string;
|
|
1098
|
+
description: string;
|
|
1099
|
+
targetFieldIds: string[];
|
|
1100
|
+
}[], targetFields: {
|
|
1101
|
+
id: string;
|
|
1102
|
+
label: string;
|
|
1103
|
+
fieldType: string;
|
|
1104
|
+
}[], availableData: string): string;
|
|
1105
|
+
|
|
1106
|
+
declare function buildIdentityPrompt(ctx: AgentContext): string;
|
|
1107
|
+
|
|
1108
|
+
declare function buildSafetyPrompt(ctx: AgentContext): string;
|
|
1109
|
+
|
|
1110
|
+
declare function buildFormattingPrompt(ctx: AgentContext): string;
|
|
1111
|
+
|
|
1112
|
+
declare function buildCoverageGapPrompt(ctx: AgentContext): string | null;
|
|
1113
|
+
|
|
1114
|
+
declare function buildCoiRoutingPrompt(ctx: AgentContext): string | null;
|
|
1115
|
+
|
|
1116
|
+
declare function buildQuotesPoliciesPrompt(): string;
|
|
1117
|
+
|
|
1118
|
+
declare function buildConversationMemoryGuidance(): string;
|
|
1119
|
+
|
|
1120
|
+
declare function buildIntentPrompt(ctx: AgentContext): string;
|
|
1121
|
+
|
|
1122
|
+
/**
|
|
1123
|
+
* Build a complete agent system prompt from composable modules.
|
|
1124
|
+
*
|
|
1125
|
+
* Composes: identity -> company context -> intent -> formatting -> safety
|
|
1126
|
+
* -> coverage gaps -> COI routing -> quotes/policies -> memory guidance.
|
|
1127
|
+
*
|
|
1128
|
+
* Modules that return null (e.g. coverage gaps in direct mode) are filtered out.
|
|
1129
|
+
*/
|
|
1130
|
+
declare function buildAgentSystemPrompt(ctx: AgentContext): string;
|
|
1131
|
+
|
|
1132
|
+
/**
|
|
1133
|
+
* @deprecated Use `buildAgentSystemPrompt` from `prompts/agent/index` instead.
|
|
1134
|
+
* Maps legacy mode strings to the new platform/intent API.
|
|
1135
|
+
*/
|
|
1136
|
+
declare function buildSystemPrompt(mode: "direct" | "cc" | "forward", companyContext: string | undefined, siteUrl: string, companyName?: string, userName?: string, coiHandling?: "broker" | "user" | "member" | "ignore", brokerName?: string, brokerContactName?: string, brokerContactEmail?: string): string;
|
|
1137
|
+
/** @deprecated Use buildDocumentContext instead */
|
|
1138
|
+
declare function buildPolicyContext(policies: PolicyDocument[], queryText: string): {
|
|
1139
|
+
context: string;
|
|
1140
|
+
relevantPolicyIds: string[];
|
|
1141
|
+
};
|
|
1142
|
+
declare function buildDocumentContext(policies: PolicyDocument[], quotes: QuoteDocument[], queryText: string): {
|
|
1143
|
+
context: string;
|
|
1144
|
+
relevantPolicyIds: string[];
|
|
1145
|
+
relevantQuoteIds: string[];
|
|
1146
|
+
};
|
|
1147
|
+
interface PastConversation {
|
|
1148
|
+
fromName?: string;
|
|
1149
|
+
fromEmail: string;
|
|
1150
|
+
subject: string;
|
|
1151
|
+
body: string;
|
|
1152
|
+
responseBody: string;
|
|
1153
|
+
_creationTime: number;
|
|
1154
|
+
threadId?: string;
|
|
1155
|
+
}
|
|
1156
|
+
declare function buildConversationMemoryContext(conversations: PastConversation[]): string;
|
|
1157
|
+
|
|
1158
|
+
/**
|
|
1159
|
+
* Build a platform-agnostic message classification prompt.
|
|
1160
|
+
*
|
|
1161
|
+
* The prompt instructs Claude to classify an incoming message and suggest
|
|
1162
|
+
* an intent, with platform-specific context fields included in the schema.
|
|
1163
|
+
*/
|
|
1164
|
+
declare function buildClassifyMessagePrompt(platform: Platform): string;
|
|
1165
|
+
|
|
1166
|
+
/**
|
|
1167
|
+
* @deprecated Use `buildClassifyMessagePrompt("email")` from `prompts/intent` instead.
|
|
1168
|
+
*/
|
|
1169
|
+
declare const CLASSIFY_EMAIL_PROMPT = "You are an AI assistant that classifies emails. Determine if this email is related to insurance policies (new policies, renewals, certificates of insurance, policy documents, endorsements, binders, premium notices, etc).\n\nRespond with JSON only:\n{\n \"isInsurance\": boolean,\n \"reason\": \"brief explanation\",\n \"confidence\": number between 0 and 1\n}\n\nEmail subject: {{subject}}\nFrom: {{from}}\nDate: {{date}}";
|
|
1170
|
+
|
|
1171
|
+
interface ToolDefinition {
|
|
1172
|
+
name: string;
|
|
1173
|
+
description: string;
|
|
1174
|
+
input_schema: {
|
|
1175
|
+
type: "object";
|
|
1176
|
+
properties: Record<string, unknown>;
|
|
1177
|
+
required?: string[];
|
|
1178
|
+
};
|
|
1179
|
+
}
|
|
1180
|
+
declare const DOCUMENT_LOOKUP_TOOL: ToolDefinition;
|
|
1181
|
+
declare const COI_GENERATION_TOOL: ToolDefinition;
|
|
1182
|
+
declare const COVERAGE_COMPARISON_TOOL: ToolDefinition;
|
|
1183
|
+
declare const AGENT_TOOLS: ToolDefinition[];
|
|
1184
|
+
|
|
1185
|
+
/**
|
|
1186
|
+
* Multi-pass extraction pipeline for insurance PDFs.
|
|
1187
|
+
*
|
|
1188
|
+
* Processes documents in up to 4 passes with adaptive fallback:
|
|
1189
|
+
*
|
|
1190
|
+
* - **Pass 0 (Classification)**: Classification model classifies document as policy or quote.
|
|
1191
|
+
* - **Pass 1 (Metadata)**: Metadata model extracts high-level metadata (carrier, dates,
|
|
1192
|
+
* premium, coverages). Supports `onMetadata?()` callback for early persistence
|
|
1193
|
+
* so metadata survives pass 2 failures.
|
|
1194
|
+
* - **Pass 2 (Sections)**: Chunked extraction with sections model. Documents are split into
|
|
1195
|
+
* 15-page chunks; on JSON parse failure (usually output truncation), re-splits
|
|
1196
|
+
* to 10 -> 5 pages, then falls back to sectionsFallback model. `mergeChunkedSections()` combines.
|
|
1197
|
+
* - **Pass 3 (Enrichment)**: Enrichment model enriches supplementary fields (regulatory context,
|
|
1198
|
+
* contacts) from raw text. Non-fatal on failure.
|
|
1199
|
+
*
|
|
1200
|
+
* Separate entry points exist for policies (`extractFromPdf`) vs quotes
|
|
1201
|
+
* (`extractQuoteFromPdf`). `extractSectionsOnly()` retries pass 2 using
|
|
1202
|
+
* saved metadata from a prior pass 1.
|
|
1203
|
+
*
|
|
1204
|
+
* Provider-agnostic: accepts `ModelConfig` with Vercel AI SDK `LanguageModel` instances.
|
|
1205
|
+
* Consumers must provide their own models — no default provider is assumed.
|
|
1206
|
+
*/
|
|
1207
|
+
|
|
1208
|
+
type LogFn = (message: string) => Promise<void>;
|
|
1209
|
+
/** Strip markdown code fences from AI response text. */
|
|
1210
|
+
declare function stripFences(text: string): string;
|
|
1211
|
+
/**
|
|
1212
|
+
* Recursively convert null values to undefined.
|
|
1213
|
+
*
|
|
1214
|
+
* Required because Convex rejects `null` for optional fields, but Claude
|
|
1215
|
+
* routinely returns `null` for missing values in JSON output. Applied to
|
|
1216
|
+
* all extraction results before persistence.
|
|
1217
|
+
*/
|
|
1218
|
+
declare function sanitizeNulls<T>(obj: T): T;
|
|
1219
|
+
/** Map raw Claude extraction JSON to mutation-compatible fields. */
|
|
1220
|
+
declare function applyExtracted(extracted: any): any;
|
|
1221
|
+
/**
|
|
1222
|
+
* Merge document sections from chunked extraction passes.
|
|
1223
|
+
*
|
|
1224
|
+
* Combines sections from all chunks into a single array and takes the last
|
|
1225
|
+
* non-null value for supplementary fields (regulatoryContext, complaintContact,
|
|
1226
|
+
* costsAndFees, claimsContact) since these typically appear only once.
|
|
1227
|
+
*/
|
|
1228
|
+
declare function mergeChunkedSections(metadataResult: any, sectionChunks: any[]): any;
|
|
1229
|
+
/** Determine page ranges for chunked extraction. */
|
|
1230
|
+
declare function getPageChunks(totalPages: number, chunkSize?: number): Array<[number, number]>;
|
|
1231
|
+
/**
|
|
1232
|
+
* Pass 3: Enrich supplementary fields with structured data.
|
|
1233
|
+
* Text-only enrichment call — non-fatal on failure (returns document unchanged).
|
|
1234
|
+
*/
|
|
1235
|
+
declare function enrichSupplementaryFields(document: any, models: ModelConfig, log?: LogFn, onTokenUsage?: (usage: TokenUsage) => void, tokenLimits?: TokenLimits): Promise<any>;
|
|
1236
|
+
interface ClassifyOptions {
|
|
1237
|
+
log?: LogFn;
|
|
1238
|
+
models: ModelConfig;
|
|
1239
|
+
/** Called after each model call with token usage for tracking. */
|
|
1240
|
+
onTokenUsage?: (usage: TokenUsage) => void;
|
|
1241
|
+
/** PDF content format. "auto" detects Anthropic models and uses native PDF, falls back to image/text for others. */
|
|
1242
|
+
pdfContentFormat?: PdfContentFormat;
|
|
1243
|
+
/** Required when pdfContentFormat is "image". Converts PDF pages to base64 images. */
|
|
1244
|
+
convertPdfToImages?: ConvertPdfToImagesFn;
|
|
1245
|
+
/** Override default token limits per role. */
|
|
1246
|
+
tokenLimits?: TokenLimits;
|
|
1247
|
+
}
|
|
1248
|
+
/**
|
|
1249
|
+
* Pass 0: Classify document as policy or quote.
|
|
1250
|
+
*/
|
|
1251
|
+
declare function classifyDocumentType(pdfBase64: string, options: ClassifyOptions): Promise<{
|
|
1252
|
+
documentType: "policy" | "quote";
|
|
1253
|
+
confidence: number;
|
|
1254
|
+
signals: string[];
|
|
1255
|
+
}>;
|
|
1256
|
+
/** Map raw Claude quote extraction JSON to mutation-compatible fields. */
|
|
1257
|
+
declare function applyExtractedQuote(extracted: any): any;
|
|
1258
|
+
/**
|
|
1259
|
+
* Merge document sections from chunked quote extraction passes.
|
|
1260
|
+
*
|
|
1261
|
+
* Similar to `mergeChunkedSections` but also accumulates quote-specific
|
|
1262
|
+
* fields: subjectivities and underwriting conditions from all chunks.
|
|
1263
|
+
*/
|
|
1264
|
+
declare function mergeChunkedQuoteSections(metadataResult: any, sectionChunks: any[]): any;
|
|
1265
|
+
type PromptBuilder = (pageStart: number, pageEnd: number) => string;
|
|
1266
|
+
/** Token usage reported per model call. */
|
|
1267
|
+
interface TokenUsage {
|
|
1268
|
+
inputTokens: number;
|
|
1269
|
+
outputTokens: number;
|
|
1270
|
+
}
|
|
1271
|
+
interface ExtractOptions {
|
|
1272
|
+
log?: LogFn;
|
|
1273
|
+
onMetadata?: (raw: string) => Promise<void>;
|
|
1274
|
+
models: ModelConfig;
|
|
1275
|
+
/** Provider-specific options for metadata calls (e.g. Anthropic thinking). */
|
|
1276
|
+
metadataProviderOptions?: ProviderOptions;
|
|
1277
|
+
/** Provider-specific options for fallback calls. */
|
|
1278
|
+
fallbackProviderOptions?: ProviderOptions;
|
|
1279
|
+
/** Maximum number of chunk extractions to run in parallel (default: 2). */
|
|
1280
|
+
concurrency?: number;
|
|
1281
|
+
/** Called after each model call with token usage for tracking. */
|
|
1282
|
+
onTokenUsage?: (usage: TokenUsage) => void;
|
|
1283
|
+
/** PDF content format. "auto" detects Anthropic models and uses native PDF, falls back to image/text for others. */
|
|
1284
|
+
pdfContentFormat?: PdfContentFormat;
|
|
1285
|
+
/** Required when pdfContentFormat is "image". Converts PDF pages to base64 images. */
|
|
1286
|
+
convertPdfToImages?: ConvertPdfToImagesFn;
|
|
1287
|
+
/** Override default token limits per role. */
|
|
1288
|
+
tokenLimits?: TokenLimits;
|
|
1289
|
+
}
|
|
1290
|
+
/**
|
|
1291
|
+
* Full extraction pipeline for policy documents (passes 1 through 3).
|
|
1292
|
+
*
|
|
1293
|
+
* - **Pass 1**: Metadata model extracts metadata, coverages, and page count.
|
|
1294
|
+
* - **Pass 2**: Sections model extracts sections in chunks (with adaptive retry and fallback).
|
|
1295
|
+
* - **Pass 3**: Enrichment model enriches supplementary fields (non-fatal).
|
|
1296
|
+
*
|
|
1297
|
+
* @param pdfBase64 - Base64-encoded PDF document.
|
|
1298
|
+
* @param options - Extraction options (models, logging, callbacks, provider options).
|
|
1299
|
+
*/
|
|
1300
|
+
declare function extractFromPdf(pdfBase64: string, options: ExtractOptions): Promise<{
|
|
1301
|
+
rawText: string;
|
|
1302
|
+
extracted: any;
|
|
1303
|
+
}>;
|
|
1304
|
+
interface ExtractSectionsOptions {
|
|
1305
|
+
log?: LogFn;
|
|
1306
|
+
promptBuilder?: PromptBuilder;
|
|
1307
|
+
models: ModelConfig;
|
|
1308
|
+
/** Provider-specific options for fallback calls. */
|
|
1309
|
+
fallbackProviderOptions?: ProviderOptions;
|
|
1310
|
+
/** Maximum number of chunk extractions to run in parallel (default: 2). */
|
|
1311
|
+
concurrency?: number;
|
|
1312
|
+
/** Called after each model call with token usage for tracking. */
|
|
1313
|
+
onTokenUsage?: (usage: TokenUsage) => void;
|
|
1314
|
+
/** PDF content format. "auto" detects Anthropic models and uses native PDF, falls back to image/text for others. */
|
|
1315
|
+
pdfContentFormat?: PdfContentFormat;
|
|
1316
|
+
/** Required when pdfContentFormat is "image". Converts PDF pages to base64 images. */
|
|
1317
|
+
convertPdfToImages?: ConvertPdfToImagesFn;
|
|
1318
|
+
/** Override default token limits per role. */
|
|
1319
|
+
tokenLimits?: TokenLimits;
|
|
1320
|
+
}
|
|
1321
|
+
/**
|
|
1322
|
+
* Sections-only extraction: skip pass 1, use saved metadata.
|
|
1323
|
+
* For retrying when metadata succeeded but sections failed.
|
|
1324
|
+
*/
|
|
1325
|
+
declare function extractSectionsOnly(pdfBase64: string, metadataRaw: string, options: ExtractSectionsOptions): Promise<{
|
|
1326
|
+
rawText: string;
|
|
1327
|
+
extracted: any;
|
|
1328
|
+
}>;
|
|
1329
|
+
/**
|
|
1330
|
+
* Full extraction pipeline for quote documents (passes 1 through 2).
|
|
1331
|
+
*
|
|
1332
|
+
* - **Pass 1**: Metadata model extracts quote-specific metadata (proposed dates,
|
|
1333
|
+
* subjectivities, premium breakdown).
|
|
1334
|
+
* - **Pass 2**: Sections model extracts sections in chunks (with adaptive retry).
|
|
1335
|
+
*
|
|
1336
|
+
* Does not run pass 3 enrichment (quotes rarely have supplementary fields).
|
|
1337
|
+
*
|
|
1338
|
+
* @param pdfBase64 - Base64-encoded PDF document.
|
|
1339
|
+
* @param options - Extraction options (models, logging, callbacks, provider options).
|
|
1340
|
+
*/
|
|
1341
|
+
declare function extractQuoteFromPdf(pdfBase64: string, options: ExtractOptions): Promise<{
|
|
1342
|
+
rawText: string;
|
|
1343
|
+
extracted: any;
|
|
1344
|
+
}>;
|
|
1345
|
+
|
|
1346
|
+
/**
|
|
1347
|
+
* Extract a page range from a PDF and return as base64.
|
|
1348
|
+
* Used to reduce API token usage by only sending relevant pages.
|
|
1349
|
+
*
|
|
1350
|
+
* @param pdfBase64 - Full PDF as base64 string.
|
|
1351
|
+
* @param startPage - First page to include (1-indexed).
|
|
1352
|
+
* @param endPage - Last page to include (1-indexed, clamped to total pages).
|
|
1353
|
+
* @returns Base64 string of the trimmed PDF, or original if range covers all pages.
|
|
1354
|
+
*/
|
|
1355
|
+
declare function extractPageRange(pdfBase64: string, startPage: number, endPage: number): Promise<string>;
|
|
1356
|
+
/**
|
|
1357
|
+
* Get the page count of a PDF without fully parsing it.
|
|
1358
|
+
*/
|
|
1359
|
+
declare function getPdfPageCount(pdfBase64: string): Promise<number>;
|
|
1360
|
+
interface AcroFormFieldInfo {
|
|
1361
|
+
name: string;
|
|
1362
|
+
type: "text" | "checkbox" | "dropdown" | "radio";
|
|
1363
|
+
options?: string[];
|
|
1364
|
+
}
|
|
1365
|
+
/** Enumerate all AcroForm fields from a PDF. Returns empty array if no form. */
|
|
1366
|
+
declare function getAcroFormFields(pdfDoc: PDFDocument): AcroFormFieldInfo[];
|
|
1367
|
+
interface FieldMapping {
|
|
1368
|
+
acroFormName: string;
|
|
1369
|
+
value: string;
|
|
1370
|
+
}
|
|
1371
|
+
/** Fill AcroForm fields by mapping, flatten, and return bytes. */
|
|
1372
|
+
declare function fillAcroForm(pdfBytes: Uint8Array, mappings: FieldMapping[]): Promise<Uint8Array>;
|
|
1373
|
+
interface TextOverlay {
|
|
1374
|
+
page: number;
|
|
1375
|
+
x: number;
|
|
1376
|
+
y: number;
|
|
1377
|
+
text: string;
|
|
1378
|
+
fontSize?: number;
|
|
1379
|
+
isCheckmark?: boolean;
|
|
1380
|
+
}
|
|
1381
|
+
/** Overlay text on a flat PDF at specified coordinates. */
|
|
1382
|
+
declare function overlayTextOnPdf(pdfBytes: Uint8Array, overlays: TextOverlay[]): Promise<Uint8Array>;
|
|
1383
|
+
|
|
1384
|
+
export { AGENT_TOOLS, APPLICATION_CLASSIFY_PROMPT, type AcroFormFieldInfo, type Address, type AdmittedStatus, type AgentContext, type AuditType, type BaseDocument, type BindingAuthority, type BoatType, CLASSIFY_DOCUMENT_PROMPT, CLASSIFY_EMAIL_PROMPT, COI_GENERATION_TOOL, CONTEXT_KEY_MAP, COVERAGE_COMPARISON_TOOL, type ChunkType, type ClaimRecord, type ClaimStatus, type ClassificationCode, type ClassifyOptions, type CommercialAutoDeclarations, type CommercialPropertyDeclarations, type CommunicationIntent, type ConditionType, type ConstructionType, type Contact, type ContextKeyMapping, type ConvertPdfToImagesFn, type Coverage, type CoverageForm, type CoverageTrigger, type CrimeDeclarations, type CyberDeclarations, DEFAULT_TOKEN_LIMITS, DOCUMENT_LOOKUP_TOOL, type DODeclarations, type Declarations, type DeductibleSchedule, type DeductibleType, type DefenseCostTreatment, type DocumentType, type DriverRecord, type DwellingDetails, type DwellingFireDeclarations, type DwellingFireFormType, EXTRACTION_PROMPT, type EarthquakeDeclarations, type EmployersLiabilityLimits, type Endorsement, type EndorsementParty, type EndorsementPartyRole, type EndorsementType, type EnrichedCoverage, type EnrichedSubjectivity, type EnrichedUnderwritingCondition, type EntityType, type Exclusion, type ExperienceMod, type ExtendedReportingPeriod, type ExtractOptions, type ExtractSectionsOptions, type FarmRanchDeclarations, type FieldMapping, type FloodDeclarations, type FloodZone, type FormReference, type FoundationType, type GLDeclarations, type HomeownersDeclarations, type HomeownersFormType, type IdentityTheftDeclarations, type InsuranceDocument, type InsuredLocation, type InsuredVehicle, type InsurerInfo, type LimitSchedule, type LimitType, type LocationPremium, type LogFn, type LossSettlement, type LossSummary, METADATA_PROMPT, MODEL_TOKEN_LIMITS, type ModelConfig, type NamedInsured, PLATFORM_CONFIGS, POLICY_TYPES, type PaymentInstallment, type PaymentPlan, type PdfContentFormat, type PersonalArticlesDeclarations, type PersonalAutoDeclarations, type PersonalAutoUsage, type PersonalUmbrellaDeclarations, type PersonalVehicleDetails, type PetDeclarations, type PetSpecies, type Platform, type PlatformConfig, type PolicyCondition, type PolicyDocument, type PolicySectionType, type PolicyTermType, type PolicyType, type PremiumLine, type ProducerInfo, type ProfessionalLiabilityDeclarations, type PromptBuilder, QUOTE_METADATA_PROMPT, type QuoteDocument, type QuoteSectionType, type RVType, type RatingBasis, type RatingBasisType, type RecreationalVehicleDeclarations, type RoofType, type ScheduledItemCategory, type Section, type SharedLimit, type Subjectivity, type SubjectivityCategory, type Sublimit, type Subsection, type TaxFeeItem, type TextOverlay, type TitleDeclarations, type TitlePolicyType, type TokenLimits, type TokenUsage, type ToolDefinition, type TravelDeclarations, type UmbrellaExcessDeclarations, type UnderwritingCondition, type ValuationMethod, type VehicleCoverage, type VehicleCoverageType, type WatercraftDeclarations, type WorkersCompDeclarations, applyExtracted, applyExtractedQuote, buildAcroFormMappingPrompt, buildAgentSystemPrompt, buildAnswerParsingPrompt, buildAutoFillPrompt, buildBatchEmailGenerationPrompt, buildClassifyMessagePrompt, buildCoiRoutingPrompt, buildConfirmationSummaryPrompt, buildConversationMemoryContext, buildConversationMemoryGuidance, buildCoverageGapPrompt, buildDocumentContext, buildFieldExplanationPrompt, buildFieldExtractionPrompt, buildFlatPdfMappingPrompt, buildFormattingPrompt, buildIdentityPrompt, buildIntentPrompt, buildLookupFillPrompt, buildPersonalLinesHint, buildPolicyContext, buildPolicySectionsPrompt, buildQuestionBatchPrompt, buildQuoteSectionsPrompt, buildQuotesPoliciesPrompt, buildReplyIntentClassificationPrompt, buildSafetyPrompt, buildSectionsPrompt, buildSupplementaryEnrichmentPrompt, buildSystemPrompt, classifyDocumentType, createUniformModelConfig, enrichSupplementaryFields, extractFromPdf, extractPageRange, extractQuoteFromPdf, extractSectionsOnly, fillAcroForm, getAcroFormFields, getPageChunks, getPdfPageCount, mergeChunkedQuoteSections, mergeChunkedSections, overlayTextOnPdf, resolveTokenLimits, sanitizeNulls, stripFences };
|