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.mjs CHANGED
@@ -120,9 +120,22 @@ function loadConfig() {
120
120
  return defaultConfig();
121
121
  }
122
122
  }
123
+ function getVersion() {
124
+ try {
125
+ const pkg = JSON.parse(readFileSync(resolve(__dirname, "../package.json"), "utf-8"));
126
+ return pkg.version;
127
+ } catch {
128
+ try {
129
+ const pkg = JSON.parse(readFileSync(resolve(process.cwd(), "package.json"), "utf-8"));
130
+ return pkg.version;
131
+ } catch {
132
+ return "2.0.1";
133
+ }
134
+ }
135
+ }
123
136
  function defaultConfig() {
124
137
  return {
125
- server: { port: 7321, host: "localhost", version: "2.0.0" },
138
+ server: { port: 7321, host: "localhost", version: getVersion() },
126
139
  database: { path: "data/nexus.db", wal_mode: true, vec_extension_path: "data/vec0" },
127
140
  storage: { files_dir: "data/files", max_file_size_mb: 50, backups_dir: "data/backups", backup_interval_hours: 24, max_backups: 7 },
128
141
  limits: { max_atoms_per_project: 1e4, rate_limit_requests: 100, rate_limit_window_ms: 6e4 },
@@ -10828,9 +10841,26 @@ function parseYaml2(text) {
10828
10841
  }
10829
10842
  return root;
10830
10843
  }
10844
+ function getVersion2() {
10845
+ try {
10846
+ const { readFileSync: readFileSync6 } = __require("fs");
10847
+ const { resolve: resolve9 } = __require("path");
10848
+ const pkg = JSON.parse(readFileSync6(resolve9(__dirname, "../../package.json"), "utf-8"));
10849
+ return pkg.version;
10850
+ } catch {
10851
+ try {
10852
+ const { readFileSync: readFileSync6 } = __require("fs");
10853
+ const { resolve: resolve9 } = __require("path");
10854
+ const pkg = JSON.parse(readFileSync6(resolve9(process.cwd(), "package.json"), "utf-8"));
10855
+ return pkg.version;
10856
+ } catch {
10857
+ return "2.0.1";
10858
+ }
10859
+ }
10860
+ }
10831
10861
  function defaultConfig2() {
10832
10862
  return {
10833
- server: { port: 7321, host: "localhost", version: "2.0.0" },
10863
+ server: { port: 7321, host: "localhost", version: getVersion2() },
10834
10864
  database: { path: "data/nexus.db", wal_mode: true, vec_extension_path: "data/vec0" },
10835
10865
  storage: { files_dir: "data/files", max_file_size_mb: 50, backups_dir: "data/backups", backup_interval_hours: 24, max_backups: 7 },
10836
10866
  limits: { max_atoms_per_project: 1e4, rate_limit_requests: 100, rate_limit_window_ms: 6e4 },
@@ -11117,7 +11147,13 @@ var Mnemosyne = class {
11117
11147
  this.db.pragma("synchronous = NORMAL");
11118
11148
  this.vecEnabled = false;
11119
11149
  try {
11120
- const vecPath = resolve5(this.config.baseDirPath || process.cwd(), cfg.database.vec_extension_path);
11150
+ let vecPath;
11151
+ try {
11152
+ const sqliteVec = __require("sqlite-vec");
11153
+ vecPath = sqliteVec.getLoadablePath();
11154
+ } catch {
11155
+ vecPath = resolve5(this.config.baseDirPath || process.cwd(), cfg.database.vec_extension_path);
11156
+ }
11121
11157
  this.db.loadExtension(vecPath);
11122
11158
  this.vecEnabled = true;
11123
11159
  console.log("[DB] sqlite-vec extension loaded");
@@ -12493,12 +12529,20 @@ function handleEvents(store, pathname, method, res, searchParams) {
12493
12529
  }
12494
12530
 
12495
12531
  // src/api/routes/health.ts
12532
+ var PKG_VERSION = (() => {
12533
+ try {
12534
+ const pkg = JSON.parse(__require("fs").readFileSync(__require("path").resolve(__dirname, "../../../package.json"), "utf-8"));
12535
+ return pkg.version;
12536
+ } catch {
12537
+ return "2.0.1";
12538
+ }
12539
+ })();
12496
12540
  function handleHealth(store, pathname, method, res) {
12497
- if (pathname === "/health" && method === "GET") {
12541
+ if ((pathname === "/health" || pathname === "/api/v1/health") && method === "GET") {
12498
12542
  const stats = store.getStats();
12499
12543
  json(res, 200, {
12500
12544
  status: "ok",
12501
- version: "2.0.0",
12545
+ version: PKG_VERSION,
12502
12546
  storage: "sqlite",
12503
12547
  database: store.config.database.path,
12504
12548
  uptime: process.uptime(),
@@ -12812,7 +12856,6 @@ var Store2 = class extends Store {
12812
12856
  };
12813
12857
 
12814
12858
  // src/server/MnemosyneServer.ts
12815
- init_config();
12816
12859
  var MnemosyneServer = class {
12817
12860
  store;
12818
12861
  api;
@@ -12820,8 +12863,9 @@ var MnemosyneServer = class {
12820
12863
  httpServer;
12821
12864
  brain;
12822
12865
  constructor(options = {}, brain) {
12823
- const port = options.port ?? CONFIG.server.port;
12824
- const host = options.host ?? CONFIG.server.host;
12866
+ const cfg = brain?.config?.config;
12867
+ const port = options.port ?? cfg?.server?.port ?? 7321;
12868
+ const host = options.host ?? cfg?.server?.host ?? "localhost";
12825
12869
  const enableDashboard = options.dashboard !== false;
12826
12870
  const enableWebsocket = options.websocket !== false;
12827
12871
  process.on("uncaughtException", (err) => {
@@ -12849,8 +12893,9 @@ var MnemosyneServer = class {
12849
12893
  const wss = new import_websocket_server.default({ server: this.httpServer });
12850
12894
  this.wsHandler = new WebSocketHandler(wss, this.store);
12851
12895
  }
12896
+ const version = cfg?.server?.version || "2.0.1";
12852
12897
  this.httpServer.listen(port, () => {
12853
- console.log(`Mnemosyne v${CONFIG.server.version} \u2014 port ${port}`);
12898
+ console.log(`Mnemosyne v${version} \u2014 port ${port}`);
12854
12899
  console.log(`Dashboard: http://${host}:${port}/dashboard`);
12855
12900
  console.log(`API: http://${host}:${port}/api/v1`);
12856
12901
  console.log(`MCP: http://${host}:${port}/mcp/manifest`);
@@ -12875,7 +12920,8 @@ var MnemosyneServer = class {
12875
12920
  };
12876
12921
  const dirs = [
12877
12922
  resolve8(process.cwd(), "src/dashboard"),
12878
- resolve8(process.cwd(), "dashboard")
12923
+ resolve8(process.cwd(), "dashboard"),
12924
+ resolve8(__dirname, "../dashboard")
12879
12925
  ];
12880
12926
  for (const dir of dirs) {
12881
12927
  const filePath = resolve8(dir, urlPath);