mnemosyne-core 2.1.4 → 2.1.6
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 +29 -32
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +29 -32
- package/dist/cli/index.mjs.map +1 -1
- package/dist/index.js +26 -29
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -29
- 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 +21 -28
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +21 -28
- package/dist/server/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/server/index.js
CHANGED
|
@@ -3817,7 +3817,7 @@ function getVersion2() {
|
|
|
3817
3817
|
const pkg = JSON.parse(readFileSync5(resolve7(process.cwd(), "package.json"), "utf-8"));
|
|
3818
3818
|
return pkg.version;
|
|
3819
3819
|
} catch {
|
|
3820
|
-
return "2.1.
|
|
3820
|
+
return "2.1.5";
|
|
3821
3821
|
}
|
|
3822
3822
|
}
|
|
3823
3823
|
}
|
|
@@ -4368,7 +4368,7 @@ function getVersion() {
|
|
|
4368
4368
|
const pkg = JSON.parse(readFileSync5(resolve7(process.cwd(), "package.json"), "utf-8"));
|
|
4369
4369
|
return pkg.version;
|
|
4370
4370
|
} catch {
|
|
4371
|
-
return "2.1.
|
|
4371
|
+
return "2.1.5";
|
|
4372
4372
|
}
|
|
4373
4373
|
}
|
|
4374
4374
|
}
|
|
@@ -5290,8 +5290,7 @@ async function handleSearch(store, pathname, method, res, searchParams) {
|
|
|
5290
5290
|
} else {
|
|
5291
5291
|
results = store.search(projectId, q, limit);
|
|
5292
5292
|
}
|
|
5293
|
-
|
|
5294
|
-
json(res, 200, { query: q, semantic, count: filtered.length, results: filtered });
|
|
5293
|
+
json(res, 200, { query: q, semantic, count: results.length, results });
|
|
5295
5294
|
return true;
|
|
5296
5295
|
}
|
|
5297
5296
|
return false;
|
|
@@ -5501,7 +5500,7 @@ var PKG_VERSION = (() => {
|
|
|
5501
5500
|
const pkg = JSON.parse(require("fs").readFileSync(require("path").resolve(__dirname, "../../package.json"), "utf-8"));
|
|
5502
5501
|
return pkg.version;
|
|
5503
5502
|
} catch {
|
|
5504
|
-
return "2.1.
|
|
5503
|
+
return "2.1.5";
|
|
5505
5504
|
}
|
|
5506
5505
|
})();
|
|
5507
5506
|
function handleHealth(store, pathname, method, res) {
|
|
@@ -6174,7 +6173,15 @@ var Store = class extends EventEmitter {
|
|
|
6174
6173
|
vals.push(this.now());
|
|
6175
6174
|
sets.push("version = version + 1");
|
|
6176
6175
|
vals.push(id);
|
|
6177
|
-
|
|
6176
|
+
const sql = `UPDATE atoms SET ${sets.join(", ")} WHERE id = ?`;
|
|
6177
|
+
try {
|
|
6178
|
+
this.stmt(sql).run(...vals);
|
|
6179
|
+
} catch (err) {
|
|
6180
|
+
if (err.message?.includes("malformed") || err.message?.includes("corrupt")) {
|
|
6181
|
+
throw new Error(`Database appears corrupted. Run "mnemosyne doctor --data-dir ./data" or delete the data directory and run "mnemosyne init" again.`);
|
|
6182
|
+
}
|
|
6183
|
+
throw err;
|
|
6184
|
+
}
|
|
6178
6185
|
const updated = this.getAtom(id);
|
|
6179
6186
|
this.emit("atom.updated", { atom: updated, projectId: atom.project_id, changes });
|
|
6180
6187
|
this.logEvent("atom.updated", updatedBy, "assistant", atom.project_id, id, void 0, { fields: changes });
|
|
@@ -6429,7 +6436,6 @@ var Store = class extends EventEmitter {
|
|
|
6429
6436
|
// ═══════════════════════════════════════════════════════════
|
|
6430
6437
|
search(projectId, q, limit) {
|
|
6431
6438
|
const results = [];
|
|
6432
|
-
const seenAtoms = /* @__PURE__ */ new Set();
|
|
6433
6439
|
const matchExpr = q.trim().split(/\s+/).filter(Boolean).map((t) => `"${t.replace(/"/g, "")}"`).join(" ");
|
|
6434
6440
|
if (!matchExpr) return results;
|
|
6435
6441
|
const projectFilter = projectId ? "AND a.project_id = ?" : "";
|
|
@@ -6444,26 +6450,9 @@ var Store = class extends EventEmitter {
|
|
|
6444
6450
|
`).all(...paramsAtoms);
|
|
6445
6451
|
for (const a of atoms) {
|
|
6446
6452
|
if (results.length >= limit) break;
|
|
6447
|
-
|
|
6453
|
+
if (a.title === "__INDEX__") continue;
|
|
6448
6454
|
results.push({ kind: "atom", ...a, metadata: this.parseMeta(a) });
|
|
6449
6455
|
}
|
|
6450
|
-
const paramsBlocks = projectId ? [matchExpr, projectId, limit] : [matchExpr, limit];
|
|
6451
|
-
const blocks = this.stmt(`
|
|
6452
|
-
SELECT b.*, a.title as atom_title, a.id as atom_id, bm25(search_blocks) as rank
|
|
6453
|
-
FROM search_blocks
|
|
6454
|
-
JOIN blocks b ON b.rowid = search_blocks.rowid
|
|
6455
|
-
JOIN atoms a ON b.atom_id = a.id
|
|
6456
|
-
WHERE search_blocks MATCH ? ${projectFilter}
|
|
6457
|
-
ORDER BY rank
|
|
6458
|
-
LIMIT ?
|
|
6459
|
-
`).all(...paramsBlocks);
|
|
6460
|
-
for (const b of blocks) {
|
|
6461
|
-
if (results.length >= limit) break;
|
|
6462
|
-
if (!seenAtoms.has(b.atom_id)) {
|
|
6463
|
-
seenAtoms.add(b.atom_id);
|
|
6464
|
-
results.push({ kind: "block", ...b, metadata: this.parseMeta(b) });
|
|
6465
|
-
}
|
|
6466
|
-
}
|
|
6467
6456
|
return results;
|
|
6468
6457
|
}
|
|
6469
6458
|
// ─── Semantic Search ──────────────────────────────────────
|
|
@@ -6514,7 +6503,7 @@ var Store = class extends EventEmitter {
|
|
|
6514
6503
|
ORDER BY v.distance
|
|
6515
6504
|
LIMIT ${limit}
|
|
6516
6505
|
`).all(...params);
|
|
6517
|
-
return rows.map((r) => ({ kind: "atom", ...r, metadata: this.parseMeta(r) }));
|
|
6506
|
+
return rows.filter((r) => r.title !== "__INDEX__").map((r) => ({ kind: "atom", ...r, metadata: this.parseMeta(r) }));
|
|
6518
6507
|
} catch (err) {
|
|
6519
6508
|
console.error("[Store] Semantic search failed:", err.message);
|
|
6520
6509
|
return [];
|
|
@@ -7079,7 +7068,7 @@ CREATE TRIGGER IF NOT EXISTS trig_search_atoms_insert AFTER INSERT ON atoms BEGI
|
|
|
7079
7068
|
END;
|
|
7080
7069
|
|
|
7081
7070
|
CREATE TRIGGER IF NOT EXISTS trig_search_atoms_update AFTER UPDATE ON atoms BEGIN
|
|
7082
|
-
|
|
7071
|
+
INSERT OR REPLACE INTO search_atoms(rowid, title, summary) VALUES (new.rowid, new.title, COALESCE(new.summary, ''));
|
|
7083
7072
|
END;
|
|
7084
7073
|
|
|
7085
7074
|
CREATE TRIGGER IF NOT EXISTS trig_search_atoms_delete AFTER DELETE ON atoms BEGIN
|
|
@@ -7129,6 +7118,10 @@ function getDb() {
|
|
|
7129
7118
|
db.pragma("journal_mode = WAL");
|
|
7130
7119
|
db.pragma("foreign_keys = ON");
|
|
7131
7120
|
db.pragma("synchronous = NORMAL");
|
|
7121
|
+
try {
|
|
7122
|
+
db.pragma("wal_checkpoint(TRUNCATE)");
|
|
7123
|
+
} catch {
|
|
7124
|
+
}
|
|
7132
7125
|
try {
|
|
7133
7126
|
const { getLoadablePath } = require("sqlite-vec");
|
|
7134
7127
|
db.loadExtension(getLoadablePath());
|
|
@@ -7207,7 +7200,7 @@ var MnemosyneServer = class {
|
|
|
7207
7200
|
const wss = new import_websocket_server.default({ server: this.httpServer });
|
|
7208
7201
|
this.wsHandler = new WebSocketHandler(wss, this.store);
|
|
7209
7202
|
}
|
|
7210
|
-
const version = cfg?.server?.version || "2.1.
|
|
7203
|
+
const version = cfg?.server?.version || "2.1.5";
|
|
7211
7204
|
this.httpServer.listen(port, () => {
|
|
7212
7205
|
console.log(`Mnemosyne v${version} \u2014 port ${port}`);
|
|
7213
7206
|
console.log(`Dashboard: http://${host}:${port}/dashboard`);
|