mnemosyne-core 2.1.3 → 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.
@@ -3641,7 +3641,7 @@ function getVersion() {
3641
3641
  const pkg = JSON.parse(readFileSync8(resolve14(process.cwd(), "package.json"), "utf-8"));
3642
3642
  return pkg.version;
3643
3643
  } catch {
3644
- return "2.1.3";
3644
+ return "2.1.5";
3645
3645
  }
3646
3646
  }
3647
3647
  }
@@ -7602,7 +7602,7 @@ var require_package = __commonJS({
7602
7602
  "package.json"(exports, module2) {
7603
7603
  module2.exports = {
7604
7604
  name: "mnemosyne-core",
7605
- version: "2.1.3",
7605
+ version: "2.1.5",
7606
7606
  description: "Unified memory engine for AI agents \u2014 graph atoms, semantic search, and collaborative memory",
7607
7607
  logo: "logo.png",
7608
7608
  author: "Arman Aslanyan <aslanyanarman88@gmail.com> (https://www.linkedin.com/in/arman-aslanyan/)",
@@ -8140,7 +8140,14 @@ var Store = class extends EventEmitter {
8140
8140
  vals.push(this.now());
8141
8141
  sets.push("version = version + 1");
8142
8142
  vals.push(id);
8143
- this.stmt(`UPDATE atoms SET ${sets.join(", ")} WHERE id = ?`).run(...vals);
8143
+ try {
8144
+ this.stmt(`UPDATE atoms SET ${sets.join(", ")} WHERE id = ?`).run(...vals);
8145
+ } catch (err) {
8146
+ if (err.message?.includes("malformed") || err.message?.includes("corrupt")) {
8147
+ throw new Error(`Database appears corrupted. Run "mnemosyne doctor --data-dir ./data" or delete the data directory and run "mnemosyne init" again.`);
8148
+ }
8149
+ throw err;
8150
+ }
8144
8151
  const updated = this.getAtom(id);
8145
8152
  this.emit("atom.updated", { atom: updated, projectId: atom.project_id, changes });
8146
8153
  this.logEvent("atom.updated", updatedBy, "assistant", atom.project_id, id, void 0, { fields: changes });
@@ -8395,7 +8402,6 @@ var Store = class extends EventEmitter {
8395
8402
  // ═══════════════════════════════════════════════════════════
8396
8403
  search(projectId, q, limit) {
8397
8404
  const results = [];
8398
- const seenAtoms = /* @__PURE__ */ new Set();
8399
8405
  const matchExpr = q.trim().split(/\s+/).filter(Boolean).map((t) => `"${t.replace(/"/g, "")}"`).join(" ");
8400
8406
  if (!matchExpr) return results;
8401
8407
  const projectFilter = projectId ? "AND a.project_id = ?" : "";
@@ -8410,26 +8416,9 @@ var Store = class extends EventEmitter {
8410
8416
  `).all(...paramsAtoms);
8411
8417
  for (const a of atoms) {
8412
8418
  if (results.length >= limit) break;
8413
- seenAtoms.add(a.id);
8419
+ if (a.title === "__INDEX__") continue;
8414
8420
  results.push({ kind: "atom", ...a, metadata: this.parseMeta(a) });
8415
8421
  }
8416
- const paramsBlocks = projectId ? [matchExpr, projectId, limit] : [matchExpr, limit];
8417
- const blocks = this.stmt(`
8418
- SELECT b.*, a.title as atom_title, a.id as atom_id, bm25(search_blocks) as rank
8419
- FROM search_blocks
8420
- JOIN blocks b ON b.rowid = search_blocks.rowid
8421
- JOIN atoms a ON b.atom_id = a.id
8422
- WHERE search_blocks MATCH ? ${projectFilter}
8423
- ORDER BY rank
8424
- LIMIT ?
8425
- `).all(...paramsBlocks);
8426
- for (const b of blocks) {
8427
- if (results.length >= limit) break;
8428
- if (!seenAtoms.has(b.atom_id)) {
8429
- seenAtoms.add(b.atom_id);
8430
- results.push({ kind: "block", ...b, metadata: this.parseMeta(b) });
8431
- }
8432
- }
8433
8422
  return results;
8434
8423
  }
8435
8424
  // ─── Semantic Search ──────────────────────────────────────
@@ -8480,7 +8469,7 @@ var Store = class extends EventEmitter {
8480
8469
  ORDER BY v.distance
8481
8470
  LIMIT ${limit}
8482
8471
  `).all(...params);
8483
- return rows.map((r) => ({ kind: "atom", ...r, metadata: this.parseMeta(r) }));
8472
+ return rows.filter((r) => r.title !== "__INDEX__").map((r) => ({ kind: "atom", ...r, metadata: this.parseMeta(r) }));
8484
8473
  } catch (err) {
8485
8474
  console.error("[Store] Semantic search failed:", err.message);
8486
8475
  return [];
@@ -8943,7 +8932,7 @@ function getVersion2() {
8943
8932
  const pkg = JSON.parse(readFileSync8(resolve14(process.cwd(), "package.json"), "utf-8"));
8944
8933
  return pkg.version;
8945
8934
  } catch {
8946
- return "2.1.3";
8935
+ return "2.1.5";
8947
8936
  }
8948
8937
  }
8949
8938
  }
@@ -9234,6 +9223,10 @@ var Mnemosyne = class {
9234
9223
  this.db.pragma("journal_mode = WAL");
9235
9224
  this.db.pragma("foreign_keys = ON");
9236
9225
  this.db.pragma("synchronous = NORMAL");
9226
+ try {
9227
+ this.db.pragma("wal_checkpoint(TRUNCATE)");
9228
+ } catch {
9229
+ }
9237
9230
  this.vecEnabled = false;
9238
9231
  try {
9239
9232
  let vecPath;
@@ -9541,7 +9534,7 @@ function getVersion3() {
9541
9534
  const pkg = JSON.parse(readFileSync8(resolve14(process.cwd(), "package.json"), "utf-8"));
9542
9535
  return pkg.version;
9543
9536
  } catch {
9544
- return "2.1.3";
9537
+ return "2.1.5";
9545
9538
  }
9546
9539
  }
9547
9540
  }
@@ -10676,7 +10669,7 @@ var PKG_VERSION = (() => {
10676
10669
  const pkg = JSON.parse(__require("fs").readFileSync(__require("path").resolve(__dirname, "../../package.json"), "utf-8"));
10677
10670
  return pkg.version;
10678
10671
  } catch {
10679
- return "2.1.3";
10672
+ return "2.1.5";
10680
10673
  }
10681
10674
  })();
10682
10675
  function handleHealth(store, pathname, method, res) {
@@ -11000,7 +10993,7 @@ var MnemosyneServer = class {
11000
10993
  const wss = new import_websocket_server.default({ server: this.httpServer });
11001
10994
  this.wsHandler = new WebSocketHandler(wss, this.store);
11002
10995
  }
11003
- const version = cfg?.server?.version || "2.1.3";
10996
+ const version = cfg?.server?.version || "2.1.5";
11004
10997
  this.httpServer.listen(port, () => {
11005
10998
  console.log(`Mnemosyne v${version} \u2014 port ${port}`);
11006
10999
  console.log(`Dashboard: http://${host}:${port}/dashboard`);
@@ -11058,7 +11051,7 @@ function getVersion4() {
11058
11051
  const { resolve: resolve14 } = __require("path");
11059
11052
  return JSON.parse(readFileSync8(resolve14(__dirname, "../../package.json"), "utf-8")).version;
11060
11053
  } catch {
11061
- return "2.1.3";
11054
+ return "2.1.5";
11062
11055
  }
11063
11056
  }
11064
11057
  async function startCommand(options) {
@@ -11350,7 +11343,7 @@ program2.name("mnemosyne").description("Mnemosyne \u2014 Your exocortex").versio
11350
11343
  try {
11351
11344
  return require_package().version;
11352
11345
  } catch {
11353
- return "2.1.3";
11346
+ return "2.1.5";
11354
11347
  }
11355
11348
  })());
11356
11349
  program2.command("init").description("Initialize a new Mnemosyne workspace").option("-d, --data-dir <path>", "Data directory", "./data").option("-c, --config <path>", "Config file path").action(initCommand);