mnemosyne-core 2.0.1 → 2.0.2

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/index.js CHANGED
@@ -114,9 +114,22 @@ function loadConfig() {
114
114
  return defaultConfig();
115
115
  }
116
116
  }
117
+ function getVersion() {
118
+ try {
119
+ const pkg = JSON.parse((0, import_fs.readFileSync)((0, import_path.resolve)(__dirname, "../package.json"), "utf-8"));
120
+ return pkg.version;
121
+ } catch {
122
+ try {
123
+ const pkg = JSON.parse((0, import_fs.readFileSync)((0, import_path.resolve)(process.cwd(), "package.json"), "utf-8"));
124
+ return pkg.version;
125
+ } catch {
126
+ return "2.0.1";
127
+ }
128
+ }
129
+ }
117
130
  function defaultConfig() {
118
131
  return {
119
- server: { port: 7321, host: "localhost", version: "2.0.0" },
132
+ server: { port: 7321, host: "localhost", version: getVersion() },
120
133
  database: { path: "data/nexus.db", wal_mode: true, vec_extension_path: "data/vec0" },
121
134
  storage: { files_dir: "data/files", max_file_size_mb: 50, backups_dir: "data/backups", backup_interval_hours: 24, max_backups: 7 },
122
135
  limits: { max_atoms_per_project: 1e4, rate_limit_requests: 100, rate_limit_window_ms: 6e4 },
@@ -10857,9 +10870,26 @@ function parseYaml2(text) {
10857
10870
  }
10858
10871
  return root;
10859
10872
  }
10873
+ function getVersion2() {
10874
+ try {
10875
+ const { readFileSync: readFileSync6 } = require("fs");
10876
+ const { resolve: resolve9 } = require("path");
10877
+ const pkg = JSON.parse(readFileSync6(resolve9(__dirname, "../../package.json"), "utf-8"));
10878
+ return pkg.version;
10879
+ } catch {
10880
+ try {
10881
+ const { readFileSync: readFileSync6 } = require("fs");
10882
+ const { resolve: resolve9 } = require("path");
10883
+ const pkg = JSON.parse(readFileSync6(resolve9(process.cwd(), "package.json"), "utf-8"));
10884
+ return pkg.version;
10885
+ } catch {
10886
+ return "2.0.1";
10887
+ }
10888
+ }
10889
+ }
10860
10890
  function defaultConfig2() {
10861
10891
  return {
10862
- server: { port: 7321, host: "localhost", version: "2.0.0" },
10892
+ server: { port: 7321, host: "localhost", version: getVersion2() },
10863
10893
  database: { path: "data/nexus.db", wal_mode: true, vec_extension_path: "data/vec0" },
10864
10894
  storage: { files_dir: "data/files", max_file_size_mb: 50, backups_dir: "data/backups", backup_interval_hours: 24, max_backups: 7 },
10865
10895
  limits: { max_atoms_per_project: 1e4, rate_limit_requests: 100, rate_limit_window_ms: 6e4 },
@@ -11146,7 +11176,13 @@ var Mnemosyne = class {
11146
11176
  this.db.pragma("synchronous = NORMAL");
11147
11177
  this.vecEnabled = false;
11148
11178
  try {
11149
- const vecPath = (0, import_path5.resolve)(this.config.baseDirPath || process.cwd(), cfg.database.vec_extension_path);
11179
+ let vecPath;
11180
+ try {
11181
+ const sqliteVec = require("sqlite-vec");
11182
+ vecPath = sqliteVec.getLoadablePath();
11183
+ } catch {
11184
+ vecPath = (0, import_path5.resolve)(this.config.baseDirPath || process.cwd(), cfg.database.vec_extension_path);
11185
+ }
11150
11186
  this.db.loadExtension(vecPath);
11151
11187
  this.vecEnabled = true;
11152
11188
  console.log("[DB] sqlite-vec extension loaded");
@@ -12522,12 +12558,20 @@ function handleEvents(store, pathname, method, res, searchParams) {
12522
12558
  }
12523
12559
 
12524
12560
  // src/api/routes/health.ts
12561
+ var PKG_VERSION = (() => {
12562
+ try {
12563
+ const pkg = JSON.parse(require("fs").readFileSync(require("path").resolve(__dirname, "../../../package.json"), "utf-8"));
12564
+ return pkg.version;
12565
+ } catch {
12566
+ return "2.0.1";
12567
+ }
12568
+ })();
12525
12569
  function handleHealth(store, pathname, method, res) {
12526
- if (pathname === "/health" && method === "GET") {
12570
+ if ((pathname === "/health" || pathname === "/api/v1/health") && method === "GET") {
12527
12571
  const stats = store.getStats();
12528
12572
  json(res, 200, {
12529
12573
  status: "ok",
12530
- version: "2.0.0",
12574
+ version: PKG_VERSION,
12531
12575
  storage: "sqlite",
12532
12576
  database: store.config.database.path,
12533
12577
  uptime: process.uptime(),
@@ -12841,7 +12885,6 @@ var Store2 = class extends Store {
12841
12885
  };
12842
12886
 
12843
12887
  // src/server/MnemosyneServer.ts
12844
- init_config();
12845
12888
  var MnemosyneServer = class {
12846
12889
  store;
12847
12890
  api;
@@ -12849,8 +12892,9 @@ var MnemosyneServer = class {
12849
12892
  httpServer;
12850
12893
  brain;
12851
12894
  constructor(options = {}, brain) {
12852
- const port = options.port ?? CONFIG.server.port;
12853
- const host = options.host ?? CONFIG.server.host;
12895
+ const cfg = brain?.config?.config;
12896
+ const port = options.port ?? cfg?.server?.port ?? 7321;
12897
+ const host = options.host ?? cfg?.server?.host ?? "localhost";
12854
12898
  const enableDashboard = options.dashboard !== false;
12855
12899
  const enableWebsocket = options.websocket !== false;
12856
12900
  process.on("uncaughtException", (err) => {
@@ -12878,8 +12922,9 @@ var MnemosyneServer = class {
12878
12922
  const wss = new import_websocket_server.default({ server: this.httpServer });
12879
12923
  this.wsHandler = new WebSocketHandler(wss, this.store);
12880
12924
  }
12925
+ const version = cfg?.server?.version || "2.0.1";
12881
12926
  this.httpServer.listen(port, () => {
12882
- console.log(`Mnemosyne v${CONFIG.server.version} \u2014 port ${port}`);
12927
+ console.log(`Mnemosyne v${version} \u2014 port ${port}`);
12883
12928
  console.log(`Dashboard: http://${host}:${port}/dashboard`);
12884
12929
  console.log(`API: http://${host}:${port}/api/v1`);
12885
12930
  console.log(`MCP: http://${host}:${port}/mcp/manifest`);
@@ -12904,7 +12949,8 @@ var MnemosyneServer = class {
12904
12949
  };
12905
12950
  const dirs = [
12906
12951
  (0, import_path8.resolve)(process.cwd(), "src/dashboard"),
12907
- (0, import_path8.resolve)(process.cwd(), "dashboard")
12952
+ (0, import_path8.resolve)(process.cwd(), "dashboard"),
12953
+ (0, import_path8.resolve)(__dirname, "../dashboard")
12908
12954
  ];
12909
12955
  for (const dir of dirs) {
12910
12956
  const filePath = (0, import_path8.resolve)(dir, urlPath);