@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.mjs CHANGED
@@ -3618,6 +3618,7 @@ var CLEANUP_CANDIDATE_ID_LIMIT = 12;
3618
3618
  var CLEANUP_SOURCE_NODE_LIMIT = 90;
3619
3619
  var CLEANUP_SIBLING_WINDOW = 4;
3620
3620
  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;
3621
+ 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;
3621
3622
  function compactNode(node, maxText = 700) {
3622
3623
  return {
3623
3624
  id: node.id,
@@ -3746,11 +3747,15 @@ function selectCoverageCleanupNodes(sourceTree, coverages) {
3746
3747
  const children = childrenByParent.get(selectedNode.id) ?? [];
3747
3748
  for (const child of children.slice(0, 24)) addNode(child, 760);
3748
3749
  }
3750
+ const continuationPages = new Set([...coveragePages].map((page) => page + 1));
3749
3751
  for (const node of sourceTree) {
3750
3752
  if (node.kind === "document") continue;
3751
- if (!node.pageStart || !coveragePages.has(node.pageStart)) continue;
3753
+ if (typeof node.pageStart !== "number") continue;
3754
+ const samePage = coveragePages.has(node.pageStart);
3755
+ const nearbyContinuationPage = continuationPages.has(node.pageStart);
3756
+ if (!samePage && !nearbyContinuationPage) continue;
3752
3757
  const text = nodeTextForSelection(node);
3753
- if (CLEANUP_KEYWORD.test(text) || nodeTextMatchesCoverage(node, coverageTerms)) {
3758
+ if (CLEANUP_KEYWORD.test(text) || nodeTextMatchesCoverage(node, coverageTerms) || nearbyContinuationPage && CLEANUP_CONTINUATION_KEYWORD.test(text)) {
3754
3759
  addNode(node, 600);
3755
3760
  }
3756
3761
  }
@@ -3764,7 +3769,7 @@ function buildOperationalProfileCleanupPrompt(sourceTree, profile, options = {})
3764
3769
  const coverageEntries = coverageCleanupEntries(profile, options.coverageIndexes);
3765
3770
  const nodes = selectCoverageCleanupNodes(sourceTree, coverageEntries.map((entry) => entry.coverage)).map((node) => compactNode(
3766
3771
  node,
3767
- node.kind === "page" || node.kind === "page_group" ? 260 : node.kind === "table_row" || node.kind === "table_cell" ? 520 : 360
3772
+ node.kind === "page" || node.kind === "page_group" ? 520 : node.kind === "table_row" || node.kind === "table_cell" ? 520 : 360
3768
3773
  ));
3769
3774
  const candidate = {
3770
3775
  documentType: profile.documentType,
@@ -3790,6 +3795,7 @@ Projection defects to look for:
3790
3795
  - Header/value splits where "Limit of Liability", "Deductible", "Retroactive Date", "Aggregate", "Each Claim", or similar terms are attached to the wrong coverage row.
3791
3796
  - 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.
3792
3797
  - Repeated schedule headings projected as separate coverages when they only introduce the next coverage group.
3798
+ - 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.
3793
3799
 
3794
3800
  Rules:
3795
3801
  - Use internal reasoning, but return JSON decisions only.
@@ -3802,6 +3808,7 @@ Rules:
3802
3808
  - Add termAdditions only when a provided source node directly supports the missing term and the candidate already has the correct coverage row.
3803
3809
  - 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".
3804
3810
  - 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.
3811
+ - 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.
3805
3812
  - 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.
3806
3813
  - For each coverage decision, always include termDecisions and termAdditions. Use [] when no existing terms need cleanup or no new terms are needed.
3807
3814
  - Keep reasons concise and factual.