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.
@@ -3556,14 +3556,18 @@ function loadConfig() {
3556
3556
  }
3557
3557
  function getVersion() {
3558
3558
  try {
3559
- const pkg = JSON.parse(readFileSync(resolve(__dirname, "../package.json"), "utf-8"));
3559
+ const { readFileSync: readFileSync7 } = __require("fs");
3560
+ const { resolve: resolve13 } = __require("path");
3561
+ const pkg = JSON.parse(readFileSync7(resolve13(__dirname, "../package.json"), "utf-8"));
3560
3562
  return pkg.version;
3561
3563
  } catch {
3562
3564
  try {
3563
- const pkg = JSON.parse(readFileSync(resolve(process.cwd(), "package.json"), "utf-8"));
3565
+ const { readFileSync: readFileSync7 } = __require("fs");
3566
+ const { resolve: resolve13 } = __require("path");
3567
+ const pkg = JSON.parse(readFileSync7(resolve13(process.cwd(), "package.json"), "utf-8"));
3564
3568
  return pkg.version;
3565
3569
  } catch {
3566
- return "2.0.1";
3570
+ return "2.0.3";
3567
3571
  }
3568
3572
  }
3569
3573
  }
@@ -3592,11 +3596,20 @@ function mergeDeep(target, source) {
3592
3596
  }
3593
3597
  return output;
3594
3598
  }
3595
- var CONFIG;
3599
+ function getConfig() {
3600
+ if (!_config) _config = loadConfig();
3601
+ return _config;
3602
+ }
3603
+ var _config, CONFIG;
3596
3604
  var init_config = __esm({
3597
3605
  "src/config.ts"() {
3598
3606
  "use strict";
3599
- CONFIG = loadConfig();
3607
+ _config = null;
3608
+ CONFIG = new Proxy({}, {
3609
+ get(_, prop) {
3610
+ return getConfig()[prop];
3611
+ }
3612
+ });
3600
3613
  }
3601
3614
  });
3602
3615
 
@@ -3681,11 +3694,14 @@ var init_embedder = __esm({
3681
3694
  import { createHash } from "crypto";
3682
3695
  import { mkdirSync, existsSync as existsSync2, writeFileSync, readFileSync as readFileSync2 } from "fs";
3683
3696
  import { resolve as resolve2, dirname } from "path";
3697
+ function getFilesDir() {
3698
+ return resolve2(process.cwd(), CONFIG.storage.files_dir);
3699
+ }
3684
3700
  function ensureDir(path) {
3685
3701
  if (!existsSync2(path)) mkdirSync(path, { recursive: true });
3686
3702
  }
3687
3703
  function hashPath(hash) {
3688
- return resolve2(FILES_DIR, hash.slice(0, 2), hash.slice(2));
3704
+ return resolve2(getFilesDir(), hash.slice(0, 2), hash.slice(2));
3689
3705
  }
3690
3706
  function computeHash(buffer) {
3691
3707
  return createHash("sha256").update(buffer).digest("hex");
@@ -3706,12 +3722,10 @@ function getFile(hash) {
3706
3722
  return null;
3707
3723
  }
3708
3724
  }
3709
- var FILES_DIR;
3710
3725
  var init_files = __esm({
3711
3726
  "src/server/files.ts"() {
3712
3727
  "use strict";
3713
3728
  init_config();
3714
- FILES_DIR = resolve2(process.cwd(), CONFIG.storage.files_dir);
3715
3729
  }
3716
3730
  });
3717
3731
 
@@ -13091,6 +13105,81 @@ var init_stdio = __esm({
13091
13105
  }
13092
13106
  });
13093
13107
 
13108
+ // package.json
13109
+ var require_package2 = __commonJS({
13110
+ "package.json"(exports, module2) {
13111
+ module2.exports = {
13112
+ name: "mnemosyne-core",
13113
+ version: "2.0.3",
13114
+ description: "Unified memory engine for AI agents \u2014 graph atoms, semantic search, and collaborative memory",
13115
+ logo: "logo.png",
13116
+ author: "Arman Aslanyan <aslanyanarman88@gmail.com> (https://www.linkedin.com/in/arman-aslanyan/)",
13117
+ main: "dist/index.js",
13118
+ module: "dist/index.js",
13119
+ types: "dist/index.d.ts",
13120
+ bin: {
13121
+ "mnemosyne-core": "./dist/cli/index.js"
13122
+ },
13123
+ exports: {
13124
+ ".": {
13125
+ types: "./dist/index.d.ts",
13126
+ import: "./dist/index.js",
13127
+ require: "./dist/index.js"
13128
+ },
13129
+ "./sdk": {
13130
+ types: "./dist/sdk/index.d.ts",
13131
+ import: "./dist/sdk/index.js",
13132
+ require: "./dist/sdk/index.js"
13133
+ },
13134
+ "./ws": {
13135
+ types: "./dist/ws/index.d.ts",
13136
+ import: "./dist/ws/index.js",
13137
+ require: "./dist/ws/index.js"
13138
+ },
13139
+ "./mcp": {
13140
+ types: "./dist/mcp/index.d.ts",
13141
+ import: "./dist/mcp/index.js",
13142
+ require: "./dist/mcp/index.js"
13143
+ },
13144
+ "./cli": {
13145
+ types: "./dist/cli/index.d.ts",
13146
+ import: "./dist/cli/index.js",
13147
+ require: "./dist/cli/index.js"
13148
+ }
13149
+ },
13150
+ files: [
13151
+ "dist"
13152
+ ],
13153
+ scripts: {
13154
+ start: "node dist/cli/index.js",
13155
+ dev: "tsx watch src/cli/index.ts",
13156
+ 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')"`,
13157
+ typecheck: "tsc --noEmit"
13158
+ },
13159
+ devDependencies: {
13160
+ "@types/adm-zip": "^0.5.8",
13161
+ "@types/better-sqlite3": "^7.6.13",
13162
+ "@types/node": "^25.6.2",
13163
+ "@types/ws": "^8.18.1",
13164
+ commander: "^14.0.3",
13165
+ tsup: "^8.5.1",
13166
+ tsx: "^4.19.0",
13167
+ typescript: "^5.8.3",
13168
+ ws: "^8.18.0"
13169
+ },
13170
+ engines: {
13171
+ node: ">=20"
13172
+ },
13173
+ dependencies: {
13174
+ "@xenova/transformers": "^2.17.2",
13175
+ "adm-zip": "^0.5.17",
13176
+ "better-sqlite3": "^12.10.0",
13177
+ "sqlite-vec": "^0.1.9"
13178
+ }
13179
+ };
13180
+ }
13181
+ });
13182
+
13094
13183
  // node_modules/commander/esm.mjs
13095
13184
  var import_index = __toESM(require_commander(), 1);
13096
13185
  var {
@@ -14349,7 +14438,7 @@ function getVersion2() {
14349
14438
  const pkg = JSON.parse(readFileSync7(resolve13(process.cwd(), "package.json"), "utf-8"));
14350
14439
  return pkg.version;
14351
14440
  } catch {
14352
- return "2.0.1";
14441
+ return "2.0.3";
14353
14442
  }
14354
14443
  }
14355
14444
  }
@@ -14930,6 +15019,23 @@ var TOOLS = [
14930
15019
  ];
14931
15020
 
14932
15021
  // src/mcp/server.ts
15022
+ function getVersion3() {
15023
+ try {
15024
+ const { readFileSync: readFileSync7 } = __require("fs");
15025
+ const { resolve: resolve13 } = __require("path");
15026
+ const pkg = JSON.parse(readFileSync7(resolve13(__dirname, "../../package.json"), "utf-8"));
15027
+ return pkg.version;
15028
+ } catch {
15029
+ try {
15030
+ const { readFileSync: readFileSync7 } = __require("fs");
15031
+ const { resolve: resolve13 } = __require("path");
15032
+ const pkg = JSON.parse(readFileSync7(resolve13(process.cwd(), "package.json"), "utf-8"));
15033
+ return pkg.version;
15034
+ } catch {
15035
+ return "2.0.3";
15036
+ }
15037
+ }
15038
+ }
14933
15039
  var McpServer = class {
14934
15040
  store;
14935
15041
  toolMap = /* @__PURE__ */ new Map();
@@ -14950,7 +15056,7 @@ var McpServer = class {
14950
15056
  return this.ok(req.id, {
14951
15057
  protocolVersion: "2024-11-05",
14952
15058
  capabilities: { tools: {}, resources: {}, prompts: {} },
14953
- serverInfo: { name: "mnemosyne-mcp", version: "2.0.0" }
15059
+ serverInfo: { name: "mnemosyne-mcp", version: getVersion3() }
14954
15060
  });
14955
15061
  case "tools/list":
14956
15062
  return this.ok(req.id, {
@@ -14977,7 +15083,7 @@ var McpServer = class {
14977
15083
  getManifest() {
14978
15084
  return {
14979
15085
  name: "Mnemosyne",
14980
- version: "2.0.0",
15086
+ version: getVersion3(),
14981
15087
  description: "Knowledge base MCP server for projects, atoms, blocks, and bonds.",
14982
15088
  protocol: "mcp",
14983
15089
  transport: ["stdio", "sse"],
@@ -15858,7 +15964,7 @@ import { createHash as createHash2 } from "crypto";
15858
15964
  import { readFileSync as readFileSync4, existsSync as existsSync5, readdirSync as readdirSync2, statSync as statSync2 } from "fs";
15859
15965
  import { resolve as resolve6 } from "path";
15860
15966
  var DB_PATH = resolve6(process.cwd(), "data", "nexus.db");
15861
- var FILES_DIR2 = resolve6(process.cwd(), "data", "files");
15967
+ var FILES_DIR = resolve6(process.cwd(), "data", "files");
15862
15968
  function sha256File(path) {
15863
15969
  return createHash2("sha256").update(readFileSync4(path)).digest("hex");
15864
15970
  }
@@ -15878,11 +15984,11 @@ function sha256Dir(dir) {
15878
15984
  function buildMnemosyneExport(projectId, projectName) {
15879
15985
  const zip = new AdmZip2();
15880
15986
  zip.addLocalFile(DB_PATH, "", "nexus.db");
15881
- if (existsSync5(FILES_DIR2)) {
15882
- zip.addLocalFolder(FILES_DIR2, "files");
15987
+ if (existsSync5(FILES_DIR)) {
15988
+ zip.addLocalFolder(FILES_DIR, "files");
15883
15989
  }
15884
15990
  const dbChecksum = sha256File(DB_PATH);
15885
- const filesChecksum = existsSync5(FILES_DIR2) ? sha256Dir(FILES_DIR2) : "";
15991
+ const filesChecksum = existsSync5(FILES_DIR) ? sha256Dir(FILES_DIR) : "";
15886
15992
  const manifest = {
15887
15993
  version: "1.1",
15888
15994
  app: "Mnemosyne",
@@ -16013,7 +16119,7 @@ var PKG_VERSION = (() => {
16013
16119
  const pkg = JSON.parse(__require("fs").readFileSync(__require("path").resolve(__dirname, "../../../package.json"), "utf-8"));
16014
16120
  return pkg.version;
16015
16121
  } catch {
16016
- return "2.0.1";
16122
+ return "2.0.3";
16017
16123
  }
16018
16124
  })();
16019
16125
  function handleHealth(store, pathname, method, res) {
@@ -16248,18 +16354,20 @@ var WebSocketHandler = class {
16248
16354
  init_config();
16249
16355
  import Database2 from "better-sqlite3";
16250
16356
  import { resolve as resolve7 } from "path";
16251
- var DB_PATH2 = process.env.MNEMOSYNE_DB_PATH || resolve7(process.cwd(), CONFIG.database.path);
16357
+ function getDbPath() {
16358
+ return process.env.MNEMOSYNE_DB_PATH || resolve7(process.cwd(), CONFIG.database.path);
16359
+ }
16252
16360
  var db = null;
16253
16361
  var vecEnabled = false;
16254
16362
  function getDb() {
16255
16363
  if (!db) {
16256
- db = new Database2(DB_PATH2);
16364
+ db = new Database2(getDbPath());
16257
16365
  db.pragma("journal_mode = WAL");
16258
16366
  db.pragma("foreign_keys = ON");
16259
16367
  db.pragma("synchronous = NORMAL");
16260
16368
  try {
16261
- const vecPath = resolve7(process.cwd(), CONFIG.database.vec_extension_path);
16262
- db.loadExtension(vecPath);
16369
+ const { getLoadablePath } = __require("sqlite-vec");
16370
+ db.loadExtension(getLoadablePath());
16263
16371
  vecEnabled = true;
16264
16372
  console.log("[DB] sqlite-vec extension loaded");
16265
16373
  } catch (err) {
@@ -16335,7 +16443,7 @@ var MnemosyneServer = class {
16335
16443
  const wss = new import_websocket_server.default({ server: this.httpServer });
16336
16444
  this.wsHandler = new WebSocketHandler(wss, this.store);
16337
16445
  }
16338
- const version = cfg?.server?.version || "2.0.1";
16446
+ const version = cfg?.server?.version || "2.0.3";
16339
16447
  this.httpServer.listen(port, () => {
16340
16448
  console.log(`Mnemosyne v${version} \u2014 port ${port}`);
16341
16449
  console.log(`Dashboard: http://${host}:${port}/dashboard`);
@@ -16387,6 +16495,15 @@ var MnemosyneServer = class {
16387
16495
  };
16388
16496
 
16389
16497
  // src/cli/commands/start.ts
16498
+ function getVersion4() {
16499
+ try {
16500
+ const { readFileSync: readFileSync7 } = __require("fs");
16501
+ const { resolve: resolve13 } = __require("path");
16502
+ return JSON.parse(readFileSync7(resolve13(__dirname, "../../../package.json"), "utf-8")).version;
16503
+ } catch {
16504
+ return "2.0.3";
16505
+ }
16506
+ }
16390
16507
  async function startCommand(options) {
16391
16508
  const dataDir = resolve9(options.dataDir);
16392
16509
  const dbPath = resolve9(dataDir, "nexus.db");
@@ -16394,7 +16511,7 @@ async function startCommand(options) {
16394
16511
  await brain.init();
16395
16512
  if (options.mcpTransport === "stdio" && options.mcp) {
16396
16513
  if (options.verbose) {
16397
- console.error(`\u{1F9E0} Mnemosyne v2.0.0 (stdio mode)`);
16514
+ console.error(`\u{1F9E0} Mnemosyne v${getVersion4()} (stdio mode)`);
16398
16515
  console.error(` dbPath: ${dbPath}`);
16399
16516
  }
16400
16517
  const mcpServer = new McpServer(brain.store);
@@ -16404,7 +16521,7 @@ async function startCommand(options) {
16404
16521
  return;
16405
16522
  }
16406
16523
  const port = parseInt(options.port, 10);
16407
- console.log(`\u{1F9E0} Mnemosyne v2.0.0`);
16524
+ console.log(`\u{1F9E0} Mnemosyne v${getVersion4()}`);
16408
16525
  if (options.verbose) {
16409
16526
  console.log(` dataDir: ${dataDir}`);
16410
16527
  console.log(` dbPath: ${dbPath}`);
@@ -16585,7 +16702,13 @@ async function exportCommand(options) {
16585
16702
 
16586
16703
  // src/cli/index.ts
16587
16704
  var program2 = new Command();
16588
- program2.name("mnemosyne").description("Mnemosyne \u2014 Your exocortex").version("2.0.0");
16705
+ program2.name("mnemosyne").description("Mnemosyne \u2014 Your exocortex").version((() => {
16706
+ try {
16707
+ return require_package2().version;
16708
+ } catch {
16709
+ return "2.0.3";
16710
+ }
16711
+ })());
16589
16712
  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);
16590
16713
  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);
16591
16714
  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);