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

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 (45) hide show
  1. package/dist/ai/client/index.js +186 -6
  2. package/dist/ai/client/index.js.map +4 -4
  3. package/dist/ai/client/ui.js +190 -6
  4. package/dist/ai/client/ui.js.map +4 -4
  5. package/dist/ai/index.js +289 -36
  6. package/dist/ai/index.js.map +7 -7
  7. package/dist/ai/rag/quality.js +17 -6
  8. package/dist/ai/rag/quality.js.map +3 -3
  9. package/dist/ai/rag/ui.js +190 -6
  10. package/dist/ai/rag/ui.js.map +4 -4
  11. package/dist/ai-client/angular/ai/index.js +185 -5
  12. package/dist/ai-client/react/ai/index.js +200 -6
  13. package/dist/ai-client/vue/ai/index.js +289 -97
  14. package/dist/angular/ai/index.js +186 -6
  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 +201 -7
  25. package/dist/react/ai/index.js.map +6 -6
  26. package/dist/src/ai/client/ui.d.ts +1 -1
  27. package/dist/src/ai/rag/index.d.ts +1 -1
  28. package/dist/src/ai/rag/presentation.d.ts +7 -1
  29. package/dist/src/ai/rag/ui.d.ts +1 -1
  30. package/dist/src/react/ai/useRAG.d.ts +5 -0
  31. package/dist/src/react/ai/useRAGChunkPreview.d.ts +4 -0
  32. package/dist/src/react/ai/useRAGSources.d.ts +1 -0
  33. package/dist/src/svelte/ai/createRAG.d.ts +5 -0
  34. package/dist/src/svelte/ai/createRAGChunkPreview.d.ts +4 -0
  35. package/dist/src/svelte/ai/createRAGSources.d.ts +1 -0
  36. package/dist/src/vue/ai/useRAG.d.ts +65 -0
  37. package/dist/src/vue/ai/useRAGChunkPreview.d.ts +34 -0
  38. package/dist/src/vue/ai/useRAGSearch.d.ts +30 -0
  39. package/dist/src/vue/ai/useRAGSources.d.ts +1 -0
  40. package/dist/svelte/ai/index.js +247 -53
  41. package/dist/svelte/ai/index.js.map +6 -6
  42. package/dist/types/ai.d.ts +60 -0
  43. package/dist/vue/ai/index.js +253 -59
  44. package/dist/vue/ai/index.js.map +6 -6
  45. package/package.json +1 -1
@@ -10,6 +10,7 @@ export type RAGSource = {
10
10
  source?: string;
11
11
  metadata?: Record<string, unknown>;
12
12
  labels?: RAGSourceLabels;
13
+ structure?: RAGChunkStructure;
13
14
  };
14
15
  export type RAGSourceGroup = {
15
16
  key: string;
@@ -20,6 +21,7 @@ export type RAGSourceGroup = {
20
21
  count: number;
21
22
  chunks: RAGSource[];
22
23
  labels?: RAGSourceLabels;
24
+ structure?: RAGChunkStructure;
23
25
  };
24
26
  export type RAGCitation = {
25
27
  key: string;
@@ -49,6 +51,7 @@ export type RAGSourceSummary = {
49
51
  contextLabel?: string;
50
52
  locatorLabel?: string;
51
53
  provenanceLabel?: string;
54
+ structure?: RAGChunkStructure;
52
55
  };
53
56
  export type RAGGroundingReference = {
54
57
  number: number;
@@ -148,6 +151,7 @@ export type RAGDocumentChunk = {
148
151
  source?: string;
149
152
  metadata?: Record<string, unknown>;
150
153
  embedding?: number[];
154
+ structure?: RAGChunkStructure;
151
155
  };
152
156
  export type RAGEmbeddingInput = {
153
157
  text: string;
@@ -410,6 +414,7 @@ export type RAGDocumentChunkPreview = {
410
414
  normalizedText: string;
411
415
  chunks: Array<RAGDocumentChunk & {
412
416
  labels?: RAGSourceLabels;
417
+ structure?: RAGChunkStructure;
413
418
  }>;
414
419
  };
415
420
  export type RAGSourceLabels = {
@@ -417,6 +422,61 @@ export type RAGSourceLabels = {
417
422
  locatorLabel?: string;
418
423
  provenanceLabel?: string;
419
424
  };
425
+ export type RAGChunkSection = {
426
+ title?: string;
427
+ path?: string[];
428
+ depth?: number;
429
+ kind?: 'markdown_heading' | 'html_heading';
430
+ };
431
+ export type RAGChunkSequence = {
432
+ sectionChunkId?: string;
433
+ sectionChunkIndex?: number;
434
+ sectionChunkCount?: number;
435
+ previousChunkId?: string;
436
+ nextChunkId?: string;
437
+ };
438
+ export type RAGChunkStructure = {
439
+ section?: RAGChunkSection;
440
+ sequence?: RAGChunkSequence;
441
+ };
442
+ export type RAGChunkGraphNode = {
443
+ chunkId: string;
444
+ label: string;
445
+ source?: string;
446
+ title?: string;
447
+ score?: number;
448
+ contextLabel?: string;
449
+ locatorLabel?: string;
450
+ provenanceLabel?: string;
451
+ structure?: RAGChunkStructure;
452
+ };
453
+ export type RAGChunkGraphEdge = {
454
+ fromChunkId: string;
455
+ toChunkId: string;
456
+ relation: 'previous' | 'next';
457
+ };
458
+ export type RAGChunkGraphSectionGroup = {
459
+ id: string;
460
+ title?: string;
461
+ path?: string[];
462
+ depth?: number;
463
+ kind?: 'markdown_heading' | 'html_heading';
464
+ chunkIds: string[];
465
+ chunkCount: number;
466
+ };
467
+ export type RAGChunkGraph = {
468
+ nodes: RAGChunkGraphNode[];
469
+ edges: RAGChunkGraphEdge[];
470
+ sections: RAGChunkGraphSectionGroup[];
471
+ };
472
+ export type RAGChunkGraphNavigation = {
473
+ activeChunkId?: string;
474
+ activeNode?: RAGChunkGraphNode;
475
+ previousNode?: RAGChunkGraphNode;
476
+ nextNode?: RAGChunkGraphNode;
477
+ section?: RAGChunkGraphSectionGroup;
478
+ sectionNodes: RAGChunkGraphNode[];
479
+ };
420
480
  export type RAGBackendDescriptor = {
421
481
  id: string;
422
482
  label: string;
@@ -243,6 +243,11 @@ var buildContextLabel = (metadata) => {
243
243
  if (speaker) {
244
244
  return `Speaker ${speaker}`;
245
245
  }
246
+ const sectionPath = Array.isArray(metadata.sectionPath) ? metadata.sectionPath.map((value) => getContextString(value)).filter((value) => typeof value === "string") : [];
247
+ const sectionTitle = getContextString(metadata.sectionTitle) ?? sectionPath.at(-1);
248
+ if (sectionTitle) {
249
+ return `Section ${sectionTitle}`;
250
+ }
246
251
  return;
247
252
  };
248
253
  var formatMediaTimestamp = (value) => {
@@ -292,6 +297,10 @@ var buildLocatorLabel = (metadata, source, title) => {
292
297
  if (mediaStart) {
293
298
  return `Timestamp ${mediaStart}`;
294
299
  }
300
+ const sectionPath = Array.isArray(metadata.sectionPath) ? metadata.sectionPath.map((value) => getContextString(value)).filter((value) => typeof value === "string") : [];
301
+ if (sectionPath.length > 0) {
302
+ return `Section ${sectionPath.join(" > ")}`;
303
+ }
295
304
  return;
296
305
  };
297
306
  var formatTimestampLabel = (value) => {
@@ -341,8 +350,10 @@ var buildExcerpt = (text, maxLength = 160) => {
341
350
  var buildGroundingReferenceEvidenceLabel = (reference) => [reference.label, reference.locatorLabel, reference.contextLabel].filter((value) => Boolean(value && value.length > 0)).filter((value, index, values) => values.findIndex((entry) => entry === value) === index).join(" \xB7 ");
342
351
  var buildGroundingReferenceEvidenceSummary = (reference) => [
343
352
  reference.source ?? reference.title ?? reference.chunkId,
353
+ reference.locatorLabel,
354
+ reference.contextLabel,
344
355
  reference.provenanceLabel
345
- ].filter((value) => Boolean(value && value.length > 0)).join(" \xB7 ");
356
+ ].filter((value) => Boolean(value && value.length > 0)).filter((value, index, values) => values.findIndex((entry) => entry === value) === index).join(" \xB7 ");
346
357
  var buildGroundedAnswerCitationDetail = (reference) => ({
347
358
  contextLabel: reference.contextLabel,
348
359
  evidenceLabel: buildGroundingReferenceEvidenceLabel(reference),
@@ -366,12 +377,12 @@ var buildRAGCitations = (sources) => {
366
377
  continue;
367
378
  unique.set(key, {
368
379
  chunkId: source.chunkId,
369
- contextLabel: buildContextLabel(source.metadata),
380
+ contextLabel: source.labels?.contextLabel ?? buildContextLabel(source.metadata),
370
381
  key,
371
382
  label: buildSourceLabel(source),
372
- locatorLabel: buildLocatorLabel(source.metadata, source.source, source.title),
383
+ locatorLabel: source.labels?.locatorLabel ?? buildLocatorLabel(source.metadata, source.source, source.title),
373
384
  metadata: source.metadata,
374
- provenanceLabel: buildProvenanceLabel(source.metadata),
385
+ provenanceLabel: source.labels?.provenanceLabel ?? buildProvenanceLabel(source.metadata),
375
386
  score: source.score,
376
387
  source: source.source,
377
388
  text: source.text,
@@ -441,7 +452,7 @@ var buildRAGGroundingReferences = (sources) => {
441
452
  const citationReferenceMap = buildRAGCitationReferenceMap(citations);
442
453
  return citations.map((citation) => ({
443
454
  chunkId: citation.chunkId,
444
- contextLabel: buildContextLabel(citation.metadata),
455
+ contextLabel: citation.contextLabel ?? buildContextLabel(citation.metadata),
445
456
  excerpt: buildExcerpt(citation.text),
446
457
  label: citation.label,
447
458
  locatorLabel: citation.locatorLabel ?? buildLocatorLabel(citation.metadata, citation.source, citation.title),
@@ -4014,6 +4025,11 @@ var buildContextLabel2 = (metadata) => {
4014
4025
  if (speaker) {
4015
4026
  return `Speaker ${speaker}`;
4016
4027
  }
4028
+ const sectionPath = Array.isArray(metadata.sectionPath) ? metadata.sectionPath.map((value) => getContextString2(value)).filter((value) => typeof value === "string") : [];
4029
+ const sectionTitle = getContextString2(metadata.sectionTitle) ?? sectionPath.at(-1);
4030
+ if (sectionTitle) {
4031
+ return `Section ${sectionTitle}`;
4032
+ }
4017
4033
  return;
4018
4034
  };
4019
4035
  var buildLocatorLabel2 = (metadata, source, title) => {
@@ -4053,6 +4069,10 @@ var buildLocatorLabel2 = (metadata, source, title) => {
4053
4069
  if (mediaStart) {
4054
4070
  return `Timestamp ${mediaStart}`;
4055
4071
  }
4072
+ const sectionPath = Array.isArray(metadata.sectionPath) ? metadata.sectionPath.map((value) => getContextString2(value)).filter((value) => typeof value === "string") : [];
4073
+ if (sectionPath.length > 0) {
4074
+ return `Section ${sectionPath.join(" > ")}`;
4075
+ }
4056
4076
  return;
4057
4077
  };
4058
4078
  var buildProvenanceLabel2 = (metadata) => {
@@ -4098,6 +4118,33 @@ var buildRAGSourceLabels = ({
4098
4118
  provenanceLabel
4099
4119
  };
4100
4120
  };
4121
+ var buildRAGChunkStructure = (metadata) => {
4122
+ if (!metadata) {
4123
+ return;
4124
+ }
4125
+ const sectionPath = Array.isArray(metadata.sectionPath) ? metadata.sectionPath.filter((value) => typeof value === "string" && value.trim().length > 0) : undefined;
4126
+ const sectionKind = metadata.sectionKind === "markdown_heading" || metadata.sectionKind === "html_heading" ? metadata.sectionKind : undefined;
4127
+ const section = {
4128
+ depth: getContextNumber2(metadata.sectionDepth),
4129
+ kind: sectionKind,
4130
+ path: sectionPath && sectionPath.length > 0 ? sectionPath : undefined,
4131
+ title: getContextString2(metadata.sectionTitle)
4132
+ };
4133
+ const sequence = {
4134
+ nextChunkId: getContextString2(metadata.nextChunkId),
4135
+ previousChunkId: getContextString2(metadata.previousChunkId),
4136
+ sectionChunkCount: getContextNumber2(metadata.sectionChunkCount),
4137
+ sectionChunkId: getContextString2(metadata.sectionChunkId),
4138
+ sectionChunkIndex: getContextNumber2(metadata.sectionChunkIndex)
4139
+ };
4140
+ if (!section.title && (!section.path || section.path.length === 0) && typeof section.depth !== "number" && !section.kind && !sequence.nextChunkId && !sequence.previousChunkId && typeof sequence.sectionChunkCount !== "number" && !sequence.sectionChunkId && typeof sequence.sectionChunkIndex !== "number") {
4141
+ return;
4142
+ }
4143
+ return {
4144
+ section: section.title || section.path && section.path.length > 0 || typeof section.depth === "number" || section.kind ? section : undefined,
4145
+ sequence: sequence.nextChunkId || sequence.previousChunkId || typeof sequence.sectionChunkCount === "number" || sequence.sectionChunkId || typeof sequence.sectionChunkIndex === "number" ? sequence : undefined
4146
+ };
4147
+ };
4101
4148
  var buildExcerpt2 = (text, maxLength = 160) => {
4102
4149
  const normalized = text.replaceAll(/\s+/g, " ").trim();
4103
4150
  if (normalized.length <= maxLength) {
@@ -4105,6 +4152,136 @@ var buildExcerpt2 = (text, maxLength = 160) => {
4105
4152
  }
4106
4153
  return `${normalized.slice(0, Math.max(0, maxLength - 1)).trimEnd()}\u2026`;
4107
4154
  };
4155
+ var buildRAGChunkGraph = (chunks) => {
4156
+ const nodes = [];
4157
+ const edges = [];
4158
+ const edgeKeys = new Set;
4159
+ const sections = new Map;
4160
+ for (const chunk of chunks) {
4161
+ const labels = chunk.labels ?? buildRAGSourceLabels({
4162
+ metadata: chunk.metadata,
4163
+ source: chunk.source,
4164
+ title: chunk.title
4165
+ });
4166
+ const structure = chunk.structure ?? buildRAGChunkStructure(chunk.metadata);
4167
+ nodes.push({
4168
+ chunkId: chunk.chunkId,
4169
+ contextLabel: labels?.contextLabel,
4170
+ label: chunk.source ?? chunk.title ?? chunk.chunkId,
4171
+ locatorLabel: labels?.locatorLabel,
4172
+ provenanceLabel: labels?.provenanceLabel,
4173
+ score: chunk.score,
4174
+ source: chunk.source,
4175
+ structure,
4176
+ title: chunk.title
4177
+ });
4178
+ const previousChunkId = structure?.sequence?.previousChunkId;
4179
+ if (previousChunkId) {
4180
+ const key = `previous:${previousChunkId}:${chunk.chunkId}`;
4181
+ if (!edgeKeys.has(key)) {
4182
+ edgeKeys.add(key);
4183
+ edges.push({
4184
+ fromChunkId: previousChunkId,
4185
+ relation: "previous",
4186
+ toChunkId: chunk.chunkId
4187
+ });
4188
+ }
4189
+ }
4190
+ const nextChunkId = structure?.sequence?.nextChunkId;
4191
+ if (nextChunkId) {
4192
+ const key = `next:${chunk.chunkId}:${nextChunkId}`;
4193
+ if (!edgeKeys.has(key)) {
4194
+ edgeKeys.add(key);
4195
+ edges.push({
4196
+ fromChunkId: chunk.chunkId,
4197
+ relation: "next",
4198
+ toChunkId: nextChunkId
4199
+ });
4200
+ }
4201
+ }
4202
+ const sectionId = structure?.sequence?.sectionChunkId;
4203
+ if (sectionId) {
4204
+ const existing = sections.get(sectionId);
4205
+ if (!existing) {
4206
+ sections.set(sectionId, {
4207
+ chunkCount: structure.sequence?.sectionChunkCount ?? 1,
4208
+ chunkIds: [chunk.chunkId],
4209
+ depth: structure.section?.depth,
4210
+ id: sectionId,
4211
+ kind: structure.section?.kind,
4212
+ path: structure.section?.path,
4213
+ title: structure.section?.title
4214
+ });
4215
+ continue;
4216
+ }
4217
+ if (!existing.chunkIds.includes(chunk.chunkId)) {
4218
+ existing.chunkIds.push(chunk.chunkId);
4219
+ }
4220
+ existing.chunkCount = Math.max(existing.chunkCount, structure.sequence?.sectionChunkCount ?? existing.chunkCount);
4221
+ }
4222
+ }
4223
+ for (const section of sections.values()) {
4224
+ section.chunkIds.sort((left, right) => {
4225
+ const leftNode = nodes.find((node) => node.chunkId === left);
4226
+ const rightNode = nodes.find((node) => node.chunkId === right);
4227
+ const leftIndex = leftNode?.structure?.sequence?.sectionChunkIndex ?? Number.MAX_SAFE_INTEGER;
4228
+ const rightIndex = rightNode?.structure?.sequence?.sectionChunkIndex ?? Number.MAX_SAFE_INTEGER;
4229
+ if (leftIndex !== rightIndex) {
4230
+ return leftIndex - rightIndex;
4231
+ }
4232
+ return left.localeCompare(right);
4233
+ });
4234
+ }
4235
+ nodes.sort((left, right) => {
4236
+ const leftSection = left.structure?.sequence?.sectionChunkIndex ?? Number.MAX_SAFE_INTEGER;
4237
+ const rightSection = right.structure?.sequence?.sectionChunkIndex ?? Number.MAX_SAFE_INTEGER;
4238
+ if (leftSection !== rightSection) {
4239
+ return leftSection - rightSection;
4240
+ }
4241
+ const leftScore = left.score ?? Number.NEGATIVE_INFINITY;
4242
+ const rightScore = right.score ?? Number.NEGATIVE_INFINITY;
4243
+ if (leftScore !== rightScore) {
4244
+ return rightScore - leftScore;
4245
+ }
4246
+ return left.label.localeCompare(right.label);
4247
+ });
4248
+ return {
4249
+ edges,
4250
+ nodes,
4251
+ sections: [...sections.values()].sort((left, right) => (left.title ?? left.id).localeCompare(right.title ?? right.id))
4252
+ };
4253
+ };
4254
+ var buildRAGChunkPreviewGraph = (preview) => buildRAGChunkGraph(preview.chunks.map((chunk) => ({
4255
+ chunkId: chunk.chunkId,
4256
+ labels: chunk.labels,
4257
+ metadata: chunk.metadata,
4258
+ source: chunk.source ?? preview.document.source,
4259
+ structure: chunk.structure,
4260
+ title: chunk.title ?? preview.document.title
4261
+ })));
4262
+ var buildRAGChunkPreviewNavigation = (preview, activeChunkId) => buildRAGChunkGraphNavigation(buildRAGChunkPreviewGraph(preview), activeChunkId);
4263
+ var buildRAGChunkGraphNavigation = (graph, activeChunkId) => {
4264
+ if (graph.nodes.length === 0) {
4265
+ return {
4266
+ activeChunkId,
4267
+ sectionNodes: []
4268
+ };
4269
+ }
4270
+ const activeNode = (activeChunkId ? graph.nodes.find((node) => node.chunkId === activeChunkId) : undefined) ?? graph.nodes[0];
4271
+ const resolvedActiveChunkId = activeNode?.chunkId;
4272
+ const previousNode = activeNode?.structure?.sequence?.previousChunkId ? graph.nodes.find((node) => node.chunkId === activeNode.structure?.sequence?.previousChunkId) : undefined;
4273
+ const nextNode = activeNode?.structure?.sequence?.nextChunkId ? graph.nodes.find((node) => node.chunkId === activeNode.structure?.sequence?.nextChunkId) : undefined;
4274
+ const section = activeNode?.structure?.sequence?.sectionChunkId ? graph.sections.find((entry) => entry.id === activeNode.structure?.sequence?.sectionChunkId) : undefined;
4275
+ const sectionNodes = section ? section.chunkIds.map((chunkId) => graph.nodes.find((node) => node.chunkId === chunkId)).filter((node) => Boolean(node)) : activeNode ? [activeNode] : [];
4276
+ return {
4277
+ activeChunkId: resolvedActiveChunkId,
4278
+ activeNode,
4279
+ nextNode,
4280
+ previousNode,
4281
+ section,
4282
+ sectionNodes
4283
+ };
4284
+ };
4108
4285
  var buildRAGRetrievedState = (messages) => {
4109
4286
  const message = getLatestRetrievedMessage(messages);
4110
4287
  if (!message) {
@@ -4146,6 +4323,7 @@ var buildRAGSourceSummaries = (sources) => {
4146
4323
  label: group.label,
4147
4324
  locatorLabel: leadChunk?.labels?.locatorLabel ?? buildLocatorLabel2(leadChunk?.metadata, leadChunk?.source, leadChunk?.title),
4148
4325
  provenanceLabel: leadChunk?.labels?.provenanceLabel ?? buildProvenanceLabel2(leadChunk?.metadata),
4326
+ structure: leadChunk?.structure ?? buildRAGChunkStructure(leadChunk?.metadata),
4149
4327
  source: group.source,
4150
4328
  title: group.title
4151
4329
  };
@@ -4274,6 +4452,7 @@ var buildSourceGroup = (source, key) => ({
4274
4452
  source: source.source,
4275
4453
  title: source.title
4276
4454
  }),
4455
+ structure: source.structure ?? buildRAGChunkStructure(source.metadata),
4277
4456
  source: source.source,
4278
4457
  title: source.title
4279
4458
  });
@@ -4292,6 +4471,7 @@ var updateSourceGroup = (groups, source) => {
4292
4471
  source: source.source,
4293
4472
  title: source.title
4294
4473
  });
4474
+ existing.structure = source.structure ?? buildRAGChunkStructure(source.metadata);
4295
4475
  existing.source = source.source;
4296
4476
  existing.title = source.title;
4297
4477
  } else {
@@ -5508,7 +5688,7 @@ var useAIStream = (path, conversationId) => {
5508
5688
  };
5509
5689
  };
5510
5690
  // src/vue/ai/useRAGChunkPreview.ts
5511
- import { ref as ref2 } from "vue";
5691
+ import { computed, ref as ref2 } from "vue";
5512
5692
 
5513
5693
  // src/ai/client/ragClient.ts
5514
5694
  init_constants();
@@ -6586,8 +6766,11 @@ var createRAGClient = (options) => {
6586
6766
  var useRAGChunkPreview = (path) => {
6587
6767
  const client = createRAGClient({ path });
6588
6768
  const preview = ref2(null);
6769
+ const activeChunkId = ref2(null);
6589
6770
  const error = ref2(null);
6590
6771
  const isLoading = ref2(false);
6772
+ const chunkGraph = computed(() => preview.value ? buildRAGChunkPreviewGraph(preview.value) : null);
6773
+ const navigation = computed(() => preview.value ? buildRAGChunkPreviewNavigation(preview.value, activeChunkId.value ?? undefined) : null);
6591
6774
  const inspect = async (id) => {
6592
6775
  isLoading.value = true;
6593
6776
  error.value = null;
@@ -6597,6 +6780,7 @@ var useRAGChunkPreview = (path) => {
6597
6780
  throw new Error(response.error);
6598
6781
  }
6599
6782
  preview.value = response;
6783
+ activeChunkId.value = response.chunks[0]?.chunkId ?? null;
6600
6784
  return response;
6601
6785
  } catch (caught) {
6602
6786
  error.value = caught instanceof Error ? caught.message : String(caught);
@@ -6608,27 +6792,35 @@ var useRAGChunkPreview = (path) => {
6608
6792
  const clear = () => {
6609
6793
  error.value = null;
6610
6794
  isLoading.value = false;
6795
+ activeChunkId.value = null;
6611
6796
  preview.value = null;
6612
6797
  };
6798
+ const selectChunk = (id) => {
6799
+ activeChunkId.value = id;
6800
+ };
6613
6801
  return {
6802
+ activeChunkId,
6614
6803
  clear,
6804
+ chunkGraph,
6615
6805
  error,
6616
6806
  inspect,
6617
6807
  isLoading,
6618
- preview
6808
+ navigation,
6809
+ preview,
6810
+ selectChunk
6619
6811
  };
6620
6812
  };
6621
6813
  // src/vue/ai/useRAG.ts
6622
- import { computed as computed8 } from "vue";
6814
+ import { computed as computed9 } from "vue";
6623
6815
 
6624
6816
  // src/vue/ai/useRAGCitations.ts
6625
- import { computed } from "vue";
6817
+ import { computed as computed2 } from "vue";
6626
6818
  var useRAGCitations = (sources) => {
6627
- const citations = computed(() => buildRAGCitations(sources.value));
6628
- const citationReferenceMap = computed(() => buildRAGCitationReferenceMap(citations.value));
6629
- const sourceGroups = computed(() => buildRAGSourceGroups(sources.value));
6630
- const sourceSummaries = computed(() => buildRAGSourceSummaries(sources.value));
6631
- const hasCitations = computed(() => citations.value.length > 0);
6819
+ const citations = computed2(() => buildRAGCitations(sources.value));
6820
+ const citationReferenceMap = computed2(() => buildRAGCitationReferenceMap(citations.value));
6821
+ const sourceGroups = computed2(() => buildRAGSourceGroups(sources.value));
6822
+ const sourceSummaries = computed2(() => buildRAGSourceSummaries(sources.value));
6823
+ const hasCitations = computed2(() => citations.value.length > 0);
6632
6824
  return {
6633
6825
  citationReferenceMap,
6634
6826
  citations,
@@ -6678,7 +6870,7 @@ var useRAGDocuments = (path) => {
6678
6870
  };
6679
6871
 
6680
6872
  // src/vue/ai/useRAGEvaluate.ts
6681
- import { computed as computed2, ref as ref4 } from "vue";
6873
+ import { computed as computed3, ref as ref4 } from "vue";
6682
6874
  var useRAGEvaluate = (path) => {
6683
6875
  const client = createRAGClient({ path });
6684
6876
  const error = ref4(null);
@@ -6735,7 +6927,7 @@ var useRAGEvaluate = (path) => {
6735
6927
  const clearRuns = () => {
6736
6928
  suiteRuns.value = [];
6737
6929
  };
6738
- const leaderboard = computed2(() => buildRAGEvaluationLeaderboard(suiteRuns.value));
6930
+ const leaderboard = computed3(() => buildRAGEvaluationLeaderboard(suiteRuns.value));
6739
6931
  const reset = () => {
6740
6932
  error.value = null;
6741
6933
  lastRequest.value = null;
@@ -6760,14 +6952,14 @@ var useRAGEvaluate = (path) => {
6760
6952
  };
6761
6953
 
6762
6954
  // src/vue/ai/useRAGGrounding.ts
6763
- import { computed as computed3 } from "vue";
6955
+ import { computed as computed4 } from "vue";
6764
6956
  var useRAGGrounding = (content, sources) => {
6765
- const groundedAnswer = computed3(() => buildRAGGroundedAnswer(content.value, sources.value));
6766
- const references = computed3(() => buildRAGGroundingReferences(sources.value));
6767
- const hasCitations = computed3(() => groundedAnswer.value.hasCitations);
6768
- const hasGrounding = computed3(() => references.value.length > 0);
6769
- const coverage = computed3(() => groundedAnswer.value.coverage);
6770
- const ungroundedReferenceNumbers = computed3(() => groundedAnswer.value.ungroundedReferenceNumbers);
6957
+ const groundedAnswer = computed4(() => buildRAGGroundedAnswer(content.value, sources.value));
6958
+ const references = computed4(() => buildRAGGroundingReferences(sources.value));
6959
+ const hasCitations = computed4(() => groundedAnswer.value.hasCitations);
6960
+ const hasGrounding = computed4(() => references.value.length > 0);
6961
+ const coverage = computed4(() => groundedAnswer.value.coverage);
6962
+ const ungroundedReferenceNumbers = computed4(() => groundedAnswer.value.ungroundedReferenceNumbers);
6771
6963
  return {
6772
6964
  coverage,
6773
6965
  groundedAnswer,
@@ -7178,16 +7370,18 @@ var useRAGSearch = (path) => {
7178
7370
  };
7179
7371
 
7180
7372
  // src/vue/ai/useRAGSources.ts
7181
- import { computed as computed4 } from "vue";
7373
+ import { computed as computed5 } from "vue";
7182
7374
  var useRAGSources = (messages) => {
7183
- const latestAssistantMessage = computed4(() => getLatestAssistantMessage(messages.value));
7184
- const sources = computed4(() => getLatestRAGSources(messages.value));
7185
- const sourceGroups = computed4(() => buildRAGSourceGroups(sources.value));
7186
- const sourceSummaries = computed4(() => buildRAGSourceSummaries(sources.value));
7187
- const citationReferenceMap = computed4(() => buildRAGCitationReferenceMap(sourceSummaries.value.flatMap((summary) => summary.citations)));
7188
- const hasSources = computed4(() => sources.value.length > 0);
7375
+ const latestAssistantMessage = computed5(() => getLatestAssistantMessage(messages.value));
7376
+ const sources = computed5(() => getLatestRAGSources(messages.value));
7377
+ const sourceGroups = computed5(() => buildRAGSourceGroups(sources.value));
7378
+ const sourceSummaries = computed5(() => buildRAGSourceSummaries(sources.value));
7379
+ const chunkGraph = computed5(() => buildRAGChunkGraph(sources.value));
7380
+ const citationReferenceMap = computed5(() => buildRAGCitationReferenceMap(sourceSummaries.value.flatMap((summary) => summary.citations)));
7381
+ const hasSources = computed5(() => sources.value.length > 0);
7189
7382
  return {
7190
7383
  citationReferenceMap,
7384
+ chunkGraph,
7191
7385
  hasSources,
7192
7386
  latestAssistantMessage,
7193
7387
  sourceGroups,
@@ -7243,14 +7437,14 @@ var useRAGStatus = (path, autoLoad = true) => {
7243
7437
  };
7244
7438
 
7245
7439
  // src/vue/ai/useRAGWorkflow.ts
7246
- import { computed as computed7 } from "vue";
7440
+ import { computed as computed8 } from "vue";
7247
7441
 
7248
7442
  // src/vue/ai/useRAGStream.ts
7249
- import { computed as computed6 } from "vue";
7443
+ import { computed as computed7 } from "vue";
7250
7444
 
7251
7445
  // src/vue/ai/useRAGStreamProgress.ts
7252
- import { computed as computed5 } from "vue";
7253
- var useRAGStreamProgress = (params) => computed5(() => buildRAGStreamProgress({
7446
+ import { computed as computed6 } from "vue";
7447
+ var useRAGStreamProgress = (params) => computed6(() => buildRAGStreamProgress({
7254
7448
  error: params.error.value,
7255
7449
  isStreaming: params.isStreaming.value,
7256
7450
  messages: params.messages.value
@@ -7259,7 +7453,7 @@ var useRAGStreamProgress = (params) => computed5(() => buildRAGStreamProgress({
7259
7453
  // src/vue/ai/useRAGStream.ts
7260
7454
  var useRAGStream = (path, conversationId) => {
7261
7455
  const stream = useAIStream(path, conversationId);
7262
- const workflow = computed6(() => buildRAGAnswerWorkflowState({
7456
+ const workflow = computed7(() => buildRAGAnswerWorkflowState({
7263
7457
  error: stream.error.value,
7264
7458
  isStreaming: stream.isStreaming.value,
7265
7459
  messages: stream.messages.value
@@ -7272,37 +7466,37 @@ var useRAGStream = (path, conversationId) => {
7272
7466
  const query = (content, attachments) => {
7273
7467
  stream.send(content, attachments);
7274
7468
  };
7275
- const hasRetrieved = computed6(() => workflow.value.hasRetrieved);
7276
- const isRetrieving = computed6(() => workflow.value.isRetrieving);
7277
- const isRetrieved = computed6(() => workflow.value.isRetrieved);
7278
- const isAnswerStreaming = computed6(() => workflow.value.isAnswerStreaming);
7279
- const isComplete = computed6(() => workflow.value.isComplete);
7280
- const hasSources = computed6(() => workflow.value.hasSources);
7469
+ const hasRetrieved = computed7(() => workflow.value.hasRetrieved);
7470
+ const isRetrieving = computed7(() => workflow.value.isRetrieving);
7471
+ const isRetrieved = computed7(() => workflow.value.isRetrieved);
7472
+ const isAnswerStreaming = computed7(() => workflow.value.isAnswerStreaming);
7473
+ const isComplete = computed7(() => workflow.value.isComplete);
7474
+ const hasSources = computed7(() => workflow.value.hasSources);
7281
7475
  return {
7282
7476
  ...stream,
7283
- citationReferenceMap: computed6(() => workflow.value.citationReferenceMap),
7284
- citations: computed6(() => workflow.value.citations),
7285
- coverage: computed6(() => workflow.value.coverage),
7286
- groundedAnswer: computed6(() => workflow.value.groundedAnswer),
7287
- groundingReferences: computed6(() => workflow.value.groundingReferences),
7288
- hasGrounding: computed6(() => workflow.value.hasGrounding),
7477
+ citationReferenceMap: computed7(() => workflow.value.citationReferenceMap),
7478
+ citations: computed7(() => workflow.value.citations),
7479
+ coverage: computed7(() => workflow.value.coverage),
7480
+ groundedAnswer: computed7(() => workflow.value.groundedAnswer),
7481
+ groundingReferences: computed7(() => workflow.value.groundingReferences),
7482
+ hasGrounding: computed7(() => workflow.value.hasGrounding),
7289
7483
  hasRetrieved,
7290
7484
  hasSources,
7291
7485
  isAnswerStreaming,
7292
7486
  isComplete,
7293
- isError: computed6(() => workflow.value.isError),
7487
+ isError: computed7(() => workflow.value.isError),
7294
7488
  isRetrieved,
7295
7489
  isRetrieving,
7296
- isRunning: computed6(() => workflow.value.isRunning),
7297
- latestAssistantMessage: computed6(() => workflow.value.latestAssistantMessage),
7490
+ isRunning: computed7(() => workflow.value.isRunning),
7491
+ latestAssistantMessage: computed7(() => workflow.value.latestAssistantMessage),
7298
7492
  progress,
7299
7493
  query,
7300
- retrieval: computed6(() => workflow.value.retrieval),
7301
- sourceGroups: computed6(() => workflow.value.sourceGroups),
7302
- sourceSummaries: computed6(() => workflow.value.sourceSummaries),
7303
- sources: computed6(() => workflow.value.sources),
7304
- stage: computed6(() => workflow.value.stage),
7305
- ungroundedReferenceNumbers: computed6(() => workflow.value.ungroundedReferenceNumbers),
7494
+ retrieval: computed7(() => workflow.value.retrieval),
7495
+ sourceGroups: computed7(() => workflow.value.sourceGroups),
7496
+ sourceSummaries: computed7(() => workflow.value.sourceSummaries),
7497
+ sources: computed7(() => workflow.value.sources),
7498
+ stage: computed7(() => workflow.value.stage),
7499
+ ungroundedReferenceNumbers: computed7(() => workflow.value.ungroundedReferenceNumbers),
7306
7500
  workflow
7307
7501
  };
7308
7502
  };
@@ -7310,7 +7504,7 @@ var useRAGStream = (path, conversationId) => {
7310
7504
  // src/vue/ai/useRAGWorkflow.ts
7311
7505
  var useRAGWorkflow = (path, conversationId) => {
7312
7506
  const stream = useRAGStream(path, conversationId);
7313
- const state = computed7(() => stream.workflow.value);
7507
+ const state = computed8(() => stream.workflow.value);
7314
7508
  return {
7315
7509
  ...stream,
7316
7510
  state
@@ -7330,7 +7524,7 @@ var useRAG = (path, options = {}) => {
7330
7524
  const workflow = useRAGWorkflow(options.streamPath ?? path, options.conversationId);
7331
7525
  const sources = useRAGSources(workflow.messages);
7332
7526
  const citations = useRAGCitations(sources.sources);
7333
- const grounding = useRAGGrounding(computed8(() => workflow.latestAssistantMessage.value?.content ?? ""), sources.sources);
7527
+ const grounding = useRAGGrounding(computed9(() => workflow.latestAssistantMessage.value?.content ?? ""), sources.sources);
7334
7528
  return {
7335
7529
  chunkPreview,
7336
7530
  citations,
@@ -7367,5 +7561,5 @@ export {
7367
7561
  AIStreamKey
7368
7562
  };
7369
7563
 
7370
- //# debugId=B9389B1DE37A071364756E2164756E21
7564
+ //# debugId=8B2F93A7DA0F41AD64756E2164756E21
7371
7565
  //# sourceMappingURL=index.js.map