@adhdev/daemon-standalone 0.9.76-rc.17 → 0.9.76-rc.18
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 +31 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/vendor/mcp-server/index.js +46 -16
- package/vendor/mcp-server/index.js.map +1 -1
package/package.json
CHANGED
|
@@ -30935,6 +30935,34 @@ function normalizeReadChatCommandStatus(status, activeModal) {
|
|
|
30935
30935
|
return raw;
|
|
30936
30936
|
}
|
|
30937
30937
|
}
|
|
30938
|
+
function isGeneratingLikeStatus(status) {
|
|
30939
|
+
return status === "generating" || status === "streaming" || status === "long_generating" || status === "starting";
|
|
30940
|
+
}
|
|
30941
|
+
function shouldTrustCliAdapterTerminalStatus(parsedStatus, activeModal, adapter, adapterStatus) {
|
|
30942
|
+
if (!isGeneratingLikeStatus(parsedStatus)) return false;
|
|
30943
|
+
if (hasNonEmptyModalButtons(activeModal)) return false;
|
|
30944
|
+
const adapterRawStatus = typeof adapterStatus?.status === "string" ? adapterStatus.status.trim() : "";
|
|
30945
|
+
if (adapterRawStatus !== "idle") return false;
|
|
30946
|
+
if (typeof adapter.isProcessing === "function" && adapter.isProcessing()) return false;
|
|
30947
|
+
return true;
|
|
30948
|
+
}
|
|
30949
|
+
function normalizeCliReadChatStatus(parsedStatus, activeModal, adapter, adapterStatus) {
|
|
30950
|
+
if (shouldTrustCliAdapterTerminalStatus(parsedStatus, activeModal, adapter, adapterStatus)) return "idle";
|
|
30951
|
+
return typeof parsedStatus === "string" && parsedStatus.trim() ? parsedStatus : "idle";
|
|
30952
|
+
}
|
|
30953
|
+
function finalizeStreamingMessagesWhenIdle(messages, status) {
|
|
30954
|
+
if (status !== "idle") return messages;
|
|
30955
|
+
return messages.map((message) => {
|
|
30956
|
+
const meta3 = message.meta && typeof message.meta === "object" ? message.meta : void 0;
|
|
30957
|
+
const hasStreamingMeta = meta3?.streaming === true;
|
|
30958
|
+
if (message.bubbleState !== "streaming" && !hasStreamingMeta) return message;
|
|
30959
|
+
return {
|
|
30960
|
+
...message,
|
|
30961
|
+
...message.bubbleState === "streaming" ? { bubbleState: "final" } : {},
|
|
30962
|
+
...hasStreamingMeta ? { meta: { ...meta3, streaming: false } } : {}
|
|
30963
|
+
};
|
|
30964
|
+
});
|
|
30965
|
+
}
|
|
30938
30966
|
function buildReadChatCommandResult(payload, args) {
|
|
30939
30967
|
let validatedPayload;
|
|
30940
30968
|
const debugReadChat = payload?.debugReadChat && typeof payload.debugReadChat === "object" ? payload.debugReadChat : void 0;
|
|
@@ -31366,9 +31394,10 @@ async function handleReadChat(h, args) {
|
|
|
31366
31394
|
const transcriptAuthority = parsedRecord.transcriptAuthority === "provider" || parsedRecord.transcriptAuthority === "daemon" ? parsedRecord.transcriptAuthority : void 0;
|
|
31367
31395
|
const coverage = parsedRecord.coverage === "full" || parsedRecord.coverage === "tail" || parsedRecord.coverage === "current-turn" ? parsedRecord.coverage : void 0;
|
|
31368
31396
|
const activeModal = parsedRecord.activeModal ?? parsedRecord.modal ?? null;
|
|
31369
|
-
const returnedStatus = parsedRecord.status
|
|
31397
|
+
const returnedStatus = normalizeCliReadChatStatus(parsedRecord.status, activeModal, adapter, adapterStatus);
|
|
31370
31398
|
const runtimeMessageMerger = getTargetInstance(h, args);
|
|
31371
|
-
const
|
|
31399
|
+
const parsedMessages = finalizeStreamingMessagesWhenIdle(parsedRecord.messages, returnedStatus);
|
|
31400
|
+
const returnedMessages = runtimeMessageMerger?.category === "cli" && runtimeMessageMerger.type === adapter.cliType && typeof runtimeMessageMerger.mergeRuntimeChatMessages === "function" ? runtimeMessageMerger.mergeRuntimeChatMessages(parsedMessages) : parsedMessages;
|
|
31372
31401
|
LOG.debug("Command", `[read_chat] cli-like parsed provider=${adapter.cliType} target=${String(args?.targetSessionId || "")} adapterStatus=${String(adapterStatus.status || "")} parsedStatus=${String(parsedRecord.status || "")} parsedMsgCount=${parsedRecord.messages.length} returnedMsgCount=${returnedMessages.length}`);
|
|
31373
31402
|
return buildReadChatCommandResult({
|
|
31374
31403
|
messages: returnedMessages,
|
|
@@ -56293,23 +56322,22 @@ ${lines.join("\n\n")}`;
|
|
|
56293
56322
|
}
|
|
56294
56323
|
|
|
56295
56324
|
// src/tools/mesh-tools.ts
|
|
56325
|
+
async function refreshMeshFromDaemon(ctx) {
|
|
56326
|
+
if (!(ctx.transport instanceof IpcTransport)) return;
|
|
56327
|
+
try {
|
|
56328
|
+
const result = await ctx.transport.command("get_mesh", { meshId: ctx.mesh.id });
|
|
56329
|
+
if (!result?.success || !Array.isArray(result.mesh?.nodes)) return;
|
|
56330
|
+
const refreshedNodes = result.mesh.nodes.filter((n) => n?.id).map((n) => n);
|
|
56331
|
+
if (!refreshedNodes.length) return;
|
|
56332
|
+
ctx.mesh.nodes.splice(0, ctx.mesh.nodes.length, ...refreshedNodes);
|
|
56333
|
+
ctx.mesh.updatedAt = result.mesh.updatedAt ?? ctx.mesh.updatedAt;
|
|
56334
|
+
} catch {
|
|
56335
|
+
}
|
|
56336
|
+
}
|
|
56296
56337
|
async function findNodeWithRefresh(ctx, nodeId) {
|
|
56297
56338
|
const hit = ctx.mesh.nodes.find((n) => n.id === nodeId);
|
|
56298
56339
|
if (hit) return hit;
|
|
56299
|
-
|
|
56300
|
-
try {
|
|
56301
|
-
const result = await ctx.transport.command("get_mesh", { meshId: ctx.mesh.id });
|
|
56302
|
-
if (result?.success && Array.isArray(result.mesh?.nodes)) {
|
|
56303
|
-
for (const n of result.mesh.nodes) {
|
|
56304
|
-
if (n?.id && !ctx.mesh.nodes.find((existing) => existing.id === n.id)) {
|
|
56305
|
-
ctx.mesh.nodes.push(n);
|
|
56306
|
-
}
|
|
56307
|
-
}
|
|
56308
|
-
ctx.mesh.updatedAt = result.mesh.updatedAt ?? ctx.mesh.updatedAt;
|
|
56309
|
-
}
|
|
56310
|
-
} catch {
|
|
56311
|
-
}
|
|
56312
|
-
}
|
|
56340
|
+
await refreshMeshFromDaemon(ctx);
|
|
56313
56341
|
const refreshed = ctx.mesh.nodes.find((n) => n.id === nodeId);
|
|
56314
56342
|
if (!refreshed) throw new Error(`Node '${nodeId}' is not a member of mesh '${ctx.mesh.name}'`);
|
|
56315
56343
|
return refreshed;
|
|
@@ -56450,6 +56478,7 @@ var ALL_MESH_TOOLS = [
|
|
|
56450
56478
|
MESH_REMOVE_NODE_TOOL
|
|
56451
56479
|
];
|
|
56452
56480
|
async function meshStatus(ctx) {
|
|
56481
|
+
await refreshMeshFromDaemon(ctx);
|
|
56453
56482
|
const { mesh, transport } = ctx;
|
|
56454
56483
|
const results = [];
|
|
56455
56484
|
for (const node of mesh.nodes) {
|
|
@@ -56492,6 +56521,7 @@ async function meshStatus(ctx) {
|
|
|
56492
56521
|
}, null, 2);
|
|
56493
56522
|
}
|
|
56494
56523
|
async function meshListNodes(ctx) {
|
|
56524
|
+
await refreshMeshFromDaemon(ctx);
|
|
56495
56525
|
const { mesh } = ctx;
|
|
56496
56526
|
return JSON.stringify({
|
|
56497
56527
|
meshId: mesh.id,
|