mnemosyne-core 2.0.2 → 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 +148 -24
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +147 -24
- package/dist/cli/index.mjs.map +1 -1
- package/dist/index.js +55 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +54 -21
- 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 +48 -16
- package/dist/server/api.js.map +1 -1
- package/dist/server/api.mjs +48 -16
- package/dist/server/api.mjs.map +1 -1
- package/dist/server/index.js +56 -22
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +55 -22
- package/dist/server/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/server/api.mjs
CHANGED
|
@@ -92,22 +92,26 @@ function loadConfig() {
|
|
|
92
92
|
return defaultConfig();
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
|
-
function
|
|
95
|
+
function getVersion2() {
|
|
96
96
|
try {
|
|
97
|
-
const
|
|
97
|
+
const { readFileSync: readFileSync4 } = __require("fs");
|
|
98
|
+
const { resolve: resolve4 } = __require("path");
|
|
99
|
+
const pkg = JSON.parse(readFileSync4(resolve4(__dirname, "../package.json"), "utf-8"));
|
|
98
100
|
return pkg.version;
|
|
99
101
|
} catch {
|
|
100
102
|
try {
|
|
101
|
-
const
|
|
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"));
|
|
102
106
|
return pkg.version;
|
|
103
107
|
} catch {
|
|
104
|
-
return "2.0.
|
|
108
|
+
return "2.0.3";
|
|
105
109
|
}
|
|
106
110
|
}
|
|
107
111
|
}
|
|
108
112
|
function defaultConfig() {
|
|
109
113
|
return {
|
|
110
|
-
server: { port: 7321, host: "localhost", version:
|
|
114
|
+
server: { port: 7321, host: "localhost", version: getVersion2() },
|
|
111
115
|
database: { path: "data/nexus.db", wal_mode: true, vec_extension_path: "data/vec0" },
|
|
112
116
|
storage: { files_dir: "data/files", max_file_size_mb: 50, backups_dir: "data/backups", backup_interval_hours: 24, max_backups: 7 },
|
|
113
117
|
limits: { max_atoms_per_project: 1e4, rate_limit_requests: 100, rate_limit_window_ms: 6e4 },
|
|
@@ -130,11 +134,20 @@ function mergeDeep(target, source) {
|
|
|
130
134
|
}
|
|
131
135
|
return output;
|
|
132
136
|
}
|
|
133
|
-
|
|
137
|
+
function getConfig() {
|
|
138
|
+
if (!_config) _config = loadConfig();
|
|
139
|
+
return _config;
|
|
140
|
+
}
|
|
141
|
+
var _config, CONFIG;
|
|
134
142
|
var init_config = __esm({
|
|
135
143
|
"src/config.ts"() {
|
|
136
144
|
"use strict";
|
|
137
|
-
|
|
145
|
+
_config = null;
|
|
146
|
+
CONFIG = new Proxy({}, {
|
|
147
|
+
get(_, prop) {
|
|
148
|
+
return getConfig()[prop];
|
|
149
|
+
}
|
|
150
|
+
});
|
|
138
151
|
}
|
|
139
152
|
});
|
|
140
153
|
|
|
@@ -432,6 +445,23 @@ var TOOLS = [
|
|
|
432
445
|
];
|
|
433
446
|
|
|
434
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
|
+
}
|
|
435
465
|
var McpServer = class {
|
|
436
466
|
store;
|
|
437
467
|
toolMap = /* @__PURE__ */ new Map();
|
|
@@ -452,7 +482,7 @@ var McpServer = class {
|
|
|
452
482
|
return this.ok(req.id, {
|
|
453
483
|
protocolVersion: "2024-11-05",
|
|
454
484
|
capabilities: { tools: {}, resources: {}, prompts: {} },
|
|
455
|
-
serverInfo: { name: "mnemosyne-mcp", version:
|
|
485
|
+
serverInfo: { name: "mnemosyne-mcp", version: getVersion() }
|
|
456
486
|
});
|
|
457
487
|
case "tools/list":
|
|
458
488
|
return this.ok(req.id, {
|
|
@@ -479,7 +509,7 @@ var McpServer = class {
|
|
|
479
509
|
getManifest() {
|
|
480
510
|
return {
|
|
481
511
|
name: "Mnemosyne",
|
|
482
|
-
version:
|
|
512
|
+
version: getVersion(),
|
|
483
513
|
description: "Knowledge base MCP server for projects, atoms, blocks, and bonds.",
|
|
484
514
|
protocol: "mcp",
|
|
485
515
|
transport: ["stdio", "sse"],
|
|
@@ -1313,12 +1343,14 @@ init_config();
|
|
|
1313
1343
|
import { createHash } from "crypto";
|
|
1314
1344
|
import { mkdirSync, existsSync as existsSync2, writeFileSync, readFileSync as readFileSync2 } from "fs";
|
|
1315
1345
|
import { resolve as resolve2, dirname } from "path";
|
|
1316
|
-
|
|
1346
|
+
function getFilesDir() {
|
|
1347
|
+
return resolve2(process.cwd(), CONFIG.storage.files_dir);
|
|
1348
|
+
}
|
|
1317
1349
|
function ensureDir(path) {
|
|
1318
1350
|
if (!existsSync2(path)) mkdirSync(path, { recursive: true });
|
|
1319
1351
|
}
|
|
1320
1352
|
function hashPath(hash) {
|
|
1321
|
-
return resolve2(
|
|
1353
|
+
return resolve2(getFilesDir(), hash.slice(0, 2), hash.slice(2));
|
|
1322
1354
|
}
|
|
1323
1355
|
function computeHash(buffer) {
|
|
1324
1356
|
return createHash("sha256").update(buffer).digest("hex");
|
|
@@ -1388,7 +1420,7 @@ import { createHash as createHash2 } from "crypto";
|
|
|
1388
1420
|
import { readFileSync as readFileSync3, existsSync as existsSync3, readdirSync, statSync } from "fs";
|
|
1389
1421
|
import { resolve as resolve3 } from "path";
|
|
1390
1422
|
var DB_PATH = resolve3(process.cwd(), "data", "nexus.db");
|
|
1391
|
-
var
|
|
1423
|
+
var FILES_DIR = resolve3(process.cwd(), "data", "files");
|
|
1392
1424
|
function sha256File(path) {
|
|
1393
1425
|
return createHash2("sha256").update(readFileSync3(path)).digest("hex");
|
|
1394
1426
|
}
|
|
@@ -1408,11 +1440,11 @@ function sha256Dir(dir) {
|
|
|
1408
1440
|
function buildMnemosyneExport(projectId, projectName) {
|
|
1409
1441
|
const zip = new AdmZip();
|
|
1410
1442
|
zip.addLocalFile(DB_PATH, "", "nexus.db");
|
|
1411
|
-
if (existsSync3(
|
|
1412
|
-
zip.addLocalFolder(
|
|
1443
|
+
if (existsSync3(FILES_DIR)) {
|
|
1444
|
+
zip.addLocalFolder(FILES_DIR, "files");
|
|
1413
1445
|
}
|
|
1414
1446
|
const dbChecksum = sha256File(DB_PATH);
|
|
1415
|
-
const filesChecksum = existsSync3(
|
|
1447
|
+
const filesChecksum = existsSync3(FILES_DIR) ? sha256Dir(FILES_DIR) : "";
|
|
1416
1448
|
const manifest = {
|
|
1417
1449
|
version: "1.1",
|
|
1418
1450
|
app: "Mnemosyne",
|
|
@@ -1543,7 +1575,7 @@ var PKG_VERSION = (() => {
|
|
|
1543
1575
|
const pkg = JSON.parse(__require("fs").readFileSync(__require("path").resolve(__dirname, "../../../package.json"), "utf-8"));
|
|
1544
1576
|
return pkg.version;
|
|
1545
1577
|
} catch {
|
|
1546
|
-
return "2.0.
|
|
1578
|
+
return "2.0.3";
|
|
1547
1579
|
}
|
|
1548
1580
|
})();
|
|
1549
1581
|
function handleHealth(store, pathname, method, res) {
|