@adhdev/daemon-standalone 0.9.77-rc.10 → 0.9.77-rc.11
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 +108 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/vendor/mcp-server/index.js +108 -8
- package/vendor/mcp-server/index.js.map +1 -1
package/package.json
CHANGED
|
@@ -26264,7 +26264,7 @@ function tryAssignQueueTask(components, meshId, nodeId, sessionId, providerType)
|
|
|
26264
26264
|
targetSessionId: sessionId,
|
|
26265
26265
|
cliType: providerType,
|
|
26266
26266
|
action: "send_chat",
|
|
26267
|
-
|
|
26267
|
+
message: task.message
|
|
26268
26268
|
}).catch((e) => {
|
|
26269
26269
|
LOG.error("MeshQueue", `Failed to dispatch task to node ${nodeId}: ${e?.message}`);
|
|
26270
26270
|
});
|
|
@@ -33701,11 +33701,13 @@ async function handleOpenPanel(h, args) {
|
|
|
33701
33701
|
async function handlePtyInput(h, args) {
|
|
33702
33702
|
const { cliType, data, targetSessionId } = args || {};
|
|
33703
33703
|
if (!data) return { success: false, error: "data required" };
|
|
33704
|
+
const cleanData = typeof data === "string" ? data.replace(/\x1b\[\?[0-9;]*c/g, "") : data;
|
|
33705
|
+
if (!cleanData) return { success: true };
|
|
33704
33706
|
const adapter = h.getCliAdapter(targetSessionId || cliType);
|
|
33705
33707
|
if (!adapter || typeof adapter.writeRaw !== "function") {
|
|
33706
33708
|
return { success: false, error: `CLI adapter not found: ${targetSessionId || cliType || "unknown"}` };
|
|
33707
33709
|
}
|
|
33708
|
-
await adapter.writeRaw(
|
|
33710
|
+
await adapter.writeRaw(cleanData);
|
|
33709
33711
|
return { success: true };
|
|
33710
33712
|
}
|
|
33711
33713
|
function handlePtyResize(_h, args) {
|
|
@@ -35567,6 +35569,22 @@ function resolveMeshCoordinatorSetup(options) {
|
|
|
35567
35569
|
if (!instructions || !template?.trim()) {
|
|
35568
35570
|
return { kind: "unsupported", reason: "Provider manual MCP setup is missing instructions or template" };
|
|
35569
35571
|
}
|
|
35572
|
+
const renderedTemplate = renderMeshCoordinatorTemplate(template, {
|
|
35573
|
+
meshId,
|
|
35574
|
+
workspace,
|
|
35575
|
+
serverName,
|
|
35576
|
+
adhdevMcpCommand: options.adhdevMcpCommand || DEFAULT_ADHDEV_MCP_COMMAND
|
|
35577
|
+
});
|
|
35578
|
+
const isCliCommand = !renderedTemplate.trim().includes("\n") && !renderedTemplate.trim().startsWith("{");
|
|
35579
|
+
if (isCliCommand) {
|
|
35580
|
+
return {
|
|
35581
|
+
kind: "cli_command",
|
|
35582
|
+
serverName,
|
|
35583
|
+
command: renderedTemplate.trim(),
|
|
35584
|
+
requiresRestart: mcpConfig.requiresRestart === true,
|
|
35585
|
+
instructions
|
|
35586
|
+
};
|
|
35587
|
+
}
|
|
35570
35588
|
return {
|
|
35571
35589
|
kind: "manual",
|
|
35572
35590
|
serverName,
|
|
@@ -35574,12 +35592,7 @@ function resolveMeshCoordinatorSetup(options) {
|
|
|
35574
35592
|
configPathCommand: mcpConfig.configPathCommand,
|
|
35575
35593
|
requiresRestart: mcpConfig.requiresRestart === true,
|
|
35576
35594
|
instructions,
|
|
35577
|
-
template:
|
|
35578
|
-
meshId,
|
|
35579
|
-
workspace,
|
|
35580
|
-
serverName,
|
|
35581
|
-
adhdevMcpCommand: options.adhdevMcpCommand || DEFAULT_ADHDEV_MCP_COMMAND
|
|
35582
|
-
})
|
|
35595
|
+
template: renderedTemplate
|
|
35583
35596
|
};
|
|
35584
35597
|
}
|
|
35585
35598
|
return {
|
|
@@ -53346,6 +53359,93 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
53346
53359
|
meshCoordinatorSetup: coordinatorSetup
|
|
53347
53360
|
};
|
|
53348
53361
|
}
|
|
53362
|
+
if (coordinatorSetup.kind === "cli_command") {
|
|
53363
|
+
let cliCmdSystemPrompt = "";
|
|
53364
|
+
try {
|
|
53365
|
+
cliCmdSystemPrompt = buildCoordinatorSystemPrompt2({ mesh, coordinatorCliType: cliType });
|
|
53366
|
+
} catch (error48) {
|
|
53367
|
+
const message = error48?.message || String(error48);
|
|
53368
|
+
LOG.error("MeshCoordinator", `Failed to build coordinator prompt: ${message}`);
|
|
53369
|
+
return {
|
|
53370
|
+
success: false,
|
|
53371
|
+
code: "mesh_coordinator_prompt_failed",
|
|
53372
|
+
error: `Failed to build Repo Mesh coordinator prompt: ${message}`,
|
|
53373
|
+
meshId,
|
|
53374
|
+
cliType,
|
|
53375
|
+
workspace
|
|
53376
|
+
};
|
|
53377
|
+
}
|
|
53378
|
+
try {
|
|
53379
|
+
const { execFileSync: execCmdSync } = await import("child_process");
|
|
53380
|
+
const cmdParts = coordinatorSetup.command.trim().split(/\s+/);
|
|
53381
|
+
const [regCmd, ...regArgs] = cmdParts;
|
|
53382
|
+
LOG.info("MeshCoordinator", `Running MCP registration: ${coordinatorSetup.command}`);
|
|
53383
|
+
execCmdSync(regCmd, regArgs, { stdio: "pipe", timeout: 15e3 });
|
|
53384
|
+
} catch (error48) {
|
|
53385
|
+
LOG.warn("MeshCoordinator", `MCP registration command failed (may be pre-registered): ${error48?.message || error48}`);
|
|
53386
|
+
}
|
|
53387
|
+
const cliCmdArgs = [];
|
|
53388
|
+
const cliCmdEnv = {};
|
|
53389
|
+
if (cliCmdSystemPrompt) {
|
|
53390
|
+
if (cliType === "codex-cli") {
|
|
53391
|
+
cliCmdArgs.push("-c", `developer_instructions=${JSON.stringify(cliCmdSystemPrompt)}`);
|
|
53392
|
+
} else if (cliType === "gemini-cli") {
|
|
53393
|
+
try {
|
|
53394
|
+
const { writeFileSync: wfs, existsSync: efs, readFileSync: rfs } = await import("fs");
|
|
53395
|
+
const geminiMdPath = `${workspace}/GEMINI.md`;
|
|
53396
|
+
const marker = "<!-- adhdev-mesh-coordinator-prompt -->";
|
|
53397
|
+
const markerEnd = "<!-- /adhdev-mesh-coordinator-prompt -->";
|
|
53398
|
+
const block = `${marker}
|
|
53399
|
+
${cliCmdSystemPrompt}
|
|
53400
|
+
${markerEnd}`;
|
|
53401
|
+
if (efs(geminiMdPath)) {
|
|
53402
|
+
const existing = rfs(geminiMdPath, "utf-8");
|
|
53403
|
+
const replaced = existing.replace(
|
|
53404
|
+
new RegExp(`${marker}[\\s\\S]*?${markerEnd}`, "g"),
|
|
53405
|
+
block
|
|
53406
|
+
);
|
|
53407
|
+
wfs(geminiMdPath, replaced.includes(marker) ? replaced : `${existing}
|
|
53408
|
+
|
|
53409
|
+
${block}`);
|
|
53410
|
+
} else {
|
|
53411
|
+
wfs(geminiMdPath, block);
|
|
53412
|
+
}
|
|
53413
|
+
LOG.info("MeshCoordinator", `Wrote coordinator prompt to ${workspace}/GEMINI.md`);
|
|
53414
|
+
} catch (e) {
|
|
53415
|
+
LOG.warn("MeshCoordinator", `Could not write GEMINI.md: ${e?.message || e}`);
|
|
53416
|
+
}
|
|
53417
|
+
}
|
|
53418
|
+
}
|
|
53419
|
+
const cliCmdLaunch = await this.deps.cliManager.handleCliCommand("launch_cli", {
|
|
53420
|
+
cliType,
|
|
53421
|
+
dir: workspace,
|
|
53422
|
+
cliArgs: cliCmdArgs.length > 0 ? cliCmdArgs : void 0,
|
|
53423
|
+
env: Object.keys(cliCmdEnv).length > 0 ? cliCmdEnv : void 0,
|
|
53424
|
+
settings: { meshCoordinatorFor: meshId }
|
|
53425
|
+
});
|
|
53426
|
+
if (!cliCmdLaunch?.success) {
|
|
53427
|
+
return { success: false, error: cliCmdLaunch?.error || "Failed to launch CLI session" };
|
|
53428
|
+
}
|
|
53429
|
+
LOG.info("MeshCoordinator", `Launched ${cliType} coordinator (cli_command) for mesh ${meshId}`);
|
|
53430
|
+
try {
|
|
53431
|
+
const { appendLedgerEntry: appendLedgerEntry2 } = await Promise.resolve().then(() => (init_mesh_ledger(), mesh_ledger_exports));
|
|
53432
|
+
appendLedgerEntry2(meshId, {
|
|
53433
|
+
kind: "coordinator_started",
|
|
53434
|
+
sessionId: cliCmdLaunch.sessionId || cliCmdLaunch.id,
|
|
53435
|
+
providerType: cliType,
|
|
53436
|
+
payload: { workspace }
|
|
53437
|
+
});
|
|
53438
|
+
} catch {
|
|
53439
|
+
}
|
|
53440
|
+
return {
|
|
53441
|
+
success: true,
|
|
53442
|
+
meshId,
|
|
53443
|
+
cliType,
|
|
53444
|
+
workspace,
|
|
53445
|
+
sessionId: cliCmdLaunch.sessionId || cliCmdLaunch.id,
|
|
53446
|
+
mcpRegistered: true
|
|
53447
|
+
};
|
|
53448
|
+
}
|
|
53349
53449
|
const configFormat = coordinatorSetup.configFormat;
|
|
53350
53450
|
if (configFormat !== "claude_mcp_json" && configFormat !== "hermes_config_yaml") {
|
|
53351
53451
|
return {
|