@absolutejs/absolute 0.19.0-beta.605 → 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.
@@ -1022,11 +1022,13 @@ var buildRAGChunkGraph = (chunks) => {
1022
1022
  const existing = sections.get(sectionId);
1023
1023
  if (!existing) {
1024
1024
  sections.set(sectionId, {
1025
+ childSectionIds: [],
1025
1026
  chunkCount: structure.sequence?.sectionChunkCount ?? 1,
1026
1027
  chunkIds: [chunk.chunkId],
1027
1028
  depth: structure.section?.depth,
1028
1029
  id: sectionId,
1029
1030
  kind: structure.section?.kind,
1031
+ leadChunkId: chunk.chunkId,
1030
1032
  path: structure.section?.path,
1031
1033
  title: structure.section?.title
1032
1034
  });
@@ -1049,6 +1051,48 @@ var buildRAGChunkGraph = (chunks) => {
1049
1051
  }
1050
1052
  return left.localeCompare(right);
1051
1053
  });
1054
+ section.leadChunkId = section.chunkIds[0];
1055
+ }
1056
+ const sectionPathIndex = new Map;
1057
+ for (const section of sections.values()) {
1058
+ const path = section.path && section.path.length > 0 ? section.path : section.title ? [section.title] : undefined;
1059
+ if (path && path.length > 0) {
1060
+ sectionPathIndex.set(path.join("\x00"), section);
1061
+ }
1062
+ }
1063
+ for (const section of sections.values()) {
1064
+ const path = section.path && section.path.length > 0 ? section.path : section.title ? [section.title] : undefined;
1065
+ if (!path || path.length < 2) {
1066
+ continue;
1067
+ }
1068
+ const parent = sectionPathIndex.get(path.slice(0, -1).join("\x00"));
1069
+ if (!parent || parent.id === section.id) {
1070
+ continue;
1071
+ }
1072
+ section.parentSectionId = parent.id;
1073
+ if (!parent.childSectionIds.includes(section.id)) {
1074
+ parent.childSectionIds.push(section.id);
1075
+ }
1076
+ if (parent.leadChunkId && section.leadChunkId) {
1077
+ const parentKey = `section_parent:${section.leadChunkId}:${parent.leadChunkId}`;
1078
+ if (!edgeKeys.has(parentKey)) {
1079
+ edgeKeys.add(parentKey);
1080
+ edges.push({
1081
+ fromChunkId: section.leadChunkId,
1082
+ relation: "section_parent",
1083
+ toChunkId: parent.leadChunkId
1084
+ });
1085
+ }
1086
+ const childKey = `section_child:${parent.leadChunkId}:${section.leadChunkId}`;
1087
+ if (!edgeKeys.has(childKey)) {
1088
+ edgeKeys.add(childKey);
1089
+ edges.push({
1090
+ fromChunkId: parent.leadChunkId,
1091
+ relation: "section_child",
1092
+ toChunkId: section.leadChunkId
1093
+ });
1094
+ }
1095
+ }
1052
1096
  }
1053
1097
  nodes.sort((left, right) => {
1054
1098
  const leftSection = left.structure?.sequence?.sectionChunkIndex ?? Number.MAX_SAFE_INTEGER;
@@ -1082,6 +1126,8 @@ var buildRAGChunkGraphNavigation = (graph, activeChunkId) => {
1082
1126
  if (graph.nodes.length === 0) {
1083
1127
  return {
1084
1128
  activeChunkId,
1129
+ childSections: [],
1130
+ siblingSections: [],
1085
1131
  sectionNodes: []
1086
1132
  };
1087
1133
  }
@@ -1090,13 +1136,19 @@ var buildRAGChunkGraphNavigation = (graph, activeChunkId) => {
1090
1136
  const previousNode = activeNode?.structure?.sequence?.previousChunkId ? graph.nodes.find((node) => node.chunkId === activeNode.structure?.sequence?.previousChunkId) : undefined;
1091
1137
  const nextNode = activeNode?.structure?.sequence?.nextChunkId ? graph.nodes.find((node) => node.chunkId === activeNode.structure?.sequence?.nextChunkId) : undefined;
1092
1138
  const section = activeNode?.structure?.sequence?.sectionChunkId ? graph.sections.find((entry) => entry.id === activeNode.structure?.sequence?.sectionChunkId) : undefined;
1139
+ const parentSection = section?.parentSectionId ? graph.sections.find((entry) => entry.id === section.parentSectionId) : undefined;
1140
+ const childSections = section ? section.childSectionIds.map((sectionId) => graph.sections.find((entry) => entry.id === sectionId)).filter((entry) => Boolean(entry)) : [];
1141
+ const siblingSections = section?.parentSectionId ? graph.sections.filter((entry) => entry.parentSectionId === section.parentSectionId && entry.id !== section.id) : [];
1093
1142
  const sectionNodes = section ? section.chunkIds.map((chunkId) => graph.nodes.find((node) => node.chunkId === chunkId)).filter((node) => Boolean(node)) : activeNode ? [activeNode] : [];
1094
1143
  return {
1095
1144
  activeChunkId: resolvedActiveChunkId,
1096
1145
  activeNode,
1146
+ childSections,
1097
1147
  nextNode,
1148
+ parentSection,
1098
1149
  previousNode,
1099
1150
  section,
1151
+ siblingSections,
1100
1152
  sectionNodes
1101
1153
  };
1102
1154
  };
@@ -1932,5 +1984,5 @@ export {
1932
1984
  buildRAGAnswerWorkflowState
1933
1985
  };
1934
1986
 
1935
- //# debugId=81687C5D34AF246364756E2164756E21
1987
+ //# debugId=946864EEE44A7E8964756E2164756E21
1936
1988
  //# sourceMappingURL=ui.js.map