mnemosyne-core 2.0.1 → 2.0.3
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 +198 -28
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +197 -28
- package/dist/cli/index.mjs.map +1 -1
- package/dist/dashboard/index.html +9401 -0
- package/dist/index.js +105 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +104 -25
- package/dist/index.mjs.map +1 -1
- package/dist/mcp/index.js +19 -2
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/index.mjs +26 -2
- package/dist/mcp/index.mjs.map +1 -1
- package/dist/server/api.js +66 -13
- package/dist/server/api.js.map +1 -1
- package/dist/server/api.mjs +72 -13
- package/dist/server/api.mjs.map +1 -1
- package/dist/server/index.js +80 -23
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +79 -23
- package/dist/server/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/server/api.mjs
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
4
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
5
|
+
}) : x)(function(x) {
|
|
6
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
7
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
8
|
+
});
|
|
3
9
|
var __esm = (fn, res) => function __init() {
|
|
4
10
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
5
11
|
};
|
|
@@ -86,9 +92,26 @@ function loadConfig() {
|
|
|
86
92
|
return defaultConfig();
|
|
87
93
|
}
|
|
88
94
|
}
|
|
95
|
+
function getVersion2() {
|
|
96
|
+
try {
|
|
97
|
+
const { readFileSync: readFileSync4 } = __require("fs");
|
|
98
|
+
const { resolve: resolve4 } = __require("path");
|
|
99
|
+
const pkg = JSON.parse(readFileSync4(resolve4(__dirname, "../package.json"), "utf-8"));
|
|
100
|
+
return pkg.version;
|
|
101
|
+
} catch {
|
|
102
|
+
try {
|
|
103
|
+
const { readFileSync: readFileSync4 } = __require("fs");
|
|
104
|
+
const { resolve: resolve4 } = __require("path");
|
|
105
|
+
const pkg = JSON.parse(readFileSync4(resolve4(process.cwd(), "package.json"), "utf-8"));
|
|
106
|
+
return pkg.version;
|
|
107
|
+
} catch {
|
|
108
|
+
return "2.0.3";
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
89
112
|
function defaultConfig() {
|
|
90
113
|
return {
|
|
91
|
-
server: { port: 7321, host: "localhost", version:
|
|
114
|
+
server: { port: 7321, host: "localhost", version: getVersion2() },
|
|
92
115
|
database: { path: "data/nexus.db", wal_mode: true, vec_extension_path: "data/vec0" },
|
|
93
116
|
storage: { files_dir: "data/files", max_file_size_mb: 50, backups_dir: "data/backups", backup_interval_hours: 24, max_backups: 7 },
|
|
94
117
|
limits: { max_atoms_per_project: 1e4, rate_limit_requests: 100, rate_limit_window_ms: 6e4 },
|
|
@@ -111,11 +134,20 @@ function mergeDeep(target, source) {
|
|
|
111
134
|
}
|
|
112
135
|
return output;
|
|
113
136
|
}
|
|
114
|
-
|
|
137
|
+
function getConfig() {
|
|
138
|
+
if (!_config) _config = loadConfig();
|
|
139
|
+
return _config;
|
|
140
|
+
}
|
|
141
|
+
var _config, CONFIG;
|
|
115
142
|
var init_config = __esm({
|
|
116
143
|
"src/config.ts"() {
|
|
117
144
|
"use strict";
|
|
118
|
-
|
|
145
|
+
_config = null;
|
|
146
|
+
CONFIG = new Proxy({}, {
|
|
147
|
+
get(_, prop) {
|
|
148
|
+
return getConfig()[prop];
|
|
149
|
+
}
|
|
150
|
+
});
|
|
119
151
|
}
|
|
120
152
|
});
|
|
121
153
|
|
|
@@ -413,6 +445,23 @@ var TOOLS = [
|
|
|
413
445
|
];
|
|
414
446
|
|
|
415
447
|
// src/mcp/server.ts
|
|
448
|
+
function getVersion() {
|
|
449
|
+
try {
|
|
450
|
+
const { readFileSync: readFileSync4 } = __require("fs");
|
|
451
|
+
const { resolve: resolve4 } = __require("path");
|
|
452
|
+
const pkg = JSON.parse(readFileSync4(resolve4(__dirname, "../../package.json"), "utf-8"));
|
|
453
|
+
return pkg.version;
|
|
454
|
+
} catch {
|
|
455
|
+
try {
|
|
456
|
+
const { readFileSync: readFileSync4 } = __require("fs");
|
|
457
|
+
const { resolve: resolve4 } = __require("path");
|
|
458
|
+
const pkg = JSON.parse(readFileSync4(resolve4(process.cwd(), "package.json"), "utf-8"));
|
|
459
|
+
return pkg.version;
|
|
460
|
+
} catch {
|
|
461
|
+
return "2.0.3";
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
}
|
|
416
465
|
var McpServer = class {
|
|
417
466
|
store;
|
|
418
467
|
toolMap = /* @__PURE__ */ new Map();
|
|
@@ -433,7 +482,7 @@ var McpServer = class {
|
|
|
433
482
|
return this.ok(req.id, {
|
|
434
483
|
protocolVersion: "2024-11-05",
|
|
435
484
|
capabilities: { tools: {}, resources: {}, prompts: {} },
|
|
436
|
-
serverInfo: { name: "mnemosyne-mcp", version:
|
|
485
|
+
serverInfo: { name: "mnemosyne-mcp", version: getVersion() }
|
|
437
486
|
});
|
|
438
487
|
case "tools/list":
|
|
439
488
|
return this.ok(req.id, {
|
|
@@ -460,7 +509,7 @@ var McpServer = class {
|
|
|
460
509
|
getManifest() {
|
|
461
510
|
return {
|
|
462
511
|
name: "Mnemosyne",
|
|
463
|
-
version:
|
|
512
|
+
version: getVersion(),
|
|
464
513
|
description: "Knowledge base MCP server for projects, atoms, blocks, and bonds.",
|
|
465
514
|
protocol: "mcp",
|
|
466
515
|
transport: ["stdio", "sse"],
|
|
@@ -1294,12 +1343,14 @@ init_config();
|
|
|
1294
1343
|
import { createHash } from "crypto";
|
|
1295
1344
|
import { mkdirSync, existsSync as existsSync2, writeFileSync, readFileSync as readFileSync2 } from "fs";
|
|
1296
1345
|
import { resolve as resolve2, dirname } from "path";
|
|
1297
|
-
|
|
1346
|
+
function getFilesDir() {
|
|
1347
|
+
return resolve2(process.cwd(), CONFIG.storage.files_dir);
|
|
1348
|
+
}
|
|
1298
1349
|
function ensureDir(path) {
|
|
1299
1350
|
if (!existsSync2(path)) mkdirSync(path, { recursive: true });
|
|
1300
1351
|
}
|
|
1301
1352
|
function hashPath(hash) {
|
|
1302
|
-
return resolve2(
|
|
1353
|
+
return resolve2(getFilesDir(), hash.slice(0, 2), hash.slice(2));
|
|
1303
1354
|
}
|
|
1304
1355
|
function computeHash(buffer) {
|
|
1305
1356
|
return createHash("sha256").update(buffer).digest("hex");
|
|
@@ -1369,7 +1420,7 @@ import { createHash as createHash2 } from "crypto";
|
|
|
1369
1420
|
import { readFileSync as readFileSync3, existsSync as existsSync3, readdirSync, statSync } from "fs";
|
|
1370
1421
|
import { resolve as resolve3 } from "path";
|
|
1371
1422
|
var DB_PATH = resolve3(process.cwd(), "data", "nexus.db");
|
|
1372
|
-
var
|
|
1423
|
+
var FILES_DIR = resolve3(process.cwd(), "data", "files");
|
|
1373
1424
|
function sha256File(path) {
|
|
1374
1425
|
return createHash2("sha256").update(readFileSync3(path)).digest("hex");
|
|
1375
1426
|
}
|
|
@@ -1389,11 +1440,11 @@ function sha256Dir(dir) {
|
|
|
1389
1440
|
function buildMnemosyneExport(projectId, projectName) {
|
|
1390
1441
|
const zip = new AdmZip();
|
|
1391
1442
|
zip.addLocalFile(DB_PATH, "", "nexus.db");
|
|
1392
|
-
if (existsSync3(
|
|
1393
|
-
zip.addLocalFolder(
|
|
1443
|
+
if (existsSync3(FILES_DIR)) {
|
|
1444
|
+
zip.addLocalFolder(FILES_DIR, "files");
|
|
1394
1445
|
}
|
|
1395
1446
|
const dbChecksum = sha256File(DB_PATH);
|
|
1396
|
-
const filesChecksum = existsSync3(
|
|
1447
|
+
const filesChecksum = existsSync3(FILES_DIR) ? sha256Dir(FILES_DIR) : "";
|
|
1397
1448
|
const manifest = {
|
|
1398
1449
|
version: "1.1",
|
|
1399
1450
|
app: "Mnemosyne",
|
|
@@ -1519,12 +1570,20 @@ function handleEvents(store, pathname, method, res, searchParams) {
|
|
|
1519
1570
|
}
|
|
1520
1571
|
|
|
1521
1572
|
// src/api/routes/health.ts
|
|
1573
|
+
var PKG_VERSION = (() => {
|
|
1574
|
+
try {
|
|
1575
|
+
const pkg = JSON.parse(__require("fs").readFileSync(__require("path").resolve(__dirname, "../../../package.json"), "utf-8"));
|
|
1576
|
+
return pkg.version;
|
|
1577
|
+
} catch {
|
|
1578
|
+
return "2.0.3";
|
|
1579
|
+
}
|
|
1580
|
+
})();
|
|
1522
1581
|
function handleHealth(store, pathname, method, res) {
|
|
1523
|
-
if (pathname === "/health" && method === "GET") {
|
|
1582
|
+
if ((pathname === "/health" || pathname === "/api/v1/health") && method === "GET") {
|
|
1524
1583
|
const stats = store.getStats();
|
|
1525
1584
|
json(res, 200, {
|
|
1526
1585
|
status: "ok",
|
|
1527
|
-
version:
|
|
1586
|
+
version: PKG_VERSION,
|
|
1528
1587
|
storage: "sqlite",
|
|
1529
1588
|
database: store.config.database.path,
|
|
1530
1589
|
uptime: process.uptime(),
|