@claritylabs/cl-sdk 3.2.6 → 3.2.7

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/dist/index.js CHANGED
@@ -3994,6 +3994,7 @@ var CLEANUP_CANDIDATE_ID_LIMIT = 12;
3994
3994
  var CLEANUP_SOURCE_NODE_LIMIT = 90;
3995
3995
  var CLEANUP_SIBLING_WINDOW = 4;
3996
3996
  var CLEANUP_KEYWORD = /\b(coverage|limit|liability|deductible|retention|retroactive|premium|aggregate|sublimit|sub-limit|claim|occurrence|loss|proceeding|endorsement|declarations?)\b|\$[0-9]/i;
3997
+ var CLEANUP_CONTINUATION_KEYWORD = /\b(coverage part|limit of liability|deductible|retention|retroactive date|aggregate|sublimit|sub-limit|each claim|each occurrence|each loss|each proceeding|coinsurance)\b|\$[0-9]/i;
3997
3998
  function compactNode(node, maxText = 700) {
3998
3999
  return {
3999
4000
  id: node.id,
@@ -4122,11 +4123,15 @@ function selectCoverageCleanupNodes(sourceTree, coverages) {
4122
4123
  const children = childrenByParent.get(selectedNode.id) ?? [];
4123
4124
  for (const child of children.slice(0, 24)) addNode(child, 760);
4124
4125
  }
4126
+ const continuationPages = new Set([...coveragePages].map((page) => page + 1));
4125
4127
  for (const node of sourceTree) {
4126
4128
  if (node.kind === "document") continue;
4127
- if (!node.pageStart || !coveragePages.has(node.pageStart)) continue;
4129
+ if (typeof node.pageStart !== "number") continue;
4130
+ const samePage = coveragePages.has(node.pageStart);
4131
+ const nearbyContinuationPage = continuationPages.has(node.pageStart);
4132
+ if (!samePage && !nearbyContinuationPage) continue;
4128
4133
  const text = nodeTextForSelection(node);
4129
- if (CLEANUP_KEYWORD.test(text) || nodeTextMatchesCoverage(node, coverageTerms)) {
4134
+ if (CLEANUP_KEYWORD.test(text) || nodeTextMatchesCoverage(node, coverageTerms) || nearbyContinuationPage && CLEANUP_CONTINUATION_KEYWORD.test(text)) {
4130
4135
  addNode(node, 600);
4131
4136
  }
4132
4137
  }
@@ -4140,7 +4145,7 @@ function buildOperationalProfileCleanupPrompt(sourceTree, profile, options = {})
4140
4145
  const coverageEntries = coverageCleanupEntries(profile, options.coverageIndexes);
4141
4146
  const nodes = selectCoverageCleanupNodes(sourceTree, coverageEntries.map((entry) => entry.coverage)).map((node) => compactNode(
4142
4147
  node,
4143
- node.kind === "page" || node.kind === "page_group" ? 260 : node.kind === "table_row" || node.kind === "table_cell" ? 520 : 360
4148
+ node.kind === "page" || node.kind === "page_group" ? 520 : node.kind === "table_row" || node.kind === "table_cell" ? 520 : 360
4144
4149
  ));
4145
4150
  const candidate = {
4146
4151
  documentType: profile.documentType,
@@ -4166,6 +4171,7 @@ Projection defects to look for:
4166
4171
  - Header/value splits where "Limit of Liability", "Deductible", "Retroactive Date", "Aggregate", "Each Claim", or similar terms are attached to the wrong coverage row.
4167
4172
  - Collapsed combined bases where one candidate term says "Each Claim / Aggregate", "Each Loss / Aggregate", "Each Proceeding / Aggregate", or a continuation line supplies a separate policy aggregate, sub-limit, deductible, retention, retroactive date, or coinsurance term.
4168
4173
  - Repeated schedule headings projected as separate coverages when they only introduce the next coverage group.
4174
+ - Generic policy form rows projected as scheduled coverages when their values only say "as stated in Item...", "shown in the Declarations", or similar cross-references instead of actual scheduled amounts.
4169
4175
 
4170
4176
  Rules:
4171
4177
  - Use internal reasoning, but return JSON decisions only.
@@ -4178,6 +4184,7 @@ Rules:
4178
4184
  - Add termAdditions only when a provided source node directly supports the missing term and the candidate already has the correct coverage row.
4179
4185
  - When replacing one combined term with split terms, drop the combined term and add one term per basis. For example, "$1,000,000 Each Claim / Aggregate" should become one each_claim_limit term and one aggregate_limit term, both with value "$1,000,000".
4180
4186
  - When a schedule continues onto the next page before the next item marker, attach continuation terms such as "Aggregate", "Policy Aggregate", coinsurance, deductible, or retroactive date to the previous coverage row.
4187
+ - Drop a coverage row when it is only generic policy wording that points back to a declarations item or schedule and does not itself state policy-specific limits, deductibles, retentions, premiums, dates, or coverage names.
4181
4188
  - Include every JSON key in each decision. Use null for scalar fields you are not changing and [] for source ID lists you are not changing.
4182
4189
  - For each coverage decision, always include termDecisions and termAdditions. Use [] when no existing terms need cleanup or no new terms are needed.
4183
4190
  - Keep reasons concise and factual.