@adhdev/daemon-standalone 0.9.82-rc.132 → 0.9.82-rc.134
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 +76 -17
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/vendor/mcp-server/index.js +20 -3
- package/vendor/mcp-server/index.js.map +1 -1
package/dist/index.js
CHANGED
|
@@ -23324,7 +23324,7 @@ ${rules.join("\n")}`;
|
|
|
23324
23324
|
|
|
23325
23325
|
- **Minimize coordinator context.** The coordinator's job is routing, not implementing. Do not read source files, run commands, or analyze code directly \u2014 delegate all of that to node agents. Your context should stay lean.
|
|
23326
23326
|
- **Delegate analysis too.** If you need to understand a bug or explore the codebase, send that investigation as a task to the queue or a node. Do not do it yourself.
|
|
23327
|
-
- **Respect explicit provider requests.** If the user names an agent/provider, pass the matching provider type to \`mesh_launch_session\`: Hermes \u2192 \`hermes-cli\`, Claude Code/Claude \u2192 \`claude-cli\`, Codex \u2192 \`codex-cli\`, Gemini \u2192 \`gemini-cli\`. Never substitute \`claude-cli\` just because the coordinator itself is Claude Code.
|
|
23327
|
+
- **Respect explicit provider requests.** If the user names an agent/provider, pass the matching provider type to \`mesh_launch_session\`: Hermes \u2192 \`hermes-cli\`, Claude Code/Claude \u2192 \`claude-cli\`, Codex \u2192 \`codex-cli\`, Gemini \u2192 \`gemini-cli\`, Antigravity \u2192 \`antigravity-cli\`. Never substitute \`claude-cli\` just because the coordinator itself is Claude Code.
|
|
23328
23328
|
- **Front-load new task messages.** When calling \`mesh_enqueue_task\` or \`mesh_send_task\` for a new task, include everything the agent needs: what files to touch, what the problem is, what the fix should look like. The agent won't ask follow-up questions.
|
|
23329
23329
|
- **Avoid context-wasting restarts.** For follow-up, retry, commit/push, preview, or cleanup work on the same issue, prefer the existing idle session and send only the delta from its last verified state. Start a fresh chat/session only for genuinely independent work, explicit provider/user request, unsafe transcript contamination, or required branch/worktree isolation.
|
|
23330
23330
|
- **Don't inspect code.** Treat delegated agent summaries as self-reports, not verification. Verify side effects via \`mesh_git_status\` (including related repo freshness when configured), not by reading source files.
|
|
@@ -24969,14 +24969,26 @@ Follow these recovery rules:
|
|
|
24969
24969
|
const entry = entries[i];
|
|
24970
24970
|
if (entry.kind !== "task_completed" && entry.kind !== "task_failed" && entry.kind !== "task_stalled") continue;
|
|
24971
24971
|
if (args.sessionId && entry.sessionId === args.sessionId) {
|
|
24972
|
-
return { kind: entry.kind, payload: entry.payload || {}, timestamp: entry.timestamp };
|
|
24972
|
+
return { id: entry.id, kind: entry.kind, payload: entry.payload || {}, timestamp: entry.timestamp };
|
|
24973
24973
|
}
|
|
24974
24974
|
if (!args.sessionId && args.nodeId && entry.nodeId === args.nodeId) {
|
|
24975
|
-
return { kind: entry.kind, payload: entry.payload || {}, timestamp: entry.timestamp };
|
|
24975
|
+
return { id: entry.id, kind: entry.kind, payload: entry.payload || {}, timestamp: entry.timestamp };
|
|
24976
24976
|
}
|
|
24977
24977
|
}
|
|
24978
24978
|
return null;
|
|
24979
24979
|
}
|
|
24980
|
+
function hasDispatchAfterTerminal(meshId, sessionId, terminalId) {
|
|
24981
|
+
const entries = readLedgerEntries(meshId);
|
|
24982
|
+
let pastTerminal = false;
|
|
24983
|
+
for (const entry of entries) {
|
|
24984
|
+
if (!pastTerminal) {
|
|
24985
|
+
if (entry.id === terminalId) pastTerminal = true;
|
|
24986
|
+
continue;
|
|
24987
|
+
}
|
|
24988
|
+
if (entry.kind === "task_dispatched" && entry.sessionId === sessionId) return true;
|
|
24989
|
+
}
|
|
24990
|
+
return false;
|
|
24991
|
+
}
|
|
24980
24992
|
function buildLongGeneratingCompletionReconciliation(args) {
|
|
24981
24993
|
const sessionId = resolveEventSessionId(args.metadataEvent, args.sourceInstanceId);
|
|
24982
24994
|
const nodeId = readNonEmptyString2(args.nodeId) || readNonEmptyString2(args.metadataEvent.meshNodeId);
|
|
@@ -25481,13 +25493,16 @@ Next step: ${nextStep}`;
|
|
|
25481
25493
|
nodeId: eventNodeId || void 0
|
|
25482
25494
|
});
|
|
25483
25495
|
if (terminal?.kind === "task_completed" && !sessionHasActiveAssignment(args.meshId, eventSessionId)) {
|
|
25484
|
-
const
|
|
25485
|
-
|
|
25486
|
-
|
|
25487
|
-
|
|
25488
|
-
|
|
25489
|
-
|
|
25490
|
-
|
|
25496
|
+
const newDispatchAfterTerminal = hasDispatchAfterTerminal(args.meshId, eventSessionId, terminal.id);
|
|
25497
|
+
if (!newDispatchAfterTerminal) {
|
|
25498
|
+
const terminalProviderSessionId = readNonEmptyString2(terminal.payload.providerSessionId);
|
|
25499
|
+
const terminalFinalSummary = readNonEmptyString2(terminal.payload.finalSummary);
|
|
25500
|
+
const eventProviderSessionId = readNonEmptyString2(args.metadataEvent.providerSessionId);
|
|
25501
|
+
const eventFinalSummary = readNonEmptyString2(args.metadataEvent.finalSummary);
|
|
25502
|
+
if (terminalProviderSessionId && terminalProviderSessionId === eventProviderSessionId || terminalFinalSummary && terminalFinalSummary === eventFinalSummary || args.metadataEvent.source === "long_generating_reconciliation") {
|
|
25503
|
+
LOG2.info("MeshEvents", `Suppressed duplicate completion with existing terminal ledger evidence for mesh ${args.meshId} session ${eventSessionId}`);
|
|
25504
|
+
return { success: true, forwarded: 0, suppressed: true, duplicateCompletion: true, terminalLedgerEvidence: true };
|
|
25505
|
+
}
|
|
25491
25506
|
}
|
|
25492
25507
|
}
|
|
25493
25508
|
const duplicateCompletion = isDuplicateMeshCompletionEvent({
|
|
@@ -25714,7 +25729,13 @@ Next step: ${nextStep}`;
|
|
|
25714
25729
|
}
|
|
25715
25730
|
return { success: true, forwarded: 0 };
|
|
25716
25731
|
}
|
|
25717
|
-
|
|
25732
|
+
const allCoordinatorsGenerating = isRefineTerminalEvent && coordinatorInstances.every((inst) => {
|
|
25733
|
+
const s = inst.getState();
|
|
25734
|
+
const status = readNonEmptyString2(s.status).toLowerCase();
|
|
25735
|
+
const activeChatStatus = readNonEmptyString2(s.activeChat?.status).toLowerCase();
|
|
25736
|
+
return status === "generating" || status === "streaming" || status === "long_generating" || activeChatStatus === "generating" || activeChatStatus === "streaming";
|
|
25737
|
+
});
|
|
25738
|
+
if (!isRefineTerminalEvent || allCoordinatorsGenerating) {
|
|
25718
25739
|
if (queuePendingMeshCoordinatorEvent({
|
|
25719
25740
|
event: args.event,
|
|
25720
25741
|
meshId: args.meshId,
|
|
@@ -25728,9 +25749,16 @@ Next step: ${nextStep}`;
|
|
|
25728
25749
|
coordinatorMessage: messageText,
|
|
25729
25750
|
queuedAt: Date.now()
|
|
25730
25751
|
})) {
|
|
25731
|
-
|
|
25752
|
+
if (allCoordinatorsGenerating) {
|
|
25753
|
+
LOG2.info("MeshEvents", `Queued ${args.event} for generating CLI coordinator (mesh ${args.meshId}) \u2014 will be delivered via get_pending_mesh_events when coordinator returns to idle`);
|
|
25754
|
+
} else {
|
|
25755
|
+
LOG2.info("MeshEvents", `Queued ${args.event} for MCP coordinator (mesh ${args.meshId})`);
|
|
25756
|
+
}
|
|
25732
25757
|
}
|
|
25733
25758
|
}
|
|
25759
|
+
if (allCoordinatorsGenerating) {
|
|
25760
|
+
return { success: true, forwarded: 0, bufferedForGeneratingCoordinator: true };
|
|
25761
|
+
}
|
|
25734
25762
|
for (const coord of coordinatorInstances) {
|
|
25735
25763
|
const coordState = coord.getState();
|
|
25736
25764
|
LOG2.info("MeshEvents", `Forwarding mesh event to coordinator ${coordState.instanceId}`);
|
|
@@ -32316,6 +32344,7 @@ ${lastSnapshot}`;
|
|
|
32316
32344
|
statusCounts[item.status] += 1;
|
|
32317
32345
|
}
|
|
32318
32346
|
const staleDirectCount = activeWork.filter((item) => item.source === "direct" && item.staleReason).length;
|
|
32347
|
+
const staleDirectUnacknowledgedCount = activeWork.filter((item) => item.source === "direct" && item.staleDispatchUnacknowledged).length;
|
|
32319
32348
|
return {
|
|
32320
32349
|
totalActiveCount: activeWork.length,
|
|
32321
32350
|
queueActiveCount: sourceCounts.queue,
|
|
@@ -32327,6 +32356,7 @@ ${lastSnapshot}`;
|
|
|
32327
32356
|
sourceCounts,
|
|
32328
32357
|
statusCounts,
|
|
32329
32358
|
staleDirectCount,
|
|
32359
|
+
...staleDirectUnacknowledgedCount > 0 ? { staleDirectUnacknowledgedCount } : {},
|
|
32330
32360
|
...staleDirectCount > 0 ? { staleDirectNote: "Stale direct records are orphaned ledger entries whose node/session no longer exists. They are historical recovery evidence only \u2014 not active or unresolved work. The queue (source: queue) is authoritative for pending/assigned tasks." } : {}
|
|
32331
32361
|
};
|
|
32332
32362
|
}
|
|
@@ -32363,9 +32393,13 @@ ${lastSnapshot}`;
|
|
|
32363
32393
|
const live = sessionStatusFromNodes(opts.nodes, dispatch.nodeId, dispatch.sessionId);
|
|
32364
32394
|
const status = terminalStatus || live.status || "assigned";
|
|
32365
32395
|
const terminalRow = Boolean(terminal && terminal.kind !== "task_approval_needed");
|
|
32366
|
-
const
|
|
32396
|
+
const dispatchedToIdleSession = dispatch.payload?.dispatchedToIdleSession === true;
|
|
32397
|
+
const isNoTransition = !terminalStatus && !live.status;
|
|
32398
|
+
const isIdleUnacknowledged = status === "idle";
|
|
32399
|
+
const ledgerOnlyStaleReason = !terminalRow && (isIdleUnacknowledged || isNoTransition || dispatchedToIdleSession && isIdleUnacknowledged) ? "direct task dispatch has no provider acknowledgement, transcript append, or active runtime transition" : void 0;
|
|
32367
32400
|
const message = readString2(dispatch.payload?.message) || readString2(dispatch.payload?.summary) || "";
|
|
32368
32401
|
const { title, summary: summary2 } = summarizeMessage(message);
|
|
32402
|
+
const isFreshUnacknowledged = Boolean(ledgerOnlyStaleReason && !live.staleReason);
|
|
32369
32403
|
const record2 = {
|
|
32370
32404
|
taskId,
|
|
32371
32405
|
source: "direct",
|
|
@@ -32384,7 +32418,8 @@ ${lastSnapshot}`;
|
|
|
32384
32418
|
terminal: terminalRow,
|
|
32385
32419
|
terminalKind: terminal?.kind,
|
|
32386
32420
|
terminalAt: terminal?.timestamp,
|
|
32387
|
-
staleReason: live.staleReason || ledgerOnlyStaleReason
|
|
32421
|
+
staleReason: live.staleReason || ledgerOnlyStaleReason,
|
|
32422
|
+
...isFreshUnacknowledged ? { staleDispatchUnacknowledged: true } : {}
|
|
32388
32423
|
};
|
|
32389
32424
|
if (terminalRow) {
|
|
32390
32425
|
terminalDirectWork.push(record2);
|
|
@@ -32401,7 +32436,11 @@ ${lastSnapshot}`;
|
|
|
32401
32436
|
terminalDirectWork.sort((a, b) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime());
|
|
32402
32437
|
const summary = buildMeshActiveWorkSummary(records);
|
|
32403
32438
|
summary.staleDirectCount = staleDirectWork.length;
|
|
32404
|
-
const
|
|
32439
|
+
const unacknowledgedCount = staleDirectWork.filter((r) => r.staleDispatchUnacknowledged).length;
|
|
32440
|
+
if (unacknowledgedCount > 0) {
|
|
32441
|
+
summary.staleDirectUnacknowledgedCount = unacknowledgedCount;
|
|
32442
|
+
}
|
|
32443
|
+
const staleDirectWorkNote = staleDirectWork.length > 0 ? unacknowledgedCount > 0 && unacknowledgedCount === staleDirectWork.length ? `${unacknowledgedCount} direct dispatch(es) were not acknowledged by the target session \u2014 the session received the agent_command but never transitioned to generating. This is a fresh dispatch failure, not historical noise. Recovery: launch a fresh session on the same node and retry the task, or use mesh_enqueue_task for queue-based assignment.` : unacknowledgedCount > 0 ? `${unacknowledgedCount} of ${staleDirectWork.length} stale direct record(s) are fresh unacknowledged dispatch failures (session still live but never transitioned to generating); the rest are orphaned historical entries whose node/session no longer exists. Fresh unacknowledged dispatches need recovery: launch a fresh session and retry. Orphaned entries are historical evidence only \u2014 not active or unresolved work.` : "These are orphaned ledger entries whose original node or session no longer exists in the live mesh. They are historical/recovery evidence only \u2014 not active or unresolved work. Do not treat staleDirectCount as a status mismatch; use the queue (source: queue) as authoritative for pending/assigned tasks." : void 0;
|
|
32405
32444
|
if (staleDirectWorkNote) {
|
|
32406
32445
|
summary.staleDirectNote = staleDirectWorkNote;
|
|
32407
32446
|
}
|
|
@@ -43332,7 +43371,10 @@ ${effect.notification.body || ""}`.trim();
|
|
|
43332
43371
|
if (!isCliGeneratingLikeStatus(parsedRawStatus)) return false;
|
|
43333
43372
|
if (adapterRawStatus !== "idle") return false;
|
|
43334
43373
|
if (hasNonEmptyCliModalButtons(parsedStatus?.activeModal ?? parsedStatus?.modal)) return false;
|
|
43335
|
-
|
|
43374
|
+
if (this.hasAdapterPendingResponse()) return false;
|
|
43375
|
+
const adapterAny = this.adapter;
|
|
43376
|
+
if (typeof adapterAny?.responseBuffer === "string" && adapterAny.responseBuffer.trim()) return false;
|
|
43377
|
+
return true;
|
|
43336
43378
|
}
|
|
43337
43379
|
getCompletedFinalizationBlock(latestVisibleStatus) {
|
|
43338
43380
|
if (latestVisibleStatus !== "idle") return { reason: `status:${latestVisibleStatus}`, terminal: true };
|
|
@@ -43530,13 +43572,30 @@ ${effect.notification.body || ""}`.trim();
|
|
|
43530
43572
|
} else if (newStatus === "idle" && (this.lastStatus === "generating" || this.lastStatus === "waiting_approval")) {
|
|
43531
43573
|
const duration3 = this.generatingStartedAt ? Math.round((now - this.generatingStartedAt) / 1e3) : 0;
|
|
43532
43574
|
if (this.generatingDebouncePending) {
|
|
43533
|
-
|
|
43575
|
+
const shortDurationMs = this.generatingStartedAt ? now - this.generatingStartedAt : 0;
|
|
43576
|
+
LOG2.info("CLI", `[${this.type}] suppressed short generating (${shortDurationMs}ms)`);
|
|
43534
43577
|
if (this.generatingDebounceTimer) {
|
|
43535
43578
|
clearTimeout(this.generatingDebounceTimer);
|
|
43536
43579
|
this.generatingDebounceTimer = null;
|
|
43537
43580
|
}
|
|
43538
43581
|
this.generatingDebouncePending = null;
|
|
43539
43582
|
this.generatingStartedAt = 0;
|
|
43583
|
+
let shortFinalSummary;
|
|
43584
|
+
try {
|
|
43585
|
+
shortFinalSummary = extractFinalSummaryFromMessages(this.adapter?.getScriptParsedStatus()?.messages);
|
|
43586
|
+
} catch {
|
|
43587
|
+
}
|
|
43588
|
+
this.pushEvent({
|
|
43589
|
+
event: "agent:generating_completed",
|
|
43590
|
+
chatTitle,
|
|
43591
|
+
duration: 0,
|
|
43592
|
+
timestamp: now,
|
|
43593
|
+
finalSummary: shortFinalSummary,
|
|
43594
|
+
completionDiagnostic: {
|
|
43595
|
+
reason: "short_generating_suppressed",
|
|
43596
|
+
shortDurationMs
|
|
43597
|
+
}
|
|
43598
|
+
});
|
|
43540
43599
|
} else {
|
|
43541
43600
|
this.completedDebouncePending = { chatTitle, duration: duration3, timestamp: now, firstObservedAt: now };
|
|
43542
43601
|
this.scheduleCompletedDebounceFlush(3e3);
|