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.mjs
CHANGED
|
@@ -207,7 +207,7 @@ function getVersion() {
|
|
|
207
207
|
const pkg = JSON.parse(readFileSync6(resolve9(process.cwd(), "package.json"), "utf-8"));
|
|
208
208
|
return pkg.version;
|
|
209
209
|
} catch {
|
|
210
|
-
return "2.1.
|
|
210
|
+
return "2.1.5";
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
213
|
}
|
|
@@ -4568,7 +4568,14 @@ var Store = class extends EventEmitter {
|
|
|
4568
4568
|
vals.push(this.now());
|
|
4569
4569
|
sets.push("version = version + 1");
|
|
4570
4570
|
vals.push(id);
|
|
4571
|
-
|
|
4571
|
+
try {
|
|
4572
|
+
this.stmt(`UPDATE atoms SET ${sets.join(", ")} WHERE id = ?`).run(...vals);
|
|
4573
|
+
} catch (err) {
|
|
4574
|
+
if (err.message?.includes("malformed") || err.message?.includes("corrupt")) {
|
|
4575
|
+
throw new Error(`Database appears corrupted. Run "mnemosyne doctor --data-dir ./data" or delete the data directory and run "mnemosyne init" again.`);
|
|
4576
|
+
}
|
|
4577
|
+
throw err;
|
|
4578
|
+
}
|
|
4572
4579
|
const updated = this.getAtom(id);
|
|
4573
4580
|
this.emit("atom.updated", { atom: updated, projectId: atom.project_id, changes });
|
|
4574
4581
|
this.logEvent("atom.updated", updatedBy, "assistant", atom.project_id, id, void 0, { fields: changes });
|
|
@@ -4823,7 +4830,6 @@ var Store = class extends EventEmitter {
|
|
|
4823
4830
|
// ═══════════════════════════════════════════════════════════
|
|
4824
4831
|
search(projectId, q, limit) {
|
|
4825
4832
|
const results = [];
|
|
4826
|
-
const seenAtoms = /* @__PURE__ */ new Set();
|
|
4827
4833
|
const matchExpr = q.trim().split(/\s+/).filter(Boolean).map((t) => `"${t.replace(/"/g, "")}"`).join(" ");
|
|
4828
4834
|
if (!matchExpr) return results;
|
|
4829
4835
|
const projectFilter = projectId ? "AND a.project_id = ?" : "";
|
|
@@ -4838,26 +4844,9 @@ var Store = class extends EventEmitter {
|
|
|
4838
4844
|
`).all(...paramsAtoms);
|
|
4839
4845
|
for (const a of atoms) {
|
|
4840
4846
|
if (results.length >= limit) break;
|
|
4841
|
-
|
|
4847
|
+
if (a.title === "__INDEX__") continue;
|
|
4842
4848
|
results.push({ kind: "atom", ...a, metadata: this.parseMeta(a) });
|
|
4843
4849
|
}
|
|
4844
|
-
const paramsBlocks = projectId ? [matchExpr, projectId, limit] : [matchExpr, limit];
|
|
4845
|
-
const blocks = this.stmt(`
|
|
4846
|
-
SELECT b.*, a.title as atom_title, a.id as atom_id, bm25(search_blocks) as rank
|
|
4847
|
-
FROM search_blocks
|
|
4848
|
-
JOIN blocks b ON b.rowid = search_blocks.rowid
|
|
4849
|
-
JOIN atoms a ON b.atom_id = a.id
|
|
4850
|
-
WHERE search_blocks MATCH ? ${projectFilter}
|
|
4851
|
-
ORDER BY rank
|
|
4852
|
-
LIMIT ?
|
|
4853
|
-
`).all(...paramsBlocks);
|
|
4854
|
-
for (const b of blocks) {
|
|
4855
|
-
if (results.length >= limit) break;
|
|
4856
|
-
if (!seenAtoms.has(b.atom_id)) {
|
|
4857
|
-
seenAtoms.add(b.atom_id);
|
|
4858
|
-
results.push({ kind: "block", ...b, metadata: this.parseMeta(b) });
|
|
4859
|
-
}
|
|
4860
|
-
}
|
|
4861
4850
|
return results;
|
|
4862
4851
|
}
|
|
4863
4852
|
// ─── Semantic Search ──────────────────────────────────────
|
|
@@ -4908,7 +4897,7 @@ var Store = class extends EventEmitter {
|
|
|
4908
4897
|
ORDER BY v.distance
|
|
4909
4898
|
LIMIT ${limit}
|
|
4910
4899
|
`).all(...params);
|
|
4911
|
-
return rows.map((r) => ({ kind: "atom", ...r, metadata: this.parseMeta(r) }));
|
|
4900
|
+
return rows.filter((r) => r.title !== "__INDEX__").map((r) => ({ kind: "atom", ...r, metadata: this.parseMeta(r) }));
|
|
4912
4901
|
} catch (err) {
|
|
4913
4902
|
console.error("[Store] Semantic search failed:", err.message);
|
|
4914
4903
|
return [];
|
|
@@ -5371,7 +5360,7 @@ function getVersion2() {
|
|
|
5371
5360
|
const pkg = JSON.parse(readFileSync6(resolve9(process.cwd(), "package.json"), "utf-8"));
|
|
5372
5361
|
return pkg.version;
|
|
5373
5362
|
} catch {
|
|
5374
|
-
return "2.1.
|
|
5363
|
+
return "2.1.5";
|
|
5375
5364
|
}
|
|
5376
5365
|
}
|
|
5377
5366
|
}
|
|
@@ -5662,6 +5651,10 @@ var Mnemosyne = class {
|
|
|
5662
5651
|
this.db.pragma("journal_mode = WAL");
|
|
5663
5652
|
this.db.pragma("foreign_keys = ON");
|
|
5664
5653
|
this.db.pragma("synchronous = NORMAL");
|
|
5654
|
+
try {
|
|
5655
|
+
this.db.pragma("wal_checkpoint(TRUNCATE)");
|
|
5656
|
+
} catch {
|
|
5657
|
+
}
|
|
5665
5658
|
this.vecEnabled = false;
|
|
5666
5659
|
try {
|
|
5667
5660
|
let vecPath;
|
|
@@ -5954,7 +5947,7 @@ function getVersion3() {
|
|
|
5954
5947
|
const pkg = JSON.parse(readFileSync6(resolve9(process.cwd(), "package.json"), "utf-8"));
|
|
5955
5948
|
return pkg.version;
|
|
5956
5949
|
} catch {
|
|
5957
|
-
return "2.1.
|
|
5950
|
+
return "2.1.5";
|
|
5958
5951
|
}
|
|
5959
5952
|
}
|
|
5960
5953
|
}
|
|
@@ -6910,8 +6903,7 @@ async function handleSearch(store, pathname, method, res, searchParams) {
|
|
|
6910
6903
|
} else {
|
|
6911
6904
|
results = store.search(projectId, q, limit);
|
|
6912
6905
|
}
|
|
6913
|
-
|
|
6914
|
-
json(res, 200, { query: q, semantic, count: filtered.length, results: filtered });
|
|
6906
|
+
json(res, 200, { query: q, semantic, count: results.length, results });
|
|
6915
6907
|
return true;
|
|
6916
6908
|
}
|
|
6917
6909
|
return false;
|
|
@@ -7121,7 +7113,7 @@ var PKG_VERSION = (() => {
|
|
|
7121
7113
|
const pkg = JSON.parse(__require("fs").readFileSync(__require("path").resolve(__dirname, "../../package.json"), "utf-8"));
|
|
7122
7114
|
return pkg.version;
|
|
7123
7115
|
} catch {
|
|
7124
|
-
return "2.1.
|
|
7116
|
+
return "2.1.5";
|
|
7125
7117
|
}
|
|
7126
7118
|
})();
|
|
7127
7119
|
function handleHealth(store, pathname, method, res) {
|
|
@@ -7482,7 +7474,7 @@ var MnemosyneServer = class {
|
|
|
7482
7474
|
const wss = new import_websocket_server.default({ server: this.httpServer });
|
|
7483
7475
|
this.wsHandler = new WebSocketHandler(wss, this.store);
|
|
7484
7476
|
}
|
|
7485
|
-
const version = cfg?.server?.version || "2.1.
|
|
7477
|
+
const version = cfg?.server?.version || "2.1.5";
|
|
7486
7478
|
this.httpServer.listen(port, () => {
|
|
7487
7479
|
console.log(`Mnemosyne v${version} \u2014 port ${port}`);
|
|
7488
7480
|
console.log(`Dashboard: http://${host}:${port}/dashboard`);
|