@adhdev/daemon-core 0.9.82-rc.133 → 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 +46 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +46 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/mesh/mesh-events.ts +35 -14
- package/src/providers/cli-provider-instance.ts +30 -3
package/dist/index.mjs
CHANGED
|
@@ -2814,14 +2814,26 @@ function findRecentTerminalLedgerEvidence(args) {
|
|
|
2814
2814
|
const entry = entries[i];
|
|
2815
2815
|
if (entry.kind !== "task_completed" && entry.kind !== "task_failed" && entry.kind !== "task_stalled") continue;
|
|
2816
2816
|
if (args.sessionId && entry.sessionId === args.sessionId) {
|
|
2817
|
-
return { kind: entry.kind, payload: entry.payload || {}, timestamp: entry.timestamp };
|
|
2817
|
+
return { id: entry.id, kind: entry.kind, payload: entry.payload || {}, timestamp: entry.timestamp };
|
|
2818
2818
|
}
|
|
2819
2819
|
if (!args.sessionId && args.nodeId && entry.nodeId === args.nodeId) {
|
|
2820
|
-
return { kind: entry.kind, payload: entry.payload || {}, timestamp: entry.timestamp };
|
|
2820
|
+
return { id: entry.id, kind: entry.kind, payload: entry.payload || {}, timestamp: entry.timestamp };
|
|
2821
2821
|
}
|
|
2822
2822
|
}
|
|
2823
2823
|
return null;
|
|
2824
2824
|
}
|
|
2825
|
+
function hasDispatchAfterTerminal(meshId, sessionId, terminalId) {
|
|
2826
|
+
const entries = readLedgerEntries(meshId);
|
|
2827
|
+
let pastTerminal = false;
|
|
2828
|
+
for (const entry of entries) {
|
|
2829
|
+
if (!pastTerminal) {
|
|
2830
|
+
if (entry.id === terminalId) pastTerminal = true;
|
|
2831
|
+
continue;
|
|
2832
|
+
}
|
|
2833
|
+
if (entry.kind === "task_dispatched" && entry.sessionId === sessionId) return true;
|
|
2834
|
+
}
|
|
2835
|
+
return false;
|
|
2836
|
+
}
|
|
2825
2837
|
function buildLongGeneratingCompletionReconciliation(args) {
|
|
2826
2838
|
const sessionId = resolveEventSessionId(args.metadataEvent, args.sourceInstanceId);
|
|
2827
2839
|
const nodeId = readNonEmptyString2(args.nodeId) || readNonEmptyString2(args.metadataEvent.meshNodeId);
|
|
@@ -3326,13 +3338,16 @@ function injectMeshSystemMessage(components, args) {
|
|
|
3326
3338
|
nodeId: eventNodeId || void 0
|
|
3327
3339
|
});
|
|
3328
3340
|
if (terminal?.kind === "task_completed" && !sessionHasActiveAssignment(args.meshId, eventSessionId)) {
|
|
3329
|
-
const
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3341
|
+
const newDispatchAfterTerminal = hasDispatchAfterTerminal(args.meshId, eventSessionId, terminal.id);
|
|
3342
|
+
if (!newDispatchAfterTerminal) {
|
|
3343
|
+
const terminalProviderSessionId = readNonEmptyString2(terminal.payload.providerSessionId);
|
|
3344
|
+
const terminalFinalSummary = readNonEmptyString2(terminal.payload.finalSummary);
|
|
3345
|
+
const eventProviderSessionId = readNonEmptyString2(args.metadataEvent.providerSessionId);
|
|
3346
|
+
const eventFinalSummary = readNonEmptyString2(args.metadataEvent.finalSummary);
|
|
3347
|
+
if (terminalProviderSessionId && terminalProviderSessionId === eventProviderSessionId || terminalFinalSummary && terminalFinalSummary === eventFinalSummary || args.metadataEvent.source === "long_generating_reconciliation") {
|
|
3348
|
+
LOG.info("MeshEvents", `Suppressed duplicate completion with existing terminal ledger evidence for mesh ${args.meshId} session ${eventSessionId}`);
|
|
3349
|
+
return { success: true, forwarded: 0, suppressed: true, duplicateCompletion: true, terminalLedgerEvidence: true };
|
|
3350
|
+
}
|
|
3336
3351
|
}
|
|
3337
3352
|
}
|
|
3338
3353
|
const duplicateCompletion = isDuplicateMeshCompletionEvent({
|
|
@@ -21086,7 +21101,10 @@ var CliProviderInstance = class {
|
|
|
21086
21101
|
if (!isCliGeneratingLikeStatus(parsedRawStatus)) return false;
|
|
21087
21102
|
if (adapterRawStatus !== "idle") return false;
|
|
21088
21103
|
if (hasNonEmptyCliModalButtons(parsedStatus?.activeModal ?? parsedStatus?.modal)) return false;
|
|
21089
|
-
|
|
21104
|
+
if (this.hasAdapterPendingResponse()) return false;
|
|
21105
|
+
const adapterAny = this.adapter;
|
|
21106
|
+
if (typeof adapterAny?.responseBuffer === "string" && adapterAny.responseBuffer.trim()) return false;
|
|
21107
|
+
return true;
|
|
21090
21108
|
}
|
|
21091
21109
|
getCompletedFinalizationBlock(latestVisibleStatus) {
|
|
21092
21110
|
if (latestVisibleStatus !== "idle") return { reason: `status:${latestVisibleStatus}`, terminal: true };
|
|
@@ -21284,13 +21302,30 @@ var CliProviderInstance = class {
|
|
|
21284
21302
|
} else if (newStatus === "idle" && (this.lastStatus === "generating" || this.lastStatus === "waiting_approval")) {
|
|
21285
21303
|
const duration = this.generatingStartedAt ? Math.round((now - this.generatingStartedAt) / 1e3) : 0;
|
|
21286
21304
|
if (this.generatingDebouncePending) {
|
|
21287
|
-
|
|
21305
|
+
const shortDurationMs = this.generatingStartedAt ? now - this.generatingStartedAt : 0;
|
|
21306
|
+
LOG.info("CLI", `[${this.type}] suppressed short generating (${shortDurationMs}ms)`);
|
|
21288
21307
|
if (this.generatingDebounceTimer) {
|
|
21289
21308
|
clearTimeout(this.generatingDebounceTimer);
|
|
21290
21309
|
this.generatingDebounceTimer = null;
|
|
21291
21310
|
}
|
|
21292
21311
|
this.generatingDebouncePending = null;
|
|
21293
21312
|
this.generatingStartedAt = 0;
|
|
21313
|
+
let shortFinalSummary;
|
|
21314
|
+
try {
|
|
21315
|
+
shortFinalSummary = extractFinalSummaryFromMessages(this.adapter?.getScriptParsedStatus()?.messages);
|
|
21316
|
+
} catch {
|
|
21317
|
+
}
|
|
21318
|
+
this.pushEvent({
|
|
21319
|
+
event: "agent:generating_completed",
|
|
21320
|
+
chatTitle,
|
|
21321
|
+
duration: 0,
|
|
21322
|
+
timestamp: now,
|
|
21323
|
+
finalSummary: shortFinalSummary,
|
|
21324
|
+
completionDiagnostic: {
|
|
21325
|
+
reason: "short_generating_suppressed",
|
|
21326
|
+
shortDurationMs
|
|
21327
|
+
}
|
|
21328
|
+
});
|
|
21294
21329
|
} else {
|
|
21295
21330
|
this.completedDebouncePending = { chatTitle, duration, timestamp: now, firstObservedAt: now };
|
|
21296
21331
|
this.scheduleCompletedDebounceFlush(3e3);
|