@andespindola/brainlink 0.1.0-beta.91 → 0.1.0-beta.93

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
@@ -602,7 +602,7 @@ The graph UI shows:
602
602
  - WebGL node and edge acceleration when supported, falling back to Canvas 2D without changing graph behavior
603
603
  - compact macro-to-micro density progression so reset keeps the graph mass oriented and zoom-in separates local neighborhoods progressively
604
604
  - graph camera treats hub-centered navigation as structural only when the hub is dominant; diffuse stress graphs reset and zoom around the full graph mass
605
- - graph LOD progression: graphs up to 1000 notes render directly; larger graphs use a compact memory-hub-centered mesh of connected 1000-note points, zoom-in continuously spreads and fades only focused clusters through 500-note, 250-note, 125-note and 60-note subgraphs with aggregated real links plus local sibling mesh links, keeps parent points during expansion to avoid visual jumps, then progressively raises the focused node budget so local areas keep nearby notes and links visible
605
+ - graph LOD progression: graphs up to 1000 notes render directly; larger graphs use a compact memory-hub-centered mesh of alpha-particle 1000-note points, zoom-in keeps focused child clusters latent at the parent position before fading them in and only then separating them through 500-note, 250-note, 125-note and 60-note subgraphs with aggregated real links plus local sibling mesh links, keeps parent points during expansion to avoid visual jumps, then progressively raises the focused node budget so local areas keep nearby notes and links visible
606
606
 
607
607
  The server indexes before starting by default. Use `--no-index` to skip that step:
608
608
 
@@ -27,15 +27,15 @@ const ecosystemGroupSizes = [1000, 500, 250, 125, 60]
27
27
  const ecosystemClusterEdgeLimit = 520
28
28
  const ecosystemHubEdgeLimit = 120
29
29
  const ecosystemSiblingEdgeLimit = 180
30
- const ecosystemClusterScaleThreshold = 0.32
30
+ const ecosystemClusterScaleThreshold = 0.78
31
31
  const ecosystemSubgraphScaleThreshold = 0.18
32
32
  const ecosystemMicroScaleThreshold = 0.08
33
- const ecosystemFocusedParentLimit = 3
33
+ const ecosystemFocusedParentLimit = 2
34
34
  const ecosystemExpansionLevels = [
35
- { parentSize: 1000, childSize: 500, start: 0.035, end: 0.105 },
36
- { parentSize: 500, childSize: 250, start: 0.075, end: 0.165 },
37
- { parentSize: 250, childSize: 125, start: 0.135, end: 0.245 },
38
- { parentSize: 125, childSize: 60, start: 0.205, end: 0.32 }
35
+ { parentSize: 1000, childSize: 500, start: 0.04, end: 0.62 },
36
+ { parentSize: 500, childSize: 250, start: 0.16, end: 0.72 },
37
+ { parentSize: 250, childSize: 125, start: 0.3, end: 0.78 },
38
+ { parentSize: 125, childSize: 60, start: 0.46, end: 0.86 }
39
39
  ]
40
40
  const zoomRecoveryGuardMs = 4200
41
41
  const zoomCapTargetViewportShare = 0.72
@@ -743,11 +743,11 @@ const selectEcosystemRepresentative = nodes => {
743
743
  }
744
744
 
745
745
  const ecosystemLayoutSpacingForSize = size => {
746
- if (size >= 1000) return 360
747
- if (size >= 500) return 160
748
- if (size >= 250) return 92
749
- if (size >= 125) return 48
750
- return 28
746
+ if (size >= 1000) return 260
747
+ if (size >= 500) return 92
748
+ if (size >= 250) return 52
749
+ if (size >= 125) return 28
750
+ return 16
751
751
  }
752
752
 
753
753
  const ecosystemCompactPoint = (index, total, center, spacing) => {
@@ -894,9 +894,11 @@ const smoothStep = value => {
894
894
  const zoomProgress = (scale, start, end) =>
895
895
  smoothStep((scale - start) / Math.max(end - start, 0.0001))
896
896
 
897
- const opacityForSpread = spread => 0.05 + smoothStep(spread) * 0.95
897
+ const semanticZoomSpread = progress => Math.pow(progress, 4.2)
898
898
 
899
- const expandFocusedClusters = (parentClusters, childSize, spread, viewport) => {
899
+ const opacityForProgress = progress => Math.pow(progress, 2.1)
900
+
901
+ const expandFocusedClusters = (parentClusters, childSize, progress, spread, viewport) => {
900
902
  const focusPoint = ecosystemFocusPoint()
901
903
  const expandedParentIds = new Set(nearestEcosystemParentIds(
902
904
  parentClusters,
@@ -906,7 +908,7 @@ const expandFocusedClusters = (parentClusters, childSize, spread, viewport) => {
906
908
  const childClusters = state.ecosystemClustersBySize.get(childSize) ?? []
907
909
  const visibleChildClusters = childClusters
908
910
  .filter(cluster => expandedParentIds.has(cluster.parentId))
909
- .map(cluster => spreadChildClusterFromParent(cluster, spread))
911
+ .map(cluster => spreadChildClusterFromParent(cluster, progress, spread))
910
912
  .filter(cluster => isClusterInViewport(cluster, viewport))
911
913
 
912
914
  return {
@@ -915,11 +917,11 @@ const expandFocusedClusters = (parentClusters, childSize, spread, viewport) => {
915
917
  }
916
918
  }
917
919
 
918
- const spreadChildClusterFromParent = (cluster, spread) => {
920
+ const spreadChildClusterFromParent = (cluster, progress, spread) => {
919
921
  if (!Number.isFinite(cluster.parentX) || !Number.isFinite(cluster.parentY)) {
920
922
  return {
921
923
  ...cluster,
922
- lodOpacity: opacityForSpread(spread)
924
+ lodOpacity: opacityForProgress(progress)
923
925
  }
924
926
  }
925
927
 
@@ -927,7 +929,7 @@ const spreadChildClusterFromParent = (cluster, spread) => {
927
929
  ...cluster,
928
930
  x: cluster.parentX + (cluster.x - cluster.parentX) * spread,
929
931
  y: cluster.parentY + (cluster.y - cluster.parentY) * spread,
930
- lodOpacity: opacityForSpread(spread)
932
+ lodOpacity: opacityForProgress(progress)
931
933
  }
932
934
  }
933
935
 
@@ -943,11 +945,9 @@ const selectHierarchicalEcosystemClusters = viewport => {
943
945
  if (parentClusters.length === 0) {
944
946
  continue
945
947
  }
946
- const spread = zoomProgress(state.transform.scale, level.start, level.end)
947
- if (spread <= 0.015) {
948
- continue
949
- }
950
- const expansion = expandFocusedClusters(parentClusters, level.childSize, spread, viewport)
948
+ const progress = zoomProgress(state.transform.scale, level.start, level.end)
949
+ const spread = semanticZoomSpread(progress)
950
+ const expansion = expandFocusedClusters(parentClusters, level.childSize, progress, spread, viewport)
951
951
  visibleClusters.push(...expansion.childClusters)
952
952
  }
953
953
 
@@ -1002,11 +1002,12 @@ const ecosystemSiblingEdgesForClusters = (clusters, existingEdges) => {
1002
1002
  }
1003
1003
 
1004
1004
  const ecosystemEdgesForClusters = clusters => {
1005
- const clusterById = new Map(clusters.map(cluster => [cluster.id, cluster]))
1005
+ const edgeClusters = clusters.filter(cluster => cluster.isHub || clusterOpacity(cluster) > 0.018)
1006
+ const clusterById = new Map(edgeClusters.map(cluster => [cluster.id, cluster]))
1006
1007
  const clusterIds = new Set(clusterById.keys())
1007
1008
  const levelsBySize = []
1008
- for (let index = 0; index < clusters.length; index += 1) {
1009
- const cluster = clusters[index]
1009
+ for (let index = 0; index < edgeClusters.length; index += 1) {
1010
+ const cluster = edgeClusters[index]
1010
1011
  if (!cluster.size || cluster.isHub) continue
1011
1012
  if (!levelsBySize.some(level => level.size === cluster.size)) {
1012
1013
  levelsBySize.push({
@@ -1057,7 +1058,7 @@ const ecosystemEdgesForClusters = clusters => {
1057
1058
  })
1058
1059
  }
1059
1060
 
1060
- ecosystemSiblingEdgesForClusters(clusters, edgeByClusterPair)
1061
+ ecosystemSiblingEdgesForClusters(edgeClusters, edgeByClusterPair)
1061
1062
  const edges = Array.from(edgeByClusterPair.values())
1062
1063
  .sort((left, right) => right.weight - left.weight)
1063
1064
  .slice(0, ecosystemClusterEdgeLimit)
@@ -1075,7 +1076,7 @@ const ecosystemEdgesForClusters = clusters => {
1075
1076
  ? [edge.sourceCluster.id]
1076
1077
  : []
1077
1078
  ))
1078
- const syntheticHubEdges = clusters
1079
+ const syntheticHubEdges = edgeClusters
1079
1080
  .filter(cluster => cluster.id !== hubCluster.id && !existingHubTargets.has(cluster.id))
1080
1081
  .slice(0, ecosystemHubEdgeLimit)
1081
1082
  .map(cluster => ({
@@ -2527,11 +2528,11 @@ const clusterRadiusPx = cluster => {
2527
2528
  return 10
2528
2529
  }
2529
2530
  if (cluster.isHub) {
2530
- return 5.2
2531
+ return 3.2
2531
2532
  }
2532
2533
  if (String(cluster.id).startsWith('ecosystem-')) {
2533
- const base = cluster.size >= 1000 ? 2.4 : cluster.size >= 500 ? 2.25 : cluster.size >= 250 ? 2.1 : cluster.size >= 125 ? 1.95 : 1.8
2534
- return Math.max(1.8, Math.min(4.2, base + Math.log10(cluster.count + 1) * 0.28))
2534
+ const base = cluster.size >= 1000 ? 0.68 : cluster.size >= 500 ? 0.64 : cluster.size >= 250 ? 0.6 : cluster.size >= 125 ? 0.56 : 0.52
2535
+ return Math.max(0.5, Math.min(1.55, base + Math.log10(cluster.count + 1) * 0.12))
2535
2536
  }
2536
2537
  return Math.max(8, Math.min(28, 8 + Math.log2(cluster.count + 1) * 3))
2537
2538
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andespindola/brainlink",
3
- "version": "0.1.0-beta.91",
3
+ "version": "0.1.0-beta.93",
4
4
  "description": "Local-first knowledge memory for agents with Markdown, backlinks, indexing and context retrieval.",
5
5
  "type": "module",
6
6
  "license": "MIT",