@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/dist/index.js
CHANGED
|
@@ -32538,7 +32538,7 @@ Follow these recovery rules:
|
|
|
32538
32538
|
targetSessionId: sessionId,
|
|
32539
32539
|
cliType: providerType,
|
|
32540
32540
|
action: "send_chat",
|
|
32541
|
-
|
|
32541
|
+
message: task.message
|
|
32542
32542
|
}).catch((e) => {
|
|
32543
32543
|
LOG2.error("MeshQueue", `Failed to dispatch task to node ${nodeId}: ${e?.message}`);
|
|
32544
32544
|
});
|
|
@@ -46300,11 +46300,13 @@ ${effect.notification.body || ""}`.trim();
|
|
|
46300
46300
|
async function handlePtyInput(h, args) {
|
|
46301
46301
|
const { cliType, data, targetSessionId } = args || {};
|
|
46302
46302
|
if (!data) return { success: false, error: "data required" };
|
|
46303
|
+
const cleanData = typeof data === "string" ? data.replace(/\x1b\[\?[0-9;]*c/g, "") : data;
|
|
46304
|
+
if (!cleanData) return { success: true };
|
|
46303
46305
|
const adapter = h.getCliAdapter(targetSessionId || cliType);
|
|
46304
46306
|
if (!adapter || typeof adapter.writeRaw !== "function") {
|
|
46305
46307
|
return { success: false, error: `CLI adapter not found: ${targetSessionId || cliType || "unknown"}` };
|
|
46306
46308
|
}
|
|
46307
|
-
await adapter.writeRaw(
|
|
46309
|
+
await adapter.writeRaw(cleanData);
|
|
46308
46310
|
return { success: true };
|
|
46309
46311
|
}
|
|
46310
46312
|
function handlePtyResize(_h, args) {
|
|
@@ -52974,6 +52976,22 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
52974
52976
|
if (!instructions || !template?.trim()) {
|
|
52975
52977
|
return { kind: "unsupported", reason: "Provider manual MCP setup is missing instructions or template" };
|
|
52976
52978
|
}
|
|
52979
|
+
const renderedTemplate = renderMeshCoordinatorTemplate(template, {
|
|
52980
|
+
meshId,
|
|
52981
|
+
workspace,
|
|
52982
|
+
serverName,
|
|
52983
|
+
adhdevMcpCommand: options.adhdevMcpCommand || DEFAULT_ADHDEV_MCP_COMMAND
|
|
52984
|
+
});
|
|
52985
|
+
const isCliCommand = !renderedTemplate.trim().includes("\n") && !renderedTemplate.trim().startsWith("{");
|
|
52986
|
+
if (isCliCommand) {
|
|
52987
|
+
return {
|
|
52988
|
+
kind: "cli_command",
|
|
52989
|
+
serverName,
|
|
52990
|
+
command: renderedTemplate.trim(),
|
|
52991
|
+
requiresRestart: mcpConfig.requiresRestart === true,
|
|
52992
|
+
instructions
|
|
52993
|
+
};
|
|
52994
|
+
}
|
|
52977
52995
|
return {
|
|
52978
52996
|
kind: "manual",
|
|
52979
52997
|
serverName,
|
|
@@ -52981,12 +52999,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
52981
52999
|
configPathCommand: mcpConfig.configPathCommand,
|
|
52982
53000
|
requiresRestart: mcpConfig.requiresRestart === true,
|
|
52983
53001
|
instructions,
|
|
52984
|
-
template:
|
|
52985
|
-
meshId,
|
|
52986
|
-
workspace,
|
|
52987
|
-
serverName,
|
|
52988
|
-
adhdevMcpCommand: options.adhdevMcpCommand || DEFAULT_ADHDEV_MCP_COMMAND
|
|
52989
|
-
})
|
|
53002
|
+
template: renderedTemplate
|
|
52990
53003
|
};
|
|
52991
53004
|
}
|
|
52992
53005
|
return {
|
|
@@ -55160,6 +55173,93 @@ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
|
|
|
55160
55173
|
meshCoordinatorSetup: coordinatorSetup
|
|
55161
55174
|
};
|
|
55162
55175
|
}
|
|
55176
|
+
if (coordinatorSetup.kind === "cli_command") {
|
|
55177
|
+
let cliCmdSystemPrompt = "";
|
|
55178
|
+
try {
|
|
55179
|
+
cliCmdSystemPrompt = buildCoordinatorSystemPrompt2({ mesh, coordinatorCliType: cliType });
|
|
55180
|
+
} catch (error48) {
|
|
55181
|
+
const message = error48?.message || String(error48);
|
|
55182
|
+
LOG2.error("MeshCoordinator", `Failed to build coordinator prompt: ${message}`);
|
|
55183
|
+
return {
|
|
55184
|
+
success: false,
|
|
55185
|
+
code: "mesh_coordinator_prompt_failed",
|
|
55186
|
+
error: `Failed to build Repo Mesh coordinator prompt: ${message}`,
|
|
55187
|
+
meshId,
|
|
55188
|
+
cliType,
|
|
55189
|
+
workspace
|
|
55190
|
+
};
|
|
55191
|
+
}
|
|
55192
|
+
try {
|
|
55193
|
+
const { execFileSync: execCmdSync } = await import("child_process");
|
|
55194
|
+
const cmdParts = coordinatorSetup.command.trim().split(/\s+/);
|
|
55195
|
+
const [regCmd, ...regArgs] = cmdParts;
|
|
55196
|
+
LOG2.info("MeshCoordinator", `Running MCP registration: ${coordinatorSetup.command}`);
|
|
55197
|
+
execCmdSync(regCmd, regArgs, { stdio: "pipe", timeout: 15e3 });
|
|
55198
|
+
} catch (error48) {
|
|
55199
|
+
LOG2.warn("MeshCoordinator", `MCP registration command failed (may be pre-registered): ${error48?.message || error48}`);
|
|
55200
|
+
}
|
|
55201
|
+
const cliCmdArgs = [];
|
|
55202
|
+
const cliCmdEnv = {};
|
|
55203
|
+
if (cliCmdSystemPrompt) {
|
|
55204
|
+
if (cliType === "codex-cli") {
|
|
55205
|
+
cliCmdArgs.push("-c", `developer_instructions=${JSON.stringify(cliCmdSystemPrompt)}`);
|
|
55206
|
+
} else if (cliType === "gemini-cli") {
|
|
55207
|
+
try {
|
|
55208
|
+
const { writeFileSync: wfs, existsSync: efs, readFileSync: rfs } = await import("fs");
|
|
55209
|
+
const geminiMdPath = `${workspace}/GEMINI.md`;
|
|
55210
|
+
const marker = "<!-- adhdev-mesh-coordinator-prompt -->";
|
|
55211
|
+
const markerEnd = "<!-- /adhdev-mesh-coordinator-prompt -->";
|
|
55212
|
+
const block = `${marker}
|
|
55213
|
+
${cliCmdSystemPrompt}
|
|
55214
|
+
${markerEnd}`;
|
|
55215
|
+
if (efs(geminiMdPath)) {
|
|
55216
|
+
const existing = rfs(geminiMdPath, "utf-8");
|
|
55217
|
+
const replaced = existing.replace(
|
|
55218
|
+
new RegExp(`${marker}[\\s\\S]*?${markerEnd}`, "g"),
|
|
55219
|
+
block
|
|
55220
|
+
);
|
|
55221
|
+
wfs(geminiMdPath, replaced.includes(marker) ? replaced : `${existing}
|
|
55222
|
+
|
|
55223
|
+
${block}`);
|
|
55224
|
+
} else {
|
|
55225
|
+
wfs(geminiMdPath, block);
|
|
55226
|
+
}
|
|
55227
|
+
LOG2.info("MeshCoordinator", `Wrote coordinator prompt to ${workspace}/GEMINI.md`);
|
|
55228
|
+
} catch (e) {
|
|
55229
|
+
LOG2.warn("MeshCoordinator", `Could not write GEMINI.md: ${e?.message || e}`);
|
|
55230
|
+
}
|
|
55231
|
+
}
|
|
55232
|
+
}
|
|
55233
|
+
const cliCmdLaunch = await this.deps.cliManager.handleCliCommand("launch_cli", {
|
|
55234
|
+
cliType,
|
|
55235
|
+
dir: workspace,
|
|
55236
|
+
cliArgs: cliCmdArgs.length > 0 ? cliCmdArgs : void 0,
|
|
55237
|
+
env: Object.keys(cliCmdEnv).length > 0 ? cliCmdEnv : void 0,
|
|
55238
|
+
settings: { meshCoordinatorFor: meshId }
|
|
55239
|
+
});
|
|
55240
|
+
if (!cliCmdLaunch?.success) {
|
|
55241
|
+
return { success: false, error: cliCmdLaunch?.error || "Failed to launch CLI session" };
|
|
55242
|
+
}
|
|
55243
|
+
LOG2.info("MeshCoordinator", `Launched ${cliType} coordinator (cli_command) for mesh ${meshId}`);
|
|
55244
|
+
try {
|
|
55245
|
+
const { appendLedgerEntry: appendLedgerEntry2 } = await Promise.resolve().then(() => (init_mesh_ledger(), mesh_ledger_exports));
|
|
55246
|
+
appendLedgerEntry2(meshId, {
|
|
55247
|
+
kind: "coordinator_started",
|
|
55248
|
+
sessionId: cliCmdLaunch.sessionId || cliCmdLaunch.id,
|
|
55249
|
+
providerType: cliType,
|
|
55250
|
+
payload: { workspace }
|
|
55251
|
+
});
|
|
55252
|
+
} catch {
|
|
55253
|
+
}
|
|
55254
|
+
return {
|
|
55255
|
+
success: true,
|
|
55256
|
+
meshId,
|
|
55257
|
+
cliType,
|
|
55258
|
+
workspace,
|
|
55259
|
+
sessionId: cliCmdLaunch.sessionId || cliCmdLaunch.id,
|
|
55260
|
+
mcpRegistered: true
|
|
55261
|
+
};
|
|
55262
|
+
}
|
|
55163
55263
|
const configFormat = coordinatorSetup.configFormat;
|
|
55164
55264
|
if (configFormat !== "claude_mcp_json" && configFormat !== "hermes_config_yaml") {
|
|
55165
55265
|
return {
|