@velvetmonkey/flywheel-memory 2.5.11 → 2.5.13
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 +530 -250
- package/dist/integrity-worker.js +49 -0
- package/package.json +4 -3
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// src/core/read/integrity-worker.ts
|
|
2
|
+
import Database from "better-sqlite3";
|
|
3
|
+
import { parentPort } from "node:worker_threads";
|
|
4
|
+
import { checkDbIntegrity, safeBackupAsync } from "@velvetmonkey/vault-core";
|
|
5
|
+
if (!parentPort) {
|
|
6
|
+
throw new Error("integrity-worker.ts must be run as a worker thread");
|
|
7
|
+
}
|
|
8
|
+
var port = parentPort;
|
|
9
|
+
port.on("message", async (msg) => {
|
|
10
|
+
const startedAt = Date.now();
|
|
11
|
+
let db = null;
|
|
12
|
+
try {
|
|
13
|
+
db = new Database(msg.dbPath, { readonly: true, fileMustExist: true });
|
|
14
|
+
db.pragma(`busy_timeout = ${msg.busyTimeoutMs}`);
|
|
15
|
+
const integrity = checkDbIntegrity(db);
|
|
16
|
+
if (!integrity.ok) {
|
|
17
|
+
port.postMessage({
|
|
18
|
+
status: "failed",
|
|
19
|
+
detail: integrity.detail ?? "unknown integrity failure",
|
|
20
|
+
durationMs: Date.now() - startedAt,
|
|
21
|
+
backupCreated: false
|
|
22
|
+
});
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
let backupCreated = false;
|
|
26
|
+
if (msg.runBackup) {
|
|
27
|
+
backupCreated = await safeBackupAsync(db, msg.dbPath);
|
|
28
|
+
}
|
|
29
|
+
port.postMessage({
|
|
30
|
+
status: "healthy",
|
|
31
|
+
detail: null,
|
|
32
|
+
durationMs: Date.now() - startedAt,
|
|
33
|
+
backupCreated
|
|
34
|
+
});
|
|
35
|
+
} catch (err) {
|
|
36
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
37
|
+
port.postMessage({
|
|
38
|
+
status: "error",
|
|
39
|
+
detail: message,
|
|
40
|
+
durationMs: Date.now() - startedAt,
|
|
41
|
+
backupCreated: false
|
|
42
|
+
});
|
|
43
|
+
} finally {
|
|
44
|
+
try {
|
|
45
|
+
db?.close();
|
|
46
|
+
} catch {
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@velvetmonkey/flywheel-memory",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.13",
|
|
4
4
|
"description": "MCP tools that search, write, and auto-link your Obsidian vault — and learn from your edits.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"zettelkasten"
|
|
35
35
|
],
|
|
36
36
|
"scripts": {
|
|
37
|
-
"build": "npx esbuild src/index.ts --bundle --platform=node --format=esm --outfile=dist/index.js --packages=external && npx esbuild src/core/read/embedding-worker.ts --bundle --platform=node --format=esm --outfile=dist/embedding-worker.js --packages=external && chmod +x dist/index.js",
|
|
37
|
+
"build": "npx esbuild src/index.ts --bundle --platform=node --format=esm --outfile=dist/index.js --packages=external && npx esbuild src/core/read/embedding-worker.ts --bundle --platform=node --format=esm --outfile=dist/embedding-worker.js --packages=external && npx esbuild src/core/read/integrity-worker.ts --bundle --platform=node --format=esm --outfile=dist/integrity-worker.js --packages=external && chmod +x dist/index.js",
|
|
38
38
|
"dev": "npx esbuild src/index.ts --bundle --platform=node --format=esm --outfile=dist/index.js --packages=external --watch",
|
|
39
39
|
"test": "vitest run",
|
|
40
40
|
"test:watch": "vitest",
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"test:quality": "vitest run test/graph-quality/",
|
|
46
46
|
"test:quality:report": "tsx test/graph-quality/generate-proof.ts",
|
|
47
47
|
"generate:tool-embeddings": "tsx scripts/generate-tool-embeddings.ts",
|
|
48
|
+
"smoke:registry-latest": "node scripts/post-publish-codex-smoke.mjs latest",
|
|
48
49
|
"test:coverage": "vitest run --coverage",
|
|
49
50
|
"test:ci": "vitest run --reporter=github-actions",
|
|
50
51
|
"lint": "tsc --noEmit",
|
|
@@ -55,7 +56,7 @@
|
|
|
55
56
|
"dependencies": {
|
|
56
57
|
"@huggingface/transformers": "^3.8.1",
|
|
57
58
|
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
58
|
-
"@velvetmonkey/vault-core": "^2.5.
|
|
59
|
+
"@velvetmonkey/vault-core": "^2.5.13",
|
|
59
60
|
"better-sqlite3": "^12.0.0",
|
|
60
61
|
"chokidar": "^4.0.0",
|
|
61
62
|
"gray-matter": "^4.0.3",
|