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.
@@ -3730,22 +3730,26 @@ function loadConfig() {
3730
3730
  return defaultConfig();
3731
3731
  }
3732
3732
  }
3733
- function getVersion() {
3733
+ function getVersion2() {
3734
3734
  try {
3735
- const pkg = JSON.parse((0, import_fs.readFileSync)((0, import_path.resolve)(__dirname, "../package.json"), "utf-8"));
3735
+ const { readFileSync: readFileSync5 } = require("fs");
3736
+ const { resolve: resolve7 } = require("path");
3737
+ const pkg = JSON.parse(readFileSync5(resolve7(__dirname, "../package.json"), "utf-8"));
3736
3738
  return pkg.version;
3737
3739
  } catch {
3738
3740
  try {
3739
- const pkg = JSON.parse((0, import_fs.readFileSync)((0, import_path.resolve)(process.cwd(), "package.json"), "utf-8"));
3741
+ const { readFileSync: readFileSync5 } = require("fs");
3742
+ const { resolve: resolve7 } = require("path");
3743
+ const pkg = JSON.parse(readFileSync5(resolve7(process.cwd(), "package.json"), "utf-8"));
3740
3744
  return pkg.version;
3741
3745
  } catch {
3742
- return "2.0.1";
3746
+ return "2.0.3";
3743
3747
  }
3744
3748
  }
3745
3749
  }
3746
3750
  function defaultConfig() {
3747
3751
  return {
3748
- server: { port: 7321, host: "localhost", version: getVersion() },
3752
+ server: { port: 7321, host: "localhost", version: getVersion2() },
3749
3753
  database: { path: "data/nexus.db", wal_mode: true, vec_extension_path: "data/vec0" },
3750
3754
  storage: { files_dir: "data/files", max_file_size_mb: 50, backups_dir: "data/backups", backup_interval_hours: 24, max_backups: 7 },
3751
3755
  limits: { max_atoms_per_project: 1e4, rate_limit_requests: 100, rate_limit_window_ms: 6e4 },
@@ -3768,13 +3772,22 @@ function mergeDeep(target, source) {
3768
3772
  }
3769
3773
  return output;
3770
3774
  }
3771
- var import_fs, import_path, CONFIG;
3775
+ function getConfig() {
3776
+ if (!_config) _config = loadConfig();
3777
+ return _config;
3778
+ }
3779
+ var import_fs, import_path, _config, CONFIG;
3772
3780
  var init_config = __esm({
3773
3781
  "src/config.ts"() {
3774
3782
  "use strict";
3775
3783
  import_fs = require("fs");
3776
3784
  import_path = require("path");
3777
- CONFIG = loadConfig();
3785
+ _config = null;
3786
+ CONFIG = new Proxy({}, {
3787
+ get(_, prop) {
3788
+ return getConfig()[prop];
3789
+ }
3790
+ });
3778
3791
  }
3779
3792
  });
3780
3793
 
@@ -3856,11 +3869,14 @@ var init_embedder = __esm({
3856
3869
  });
3857
3870
 
3858
3871
  // src/server/files.ts
3872
+ function getFilesDir() {
3873
+ return (0, import_path2.resolve)(process.cwd(), CONFIG.storage.files_dir);
3874
+ }
3859
3875
  function ensureDir(path) {
3860
3876
  if (!(0, import_fs2.existsSync)(path)) (0, import_fs2.mkdirSync)(path, { recursive: true });
3861
3877
  }
3862
3878
  function hashPath(hash) {
3863
- return (0, import_path2.resolve)(FILES_DIR, hash.slice(0, 2), hash.slice(2));
3879
+ return (0, import_path2.resolve)(getFilesDir(), hash.slice(0, 2), hash.slice(2));
3864
3880
  }
3865
3881
  function computeHash(buffer) {
3866
3882
  return (0, import_crypto.createHash)("sha256").update(buffer).digest("hex");
@@ -3881,7 +3897,7 @@ function getFile(hash) {
3881
3897
  return null;
3882
3898
  }
3883
3899
  }
3884
- var import_crypto, import_fs2, import_path2, FILES_DIR;
3900
+ var import_crypto, import_fs2, import_path2;
3885
3901
  var init_files = __esm({
3886
3902
  "src/server/files.ts"() {
3887
3903
  "use strict";
@@ -3889,7 +3905,6 @@ var init_files = __esm({
3889
3905
  import_fs2 = require("fs");
3890
3906
  import_path2 = require("path");
3891
3907
  init_config();
3892
- FILES_DIR = (0, import_path2.resolve)(process.cwd(), CONFIG.storage.files_dir);
3893
3908
  }
3894
3909
  });
3895
3910
 
@@ -9848,6 +9863,23 @@ var TOOLS = [
9848
9863
  ];
9849
9864
 
9850
9865
  // src/mcp/server.ts
9866
+ function getVersion() {
9867
+ try {
9868
+ const { readFileSync: readFileSync5 } = require("fs");
9869
+ const { resolve: resolve7 } = require("path");
9870
+ const pkg = JSON.parse(readFileSync5(resolve7(__dirname, "../../package.json"), "utf-8"));
9871
+ return pkg.version;
9872
+ } catch {
9873
+ try {
9874
+ const { readFileSync: readFileSync5 } = require("fs");
9875
+ const { resolve: resolve7 } = require("path");
9876
+ const pkg = JSON.parse(readFileSync5(resolve7(process.cwd(), "package.json"), "utf-8"));
9877
+ return pkg.version;
9878
+ } catch {
9879
+ return "2.0.3";
9880
+ }
9881
+ }
9882
+ }
9851
9883
  var McpServer = class {
9852
9884
  store;
9853
9885
  toolMap = /* @__PURE__ */ new Map();
@@ -9868,7 +9900,7 @@ var McpServer = class {
9868
9900
  return this.ok(req.id, {
9869
9901
  protocolVersion: "2024-11-05",
9870
9902
  capabilities: { tools: {}, resources: {}, prompts: {} },
9871
- serverInfo: { name: "mnemosyne-mcp", version: "2.0.0" }
9903
+ serverInfo: { name: "mnemosyne-mcp", version: getVersion() }
9872
9904
  });
9873
9905
  case "tools/list":
9874
9906
  return this.ok(req.id, {
@@ -9895,7 +9927,7 @@ var McpServer = class {
9895
9927
  getManifest() {
9896
9928
  return {
9897
9929
  name: "Mnemosyne",
9898
- version: "2.0.0",
9930
+ version: getVersion(),
9899
9931
  description: "Knowledge base MCP server for projects, atoms, blocks, and bonds.",
9900
9932
  protocol: "mcp",
9901
9933
  transport: ["stdio", "sse"],
@@ -10773,7 +10805,7 @@ var import_crypto2 = require("crypto");
10773
10805
  var import_fs3 = require("fs");
10774
10806
  var import_path3 = require("path");
10775
10807
  var DB_PATH = (0, import_path3.resolve)(process.cwd(), "data", "nexus.db");
10776
- var FILES_DIR2 = (0, import_path3.resolve)(process.cwd(), "data", "files");
10808
+ var FILES_DIR = (0, import_path3.resolve)(process.cwd(), "data", "files");
10777
10809
  function sha256File(path) {
10778
10810
  return (0, import_crypto2.createHash)("sha256").update((0, import_fs3.readFileSync)(path)).digest("hex");
10779
10811
  }
@@ -10793,11 +10825,11 @@ function sha256Dir(dir) {
10793
10825
  function buildMnemosyneExport(projectId, projectName) {
10794
10826
  const zip = new import_adm_zip.default();
10795
10827
  zip.addLocalFile(DB_PATH, "", "nexus.db");
10796
- if ((0, import_fs3.existsSync)(FILES_DIR2)) {
10797
- zip.addLocalFolder(FILES_DIR2, "files");
10828
+ if ((0, import_fs3.existsSync)(FILES_DIR)) {
10829
+ zip.addLocalFolder(FILES_DIR, "files");
10798
10830
  }
10799
10831
  const dbChecksum = sha256File(DB_PATH);
10800
- const filesChecksum = (0, import_fs3.existsSync)(FILES_DIR2) ? sha256Dir(FILES_DIR2) : "";
10832
+ const filesChecksum = (0, import_fs3.existsSync)(FILES_DIR) ? sha256Dir(FILES_DIR) : "";
10801
10833
  const manifest = {
10802
10834
  version: "1.1",
10803
10835
  app: "Mnemosyne",
@@ -10928,7 +10960,7 @@ var PKG_VERSION = (() => {
10928
10960
  const pkg = JSON.parse(require("fs").readFileSync(require("path").resolve(__dirname, "../../../package.json"), "utf-8"));
10929
10961
  return pkg.version;
10930
10962
  } catch {
10931
- return "2.0.1";
10963
+ return "2.0.3";
10932
10964
  }
10933
10965
  })();
10934
10966
  function handleHealth(store, pathname, method, res) {
@@ -12534,18 +12566,20 @@ CREATE TABLE IF NOT EXISTS atom_permissions (
12534
12566
  `;
12535
12567
 
12536
12568
  // src/db/connection.ts
12537
- var DB_PATH2 = process.env.MNEMOSYNE_DB_PATH || (0, import_path5.resolve)(process.cwd(), CONFIG.database.path);
12569
+ function getDbPath() {
12570
+ return process.env.MNEMOSYNE_DB_PATH || (0, import_path5.resolve)(process.cwd(), CONFIG.database.path);
12571
+ }
12538
12572
  var db = null;
12539
12573
  var vecEnabled = false;
12540
12574
  function getDb() {
12541
12575
  if (!db) {
12542
- db = new import_better_sqlite32.default(DB_PATH2);
12576
+ db = new import_better_sqlite32.default(getDbPath());
12543
12577
  db.pragma("journal_mode = WAL");
12544
12578
  db.pragma("foreign_keys = ON");
12545
12579
  db.pragma("synchronous = NORMAL");
12546
12580
  try {
12547
- const vecPath = (0, import_path5.resolve)(process.cwd(), CONFIG.database.vec_extension_path);
12548
- db.loadExtension(vecPath);
12581
+ const { getLoadablePath } = require("sqlite-vec");
12582
+ db.loadExtension(getLoadablePath());
12549
12583
  vecEnabled = true;
12550
12584
  console.log("[DB] sqlite-vec extension loaded");
12551
12585
  } catch (err) {
@@ -12621,7 +12655,7 @@ var MnemosyneServer = class {
12621
12655
  const wss = new import_websocket_server.default({ server: this.httpServer });
12622
12656
  this.wsHandler = new WebSocketHandler(wss, this.store);
12623
12657
  }
12624
- const version = cfg?.server?.version || "2.0.1";
12658
+ const version = cfg?.server?.version || "2.0.3";
12625
12659
  this.httpServer.listen(port, () => {
12626
12660
  console.log(`Mnemosyne v${version} \u2014 port ${port}`);
12627
12661
  console.log(`Dashboard: http://${host}:${port}/dashboard`);