@velvetmonkey/flywheel-memory 2.0.83 → 2.0.85
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 +49 -6
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
5
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
6
|
+
}) : x)(function(x) {
|
|
7
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
8
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
9
|
+
});
|
|
4
10
|
var __esm = (fn, res) => function __init() {
|
|
5
11
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
6
12
|
};
|
|
@@ -1575,7 +1581,7 @@ var init_taskHelpers = __esm({
|
|
|
1575
1581
|
import * as path32 from "path";
|
|
1576
1582
|
import { readFileSync as readFileSync5, realpathSync } from "fs";
|
|
1577
1583
|
import { fileURLToPath } from "url";
|
|
1578
|
-
import { dirname as
|
|
1584
|
+
import { dirname as dirname5, join as join17 } from "path";
|
|
1579
1585
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
1580
1586
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
1581
1587
|
|
|
@@ -1891,12 +1897,41 @@ function setEmbeddingsBuildState(state2) {
|
|
|
1891
1897
|
function setEmbeddingsDatabase(database) {
|
|
1892
1898
|
db = database;
|
|
1893
1899
|
}
|
|
1900
|
+
function clearModelCache(modelId) {
|
|
1901
|
+
try {
|
|
1902
|
+
const candidates = [];
|
|
1903
|
+
try {
|
|
1904
|
+
const transformersDir = path2.dirname(__require.resolve("@huggingface/transformers/package.json"));
|
|
1905
|
+
candidates.push(path2.join(transformersDir, ".cache", ...modelId.split("/")));
|
|
1906
|
+
} catch {
|
|
1907
|
+
}
|
|
1908
|
+
const home = process.env.HOME || process.env.USERPROFILE || "";
|
|
1909
|
+
if (home) {
|
|
1910
|
+
const npxDir = path2.join(home, ".npm", "_npx");
|
|
1911
|
+
if (fs3.existsSync(npxDir)) {
|
|
1912
|
+
for (const hash of fs3.readdirSync(npxDir)) {
|
|
1913
|
+
const candidate = path2.join(npxDir, hash, "node_modules", "@huggingface", "transformers", ".cache", ...modelId.split("/"));
|
|
1914
|
+
if (fs3.existsSync(candidate)) candidates.push(candidate);
|
|
1915
|
+
}
|
|
1916
|
+
}
|
|
1917
|
+
}
|
|
1918
|
+
for (const cacheDir of candidates) {
|
|
1919
|
+
if (fs3.existsSync(cacheDir)) {
|
|
1920
|
+
fs3.rmSync(cacheDir, { recursive: true, force: true });
|
|
1921
|
+
console.error(`[Semantic] Deleted corrupted model cache: ${cacheDir}`);
|
|
1922
|
+
}
|
|
1923
|
+
}
|
|
1924
|
+
} catch (e) {
|
|
1925
|
+
console.error(`[Semantic] Could not clear model cache: ${e instanceof Error ? e.message : e}`);
|
|
1926
|
+
}
|
|
1927
|
+
}
|
|
1894
1928
|
async function initEmbeddings() {
|
|
1895
1929
|
if (pipeline) return;
|
|
1896
1930
|
if (initPromise) return initPromise;
|
|
1897
1931
|
initPromise = (async () => {
|
|
1898
1932
|
const MAX_RETRIES = 3;
|
|
1899
1933
|
const RETRY_DELAYS = [2e3, 5e3, 1e4];
|
|
1934
|
+
let cacheCleared = false;
|
|
1900
1935
|
for (let attempt = 1; attempt <= MAX_RETRIES; attempt++) {
|
|
1901
1936
|
try {
|
|
1902
1937
|
const transformers = await Function("specifier", "return import(specifier)")("@huggingface/transformers");
|
|
@@ -1918,9 +1953,17 @@ async function initEmbeddings() {
|
|
|
1918
1953
|
"Semantic search requires @huggingface/transformers. Install it with: npm install @huggingface/transformers"
|
|
1919
1954
|
);
|
|
1920
1955
|
}
|
|
1956
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
1957
|
+
if (!cacheCleared && (errMsg.includes("Protobuf parsing failed") || errMsg.includes("onnx"))) {
|
|
1958
|
+
console.error(`[Semantic] Corrupted model cache detected: ${errMsg}`);
|
|
1959
|
+
clearModelCache(activeModelConfig.id);
|
|
1960
|
+
cacheCleared = true;
|
|
1961
|
+
pipeline = null;
|
|
1962
|
+
continue;
|
|
1963
|
+
}
|
|
1921
1964
|
if (attempt < MAX_RETRIES) {
|
|
1922
1965
|
const delay = RETRY_DELAYS[attempt - 1];
|
|
1923
|
-
console.error(`[Semantic] Model load failed (attempt ${attempt}/${MAX_RETRIES}): ${
|
|
1966
|
+
console.error(`[Semantic] Model load failed (attempt ${attempt}/${MAX_RETRIES}): ${errMsg}`);
|
|
1924
1967
|
console.error(`[Semantic] Retrying in ${delay / 1e3}s...`);
|
|
1925
1968
|
await new Promise((resolve2) => setTimeout(resolve2, delay));
|
|
1926
1969
|
pipeline = null;
|
|
@@ -13520,7 +13563,7 @@ Example: vault_add_to_section({ path: "daily/2026-02-15.md", section: "Log", con
|
|
|
13520
13563
|
}
|
|
13521
13564
|
}
|
|
13522
13565
|
let suggestInfo;
|
|
13523
|
-
if (suggestOutgoingLinks && !skipWikilinks
|
|
13566
|
+
if (suggestOutgoingLinks && !skipWikilinks) {
|
|
13524
13567
|
const result = await suggestRelatedLinks(processedContent, { maxSuggestions, notePath });
|
|
13525
13568
|
if (result.suffix) {
|
|
13526
13569
|
processedContent = processedContent + " " + result.suffix;
|
|
@@ -13641,7 +13684,7 @@ Example: vault_add_to_section({ path: "daily/2026-02-15.md", section: "Log", con
|
|
|
13641
13684
|
}
|
|
13642
13685
|
let workingReplacement = validationResult.content;
|
|
13643
13686
|
let { content: processedReplacement } = maybeApplyWikilinks(workingReplacement, skipWikilinks, notePath, ctx.content);
|
|
13644
|
-
if (suggestOutgoingLinks && !skipWikilinks
|
|
13687
|
+
if (suggestOutgoingLinks && !skipWikilinks) {
|
|
13645
13688
|
const result = await suggestRelatedLinks(processedReplacement, { maxSuggestions, notePath });
|
|
13646
13689
|
if (result.suffix) {
|
|
13647
13690
|
processedReplacement = processedReplacement + " " + result.suffix;
|
|
@@ -14044,7 +14087,7 @@ function registerNoteTools(server2, vaultPath2, getIndex) {
|
|
|
14044
14087
|
}
|
|
14045
14088
|
let { content: processedContent, wikilinkInfo } = maybeApplyWikilinks(effectiveContent, skipWikilinks, notePath);
|
|
14046
14089
|
let suggestInfo;
|
|
14047
|
-
if (suggestOutgoingLinks && !skipWikilinks
|
|
14090
|
+
if (suggestOutgoingLinks && !skipWikilinks) {
|
|
14048
14091
|
const result = await suggestRelatedLinks(processedContent, { maxSuggestions, notePath });
|
|
14049
14092
|
if (result.suffix) {
|
|
14050
14093
|
processedContent = processedContent + " " + result.suffix;
|
|
@@ -19309,7 +19352,7 @@ function registerVaultResources(server2, getIndex) {
|
|
|
19309
19352
|
|
|
19310
19353
|
// src/index.ts
|
|
19311
19354
|
var __filename = fileURLToPath(import.meta.url);
|
|
19312
|
-
var __dirname =
|
|
19355
|
+
var __dirname = dirname5(__filename);
|
|
19313
19356
|
var pkg = JSON.parse(readFileSync5(join17(__dirname, "../package.json"), "utf-8"));
|
|
19314
19357
|
var vaultPath = process.env.PROJECT_PATH || process.env.VAULT_PATH || findVaultRoot();
|
|
19315
19358
|
var resolvedVaultPath;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@velvetmonkey/flywheel-memory",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.85",
|
|
4
4
|
"description": "MCP server that gives Claude full read/write access to your Obsidian vault. Select from 51 tools for search, backlinks, graph queries, mutations, agent memory, and hybrid semantic search.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@modelcontextprotocol/sdk": "^1.25.1",
|
|
56
|
-
"@velvetmonkey/vault-core": "^2.0.
|
|
56
|
+
"@velvetmonkey/vault-core": "^2.0.85",
|
|
57
57
|
"better-sqlite3": "^11.0.0",
|
|
58
58
|
"chokidar": "^4.0.0",
|
|
59
59
|
"gray-matter": "^4.0.3",
|