@andespindola/brainlink 1.6.9 → 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.
@@ -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.9",
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",