@adhdev/daemon-standalone 0.9.76-rc.12 → 0.9.76-rc.13
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.js +67 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/vendor/mcp-server/index.js +84 -19
- package/vendor/mcp-server/index.js.map +1 -1
package/dist/index.js
CHANGED
|
@@ -51216,6 +51216,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
51216
51216
|
cleanOldFiles();
|
|
51217
51217
|
var yaml = __toESM2(require_js_yaml());
|
|
51218
51218
|
init_logger();
|
|
51219
|
+
var import_node_child_process3 = require("child_process");
|
|
51219
51220
|
var import_node_fs32 = require("fs");
|
|
51220
51221
|
var import_node_module2 = require("module");
|
|
51221
51222
|
var os17 = __toESM2(require("os"));
|
|
@@ -51252,7 +51253,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
51252
51253
|
if (!mcpServer) {
|
|
51253
51254
|
return {
|
|
51254
51255
|
kind: "unsupported",
|
|
51255
|
-
reason: "Could not resolve the ADHDev MCP server entrypoint
|
|
51256
|
+
reason: "Could not resolve the ADHDev MCP server entrypoint and a Node runtime with WebSocket support for daemon IPC mode"
|
|
51256
51257
|
};
|
|
51257
51258
|
}
|
|
51258
51259
|
return {
|
|
@@ -51302,11 +51303,75 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
51302
51303
|
function resolveAdhdevMcpServerLaunch(options) {
|
|
51303
51304
|
const entryPath = resolveAdhdevMcpEntryPath(options.adhdevMcpEntryPath);
|
|
51304
51305
|
if (!entryPath) return null;
|
|
51306
|
+
const nodeExecutable = resolveMcpNodeExecutable(options.nodeExecutable);
|
|
51307
|
+
if (!nodeExecutable) return null;
|
|
51305
51308
|
return {
|
|
51306
|
-
command:
|
|
51309
|
+
command: nodeExecutable,
|
|
51307
51310
|
args: [entryPath, "--mode", "ipc", "--repo-mesh", options.meshId]
|
|
51308
51311
|
};
|
|
51309
51312
|
}
|
|
51313
|
+
function resolveMcpNodeExecutable(explicitExecutable) {
|
|
51314
|
+
const explicit = explicitExecutable?.trim();
|
|
51315
|
+
if (explicit) return explicit;
|
|
51316
|
+
const candidates = [];
|
|
51317
|
+
const addCandidate = (candidate) => {
|
|
51318
|
+
const trimmed = candidate?.trim();
|
|
51319
|
+
if (!trimmed) return;
|
|
51320
|
+
const normalized = normalizeExistingPath(trimmed) || trimmed;
|
|
51321
|
+
if (!candidates.includes(normalized)) candidates.push(normalized);
|
|
51322
|
+
};
|
|
51323
|
+
addCandidate(process.env.ADHDEV_MCP_NODE_EXECUTABLE);
|
|
51324
|
+
addCandidate(process.env.ADHDEV_NODE_EXECUTABLE);
|
|
51325
|
+
addCandidate(process.env.npm_node_execpath);
|
|
51326
|
+
addNodeCandidatesFromPath(process.env.PATH, addCandidate);
|
|
51327
|
+
addNodeCandidatesFromNvm(os17.homedir(), addCandidate);
|
|
51328
|
+
addCandidate("/opt/homebrew/bin/node");
|
|
51329
|
+
addCandidate("/usr/local/bin/node");
|
|
51330
|
+
addCandidate("/usr/bin/node");
|
|
51331
|
+
addCandidate(process.execPath);
|
|
51332
|
+
for (const candidate of candidates) {
|
|
51333
|
+
if (nodeRuntimeSupportsWebSocket(candidate)) return candidate;
|
|
51334
|
+
}
|
|
51335
|
+
return null;
|
|
51336
|
+
}
|
|
51337
|
+
function addNodeCandidatesFromPath(pathValue, addCandidate) {
|
|
51338
|
+
for (const entry of (pathValue || "").split(":")) {
|
|
51339
|
+
const dir = entry.trim();
|
|
51340
|
+
if (!dir) continue;
|
|
51341
|
+
addCandidate((0, import_node_path2.join)(dir, "node"));
|
|
51342
|
+
}
|
|
51343
|
+
}
|
|
51344
|
+
function addNodeCandidatesFromNvm(homeDir, addCandidate) {
|
|
51345
|
+
const versionsDir = (0, import_node_path2.join)(homeDir, ".nvm", "versions", "node");
|
|
51346
|
+
try {
|
|
51347
|
+
const versionDirs = (0, import_node_fs32.readdirSync)(versionsDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort(compareNodeVersionNamesDescending);
|
|
51348
|
+
for (const versionDir of versionDirs) {
|
|
51349
|
+
addCandidate((0, import_node_path2.join)(versionsDir, versionDir, "bin", "node"));
|
|
51350
|
+
}
|
|
51351
|
+
} catch {
|
|
51352
|
+
}
|
|
51353
|
+
}
|
|
51354
|
+
function compareNodeVersionNamesDescending(a, b2) {
|
|
51355
|
+
const parse3 = (value) => value.replace(/^v/, "").split(".").map((part) => Number.parseInt(part, 10) || 0);
|
|
51356
|
+
const left = parse3(a);
|
|
51357
|
+
const right = parse3(b2);
|
|
51358
|
+
for (let i = 0; i < Math.max(left.length, right.length); i++) {
|
|
51359
|
+
const diff = (right[i] || 0) - (left[i] || 0);
|
|
51360
|
+
if (diff !== 0) return diff;
|
|
51361
|
+
}
|
|
51362
|
+
return b2.localeCompare(a);
|
|
51363
|
+
}
|
|
51364
|
+
function nodeRuntimeSupportsWebSocket(nodeExecutable) {
|
|
51365
|
+
try {
|
|
51366
|
+
(0, import_node_child_process3.execFileSync)(nodeExecutable, ["-e", "process.exit(typeof WebSocket === 'function' ? 0 : 42)"], {
|
|
51367
|
+
stdio: "ignore",
|
|
51368
|
+
timeout: 3e3
|
|
51369
|
+
});
|
|
51370
|
+
return true;
|
|
51371
|
+
} catch {
|
|
51372
|
+
return false;
|
|
51373
|
+
}
|
|
51374
|
+
}
|
|
51310
51375
|
function resolveAdhdevMcpEntryPath(explicitPath) {
|
|
51311
51376
|
const explicit = explicitPath?.trim();
|
|
51312
51377
|
if (explicit) return normalizeExistingPath(explicit) || explicit;
|