mnemosyne-core 2.0.2 → 2.0.3

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 CHANGED
@@ -3550,14 +3550,18 @@ function loadConfig() {
3550
3550
  }
3551
3551
  function getVersion() {
3552
3552
  try {
3553
- const pkg = JSON.parse((0, import_fs.readFileSync)((0, import_path.resolve)(__dirname, "../package.json"), "utf-8"));
3553
+ const { readFileSync: readFileSync7 } = require("fs");
3554
+ const { resolve: resolve13 } = require("path");
3555
+ const pkg = JSON.parse(readFileSync7(resolve13(__dirname, "../package.json"), "utf-8"));
3554
3556
  return pkg.version;
3555
3557
  } catch {
3556
3558
  try {
3557
- const pkg = JSON.parse((0, import_fs.readFileSync)((0, import_path.resolve)(process.cwd(), "package.json"), "utf-8"));
3559
+ const { readFileSync: readFileSync7 } = require("fs");
3560
+ const { resolve: resolve13 } = require("path");
3561
+ const pkg = JSON.parse(readFileSync7(resolve13(process.cwd(), "package.json"), "utf-8"));
3558
3562
  return pkg.version;
3559
3563
  } catch {
3560
- return "2.0.1";
3564
+ return "2.0.3";
3561
3565
  }
3562
3566
  }
3563
3567
  }
@@ -3586,13 +3590,22 @@ function mergeDeep(target, source) {
3586
3590
  }
3587
3591
  return output;
3588
3592
  }
3589
- var import_fs, import_path, CONFIG;
3593
+ function getConfig() {
3594
+ if (!_config) _config = loadConfig();
3595
+ return _config;
3596
+ }
3597
+ var import_fs, import_path, _config, CONFIG;
3590
3598
  var init_config = __esm({
3591
3599
  "src/config.ts"() {
3592
3600
  "use strict";
3593
3601
  import_fs = require("fs");
3594
3602
  import_path = require("path");
3595
- CONFIG = loadConfig();
3603
+ _config = null;
3604
+ CONFIG = new Proxy({}, {
3605
+ get(_, prop) {
3606
+ return getConfig()[prop];
3607
+ }
3608
+ });
3596
3609
  }
3597
3610
  });
3598
3611
 
@@ -3674,11 +3687,14 @@ var init_embedder = __esm({
3674
3687
  });
3675
3688
 
3676
3689
  // src/server/files.ts
3690
+ function getFilesDir() {
3691
+ return (0, import_path2.resolve)(process.cwd(), CONFIG.storage.files_dir);
3692
+ }
3677
3693
  function ensureDir(path) {
3678
3694
  if (!(0, import_fs2.existsSync)(path)) (0, import_fs2.mkdirSync)(path, { recursive: true });
3679
3695
  }
3680
3696
  function hashPath(hash) {
3681
- return (0, import_path2.resolve)(FILES_DIR, hash.slice(0, 2), hash.slice(2));
3697
+ return (0, import_path2.resolve)(getFilesDir(), hash.slice(0, 2), hash.slice(2));
3682
3698
  }
3683
3699
  function computeHash(buffer) {
3684
3700
  return (0, import_crypto.createHash)("sha256").update(buffer).digest("hex");
@@ -3699,7 +3715,7 @@ function getFile(hash) {
3699
3715
  return null;
3700
3716
  }
3701
3717
  }
3702
- var import_crypto, import_fs2, import_path2, FILES_DIR;
3718
+ var import_crypto, import_fs2, import_path2;
3703
3719
  var init_files = __esm({
3704
3720
  "src/server/files.ts"() {
3705
3721
  "use strict";
@@ -3707,7 +3723,6 @@ var init_files = __esm({
3707
3723
  import_fs2 = require("fs");
3708
3724
  import_path2 = require("path");
3709
3725
  init_config();
3710
- FILES_DIR = (0, import_path2.resolve)(process.cwd(), CONFIG.storage.files_dir);
3711
3726
  }
3712
3727
  });
3713
3728
 
@@ -13087,6 +13102,81 @@ var init_stdio = __esm({
13087
13102
  }
13088
13103
  });
13089
13104
 
13105
+ // package.json
13106
+ var require_package2 = __commonJS({
13107
+ "package.json"(exports2, module2) {
13108
+ module2.exports = {
13109
+ name: "mnemosyne-core",
13110
+ version: "2.0.3",
13111
+ description: "Unified memory engine for AI agents \u2014 graph atoms, semantic search, and collaborative memory",
13112
+ logo: "logo.png",
13113
+ author: "Arman Aslanyan <aslanyanarman88@gmail.com> (https://www.linkedin.com/in/arman-aslanyan/)",
13114
+ main: "dist/index.js",
13115
+ module: "dist/index.js",
13116
+ types: "dist/index.d.ts",
13117
+ bin: {
13118
+ "mnemosyne-core": "./dist/cli/index.js"
13119
+ },
13120
+ exports: {
13121
+ ".": {
13122
+ types: "./dist/index.d.ts",
13123
+ import: "./dist/index.js",
13124
+ require: "./dist/index.js"
13125
+ },
13126
+ "./sdk": {
13127
+ types: "./dist/sdk/index.d.ts",
13128
+ import: "./dist/sdk/index.js",
13129
+ require: "./dist/sdk/index.js"
13130
+ },
13131
+ "./ws": {
13132
+ types: "./dist/ws/index.d.ts",
13133
+ import: "./dist/ws/index.js",
13134
+ require: "./dist/ws/index.js"
13135
+ },
13136
+ "./mcp": {
13137
+ types: "./dist/mcp/index.d.ts",
13138
+ import: "./dist/mcp/index.js",
13139
+ require: "./dist/mcp/index.js"
13140
+ },
13141
+ "./cli": {
13142
+ types: "./dist/cli/index.d.ts",
13143
+ import: "./dist/cli/index.js",
13144
+ require: "./dist/cli/index.js"
13145
+ }
13146
+ },
13147
+ files: [
13148
+ "dist"
13149
+ ],
13150
+ scripts: {
13151
+ start: "node dist/cli/index.js",
13152
+ dev: "tsx watch src/cli/index.ts",
13153
+ build: `tsup --config tsup.config.ts && node -e "require('fs').mkdirSync('dist/dashboard',{recursive:true});require('fs').copyFileSync('src/dashboard/index.html','dist/dashboard/index.html')"`,
13154
+ typecheck: "tsc --noEmit"
13155
+ },
13156
+ devDependencies: {
13157
+ "@types/adm-zip": "^0.5.8",
13158
+ "@types/better-sqlite3": "^7.6.13",
13159
+ "@types/node": "^25.6.2",
13160
+ "@types/ws": "^8.18.1",
13161
+ commander: "^14.0.3",
13162
+ tsup: "^8.5.1",
13163
+ tsx: "^4.19.0",
13164
+ typescript: "^5.8.3",
13165
+ ws: "^8.18.0"
13166
+ },
13167
+ engines: {
13168
+ node: ">=20"
13169
+ },
13170
+ dependencies: {
13171
+ "@xenova/transformers": "^2.17.2",
13172
+ "adm-zip": "^0.5.17",
13173
+ "better-sqlite3": "^12.10.0",
13174
+ "sqlite-vec": "^0.1.9"
13175
+ }
13176
+ };
13177
+ }
13178
+ });
13179
+
13090
13180
  // src/cli/index.ts
13091
13181
  var cli_exports = {};
13092
13182
  __export(cli_exports, {
@@ -14352,7 +14442,7 @@ function getVersion2() {
14352
14442
  const pkg = JSON.parse(readFileSync7(resolve13(process.cwd(), "package.json"), "utf-8"));
14353
14443
  return pkg.version;
14354
14444
  } catch {
14355
- return "2.0.1";
14445
+ return "2.0.3";
14356
14446
  }
14357
14447
  }
14358
14448
  }
@@ -14933,6 +15023,23 @@ var TOOLS = [
14933
15023
  ];
14934
15024
 
14935
15025
  // src/mcp/server.ts
15026
+ function getVersion3() {
15027
+ try {
15028
+ const { readFileSync: readFileSync7 } = require("fs");
15029
+ const { resolve: resolve13 } = require("path");
15030
+ const pkg = JSON.parse(readFileSync7(resolve13(__dirname, "../../package.json"), "utf-8"));
15031
+ return pkg.version;
15032
+ } catch {
15033
+ try {
15034
+ const { readFileSync: readFileSync7 } = require("fs");
15035
+ const { resolve: resolve13 } = require("path");
15036
+ const pkg = JSON.parse(readFileSync7(resolve13(process.cwd(), "package.json"), "utf-8"));
15037
+ return pkg.version;
15038
+ } catch {
15039
+ return "2.0.3";
15040
+ }
15041
+ }
15042
+ }
14936
15043
  var McpServer = class {
14937
15044
  store;
14938
15045
  toolMap = /* @__PURE__ */ new Map();
@@ -14953,7 +15060,7 @@ var McpServer = class {
14953
15060
  return this.ok(req.id, {
14954
15061
  protocolVersion: "2024-11-05",
14955
15062
  capabilities: { tools: {}, resources: {}, prompts: {} },
14956
- serverInfo: { name: "mnemosyne-mcp", version: "2.0.0" }
15063
+ serverInfo: { name: "mnemosyne-mcp", version: getVersion3() }
14957
15064
  });
14958
15065
  case "tools/list":
14959
15066
  return this.ok(req.id, {
@@ -14980,7 +15087,7 @@ var McpServer = class {
14980
15087
  getManifest() {
14981
15088
  return {
14982
15089
  name: "Mnemosyne",
14983
- version: "2.0.0",
15090
+ version: getVersion3(),
14984
15091
  description: "Knowledge base MCP server for projects, atoms, blocks, and bonds.",
14985
15092
  protocol: "mcp",
14986
15093
  transport: ["stdio", "sse"],
@@ -15861,7 +15968,7 @@ var import_crypto2 = require("crypto");
15861
15968
  var import_fs5 = require("fs");
15862
15969
  var import_path6 = require("path");
15863
15970
  var DB_PATH = (0, import_path6.resolve)(process.cwd(), "data", "nexus.db");
15864
- var FILES_DIR2 = (0, import_path6.resolve)(process.cwd(), "data", "files");
15971
+ var FILES_DIR = (0, import_path6.resolve)(process.cwd(), "data", "files");
15865
15972
  function sha256File(path) {
15866
15973
  return (0, import_crypto2.createHash)("sha256").update((0, import_fs5.readFileSync)(path)).digest("hex");
15867
15974
  }
@@ -15881,11 +15988,11 @@ function sha256Dir(dir) {
15881
15988
  function buildMnemosyneExport(projectId, projectName) {
15882
15989
  const zip = new import_adm_zip2.default();
15883
15990
  zip.addLocalFile(DB_PATH, "", "nexus.db");
15884
- if ((0, import_fs5.existsSync)(FILES_DIR2)) {
15885
- zip.addLocalFolder(FILES_DIR2, "files");
15991
+ if ((0, import_fs5.existsSync)(FILES_DIR)) {
15992
+ zip.addLocalFolder(FILES_DIR, "files");
15886
15993
  }
15887
15994
  const dbChecksum = sha256File(DB_PATH);
15888
- const filesChecksum = (0, import_fs5.existsSync)(FILES_DIR2) ? sha256Dir(FILES_DIR2) : "";
15995
+ const filesChecksum = (0, import_fs5.existsSync)(FILES_DIR) ? sha256Dir(FILES_DIR) : "";
15889
15996
  const manifest = {
15890
15997
  version: "1.1",
15891
15998
  app: "Mnemosyne",
@@ -16016,7 +16123,7 @@ var PKG_VERSION = (() => {
16016
16123
  const pkg = JSON.parse(require("fs").readFileSync(require("path").resolve(__dirname, "../../../package.json"), "utf-8"));
16017
16124
  return pkg.version;
16018
16125
  } catch {
16019
- return "2.0.1";
16126
+ return "2.0.3";
16020
16127
  }
16021
16128
  })();
16022
16129
  function handleHealth(store, pathname, method, res) {
@@ -16251,18 +16358,20 @@ var WebSocketHandler = class {
16251
16358
  var import_better_sqlite33 = __toESM(require("better-sqlite3"));
16252
16359
  var import_path7 = require("path");
16253
16360
  init_config();
16254
- var DB_PATH2 = process.env.MNEMOSYNE_DB_PATH || (0, import_path7.resolve)(process.cwd(), CONFIG.database.path);
16361
+ function getDbPath() {
16362
+ return process.env.MNEMOSYNE_DB_PATH || (0, import_path7.resolve)(process.cwd(), CONFIG.database.path);
16363
+ }
16255
16364
  var db = null;
16256
16365
  var vecEnabled = false;
16257
16366
  function getDb() {
16258
16367
  if (!db) {
16259
- db = new import_better_sqlite33.default(DB_PATH2);
16368
+ db = new import_better_sqlite33.default(getDbPath());
16260
16369
  db.pragma("journal_mode = WAL");
16261
16370
  db.pragma("foreign_keys = ON");
16262
16371
  db.pragma("synchronous = NORMAL");
16263
16372
  try {
16264
- const vecPath = (0, import_path7.resolve)(process.cwd(), CONFIG.database.vec_extension_path);
16265
- db.loadExtension(vecPath);
16373
+ const { getLoadablePath } = require("sqlite-vec");
16374
+ db.loadExtension(getLoadablePath());
16266
16375
  vecEnabled = true;
16267
16376
  console.log("[DB] sqlite-vec extension loaded");
16268
16377
  } catch (err) {
@@ -16338,7 +16447,7 @@ var MnemosyneServer = class {
16338
16447
  const wss = new import_websocket_server.default({ server: this.httpServer });
16339
16448
  this.wsHandler = new WebSocketHandler(wss, this.store);
16340
16449
  }
16341
- const version = cfg?.server?.version || "2.0.1";
16450
+ const version = cfg?.server?.version || "2.0.3";
16342
16451
  this.httpServer.listen(port, () => {
16343
16452
  console.log(`Mnemosyne v${version} \u2014 port ${port}`);
16344
16453
  console.log(`Dashboard: http://${host}:${port}/dashboard`);
@@ -16390,6 +16499,15 @@ var MnemosyneServer = class {
16390
16499
  };
16391
16500
 
16392
16501
  // src/cli/commands/start.ts
16502
+ function getVersion4() {
16503
+ try {
16504
+ const { readFileSync: readFileSync7 } = require("fs");
16505
+ const { resolve: resolve13 } = require("path");
16506
+ return JSON.parse(readFileSync7(resolve13(__dirname, "../../../package.json"), "utf-8")).version;
16507
+ } catch {
16508
+ return "2.0.3";
16509
+ }
16510
+ }
16393
16511
  async function startCommand(options) {
16394
16512
  const dataDir = (0, import_path9.resolve)(options.dataDir);
16395
16513
  const dbPath = (0, import_path9.resolve)(dataDir, "nexus.db");
@@ -16397,7 +16515,7 @@ async function startCommand(options) {
16397
16515
  await brain.init();
16398
16516
  if (options.mcpTransport === "stdio" && options.mcp) {
16399
16517
  if (options.verbose) {
16400
- console.error(`\u{1F9E0} Mnemosyne v2.0.0 (stdio mode)`);
16518
+ console.error(`\u{1F9E0} Mnemosyne v${getVersion4()} (stdio mode)`);
16401
16519
  console.error(` dbPath: ${dbPath}`);
16402
16520
  }
16403
16521
  const mcpServer = new McpServer(brain.store);
@@ -16407,7 +16525,7 @@ async function startCommand(options) {
16407
16525
  return;
16408
16526
  }
16409
16527
  const port = parseInt(options.port, 10);
16410
- console.log(`\u{1F9E0} Mnemosyne v2.0.0`);
16528
+ console.log(`\u{1F9E0} Mnemosyne v${getVersion4()}`);
16411
16529
  if (options.verbose) {
16412
16530
  console.log(` dataDir: ${dataDir}`);
16413
16531
  console.log(` dbPath: ${dbPath}`);
@@ -16588,7 +16706,13 @@ async function exportCommand(options) {
16588
16706
 
16589
16707
  // src/cli/index.ts
16590
16708
  var program2 = new Command();
16591
- program2.name("mnemosyne").description("Mnemosyne \u2014 Your exocortex").version("2.0.0");
16709
+ program2.name("mnemosyne").description("Mnemosyne \u2014 Your exocortex").version((() => {
16710
+ try {
16711
+ return require_package2().version;
16712
+ } catch {
16713
+ return "2.0.3";
16714
+ }
16715
+ })());
16592
16716
  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);
16593
16717
  program2.command("start").description("Start the Mnemosyne server").option("-p, --port <number>", "Port to listen on", "7321").option("-h, --host <string>", "Host to bind to", "localhost").option("-d, --data-dir <path>", "Data directory", "./data").option("--mcp", "Enable MCP server", true).option("--mcp-transport <type>", "MCP transport: sse or stdio", "sse").option("--no-dashboard", "Disable dashboard serving").option("-c, --config <path>", "Config file path").option("-v, --verbose", "Enable verbose logging").action(startCommand);
16594
16718
  program2.command("migrate").description("Migrate from v1.0 JSON to v2.0 SQLite").requiredOption("--from <path>", "Path to v1.0 mnemosyne.db.json").requiredOption("--to <path>", "Path to v2.0 nexus.db").action(migrateCommand);