@claritylabs/cl-sdk 3.1.24 → 3.1.26

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
@@ -10537,6 +10537,7 @@ Rules:
10537
10537
  - Every returned value must include sourceNodeIds or sourceSpanIds from the provided nodes.
10538
10538
  - If a value is not directly supported, omit it.
10539
10539
  - Prefer declarations, schedules, premium tables, and endorsement schedules over generic policy wording.
10540
+ - For broker/producer, extract the agency or company legal name, not the license role, credential, or type. In a block like "Bayshore Insurance Brokers, LLC" followed by "Surplus Lines Broker - CA License No. ...", broker.value must be "Bayshore Insurance Brokers, LLC"; the surplus-lines role and license number are not the broker name.
10540
10541
  - On declarations pages, treat "Item N" labels as section boundaries. Use Item 6 or equivalent coverage-schedule rows for coverage limits, deductibles, aggregate terms, and retroactive dates; do not merge Item 7 premium, Item 8 ERP, Item 9 producer, or Item 10 forms into Item 6 coverage facts.
10541
10542
  - A coverage schedule row's coverage name should come from the "Coverage Part" or equivalent row label. Limit, deductible, aggregate, sublimit, retention, and retroactive-date values belong as nested terms under that coverage, not in the coverage title.
10542
10543
  - If a coverage schedule continues onto the next page before the next item marker, include the continuation rows in the same coverage or declaration item.
@@ -10556,63 +10557,6 @@ ${JSON.stringify(nodes, null, 2)}
10556
10557
 
10557
10558
  Return JSON for the operational profile.`;
10558
10559
  }
10559
- function tableCellValueText(cell) {
10560
- return cleanText(cell.textExcerpt ?? cell.description ?? "", "");
10561
- }
10562
- function tableRowTextFromCells(cells) {
10563
- const text = cells.map((cell) => {
10564
- const label = cleanText(cell.title, "");
10565
- const value = tableCellValueText(cell);
10566
- if (!value) return label;
10567
- if (!label || value.toLowerCase() === label.toLowerCase()) return value;
10568
- return `${label}: ${value}`;
10569
- }).filter(Boolean).join(" | ");
10570
- return text ? cleanText(text, text) : void 0;
10571
- }
10572
- function normalizeTableBoundaryDelimiters(value) {
10573
- const text = cleanText(value, "");
10574
- if (!text) return void 0;
10575
- const normalized = text.replace(/\s+\|\s+\|/g, " | ").replace(/\s+\/\s+\|/g, " |").replace(/\s+[|/]\s*$/g, "").replace(/\s{2,}/g, " ").trim();
10576
- return normalized || void 0;
10577
- }
10578
- function normalizeSourceTreeTableDisplayText(sourceTree) {
10579
- const byParent = nodesByParent(sourceTree);
10580
- const updates = /* @__PURE__ */ new Map();
10581
- const currentNode = (node) => updates.get(node.id) ?? node;
10582
- for (const node of sourceTree) {
10583
- if (node.kind !== "table_cell") continue;
10584
- const textExcerpt = normalizeTableBoundaryDelimiters(node.textExcerpt);
10585
- const textChanged = textExcerpt !== void 0 && textExcerpt !== node.textExcerpt;
10586
- const description = textChanged && textExcerpt ? normalizeTableBoundaryDelimiters([node.title, textExcerpt].filter(Boolean).join(" | ")) : normalizeTableBoundaryDelimiters(node.description);
10587
- if (textExcerpt === node.textExcerpt && description === node.description) continue;
10588
- updates.set(node.id, {
10589
- ...node,
10590
- ...textExcerpt !== void 0 ? { textExcerpt } : {},
10591
- ...description !== void 0 ? { description } : {}
10592
- });
10593
- }
10594
- for (const node of sourceTree) {
10595
- if (node.kind !== "table_row") continue;
10596
- const cells = (byParent.get(node.id) ?? []).filter((child) => child.kind === "table_cell").map(currentNode).sort(
10597
- (left, right) => tableCellColumnIndex(left, 0) - tableCellColumnIndex(right, 0) || left.order - right.order || left.id.localeCompare(right.id)
10598
- );
10599
- const textExcerpt = cells.length ? tableRowTextFromCells(cells) : normalizeTableBoundaryDelimiters(node.textExcerpt);
10600
- const textChanged = textExcerpt !== void 0 && textExcerpt !== node.textExcerpt;
10601
- const description = textChanged && textExcerpt ? normalizeTableBoundaryDelimiters([node.title, textExcerpt].filter(Boolean).join(" | ")) : normalizeTableBoundaryDelimiters(node.description);
10602
- if (textExcerpt === node.textExcerpt && description === node.description) continue;
10603
- updates.set(node.id, {
10604
- ...node,
10605
- ...textExcerpt !== void 0 ? { textExcerpt } : {},
10606
- ...description !== void 0 ? { description } : {}
10607
- });
10608
- }
10609
- if (updates.size === 0) return sourceTree;
10610
- return sourceTree.map((node) => updates.get(node.id) ?? node);
10611
- }
10612
- function tableCellColumnIndex(cell, fallbackIndex) {
10613
- const metadataIndex = cell.metadata?.columnIndex;
10614
- return typeof metadataIndex === "number" && Number.isInteger(metadataIndex) ? metadataIndex : fallbackIndex;
10615
- }
10616
10560
  function sourceTreeToOutline(sourceTree) {
10617
10561
  const byParent = /* @__PURE__ */ new Map();
10618
10562
  for (const node of sourceTree.filter((item) => item.kind !== "document")) {
@@ -10859,7 +10803,6 @@ async function runSourceTreeExtraction(params) {
10859
10803
  }
10860
10804
  params.trackUsage(usage, report);
10861
10805
  };
10862
- sourceTree = normalizeSourceTreeTableDisplayText(sourceTree);
10863
10806
  const emptyProfile = emptyOperationalProfile();
10864
10807
  let operationalProfile = emptyProfile;
10865
10808
  try {