@absolutejs/absolute 0.19.0-beta.605 → 0.19.0-beta.607

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.
Files changed (37) hide show
  1. package/dist/ai/client/index.js +112 -1
  2. package/dist/ai/client/index.js.map +4 -4
  3. package/dist/ai/client/ui.js +113 -1
  4. package/dist/ai/client/ui.js.map +4 -4
  5. package/dist/ai/index.js +153 -4
  6. package/dist/ai/index.js.map +6 -6
  7. package/dist/ai/rag/quality.js +60 -1
  8. package/dist/ai/rag/quality.js.map +3 -3
  9. package/dist/ai/rag/ui.js +113 -1
  10. package/dist/ai/rag/ui.js.map +4 -4
  11. package/dist/ai-client/angular/ai/index.js +111 -0
  12. package/dist/ai-client/react/ai/index.js +141 -7
  13. package/dist/ai-client/vue/ai/index.js +135 -1
  14. package/dist/angular/ai/index.js +112 -1
  15. package/dist/angular/ai/index.js.map +4 -4
  16. package/dist/react/ai/index.js +142 -8
  17. package/dist/react/ai/index.js.map +6 -6
  18. package/dist/src/ai/client/ui.d.ts +1 -1
  19. package/dist/src/ai/rag/grounding.d.ts +2 -1
  20. package/dist/src/ai/rag/index.d.ts +1 -1
  21. package/dist/src/ai/rag/presentation.d.ts +2 -2
  22. package/dist/src/ai/rag/ui.d.ts +1 -1
  23. package/dist/src/react/ai/useRAG.d.ts +4 -0
  24. package/dist/src/react/ai/useRAGChunkPreview.d.ts +3 -0
  25. package/dist/src/react/ai/useRAGSources.d.ts +1 -0
  26. package/dist/src/svelte/ai/createRAG.d.ts +4 -0
  27. package/dist/src/svelte/ai/createRAGChunkPreview.d.ts +3 -0
  28. package/dist/src/svelte/ai/createRAGSources.d.ts +1 -0
  29. package/dist/src/vue/ai/useRAG.d.ts +4 -0
  30. package/dist/src/vue/ai/useRAGChunkPreview.d.ts +3 -0
  31. package/dist/src/vue/ai/useRAGSources.d.ts +1 -0
  32. package/dist/svelte/ai/index.js +149 -3
  33. package/dist/svelte/ai/index.js.map +6 -6
  34. package/dist/types/ai.d.ts +20 -1
  35. package/dist/vue/ai/index.js +136 -2
  36. package/dist/vue/ai/index.js.map +6 -6
  37. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  export { buildRAGAnswerWorkflowState, buildRAGSourceGroups, buildRAGSourceSummaries, buildRAGStreamProgress, getLatestAssistantMessage, resolveRAGStreamStage } from '../rag/workflowState';
2
2
  export { buildRAGStreamProgress as getRAGStreamProgress } from '../rag/workflowState';
3
- export { buildRAGCitationReferenceMap, buildRAGChunkGraphNavigation, buildRAGChunkGraph, buildRAGChunkPreviewGraph, buildRAGChunkPreviewNavigation, buildRAGGroundedAnswer, buildRAGGroundingReferences } from '../rag/presentation';
3
+ export { buildRAGCitationReferenceMap, buildRAGChunkGraphNavigation, buildRAGChunkGraph, buildRAGChunkPreviewGraph, buildRAGChunkPreviewNavigation, buildRAGGroundedAnswer, buildRAGGroundedAnswerSectionSummaries, buildRAGGroundingReferences } from '../rag/presentation';
4
4
  export type { RAGStreamProgress, RAGStreamProgressState } from '../rag/workflowState';
5
5
  export type { RAGAnswerWorkflowState } from '../../../types/ai';
@@ -1,5 +1,6 @@
1
- import type { RAGCitation, RAGCitationReferenceMap, RAGGroundedAnswer, RAGGroundingReference, RAGSource } from '../../../types/ai';
1
+ import type { RAGCitation, RAGCitationReferenceMap, RAGGroundedAnswer, RAGGroundedAnswerSectionSummary, RAGGroundingReference, RAGSource } from '../../../types/ai';
2
2
  export declare const buildRAGCitationReferenceMap: (citations: RAGCitation[]) => RAGCitationReferenceMap;
3
3
  export declare const buildRAGCitations: (sources: RAGSource[]) => RAGCitation[];
4
4
  export declare const buildRAGGroundedAnswer: (content: string, sources: RAGSource[]) => RAGGroundedAnswer;
5
+ export declare const buildRAGGroundedAnswerSectionSummaries: (references: RAGGroundingReference[]) => RAGGroundedAnswerSectionSummary[];
5
6
  export declare const buildRAGGroundingReferences: (sources: RAGSource[]) => RAGGroundingReference[];
@@ -10,7 +10,7 @@ export { createRAGGmailEmailSyncClient, createRAGGraphEmailSyncClient, createRAG
10
10
  export { buildRAGUpsertInputFromDirectory, buildRAGUpsertInputFromDocuments, buildRAGUpsertInputFromUploads, createBuiltinArchiveExpander, createEmailExtractor, createEPUBExtractor, createLegacyDocumentExtractor, createRAGPDFOCRExtractor, createRAGArchiveExpander, createRAGArchiveFileExtractor, createOfficeDocumentExtractor, createPDFFileExtractor, createRAGFileExtractor, createRAGImageOCRExtractor, createRAGMediaFileExtractor, createRAGMediaTranscriber, createRAGOCRProvider, createTextFileExtractor, loadRAGDocumentFromURL, loadRAGDocumentUpload, loadRAGDocumentsFromUploads, buildRAGUpsertInputFromURLs, loadRAGDocumentFile, loadRAGDocumentsFromDirectory, loadRAGDocumentsFromURLs, prepareRAGDirectoryDocuments, prepareRAGDocument, prepareRAGDocumentFile, prepareRAGDocuments } from './ingestion';
11
11
  export { buildRAGContext } from './types';
12
12
  export { buildRAGEvaluationLeaderboard, buildRAGEvaluationResponse, compareRAGRetrievalStrategies, compareRAGRerankers, buildRAGAnswerGroundingCaseDifficultyLeaderboard, buildRAGAnswerGroundingCaseDifficultyRunDiff, buildRAGAnswerGroundingEvaluationLeaderboard, buildRAGAnswerGroundingEvaluationResponse, buildRAGAnswerGroundingEvaluationRunDiff, buildRAGRetrievalComparisonDecisionSummary, buildRAGRetrievalReleaseVerdict, createRAGFileAnswerGroundingCaseDifficultyHistoryStore, createRAGFileAnswerGroundingEvaluationHistoryStore, createRAGFileEvaluationHistoryStore, createRAGFileRetrievalBaselineStore, createRAGFileRetrievalComparisonHistoryStore, createRAGFileRetrievalLaneHandoffDecisionStore, createRAGFileRetrievalLaneHandoffIncidentStore, createRAGFileRetrievalLaneHandoffIncidentHistoryStore, createRAGFileRetrievalIncidentRemediationDecisionStore, createRAGFileRetrievalIncidentRemediationExecutionHistoryStore, createRAGFileRetrievalLaneHandoffAutoCompletePolicyHistoryStore, createRAGFileRetrievalReleaseLanePolicyHistoryStore, createRAGFileRetrievalBaselineGatePolicyHistoryStore, createRAGFileRetrievalReleaseLaneEscalationPolicyHistoryStore, createRAGFileRetrievalReleaseDecisionStore, createRAGFileRetrievalReleaseIncidentStore, createRAGFileSearchTraceStore, createRAGFileSearchTracePruneHistoryStore, createRAGSQLiteSearchTraceStore, createRAGEvaluationSuite, evaluateRAGAnswerGrounding, evaluateRAGAnswerGroundingCase, evaluateRAGCollection, executeDryRunRAGEvaluation, loadRAGAnswerGroundingCaseDifficultyHistory, loadRAGAnswerGroundingEvaluationHistory, loadRAGEvaluationHistory, loadRAGRetrievalBaselines, loadRAGRetrievalComparisonHistory, loadRAGRetrievalLaneHandoffDecisions, loadRAGRetrievalLaneHandoffIncidents, loadRAGRetrievalLaneHandoffIncidentHistory, loadRAGRetrievalIncidentRemediationDecisions, loadRAGRetrievalIncidentRemediationExecutionHistory, loadRAGRetrievalLaneHandoffAutoCompletePolicyHistory, loadRAGRetrievalReleaseLanePolicyHistory, loadRAGRetrievalBaselineGatePolicyHistory, loadRAGRetrievalReleaseLaneEscalationPolicyHistory, loadRAGRetrievalReleaseDecisions, loadRAGRetrievalReleaseIncidents, loadRAGSearchTraceGroupHistory, loadRAGSearchTraceHistory, loadRAGSearchTracePruneHistory, previewRAGSearchTraceStorePrune, persistRAGRetrievalBaseline, persistRAGRetrievalComparisonRun, persistRAGRetrievalLaneHandoffDecision, persistRAGRetrievalLaneHandoffIncident, persistRAGRetrievalLaneHandoffIncidentHistory, persistRAGRetrievalIncidentRemediationDecision, persistRAGRetrievalIncidentRemediationExecutionHistory, persistRAGRetrievalLaneHandoffAutoCompletePolicyHistory, persistRAGRetrievalReleaseLanePolicyHistory, persistRAGRetrievalBaselineGatePolicyHistory, persistRAGRetrievalReleaseLaneEscalationPolicyHistory, persistRAGRetrievalReleaseDecision, persistRAGRetrievalReleaseIncident, persistRAGSearchTracePruneRun, pruneRAGSearchTraceStore, summarizeRAGSearchTraceStore, buildRAGRetrievalTraceHistoryTrend, persistRAGAnswerGroundingCaseDifficultyRun, persistRAGAnswerGroundingEvaluationRun, persistRAGEvaluationSuiteRun, persistRAGSearchTraceRecord, runRAGEvaluationSuite, summarizeRAGEvaluationCase, summarizeRAGRerankerComparison, compareRAGRetrievalTraceSummaries, summarizeRAGRetrievalTraces, buildRAGEvaluationRunDiff, buildRAGSearchTraceDiff, buildRAGSearchTraceRecord } from './quality';
13
- export { buildRAGAdminActionPresentation, buildRAGAdminActionPresentations, buildRAGAdminJobPresentation, buildRAGAdminJobPresentations, buildRAGAnswerGroundingCaseSnapshotPresentations, buildRAGAnswerGroundingHistoryPresentation, buildRAGAnswerGroundingHistoryRows, buildRAGCitations, buildRAGCitationReferenceMap, buildRAGChunkGraphNavigation, buildRAGChunkPreviewGraph, buildRAGChunkPreviewNavigation, buildRAGChunkGraph, buildRAGComparisonTraceDiffRows, buildRAGComparisonTraceSummaryRows, buildRAGCorpusHealthPresentation, buildRAGEvaluationCaseTracePresentations, buildRAGEvaluationHistoryPresentation, buildRAGEvaluationHistoryRows, buildRAGGroundedAnswer, buildRAGGroundingOverviewPresentation, buildRAGGroundingProviderCaseComparisonPresentations, buildRAGGroundingProviderOverviewPresentation, buildRAGGroundingProviderPresentations, buildRAGGroundingReferences, buildRAGQualityOverviewPresentation, buildRAGReadinessPresentation, buildRAGRerankerComparisonOverviewPresentation, buildRAGRerankerComparisonPresentations, buildRAGRerankerOverviewPresentation, buildRAGRetrievalComparisonOverviewPresentation, buildRAGRetrievalComparisonPresentations, buildRAGRetrievalOverviewPresentation, buildRAGRetrievalTracePresentation, buildRAGSourceGroups, buildRAGSourceSummaries, buildRAGSyncOverviewPresentation, buildRAGSyncSourcePresentation, buildRAGSyncSourcePresentations } from './ui';
13
+ export { buildRAGAdminActionPresentation, buildRAGAdminActionPresentations, buildRAGAdminJobPresentation, buildRAGAdminJobPresentations, buildRAGAnswerGroundingCaseSnapshotPresentations, buildRAGAnswerGroundingHistoryPresentation, buildRAGAnswerGroundingHistoryRows, buildRAGCitations, buildRAGCitationReferenceMap, buildRAGChunkGraphNavigation, buildRAGChunkPreviewGraph, buildRAGChunkPreviewNavigation, buildRAGChunkGraph, buildRAGComparisonTraceDiffRows, buildRAGComparisonTraceSummaryRows, buildRAGCorpusHealthPresentation, buildRAGEvaluationCaseTracePresentations, buildRAGEvaluationHistoryPresentation, buildRAGEvaluationHistoryRows, buildRAGGroundedAnswer, buildRAGGroundedAnswerSectionSummaries, buildRAGGroundingOverviewPresentation, buildRAGGroundingProviderCaseComparisonPresentations, buildRAGGroundingProviderOverviewPresentation, buildRAGGroundingProviderPresentations, buildRAGGroundingReferences, buildRAGQualityOverviewPresentation, buildRAGReadinessPresentation, buildRAGRerankerComparisonOverviewPresentation, buildRAGRerankerComparisonPresentations, buildRAGRerankerOverviewPresentation, buildRAGRetrievalComparisonOverviewPresentation, buildRAGRetrievalComparisonPresentations, buildRAGRetrievalOverviewPresentation, buildRAGRetrievalTracePresentation, buildRAGSourceGroups, buildRAGSourceSummaries, buildRAGSyncOverviewPresentation, buildRAGSyncSourcePresentation, buildRAGSyncSourcePresentations } from './ui';
14
14
  export { createRAGBunS3SyncClient, createRAGDirectorySyncSource, createRAGEmailSyncSource, createRAGFileSyncStateStore, createRAGStaticEmailSyncClient, createRAGStorageSyncSource, createRAGSyncManager, createRAGSyncScheduler, createRAGUrlSyncSource } from './sync';
15
15
  export { createRAGCollection, ingestDocuments, ingestRAGDocuments, searchDocuments } from './collection';
16
16
  export { createInMemoryRAGStore } from './adapters/inMemory';
@@ -1,6 +1,6 @@
1
1
  import type { RAGAdminActionPresentation, RAGAdminActionRecord, RAGAdminJobPresentation, RAGAdminJobRecord, AIMessage, RAGAnswerGroundingCaseSnapshotPresentation, RAGAnswerGroundingEvaluationHistory, RAGAnswerGroundingEvaluationResponse, RAGCorpusHealth, RAGCorpusHealthPresentation, RAGExtractorReadiness, RAGReadinessPresentation, RAGGroundingOverviewPresentation, RAGGroundingProviderCaseComparisonPresentation, RAGGroundingProviderOverviewPresentation, RAGGroundingProviderPresentation, RAGComparisonOverviewPresentation, RAGComparisonPresentation, RAGChunkGraph, RAGChunkGraphNavigation, RAGChunkStructure, RAGDocumentChunkPreview, RAGLabelValueRow, RAGRerankerComparisonEntry, RAGRetrievalComparison, RAGRetrievalComparisonEntry, RAGRetrievalTrace, RAGQualityOverviewPresentation, RAGEvaluationCaseTracePresentation, RAGEvaluationHistory, RAGAnswerGroundingHistoryPresentation, RAGEvaluationHistoryPresentation, RAGRerankerComparison, RAGAnswerWorkflowState, RAGRetrievalTracePresentation, RAGSource, RAGSourceLabels, RAGSourceGroup, RAGSourceSummary, RAGStreamStage, RAGSyncOverviewPresentation, RAGSyncSourcePresentation, RAGSyncSourceRecord } from '../../../types/ai';
2
- import { buildRAGCitationReferenceMap, buildRAGCitations, buildRAGGroundedAnswer, buildRAGGroundingReferences } from './grounding';
3
- export { buildRAGCitationReferenceMap, buildRAGCitations, buildRAGGroundedAnswer, buildRAGGroundingReferences };
2
+ import { buildRAGCitationReferenceMap, buildRAGCitations, buildRAGGroundedAnswer, buildRAGGroundedAnswerSectionSummaries, buildRAGGroundingReferences } from './grounding';
3
+ export { buildRAGCitationReferenceMap, buildRAGCitations, buildRAGGroundedAnswer, buildRAGGroundedAnswerSectionSummaries, buildRAGGroundingReferences };
4
4
  export declare const buildRAGRetrievalTracePresentation: (trace?: RAGRetrievalTrace) => RAGRetrievalTracePresentation;
5
5
  export declare const buildRAGAdminJobPresentation: (job: RAGAdminJobRecord) => RAGAdminJobPresentation;
6
6
  export declare const buildRAGAdminJobPresentations: (jobs?: RAGAdminJobRecord[]) => RAGAdminJobPresentation[];
@@ -1,4 +1,4 @@
1
- export { buildRAGAdminActionPresentation, buildRAGAdminActionPresentations, buildRAGAdminJobPresentation, buildRAGAdminJobPresentations, buildRAGCitations, buildRAGCitationReferenceMap, buildRAGChunkGraphNavigation, buildRAGChunkPreviewGraph, buildRAGChunkPreviewNavigation, buildRAGChunkGraph, buildRAGCorpusHealthPresentation, buildRAGGroundedAnswer, buildRAGGroundingReferences, buildRAGReadinessPresentation, buildRAGRetrievalTracePresentation, buildRAGSyncOverviewPresentation, buildRAGSyncSourcePresentation, buildRAGSyncSourcePresentations } from './presentation';
1
+ export { buildRAGAdminActionPresentation, buildRAGAdminActionPresentations, buildRAGAdminJobPresentation, buildRAGAdminJobPresentations, buildRAGCitations, buildRAGCitationReferenceMap, buildRAGChunkGraphNavigation, buildRAGChunkPreviewGraph, buildRAGChunkPreviewNavigation, buildRAGChunkGraph, buildRAGCorpusHealthPresentation, buildRAGGroundedAnswer, buildRAGGroundedAnswerSectionSummaries, buildRAGGroundingReferences, buildRAGReadinessPresentation, buildRAGRetrievalTracePresentation, buildRAGSyncOverviewPresentation, buildRAGSyncSourcePresentation, buildRAGSyncSourcePresentations } from './presentation';
2
2
  export { buildRAGAnswerWorkflowState, buildRAGRetrievedState, buildRAGSourceGroups, buildRAGSourceSummaries, buildRAGStreamProgress, getLatestAssistantMessage, getLatestRAGSources, resolveRAGStreamStage } from './workflowState';
3
3
  export { buildRAGAnswerGroundingCaseSnapshotPresentations, buildRAGAnswerGroundingHistoryPresentation, buildRAGAnswerGroundingHistoryRows, buildRAGComparisonTraceDiffRows, buildRAGComparisonTraceSummaryRows, buildRAGQualityOverviewPresentation, buildRAGGroundingOverviewPresentation, buildRAGGroundingProviderCaseComparisonPresentations, buildRAGGroundingProviderOverviewPresentation, buildRAGGroundingProviderPresentations, buildRAGRetrievalComparisonOverviewPresentation, buildRAGRetrievalOverviewPresentation, buildRAGRetrievalComparisonPresentations, buildRAGRerankerComparisonOverviewPresentation, buildRAGRerankerOverviewPresentation, buildRAGRerankerComparisonPresentations, buildRAGEvaluationCaseTracePresentations, buildRAGEvaluationHistoryPresentation, buildRAGEvaluationHistoryRows } from './presentation';
4
4
  export type { RAGStreamProgress, RAGStreamProgressState } from './workflowState';
@@ -16,7 +16,10 @@ export declare const useRAG: (path: string, options?: UseRAGOptions) => {
16
16
  isLoading: boolean;
17
17
  navigation: import("../..").RAGChunkGraphNavigation | null;
18
18
  preview: import("../..").RAGDocumentChunkPreview | null;
19
+ selectChildSection: (sectionId: string) => void;
19
20
  selectChunk: (id: string | null) => void;
21
+ selectParentSection: () => void;
22
+ selectSiblingSection: (sectionId: string) => void;
20
23
  };
21
24
  citations: {
22
25
  citationReferenceMap: import("../..").RAGCitationReferenceMap;
@@ -193,6 +196,7 @@ export declare const useRAG: (path: string, options?: UseRAGOptions) => {
193
196
  chunkGraph: import("../..").RAGChunkGraph;
194
197
  hasSources: boolean;
195
198
  latestAssistantMessage: import("../..").AIMessage | undefined;
199
+ navigationForChunk: (chunkId?: string | null) => import("../..").RAGChunkGraphNavigation;
196
200
  sourceGroups: import("../..").RAGSourceGroup[];
197
201
  sources: import("../..").RAGSource[];
198
202
  sourceSummaries: import("../..").RAGSourceSummary[];
@@ -10,6 +10,9 @@ export declare const useRAGChunkPreview: (path: string) => {
10
10
  isLoading: boolean;
11
11
  navigation: import("../..").RAGChunkGraphNavigation | null;
12
12
  preview: RAGDocumentChunkPreview | null;
13
+ selectChildSection: (sectionId: string) => void;
13
14
  selectChunk: (id: string | null) => void;
15
+ selectParentSection: () => void;
16
+ selectSiblingSection: (sectionId: string) => void;
14
17
  };
15
18
  export type UseRAGChunkPreviewResult = ReturnType<typeof useRAGChunkPreview>;
@@ -4,6 +4,7 @@ export declare const useRAGSources: (messages: AIMessage[]) => {
4
4
  chunkGraph: import("../..").RAGChunkGraph;
5
5
  hasSources: boolean;
6
6
  latestAssistantMessage: AIMessage | undefined;
7
+ navigationForChunk: (chunkId?: string | null) => import("../..").RAGChunkGraphNavigation;
7
8
  sourceGroups: import("../..").RAGSourceGroup[];
8
9
  sources: import("../..").RAGSource[];
9
10
  sourceSummaries: import("../..").RAGSourceSummary[];
@@ -16,7 +16,10 @@ export declare const createRAG: (path: string, options?: CreateRAGOptions) => {
16
16
  isLoading: import("svelte/store").Writable<boolean>;
17
17
  navigation: import("svelte/store").Readable<import("../..").RAGChunkGraphNavigation | null>;
18
18
  preview: import("svelte/store").Writable<import("../..").RAGDocumentChunkPreview | null>;
19
+ selectChildSection: (sectionId: string) => void;
19
20
  selectChunk: (id: string | null) => void;
21
+ selectParentSection: () => void;
22
+ selectSiblingSection: (sectionId: string) => void;
20
23
  };
21
24
  citations: {
22
25
  citationReferenceMap: import("svelte/store").Readable<import("../..").RAGCitationReferenceMap>;
@@ -194,6 +197,7 @@ export declare const createRAG: (path: string, options?: CreateRAGOptions) => {
194
197
  chunkGraph: import("svelte/store").Readable<import("../..").RAGChunkGraph>;
195
198
  hasSources: import("svelte/store").Readable<boolean>;
196
199
  latestAssistantMessage: import("svelte/store").Readable<import("../..").AIMessage | undefined>;
200
+ navigationForChunk: (chunkId?: string | null) => import("../..").RAGChunkGraphNavigation;
197
201
  sourceGroups: import("svelte/store").Readable<import("../..").RAGSourceGroup[]>;
198
202
  sources: import("svelte/store").Readable<import("../..").RAGSource[]>;
199
203
  sourceSummaries: import("svelte/store").Readable<import("../..").RAGSourceSummary[]>;
@@ -10,6 +10,9 @@ export declare const createRAGChunkPreview: (path: string) => {
10
10
  isLoading: import("svelte/store").Writable<boolean>;
11
11
  navigation: import("svelte/store").Readable<import("../..").RAGChunkGraphNavigation | null>;
12
12
  preview: import("svelte/store").Writable<RAGDocumentChunkPreview | null>;
13
+ selectChildSection: (sectionId: string) => void;
13
14
  selectChunk: (id: string | null) => void;
15
+ selectParentSection: () => void;
16
+ selectSiblingSection: (sectionId: string) => void;
14
17
  };
15
18
  export type CreateRAGChunkPreviewResult = ReturnType<typeof createRAGChunkPreview>;
@@ -5,6 +5,7 @@ export declare const createRAGSources: (messages: Readable<AIMessage[]>) => {
5
5
  chunkGraph: Readable<import("../..").RAGChunkGraph>;
6
6
  hasSources: Readable<boolean>;
7
7
  latestAssistantMessage: Readable<AIMessage | undefined>;
8
+ navigationForChunk: (chunkId?: string | null) => import("../..").RAGChunkGraphNavigation;
8
9
  sourceGroups: Readable<import("../..").RAGSourceGroup[]>;
9
10
  sources: Readable<import("../..").RAGSource[]>;
10
11
  sourceSummaries: Readable<import("../..").RAGSourceSummary[]>;
@@ -112,7 +112,10 @@ export declare const useRAG: (path: string, options?: UseRAGOptions) => {
112
112
  } | undefined;
113
113
  }[];
114
114
  } | null>;
115
+ selectChildSection: (sectionId: string) => void;
115
116
  selectChunk: (id: string | null) => void;
117
+ selectParentSection: () => void;
118
+ selectSiblingSection: (sectionId: string) => void;
116
119
  };
117
120
  citations: {
118
121
  citationReferenceMap: import("vue").ComputedRef<import("../..").RAGCitationReferenceMap>;
@@ -1428,6 +1431,7 @@ export declare const useRAG: (path: string, options?: UseRAGOptions) => {
1428
1431
  chunkGraph: import("vue").ComputedRef<import("../..").RAGChunkGraph>;
1429
1432
  hasSources: import("vue").ComputedRef<boolean>;
1430
1433
  latestAssistantMessage: import("vue").ComputedRef<import("../..").AIMessage | undefined>;
1434
+ navigationForChunk: (chunkId?: string | null) => import("../..").RAGChunkGraphNavigation;
1431
1435
  sourceGroups: import("vue").ComputedRef<import("../..").RAGSourceGroup[]>;
1432
1436
  sources: import("vue").ComputedRef<import("../..").RAGSource[]>;
1433
1437
  sourceSummaries: import("vue").ComputedRef<import("../..").RAGSourceSummary[]>;
@@ -106,6 +106,9 @@ export declare const useRAGChunkPreview: (path: string) => {
106
106
  } | undefined;
107
107
  }[];
108
108
  } | null>;
109
+ selectChildSection: (sectionId: string) => void;
109
110
  selectChunk: (id: string | null) => void;
111
+ selectParentSection: () => void;
112
+ selectSiblingSection: (sectionId: string) => void;
110
113
  };
111
114
  export type UseRAGChunkPreviewResult = ReturnType<typeof useRAGChunkPreview>;
@@ -5,6 +5,7 @@ export declare const useRAGSources: (messages: Ref<AIMessage[]>) => {
5
5
  chunkGraph: import("vue").ComputedRef<import("../..").RAGChunkGraph>;
6
6
  hasSources: import("vue").ComputedRef<boolean>;
7
7
  latestAssistantMessage: import("vue").ComputedRef<AIMessage | undefined>;
8
+ navigationForChunk: (chunkId?: string | null) => import("../..").RAGChunkGraphNavigation;
8
9
  sourceGroups: import("vue").ComputedRef<import("../..").RAGSourceGroup[]>;
9
10
  sources: import("vue").ComputedRef<import("../..").RAGSource[]>;
10
11
  sourceSummaries: import("vue").ComputedRef<import("../..").RAGSourceSummary[]>;
@@ -354,6 +354,13 @@ var buildGroundingReferenceEvidenceSummary = (reference) => [
354
354
  reference.contextLabel,
355
355
  reference.provenanceLabel
356
356
  ].filter((value) => Boolean(value && value.length > 0)).filter((value, index, values) => values.findIndex((entry) => entry === value) === index).join(" \xB7 ");
357
+ var buildGroundingSectionKey = (reference) => reference.contextLabel ?? reference.locatorLabel ?? reference.label ?? reference.source ?? reference.chunkId;
358
+ var buildGroundingSectionSummaryLine = (reference) => [
359
+ reference.source ?? reference.title ?? reference.chunkId,
360
+ reference.locatorLabel,
361
+ reference.contextLabel,
362
+ reference.provenanceLabel
363
+ ].filter((value) => Boolean(value && value.length > 0)).filter((value, index, values) => values.findIndex((entry) => entry === value) === index).join(" \xB7 ");
357
364
  var buildGroundedAnswerCitationDetail = (reference) => ({
358
365
  contextLabel: reference.contextLabel,
359
366
  evidenceLabel: buildGroundingReferenceEvidenceLabel(reference),
@@ -444,9 +451,61 @@ var buildRAGGroundedAnswer = (content, sources) => {
444
451
  hasCitations,
445
452
  parts,
446
453
  references,
454
+ sectionSummaries: buildRAGGroundedAnswerSectionSummaries(references),
447
455
  ungroundedReferenceNumbers: [...ungroundedReferenceNumbers].sort((left, right) => left - right)
448
456
  };
449
457
  };
458
+ var buildRAGGroundedAnswerSectionSummaries = (references) => {
459
+ const groups = new Map;
460
+ for (const reference of references) {
461
+ const key = buildGroundingSectionKey(reference);
462
+ const existing = groups.get(key);
463
+ if (!existing) {
464
+ groups.set(key, {
465
+ chunkIds: [reference.chunkId],
466
+ contextLabel: reference.contextLabel,
467
+ count: 1,
468
+ key,
469
+ label: key,
470
+ locatorLabel: reference.locatorLabel,
471
+ provenanceLabel: reference.provenanceLabel,
472
+ referenceNumbers: [reference.number],
473
+ references: [reference],
474
+ summary: buildGroundingSectionSummaryLine(reference) || reference.label || reference.chunkId
475
+ });
476
+ continue;
477
+ }
478
+ existing.count += 1;
479
+ if (!existing.chunkIds.includes(reference.chunkId)) {
480
+ existing.chunkIds.push(reference.chunkId);
481
+ }
482
+ if (!existing.referenceNumbers.includes(reference.number)) {
483
+ existing.referenceNumbers.push(reference.number);
484
+ }
485
+ existing.references.push(reference);
486
+ if (!existing.contextLabel && reference.contextLabel) {
487
+ existing.contextLabel = reference.contextLabel;
488
+ }
489
+ if (!existing.locatorLabel && reference.locatorLabel) {
490
+ existing.locatorLabel = reference.locatorLabel;
491
+ }
492
+ if (!existing.provenanceLabel && reference.provenanceLabel) {
493
+ existing.provenanceLabel = reference.provenanceLabel;
494
+ }
495
+ }
496
+ return [...groups.values()].map((group) => ({
497
+ ...group,
498
+ referenceNumbers: [...group.referenceNumbers].sort((left, right) => left - right),
499
+ references: group.references.slice().sort((left, right) => left.number - right.number)
500
+ })).sort((left, right) => {
501
+ const leftFirst = left.referenceNumbers[0] ?? Number.POSITIVE_INFINITY;
502
+ const rightFirst = right.referenceNumbers[0] ?? Number.POSITIVE_INFINITY;
503
+ if (leftFirst !== rightFirst) {
504
+ return leftFirst - rightFirst;
505
+ }
506
+ return left.label.localeCompare(right.label);
507
+ });
508
+ };
450
509
  var buildRAGGroundingReferences = (sources) => {
451
510
  const citations = buildRAGCitations(sources);
452
511
  const citationReferenceMap = buildRAGCitationReferenceMap(citations);
@@ -4204,11 +4263,13 @@ var buildRAGChunkGraph = (chunks) => {
4204
4263
  const existing = sections.get(sectionId);
4205
4264
  if (!existing) {
4206
4265
  sections.set(sectionId, {
4266
+ childSectionIds: [],
4207
4267
  chunkCount: structure.sequence?.sectionChunkCount ?? 1,
4208
4268
  chunkIds: [chunk.chunkId],
4209
4269
  depth: structure.section?.depth,
4210
4270
  id: sectionId,
4211
4271
  kind: structure.section?.kind,
4272
+ leadChunkId: chunk.chunkId,
4212
4273
  path: structure.section?.path,
4213
4274
  title: structure.section?.title
4214
4275
  });
@@ -4231,6 +4292,48 @@ var buildRAGChunkGraph = (chunks) => {
4231
4292
  }
4232
4293
  return left.localeCompare(right);
4233
4294
  });
4295
+ section.leadChunkId = section.chunkIds[0];
4296
+ }
4297
+ const sectionPathIndex = new Map;
4298
+ for (const section of sections.values()) {
4299
+ const path = section.path && section.path.length > 0 ? section.path : section.title ? [section.title] : undefined;
4300
+ if (path && path.length > 0) {
4301
+ sectionPathIndex.set(path.join("\x00"), section);
4302
+ }
4303
+ }
4304
+ for (const section of sections.values()) {
4305
+ const path = section.path && section.path.length > 0 ? section.path : section.title ? [section.title] : undefined;
4306
+ if (!path || path.length < 2) {
4307
+ continue;
4308
+ }
4309
+ const parent = sectionPathIndex.get(path.slice(0, -1).join("\x00"));
4310
+ if (!parent || parent.id === section.id) {
4311
+ continue;
4312
+ }
4313
+ section.parentSectionId = parent.id;
4314
+ if (!parent.childSectionIds.includes(section.id)) {
4315
+ parent.childSectionIds.push(section.id);
4316
+ }
4317
+ if (parent.leadChunkId && section.leadChunkId) {
4318
+ const parentKey = `section_parent:${section.leadChunkId}:${parent.leadChunkId}`;
4319
+ if (!edgeKeys.has(parentKey)) {
4320
+ edgeKeys.add(parentKey);
4321
+ edges.push({
4322
+ fromChunkId: section.leadChunkId,
4323
+ relation: "section_parent",
4324
+ toChunkId: parent.leadChunkId
4325
+ });
4326
+ }
4327
+ const childKey = `section_child:${parent.leadChunkId}:${section.leadChunkId}`;
4328
+ if (!edgeKeys.has(childKey)) {
4329
+ edgeKeys.add(childKey);
4330
+ edges.push({
4331
+ fromChunkId: parent.leadChunkId,
4332
+ relation: "section_child",
4333
+ toChunkId: section.leadChunkId
4334
+ });
4335
+ }
4336
+ }
4234
4337
  }
4235
4338
  nodes.sort((left, right) => {
4236
4339
  const leftSection = left.structure?.sequence?.sectionChunkIndex ?? Number.MAX_SAFE_INTEGER;
@@ -4264,6 +4367,8 @@ var buildRAGChunkGraphNavigation = (graph, activeChunkId) => {
4264
4367
  if (graph.nodes.length === 0) {
4265
4368
  return {
4266
4369
  activeChunkId,
4370
+ childSections: [],
4371
+ siblingSections: [],
4267
4372
  sectionNodes: []
4268
4373
  };
4269
4374
  }
@@ -4272,13 +4377,19 @@ var buildRAGChunkGraphNavigation = (graph, activeChunkId) => {
4272
4377
  const previousNode = activeNode?.structure?.sequence?.previousChunkId ? graph.nodes.find((node) => node.chunkId === activeNode.structure?.sequence?.previousChunkId) : undefined;
4273
4378
  const nextNode = activeNode?.structure?.sequence?.nextChunkId ? graph.nodes.find((node) => node.chunkId === activeNode.structure?.sequence?.nextChunkId) : undefined;
4274
4379
  const section = activeNode?.structure?.sequence?.sectionChunkId ? graph.sections.find((entry) => entry.id === activeNode.structure?.sequence?.sectionChunkId) : undefined;
4380
+ const parentSection = section?.parentSectionId ? graph.sections.find((entry) => entry.id === section.parentSectionId) : undefined;
4381
+ const childSections = section ? section.childSectionIds.map((sectionId) => graph.sections.find((entry) => entry.id === sectionId)).filter((entry) => Boolean(entry)) : [];
4382
+ const siblingSections = section?.parentSectionId ? graph.sections.filter((entry) => entry.parentSectionId === section.parentSectionId && entry.id !== section.id) : [];
4275
4383
  const sectionNodes = section ? section.chunkIds.map((chunkId) => graph.nodes.find((node) => node.chunkId === chunkId)).filter((node) => Boolean(node)) : activeNode ? [activeNode] : [];
4276
4384
  return {
4277
4385
  activeChunkId: resolvedActiveChunkId,
4278
4386
  activeNode,
4387
+ childSections,
4279
4388
  nextNode,
4389
+ parentSection,
4280
4390
  previousNode,
4281
4391
  section,
4392
+ siblingSections,
4282
4393
  sectionNodes
4283
4394
  };
4284
4395
  };
@@ -6803,6 +6914,36 @@ var createRAGChunkPreview = (path) => {
6803
6914
  const selectChunk = (id) => {
6804
6915
  activeChunkId.set(id);
6805
6916
  };
6917
+ const selectParentSection = () => {
6918
+ let leadChunkId;
6919
+ const unsubscribe = navigationWithSelection.subscribe(($navigation) => {
6920
+ leadChunkId = $navigation?.parentSection?.leadChunkId;
6921
+ });
6922
+ unsubscribe();
6923
+ if (leadChunkId) {
6924
+ activeChunkId.set(leadChunkId);
6925
+ }
6926
+ };
6927
+ const selectChildSection = (sectionId) => {
6928
+ let leadChunkId;
6929
+ const unsubscribe = navigationWithSelection.subscribe(($navigation) => {
6930
+ leadChunkId = $navigation?.childSections.find((section) => section.id === sectionId)?.leadChunkId;
6931
+ });
6932
+ unsubscribe();
6933
+ if (leadChunkId) {
6934
+ activeChunkId.set(leadChunkId);
6935
+ }
6936
+ };
6937
+ const selectSiblingSection = (sectionId) => {
6938
+ let leadChunkId;
6939
+ const unsubscribe = navigationWithSelection.subscribe(($navigation) => {
6940
+ leadChunkId = $navigation?.siblingSections.find((section) => section.id === sectionId)?.leadChunkId;
6941
+ });
6942
+ unsubscribe();
6943
+ if (leadChunkId) {
6944
+ activeChunkId.set(leadChunkId);
6945
+ }
6946
+ };
6806
6947
  return {
6807
6948
  activeChunkId,
6808
6949
  clear,
@@ -6812,7 +6953,10 @@ var createRAGChunkPreview = (path) => {
6812
6953
  isLoading,
6813
6954
  navigation: navigationWithSelection,
6814
6955
  preview,
6815
- selectChunk
6956
+ selectChildSection,
6957
+ selectChunk,
6958
+ selectParentSection,
6959
+ selectSiblingSection
6816
6960
  };
6817
6961
  };
6818
6962
 
@@ -7371,7 +7515,7 @@ var createRAGSearch = (path) => {
7371
7515
  };
7372
7516
 
7373
7517
  // src/svelte/ai/createRAGSources.ts
7374
- import { derived as derived5 } from "svelte/store";
7518
+ import { derived as derived5, get } from "svelte/store";
7375
7519
  var createRAGSources = (messages) => {
7376
7520
  const latestAssistantMessage = derived5(messages, ($messages) => getLatestAssistantMessage($messages));
7377
7521
  const sources = derived5(messages, ($messages) => getLatestRAGSources($messages));
@@ -7380,11 +7524,13 @@ var createRAGSources = (messages) => {
7380
7524
  const chunkGraph = derived5(sources, ($sources) => buildRAGChunkGraph($sources));
7381
7525
  const citationReferenceMap = derived5(sourceSummaries, ($sourceSummaries) => buildRAGCitationReferenceMap($sourceSummaries.flatMap((summary) => summary.citations)));
7382
7526
  const hasSources = derived5(sources, ($sources) => $sources.length > 0);
7527
+ const navigationForChunk = (chunkId) => buildRAGChunkGraphNavigation(get(chunkGraph), chunkId ?? undefined);
7383
7528
  return {
7384
7529
  citationReferenceMap,
7385
7530
  chunkGraph,
7386
7531
  hasSources,
7387
7532
  latestAssistantMessage,
7533
+ navigationForChunk,
7388
7534
  sourceGroups,
7389
7535
  sources,
7390
7536
  sourceSummaries
@@ -7578,5 +7724,5 @@ export {
7578
7724
  createAIStream
7579
7725
  };
7580
7726
 
7581
- //# debugId=4B08CD73149144C364756E2164756E21
7727
+ //# debugId=CC16B816D2847A9E64756E2164756E21
7582
7728
  //# sourceMappingURL=index.js.map