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.
@@ -3730,9 +3730,22 @@ function loadConfig() {
3730
3730
  return defaultConfig();
3731
3731
  }
3732
3732
  }
3733
+ function getVersion() {
3734
+ try {
3735
+ const pkg = JSON.parse((0, import_fs.readFileSync)((0, import_path.resolve)(__dirname, "../package.json"), "utf-8"));
3736
+ return pkg.version;
3737
+ } catch {
3738
+ try {
3739
+ const pkg = JSON.parse((0, import_fs.readFileSync)((0, import_path.resolve)(process.cwd(), "package.json"), "utf-8"));
3740
+ return pkg.version;
3741
+ } catch {
3742
+ return "2.0.1";
3743
+ }
3744
+ }
3745
+ }
3733
3746
  function defaultConfig() {
3734
3747
  return {
3735
- server: { port: 7321, host: "localhost", version: "2.0.0" },
3748
+ server: { port: 7321, host: "localhost", version: getVersion() },
3736
3749
  database: { path: "data/nexus.db", wal_mode: true, vec_extension_path: "data/vec0" },
3737
3750
  storage: { files_dir: "data/files", max_file_size_mb: 50, backups_dir: "data/backups", backup_interval_hours: 24, max_backups: 7 },
3738
3751
  limits: { max_atoms_per_project: 1e4, rate_limit_requests: 100, rate_limit_window_ms: 6e4 },
@@ -10910,12 +10923,20 @@ function handleEvents(store, pathname, method, res, searchParams) {
10910
10923
  }
10911
10924
 
10912
10925
  // src/api/routes/health.ts
10926
+ var PKG_VERSION = (() => {
10927
+ try {
10928
+ const pkg = JSON.parse(require("fs").readFileSync(require("path").resolve(__dirname, "../../../package.json"), "utf-8"));
10929
+ return pkg.version;
10930
+ } catch {
10931
+ return "2.0.1";
10932
+ }
10933
+ })();
10913
10934
  function handleHealth(store, pathname, method, res) {
10914
- if (pathname === "/health" && method === "GET") {
10935
+ if ((pathname === "/health" || pathname === "/api/v1/health") && method === "GET") {
10915
10936
  const stats = store.getStats();
10916
10937
  json(res, 200, {
10917
10938
  status: "ok",
10918
- version: "2.0.0",
10939
+ version: PKG_VERSION,
10919
10940
  storage: "sqlite",
10920
10941
  database: store.config.database.path,
10921
10942
  uptime: process.uptime(),
@@ -12563,7 +12584,6 @@ var Store2 = class extends Store {
12563
12584
  };
12564
12585
 
12565
12586
  // src/server/MnemosyneServer.ts
12566
- init_config();
12567
12587
  var MnemosyneServer = class {
12568
12588
  store;
12569
12589
  api;
@@ -12571,8 +12591,9 @@ var MnemosyneServer = class {
12571
12591
  httpServer;
12572
12592
  brain;
12573
12593
  constructor(options = {}, brain) {
12574
- const port = options.port ?? CONFIG.server.port;
12575
- const host = options.host ?? CONFIG.server.host;
12594
+ const cfg = brain?.config?.config;
12595
+ const port = options.port ?? cfg?.server?.port ?? 7321;
12596
+ const host = options.host ?? cfg?.server?.host ?? "localhost";
12576
12597
  const enableDashboard = options.dashboard !== false;
12577
12598
  const enableWebsocket = options.websocket !== false;
12578
12599
  process.on("uncaughtException", (err) => {
@@ -12600,8 +12621,9 @@ var MnemosyneServer = class {
12600
12621
  const wss = new import_websocket_server.default({ server: this.httpServer });
12601
12622
  this.wsHandler = new WebSocketHandler(wss, this.store);
12602
12623
  }
12624
+ const version = cfg?.server?.version || "2.0.1";
12603
12625
  this.httpServer.listen(port, () => {
12604
- console.log(`Mnemosyne v${CONFIG.server.version} \u2014 port ${port}`);
12626
+ console.log(`Mnemosyne v${version} \u2014 port ${port}`);
12605
12627
  console.log(`Dashboard: http://${host}:${port}/dashboard`);
12606
12628
  console.log(`API: http://${host}:${port}/api/v1`);
12607
12629
  console.log(`MCP: http://${host}:${port}/mcp/manifest`);
@@ -12626,7 +12648,8 @@ var MnemosyneServer = class {
12626
12648
  };
12627
12649
  const dirs = [
12628
12650
  (0, import_path6.resolve)(process.cwd(), "src/dashboard"),
12629
- (0, import_path6.resolve)(process.cwd(), "dashboard")
12651
+ (0, import_path6.resolve)(process.cwd(), "dashboard"),
12652
+ (0, import_path6.resolve)(__dirname, "../dashboard")
12630
12653
  ];
12631
12654
  for (const dir of dirs) {
12632
12655
  const filePath = (0, import_path6.resolve)(dir, urlPath);