@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.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,
@@ -4173,6 +4178,7 @@ Rules:
4173
4178
  - Use sourceNodeIds and sourceSpanIds only from the provided source nodes or from the existing candidate entry.
4174
4179
  - Prefer dropping a malformed fact over speculative rewriting.
4175
4180
  - Keep a coverage when it is a real operational coverage/benefit even if only one term needs cleanup.
4181
+ - 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.
4176
4182
  - When changing a term's semantic meaning, set kind to the corrected normalized term kind.
4177
4183
  - Do not add new coverage rows.
4178
4184
  - Add termAdditions only when a provided source node directly supports the missing term and the candidate already has the correct coverage row.