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