@absolutejs/absolute 0.19.0-beta.602 → 0.19.0-beta.604

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 +59 -5
  2. package/dist/ai/client/index.js.map +4 -4
  3. package/dist/ai/client/ui.js +59 -5
  4. package/dist/ai/client/ui.js.map +4 -4
  5. package/dist/ai/index.js +720 -80
  6. package/dist/ai/index.js.map +8 -8
  7. package/dist/ai/rag/quality.js +11 -1
  8. package/dist/ai/rag/quality.js.map +3 -3
  9. package/dist/ai/rag/ui.js +59 -5
  10. package/dist/ai/rag/ui.js.map +4 -4
  11. package/dist/ai-client/angular/ai/index.js +58 -4
  12. package/dist/ai-client/react/ai/index.js +58 -4
  13. package/dist/ai-client/vue/ai/index.js +58 -4
  14. package/dist/angular/ai/index.js +59 -5
  15. package/dist/angular/ai/index.js.map +4 -4
  16. package/dist/angular/index.js +2 -2
  17. package/dist/angular/index.js.map +1 -1
  18. package/dist/angular/server.js +2 -2
  19. package/dist/angular/server.js.map +1 -1
  20. package/dist/build.js +2 -2
  21. package/dist/build.js.map +1 -1
  22. package/dist/index.js +2 -2
  23. package/dist/index.js.map +1 -1
  24. package/dist/react/ai/index.js +59 -5
  25. package/dist/react/ai/index.js.map +4 -4
  26. package/dist/src/ai/rag/presentation.d.ts +6 -1
  27. package/dist/src/vue/ai/useRAG.d.ts +60 -0
  28. package/dist/src/vue/ai/useRAGChunkPreview.d.ts +20 -0
  29. package/dist/src/vue/ai/useRAGDocuments.d.ts +20 -0
  30. package/dist/src/vue/ai/useRAGIndexAdmin.d.ts +10 -0
  31. package/dist/src/vue/ai/useRAGSearch.d.ts +10 -0
  32. package/dist/svelte/ai/index.js +59 -5
  33. package/dist/svelte/ai/index.js.map +4 -4
  34. package/dist/types/ai.d.ts +42 -1
  35. package/dist/vue/ai/index.js +59 -5
  36. package/dist/vue/ai/index.js.map +4 -4
  37. package/package.json +53 -7
@@ -1,4 +1,4 @@
1
- import type { RAGAdminActionPresentation, RAGAdminActionRecord, RAGAdminJobPresentation, RAGAdminJobRecord, AIMessage, RAGAnswerGroundingCaseSnapshotPresentation, RAGAnswerGroundingEvaluationHistory, RAGAnswerGroundingEvaluationResponse, RAGCorpusHealth, RAGCorpusHealthPresentation, RAGExtractorReadiness, RAGReadinessPresentation, RAGGroundingOverviewPresentation, RAGGroundingProviderCaseComparisonPresentation, RAGGroundingProviderOverviewPresentation, RAGGroundingProviderPresentation, RAGComparisonOverviewPresentation, RAGComparisonPresentation, RAGLabelValueRow, RAGRerankerComparisonEntry, RAGRetrievalComparison, RAGRetrievalComparisonEntry, RAGRetrievalTrace, RAGQualityOverviewPresentation, RAGEvaluationCaseTracePresentation, RAGEvaluationHistory, RAGAnswerGroundingHistoryPresentation, RAGEvaluationHistoryPresentation, RAGRerankerComparison, RAGAnswerWorkflowState, RAGRetrievalTracePresentation, RAGSource, RAGSourceGroup, RAGSourceSummary, RAGStreamStage, RAGSyncOverviewPresentation, RAGSyncSourcePresentation, RAGSyncSourceRecord } from '../../../types/ai';
1
+ import type { RAGAdminActionPresentation, RAGAdminActionRecord, RAGAdminJobPresentation, RAGAdminJobRecord, AIMessage, RAGAnswerGroundingCaseSnapshotPresentation, RAGAnswerGroundingEvaluationHistory, RAGAnswerGroundingEvaluationResponse, RAGCorpusHealth, RAGCorpusHealthPresentation, RAGExtractorReadiness, RAGReadinessPresentation, RAGGroundingOverviewPresentation, RAGGroundingProviderCaseComparisonPresentation, RAGGroundingProviderOverviewPresentation, RAGGroundingProviderPresentation, RAGComparisonOverviewPresentation, RAGComparisonPresentation, 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
2
  import { buildRAGCitationReferenceMap, buildRAGCitations, buildRAGGroundedAnswer, buildRAGGroundingReferences } from './grounding';
3
3
  export { buildRAGCitationReferenceMap, buildRAGCitations, buildRAGGroundedAnswer, buildRAGGroundingReferences };
4
4
  export declare const buildRAGRetrievalTracePresentation: (trace?: RAGRetrievalTrace) => RAGRetrievalTracePresentation;
@@ -11,6 +11,11 @@ export declare const buildRAGSyncSourcePresentations: (sources?: RAGSyncSourceRe
11
11
  export declare const buildRAGReadinessPresentation: (readiness?: RAGExtractorReadiness) => RAGReadinessPresentation;
12
12
  export declare const buildRAGCorpusHealthPresentation: (health?: RAGCorpusHealth) => RAGCorpusHealthPresentation;
13
13
  export declare const buildRAGSyncOverviewPresentation: (sources?: RAGSyncSourceRecord[]) => RAGSyncOverviewPresentation;
14
+ export declare const buildRAGSourceLabels: ({ metadata, source, title }: {
15
+ metadata?: Record<string, unknown>;
16
+ source?: string;
17
+ title?: string;
18
+ }) => RAGSourceLabels | undefined;
14
19
  export declare const buildRAGRetrievedState: (messages: AIMessage[]) => {
15
20
  citationReferenceMap: import("./types").RAGCitationReferenceMap;
16
21
  citations: import("./types").RAGCitation[];
@@ -24,6 +24,11 @@ export declare const useRAG: (path: string, options?: UseRAGOptions) => {
24
24
  chunkCount?: number | undefined;
25
25
  createdAt?: number | undefined;
26
26
  updatedAt?: number | undefined;
27
+ labels?: {
28
+ contextLabel?: string | undefined;
29
+ locatorLabel?: string | undefined;
30
+ provenanceLabel?: string | undefined;
31
+ } | undefined;
27
32
  metadata?: Record<string, unknown> | undefined;
28
33
  };
29
34
  normalizedText: string;
@@ -34,6 +39,11 @@ export declare const useRAG: (path: string, options?: UseRAGOptions) => {
34
39
  source?: string | undefined;
35
40
  metadata?: Record<string, unknown> | undefined;
36
41
  embedding?: number[] | undefined;
42
+ labels?: {
43
+ contextLabel?: string | undefined;
44
+ locatorLabel?: string | undefined;
45
+ provenanceLabel?: string | undefined;
46
+ } | undefined;
37
47
  }[];
38
48
  } | null, import("../..").RAGDocumentChunkPreview | {
39
49
  document: {
@@ -47,6 +57,11 @@ export declare const useRAG: (path: string, options?: UseRAGOptions) => {
47
57
  chunkCount?: number | undefined;
48
58
  createdAt?: number | undefined;
49
59
  updatedAt?: number | undefined;
60
+ labels?: {
61
+ contextLabel?: string | undefined;
62
+ locatorLabel?: string | undefined;
63
+ provenanceLabel?: string | undefined;
64
+ } | undefined;
50
65
  metadata?: Record<string, unknown> | undefined;
51
66
  };
52
67
  normalizedText: string;
@@ -57,6 +72,11 @@ export declare const useRAG: (path: string, options?: UseRAGOptions) => {
57
72
  source?: string | undefined;
58
73
  metadata?: Record<string, unknown> | undefined;
59
74
  embedding?: number[] | undefined;
75
+ labels?: {
76
+ contextLabel?: string | undefined;
77
+ locatorLabel?: string | undefined;
78
+ provenanceLabel?: string | undefined;
79
+ } | undefined;
60
80
  }[];
61
81
  } | null>;
62
82
  };
@@ -81,6 +101,11 @@ export declare const useRAG: (path: string, options?: UseRAGOptions) => {
81
101
  createdAt?: number | undefined;
82
102
  updatedAt?: number | undefined;
83
103
  metadata?: Record<string, unknown> | undefined;
104
+ labels?: {
105
+ contextLabel?: string | undefined;
106
+ locatorLabel?: string | undefined;
107
+ provenanceLabel?: string | undefined;
108
+ } | undefined;
84
109
  }[], import("../..").RAGIndexedDocument[] | {
85
110
  id: string;
86
111
  title: string;
@@ -94,6 +119,11 @@ export declare const useRAG: (path: string, options?: UseRAGOptions) => {
94
119
  createdAt?: number | undefined;
95
120
  updatedAt?: number | undefined;
96
121
  metadata?: Record<string, unknown> | undefined;
122
+ labels?: {
123
+ contextLabel?: string | undefined;
124
+ locatorLabel?: string | undefined;
125
+ provenanceLabel?: string | undefined;
126
+ } | undefined;
97
127
  }[]>;
98
128
  error: import("vue").Ref<string | null, string | null>;
99
129
  isLoading: import("vue").Ref<boolean, boolean>;
@@ -112,6 +142,11 @@ export declare const useRAG: (path: string, options?: UseRAGOptions) => {
112
142
  createdAt?: number | undefined;
113
143
  updatedAt?: number | undefined;
114
144
  metadata?: Record<string, unknown> | undefined;
145
+ labels?: {
146
+ contextLabel?: string | undefined;
147
+ locatorLabel?: string | undefined;
148
+ provenanceLabel?: string | undefined;
149
+ } | undefined;
115
150
  }[];
116
151
  lastSeedMsByMode?: Record<string, number> | undefined;
117
152
  } | null, import("../..").RAGDocumentsResponse | {
@@ -129,6 +164,11 @@ export declare const useRAG: (path: string, options?: UseRAGOptions) => {
129
164
  createdAt?: number | undefined;
130
165
  updatedAt?: number | undefined;
131
166
  metadata?: Record<string, unknown> | undefined;
167
+ labels?: {
168
+ contextLabel?: string | undefined;
169
+ locatorLabel?: string | undefined;
170
+ provenanceLabel?: string | undefined;
171
+ } | undefined;
132
172
  }[];
133
173
  lastSeedMsByMode?: Record<string, number> | undefined;
134
174
  } | null>;
@@ -895,6 +935,11 @@ export declare const useRAG: (path: string, options?: UseRAGOptions) => {
895
935
  createdAt?: number | undefined;
896
936
  updatedAt?: number | undefined;
897
937
  metadata?: Record<string, unknown> | undefined;
938
+ labels?: {
939
+ contextLabel?: string | undefined;
940
+ locatorLabel?: string | undefined;
941
+ provenanceLabel?: string | undefined;
942
+ } | undefined;
898
943
  } | undefined;
899
944
  } | null, import("../..").RAGMutationResponse | {
900
945
  ok: boolean;
@@ -922,6 +967,11 @@ export declare const useRAG: (path: string, options?: UseRAGOptions) => {
922
967
  createdAt?: number | undefined;
923
968
  updatedAt?: number | undefined;
924
969
  metadata?: Record<string, unknown> | undefined;
970
+ labels?: {
971
+ contextLabel?: string | undefined;
972
+ locatorLabel?: string | undefined;
973
+ provenanceLabel?: string | undefined;
974
+ } | undefined;
925
975
  } | undefined;
926
976
  } | null>;
927
977
  loadBackends: () => Promise<import("../..").RAGBackendsResponse>;
@@ -1263,6 +1313,11 @@ export declare const useRAG: (path: string, options?: UseRAGOptions) => {
1263
1313
  title?: string | undefined;
1264
1314
  source?: string | undefined;
1265
1315
  metadata?: Record<string, unknown> | undefined;
1316
+ labels?: {
1317
+ contextLabel?: string | undefined;
1318
+ locatorLabel?: string | undefined;
1319
+ provenanceLabel?: string | undefined;
1320
+ } | undefined;
1266
1321
  }[], import("../..").RAGSource[] | {
1267
1322
  chunkId: string;
1268
1323
  score: number;
@@ -1270,6 +1325,11 @@ export declare const useRAG: (path: string, options?: UseRAGOptions) => {
1270
1325
  title?: string | undefined;
1271
1326
  source?: string | undefined;
1272
1327
  metadata?: Record<string, unknown> | undefined;
1328
+ labels?: {
1329
+ contextLabel?: string | undefined;
1330
+ locatorLabel?: string | undefined;
1331
+ provenanceLabel?: string | undefined;
1332
+ } | undefined;
1273
1333
  }[]>;
1274
1334
  search: (input: {
1275
1335
  filter?: Record<string, unknown> | undefined;
@@ -18,6 +18,11 @@ export declare const useRAGChunkPreview: (path: string) => {
18
18
  chunkCount?: number | undefined;
19
19
  createdAt?: number | undefined;
20
20
  updatedAt?: number | undefined;
21
+ labels?: {
22
+ contextLabel?: string | undefined;
23
+ locatorLabel?: string | undefined;
24
+ provenanceLabel?: string | undefined;
25
+ } | undefined;
21
26
  metadata?: Record<string, unknown> | undefined;
22
27
  };
23
28
  normalizedText: string;
@@ -28,6 +33,11 @@ export declare const useRAGChunkPreview: (path: string) => {
28
33
  source?: string | undefined;
29
34
  metadata?: Record<string, unknown> | undefined;
30
35
  embedding?: number[] | undefined;
36
+ labels?: {
37
+ contextLabel?: string | undefined;
38
+ locatorLabel?: string | undefined;
39
+ provenanceLabel?: string | undefined;
40
+ } | undefined;
31
41
  }[];
32
42
  } | null, RAGDocumentChunkPreview | {
33
43
  document: {
@@ -41,6 +51,11 @@ export declare const useRAGChunkPreview: (path: string) => {
41
51
  chunkCount?: number | undefined;
42
52
  createdAt?: number | undefined;
43
53
  updatedAt?: number | undefined;
54
+ labels?: {
55
+ contextLabel?: string | undefined;
56
+ locatorLabel?: string | undefined;
57
+ provenanceLabel?: string | undefined;
58
+ } | undefined;
44
59
  metadata?: Record<string, unknown> | undefined;
45
60
  };
46
61
  normalizedText: string;
@@ -51,6 +66,11 @@ export declare const useRAGChunkPreview: (path: string) => {
51
66
  source?: string | undefined;
52
67
  metadata?: Record<string, unknown> | undefined;
53
68
  embedding?: number[] | undefined;
69
+ labels?: {
70
+ contextLabel?: string | undefined;
71
+ locatorLabel?: string | undefined;
72
+ provenanceLabel?: string | undefined;
73
+ } | undefined;
54
74
  }[];
55
75
  } | null>;
56
76
  };
@@ -13,6 +13,11 @@ export declare const useRAGDocuments: (path: string) => {
13
13
  createdAt?: number | undefined;
14
14
  updatedAt?: number | undefined;
15
15
  metadata?: Record<string, unknown> | undefined;
16
+ labels?: {
17
+ contextLabel?: string | undefined;
18
+ locatorLabel?: string | undefined;
19
+ provenanceLabel?: string | undefined;
20
+ } | undefined;
16
21
  }[], RAGIndexedDocument[] | {
17
22
  id: string;
18
23
  title: string;
@@ -26,6 +31,11 @@ export declare const useRAGDocuments: (path: string) => {
26
31
  createdAt?: number | undefined;
27
32
  updatedAt?: number | undefined;
28
33
  metadata?: Record<string, unknown> | undefined;
34
+ labels?: {
35
+ contextLabel?: string | undefined;
36
+ locatorLabel?: string | undefined;
37
+ provenanceLabel?: string | undefined;
38
+ } | undefined;
29
39
  }[]>;
30
40
  error: import("vue").Ref<string | null, string | null>;
31
41
  isLoading: import("vue").Ref<boolean, boolean>;
@@ -44,6 +54,11 @@ export declare const useRAGDocuments: (path: string) => {
44
54
  createdAt?: number | undefined;
45
55
  updatedAt?: number | undefined;
46
56
  metadata?: Record<string, unknown> | undefined;
57
+ labels?: {
58
+ contextLabel?: string | undefined;
59
+ locatorLabel?: string | undefined;
60
+ provenanceLabel?: string | undefined;
61
+ } | undefined;
47
62
  }[];
48
63
  lastSeedMsByMode?: Record<string, number> | undefined;
49
64
  } | null, RAGDocumentsResponse | {
@@ -61,6 +76,11 @@ export declare const useRAGDocuments: (path: string) => {
61
76
  createdAt?: number | undefined;
62
77
  updatedAt?: number | undefined;
63
78
  metadata?: Record<string, unknown> | undefined;
79
+ labels?: {
80
+ contextLabel?: string | undefined;
81
+ locatorLabel?: string | undefined;
82
+ provenanceLabel?: string | undefined;
83
+ } | undefined;
64
84
  }[];
65
85
  lastSeedMsByMode?: Record<string, number> | undefined;
66
86
  } | null>;
@@ -171,6 +171,11 @@ export declare const useRAGIndexAdmin: (path: string) => {
171
171
  createdAt?: number | undefined;
172
172
  updatedAt?: number | undefined;
173
173
  metadata?: Record<string, unknown> | undefined;
174
+ labels?: {
175
+ contextLabel?: string | undefined;
176
+ locatorLabel?: string | undefined;
177
+ provenanceLabel?: string | undefined;
178
+ } | undefined;
174
179
  } | undefined;
175
180
  } | null, RAGMutationResponse | {
176
181
  ok: boolean;
@@ -198,6 +203,11 @@ export declare const useRAGIndexAdmin: (path: string) => {
198
203
  createdAt?: number | undefined;
199
204
  updatedAt?: number | undefined;
200
205
  metadata?: Record<string, unknown> | undefined;
206
+ labels?: {
207
+ contextLabel?: string | undefined;
208
+ locatorLabel?: string | undefined;
209
+ provenanceLabel?: string | undefined;
210
+ } | undefined;
201
211
  } | undefined;
202
212
  } | null>;
203
213
  loadBackends: () => Promise<RAGBackendsResponse>;
@@ -70,6 +70,11 @@ export declare const useRAGSearch: (path: string) => {
70
70
  title?: string | undefined;
71
71
  source?: string | undefined;
72
72
  metadata?: Record<string, unknown> | undefined;
73
+ labels?: {
74
+ contextLabel?: string | undefined;
75
+ locatorLabel?: string | undefined;
76
+ provenanceLabel?: string | undefined;
77
+ } | undefined;
73
78
  }[], RAGSource[] | {
74
79
  chunkId: string;
75
80
  score: number;
@@ -77,6 +82,11 @@ export declare const useRAGSearch: (path: string) => {
77
82
  title?: string | undefined;
78
83
  source?: string | undefined;
79
84
  metadata?: Record<string, unknown> | undefined;
85
+ labels?: {
86
+ contextLabel?: string | undefined;
87
+ locatorLabel?: string | undefined;
88
+ provenanceLabel?: string | undefined;
89
+ } | undefined;
80
90
  }[]>;
81
91
  search: (input: SearchRequest) => Promise<RAGSource[]>;
82
92
  searchWithTrace: (input: SearchRequest) => Promise<RAGDetailedSearchResponse>;
@@ -216,6 +216,10 @@ var buildContextLabel = (metadata) => {
216
216
  return from ? `Message from ${from}` : "Message evidence";
217
217
  }
218
218
  const page = getContextNumber(metadata.page) ?? getContextNumber(metadata.pageNumber) ?? (typeof metadata.pageIndex === "number" ? metadata.pageIndex + 1 : undefined);
219
+ const region = getContextNumber(metadata.regionNumber) ?? (typeof metadata.regionIndex === "number" ? metadata.regionIndex + 1 : undefined);
220
+ if (page && region) {
221
+ return `Page ${page} region ${region}`;
222
+ }
219
223
  if (page) {
220
224
  return `Page ${page}`;
221
225
  }
@@ -256,6 +260,10 @@ var buildLocatorLabel = (metadata, source, title) => {
256
260
  return;
257
261
  }
258
262
  const page = getContextNumber(metadata.page) ?? getContextNumber(metadata.pageNumber) ?? (typeof metadata.pageIndex === "number" ? metadata.pageIndex + 1 : undefined);
263
+ const region = getContextNumber(metadata.regionNumber) ?? (typeof metadata.regionIndex === "number" ? metadata.regionIndex + 1 : undefined);
264
+ if (page && region) {
265
+ return `Page ${page} \xB7 Region ${region}`;
266
+ }
259
267
  if (page) {
260
268
  return `Page ${page}`;
261
269
  }
@@ -308,9 +316,11 @@ var buildProvenanceLabel = (metadata) => {
308
316
  const transcriptSource = getContextString(metadata.transcriptSource);
309
317
  const pdfTextMode = getContextString(metadata.pdfTextMode);
310
318
  const ocrEngine = getContextString(metadata.ocrEngine);
319
+ const ocrConfidence = getContextNumber(metadata.ocrRegionConfidence) ?? getContextNumber(metadata.ocrConfidence);
311
320
  const labels = [
312
321
  pdfTextMode ? `PDF ${pdfTextMode}` : "",
313
322
  ocrEngine ? `OCR ${ocrEngine}` : "",
323
+ typeof ocrConfidence === "number" ? `Confidence ${ocrConfidence.toFixed(2)}` : "",
314
324
  mediaKind ? `Media ${mediaKind}` : "",
315
325
  transcriptSource ? `Transcript ${transcriptSource}` : "",
316
326
  threadTopic ? `Thread ${threadTopic}` : "",
@@ -3977,6 +3987,10 @@ var buildContextLabel2 = (metadata) => {
3977
3987
  return from ? `Message from ${from}` : "Message evidence";
3978
3988
  }
3979
3989
  const page = getContextNumber2(metadata.page) ?? getContextNumber2(metadata.pageNumber) ?? (typeof metadata.pageIndex === "number" ? metadata.pageIndex + 1 : undefined);
3990
+ const region = getContextNumber2(metadata.regionNumber) ?? (typeof metadata.regionIndex === "number" ? metadata.regionIndex + 1 : undefined);
3991
+ if (page && region) {
3992
+ return `Page ${page} region ${region}`;
3993
+ }
3980
3994
  if (page) {
3981
3995
  return `Page ${page}`;
3982
3996
  }
@@ -4007,6 +4021,10 @@ var buildLocatorLabel2 = (metadata, source, title) => {
4007
4021
  return;
4008
4022
  }
4009
4023
  const page = getContextNumber2(metadata.page) ?? getContextNumber2(metadata.pageNumber) ?? (typeof metadata.pageIndex === "number" ? metadata.pageIndex + 1 : undefined);
4024
+ const region = getContextNumber2(metadata.regionNumber) ?? (typeof metadata.regionIndex === "number" ? metadata.regionIndex + 1 : undefined);
4025
+ if (page && region) {
4026
+ return `Page ${page} \xB7 Region ${region}`;
4027
+ }
4010
4028
  if (page) {
4011
4029
  return `Page ${page}`;
4012
4030
  }
@@ -4049,9 +4067,11 @@ var buildProvenanceLabel2 = (metadata) => {
4049
4067
  const transcriptSource = getContextString2(metadata.transcriptSource);
4050
4068
  const pdfTextMode = getContextString2(metadata.pdfTextMode);
4051
4069
  const ocrEngine = getContextString2(metadata.ocrEngine);
4070
+ const ocrConfidence = getContextNumber2(metadata.ocrRegionConfidence) ?? getContextNumber2(metadata.ocrConfidence);
4052
4071
  const labels = [
4053
4072
  pdfTextMode ? `PDF ${pdfTextMode}` : "",
4054
4073
  ocrEngine ? `OCR ${ocrEngine}` : "",
4074
+ typeof ocrConfidence === "number" ? `Confidence ${ocrConfidence.toFixed(2)}` : "",
4055
4075
  mediaKind ? `Media ${mediaKind}` : "",
4056
4076
  transcriptSource ? `Transcript ${transcriptSource}` : "",
4057
4077
  threadTopic ? `Thread ${threadTopic}` : "",
@@ -4061,6 +4081,23 @@ var buildProvenanceLabel2 = (metadata) => {
4061
4081
  ].filter((value) => value.length > 0);
4062
4082
  return labels.length > 0 ? labels.join(" \xB7 ") : undefined;
4063
4083
  };
4084
+ var buildRAGSourceLabels = ({
4085
+ metadata,
4086
+ source,
4087
+ title
4088
+ }) => {
4089
+ const contextLabel = buildContextLabel2(metadata);
4090
+ const locatorLabel = buildLocatorLabel2(metadata, source, title);
4091
+ const provenanceLabel = buildProvenanceLabel2(metadata);
4092
+ if (!contextLabel && !locatorLabel && !provenanceLabel) {
4093
+ return;
4094
+ }
4095
+ return {
4096
+ contextLabel,
4097
+ locatorLabel,
4098
+ provenanceLabel
4099
+ };
4100
+ };
4064
4101
  var buildExcerpt2 = (text, maxLength = 160) => {
4065
4102
  const normalized = text.replaceAll(/\s+/g, " ").trim();
4066
4103
  if (normalized.length <= maxLength) {
@@ -4102,13 +4139,13 @@ var buildRAGSourceSummaries = (sources) => {
4102
4139
  citationNumbers: groupCitations.map((citation) => citationReferenceMap[citation.chunkId] ?? 0),
4103
4140
  citations: groupCitations,
4104
4141
  chunkIds: group.chunks.map((chunk) => chunk.chunkId),
4105
- contextLabel: buildContextLabel2(leadChunk?.metadata),
4142
+ contextLabel: leadChunk?.labels?.contextLabel ?? buildContextLabel2(leadChunk?.metadata),
4106
4143
  count: group.count,
4107
4144
  excerpt: buildExcerpt2(leadChunk?.text ?? ""),
4108
4145
  key: group.key,
4109
4146
  label: group.label,
4110
- locatorLabel: buildLocatorLabel2(leadChunk?.metadata, leadChunk?.source, leadChunk?.title),
4111
- provenanceLabel: buildProvenanceLabel2(leadChunk?.metadata),
4147
+ locatorLabel: leadChunk?.labels?.locatorLabel ?? buildLocatorLabel2(leadChunk?.metadata, leadChunk?.source, leadChunk?.title),
4148
+ provenanceLabel: leadChunk?.labels?.provenanceLabel ?? buildProvenanceLabel2(leadChunk?.metadata),
4112
4149
  source: group.source,
4113
4150
  title: group.title
4114
4151
  };
@@ -4232,6 +4269,11 @@ var buildSourceGroup = (source, key) => ({
4232
4269
  count: 1,
4233
4270
  key,
4234
4271
  label: buildSourceLabel2(source),
4272
+ labels: source.labels ?? buildRAGSourceLabels({
4273
+ metadata: source.metadata,
4274
+ source: source.source,
4275
+ title: source.title
4276
+ }),
4235
4277
  source: source.source,
4236
4278
  title: source.title
4237
4279
  });
@@ -4242,7 +4284,19 @@ var updateSourceGroup = (groups, source) => {
4242
4284
  groups.set(key, buildSourceGroup(source, key));
4243
4285
  return;
4244
4286
  }
4245
- existing.bestScore = Math.max(existing.bestScore, source.score);
4287
+ if (source.score > existing.bestScore) {
4288
+ existing.bestScore = source.score;
4289
+ existing.label = buildSourceLabel2(source);
4290
+ existing.labels = source.labels ?? buildRAGSourceLabels({
4291
+ metadata: source.metadata,
4292
+ source: source.source,
4293
+ title: source.title
4294
+ });
4295
+ existing.source = source.source;
4296
+ existing.title = source.title;
4297
+ } else {
4298
+ existing.bestScore = Math.max(existing.bestScore, source.score);
4299
+ }
4246
4300
  existing.count += 1;
4247
4301
  existing.chunks.push(source);
4248
4302
  };
@@ -7330,5 +7384,5 @@ export {
7330
7384
  createAIStream
7331
7385
  };
7332
7386
 
7333
- //# debugId=C032A3F31461FE6064756E2164756E21
7387
+ //# debugId=883D3072246460B664756E2164756E21
7334
7388
  //# sourceMappingURL=index.js.map