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/cli/index.js CHANGED
@@ -3548,9 +3548,22 @@ function loadConfig() {
3548
3548
  return defaultConfig();
3549
3549
  }
3550
3550
  }
3551
+ function getVersion() {
3552
+ try {
3553
+ const pkg = JSON.parse((0, import_fs.readFileSync)((0, import_path.resolve)(__dirname, "../package.json"), "utf-8"));
3554
+ return pkg.version;
3555
+ } catch {
3556
+ try {
3557
+ const pkg = JSON.parse((0, import_fs.readFileSync)((0, import_path.resolve)(process.cwd(), "package.json"), "utf-8"));
3558
+ return pkg.version;
3559
+ } catch {
3560
+ return "2.0.1";
3561
+ }
3562
+ }
3563
+ }
3551
3564
  function defaultConfig() {
3552
3565
  return {
3553
- server: { port: 7321, host: "localhost", version: "2.0.0" },
3566
+ server: { port: 7321, host: "localhost", version: getVersion() },
3554
3567
  database: { path: "data/nexus.db", wal_mode: true, vec_extension_path: "data/vec0" },
3555
3568
  storage: { files_dir: "data/files", max_file_size_mb: 50, backups_dir: "data/backups", backup_interval_hours: 24, max_backups: 7 },
3556
3569
  limits: { max_atoms_per_project: 1e4, rate_limit_requests: 100, rate_limit_window_ms: 6e4 },
@@ -14326,9 +14339,26 @@ function parseYaml2(text) {
14326
14339
  }
14327
14340
  return root;
14328
14341
  }
14342
+ function getVersion2() {
14343
+ try {
14344
+ const { readFileSync: readFileSync7 } = require("fs");
14345
+ const { resolve: resolve13 } = require("path");
14346
+ const pkg = JSON.parse(readFileSync7(resolve13(__dirname, "../../package.json"), "utf-8"));
14347
+ return pkg.version;
14348
+ } catch {
14349
+ try {
14350
+ const { readFileSync: readFileSync7 } = require("fs");
14351
+ const { resolve: resolve13 } = require("path");
14352
+ const pkg = JSON.parse(readFileSync7(resolve13(process.cwd(), "package.json"), "utf-8"));
14353
+ return pkg.version;
14354
+ } catch {
14355
+ return "2.0.1";
14356
+ }
14357
+ }
14358
+ }
14329
14359
  function defaultConfig2() {
14330
14360
  return {
14331
- server: { port: 7321, host: "localhost", version: "2.0.0" },
14361
+ server: { port: 7321, host: "localhost", version: getVersion2() },
14332
14362
  database: { path: "data/nexus.db", wal_mode: true, vec_extension_path: "data/vec0" },
14333
14363
  storage: { files_dir: "data/files", max_file_size_mb: 50, backups_dir: "data/backups", backup_interval_hours: 24, max_backups: 7 },
14334
14364
  limits: { max_atoms_per_project: 1e4, rate_limit_requests: 100, rate_limit_window_ms: 6e4 },
@@ -14615,7 +14645,13 @@ var Mnemosyne = class {
14615
14645
  this.db.pragma("synchronous = NORMAL");
14616
14646
  this.vecEnabled = false;
14617
14647
  try {
14618
- const vecPath = (0, import_path5.resolve)(this.config.baseDirPath || process.cwd(), cfg.database.vec_extension_path);
14648
+ let vecPath;
14649
+ try {
14650
+ const sqliteVec = require("sqlite-vec");
14651
+ vecPath = sqliteVec.getLoadablePath();
14652
+ } catch {
14653
+ vecPath = (0, import_path5.resolve)(this.config.baseDirPath || process.cwd(), cfg.database.vec_extension_path);
14654
+ }
14619
14655
  this.db.loadExtension(vecPath);
14620
14656
  this.vecEnabled = true;
14621
14657
  console.log("[DB] sqlite-vec extension loaded");
@@ -15975,12 +16011,20 @@ function handleEvents(store, pathname, method, res, searchParams) {
15975
16011
  }
15976
16012
 
15977
16013
  // src/api/routes/health.ts
16014
+ var PKG_VERSION = (() => {
16015
+ try {
16016
+ const pkg = JSON.parse(require("fs").readFileSync(require("path").resolve(__dirname, "../../../package.json"), "utf-8"));
16017
+ return pkg.version;
16018
+ } catch {
16019
+ return "2.0.1";
16020
+ }
16021
+ })();
15978
16022
  function handleHealth(store, pathname, method, res) {
15979
- if (pathname === "/health" && method === "GET") {
16023
+ if ((pathname === "/health" || pathname === "/api/v1/health") && method === "GET") {
15980
16024
  const stats = store.getStats();
15981
16025
  json(res, 200, {
15982
16026
  status: "ok",
15983
- version: "2.0.0",
16027
+ version: PKG_VERSION,
15984
16028
  storage: "sqlite",
15985
16029
  database: store.config.database.path,
15986
16030
  uptime: process.uptime(),
@@ -16257,7 +16301,6 @@ var Store2 = class extends Store {
16257
16301
  };
16258
16302
 
16259
16303
  // src/server/MnemosyneServer.ts
16260
- init_config();
16261
16304
  var MnemosyneServer = class {
16262
16305
  store;
16263
16306
  api;
@@ -16265,8 +16308,9 @@ var MnemosyneServer = class {
16265
16308
  httpServer;
16266
16309
  brain;
16267
16310
  constructor(options = {}, brain) {
16268
- const port = options.port ?? CONFIG.server.port;
16269
- const host = options.host ?? CONFIG.server.host;
16311
+ const cfg = brain?.config?.config;
16312
+ const port = options.port ?? cfg?.server?.port ?? 7321;
16313
+ const host = options.host ?? cfg?.server?.host ?? "localhost";
16270
16314
  const enableDashboard = options.dashboard !== false;
16271
16315
  const enableWebsocket = options.websocket !== false;
16272
16316
  process.on("uncaughtException", (err) => {
@@ -16294,8 +16338,9 @@ var MnemosyneServer = class {
16294
16338
  const wss = new import_websocket_server.default({ server: this.httpServer });
16295
16339
  this.wsHandler = new WebSocketHandler(wss, this.store);
16296
16340
  }
16341
+ const version = cfg?.server?.version || "2.0.1";
16297
16342
  this.httpServer.listen(port, () => {
16298
- console.log(`Mnemosyne v${CONFIG.server.version} \u2014 port ${port}`);
16343
+ console.log(`Mnemosyne v${version} \u2014 port ${port}`);
16299
16344
  console.log(`Dashboard: http://${host}:${port}/dashboard`);
16300
16345
  console.log(`API: http://${host}:${port}/api/v1`);
16301
16346
  console.log(`MCP: http://${host}:${port}/mcp/manifest`);
@@ -16320,7 +16365,8 @@ var MnemosyneServer = class {
16320
16365
  };
16321
16366
  const dirs = [
16322
16367
  (0, import_path8.resolve)(process.cwd(), "src/dashboard"),
16323
- (0, import_path8.resolve)(process.cwd(), "dashboard")
16368
+ (0, import_path8.resolve)(process.cwd(), "dashboard"),
16369
+ (0, import_path8.resolve)(__dirname, "../dashboard")
16324
16370
  ];
16325
16371
  for (const dir of dirs) {
16326
16372
  const filePath = (0, import_path8.resolve)(dir, urlPath);