@claritylabs/cl-sdk 3.2.6 → 3.2.8

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,
@@ -3797,6 +3802,7 @@ Rules:
3797
3802
  - Use sourceNodeIds and sourceSpanIds only from the provided source nodes or from the existing candidate entry.
3798
3803
  - Prefer dropping a malformed fact over speculative rewriting.
3799
3804
  - Keep a coverage when it is a real operational coverage/benefit even if only one term needs cleanup.
3805
+ - Never drop a declaration or schedule coverage row that names a coverage and states policy-specific amounts, dates, deductibles, retentions, premiums, or coverage terms. Repair its terms instead.
3800
3806
  - When changing a term's semantic meaning, set kind to the corrected normalized term kind.
3801
3807
  - Do not add new coverage rows.
3802
3808
  - Add termAdditions only when a provided source node directly supports the missing term and the candidate already has the correct coverage row.