@absolutejs/absolute 0.19.0-beta.611 → 0.19.0-beta.612

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.
@@ -1748,6 +1748,8 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
1748
1748
  }
1749
1749
  const diagnostics = [...sections.values()];
1750
1750
  const strongestBestHit = diagnostics.reduce((highest, section) => Math.max(highest, section.bestScore), 0);
1751
+ const parentLabelByKey = new Map(diagnostics.map((section) => [section.key, section.parentLabel]));
1752
+ const stageSectionCounts = new Map((trace?.steps ?? []).filter((step) => Array.isArray(step.sectionCounts) && step.sectionCounts.length > 0).map((step) => [step.stage, step.sectionCounts ?? []]));
1751
1753
  return diagnostics.map((section) => {
1752
1754
  const siblingPool = diagnostics.filter((entry) => entry.parentLabel === section.parentLabel);
1753
1755
  const siblings = siblingPool.filter((entry) => entry.key !== section.key);
@@ -1768,6 +1770,42 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
1768
1770
  count: step.sectionCounts?.find((entry) => entry.key === section.key)?.count ?? 0,
1769
1771
  stage: step.stage
1770
1772
  })).filter((entry) => entry.count > 0) ?? [];
1773
+ const stageWeights = stageCounts.map((entry) => {
1774
+ const stageEntries = stageSectionCounts.get(entry.stage)?.filter((candidate) => candidate.count > 0) ?? [];
1775
+ const stageTotal = stageEntries.reduce((sum, candidate) => sum + candidate.count, 0);
1776
+ const siblingStageEntries = stageEntries.filter((candidate) => candidate.key !== section.key && parentLabelByKey.get(candidate.key) === section.parentLabel);
1777
+ const parentStageEntries = stageEntries.filter((candidate) => parentLabelByKey.get(candidate.key) === section.parentLabel);
1778
+ const strongestStageSibling = siblingStageEntries.slice().sort((left, right) => right.count - left.count)[0];
1779
+ const parentStageTotal = parentStageEntries.reduce((sum, candidate) => sum + candidate.count, 0);
1780
+ const stageShare = stageTotal > 0 ? entry.count / stageTotal : 0;
1781
+ const parentStageShare = parentStageTotal > 0 ? entry.count / parentStageTotal : undefined;
1782
+ const stageShareGap = stageTotal > 0 && strongestStageSibling ? entry.count / stageTotal - strongestStageSibling.count / stageTotal : undefined;
1783
+ const parentStageShareGap = parentStageTotal > 0 && strongestStageSibling ? entry.count / parentStageTotal - strongestStageSibling.count / parentStageTotal : undefined;
1784
+ const reasons2 = [];
1785
+ if (entry.stage === "rerank" && stageShare > 0.5 && (typeof stageShareGap !== "number" || stageShareGap > 0)) {
1786
+ reasons2.push("rerank_preserved_lead");
1787
+ }
1788
+ if (entry.stage === "finalize" && stageShare >= 0.5) {
1789
+ reasons2.push("final_stage_concentration");
1790
+ }
1791
+ if (entry.stage === "finalize" && typeof parentStageShare === "number" && parentStageShare >= 0.6 && (typeof parentStageShareGap !== "number" || parentStageShareGap > 0)) {
1792
+ reasons2.push("final_stage_dominant_within_parent");
1793
+ }
1794
+ if (strongestStageSibling && (typeof stageShareGap === "number" && stageShareGap <= 0.1 || typeof parentStageShareGap === "number" && parentStageShareGap <= 0.1)) {
1795
+ reasons2.push("stage_runner_up_pressure");
1796
+ }
1797
+ return {
1798
+ count: entry.count,
1799
+ parentStageShare,
1800
+ parentStageShareGap,
1801
+ reasons: reasons2,
1802
+ stage: entry.stage,
1803
+ stageShare,
1804
+ stageShareGap,
1805
+ strongestSiblingCount: strongestStageSibling?.count,
1806
+ strongestSiblingLabel: strongestStageSibling ? diagnostics.find((candidate) => candidate.key === strongestStageSibling.key)?.label ?? strongestStageSibling.key : undefined
1807
+ };
1808
+ });
1771
1809
  const firstSeenStage = stageCounts[0]?.stage;
1772
1810
  const lastSeenStage = stageCounts.at(-1)?.stage;
1773
1811
  if (section.bestScore >= strongestBestHit) {
@@ -1810,6 +1848,7 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
1810
1848
  scoreShare,
1811
1849
  scoreThresholdApplied: trace?.steps.some((step) => step.stage === "score_filter"),
1812
1850
  stageCounts,
1851
+ stageWeights,
1813
1852
  siblingCount: siblings.length,
1814
1853
  siblingScoreGap: strongestSibling ? section.totalScore - strongestSibling.totalScore : undefined,
1815
1854
  sourceCount: section.sourceSet.size,
@@ -1708,6 +1708,8 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
1708
1708
  }
1709
1709
  const diagnostics = [...sections.values()];
1710
1710
  const strongestBestHit = diagnostics.reduce((highest, section) => Math.max(highest, section.bestScore), 0);
1711
+ const parentLabelByKey = new Map(diagnostics.map((section) => [section.key, section.parentLabel]));
1712
+ const stageSectionCounts = new Map((trace?.steps ?? []).filter((step) => Array.isArray(step.sectionCounts) && step.sectionCounts.length > 0).map((step) => [step.stage, step.sectionCounts ?? []]));
1711
1713
  return diagnostics.map((section) => {
1712
1714
  const siblingPool = diagnostics.filter((entry) => entry.parentLabel === section.parentLabel);
1713
1715
  const siblings = siblingPool.filter((entry) => entry.key !== section.key);
@@ -1728,6 +1730,42 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
1728
1730
  count: step.sectionCounts?.find((entry) => entry.key === section.key)?.count ?? 0,
1729
1731
  stage: step.stage
1730
1732
  })).filter((entry) => entry.count > 0) ?? [];
1733
+ const stageWeights = stageCounts.map((entry) => {
1734
+ const stageEntries = stageSectionCounts.get(entry.stage)?.filter((candidate) => candidate.count > 0) ?? [];
1735
+ const stageTotal = stageEntries.reduce((sum, candidate) => sum + candidate.count, 0);
1736
+ const siblingStageEntries = stageEntries.filter((candidate) => candidate.key !== section.key && parentLabelByKey.get(candidate.key) === section.parentLabel);
1737
+ const parentStageEntries = stageEntries.filter((candidate) => parentLabelByKey.get(candidate.key) === section.parentLabel);
1738
+ const strongestStageSibling = siblingStageEntries.slice().sort((left, right) => right.count - left.count)[0];
1739
+ const parentStageTotal = parentStageEntries.reduce((sum, candidate) => sum + candidate.count, 0);
1740
+ const stageShare = stageTotal > 0 ? entry.count / stageTotal : 0;
1741
+ const parentStageShare = parentStageTotal > 0 ? entry.count / parentStageTotal : undefined;
1742
+ const stageShareGap = stageTotal > 0 && strongestStageSibling ? entry.count / stageTotal - strongestStageSibling.count / stageTotal : undefined;
1743
+ const parentStageShareGap = parentStageTotal > 0 && strongestStageSibling ? entry.count / parentStageTotal - strongestStageSibling.count / parentStageTotal : undefined;
1744
+ const reasons2 = [];
1745
+ if (entry.stage === "rerank" && stageShare > 0.5 && (typeof stageShareGap !== "number" || stageShareGap > 0)) {
1746
+ reasons2.push("rerank_preserved_lead");
1747
+ }
1748
+ if (entry.stage === "finalize" && stageShare >= 0.5) {
1749
+ reasons2.push("final_stage_concentration");
1750
+ }
1751
+ if (entry.stage === "finalize" && typeof parentStageShare === "number" && parentStageShare >= 0.6 && (typeof parentStageShareGap !== "number" || parentStageShareGap > 0)) {
1752
+ reasons2.push("final_stage_dominant_within_parent");
1753
+ }
1754
+ if (strongestStageSibling && (typeof stageShareGap === "number" && stageShareGap <= 0.1 || typeof parentStageShareGap === "number" && parentStageShareGap <= 0.1)) {
1755
+ reasons2.push("stage_runner_up_pressure");
1756
+ }
1757
+ return {
1758
+ count: entry.count,
1759
+ parentStageShare,
1760
+ parentStageShareGap,
1761
+ reasons: reasons2,
1762
+ stage: entry.stage,
1763
+ stageShare,
1764
+ stageShareGap,
1765
+ strongestSiblingCount: strongestStageSibling?.count,
1766
+ strongestSiblingLabel: strongestStageSibling ? diagnostics.find((candidate) => candidate.key === strongestStageSibling.key)?.label ?? strongestStageSibling.key : undefined
1767
+ };
1768
+ });
1731
1769
  const firstSeenStage = stageCounts[0]?.stage;
1732
1770
  const lastSeenStage = stageCounts.at(-1)?.stage;
1733
1771
  if (section.bestScore >= strongestBestHit) {
@@ -1770,6 +1808,7 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
1770
1808
  scoreShare,
1771
1809
  scoreThresholdApplied: trace?.steps.some((step) => step.stage === "score_filter"),
1772
1810
  stageCounts,
1811
+ stageWeights,
1773
1812
  siblingCount: siblings.length,
1774
1813
  siblingScoreGap: strongestSibling ? section.totalScore - strongestSibling.totalScore : undefined,
1775
1814
  sourceCount: section.sourceSet.size,
@@ -2751,6 +2751,8 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
2751
2751
  }
2752
2752
  const diagnostics = [...sections.values()];
2753
2753
  const strongestBestHit = diagnostics.reduce((highest, section) => Math.max(highest, section.bestScore), 0);
2754
+ const parentLabelByKey = new Map(diagnostics.map((section) => [section.key, section.parentLabel]));
2755
+ const stageSectionCounts = new Map((trace?.steps ?? []).filter((step) => Array.isArray(step.sectionCounts) && step.sectionCounts.length > 0).map((step) => [step.stage, step.sectionCounts ?? []]));
2754
2756
  return diagnostics.map((section) => {
2755
2757
  const siblingPool = diagnostics.filter((entry) => entry.parentLabel === section.parentLabel);
2756
2758
  const siblings = siblingPool.filter((entry) => entry.key !== section.key);
@@ -2771,6 +2773,42 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
2771
2773
  count: step.sectionCounts?.find((entry) => entry.key === section.key)?.count ?? 0,
2772
2774
  stage: step.stage
2773
2775
  })).filter((entry) => entry.count > 0) ?? [];
2776
+ const stageWeights = stageCounts.map((entry) => {
2777
+ const stageEntries = stageSectionCounts.get(entry.stage)?.filter((candidate) => candidate.count > 0) ?? [];
2778
+ const stageTotal = stageEntries.reduce((sum, candidate) => sum + candidate.count, 0);
2779
+ const siblingStageEntries = stageEntries.filter((candidate) => candidate.key !== section.key && parentLabelByKey.get(candidate.key) === section.parentLabel);
2780
+ const parentStageEntries = stageEntries.filter((candidate) => parentLabelByKey.get(candidate.key) === section.parentLabel);
2781
+ const strongestStageSibling = siblingStageEntries.slice().sort((left, right) => right.count - left.count)[0];
2782
+ const parentStageTotal = parentStageEntries.reduce((sum, candidate) => sum + candidate.count, 0);
2783
+ const stageShare = stageTotal > 0 ? entry.count / stageTotal : 0;
2784
+ const parentStageShare = parentStageTotal > 0 ? entry.count / parentStageTotal : undefined;
2785
+ const stageShareGap = stageTotal > 0 && strongestStageSibling ? entry.count / stageTotal - strongestStageSibling.count / stageTotal : undefined;
2786
+ const parentStageShareGap = parentStageTotal > 0 && strongestStageSibling ? entry.count / parentStageTotal - strongestStageSibling.count / parentStageTotal : undefined;
2787
+ const reasons2 = [];
2788
+ if (entry.stage === "rerank" && stageShare > 0.5 && (typeof stageShareGap !== "number" || stageShareGap > 0)) {
2789
+ reasons2.push("rerank_preserved_lead");
2790
+ }
2791
+ if (entry.stage === "finalize" && stageShare >= 0.5) {
2792
+ reasons2.push("final_stage_concentration");
2793
+ }
2794
+ if (entry.stage === "finalize" && typeof parentStageShare === "number" && parentStageShare >= 0.6 && (typeof parentStageShareGap !== "number" || parentStageShareGap > 0)) {
2795
+ reasons2.push("final_stage_dominant_within_parent");
2796
+ }
2797
+ if (strongestStageSibling && (typeof stageShareGap === "number" && stageShareGap <= 0.1 || typeof parentStageShareGap === "number" && parentStageShareGap <= 0.1)) {
2798
+ reasons2.push("stage_runner_up_pressure");
2799
+ }
2800
+ return {
2801
+ count: entry.count,
2802
+ parentStageShare,
2803
+ parentStageShareGap,
2804
+ reasons: reasons2,
2805
+ stage: entry.stage,
2806
+ stageShare,
2807
+ stageShareGap,
2808
+ strongestSiblingCount: strongestStageSibling?.count,
2809
+ strongestSiblingLabel: strongestStageSibling ? diagnostics.find((candidate) => candidate.key === strongestStageSibling.key)?.label ?? strongestStageSibling.key : undefined
2810
+ };
2811
+ });
2774
2812
  const firstSeenStage = stageCounts[0]?.stage;
2775
2813
  const lastSeenStage = stageCounts.at(-1)?.stage;
2776
2814
  if (section.bestScore >= strongestBestHit) {
@@ -2813,6 +2851,7 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
2813
2851
  scoreShare,
2814
2852
  scoreThresholdApplied: trace?.steps.some((step) => step.stage === "score_filter"),
2815
2853
  stageCounts,
2854
+ stageWeights,
2816
2855
  siblingCount: siblings.length,
2817
2856
  siblingScoreGap: strongestSibling ? section.totalScore - strongestSibling.totalScore : undefined,
2818
2857
  sourceCount: section.sourceSet.size,
@@ -2298,6 +2298,8 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
2298
2298
  }
2299
2299
  const diagnostics = [...sections.values()];
2300
2300
  const strongestBestHit = diagnostics.reduce((highest, section) => Math.max(highest, section.bestScore), 0);
2301
+ const parentLabelByKey = new Map(diagnostics.map((section) => [section.key, section.parentLabel]));
2302
+ const stageSectionCounts = new Map((trace?.steps ?? []).filter((step) => Array.isArray(step.sectionCounts) && step.sectionCounts.length > 0).map((step) => [step.stage, step.sectionCounts ?? []]));
2301
2303
  return diagnostics.map((section) => {
2302
2304
  const siblingPool = diagnostics.filter((entry) => entry.parentLabel === section.parentLabel);
2303
2305
  const siblings = siblingPool.filter((entry) => entry.key !== section.key);
@@ -2318,6 +2320,42 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
2318
2320
  count: step.sectionCounts?.find((entry) => entry.key === section.key)?.count ?? 0,
2319
2321
  stage: step.stage
2320
2322
  })).filter((entry) => entry.count > 0) ?? [];
2323
+ const stageWeights = stageCounts.map((entry) => {
2324
+ const stageEntries = stageSectionCounts.get(entry.stage)?.filter((candidate) => candidate.count > 0) ?? [];
2325
+ const stageTotal = stageEntries.reduce((sum, candidate) => sum + candidate.count, 0);
2326
+ const siblingStageEntries = stageEntries.filter((candidate) => candidate.key !== section.key && parentLabelByKey.get(candidate.key) === section.parentLabel);
2327
+ const parentStageEntries = stageEntries.filter((candidate) => parentLabelByKey.get(candidate.key) === section.parentLabel);
2328
+ const strongestStageSibling = siblingStageEntries.slice().sort((left, right) => right.count - left.count)[0];
2329
+ const parentStageTotal = parentStageEntries.reduce((sum, candidate) => sum + candidate.count, 0);
2330
+ const stageShare = stageTotal > 0 ? entry.count / stageTotal : 0;
2331
+ const parentStageShare = parentStageTotal > 0 ? entry.count / parentStageTotal : undefined;
2332
+ const stageShareGap = stageTotal > 0 && strongestStageSibling ? entry.count / stageTotal - strongestStageSibling.count / stageTotal : undefined;
2333
+ const parentStageShareGap = parentStageTotal > 0 && strongestStageSibling ? entry.count / parentStageTotal - strongestStageSibling.count / parentStageTotal : undefined;
2334
+ const reasons2 = [];
2335
+ if (entry.stage === "rerank" && stageShare > 0.5 && (typeof stageShareGap !== "number" || stageShareGap > 0)) {
2336
+ reasons2.push("rerank_preserved_lead");
2337
+ }
2338
+ if (entry.stage === "finalize" && stageShare >= 0.5) {
2339
+ reasons2.push("final_stage_concentration");
2340
+ }
2341
+ if (entry.stage === "finalize" && typeof parentStageShare === "number" && parentStageShare >= 0.6 && (typeof parentStageShareGap !== "number" || parentStageShareGap > 0)) {
2342
+ reasons2.push("final_stage_dominant_within_parent");
2343
+ }
2344
+ if (strongestStageSibling && (typeof stageShareGap === "number" && stageShareGap <= 0.1 || typeof parentStageShareGap === "number" && parentStageShareGap <= 0.1)) {
2345
+ reasons2.push("stage_runner_up_pressure");
2346
+ }
2347
+ return {
2348
+ count: entry.count,
2349
+ parentStageShare,
2350
+ parentStageShareGap,
2351
+ reasons: reasons2,
2352
+ stage: entry.stage,
2353
+ stageShare,
2354
+ stageShareGap,
2355
+ strongestSiblingCount: strongestStageSibling?.count,
2356
+ strongestSiblingLabel: strongestStageSibling ? diagnostics.find((candidate) => candidate.key === strongestStageSibling.key)?.label ?? strongestStageSibling.key : undefined
2357
+ };
2358
+ });
2321
2359
  const firstSeenStage = stageCounts[0]?.stage;
2322
2360
  const lastSeenStage = stageCounts.at(-1)?.stage;
2323
2361
  if (section.bestScore >= strongestBestHit) {
@@ -2360,6 +2398,7 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
2360
2398
  scoreShare,
2361
2399
  scoreThresholdApplied: trace?.steps.some((step) => step.stage === "score_filter"),
2362
2400
  stageCounts,
2401
+ stageWeights,
2363
2402
  siblingCount: siblings.length,
2364
2403
  siblingScoreGap: strongestSibling ? section.totalScore - strongestSibling.totalScore : undefined,
2365
2404
  sourceCount: section.sourceSet.size,
@@ -4549,5 +4588,5 @@ export {
4549
4588
  AIStreamService
4550
4589
  };
4551
4590
 
4552
- //# debugId=458F3E73F2A0F43C64756E2164756E21
4591
+ //# debugId=4DB0513163E0BB7564756E2164756E21
4553
4592
  //# sourceMappingURL=index.js.map