@absolutejs/absolute 0.19.0-beta.610 → 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.
- package/dist/ai/client/index.js +49 -1
- package/dist/ai/client/index.js.map +3 -3
- package/dist/ai/client/ui.js +49 -1
- package/dist/ai/client/ui.js.map +3 -3
- package/dist/ai/index.js +85 -2
- package/dist/ai/index.js.map +5 -5
- package/dist/ai/rag/ui.js +49 -1
- package/dist/ai/rag/ui.js.map +3 -3
- package/dist/ai-client/angular/ai/index.js +48 -0
- package/dist/ai-client/react/ai/index.js +48 -0
- package/dist/ai-client/vue/ai/index.js +48 -0
- package/dist/angular/ai/index.js +49 -1
- package/dist/angular/ai/index.js.map +3 -3
- package/dist/react/ai/index.js +49 -1
- package/dist/react/ai/index.js.map +3 -3
- package/dist/svelte/ai/index.js +49 -1
- package/dist/svelte/ai/index.js.map +3 -3
- package/dist/types/ai.d.ts +23 -0
- package/dist/vue/ai/index.js +49 -1
- package/dist/vue/ai/index.js.map +3 -3
- package/package.json +1 -1
|
@@ -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);
|
|
@@ -1764,6 +1766,48 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
|
|
|
1764
1766
|
totalScore: entry.totalScore
|
|
1765
1767
|
})).sort((left, right) => right.totalScore - left.totalScore) : [];
|
|
1766
1768
|
const reasons = [];
|
|
1769
|
+
const stageCounts = trace?.steps.map((step) => ({
|
|
1770
|
+
count: step.sectionCounts?.find((entry) => entry.key === section.key)?.count ?? 0,
|
|
1771
|
+
stage: step.stage
|
|
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
|
+
});
|
|
1809
|
+
const firstSeenStage = stageCounts[0]?.stage;
|
|
1810
|
+
const lastSeenStage = stageCounts.at(-1)?.stage;
|
|
1767
1811
|
if (section.bestScore >= strongestBestHit) {
|
|
1768
1812
|
reasons.push("best_hit");
|
|
1769
1813
|
}
|
|
@@ -1796,11 +1840,15 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
|
|
|
1796
1840
|
parentShare,
|
|
1797
1841
|
parentShareGap: typeof parentShare === "number" && strongestSibling && parentTotal > 0 ? parentShare - strongestSibling.totalScore / parentTotal : undefined,
|
|
1798
1842
|
path: section.path,
|
|
1843
|
+
firstSeenStage,
|
|
1844
|
+
lastSeenStage,
|
|
1799
1845
|
retrievalMode: trace?.mode,
|
|
1800
1846
|
reasons,
|
|
1801
1847
|
rerankApplied: trace?.steps.some((step) => step.stage === "rerank" && step.metadata?.applied === true),
|
|
1802
1848
|
scoreShare,
|
|
1803
1849
|
scoreThresholdApplied: trace?.steps.some((step) => step.stage === "score_filter"),
|
|
1850
|
+
stageCounts,
|
|
1851
|
+
stageWeights,
|
|
1804
1852
|
siblingCount: siblings.length,
|
|
1805
1853
|
siblingScoreGap: strongestSibling ? section.totalScore - strongestSibling.totalScore : undefined,
|
|
1806
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);
|
|
@@ -1724,6 +1726,48 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
|
|
|
1724
1726
|
totalScore: entry.totalScore
|
|
1725
1727
|
})).sort((left, right) => right.totalScore - left.totalScore) : [];
|
|
1726
1728
|
const reasons = [];
|
|
1729
|
+
const stageCounts = trace?.steps.map((step) => ({
|
|
1730
|
+
count: step.sectionCounts?.find((entry) => entry.key === section.key)?.count ?? 0,
|
|
1731
|
+
stage: step.stage
|
|
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
|
+
});
|
|
1769
|
+
const firstSeenStage = stageCounts[0]?.stage;
|
|
1770
|
+
const lastSeenStage = stageCounts.at(-1)?.stage;
|
|
1727
1771
|
if (section.bestScore >= strongestBestHit) {
|
|
1728
1772
|
reasons.push("best_hit");
|
|
1729
1773
|
}
|
|
@@ -1756,11 +1800,15 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
|
|
|
1756
1800
|
parentShare,
|
|
1757
1801
|
parentShareGap: typeof parentShare === "number" && strongestSibling && parentTotal > 0 ? parentShare - strongestSibling.totalScore / parentTotal : undefined,
|
|
1758
1802
|
path: section.path,
|
|
1803
|
+
firstSeenStage,
|
|
1804
|
+
lastSeenStage,
|
|
1759
1805
|
retrievalMode: trace?.mode,
|
|
1760
1806
|
reasons,
|
|
1761
1807
|
rerankApplied: trace?.steps.some((step) => step.stage === "rerank" && step.metadata?.applied === true),
|
|
1762
1808
|
scoreShare,
|
|
1763
1809
|
scoreThresholdApplied: trace?.steps.some((step) => step.stage === "score_filter"),
|
|
1810
|
+
stageCounts,
|
|
1811
|
+
stageWeights,
|
|
1764
1812
|
siblingCount: siblings.length,
|
|
1765
1813
|
siblingScoreGap: strongestSibling ? section.totalScore - strongestSibling.totalScore : undefined,
|
|
1766
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);
|
|
@@ -2767,6 +2769,48 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
|
|
|
2767
2769
|
totalScore: entry.totalScore
|
|
2768
2770
|
})).sort((left, right) => right.totalScore - left.totalScore) : [];
|
|
2769
2771
|
const reasons = [];
|
|
2772
|
+
const stageCounts = trace?.steps.map((step) => ({
|
|
2773
|
+
count: step.sectionCounts?.find((entry) => entry.key === section.key)?.count ?? 0,
|
|
2774
|
+
stage: step.stage
|
|
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
|
+
});
|
|
2812
|
+
const firstSeenStage = stageCounts[0]?.stage;
|
|
2813
|
+
const lastSeenStage = stageCounts.at(-1)?.stage;
|
|
2770
2814
|
if (section.bestScore >= strongestBestHit) {
|
|
2771
2815
|
reasons.push("best_hit");
|
|
2772
2816
|
}
|
|
@@ -2799,11 +2843,15 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
|
|
|
2799
2843
|
parentShare,
|
|
2800
2844
|
parentShareGap: typeof parentShare === "number" && strongestSibling && parentTotal > 0 ? parentShare - strongestSibling.totalScore / parentTotal : undefined,
|
|
2801
2845
|
path: section.path,
|
|
2846
|
+
firstSeenStage,
|
|
2847
|
+
lastSeenStage,
|
|
2802
2848
|
retrievalMode: trace?.mode,
|
|
2803
2849
|
reasons,
|
|
2804
2850
|
rerankApplied: trace?.steps.some((step) => step.stage === "rerank" && step.metadata?.applied === true),
|
|
2805
2851
|
scoreShare,
|
|
2806
2852
|
scoreThresholdApplied: trace?.steps.some((step) => step.stage === "score_filter"),
|
|
2853
|
+
stageCounts,
|
|
2854
|
+
stageWeights,
|
|
2807
2855
|
siblingCount: siblings.length,
|
|
2808
2856
|
siblingScoreGap: strongestSibling ? section.totalScore - strongestSibling.totalScore : undefined,
|
|
2809
2857
|
sourceCount: section.sourceSet.size,
|
package/dist/angular/ai/index.js
CHANGED
|
@@ -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);
|
|
@@ -2314,6 +2316,48 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
|
|
|
2314
2316
|
totalScore: entry.totalScore
|
|
2315
2317
|
})).sort((left, right) => right.totalScore - left.totalScore) : [];
|
|
2316
2318
|
const reasons = [];
|
|
2319
|
+
const stageCounts = trace?.steps.map((step) => ({
|
|
2320
|
+
count: step.sectionCounts?.find((entry) => entry.key === section.key)?.count ?? 0,
|
|
2321
|
+
stage: step.stage
|
|
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
|
+
});
|
|
2359
|
+
const firstSeenStage = stageCounts[0]?.stage;
|
|
2360
|
+
const lastSeenStage = stageCounts.at(-1)?.stage;
|
|
2317
2361
|
if (section.bestScore >= strongestBestHit) {
|
|
2318
2362
|
reasons.push("best_hit");
|
|
2319
2363
|
}
|
|
@@ -2346,11 +2390,15 @@ var buildRAGSectionRetrievalDiagnostics = (sources, trace) => {
|
|
|
2346
2390
|
parentShare,
|
|
2347
2391
|
parentShareGap: typeof parentShare === "number" && strongestSibling && parentTotal > 0 ? parentShare - strongestSibling.totalScore / parentTotal : undefined,
|
|
2348
2392
|
path: section.path,
|
|
2393
|
+
firstSeenStage,
|
|
2394
|
+
lastSeenStage,
|
|
2349
2395
|
retrievalMode: trace?.mode,
|
|
2350
2396
|
reasons,
|
|
2351
2397
|
rerankApplied: trace?.steps.some((step) => step.stage === "rerank" && step.metadata?.applied === true),
|
|
2352
2398
|
scoreShare,
|
|
2353
2399
|
scoreThresholdApplied: trace?.steps.some((step) => step.stage === "score_filter"),
|
|
2400
|
+
stageCounts,
|
|
2401
|
+
stageWeights,
|
|
2354
2402
|
siblingCount: siblings.length,
|
|
2355
2403
|
siblingScoreGap: strongestSibling ? section.totalScore - strongestSibling.totalScore : undefined,
|
|
2356
2404
|
sourceCount: section.sourceSet.size,
|
|
@@ -4540,5 +4588,5 @@ export {
|
|
|
4540
4588
|
AIStreamService
|
|
4541
4589
|
};
|
|
4542
4590
|
|
|
4543
|
-
//# debugId=
|
|
4591
|
+
//# debugId=4DB0513163E0BB7564756E2164756E21
|
|
4544
4592
|
//# sourceMappingURL=index.js.map
|