mnemosyne-core 2.1.4 → 2.1.5
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/cli/index.js +23 -31
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +23 -31
- package/dist/cli/index.mjs.map +1 -1
- package/dist/index.js +20 -28
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -28
- package/dist/index.mjs.map +1 -1
- package/dist/mcp/index.js +1 -1
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/index.mjs +1 -1
- package/dist/mcp/index.mjs.map +1 -1
- package/dist/server/api.js +4 -5
- package/dist/server/api.js.map +1 -1
- package/dist/server/api.mjs +4 -5
- package/dist/server/api.mjs.map +1 -1
- package/dist/server/index.js +15 -27
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +15 -27
- package/dist/server/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -201,7 +201,7 @@ function getVersion() {
|
|
|
201
201
|
const pkg = JSON.parse(readFileSync6(resolve9(process.cwd(), "package.json"), "utf-8"));
|
|
202
202
|
return pkg.version;
|
|
203
203
|
} catch {
|
|
204
|
-
return "2.1.
|
|
204
|
+
return "2.1.5";
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
207
|
}
|
|
@@ -4598,7 +4598,14 @@ var Store = class extends EventEmitter {
|
|
|
4598
4598
|
vals.push(this.now());
|
|
4599
4599
|
sets.push("version = version + 1");
|
|
4600
4600
|
vals.push(id);
|
|
4601
|
-
|
|
4601
|
+
try {
|
|
4602
|
+
this.stmt(`UPDATE atoms SET ${sets.join(", ")} WHERE id = ?`).run(...vals);
|
|
4603
|
+
} catch (err) {
|
|
4604
|
+
if (err.message?.includes("malformed") || err.message?.includes("corrupt")) {
|
|
4605
|
+
throw new Error(`Database appears corrupted. Run "mnemosyne doctor --data-dir ./data" or delete the data directory and run "mnemosyne init" again.`);
|
|
4606
|
+
}
|
|
4607
|
+
throw err;
|
|
4608
|
+
}
|
|
4602
4609
|
const updated = this.getAtom(id);
|
|
4603
4610
|
this.emit("atom.updated", { atom: updated, projectId: atom.project_id, changes });
|
|
4604
4611
|
this.logEvent("atom.updated", updatedBy, "assistant", atom.project_id, id, void 0, { fields: changes });
|
|
@@ -4853,7 +4860,6 @@ var Store = class extends EventEmitter {
|
|
|
4853
4860
|
// ═══════════════════════════════════════════════════════════
|
|
4854
4861
|
search(projectId, q, limit) {
|
|
4855
4862
|
const results = [];
|
|
4856
|
-
const seenAtoms = /* @__PURE__ */ new Set();
|
|
4857
4863
|
const matchExpr = q.trim().split(/\s+/).filter(Boolean).map((t) => `"${t.replace(/"/g, "")}"`).join(" ");
|
|
4858
4864
|
if (!matchExpr) return results;
|
|
4859
4865
|
const projectFilter = projectId ? "AND a.project_id = ?" : "";
|
|
@@ -4868,26 +4874,9 @@ var Store = class extends EventEmitter {
|
|
|
4868
4874
|
`).all(...paramsAtoms);
|
|
4869
4875
|
for (const a of atoms) {
|
|
4870
4876
|
if (results.length >= limit) break;
|
|
4871
|
-
|
|
4877
|
+
if (a.title === "__INDEX__") continue;
|
|
4872
4878
|
results.push({ kind: "atom", ...a, metadata: this.parseMeta(a) });
|
|
4873
4879
|
}
|
|
4874
|
-
const paramsBlocks = projectId ? [matchExpr, projectId, limit] : [matchExpr, limit];
|
|
4875
|
-
const blocks = this.stmt(`
|
|
4876
|
-
SELECT b.*, a.title as atom_title, a.id as atom_id, bm25(search_blocks) as rank
|
|
4877
|
-
FROM search_blocks
|
|
4878
|
-
JOIN blocks b ON b.rowid = search_blocks.rowid
|
|
4879
|
-
JOIN atoms a ON b.atom_id = a.id
|
|
4880
|
-
WHERE search_blocks MATCH ? ${projectFilter}
|
|
4881
|
-
ORDER BY rank
|
|
4882
|
-
LIMIT ?
|
|
4883
|
-
`).all(...paramsBlocks);
|
|
4884
|
-
for (const b of blocks) {
|
|
4885
|
-
if (results.length >= limit) break;
|
|
4886
|
-
if (!seenAtoms.has(b.atom_id)) {
|
|
4887
|
-
seenAtoms.add(b.atom_id);
|
|
4888
|
-
results.push({ kind: "block", ...b, metadata: this.parseMeta(b) });
|
|
4889
|
-
}
|
|
4890
|
-
}
|
|
4891
4880
|
return results;
|
|
4892
4881
|
}
|
|
4893
4882
|
// ─── Semantic Search ──────────────────────────────────────
|
|
@@ -4938,7 +4927,7 @@ var Store = class extends EventEmitter {
|
|
|
4938
4927
|
ORDER BY v.distance
|
|
4939
4928
|
LIMIT ${limit}
|
|
4940
4929
|
`).all(...params);
|
|
4941
|
-
return rows.map((r) => ({ kind: "atom", ...r, metadata: this.parseMeta(r) }));
|
|
4930
|
+
return rows.filter((r) => r.title !== "__INDEX__").map((r) => ({ kind: "atom", ...r, metadata: this.parseMeta(r) }));
|
|
4942
4931
|
} catch (err) {
|
|
4943
4932
|
console.error("[Store] Semantic search failed:", err.message);
|
|
4944
4933
|
return [];
|
|
@@ -5401,7 +5390,7 @@ function getVersion2() {
|
|
|
5401
5390
|
const pkg = JSON.parse(readFileSync6(resolve9(process.cwd(), "package.json"), "utf-8"));
|
|
5402
5391
|
return pkg.version;
|
|
5403
5392
|
} catch {
|
|
5404
|
-
return "2.1.
|
|
5393
|
+
return "2.1.5";
|
|
5405
5394
|
}
|
|
5406
5395
|
}
|
|
5407
5396
|
}
|
|
@@ -5692,6 +5681,10 @@ var Mnemosyne = class {
|
|
|
5692
5681
|
this.db.pragma("journal_mode = WAL");
|
|
5693
5682
|
this.db.pragma("foreign_keys = ON");
|
|
5694
5683
|
this.db.pragma("synchronous = NORMAL");
|
|
5684
|
+
try {
|
|
5685
|
+
this.db.pragma("wal_checkpoint(TRUNCATE)");
|
|
5686
|
+
} catch {
|
|
5687
|
+
}
|
|
5695
5688
|
this.vecEnabled = false;
|
|
5696
5689
|
try {
|
|
5697
5690
|
let vecPath;
|
|
@@ -5984,7 +5977,7 @@ function getVersion3() {
|
|
|
5984
5977
|
const pkg = JSON.parse(readFileSync6(resolve9(process.cwd(), "package.json"), "utf-8"));
|
|
5985
5978
|
return pkg.version;
|
|
5986
5979
|
} catch {
|
|
5987
|
-
return "2.1.
|
|
5980
|
+
return "2.1.5";
|
|
5988
5981
|
}
|
|
5989
5982
|
}
|
|
5990
5983
|
}
|
|
@@ -6940,8 +6933,7 @@ async function handleSearch(store, pathname, method, res, searchParams) {
|
|
|
6940
6933
|
} else {
|
|
6941
6934
|
results = store.search(projectId, q, limit);
|
|
6942
6935
|
}
|
|
6943
|
-
|
|
6944
|
-
json(res, 200, { query: q, semantic, count: filtered.length, results: filtered });
|
|
6936
|
+
json(res, 200, { query: q, semantic, count: results.length, results });
|
|
6945
6937
|
return true;
|
|
6946
6938
|
}
|
|
6947
6939
|
return false;
|
|
@@ -7151,7 +7143,7 @@ var PKG_VERSION = (() => {
|
|
|
7151
7143
|
const pkg = JSON.parse(require("fs").readFileSync(require("path").resolve(__dirname, "../../package.json"), "utf-8"));
|
|
7152
7144
|
return pkg.version;
|
|
7153
7145
|
} catch {
|
|
7154
|
-
return "2.1.
|
|
7146
|
+
return "2.1.5";
|
|
7155
7147
|
}
|
|
7156
7148
|
})();
|
|
7157
7149
|
function handleHealth(store, pathname, method, res) {
|
|
@@ -7512,7 +7504,7 @@ var MnemosyneServer = class {
|
|
|
7512
7504
|
const wss = new import_websocket_server.default({ server: this.httpServer });
|
|
7513
7505
|
this.wsHandler = new WebSocketHandler(wss, this.store);
|
|
7514
7506
|
}
|
|
7515
|
-
const version = cfg?.server?.version || "2.1.
|
|
7507
|
+
const version = cfg?.server?.version || "2.1.5";
|
|
7516
7508
|
this.httpServer.listen(port, () => {
|
|
7517
7509
|
console.log(`Mnemosyne v${version} \u2014 port ${port}`);
|
|
7518
7510
|
console.log(`Dashboard: http://${host}:${port}/dashboard`);
|