@andespindola/brainlink 0.1.0-beta.122 → 0.1.0-beta.123
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
|
@@ -84,11 +84,11 @@ Legacy `.jsonl.gz` packs are upgraded to `.blpk` automatically on first search/c
|
|
|
84
84
|
- Graph renderer optimized for large datasets with viewport-driven node culling and edge lookup by visible nodes.
|
|
85
85
|
- Canvas graph rendering uses the same batched node and edge pipeline for every graph size, reducing per-frame draw calls while keeping selected and hovered items highlighted.
|
|
86
86
|
- WebGL acceleration is used when available for dense node and edge drawing, with Canvas 2D preserved as the interaction and fallback layer.
|
|
87
|
-
- Graph rendering keeps the flat node scene and adds stable hierarchical groups for vaults above 1000 notes, with recursive parent groups when a level itself exceeds 1000 groups.
|
|
87
|
+
- Graph rendering keeps the flat node scene and adds stable hierarchical mesh groups for vaults above 1000 notes, with every visible graph level capped at 1000 nodes and recursive parent groups when a level itself exceeds 1000 groups.
|
|
88
88
|
- Large graph layout API automatically uses compact payload encoding with link-coverage-aware edge selection to reduce initial client load without hiding major relationships.
|
|
89
89
|
- Large-segment layout spacing now grows logarithmically to keep initial visual density consistent between medium and very large vaults (for example, ~1k vs ~50k notes).
|
|
90
90
|
- Graph coordinates are visually compacted across graph sizes so reset starts from a stable fitted scene and zoom-in progressively reveals local detail.
|
|
91
|
-
- Zoomed-out graph LOD renders hierarchy groups as normal graph nodes and expands a group only after it is framed in the viewport, progressively hiding sibling groups in micro view.
|
|
91
|
+
- Zoomed-out graph LOD renders hierarchy groups as normal mesh graph nodes and expands a group only after it is framed in the viewport, progressively hiding sibling groups in micro view.
|
|
92
92
|
- Graph reset fits the full graph scene instead of starting in a separate macro overview mode.
|
|
93
93
|
- Graph filtering runs in a dedicated browser worker to keep the UI thread responsive during heavy datasets.
|
|
94
94
|
- Edge rendering budgets adapt to zoom level to prevent frame spikes on large graph panoramas.
|
|
@@ -606,7 +606,7 @@ The graph UI shows:
|
|
|
606
606
|
- graph rendering safeguards (batched canvas drawing across graph sizes, edge draw caps, lower redraw rate, zoom-aware interaction)
|
|
607
607
|
- adaptive CPU safeguards for large graphs: idle frame pacing, throttled background physics updates and cached viewport dimensions to reduce redraw/layout overhead while preserving interaction responsiveness
|
|
608
608
|
- WebGL node and edge acceleration when supported, falling back to Canvas 2D without changing graph behavior
|
|
609
|
-
- large graph LOD keeps a recursive graph-of-graphs model: zoom-out shows one level
|
|
609
|
+
- large graph LOD keeps a recursive graph-of-graphs mesh model: zoom-out shows one level capped at 1000 group nodes, zoom-in expands the framed node into its child graph capped at 1000 nodes, micro view renders only that focused subgraph, and zoom-out restores sibling groups
|
|
610
610
|
|
|
611
611
|
The server indexes before starting by default. Use `--no-index` to skip that step:
|
|
612
612
|
|
|
@@ -4,7 +4,7 @@ const ctx = canvas.getContext('2d')
|
|
|
4
4
|
const largeGraphNodeThreshold = 4000
|
|
5
5
|
const massiveGraphNodeThreshold = 20000
|
|
6
6
|
const largeGraphEdgeRenderLimit = 120000
|
|
7
|
-
const renderNodeBudget =
|
|
7
|
+
const renderNodeBudget = 1000
|
|
8
8
|
const zoomedMassiveRenderNodeBudget = 2200
|
|
9
9
|
const massiveOverviewRenderNodeBudget = 1800
|
|
10
10
|
const massiveOverviewScaleThreshold = 0.065
|
|
@@ -1509,7 +1509,8 @@ const buildMeshEdgesForNodes = (nodes, existingEdges) => {
|
|
|
1509
1509
|
}
|
|
1510
1510
|
|
|
1511
1511
|
const withMeshEdges = (nodes, edges) => {
|
|
1512
|
-
|
|
1512
|
+
const isHierarchyGraphLevel = state.groups.length > 0 && (state.visibleNodes.length > 1000 || state.hierarchyFocusGroupId)
|
|
1513
|
+
if (nodes.length === 0 || !isHierarchyGraphLevel || state.transform.scale < meshEdgeScaleThreshold) {
|
|
1513
1514
|
return edges
|
|
1514
1515
|
}
|
|
1515
1516
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { getGraphLayout } from './get-graph-layout.js';
|
|
2
2
|
const macroScale = 0.24;
|
|
3
3
|
const microCoverage = 0.72;
|
|
4
|
-
const nodeLimit =
|
|
4
|
+
const nodeLimit = 1000;
|
|
5
5
|
const edgeLimit = 5000;
|
|
6
|
+
const meshEdgeLimit = 2500;
|
|
6
7
|
const inViewport = (item, input) => {
|
|
7
8
|
const radius = item.radius ?? 48;
|
|
8
9
|
return (item.x + radius >= input.x &&
|
|
@@ -68,6 +69,31 @@ const realEdges = (edges, nodeIds) => edges
|
|
|
68
69
|
.filter((edge) => Boolean(edge.target && nodeIds.has(edge.source) && nodeIds.has(edge.target)))
|
|
69
70
|
.slice(0, edgeLimit)
|
|
70
71
|
.map((edge) => [edge.source, edge.target, edge.weight, edge.priority]);
|
|
72
|
+
const edgePairKey = (left, right) => left < right ? `${left}|${right}` : `${right}|${left}`;
|
|
73
|
+
const meshEdges = (nodes, existingEdges) => {
|
|
74
|
+
if (nodes.length < 2) {
|
|
75
|
+
return [];
|
|
76
|
+
}
|
|
77
|
+
const existing = new Set(existingEdges.map((edge) => edgePairKey(edge[0], edge[1])));
|
|
78
|
+
const selected = [];
|
|
79
|
+
const selectedKeys = new Set();
|
|
80
|
+
const maxNeighbors = nodes.length > 500 ? 2 : 3;
|
|
81
|
+
const byX = [...nodes].sort((left, right) => left[2] - right[2] || left[3] - right[3] || left[0].localeCompare(right[0]));
|
|
82
|
+
for (let index = 0; index < nodes.length && selected.length < meshEdgeLimit; index += 1) {
|
|
83
|
+
const node = byX[index];
|
|
84
|
+
const candidates = byX.slice(index + 1, index + 1 + maxNeighbors);
|
|
85
|
+
candidates.forEach((candidate) => {
|
|
86
|
+
const key = edgePairKey(node[0], candidate[0]);
|
|
87
|
+
if (existing.has(key) || selectedKeys.has(key) || selected.length >= meshEdgeLimit) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
selectedKeys.add(key);
|
|
91
|
+
selected.push([node[0], candidate[0], 1, 'low']);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
return selected;
|
|
95
|
+
};
|
|
96
|
+
const withMeshEdges = (nodes, edges) => [...edges, ...meshEdges(nodes, edges)].slice(0, edgeLimit);
|
|
71
97
|
export const getGraphView = async (vaultPath, input) => {
|
|
72
98
|
const { signature, layout } = await getGraphLayout(vaultPath, input.agentId);
|
|
73
99
|
const groups = layout.groups ?? [];
|
|
@@ -75,11 +101,12 @@ export const getGraphView = async (vaultPath, input) => {
|
|
|
75
101
|
if (groups.length === 0) {
|
|
76
102
|
const nodes = layout.nodes.filter((node) => inViewport(node, input)).slice(0, nodeLimit);
|
|
77
103
|
const nodeIds = new Set(nodes.map((node) => node.id));
|
|
104
|
+
const viewNodes = nodes.map(realNode);
|
|
78
105
|
return {
|
|
79
106
|
signature,
|
|
80
107
|
mode: 'flat',
|
|
81
|
-
nodes:
|
|
82
|
-
edges: realEdges(layout.edges, nodeIds),
|
|
108
|
+
nodes: viewNodes,
|
|
109
|
+
edges: withMeshEdges(viewNodes, realEdges(layout.edges, nodeIds)),
|
|
83
110
|
totals: {
|
|
84
111
|
nodes: layout.nodes.length,
|
|
85
112
|
edges: layout.edges.length
|
|
@@ -97,11 +124,12 @@ export const getGraphView = async (vaultPath, input) => {
|
|
|
97
124
|
.filter((node) => nodeIds.has(node.id) && inViewport(node, input))
|
|
98
125
|
.slice(0, nodeLimit);
|
|
99
126
|
const visibleNodeIds = new Set(nodes.map((node) => node.id));
|
|
127
|
+
const viewNodes = nodes.map(realNode);
|
|
100
128
|
return {
|
|
101
129
|
signature,
|
|
102
130
|
mode: 'micro',
|
|
103
|
-
nodes:
|
|
104
|
-
edges: realEdges(layout.edges, visibleNodeIds),
|
|
131
|
+
nodes: viewNodes,
|
|
132
|
+
edges: withMeshEdges(viewNodes, realEdges(layout.edges, visibleNodeIds)),
|
|
105
133
|
totals: {
|
|
106
134
|
nodes: layout.nodes.length,
|
|
107
135
|
edges: layout.edges.length
|
|
@@ -109,11 +137,12 @@ export const getGraphView = async (vaultPath, input) => {
|
|
|
109
137
|
};
|
|
110
138
|
}
|
|
111
139
|
const groupsToRender = (visibleGroups.length > 0 ? visibleGroups : groups.filter((group) => group.parentId === null)).slice(0, nodeLimit);
|
|
140
|
+
const viewNodes = groupsToRender.map(groupNode);
|
|
112
141
|
return {
|
|
113
142
|
signature,
|
|
114
143
|
mode: 'macro',
|
|
115
|
-
nodes:
|
|
116
|
-
edges: aggregateGroupEdges(groupsToRender, layout.edges, groupById),
|
|
144
|
+
nodes: viewNodes,
|
|
145
|
+
edges: withMeshEdges(viewNodes, aggregateGroupEdges(groupsToRender, layout.edges, groupById)),
|
|
117
146
|
totals: {
|
|
118
147
|
nodes: layout.nodes.length,
|
|
119
148
|
edges: layout.edges.length
|
package/docs/AGENT_USAGE.md
CHANGED
|
@@ -607,7 +607,7 @@ Without `--vault`, the graph UI serves `$HOME/.brainlink/vault`.
|
|
|
607
607
|
|
|
608
608
|
The frontend includes an agent selector that shows only the agent id. Selecting an agent calls the same read APIs with `agent=<agent-id>` and renders that namespace instead of merging every agent into one graph.
|
|
609
609
|
|
|
610
|
-
Graph navigation controls include zoom in, zoom out, fit visible nodes and reset-to-fit-all nodes. Mouse wheel zoom (including `cmd+scroll` and `ctrl+scroll`) is anchored to the cursor. Keyboard shortcuts are `+` (zoom in), `-` (zoom out) and `0` (reset fit). Double-click on canvas zooms in at cursor position. Totals for notes, links and tags stay visible as floating metrics under the Brainlink title, and node details open on click in a modal (tags, outgoing links, backlinks and Markdown content). Vaults above 1000 notes also expose stable hierarchy groups of up to 1000 direct nodes, with recursive parent groups when a level exceeds 1000 groups; zoom-out renders those groups as normal graph nodes, zoom-in expands a group only after it is framed in the viewport, and micro view renders only the focused subgraph until zoom-out restores sibling groups.
|
|
610
|
+
Graph navigation controls include zoom in, zoom out, fit visible nodes and reset-to-fit-all nodes. Mouse wheel zoom (including `cmd+scroll` and `ctrl+scroll`) is anchored to the cursor. Keyboard shortcuts are `+` (zoom in), `-` (zoom out) and `0` (reset fit). Double-click on canvas zooms in at cursor position. Totals for notes, links and tags stay visible as floating metrics under the Brainlink title, and node details open on click in a modal (tags, outgoing links, backlinks and Markdown content). Vaults above 1000 notes also expose stable hierarchy mesh groups of up to 1000 direct nodes, with recursive parent groups when a level exceeds 1000 groups; zoom-out renders those groups as normal mesh graph nodes, zoom-in expands a group only after it is framed in the viewport, and micro view renders only the focused subgraph until zoom-out restores sibling groups.
|
|
611
611
|
During graph filtering, Brainlink keeps hub context nodes visible (`Memory Hub`/`MOC`/high-degree fallback) so filtered views still show relationship anchors.
|
|
612
612
|
|
|
613
613
|
The command reindexes by default, then serves:
|
package/package.json
CHANGED