@adhdev/daemon-standalone 0.9.76-rc.33 → 0.9.76-rc.34
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 +23 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/vendor/mcp-server/index.js +172 -2
- package/vendor/mcp-server/index.js.map +1 -1
package/package.json
CHANGED
|
@@ -31123,6 +31123,14 @@ function buildChatDebugBundleSummary(bundle) {
|
|
|
31123
31123
|
const readChat2 = bundle.readChat && typeof bundle.readChat === "object" ? bundle.readChat : {};
|
|
31124
31124
|
const cli = bundle.cli && typeof bundle.cli === "object" ? bundle.cli : null;
|
|
31125
31125
|
const frontend = bundle.frontend && typeof bundle.frontend === "object" ? bundle.frontend : null;
|
|
31126
|
+
const debugReadChat = readChat2.debugReadChat && typeof readChat2.debugReadChat === "object" ? readChat2.debugReadChat : {};
|
|
31127
|
+
const parsedStatus = cli?.parsedStatus && typeof cli.parsedStatus === "object" ? cli.parsedStatus : null;
|
|
31128
|
+
const cliParsedMessageCount = Array.isArray(parsedStatus?.messages) ? parsedStatus.messages.length : void 0;
|
|
31129
|
+
const readChatReturnedMessages = Array.isArray(readChat2.messagesTail) ? readChat2.messagesTail.length : void 0;
|
|
31130
|
+
const cliPartialResponse = typeof cli?.partialResponse === "string" ? cli.partialResponse : "";
|
|
31131
|
+
const readChatStatus = typeof readChat2.status === "string" ? readChat2.status : "";
|
|
31132
|
+
const cliStatus = typeof cli?.status === "string" ? cli.status : "";
|
|
31133
|
+
const cliParsedStatus = typeof parsedStatus?.status === "string" ? parsedStatus.status : "";
|
|
31126
31134
|
return {
|
|
31127
31135
|
createdAt: bundle.createdAt,
|
|
31128
31136
|
targetSessionId: target.targetSessionId,
|
|
@@ -31131,8 +31139,22 @@ function buildChatDebugBundleSummary(bundle) {
|
|
|
31131
31139
|
readChatSuccess: readChat2.success,
|
|
31132
31140
|
readChatStatus: readChat2.status,
|
|
31133
31141
|
readChatTotalMessages: readChat2.totalMessages,
|
|
31142
|
+
readChatReturnedMessages,
|
|
31134
31143
|
cliStatus: cli?.status,
|
|
31144
|
+
cliParsedStatus: cliParsedStatus || void 0,
|
|
31135
31145
|
cliMessageCount: cli?.messageCount,
|
|
31146
|
+
cliParsedMessageCount,
|
|
31147
|
+
cliPartialResponseChars: cliPartialResponse.length,
|
|
31148
|
+
parserAdapterStatusMismatch: Boolean(cliStatus && cliParsedStatus && cliStatus !== cliParsedStatus),
|
|
31149
|
+
parserReadChatStatusMismatch: Boolean(readChatStatus && cliParsedStatus && readChatStatus !== cliParsedStatus),
|
|
31150
|
+
readChatDebug: Object.keys(debugReadChat).length ? {
|
|
31151
|
+
adapterStatus: debugReadChat.adapterStatus,
|
|
31152
|
+
parsedStatus: debugReadChat.parsedStatus,
|
|
31153
|
+
returnedStatus: debugReadChat.returnedStatus,
|
|
31154
|
+
parsedMsgCount: debugReadChat.parsedMsgCount,
|
|
31155
|
+
returnedMsgCount: debugReadChat.returnedMsgCount,
|
|
31156
|
+
shouldPreferAdapterMessages: debugReadChat.shouldPreferAdapterMessages
|
|
31157
|
+
} : void 0,
|
|
31136
31158
|
hasFrontendSnapshot: !!frontend
|
|
31137
31159
|
};
|
|
31138
31160
|
}
|
|
@@ -55361,6 +55383,23 @@ var CloudTransport = class {
|
|
|
55361
55383
|
if (!res.ok) throw new Error(`Read chat failed: ${res.status}`);
|
|
55362
55384
|
return res.json();
|
|
55363
55385
|
}
|
|
55386
|
+
async getChatDebugBundle(targetId, opts = {}) {
|
|
55387
|
+
const res = await fetch(
|
|
55388
|
+
`${this.baseUrl}/api/v1/shortcuts/${encodeURIComponent(targetId)}/chat/debug`,
|
|
55389
|
+
{
|
|
55390
|
+
method: "POST",
|
|
55391
|
+
headers: this.headers(),
|
|
55392
|
+
body: JSON.stringify({
|
|
55393
|
+
...opts.agentType ? { agentType: opts.agentType } : {},
|
|
55394
|
+
...opts.sessionId ? { sessionId: opts.sessionId } : {},
|
|
55395
|
+
...opts.tailLimit ? { tailLimit: opts.tailLimit } : {},
|
|
55396
|
+
...opts.delivery ? { delivery: opts.delivery } : {}
|
|
55397
|
+
})
|
|
55398
|
+
}
|
|
55399
|
+
);
|
|
55400
|
+
if (!res.ok) throw new Error(`Chat debug bundle failed: ${res.status}`);
|
|
55401
|
+
return res.json();
|
|
55402
|
+
}
|
|
55364
55403
|
async sendChat(targetId, message, opts = {}) {
|
|
55365
55404
|
const res = await fetch(
|
|
55366
55405
|
`${this.baseUrl}/api/v1/shortcuts/${encodeURIComponent(targetId)}/chat`,
|
|
@@ -55806,6 +55845,93 @@ function formatChatResult(result, sessionId, format, limit = 50) {
|
|
|
55806
55845
|
return lines.join("\n\n");
|
|
55807
55846
|
}
|
|
55808
55847
|
|
|
55848
|
+
// src/tools/read-chat-debug.ts
|
|
55849
|
+
var READ_CHAT_DEBUG_TOOL = {
|
|
55850
|
+
name: "read_chat_debug",
|
|
55851
|
+
description: "Collect a daemon-side chat/parser debug bundle for an agent session without opening the browser UI. Prefer this when terminal/chat diverge or long CLI transcripts parse incorrectly. Defaults to daemon_file delivery and returns a saved bundle locator.",
|
|
55852
|
+
inputSchema: {
|
|
55853
|
+
type: "object",
|
|
55854
|
+
properties: {
|
|
55855
|
+
session_id: {
|
|
55856
|
+
type: "string",
|
|
55857
|
+
description: "Target session ID (from list_sessions). Required for reliable routing."
|
|
55858
|
+
},
|
|
55859
|
+
daemon_id: {
|
|
55860
|
+
type: "string",
|
|
55861
|
+
description: "Daemon ID (cloud mode only). Omit for local mode."
|
|
55862
|
+
},
|
|
55863
|
+
agent_type: {
|
|
55864
|
+
type: "string",
|
|
55865
|
+
description: "Optional provider/agent type hint, e.g. hermes-cli, claude-cli, codex-cli."
|
|
55866
|
+
},
|
|
55867
|
+
limit: {
|
|
55868
|
+
type: "number",
|
|
55869
|
+
description: "Max read_chat tail messages embedded in the bundle (default: 40)."
|
|
55870
|
+
},
|
|
55871
|
+
delivery: {
|
|
55872
|
+
type: "string",
|
|
55873
|
+
enum: ["daemon_file", "inline"],
|
|
55874
|
+
description: "daemon_file saves the full sanitized bundle on the daemon and returns a locator; inline returns the sanitized bundle in the MCP response. Default: daemon_file."
|
|
55875
|
+
},
|
|
55876
|
+
...FORMAT_PROP
|
|
55877
|
+
},
|
|
55878
|
+
required: ["session_id"]
|
|
55879
|
+
}
|
|
55880
|
+
};
|
|
55881
|
+
async function readChatDebug(transport, args) {
|
|
55882
|
+
const sessionId = typeof args.session_id === "string" ? args.session_id.trim() : "";
|
|
55883
|
+
if (!sessionId) throw new Error("session_id is required");
|
|
55884
|
+
const tailLimit = args.limit ?? 40;
|
|
55885
|
+
const delivery = args.delivery === "inline" ? "inline" : "daemon_file";
|
|
55886
|
+
const commandArgs = {
|
|
55887
|
+
targetSessionId: sessionId,
|
|
55888
|
+
tailLimit,
|
|
55889
|
+
...args.agent_type ? { agentType: args.agent_type, providerType: args.agent_type } : {},
|
|
55890
|
+
...delivery === "daemon_file" ? { delivery: "daemon_file" } : {}
|
|
55891
|
+
};
|
|
55892
|
+
let result;
|
|
55893
|
+
if (isLocalTransport(transport)) {
|
|
55894
|
+
result = await transport.command("get_chat_debug_bundle", commandArgs);
|
|
55895
|
+
} else {
|
|
55896
|
+
if (!args.daemon_id) throw new Error("daemon_id is required in cloud mode");
|
|
55897
|
+
const targetId = `${args.daemon_id}:session:${sessionId}`;
|
|
55898
|
+
result = await transport.getChatDebugBundle(targetId, {
|
|
55899
|
+
sessionId,
|
|
55900
|
+
agentType: args.agent_type,
|
|
55901
|
+
tailLimit,
|
|
55902
|
+
delivery
|
|
55903
|
+
});
|
|
55904
|
+
}
|
|
55905
|
+
return formatChatDebugResult(result, { sessionId, delivery, format: args.format });
|
|
55906
|
+
}
|
|
55907
|
+
function formatChatDebugResult(result, options) {
|
|
55908
|
+
if (!result?.success && result?.error) {
|
|
55909
|
+
if (options.format === "json") return JSON.stringify({ success: false, error: result.error }, null, 2);
|
|
55910
|
+
return `Error: ${result.error}`;
|
|
55911
|
+
}
|
|
55912
|
+
if (options.format === "json") {
|
|
55913
|
+
return JSON.stringify(result, null, 2);
|
|
55914
|
+
}
|
|
55915
|
+
if (result?.delivery === "daemon_file") {
|
|
55916
|
+
const summary = result.summary && typeof result.summary === "object" ? result.summary : {};
|
|
55917
|
+
return [
|
|
55918
|
+
"ADHDev chat debug bundle saved on daemon.",
|
|
55919
|
+
`session_id: ${options.sessionId}`,
|
|
55920
|
+
`bundle_id: ${String(result.bundleId || "")}`,
|
|
55921
|
+
`saved_path: ${String(result.savedPath || "")}`,
|
|
55922
|
+
`size_bytes: ${String(result.sizeBytes || "")}`,
|
|
55923
|
+
`created_at: ${String(result.createdAt || "")}`,
|
|
55924
|
+
`read_chat_status: ${String(summary.readChatStatus || "")}`,
|
|
55925
|
+
`read_chat_total_messages: ${String(summary.readChatTotalMessages ?? "")}`,
|
|
55926
|
+
`cli_status: ${String(summary.cliStatus || "")}`,
|
|
55927
|
+
`cli_message_count: ${String(summary.cliMessageCount ?? "")}`
|
|
55928
|
+
].join("\n");
|
|
55929
|
+
}
|
|
55930
|
+
if (typeof result?.text === "string") return result.text;
|
|
55931
|
+
if (result?.bundle) return JSON.stringify(result.bundle, null, 2);
|
|
55932
|
+
return JSON.stringify(result, null, 2);
|
|
55933
|
+
}
|
|
55934
|
+
|
|
55809
55935
|
// src/tools/send-chat.ts
|
|
55810
55936
|
var SEND_CHAT_TOOL = {
|
|
55811
55937
|
name: "send_chat",
|
|
@@ -56770,6 +56896,21 @@ var MESH_READ_CHAT_TOOL = {
|
|
|
56770
56896
|
required: ["node_id", "session_id"]
|
|
56771
56897
|
}
|
|
56772
56898
|
};
|
|
56899
|
+
var MESH_READ_DEBUG_TOOL = {
|
|
56900
|
+
name: "mesh_read_debug",
|
|
56901
|
+
description: "Collect a daemon-side chat/parser debug bundle for a delegated agent session on a mesh node without opening the browser UI. Defaults to daemon_file delivery and returns a saved bundle locator.",
|
|
56902
|
+
inputSchema: {
|
|
56903
|
+
type: "object",
|
|
56904
|
+
properties: {
|
|
56905
|
+
node_id: { type: "string", description: "Target node ID." },
|
|
56906
|
+
session_id: { type: "string", description: "Agent session ID to debug." },
|
|
56907
|
+
provider_session_id: { type: "string", description: "Optional provider transcript/session ID for completed session history." },
|
|
56908
|
+
tail: { type: "number", description: "Number of recent read_chat messages to embed (default: 40)." },
|
|
56909
|
+
delivery: { type: "string", enum: ["daemon_file", "inline"], description: "daemon_file saves the full sanitized bundle on the daemon; inline returns it directly. Default: daemon_file." }
|
|
56910
|
+
},
|
|
56911
|
+
required: ["node_id", "session_id"]
|
|
56912
|
+
}
|
|
56913
|
+
};
|
|
56773
56914
|
var MESH_LAUNCH_SESSION_TOOL = {
|
|
56774
56915
|
name: "mesh_launch_session",
|
|
56775
56916
|
description: "Launch a new agent session on a mesh node. Returns the session ID for subsequent send_task/read_chat calls. If the user names a provider, preserve it exactly: Hermes = hermes-cli, Claude Code/Claude = claude-cli, Codex = codex-cli, Gemini = gemini-cli. If type is omitted, resolve strictly from the node policy providerPriority and provider detection; fail closed when no configured provider is usable. Do not default to claude-cli.",
|
|
@@ -56847,6 +56988,7 @@ var ALL_MESH_TOOLS = [
|
|
|
56847
56988
|
MESH_LIST_NODES_TOOL,
|
|
56848
56989
|
MESH_SEND_TASK_TOOL,
|
|
56849
56990
|
MESH_READ_CHAT_TOOL,
|
|
56991
|
+
MESH_READ_DEBUG_TOOL,
|
|
56850
56992
|
MESH_LAUNCH_SESSION_TOOL,
|
|
56851
56993
|
MESH_GIT_STATUS_TOOL,
|
|
56852
56994
|
MESH_CHECKPOINT_TOOL,
|
|
@@ -56963,6 +57105,26 @@ async function meshReadChat(ctx, args) {
|
|
|
56963
57105
|
return JSON.stringify({ error: "Cloud mesh read_chat not yet implemented" });
|
|
56964
57106
|
}
|
|
56965
57107
|
}
|
|
57108
|
+
async function meshReadDebug(ctx, args) {
|
|
57109
|
+
const node = await findNodeWithRefresh(ctx, args.node_id);
|
|
57110
|
+
if (isLocalTransport(ctx.transport)) {
|
|
57111
|
+
const cached2 = meshSessionProviderMetadata.get(meshSessionCacheKey(args.node_id, args.session_id));
|
|
57112
|
+
const providerSessionId = typeof args.provider_session_id === "string" && args.provider_session_id.trim() ? args.provider_session_id.trim() : cached2?.providerSessionId;
|
|
57113
|
+
const delivery = args.delivery === "inline" ? void 0 : "daemon_file";
|
|
57114
|
+
const result = await commandForNode(ctx, node, "get_chat_debug_bundle", {
|
|
57115
|
+
sessionId: args.session_id,
|
|
57116
|
+
targetSessionId: args.session_id,
|
|
57117
|
+
workspace: node.workspace,
|
|
57118
|
+
...cached2?.providerType ? { agentType: cached2.providerType, providerType: cached2.providerType } : {},
|
|
57119
|
+
...providerSessionId ? { providerSessionId } : {},
|
|
57120
|
+
tailLimit: args.tail ?? 40,
|
|
57121
|
+
...delivery ? { delivery } : {}
|
|
57122
|
+
});
|
|
57123
|
+
const payload = unwrapCommandPayload(result);
|
|
57124
|
+
return JSON.stringify(payload, null, 2);
|
|
57125
|
+
}
|
|
57126
|
+
return JSON.stringify({ error: "Cloud mesh read_debug not yet implemented" });
|
|
57127
|
+
}
|
|
56966
57128
|
async function meshLaunchSession(ctx, args) {
|
|
56967
57129
|
const node = await findNodeWithRefresh(ctx, args.node_id);
|
|
56968
57130
|
if (isLocalTransport(ctx.transport)) {
|
|
@@ -57278,6 +57440,9 @@ async function startMcpServer(opts) {
|
|
|
57278
57440
|
case "mesh_read_chat":
|
|
57279
57441
|
text = await meshReadChat(meshCtx, a);
|
|
57280
57442
|
break;
|
|
57443
|
+
case "mesh_read_debug":
|
|
57444
|
+
text = await meshReadDebug(meshCtx, a);
|
|
57445
|
+
break;
|
|
57281
57446
|
case "mesh_launch_session":
|
|
57282
57447
|
text = await meshLaunchSession(meshCtx, a);
|
|
57283
57448
|
break;
|
|
@@ -57317,6 +57482,7 @@ async function startMcpServer(opts) {
|
|
|
57317
57482
|
STOP_SESSION_TOOL,
|
|
57318
57483
|
CHECK_PENDING_TOOL,
|
|
57319
57484
|
READ_CHAT_TOOL,
|
|
57485
|
+
READ_CHAT_DEBUG_TOOL,
|
|
57320
57486
|
SEND_CHAT_TOOL,
|
|
57321
57487
|
APPROVE_TOOL,
|
|
57322
57488
|
GIT_STATUS_TOOL,
|
|
@@ -57348,6 +57514,10 @@ async function startMcpServer(opts) {
|
|
|
57348
57514
|
const text = await readChat(transport, a);
|
|
57349
57515
|
return { content: [{ type: "text", text }] };
|
|
57350
57516
|
}
|
|
57517
|
+
case "read_chat_debug": {
|
|
57518
|
+
const text = await readChatDebug(transport, a);
|
|
57519
|
+
return { content: [{ type: "text", text }] };
|
|
57520
|
+
}
|
|
57351
57521
|
case "send_chat": {
|
|
57352
57522
|
const text = await sendChat(transport, { message: a.message, session_id: a.session_id, daemon_id: a.daemon_id });
|
|
57353
57523
|
return { content: [{ type: "text", text }] };
|
|
@@ -57496,8 +57666,8 @@ Environment variables:
|
|
|
57496
57666
|
ADHDEV_MESH_ID Mesh ID (mesh mode)
|
|
57497
57667
|
ADHDEV_MCP_TRANSPORT Transport: local, cloud, or ipc
|
|
57498
57668
|
|
|
57499
|
-
Standard tools: list_daemons, list_sessions, launch_session, stop_session, check_pending, read_chat, send_chat, approve, git_status, git_log, git_diff, git_checkpoint, git_push, screenshot
|
|
57500
|
-
Mesh tools: mesh_status, mesh_list_nodes, mesh_send_task, mesh_read_chat, mesh_launch_session, mesh_git_status, mesh_checkpoint, mesh_approve, mesh_clone_node, mesh_remove_node
|
|
57669
|
+
Standard tools: list_daemons, list_sessions, launch_session, stop_session, check_pending, read_chat, read_chat_debug, send_chat, approve, git_status, git_log, git_diff, git_checkpoint, git_push, screenshot
|
|
57670
|
+
Mesh tools: mesh_status, mesh_list_nodes, mesh_send_task, mesh_read_chat, mesh_read_debug, mesh_launch_session, mesh_git_status, mesh_checkpoint, mesh_approve, mesh_clone_node, mesh_remove_node
|
|
57501
57671
|
`.trim());
|
|
57502
57672
|
}
|
|
57503
57673
|
startMcpServer(parseArgs(process.argv)).catch((err) => {
|