@andespindola/brainlink 0.1.0-beta.75 → 0.1.0-beta.76

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.
package/README.md CHANGED
@@ -594,7 +594,7 @@ The graph UI shows:
594
594
  - double-click on canvas zooms in at cursor position
595
595
  - floating graph totals (notes, links, tags) below the Brainlink title
596
596
  - large-graph rendering safeguards (edge draw caps, lower redraw rate, zoom-aware interaction)
597
- - massive-graph LOD progression: very low zoom uses spatial overview sampling to preserve whole-vault shape while keeping node visuals consistent, then progressively reveals nodes and edges as zoom increases
597
+ - massive-graph LOD progression: very low zoom uses spatial overview sampling plus hub-neighborhood edge previews to preserve whole-vault shape and orientation, then progressively reveals nodes and edges as zoom increases
598
598
 
599
599
  The server indexes before starting by default. Use `--no-index` to skip that step:
600
600
 
@@ -1110,6 +1110,64 @@ const enrichSampleWithNeighbors = (nodes) => {
1110
1110
  }
1111
1111
  }
1112
1112
 
1113
+ const includeHubPreviewNeighborhood = (nodes, limit) => {
1114
+ const hub = state.primaryHub
1115
+ if (!hub) {
1116
+ return nodes
1117
+ }
1118
+
1119
+ const maxNodes = Math.max(1, Math.min(renderNodeBudget, limit))
1120
+ const merged = [...nodes]
1121
+ const ids = new Set(merged.map((node) => node.id))
1122
+
1123
+ if (!ids.has(hub.id)) {
1124
+ if (merged.length < maxNodes) {
1125
+ merged.push(hub)
1126
+ ids.add(hub.id)
1127
+ } else {
1128
+ const replaceIndex = merged.findIndex((node) => node.id !== hub.id)
1129
+ if (replaceIndex >= 0) {
1130
+ ids.delete(merged[replaceIndex].id)
1131
+ merged[replaceIndex] = hub
1132
+ ids.add(hub.id)
1133
+ }
1134
+ }
1135
+ }
1136
+
1137
+ const hubEdges = [...(state.visibleEdgeByNode.get(hub.id) ?? [])]
1138
+ .filter((edge) => edge.target && (edge.source === hub.id || edge.target === hub.id))
1139
+ .sort((left, right) => {
1140
+ const byWeight = edgeWeight(right) - edgeWeight(left)
1141
+ if (byWeight !== 0) return byWeight
1142
+
1143
+ const leftOtherId = left.source === hub.id ? left.target : left.source
1144
+ const rightOtherId = right.source === hub.id ? right.target : right.source
1145
+ const leftDegree = state.nodeDegrees.get(leftOtherId ?? '') ?? 0
1146
+ const rightDegree = state.nodeDegrees.get(rightOtherId ?? '') ?? 0
1147
+ if (leftDegree !== rightDegree) return rightDegree - leftDegree
1148
+
1149
+ return edgeIdentityKey(left).localeCompare(edgeIdentityKey(right))
1150
+ })
1151
+
1152
+ for (let index = 0; index < hubEdges.length && merged.length < maxNodes; index += 1) {
1153
+ const edge = hubEdges[index]
1154
+ const otherId = edge.source === hub.id ? edge.target : edge.source
1155
+ if (!otherId || ids.has(otherId)) {
1156
+ continue
1157
+ }
1158
+
1159
+ const otherNode = state.nodeById.get(otherId)
1160
+ if (!otherNode) {
1161
+ continue
1162
+ }
1163
+
1164
+ ids.add(otherId)
1165
+ merged.push(otherNode)
1166
+ }
1167
+
1168
+ return merged
1169
+ }
1170
+
1113
1171
  const ensureHubNodesInRenderedSet = (nodes) => {
1114
1172
  if (nodes.length === 0) {
1115
1173
  return nodes
@@ -1863,9 +1921,15 @@ const computeRenderVisibility = () => {
1863
1921
  sampledRaw,
1864
1922
  Math.min(sampleLimit, renderNodeBudget)
1865
1923
  )
1866
- const sampledIds = new Set(sampled.map((node) => node.id))
1867
- let sampledEdges = state.transform.scale >= 0.035 ? collectVisibleEdgesForNodes(sampledIds) : []
1868
1924
  let sampledNodes = ensureHubNodesInRenderedSet(sampled)
1925
+ if (state.transform.scale < 0.035) {
1926
+ sampledNodes = includeHubPreviewNeighborhood(
1927
+ sampledNodes,
1928
+ Math.min(renderNodeBudget, sampleLimit + 160)
1929
+ )
1930
+ }
1931
+ const sampledIds = new Set(sampledNodes.map((node) => node.id))
1932
+ let sampledEdges = collectVisibleEdgesForNodes(sampledIds)
1869
1933
 
1870
1934
  if (state.transform.scale >= 0.035 && sampledEdges.length === 0) {
1871
1935
  const enriched = enrichSampleWithNeighbors(sampledNodes)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andespindola/brainlink",
3
- "version": "0.1.0-beta.75",
3
+ "version": "0.1.0-beta.76",
4
4
  "description": "Local-first knowledge memory for agents with Markdown, backlinks, indexing and context retrieval.",
5
5
  "type": "module",
6
6
  "license": "MIT",