@adhdev/daemon-standalone 0.9.77-rc.2 → 0.9.77-rc.21
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 +137 -19
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/public/assets/{index-6WEc6L46.js → index-CWWeDAva.js} +2 -2
- package/public/assets/{terminal-BeBmUW3m.js → terminal-B-dmfv31.js} +11 -11
- package/public/index.html +1 -1
- package/vendor/mcp-server/index.js +164 -29
- package/vendor/mcp-server/index.js.map +1 -1
package/public/index.html
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<meta name="description" content="ADHDev self-hosted dashboard for controlling AI agents" />
|
|
8
8
|
<link rel="icon" href="/otter-logo.png" />
|
|
9
9
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap" rel="stylesheet" />
|
|
10
|
-
<script type="module" crossorigin src="/assets/index-
|
|
10
|
+
<script type="module" crossorigin src="/assets/index-CWWeDAva.js"></script>
|
|
11
11
|
<link rel="modulepreload" crossorigin href="/assets/vendor-CLec0455.js">
|
|
12
12
|
<link rel="stylesheet" crossorigin href="/assets/index-DftJ2WZr.css">
|
|
13
13
|
</head>
|
|
@@ -26258,13 +26258,15 @@ function formatCompletionMetadata(event) {
|
|
|
26258
26258
|
}
|
|
26259
26259
|
function tryAssignQueueTask(components, meshId, nodeId, sessionId, providerType) {
|
|
26260
26260
|
const task = claimNextTask(meshId, nodeId, sessionId);
|
|
26261
|
-
if (!task)
|
|
26261
|
+
if (!task) {
|
|
26262
|
+
return false;
|
|
26263
|
+
}
|
|
26262
26264
|
LOG.info("MeshQueue", `Node ${nodeId} (${sessionId}) pulled task ${task.id}`);
|
|
26263
26265
|
components.cliManager.handleCliCommand("agent_command", {
|
|
26264
26266
|
targetSessionId: sessionId,
|
|
26265
26267
|
cliType: providerType,
|
|
26266
26268
|
action: "send_chat",
|
|
26267
|
-
|
|
26269
|
+
message: task.message
|
|
26268
26270
|
}).catch((e) => {
|
|
26269
26271
|
LOG.error("MeshQueue", `Failed to dispatch task to node ${nodeId}: ${e?.message}`);
|
|
26270
26272
|
});
|
|
@@ -26336,7 +26338,7 @@ Do NOT retry on this node. Consider reassigning to a different node or asking th
|
|
|
26336
26338
|
function injectMeshSystemMessage(components, args) {
|
|
26337
26339
|
if (args.event === "agent:generating_completed") {
|
|
26338
26340
|
const sessionId = readNonEmptyString(args.metadataEvent.targetSessionId);
|
|
26339
|
-
const nodeId = readNonEmptyString(args.
|
|
26341
|
+
const nodeId = readNonEmptyString(args.nodeId) || readNonEmptyString(args.metadataEvent.meshNodeId);
|
|
26340
26342
|
const providerType = readNonEmptyString(args.metadataEvent.providerType);
|
|
26341
26343
|
if (sessionId) {
|
|
26342
26344
|
updateSessionTaskStatus(args.meshId, sessionId, "completed");
|
|
@@ -26346,6 +26348,15 @@ function injectMeshSystemMessage(components, args) {
|
|
|
26346
26348
|
}, 500);
|
|
26347
26349
|
}
|
|
26348
26350
|
}
|
|
26351
|
+
} else if (args.event === "agent:ready") {
|
|
26352
|
+
const sessionId = readNonEmptyString(args.metadataEvent.targetSessionId);
|
|
26353
|
+
const nodeId = readNonEmptyString(args.nodeId) || readNonEmptyString(args.metadataEvent.meshNodeId);
|
|
26354
|
+
const providerType = readNonEmptyString(args.metadataEvent.providerType);
|
|
26355
|
+
if (sessionId && nodeId && providerType) {
|
|
26356
|
+
setTimeout(() => {
|
|
26357
|
+
tryAssignQueueTask(components, args.meshId, nodeId, sessionId, providerType);
|
|
26358
|
+
}, 500);
|
|
26359
|
+
}
|
|
26349
26360
|
} else if (args.event === "agent:stopped") {
|
|
26350
26361
|
const sessionId = readNonEmptyString(args.metadataEvent.targetSessionId);
|
|
26351
26362
|
if (sessionId) {
|
|
@@ -26357,7 +26368,7 @@ function injectMeshSystemMessage(components, args) {
|
|
|
26357
26368
|
try {
|
|
26358
26369
|
appendLedgerEntry(args.meshId, {
|
|
26359
26370
|
kind: ledgerKind,
|
|
26360
|
-
nodeId: readNonEmptyString(args.
|
|
26371
|
+
nodeId: readNonEmptyString(args.nodeId) || readNonEmptyString(args.metadataEvent.meshNodeId) || void 0,
|
|
26361
26372
|
sessionId: readNonEmptyString(args.metadataEvent.targetSessionId) || void 0,
|
|
26362
26373
|
providerType: readNonEmptyString(args.metadataEvent.providerType) || void 0,
|
|
26363
26374
|
payload: {
|
|
@@ -26377,7 +26388,7 @@ function injectMeshSystemMessage(components, args) {
|
|
|
26377
26388
|
const maxRetries = mesh?.policy?.maxTaskRetries ?? 1;
|
|
26378
26389
|
recoveryContext = getSessionRecoveryContext(args.meshId, {
|
|
26379
26390
|
sessionId: readNonEmptyString(args.metadataEvent.targetSessionId) || void 0,
|
|
26380
|
-
nodeId: readNonEmptyString(args.
|
|
26391
|
+
nodeId: readNonEmptyString(args.nodeId) || readNonEmptyString(args.metadataEvent.meshNodeId) || void 0,
|
|
26381
26392
|
maxRetries
|
|
26382
26393
|
});
|
|
26383
26394
|
recoveryContext.failedProviderType = readNonEmptyString(args.metadataEvent.providerType) || null;
|
|
@@ -26472,6 +26483,7 @@ function handleMeshForwardEvent(components, payload) {
|
|
|
26472
26483
|
const nodeLabel = nodeId ? `Node '${nodeId}'` : workspace ? `Agent at ${workspace}` : "Remote agent";
|
|
26473
26484
|
return injectMeshSystemMessage(components, {
|
|
26474
26485
|
meshId,
|
|
26486
|
+
nodeId,
|
|
26475
26487
|
nodeLabel,
|
|
26476
26488
|
event: eventName,
|
|
26477
26489
|
metadataEvent: {
|
|
@@ -26501,10 +26513,12 @@ function setupMeshEventForwarding(components) {
|
|
|
26501
26513
|
if (!meshId) return;
|
|
26502
26514
|
const targetNode = mesh?.nodes?.find((n) => n.workspace === workspace);
|
|
26503
26515
|
const runtimeNodeId = readNonEmptyString(settings.meshNodeId);
|
|
26516
|
+
const resolvedNodeId = targetNode?.id || runtimeNodeId;
|
|
26504
26517
|
const nodeLabel = targetNode ? `Node '${targetNode.id}'` : runtimeNodeId ? `Node '${runtimeNodeId}'` : `Agent at ${workspace}`;
|
|
26505
26518
|
injectMeshSystemMessage(components, {
|
|
26506
26519
|
meshId,
|
|
26507
26520
|
sourceInstanceId: instanceId,
|
|
26521
|
+
nodeId: resolvedNodeId,
|
|
26508
26522
|
nodeLabel,
|
|
26509
26523
|
event: event.event,
|
|
26510
26524
|
metadataEvent: event
|
|
@@ -33701,11 +33715,13 @@ async function handleOpenPanel(h, args) {
|
|
|
33701
33715
|
async function handlePtyInput(h, args) {
|
|
33702
33716
|
const { cliType, data, targetSessionId } = args || {};
|
|
33703
33717
|
if (!data) return { success: false, error: "data required" };
|
|
33718
|
+
const cleanData = typeof data === "string" ? data.replace(/\x1b\[[?>][0-9;]*c/g, "") : data;
|
|
33719
|
+
if (!cleanData) return { success: true };
|
|
33704
33720
|
const adapter = h.getCliAdapter(targetSessionId || cliType);
|
|
33705
33721
|
if (!adapter || typeof adapter.writeRaw !== "function") {
|
|
33706
33722
|
return { success: false, error: `CLI adapter not found: ${targetSessionId || cliType || "unknown"}` };
|
|
33707
33723
|
}
|
|
33708
|
-
await adapter.writeRaw(
|
|
33724
|
+
await adapter.writeRaw(cleanData);
|
|
33709
33725
|
return { success: true };
|
|
33710
33726
|
}
|
|
33711
33727
|
function handlePtyResize(_h, args) {
|
|
@@ -34532,9 +34548,6 @@ function buildCoordinatorDelegatedCliLaunchOptions(input) {
|
|
|
34532
34548
|
const cliType = String(input.cliType || "").trim();
|
|
34533
34549
|
const cliArgs = Array.isArray(input.cliArgs) ? [...input.cliArgs] : [];
|
|
34534
34550
|
const env2 = { ...input.env || {}, ...COORDINATOR_DELEGATED_ENV_UNSETS };
|
|
34535
|
-
if (cliType === "hermes-cli" && !hasCliArg(cliArgs, "--ignore-user-config")) {
|
|
34536
|
-
cliArgs.unshift("--ignore-user-config");
|
|
34537
|
-
}
|
|
34538
34551
|
if (cliType === "claude-cli" && !hasCliArg(cliArgs, "--mcp-config")) {
|
|
34539
34552
|
cliArgs.unshift("--mcp-config", ensureEmptyDelegatedMcpConfig(input.workspace));
|
|
34540
34553
|
}
|
|
@@ -35567,6 +35580,22 @@ function resolveMeshCoordinatorSetup(options) {
|
|
|
35567
35580
|
if (!instructions || !template?.trim()) {
|
|
35568
35581
|
return { kind: "unsupported", reason: "Provider manual MCP setup is missing instructions or template" };
|
|
35569
35582
|
}
|
|
35583
|
+
const renderedTemplate = renderMeshCoordinatorTemplate(template, {
|
|
35584
|
+
meshId,
|
|
35585
|
+
workspace,
|
|
35586
|
+
serverName,
|
|
35587
|
+
adhdevMcpCommand: options.adhdevMcpCommand || DEFAULT_ADHDEV_MCP_COMMAND
|
|
35588
|
+
});
|
|
35589
|
+
const isCliCommand = !renderedTemplate.trim().includes("\n") && !renderedTemplate.trim().startsWith("{");
|
|
35590
|
+
if (isCliCommand) {
|
|
35591
|
+
return {
|
|
35592
|
+
kind: "cli_command",
|
|
35593
|
+
serverName,
|
|
35594
|
+
command: renderedTemplate.trim(),
|
|
35595
|
+
requiresRestart: mcpConfig.requiresRestart === true,
|
|
35596
|
+
instructions
|
|
35597
|
+
};
|
|
35598
|
+
}
|
|
35570
35599
|
return {
|
|
35571
35600
|
kind: "manual",
|
|
35572
35601
|
serverName,
|
|
@@ -35574,12 +35603,7 @@ function resolveMeshCoordinatorSetup(options) {
|
|
|
35574
35603
|
configPathCommand: mcpConfig.configPathCommand,
|
|
35575
35604
|
requiresRestart: mcpConfig.requiresRestart === true,
|
|
35576
35605
|
instructions,
|
|
35577
|
-
template:
|
|
35578
|
-
meshId,
|
|
35579
|
-
workspace,
|
|
35580
|
-
serverName,
|
|
35581
|
-
adhdevMcpCommand: options.adhdevMcpCommand || DEFAULT_ADHDEV_MCP_COMMAND
|
|
35582
|
-
})
|
|
35606
|
+
template: renderedTemplate
|
|
35583
35607
|
};
|
|
35584
35608
|
}
|
|
35585
35609
|
return {
|
|
@@ -41331,6 +41355,7 @@ Follow these recovery rules:
|
|
|
41331
41355
|
"agent:generating_completed",
|
|
41332
41356
|
"agent:waiting_approval",
|
|
41333
41357
|
"agent:stopped",
|
|
41358
|
+
"agent:ready",
|
|
41334
41359
|
"monitor:long_generating"
|
|
41335
41360
|
]);
|
|
41336
41361
|
EVENT_TO_LEDGER_KIND = {
|
|
@@ -41865,6 +41890,8 @@ Follow these recovery rules:
|
|
|
41865
41890
|
statusHistory = [];
|
|
41866
41891
|
// ─── CLI Scripts (script-based parsing) ───
|
|
41867
41892
|
cliScripts;
|
|
41893
|
+
/** Per-session opaque state object created by cliScripts.createState(), reset on stop. */
|
|
41894
|
+
scriptState = null;
|
|
41868
41895
|
runtimeSettings = {};
|
|
41869
41896
|
/** Full accumulated rendered PTY transcript for parser/readback use */
|
|
41870
41897
|
accumulatedBuffer = "";
|
|
@@ -42046,6 +42073,7 @@ ${lastSnapshot}`;
|
|
|
42046
42073
|
this.cliScripts = scripts;
|
|
42047
42074
|
this.parsedStatusCache = null;
|
|
42048
42075
|
this.parseErrorMessage = null;
|
|
42076
|
+
this.scriptState = typeof scripts.createState === "function" ? scripts.createState() : null;
|
|
42049
42077
|
const scriptNames = listCliScriptNames(scripts);
|
|
42050
42078
|
LOG.info("CLI", `[${this.cliType}] CLI scripts injected: [${scriptNames.join(", ")}]`);
|
|
42051
42079
|
}
|
|
@@ -42163,6 +42191,7 @@ ${lastSnapshot}`;
|
|
|
42163
42191
|
this.ready = false;
|
|
42164
42192
|
this.startupParseGate = false;
|
|
42165
42193
|
this.spawnAt = 0;
|
|
42194
|
+
this.scriptState = null;
|
|
42166
42195
|
this.onStatusChange?.();
|
|
42167
42196
|
});
|
|
42168
42197
|
this.spawnAt = Date.now();
|
|
@@ -42936,7 +42965,7 @@ ${lastSnapshot}`;
|
|
|
42936
42965
|
scope: this.currentTurnScope,
|
|
42937
42966
|
runtimeSettings: this.runtimeSettings
|
|
42938
42967
|
});
|
|
42939
|
-
const session = this.cliScripts.parseSession({ ...input, tail, tailScreen: buildCliScreenSnapshot(tail) });
|
|
42968
|
+
const session = this.cliScripts.parseSession(this.scriptState, { ...input, tail, tailScreen: buildCliScreenSnapshot(tail) });
|
|
42940
42969
|
this.parseErrorMessage = null;
|
|
42941
42970
|
return session && typeof session === "object" ? session : null;
|
|
42942
42971
|
} catch (e) {
|
|
@@ -42950,7 +42979,7 @@ ${lastSnapshot}`;
|
|
|
42950
42979
|
if (!this.cliScripts?.detectStatus) return null;
|
|
42951
42980
|
try {
|
|
42952
42981
|
const screenText = this.terminalScreen.getText();
|
|
42953
|
-
const status = this.cliScripts.detectStatus({
|
|
42982
|
+
const status = this.cliScripts.detectStatus(this.scriptState, {
|
|
42954
42983
|
tail: text.slice(-500),
|
|
42955
42984
|
screenText,
|
|
42956
42985
|
rawBuffer: this.accumulatedRawBuffer,
|
|
@@ -42969,7 +42998,7 @@ ${lastSnapshot}`;
|
|
|
42969
42998
|
try {
|
|
42970
42999
|
const screenText = this.terminalScreen.getText();
|
|
42971
43000
|
const buffer = screenText || this.accumulatedBuffer;
|
|
42972
|
-
return this.cliScripts.parseApproval({
|
|
43001
|
+
return this.cliScripts.parseApproval(this.scriptState, {
|
|
42973
43002
|
buffer,
|
|
42974
43003
|
screenText,
|
|
42975
43004
|
rawBuffer: this.accumulatedRawBuffer,
|
|
@@ -43077,7 +43106,7 @@ ${lastSnapshot}`;
|
|
|
43077
43106
|
scope: this.currentTurnScope,
|
|
43078
43107
|
runtimeSettings: this.runtimeSettings
|
|
43079
43108
|
});
|
|
43080
|
-
return await Promise.resolve(fn({
|
|
43109
|
+
return await Promise.resolve(fn(this.scriptState, {
|
|
43081
43110
|
...input,
|
|
43082
43111
|
args: args && typeof args === "object" ? { ...args } : {}
|
|
43083
43112
|
}));
|
|
@@ -48296,6 +48325,8 @@ ${effect.notification.body || ""}`.trim();
|
|
|
48296
48325
|
this.completedDebounceTimer = null;
|
|
48297
48326
|
}, 3e3);
|
|
48298
48327
|
}
|
|
48328
|
+
} else if (newStatus === "idle" && this.lastStatus === "starting") {
|
|
48329
|
+
this.pushEvent({ event: "agent:ready", chatTitle, timestamp: now });
|
|
48299
48330
|
} else if (newStatus === "stopped") {
|
|
48300
48331
|
if (this.generatingDebounceTimer) {
|
|
48301
48332
|
clearTimeout(this.generatingDebounceTimer);
|
|
@@ -53342,6 +53373,93 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
53342
53373
|
meshCoordinatorSetup: coordinatorSetup
|
|
53343
53374
|
};
|
|
53344
53375
|
}
|
|
53376
|
+
if (coordinatorSetup.kind === "cli_command") {
|
|
53377
|
+
let cliCmdSystemPrompt = "";
|
|
53378
|
+
try {
|
|
53379
|
+
cliCmdSystemPrompt = buildCoordinatorSystemPrompt2({ mesh, coordinatorCliType: cliType });
|
|
53380
|
+
} catch (error48) {
|
|
53381
|
+
const message = error48?.message || String(error48);
|
|
53382
|
+
LOG.error("MeshCoordinator", `Failed to build coordinator prompt: ${message}`);
|
|
53383
|
+
return {
|
|
53384
|
+
success: false,
|
|
53385
|
+
code: "mesh_coordinator_prompt_failed",
|
|
53386
|
+
error: `Failed to build Repo Mesh coordinator prompt: ${message}`,
|
|
53387
|
+
meshId,
|
|
53388
|
+
cliType,
|
|
53389
|
+
workspace
|
|
53390
|
+
};
|
|
53391
|
+
}
|
|
53392
|
+
try {
|
|
53393
|
+
const { execFileSync: execCmdSync } = await import("child_process");
|
|
53394
|
+
const cmdParts = coordinatorSetup.command.trim().split(/\s+/);
|
|
53395
|
+
const [regCmd, ...regArgs] = cmdParts;
|
|
53396
|
+
LOG.info("MeshCoordinator", `Running MCP registration: ${coordinatorSetup.command}`);
|
|
53397
|
+
execCmdSync(regCmd, regArgs, { stdio: "pipe", timeout: 15e3 });
|
|
53398
|
+
} catch (error48) {
|
|
53399
|
+
LOG.warn("MeshCoordinator", `MCP registration command failed (may be pre-registered): ${error48?.message || error48}`);
|
|
53400
|
+
}
|
|
53401
|
+
const cliCmdArgs = [];
|
|
53402
|
+
const cliCmdEnv = {};
|
|
53403
|
+
if (cliCmdSystemPrompt) {
|
|
53404
|
+
if (cliType === "codex-cli") {
|
|
53405
|
+
cliCmdArgs.push("-c", `developer_instructions=${JSON.stringify(cliCmdSystemPrompt)}`);
|
|
53406
|
+
} else if (cliType === "gemini-cli") {
|
|
53407
|
+
try {
|
|
53408
|
+
const { writeFileSync: wfs, existsSync: efs, readFileSync: rfs } = await import("fs");
|
|
53409
|
+
const geminiMdPath = `${workspace}/GEMINI.md`;
|
|
53410
|
+
const marker = "<!-- adhdev-mesh-coordinator-prompt -->";
|
|
53411
|
+
const markerEnd = "<!-- /adhdev-mesh-coordinator-prompt -->";
|
|
53412
|
+
const block = `${marker}
|
|
53413
|
+
${cliCmdSystemPrompt}
|
|
53414
|
+
${markerEnd}`;
|
|
53415
|
+
if (efs(geminiMdPath)) {
|
|
53416
|
+
const existing = rfs(geminiMdPath, "utf-8");
|
|
53417
|
+
const replaced = existing.replace(
|
|
53418
|
+
new RegExp(`${marker}[\\s\\S]*?${markerEnd}`, "g"),
|
|
53419
|
+
block
|
|
53420
|
+
);
|
|
53421
|
+
wfs(geminiMdPath, replaced.includes(marker) ? replaced : `${existing}
|
|
53422
|
+
|
|
53423
|
+
${block}`);
|
|
53424
|
+
} else {
|
|
53425
|
+
wfs(geminiMdPath, block);
|
|
53426
|
+
}
|
|
53427
|
+
LOG.info("MeshCoordinator", `Wrote coordinator prompt to ${workspace}/GEMINI.md`);
|
|
53428
|
+
} catch (e) {
|
|
53429
|
+
LOG.warn("MeshCoordinator", `Could not write GEMINI.md: ${e?.message || e}`);
|
|
53430
|
+
}
|
|
53431
|
+
}
|
|
53432
|
+
}
|
|
53433
|
+
const cliCmdLaunch = await this.deps.cliManager.handleCliCommand("launch_cli", {
|
|
53434
|
+
cliType,
|
|
53435
|
+
dir: workspace,
|
|
53436
|
+
cliArgs: cliCmdArgs.length > 0 ? cliCmdArgs : void 0,
|
|
53437
|
+
env: Object.keys(cliCmdEnv).length > 0 ? cliCmdEnv : void 0,
|
|
53438
|
+
settings: { meshCoordinatorFor: meshId }
|
|
53439
|
+
});
|
|
53440
|
+
if (!cliCmdLaunch?.success) {
|
|
53441
|
+
return { success: false, error: cliCmdLaunch?.error || "Failed to launch CLI session" };
|
|
53442
|
+
}
|
|
53443
|
+
LOG.info("MeshCoordinator", `Launched ${cliType} coordinator (cli_command) for mesh ${meshId}`);
|
|
53444
|
+
try {
|
|
53445
|
+
const { appendLedgerEntry: appendLedgerEntry2 } = await Promise.resolve().then(() => (init_mesh_ledger(), mesh_ledger_exports));
|
|
53446
|
+
appendLedgerEntry2(meshId, {
|
|
53447
|
+
kind: "coordinator_started",
|
|
53448
|
+
sessionId: cliCmdLaunch.sessionId || cliCmdLaunch.id,
|
|
53449
|
+
providerType: cliType,
|
|
53450
|
+
payload: { workspace }
|
|
53451
|
+
});
|
|
53452
|
+
} catch {
|
|
53453
|
+
}
|
|
53454
|
+
return {
|
|
53455
|
+
success: true,
|
|
53456
|
+
meshId,
|
|
53457
|
+
cliType,
|
|
53458
|
+
workspace,
|
|
53459
|
+
sessionId: cliCmdLaunch.sessionId || cliCmdLaunch.id,
|
|
53460
|
+
mcpRegistered: true
|
|
53461
|
+
};
|
|
53462
|
+
}
|
|
53345
53463
|
const configFormat = coordinatorSetup.configFormat;
|
|
53346
53464
|
if (configFormat !== "claude_mcp_json" && configFormat !== "hermes_config_yaml") {
|
|
53347
53465
|
return {
|
|
@@ -57306,6 +57424,10 @@ function resolveCoordinatorNode(ctx) {
|
|
|
57306
57424
|
const preferred = ctx.mesh.nodes.find((n) => n.id === preferredNodeId && typeof n.daemonId === "string" && n.daemonId.trim());
|
|
57307
57425
|
if (preferred) return preferred;
|
|
57308
57426
|
}
|
|
57427
|
+
if (ctx.localMachineId) {
|
|
57428
|
+
const byMachine = ctx.mesh.nodes.find((n) => n.machineId === ctx.localMachineId);
|
|
57429
|
+
if (byMachine) return byMachine;
|
|
57430
|
+
}
|
|
57309
57431
|
if (ctx.localDaemonId) {
|
|
57310
57432
|
return ctx.mesh.nodes.find((n) => n.daemonId === ctx.localDaemonId);
|
|
57311
57433
|
}
|
|
@@ -57395,7 +57517,8 @@ function getNodeLaunchReadiness(node) {
|
|
|
57395
57517
|
};
|
|
57396
57518
|
}
|
|
57397
57519
|
async function commandForNode(ctx, node, command, args = {}) {
|
|
57398
|
-
|
|
57520
|
+
const isLocalNode = ctx.localMachineId && node.machineId === ctx.localMachineId || ctx.localDaemonId && node.daemonId === ctx.localDaemonId;
|
|
57521
|
+
if (ctx.transport instanceof IpcTransport && node.daemonId && !isLocalNode) {
|
|
57399
57522
|
return ctx.transport.meshCommand(node.daemonId, command, args);
|
|
57400
57523
|
}
|
|
57401
57524
|
if (isLocalTransport(ctx.transport)) {
|
|
@@ -57408,7 +57531,9 @@ var MESH_STATUS_TOOL = {
|
|
|
57408
57531
|
description: "Get the current status of all nodes in the repo mesh \u2014 health, git state, active sessions. Use this to decide which node to send work to.",
|
|
57409
57532
|
inputSchema: {
|
|
57410
57533
|
type: "object",
|
|
57411
|
-
properties: {
|
|
57534
|
+
properties: {
|
|
57535
|
+
_gemini_compat: { type: "string", description: "Dummy property for Gemini compatibility. Ignore this." }
|
|
57536
|
+
}
|
|
57412
57537
|
}
|
|
57413
57538
|
};
|
|
57414
57539
|
var MESH_LIST_NODES_TOOL = {
|
|
@@ -57416,7 +57541,9 @@ var MESH_LIST_NODES_TOOL = {
|
|
|
57416
57541
|
description: "List all nodes in the mesh with their capabilities, platform, and workspace paths.",
|
|
57417
57542
|
inputSchema: {
|
|
57418
57543
|
type: "object",
|
|
57419
|
-
properties: {
|
|
57544
|
+
properties: {
|
|
57545
|
+
_gemini_compat: { type: "string", description: "Dummy property for Gemini compatibility. Ignore this." }
|
|
57546
|
+
}
|
|
57420
57547
|
}
|
|
57421
57548
|
};
|
|
57422
57549
|
var MESH_ENQUEUE_TASK_TOOL = {
|
|
@@ -57720,10 +57847,7 @@ async function meshListNodes(ctx) {
|
|
|
57720
57847
|
async function meshEnqueueTask(ctx, args) {
|
|
57721
57848
|
try {
|
|
57722
57849
|
const task = enqueueTask(ctx.mesh.id, args.message);
|
|
57723
|
-
if (ctx.transport
|
|
57724
|
-
ctx.transport.meshCommand(ctx.localDaemonId, "trigger_mesh_queue", { meshId: ctx.mesh.id }).catch(() => {
|
|
57725
|
-
});
|
|
57726
|
-
} else if (isLocalTransport(ctx.transport)) {
|
|
57850
|
+
if (isLocalTransport(ctx.transport)) {
|
|
57727
57851
|
ctx.transport.command("trigger_mesh_queue", { meshId: ctx.mesh.id }).catch(() => {
|
|
57728
57852
|
});
|
|
57729
57853
|
}
|
|
@@ -57755,7 +57879,8 @@ async function meshSendTask(ctx, args) {
|
|
|
57755
57879
|
return JSON.stringify(res);
|
|
57756
57880
|
}
|
|
57757
57881
|
const task = enqueueTask(ctx.mesh.id, args.message, { targetNodeId: args.node_id });
|
|
57758
|
-
|
|
57882
|
+
const isLocalNode = ctx.localMachineId && node.machineId === ctx.localMachineId || ctx.localDaemonId && node.daemonId === ctx.localDaemonId;
|
|
57883
|
+
if (ctx.transport instanceof IpcTransport && node.daemonId && !isLocalNode) {
|
|
57759
57884
|
ctx.transport.meshCommand(node.daemonId, "trigger_mesh_queue", { meshId: ctx.mesh.id }).catch(() => {
|
|
57760
57885
|
});
|
|
57761
57886
|
} else if (isLocalTransport(ctx.transport)) {
|
|
@@ -57902,7 +58027,8 @@ async function meshLaunchSession(ctx, args) {
|
|
|
57902
58027
|
});
|
|
57903
58028
|
} catch {
|
|
57904
58029
|
}
|
|
57905
|
-
|
|
58030
|
+
const isLocalNode = ctx.localMachineId && node.machineId === ctx.localMachineId || ctx.localDaemonId && node.daemonId === ctx.localDaemonId;
|
|
58031
|
+
if (ctx.transport instanceof IpcTransport && node.daemonId && !isLocalNode) {
|
|
57906
58032
|
ctx.transport.meshCommand(node.daemonId, "trigger_mesh_queue", { meshId: ctx.mesh.id }).catch(() => {
|
|
57907
58033
|
});
|
|
57908
58034
|
} else if (isLocalTransport(ctx.transport)) {
|
|
@@ -59840,6 +59966,15 @@ async function startMcpServer(opts) {
|
|
|
59840
59966
|
process.exit(1);
|
|
59841
59967
|
}
|
|
59842
59968
|
let localDaemonId;
|
|
59969
|
+
let localMachineId;
|
|
59970
|
+
if (transport instanceof LocalTransport || transport instanceof IpcTransport) {
|
|
59971
|
+
try {
|
|
59972
|
+
const { loadConfig: loadConfig2 } = await Promise.resolve().then(() => (init_dist2(), dist_exports));
|
|
59973
|
+
const cfg = loadConfig2();
|
|
59974
|
+
if (cfg.registeredMachineId) localMachineId = cfg.registeredMachineId;
|
|
59975
|
+
} catch {
|
|
59976
|
+
}
|
|
59977
|
+
}
|
|
59843
59978
|
if (transport instanceof IpcTransport) {
|
|
59844
59979
|
try {
|
|
59845
59980
|
const statusResult = await transport.getStatus();
|
|
@@ -59848,7 +59983,7 @@ async function startMcpServer(opts) {
|
|
|
59848
59983
|
} catch {
|
|
59849
59984
|
}
|
|
59850
59985
|
}
|
|
59851
|
-
const meshCtx = { mesh, transport, ...localDaemonId ? { localDaemonId } : {} };
|
|
59986
|
+
const meshCtx = { mesh, transport, ...localDaemonId ? { localDaemonId } : {}, ...localMachineId ? { localMachineId } : {} };
|
|
59852
59987
|
const coordinatorPrompt = await buildMeshModeCoordinatorPrompt(mesh);
|
|
59853
59988
|
const server2 = new import_server.Server(
|
|
59854
59989
|
{ name: "adhdev-mcp-server", version: "0.9.76" },
|