@velvetmonkey/flywheel-memory 2.0.16 → 2.0.17
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/dist/index.js +33 -78
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1426,7 +1426,6 @@ var init_taskHelpers = __esm({
|
|
|
1426
1426
|
// src/index.ts
|
|
1427
1427
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
1428
1428
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
1429
|
-
import chokidar2 from "chokidar";
|
|
1430
1429
|
|
|
1431
1430
|
// src/core/read/vault.ts
|
|
1432
1431
|
import * as fs from "fs";
|
|
@@ -12872,87 +12871,43 @@ async function runPostIndexWork(index) {
|
|
|
12872
12871
|
console.error(`[Memory] Vault: ${flywheelConfig.vault_name}`);
|
|
12873
12872
|
}
|
|
12874
12873
|
if (process.env.FLYWHEEL_WATCH !== "false") {
|
|
12875
|
-
const
|
|
12876
|
-
|
|
12877
|
-
|
|
12878
|
-
|
|
12879
|
-
|
|
12880
|
-
|
|
12881
|
-
|
|
12882
|
-
|
|
12883
|
-
|
|
12884
|
-
|
|
12885
|
-
|
|
12886
|
-
|
|
12887
|
-
|
|
12888
|
-
|
|
12889
|
-
|
|
12890
|
-
|
|
12891
|
-
|
|
12892
|
-
|
|
12893
|
-
|
|
12894
|
-
} catch (err) {
|
|
12895
|
-
console.error("[Memory] Failed to update index cache:", err);
|
|
12896
|
-
}
|
|
12874
|
+
const config = parseWatcherConfig();
|
|
12875
|
+
console.error(`[Memory] File watcher enabled (debounce: ${config.debounceMs}ms)`);
|
|
12876
|
+
const watcher = createVaultWatcher({
|
|
12877
|
+
vaultPath,
|
|
12878
|
+
config,
|
|
12879
|
+
onBatch: async (batch) => {
|
|
12880
|
+
console.error(`[Memory] Processing ${batch.events.length} file changes`);
|
|
12881
|
+
const startTime = Date.now();
|
|
12882
|
+
try {
|
|
12883
|
+
vaultIndex = await buildVaultIndex(vaultPath);
|
|
12884
|
+
setIndexState("ready");
|
|
12885
|
+
console.error(`[Memory] Index rebuilt in ${Date.now() - startTime}ms`);
|
|
12886
|
+
await updateEntitiesInStateDb();
|
|
12887
|
+
await exportHubScores(vaultIndex, stateDb);
|
|
12888
|
+
if (stateDb) {
|
|
12889
|
+
try {
|
|
12890
|
+
saveVaultIndexToCache(stateDb, vaultIndex);
|
|
12891
|
+
} catch (err) {
|
|
12892
|
+
console.error("[Memory] Failed to update index cache:", err);
|
|
12897
12893
|
}
|
|
12898
|
-
} catch (err) {
|
|
12899
|
-
setIndexState("error");
|
|
12900
|
-
setIndexError(err instanceof Error ? err : new Error(String(err)));
|
|
12901
|
-
console.error("[Memory] Failed to rebuild index:", err);
|
|
12902
12894
|
}
|
|
12903
|
-
}
|
|
12904
|
-
|
|
12905
|
-
|
|
12906
|
-
|
|
12907
|
-
}
|
|
12908
|
-
},
|
|
12909
|
-
onError: (err) => {
|
|
12910
|
-
console.error("[Memory] Watcher error:", err.message);
|
|
12895
|
+
} catch (err) {
|
|
12896
|
+
setIndexState("error");
|
|
12897
|
+
setIndexError(err instanceof Error ? err : new Error(String(err)));
|
|
12898
|
+
console.error("[Memory] Failed to rebuild index:", err);
|
|
12911
12899
|
}
|
|
12912
|
-
}
|
|
12913
|
-
|
|
12914
|
-
|
|
12915
|
-
|
|
12916
|
-
console.error(`[Memory] File watcher v1 enabled (debounce: ${debounceMs}ms)`);
|
|
12917
|
-
if (debounceMs >= 6e4) {
|
|
12918
|
-
console.error("[Memory] Warning: Legacy watcher using high debounce (60s). Set FLYWHEEL_WATCH_V2=true for 200ms responsiveness.");
|
|
12919
|
-
}
|
|
12920
|
-
const legacyWatcher = chokidar2.watch(vaultPath, {
|
|
12921
|
-
ignored: /(^|[\/\\])\../,
|
|
12922
|
-
persistent: true,
|
|
12923
|
-
ignoreInitial: true,
|
|
12924
|
-
awaitWriteFinish: {
|
|
12925
|
-
stabilityThreshold: 300,
|
|
12926
|
-
pollInterval: 100
|
|
12900
|
+
},
|
|
12901
|
+
onStateChange: (status) => {
|
|
12902
|
+
if (status.state === "dirty") {
|
|
12903
|
+
console.error("[Memory] Warning: Index may be stale");
|
|
12927
12904
|
}
|
|
12928
|
-
}
|
|
12929
|
-
|
|
12930
|
-
|
|
12931
|
-
|
|
12932
|
-
|
|
12933
|
-
|
|
12934
|
-
console.error("[Memory] Rebuilding index (file changed)");
|
|
12935
|
-
buildVaultIndex(vaultPath).then(async (newIndex) => {
|
|
12936
|
-
vaultIndex = newIndex;
|
|
12937
|
-
setIndexState("ready");
|
|
12938
|
-
console.error("[Memory] Index rebuilt successfully");
|
|
12939
|
-
await updateEntitiesInStateDb();
|
|
12940
|
-
await exportHubScores(newIndex, stateDb);
|
|
12941
|
-
if (stateDb) {
|
|
12942
|
-
try {
|
|
12943
|
-
saveVaultIndexToCache(stateDb, newIndex);
|
|
12944
|
-
} catch (err) {
|
|
12945
|
-
console.error("[Memory] Failed to update index cache:", err);
|
|
12946
|
-
}
|
|
12947
|
-
}
|
|
12948
|
-
}).catch((err) => {
|
|
12949
|
-
setIndexState("error");
|
|
12950
|
-
setIndexError(err instanceof Error ? err : new Error(String(err)));
|
|
12951
|
-
console.error("[Memory] Failed to rebuild index:", err);
|
|
12952
|
-
});
|
|
12953
|
-
}, debounceMs);
|
|
12954
|
-
});
|
|
12955
|
-
}
|
|
12905
|
+
},
|
|
12906
|
+
onError: (err) => {
|
|
12907
|
+
console.error("[Memory] Watcher error:", err.message);
|
|
12908
|
+
}
|
|
12909
|
+
});
|
|
12910
|
+
watcher.start();
|
|
12956
12911
|
}
|
|
12957
12912
|
}
|
|
12958
12913
|
main().catch((error) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@velvetmonkey/flywheel-memory",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.17",
|
|
4
4
|
"description": "MCP server that gives Claude full read/write access to your Obsidian vault. 39 tools for search, backlinks, graph queries, and mutations.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@modelcontextprotocol/sdk": "^1.25.1",
|
|
53
|
-
"@velvetmonkey/vault-core": "^2.0.
|
|
53
|
+
"@velvetmonkey/vault-core": "^2.0.17",
|
|
54
54
|
"better-sqlite3": "^11.0.0",
|
|
55
55
|
"chokidar": "^4.0.0",
|
|
56
56
|
"gray-matter": "^4.0.3",
|