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.
@@ -3554,9 +3554,22 @@ function loadConfig() {
3554
3554
  return defaultConfig();
3555
3555
  }
3556
3556
  }
3557
+ function getVersion() {
3558
+ try {
3559
+ const pkg = JSON.parse(readFileSync(resolve(__dirname, "../package.json"), "utf-8"));
3560
+ return pkg.version;
3561
+ } catch {
3562
+ try {
3563
+ const pkg = JSON.parse(readFileSync(resolve(process.cwd(), "package.json"), "utf-8"));
3564
+ return pkg.version;
3565
+ } catch {
3566
+ return "2.0.1";
3567
+ }
3568
+ }
3569
+ }
3557
3570
  function defaultConfig() {
3558
3571
  return {
3559
- server: { port: 7321, host: "localhost", version: "2.0.0" },
3572
+ server: { port: 7321, host: "localhost", version: getVersion() },
3560
3573
  database: { path: "data/nexus.db", wal_mode: true, vec_extension_path: "data/vec0" },
3561
3574
  storage: { files_dir: "data/files", max_file_size_mb: 50, backups_dir: "data/backups", backup_interval_hours: 24, max_backups: 7 },
3562
3575
  limits: { max_atoms_per_project: 1e4, rate_limit_requests: 100, rate_limit_window_ms: 6e4 },
@@ -14323,9 +14336,26 @@ function parseYaml2(text) {
14323
14336
  }
14324
14337
  return root;
14325
14338
  }
14339
+ function getVersion2() {
14340
+ try {
14341
+ const { readFileSync: readFileSync7 } = __require("fs");
14342
+ const { resolve: resolve13 } = __require("path");
14343
+ const pkg = JSON.parse(readFileSync7(resolve13(__dirname, "../../package.json"), "utf-8"));
14344
+ return pkg.version;
14345
+ } catch {
14346
+ try {
14347
+ const { readFileSync: readFileSync7 } = __require("fs");
14348
+ const { resolve: resolve13 } = __require("path");
14349
+ const pkg = JSON.parse(readFileSync7(resolve13(process.cwd(), "package.json"), "utf-8"));
14350
+ return pkg.version;
14351
+ } catch {
14352
+ return "2.0.1";
14353
+ }
14354
+ }
14355
+ }
14326
14356
  function defaultConfig2() {
14327
14357
  return {
14328
- server: { port: 7321, host: "localhost", version: "2.0.0" },
14358
+ server: { port: 7321, host: "localhost", version: getVersion2() },
14329
14359
  database: { path: "data/nexus.db", wal_mode: true, vec_extension_path: "data/vec0" },
14330
14360
  storage: { files_dir: "data/files", max_file_size_mb: 50, backups_dir: "data/backups", backup_interval_hours: 24, max_backups: 7 },
14331
14361
  limits: { max_atoms_per_project: 1e4, rate_limit_requests: 100, rate_limit_window_ms: 6e4 },
@@ -14612,7 +14642,13 @@ var Mnemosyne = class {
14612
14642
  this.db.pragma("synchronous = NORMAL");
14613
14643
  this.vecEnabled = false;
14614
14644
  try {
14615
- const vecPath = resolve5(this.config.baseDirPath || process.cwd(), cfg.database.vec_extension_path);
14645
+ let vecPath;
14646
+ try {
14647
+ const sqliteVec = __require("sqlite-vec");
14648
+ vecPath = sqliteVec.getLoadablePath();
14649
+ } catch {
14650
+ vecPath = resolve5(this.config.baseDirPath || process.cwd(), cfg.database.vec_extension_path);
14651
+ }
14616
14652
  this.db.loadExtension(vecPath);
14617
14653
  this.vecEnabled = true;
14618
14654
  console.log("[DB] sqlite-vec extension loaded");
@@ -15972,12 +16008,20 @@ function handleEvents(store, pathname, method, res, searchParams) {
15972
16008
  }
15973
16009
 
15974
16010
  // src/api/routes/health.ts
16011
+ var PKG_VERSION = (() => {
16012
+ try {
16013
+ const pkg = JSON.parse(__require("fs").readFileSync(__require("path").resolve(__dirname, "../../../package.json"), "utf-8"));
16014
+ return pkg.version;
16015
+ } catch {
16016
+ return "2.0.1";
16017
+ }
16018
+ })();
15975
16019
  function handleHealth(store, pathname, method, res) {
15976
- if (pathname === "/health" && method === "GET") {
16020
+ if ((pathname === "/health" || pathname === "/api/v1/health") && method === "GET") {
15977
16021
  const stats = store.getStats();
15978
16022
  json(res, 200, {
15979
16023
  status: "ok",
15980
- version: "2.0.0",
16024
+ version: PKG_VERSION,
15981
16025
  storage: "sqlite",
15982
16026
  database: store.config.database.path,
15983
16027
  uptime: process.uptime(),
@@ -16254,7 +16298,6 @@ var Store2 = class extends Store {
16254
16298
  };
16255
16299
 
16256
16300
  // src/server/MnemosyneServer.ts
16257
- init_config();
16258
16301
  var MnemosyneServer = class {
16259
16302
  store;
16260
16303
  api;
@@ -16262,8 +16305,9 @@ var MnemosyneServer = class {
16262
16305
  httpServer;
16263
16306
  brain;
16264
16307
  constructor(options = {}, brain) {
16265
- const port = options.port ?? CONFIG.server.port;
16266
- const host = options.host ?? CONFIG.server.host;
16308
+ const cfg = brain?.config?.config;
16309
+ const port = options.port ?? cfg?.server?.port ?? 7321;
16310
+ const host = options.host ?? cfg?.server?.host ?? "localhost";
16267
16311
  const enableDashboard = options.dashboard !== false;
16268
16312
  const enableWebsocket = options.websocket !== false;
16269
16313
  process.on("uncaughtException", (err) => {
@@ -16291,8 +16335,9 @@ var MnemosyneServer = class {
16291
16335
  const wss = new import_websocket_server.default({ server: this.httpServer });
16292
16336
  this.wsHandler = new WebSocketHandler(wss, this.store);
16293
16337
  }
16338
+ const version = cfg?.server?.version || "2.0.1";
16294
16339
  this.httpServer.listen(port, () => {
16295
- console.log(`Mnemosyne v${CONFIG.server.version} \u2014 port ${port}`);
16340
+ console.log(`Mnemosyne v${version} \u2014 port ${port}`);
16296
16341
  console.log(`Dashboard: http://${host}:${port}/dashboard`);
16297
16342
  console.log(`API: http://${host}:${port}/api/v1`);
16298
16343
  console.log(`MCP: http://${host}:${port}/mcp/manifest`);
@@ -16317,7 +16362,8 @@ var MnemosyneServer = class {
16317
16362
  };
16318
16363
  const dirs = [
16319
16364
  resolve8(process.cwd(), "src/dashboard"),
16320
- resolve8(process.cwd(), "dashboard")
16365
+ resolve8(process.cwd(), "dashboard"),
16366
+ resolve8(__dirname, "../dashboard")
16321
16367
  ];
16322
16368
  for (const dir of dirs) {
16323
16369
  const filePath = resolve8(dir, urlPath);