@andespindola/brainlink 1.6.8 → 1.6.10

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.
@@ -23,6 +23,10 @@ const pollGraphVersion = async () => {
23
23
  if (version !== state.graphVersion) {
24
24
  state.graphVersion = version
25
25
  await loadContexts().catch((error) => console.error(error))
26
+ // Clear the request-dedup key so the refetch is not skipped: the viewport
27
+ // has not changed, but the vault has, so we must re-pull the chunk to pick
28
+ // up new nodes/edges (the dedup guard would otherwise short-circuit it).
29
+ state.lastChunkRequestKey = ''
26
30
  scheduleChunkFetch()
27
31
  }
28
32
  } catch (error) {
@@ -29,14 +29,25 @@ const writePersistedLayout = async (vaultPath, options, cached) => {
29
29
  await writeFile(temp, `${JSON.stringify(cached)}\n`, { encoding: 'utf8', mode: 0o600 });
30
30
  await rename(temp, target);
31
31
  };
32
+ // Invalidates the persisted graph layout when the index changes. The default
33
+ // binary backend never writes `.brainlink/index.json` (it uses `store/` +
34
+ // `index-state.json`), so signing on index.json alone left the layout stat
35
+ // permanently at '0:0' — the cached layout never refreshed and the graph froze
36
+ // on its first snapshot. `index-state.json` is rewritten on every reindex for
37
+ // every backend, so it is the reliable invalidation source (index.json stays as
38
+ // a fallback for the legacy JSON backend).
39
+ const indexStateStoragePath = (vaultPath) => join(vaultPath, '.brainlink', 'index-state.json');
32
40
  const readDatabaseSignature = async (vaultPath) => {
33
- try {
34
- const info = await stat(indexStoragePath(vaultPath));
35
- return `${Math.floor(info.mtimeMs)}:${info.size}`;
36
- }
37
- catch {
38
- return '0:0';
41
+ for (const candidate of [indexStateStoragePath(vaultPath), indexStoragePath(vaultPath)]) {
42
+ try {
43
+ const info = await stat(candidate);
44
+ return `${Math.floor(info.mtimeMs)}:${info.size}`;
45
+ }
46
+ catch {
47
+ // Try the next candidate.
48
+ }
39
49
  }
50
+ return '0:0';
40
51
  };
41
52
  const createGraphSignature = (graph) => {
42
53
  const nodesSignature = graph.nodes.map((node) => `${node.id}|${node.agentId}|${node.title}|${node.path}`).join('\n');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andespindola/brainlink",
3
- "version": "1.6.8",
3
+ "version": "1.6.10",
4
4
  "description": "Local-first knowledge memory for agents with Markdown, backlinks, indexing and context retrieval.",
5
5
  "type": "module",
6
6
  "license": "MIT",