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

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 +238 -6
  2. package/dist/ai/client/index.js.map +4 -4
  3. package/dist/ai/client/ui.js +242 -6
  4. package/dist/ai/client/ui.js.map +4 -4
  5. package/dist/ai/index.js +381 -38
  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 +242 -6
  10. package/dist/ai/rag/ui.js.map +4 -4
  11. package/dist/ai-client/angular/ai/index.js +237 -5
  12. package/dist/ai-client/react/ai/index.js +281 -12
  13. package/dist/ai-client/vue/ai/index.js +364 -97
  14. package/dist/angular/ai/index.js +238 -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 +282 -13
  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 +9 -0
  31. package/dist/src/react/ai/useRAGChunkPreview.d.ts +7 -0
  32. package/dist/src/react/ai/useRAGSources.d.ts +2 -0
  33. package/dist/src/svelte/ai/createRAG.d.ts +9 -0
  34. package/dist/src/svelte/ai/createRAGChunkPreview.d.ts +7 -0
  35. package/dist/src/svelte/ai/createRAGSources.d.ts +2 -0
  36. package/dist/src/vue/ai/useRAG.d.ts +69 -0
  37. package/dist/src/vue/ai/useRAGChunkPreview.d.ts +37 -0
  38. package/dist/src/vue/ai/useRAGSearch.d.ts +30 -0
  39. package/dist/src/vue/ai/useRAGSources.d.ts +2 -0
  40. package/dist/svelte/ai/index.js +334 -53
  41. package/dist/svelte/ai/index.js.map +6 -6
  42. package/dist/types/ai.d.ts +66 -0
  43. package/dist/vue/ai/index.js +328 -59
  44. package/dist/vue/ai/index.js.map +6 -6
  45. package/package.json +1 -1
@@ -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,188 @@ 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
+ childSectionIds: [],
4208
+ chunkCount: structure.sequence?.sectionChunkCount ?? 1,
4209
+ chunkIds: [chunk.chunkId],
4210
+ depth: structure.section?.depth,
4211
+ id: sectionId,
4212
+ kind: structure.section?.kind,
4213
+ leadChunkId: chunk.chunkId,
4214
+ path: structure.section?.path,
4215
+ title: structure.section?.title
4216
+ });
4217
+ continue;
4218
+ }
4219
+ if (!existing.chunkIds.includes(chunk.chunkId)) {
4220
+ existing.chunkIds.push(chunk.chunkId);
4221
+ }
4222
+ existing.chunkCount = Math.max(existing.chunkCount, structure.sequence?.sectionChunkCount ?? existing.chunkCount);
4223
+ }
4224
+ }
4225
+ for (const section of sections.values()) {
4226
+ section.chunkIds.sort((left, right) => {
4227
+ const leftNode = nodes.find((node) => node.chunkId === left);
4228
+ const rightNode = nodes.find((node) => node.chunkId === right);
4229
+ const leftIndex = leftNode?.structure?.sequence?.sectionChunkIndex ?? Number.MAX_SAFE_INTEGER;
4230
+ const rightIndex = rightNode?.structure?.sequence?.sectionChunkIndex ?? Number.MAX_SAFE_INTEGER;
4231
+ if (leftIndex !== rightIndex) {
4232
+ return leftIndex - rightIndex;
4233
+ }
4234
+ return left.localeCompare(right);
4235
+ });
4236
+ section.leadChunkId = section.chunkIds[0];
4237
+ }
4238
+ const sectionPathIndex = new Map;
4239
+ for (const section of sections.values()) {
4240
+ const path = section.path && section.path.length > 0 ? section.path : section.title ? [section.title] : undefined;
4241
+ if (path && path.length > 0) {
4242
+ sectionPathIndex.set(path.join("\x00"), section);
4243
+ }
4244
+ }
4245
+ for (const section of sections.values()) {
4246
+ const path = section.path && section.path.length > 0 ? section.path : section.title ? [section.title] : undefined;
4247
+ if (!path || path.length < 2) {
4248
+ continue;
4249
+ }
4250
+ const parent = sectionPathIndex.get(path.slice(0, -1).join("\x00"));
4251
+ if (!parent || parent.id === section.id) {
4252
+ continue;
4253
+ }
4254
+ section.parentSectionId = parent.id;
4255
+ if (!parent.childSectionIds.includes(section.id)) {
4256
+ parent.childSectionIds.push(section.id);
4257
+ }
4258
+ if (parent.leadChunkId && section.leadChunkId) {
4259
+ const parentKey = `section_parent:${section.leadChunkId}:${parent.leadChunkId}`;
4260
+ if (!edgeKeys.has(parentKey)) {
4261
+ edgeKeys.add(parentKey);
4262
+ edges.push({
4263
+ fromChunkId: section.leadChunkId,
4264
+ relation: "section_parent",
4265
+ toChunkId: parent.leadChunkId
4266
+ });
4267
+ }
4268
+ const childKey = `section_child:${parent.leadChunkId}:${section.leadChunkId}`;
4269
+ if (!edgeKeys.has(childKey)) {
4270
+ edgeKeys.add(childKey);
4271
+ edges.push({
4272
+ fromChunkId: parent.leadChunkId,
4273
+ relation: "section_child",
4274
+ toChunkId: section.leadChunkId
4275
+ });
4276
+ }
4277
+ }
4278
+ }
4279
+ nodes.sort((left, right) => {
4280
+ const leftSection = left.structure?.sequence?.sectionChunkIndex ?? Number.MAX_SAFE_INTEGER;
4281
+ const rightSection = right.structure?.sequence?.sectionChunkIndex ?? Number.MAX_SAFE_INTEGER;
4282
+ if (leftSection !== rightSection) {
4283
+ return leftSection - rightSection;
4284
+ }
4285
+ const leftScore = left.score ?? Number.NEGATIVE_INFINITY;
4286
+ const rightScore = right.score ?? Number.NEGATIVE_INFINITY;
4287
+ if (leftScore !== rightScore) {
4288
+ return rightScore - leftScore;
4289
+ }
4290
+ return left.label.localeCompare(right.label);
4291
+ });
4292
+ return {
4293
+ edges,
4294
+ nodes,
4295
+ sections: [...sections.values()].sort((left, right) => (left.title ?? left.id).localeCompare(right.title ?? right.id))
4296
+ };
4297
+ };
4298
+ var buildRAGChunkPreviewGraph = (preview) => buildRAGChunkGraph(preview.chunks.map((chunk) => ({
4299
+ chunkId: chunk.chunkId,
4300
+ labels: chunk.labels,
4301
+ metadata: chunk.metadata,
4302
+ source: chunk.source ?? preview.document.source,
4303
+ structure: chunk.structure,
4304
+ title: chunk.title ?? preview.document.title
4305
+ })));
4306
+ var buildRAGChunkPreviewNavigation = (preview, activeChunkId) => buildRAGChunkGraphNavigation(buildRAGChunkPreviewGraph(preview), activeChunkId);
4307
+ var buildRAGChunkGraphNavigation = (graph, activeChunkId) => {
4308
+ if (graph.nodes.length === 0) {
4309
+ return {
4310
+ activeChunkId,
4311
+ childSections: [],
4312
+ siblingSections: [],
4313
+ sectionNodes: []
4314
+ };
4315
+ }
4316
+ const activeNode = (activeChunkId ? graph.nodes.find((node) => node.chunkId === activeChunkId) : undefined) ?? graph.nodes[0];
4317
+ const resolvedActiveChunkId = activeNode?.chunkId;
4318
+ const previousNode = activeNode?.structure?.sequence?.previousChunkId ? graph.nodes.find((node) => node.chunkId === activeNode.structure?.sequence?.previousChunkId) : undefined;
4319
+ const nextNode = activeNode?.structure?.sequence?.nextChunkId ? graph.nodes.find((node) => node.chunkId === activeNode.structure?.sequence?.nextChunkId) : undefined;
4320
+ const section = activeNode?.structure?.sequence?.sectionChunkId ? graph.sections.find((entry) => entry.id === activeNode.structure?.sequence?.sectionChunkId) : undefined;
4321
+ const parentSection = section?.parentSectionId ? graph.sections.find((entry) => entry.id === section.parentSectionId) : undefined;
4322
+ const childSections = section ? section.childSectionIds.map((sectionId) => graph.sections.find((entry) => entry.id === sectionId)).filter((entry) => Boolean(entry)) : [];
4323
+ const siblingSections = section?.parentSectionId ? graph.sections.filter((entry) => entry.parentSectionId === section.parentSectionId && entry.id !== section.id) : [];
4324
+ const sectionNodes = section ? section.chunkIds.map((chunkId) => graph.nodes.find((node) => node.chunkId === chunkId)).filter((node) => Boolean(node)) : activeNode ? [activeNode] : [];
4325
+ return {
4326
+ activeChunkId: resolvedActiveChunkId,
4327
+ activeNode,
4328
+ childSections,
4329
+ nextNode,
4330
+ parentSection,
4331
+ previousNode,
4332
+ section,
4333
+ siblingSections,
4334
+ sectionNodes
4335
+ };
4336
+ };
4108
4337
  var buildRAGRetrievedState = (messages) => {
4109
4338
  const message = getLatestRetrievedMessage(messages);
4110
4339
  if (!message) {
@@ -4146,6 +4375,7 @@ var buildRAGSourceSummaries = (sources) => {
4146
4375
  label: group.label,
4147
4376
  locatorLabel: leadChunk?.labels?.locatorLabel ?? buildLocatorLabel2(leadChunk?.metadata, leadChunk?.source, leadChunk?.title),
4148
4377
  provenanceLabel: leadChunk?.labels?.provenanceLabel ?? buildProvenanceLabel2(leadChunk?.metadata),
4378
+ structure: leadChunk?.structure ?? buildRAGChunkStructure(leadChunk?.metadata),
4149
4379
  source: group.source,
4150
4380
  title: group.title
4151
4381
  };
@@ -4274,6 +4504,7 @@ var buildSourceGroup = (source, key) => ({
4274
4504
  source: source.source,
4275
4505
  title: source.title
4276
4506
  }),
4507
+ structure: source.structure ?? buildRAGChunkStructure(source.metadata),
4277
4508
  source: source.source,
4278
4509
  title: source.title
4279
4510
  });
@@ -4292,6 +4523,7 @@ var updateSourceGroup = (groups, source) => {
4292
4523
  source: source.source,
4293
4524
  title: source.title
4294
4525
  });
4526
+ existing.structure = source.structure ?? buildRAGChunkStructure(source.metadata);
4295
4527
  existing.source = source.source;
4296
4528
  existing.title = source.title;
4297
4529
  } else {
@@ -5508,7 +5740,7 @@ var useAIStream = (path, conversationId) => {
5508
5740
  };
5509
5741
  };
5510
5742
  // src/vue/ai/useRAGChunkPreview.ts
5511
- import { ref as ref2 } from "vue";
5743
+ import { computed, ref as ref2 } from "vue";
5512
5744
 
5513
5745
  // src/ai/client/ragClient.ts
5514
5746
  init_constants();
@@ -6586,8 +6818,11 @@ var createRAGClient = (options) => {
6586
6818
  var useRAGChunkPreview = (path) => {
6587
6819
  const client = createRAGClient({ path });
6588
6820
  const preview = ref2(null);
6821
+ const activeChunkId = ref2(null);
6589
6822
  const error = ref2(null);
6590
6823
  const isLoading = ref2(false);
6824
+ const chunkGraph = computed(() => preview.value ? buildRAGChunkPreviewGraph(preview.value) : null);
6825
+ const navigation = computed(() => preview.value ? buildRAGChunkPreviewNavigation(preview.value, activeChunkId.value ?? undefined) : null);
6591
6826
  const inspect = async (id) => {
6592
6827
  isLoading.value = true;
6593
6828
  error.value = null;
@@ -6597,6 +6832,7 @@ var useRAGChunkPreview = (path) => {
6597
6832
  throw new Error(response.error);
6598
6833
  }
6599
6834
  preview.value = response;
6835
+ activeChunkId.value = response.chunks[0]?.chunkId ?? null;
6600
6836
  return response;
6601
6837
  } catch (caught) {
6602
6838
  error.value = caught instanceof Error ? caught.message : String(caught);
@@ -6608,27 +6844,56 @@ var useRAGChunkPreview = (path) => {
6608
6844
  const clear = () => {
6609
6845
  error.value = null;
6610
6846
  isLoading.value = false;
6847
+ activeChunkId.value = null;
6611
6848
  preview.value = null;
6612
6849
  };
6850
+ const selectChunk = (id) => {
6851
+ activeChunkId.value = id;
6852
+ };
6853
+ const selectParentSection = () => {
6854
+ const leadChunkId = navigation.value?.parentSection?.leadChunkId;
6855
+ if (leadChunkId) {
6856
+ activeChunkId.value = leadChunkId;
6857
+ }
6858
+ };
6859
+ const selectChildSection = (sectionId) => {
6860
+ const leadChunkId = navigation.value?.childSections.find((section) => section.id === sectionId)?.leadChunkId;
6861
+ if (leadChunkId) {
6862
+ activeChunkId.value = leadChunkId;
6863
+ }
6864
+ };
6865
+ const selectSiblingSection = (sectionId) => {
6866
+ const leadChunkId = navigation.value?.siblingSections.find((section) => section.id === sectionId)?.leadChunkId;
6867
+ if (leadChunkId) {
6868
+ activeChunkId.value = leadChunkId;
6869
+ }
6870
+ };
6613
6871
  return {
6872
+ activeChunkId,
6614
6873
  clear,
6874
+ chunkGraph,
6615
6875
  error,
6616
6876
  inspect,
6617
6877
  isLoading,
6618
- preview
6878
+ navigation,
6879
+ preview,
6880
+ selectChildSection,
6881
+ selectChunk,
6882
+ selectParentSection,
6883
+ selectSiblingSection
6619
6884
  };
6620
6885
  };
6621
6886
  // src/vue/ai/useRAG.ts
6622
- import { computed as computed8 } from "vue";
6887
+ import { computed as computed9 } from "vue";
6623
6888
 
6624
6889
  // src/vue/ai/useRAGCitations.ts
6625
- import { computed } from "vue";
6890
+ import { computed as computed2 } from "vue";
6626
6891
  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);
6892
+ const citations = computed2(() => buildRAGCitations(sources.value));
6893
+ const citationReferenceMap = computed2(() => buildRAGCitationReferenceMap(citations.value));
6894
+ const sourceGroups = computed2(() => buildRAGSourceGroups(sources.value));
6895
+ const sourceSummaries = computed2(() => buildRAGSourceSummaries(sources.value));
6896
+ const hasCitations = computed2(() => citations.value.length > 0);
6632
6897
  return {
6633
6898
  citationReferenceMap,
6634
6899
  citations,
@@ -6678,7 +6943,7 @@ var useRAGDocuments = (path) => {
6678
6943
  };
6679
6944
 
6680
6945
  // src/vue/ai/useRAGEvaluate.ts
6681
- import { computed as computed2, ref as ref4 } from "vue";
6946
+ import { computed as computed3, ref as ref4 } from "vue";
6682
6947
  var useRAGEvaluate = (path) => {
6683
6948
  const client = createRAGClient({ path });
6684
6949
  const error = ref4(null);
@@ -6735,7 +7000,7 @@ var useRAGEvaluate = (path) => {
6735
7000
  const clearRuns = () => {
6736
7001
  suiteRuns.value = [];
6737
7002
  };
6738
- const leaderboard = computed2(() => buildRAGEvaluationLeaderboard(suiteRuns.value));
7003
+ const leaderboard = computed3(() => buildRAGEvaluationLeaderboard(suiteRuns.value));
6739
7004
  const reset = () => {
6740
7005
  error.value = null;
6741
7006
  lastRequest.value = null;
@@ -6760,14 +7025,14 @@ var useRAGEvaluate = (path) => {
6760
7025
  };
6761
7026
 
6762
7027
  // src/vue/ai/useRAGGrounding.ts
6763
- import { computed as computed3 } from "vue";
7028
+ import { computed as computed4 } from "vue";
6764
7029
  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);
7030
+ const groundedAnswer = computed4(() => buildRAGGroundedAnswer(content.value, sources.value));
7031
+ const references = computed4(() => buildRAGGroundingReferences(sources.value));
7032
+ const hasCitations = computed4(() => groundedAnswer.value.hasCitations);
7033
+ const hasGrounding = computed4(() => references.value.length > 0);
7034
+ const coverage = computed4(() => groundedAnswer.value.coverage);
7035
+ const ungroundedReferenceNumbers = computed4(() => groundedAnswer.value.ungroundedReferenceNumbers);
6771
7036
  return {
6772
7037
  coverage,
6773
7038
  groundedAnswer,
@@ -7178,18 +7443,22 @@ var useRAGSearch = (path) => {
7178
7443
  };
7179
7444
 
7180
7445
  // src/vue/ai/useRAGSources.ts
7181
- import { computed as computed4 } from "vue";
7446
+ import { computed as computed5 } from "vue";
7182
7447
  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);
7448
+ const latestAssistantMessage = computed5(() => getLatestAssistantMessage(messages.value));
7449
+ const sources = computed5(() => getLatestRAGSources(messages.value));
7450
+ const sourceGroups = computed5(() => buildRAGSourceGroups(sources.value));
7451
+ const sourceSummaries = computed5(() => buildRAGSourceSummaries(sources.value));
7452
+ const chunkGraph = computed5(() => buildRAGChunkGraph(sources.value));
7453
+ const citationReferenceMap = computed5(() => buildRAGCitationReferenceMap(sourceSummaries.value.flatMap((summary) => summary.citations)));
7454
+ const hasSources = computed5(() => sources.value.length > 0);
7455
+ const navigationForChunk = (chunkId) => buildRAGChunkGraphNavigation(chunkGraph.value, chunkId ?? undefined);
7189
7456
  return {
7190
7457
  citationReferenceMap,
7458
+ chunkGraph,
7191
7459
  hasSources,
7192
7460
  latestAssistantMessage,
7461
+ navigationForChunk,
7193
7462
  sourceGroups,
7194
7463
  sources,
7195
7464
  sourceSummaries
@@ -7243,14 +7512,14 @@ var useRAGStatus = (path, autoLoad = true) => {
7243
7512
  };
7244
7513
 
7245
7514
  // src/vue/ai/useRAGWorkflow.ts
7246
- import { computed as computed7 } from "vue";
7515
+ import { computed as computed8 } from "vue";
7247
7516
 
7248
7517
  // src/vue/ai/useRAGStream.ts
7249
- import { computed as computed6 } from "vue";
7518
+ import { computed as computed7 } from "vue";
7250
7519
 
7251
7520
  // src/vue/ai/useRAGStreamProgress.ts
7252
- import { computed as computed5 } from "vue";
7253
- var useRAGStreamProgress = (params) => computed5(() => buildRAGStreamProgress({
7521
+ import { computed as computed6 } from "vue";
7522
+ var useRAGStreamProgress = (params) => computed6(() => buildRAGStreamProgress({
7254
7523
  error: params.error.value,
7255
7524
  isStreaming: params.isStreaming.value,
7256
7525
  messages: params.messages.value
@@ -7259,7 +7528,7 @@ var useRAGStreamProgress = (params) => computed5(() => buildRAGStreamProgress({
7259
7528
  // src/vue/ai/useRAGStream.ts
7260
7529
  var useRAGStream = (path, conversationId) => {
7261
7530
  const stream = useAIStream(path, conversationId);
7262
- const workflow = computed6(() => buildRAGAnswerWorkflowState({
7531
+ const workflow = computed7(() => buildRAGAnswerWorkflowState({
7263
7532
  error: stream.error.value,
7264
7533
  isStreaming: stream.isStreaming.value,
7265
7534
  messages: stream.messages.value
@@ -7272,37 +7541,37 @@ var useRAGStream = (path, conversationId) => {
7272
7541
  const query = (content, attachments) => {
7273
7542
  stream.send(content, attachments);
7274
7543
  };
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);
7544
+ const hasRetrieved = computed7(() => workflow.value.hasRetrieved);
7545
+ const isRetrieving = computed7(() => workflow.value.isRetrieving);
7546
+ const isRetrieved = computed7(() => workflow.value.isRetrieved);
7547
+ const isAnswerStreaming = computed7(() => workflow.value.isAnswerStreaming);
7548
+ const isComplete = computed7(() => workflow.value.isComplete);
7549
+ const hasSources = computed7(() => workflow.value.hasSources);
7281
7550
  return {
7282
7551
  ...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),
7552
+ citationReferenceMap: computed7(() => workflow.value.citationReferenceMap),
7553
+ citations: computed7(() => workflow.value.citations),
7554
+ coverage: computed7(() => workflow.value.coverage),
7555
+ groundedAnswer: computed7(() => workflow.value.groundedAnswer),
7556
+ groundingReferences: computed7(() => workflow.value.groundingReferences),
7557
+ hasGrounding: computed7(() => workflow.value.hasGrounding),
7289
7558
  hasRetrieved,
7290
7559
  hasSources,
7291
7560
  isAnswerStreaming,
7292
7561
  isComplete,
7293
- isError: computed6(() => workflow.value.isError),
7562
+ isError: computed7(() => workflow.value.isError),
7294
7563
  isRetrieved,
7295
7564
  isRetrieving,
7296
- isRunning: computed6(() => workflow.value.isRunning),
7297
- latestAssistantMessage: computed6(() => workflow.value.latestAssistantMessage),
7565
+ isRunning: computed7(() => workflow.value.isRunning),
7566
+ latestAssistantMessage: computed7(() => workflow.value.latestAssistantMessage),
7298
7567
  progress,
7299
7568
  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),
7569
+ retrieval: computed7(() => workflow.value.retrieval),
7570
+ sourceGroups: computed7(() => workflow.value.sourceGroups),
7571
+ sourceSummaries: computed7(() => workflow.value.sourceSummaries),
7572
+ sources: computed7(() => workflow.value.sources),
7573
+ stage: computed7(() => workflow.value.stage),
7574
+ ungroundedReferenceNumbers: computed7(() => workflow.value.ungroundedReferenceNumbers),
7306
7575
  workflow
7307
7576
  };
7308
7577
  };
@@ -7310,7 +7579,7 @@ var useRAGStream = (path, conversationId) => {
7310
7579
  // src/vue/ai/useRAGWorkflow.ts
7311
7580
  var useRAGWorkflow = (path, conversationId) => {
7312
7581
  const stream = useRAGStream(path, conversationId);
7313
- const state = computed7(() => stream.workflow.value);
7582
+ const state = computed8(() => stream.workflow.value);
7314
7583
  return {
7315
7584
  ...stream,
7316
7585
  state
@@ -7330,7 +7599,7 @@ var useRAG = (path, options = {}) => {
7330
7599
  const workflow = useRAGWorkflow(options.streamPath ?? path, options.conversationId);
7331
7600
  const sources = useRAGSources(workflow.messages);
7332
7601
  const citations = useRAGCitations(sources.sources);
7333
- const grounding = useRAGGrounding(computed8(() => workflow.latestAssistantMessage.value?.content ?? ""), sources.sources);
7602
+ const grounding = useRAGGrounding(computed9(() => workflow.latestAssistantMessage.value?.content ?? ""), sources.sources);
7334
7603
  return {
7335
7604
  chunkPreview,
7336
7605
  citations,
@@ -7367,5 +7636,5 @@ export {
7367
7636
  AIStreamKey
7368
7637
  };
7369
7638
 
7370
- //# debugId=B9389B1DE37A071364756E2164756E21
7639
+ //# debugId=E188A8917F67F05864756E2164756E21
7371
7640
  //# sourceMappingURL=index.js.map