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/index.js
CHANGED
|
@@ -116,14 +116,18 @@ function loadConfig() {
|
|
|
116
116
|
}
|
|
117
117
|
function getVersion() {
|
|
118
118
|
try {
|
|
119
|
-
const
|
|
119
|
+
const { readFileSync: readFileSync6 } = require("fs");
|
|
120
|
+
const { resolve: resolve9 } = require("path");
|
|
121
|
+
const pkg = JSON.parse(readFileSync6(resolve9(__dirname, "../package.json"), "utf-8"));
|
|
120
122
|
return pkg.version;
|
|
121
123
|
} catch {
|
|
122
124
|
try {
|
|
123
|
-
const
|
|
125
|
+
const { readFileSync: readFileSync6 } = require("fs");
|
|
126
|
+
const { resolve: resolve9 } = require("path");
|
|
127
|
+
const pkg = JSON.parse(readFileSync6(resolve9(process.cwd(), "package.json"), "utf-8"));
|
|
124
128
|
return pkg.version;
|
|
125
129
|
} catch {
|
|
126
|
-
return "2.0.
|
|
130
|
+
return "2.0.3";
|
|
127
131
|
}
|
|
128
132
|
}
|
|
129
133
|
}
|
|
@@ -152,13 +156,22 @@ function mergeDeep(target, source) {
|
|
|
152
156
|
}
|
|
153
157
|
return output;
|
|
154
158
|
}
|
|
155
|
-
|
|
159
|
+
function getConfig() {
|
|
160
|
+
if (!_config) _config = loadConfig();
|
|
161
|
+
return _config;
|
|
162
|
+
}
|
|
163
|
+
var import_fs, import_path, _config, CONFIG;
|
|
156
164
|
var init_config = __esm({
|
|
157
165
|
"src/config.ts"() {
|
|
158
166
|
"use strict";
|
|
159
167
|
import_fs = require("fs");
|
|
160
168
|
import_path = require("path");
|
|
161
|
-
|
|
169
|
+
_config = null;
|
|
170
|
+
CONFIG = new Proxy({}, {
|
|
171
|
+
get(_, prop) {
|
|
172
|
+
return getConfig()[prop];
|
|
173
|
+
}
|
|
174
|
+
});
|
|
162
175
|
}
|
|
163
176
|
});
|
|
164
177
|
|
|
@@ -240,11 +253,14 @@ var init_embedder = __esm({
|
|
|
240
253
|
});
|
|
241
254
|
|
|
242
255
|
// src/server/files.ts
|
|
256
|
+
function getFilesDir() {
|
|
257
|
+
return (0, import_path2.resolve)(process.cwd(), CONFIG.storage.files_dir);
|
|
258
|
+
}
|
|
243
259
|
function ensureDir(path) {
|
|
244
260
|
if (!(0, import_fs2.existsSync)(path)) (0, import_fs2.mkdirSync)(path, { recursive: true });
|
|
245
261
|
}
|
|
246
262
|
function hashPath(hash) {
|
|
247
|
-
return (0, import_path2.resolve)(
|
|
263
|
+
return (0, import_path2.resolve)(getFilesDir(), hash.slice(0, 2), hash.slice(2));
|
|
248
264
|
}
|
|
249
265
|
function computeHash(buffer) {
|
|
250
266
|
return (0, import_crypto.createHash)("sha256").update(buffer).digest("hex");
|
|
@@ -268,7 +284,7 @@ function getFile(hash) {
|
|
|
268
284
|
function fileExists(hash) {
|
|
269
285
|
return (0, import_fs2.existsSync)(hashPath(hash));
|
|
270
286
|
}
|
|
271
|
-
var import_crypto, import_fs2, import_path2
|
|
287
|
+
var import_crypto, import_fs2, import_path2;
|
|
272
288
|
var init_files = __esm({
|
|
273
289
|
"src/server/files.ts"() {
|
|
274
290
|
"use strict";
|
|
@@ -276,7 +292,6 @@ var init_files = __esm({
|
|
|
276
292
|
import_fs2 = require("fs");
|
|
277
293
|
import_path2 = require("path");
|
|
278
294
|
init_config();
|
|
279
|
-
FILES_DIR = (0, import_path2.resolve)(process.cwd(), CONFIG.storage.files_dir);
|
|
280
295
|
}
|
|
281
296
|
});
|
|
282
297
|
|
|
@@ -10883,7 +10898,7 @@ function getVersion2() {
|
|
|
10883
10898
|
const pkg = JSON.parse(readFileSync6(resolve9(process.cwd(), "package.json"), "utf-8"));
|
|
10884
10899
|
return pkg.version;
|
|
10885
10900
|
} catch {
|
|
10886
|
-
return "2.0.
|
|
10901
|
+
return "2.0.3";
|
|
10887
10902
|
}
|
|
10888
10903
|
}
|
|
10889
10904
|
}
|
|
@@ -11449,6 +11464,23 @@ var TOOLS = [
|
|
|
11449
11464
|
];
|
|
11450
11465
|
|
|
11451
11466
|
// src/mcp/server.ts
|
|
11467
|
+
function getVersion3() {
|
|
11468
|
+
try {
|
|
11469
|
+
const { readFileSync: readFileSync6 } = require("fs");
|
|
11470
|
+
const { resolve: resolve9 } = require("path");
|
|
11471
|
+
const pkg = JSON.parse(readFileSync6(resolve9(__dirname, "../../package.json"), "utf-8"));
|
|
11472
|
+
return pkg.version;
|
|
11473
|
+
} catch {
|
|
11474
|
+
try {
|
|
11475
|
+
const { readFileSync: readFileSync6 } = require("fs");
|
|
11476
|
+
const { resolve: resolve9 } = require("path");
|
|
11477
|
+
const pkg = JSON.parse(readFileSync6(resolve9(process.cwd(), "package.json"), "utf-8"));
|
|
11478
|
+
return pkg.version;
|
|
11479
|
+
} catch {
|
|
11480
|
+
return "2.0.3";
|
|
11481
|
+
}
|
|
11482
|
+
}
|
|
11483
|
+
}
|
|
11452
11484
|
var McpServer = class {
|
|
11453
11485
|
store;
|
|
11454
11486
|
toolMap = /* @__PURE__ */ new Map();
|
|
@@ -11469,7 +11501,7 @@ var McpServer = class {
|
|
|
11469
11501
|
return this.ok(req.id, {
|
|
11470
11502
|
protocolVersion: "2024-11-05",
|
|
11471
11503
|
capabilities: { tools: {}, resources: {}, prompts: {} },
|
|
11472
|
-
serverInfo: { name: "mnemosyne-mcp", version:
|
|
11504
|
+
serverInfo: { name: "mnemosyne-mcp", version: getVersion3() }
|
|
11473
11505
|
});
|
|
11474
11506
|
case "tools/list":
|
|
11475
11507
|
return this.ok(req.id, {
|
|
@@ -11496,7 +11528,7 @@ var McpServer = class {
|
|
|
11496
11528
|
getManifest() {
|
|
11497
11529
|
return {
|
|
11498
11530
|
name: "Mnemosyne",
|
|
11499
|
-
version:
|
|
11531
|
+
version: getVersion3(),
|
|
11500
11532
|
description: "Knowledge base MCP server for projects, atoms, blocks, and bonds.",
|
|
11501
11533
|
protocol: "mcp",
|
|
11502
11534
|
transport: ["stdio", "sse"],
|
|
@@ -12408,7 +12440,7 @@ var import_crypto2 = require("crypto");
|
|
|
12408
12440
|
var import_fs5 = require("fs");
|
|
12409
12441
|
var import_path6 = require("path");
|
|
12410
12442
|
var DB_PATH = (0, import_path6.resolve)(process.cwd(), "data", "nexus.db");
|
|
12411
|
-
var
|
|
12443
|
+
var FILES_DIR = (0, import_path6.resolve)(process.cwd(), "data", "files");
|
|
12412
12444
|
function sha256File(path) {
|
|
12413
12445
|
return (0, import_crypto2.createHash)("sha256").update((0, import_fs5.readFileSync)(path)).digest("hex");
|
|
12414
12446
|
}
|
|
@@ -12428,11 +12460,11 @@ function sha256Dir(dir) {
|
|
|
12428
12460
|
function buildMnemosyneExport(projectId, projectName) {
|
|
12429
12461
|
const zip = new import_adm_zip2.default();
|
|
12430
12462
|
zip.addLocalFile(DB_PATH, "", "nexus.db");
|
|
12431
|
-
if ((0, import_fs5.existsSync)(
|
|
12432
|
-
zip.addLocalFolder(
|
|
12463
|
+
if ((0, import_fs5.existsSync)(FILES_DIR)) {
|
|
12464
|
+
zip.addLocalFolder(FILES_DIR, "files");
|
|
12433
12465
|
}
|
|
12434
12466
|
const dbChecksum = sha256File(DB_PATH);
|
|
12435
|
-
const filesChecksum = (0, import_fs5.existsSync)(
|
|
12467
|
+
const filesChecksum = (0, import_fs5.existsSync)(FILES_DIR) ? sha256Dir(FILES_DIR) : "";
|
|
12436
12468
|
const manifest = {
|
|
12437
12469
|
version: "1.1",
|
|
12438
12470
|
app: "Mnemosyne",
|
|
@@ -12563,7 +12595,7 @@ var PKG_VERSION = (() => {
|
|
|
12563
12595
|
const pkg = JSON.parse(require("fs").readFileSync(require("path").resolve(__dirname, "../../../package.json"), "utf-8"));
|
|
12564
12596
|
return pkg.version;
|
|
12565
12597
|
} catch {
|
|
12566
|
-
return "2.0.
|
|
12598
|
+
return "2.0.3";
|
|
12567
12599
|
}
|
|
12568
12600
|
})();
|
|
12569
12601
|
function handleHealth(store, pathname, method, res) {
|
|
@@ -12835,18 +12867,20 @@ var import_path8 = require("path");
|
|
|
12835
12867
|
var import_better_sqlite33 = __toESM(require("better-sqlite3"));
|
|
12836
12868
|
var import_path7 = require("path");
|
|
12837
12869
|
init_config();
|
|
12838
|
-
|
|
12870
|
+
function getDbPath() {
|
|
12871
|
+
return process.env.MNEMOSYNE_DB_PATH || (0, import_path7.resolve)(process.cwd(), CONFIG.database.path);
|
|
12872
|
+
}
|
|
12839
12873
|
var db = null;
|
|
12840
12874
|
var vecEnabled = false;
|
|
12841
12875
|
function getDb() {
|
|
12842
12876
|
if (!db) {
|
|
12843
|
-
db = new import_better_sqlite33.default(
|
|
12877
|
+
db = new import_better_sqlite33.default(getDbPath());
|
|
12844
12878
|
db.pragma("journal_mode = WAL");
|
|
12845
12879
|
db.pragma("foreign_keys = ON");
|
|
12846
12880
|
db.pragma("synchronous = NORMAL");
|
|
12847
12881
|
try {
|
|
12848
|
-
const
|
|
12849
|
-
db.loadExtension(
|
|
12882
|
+
const { getLoadablePath } = require("sqlite-vec");
|
|
12883
|
+
db.loadExtension(getLoadablePath());
|
|
12850
12884
|
vecEnabled = true;
|
|
12851
12885
|
console.log("[DB] sqlite-vec extension loaded");
|
|
12852
12886
|
} catch (err) {
|
|
@@ -12922,7 +12956,7 @@ var MnemosyneServer = class {
|
|
|
12922
12956
|
const wss = new import_websocket_server.default({ server: this.httpServer });
|
|
12923
12957
|
this.wsHandler = new WebSocketHandler(wss, this.store);
|
|
12924
12958
|
}
|
|
12925
|
-
const version = cfg?.server?.version || "2.0.
|
|
12959
|
+
const version = cfg?.server?.version || "2.0.3";
|
|
12926
12960
|
this.httpServer.listen(port, () => {
|
|
12927
12961
|
console.log(`Mnemosyne v${version} \u2014 port ${port}`);
|
|
12928
12962
|
console.log(`Dashboard: http://${host}:${port}/dashboard`);
|