@adhdev/daemon-standalone 0.9.82-rc.57 → 0.9.82-rc.58
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
CHANGED
|
@@ -24432,10 +24432,15 @@ Follow these recovery rules:
|
|
|
24432
24432
|
return typeof eventName === "string" && MESH_COORDINATOR_EVENTS.has(eventName);
|
|
24433
24433
|
}
|
|
24434
24434
|
function formatCompletionMetadata(event) {
|
|
24435
|
+
const completionDiagnostic = event.completionDiagnostic && typeof event.completionDiagnostic === "object" ? event.completionDiagnostic : null;
|
|
24436
|
+
const diagnosticReason = completionDiagnostic ? readNonEmptyString(completionDiagnostic.blockReason) || "present" : "";
|
|
24437
|
+
const finalAssistantPresent = typeof completionDiagnostic?.finalAssistantPresent === "boolean" ? String(completionDiagnostic.finalAssistantPresent) : "";
|
|
24435
24438
|
const parts = [
|
|
24436
24439
|
readNonEmptyString(event.targetSessionId) ? `session_id=${readNonEmptyString(event.targetSessionId)}` : "",
|
|
24437
24440
|
readNonEmptyString(event.providerType) ? `provider=${readNonEmptyString(event.providerType)}` : "",
|
|
24438
|
-
readNonEmptyString(event.providerSessionId) ? `provider_session_id=${readNonEmptyString(event.providerSessionId)}` : ""
|
|
24441
|
+
readNonEmptyString(event.providerSessionId) ? `provider_session_id=${readNonEmptyString(event.providerSessionId)}` : "",
|
|
24442
|
+
diagnosticReason ? `completion_diagnostic=${diagnosticReason}` : "",
|
|
24443
|
+
finalAssistantPresent ? `final_assistant=${finalAssistantPresent}` : ""
|
|
24439
24444
|
].filter(Boolean);
|
|
24440
24445
|
return parts.length > 0 ? ` (${parts.join("; ")})` : "";
|
|
24441
24446
|
}
|
|
@@ -24979,6 +24984,7 @@ Do NOT retry on this node. Consider reassigning to a different node or asking th
|
|
|
24979
24984
|
taskId: completedTaskForLedger?.id || void 0,
|
|
24980
24985
|
providerSessionId: readNonEmptyString(args.metadataEvent.providerSessionId) || void 0,
|
|
24981
24986
|
finalSummary: readNonEmptyString(args.metadataEvent.finalSummary) || void 0,
|
|
24987
|
+
completionDiagnostic: args.metadataEvent.completionDiagnostic && typeof args.metadataEvent.completionDiagnostic === "object" ? args.metadataEvent.completionDiagnostic : void 0,
|
|
24982
24988
|
evidence: completionEvidence
|
|
24983
24989
|
}
|
|
24984
24990
|
});
|
|
@@ -26067,7 +26073,9 @@ Do NOT retry on this node. Consider reassigning to a different node or asking th
|
|
|
26067
26073
|
const configuredCommand = typeof runtimeSettings.executablePath === "string" && runtimeSettings.executablePath.trim() ? runtimeSettings.executablePath.trim() : spawnConfig.command;
|
|
26068
26074
|
const binaryPath = findBinary(configuredCommand);
|
|
26069
26075
|
const isWin = os10.platform() === "win32";
|
|
26070
|
-
const allArgs = [...spawnConfig.args, ...extraArgs]
|
|
26076
|
+
const allArgs = [...spawnConfig.args, ...extraArgs].map(
|
|
26077
|
+
(arg) => typeof arg === "string" ? arg.replace(/\{\{workingDir\}\}/g, workingDir) : arg
|
|
26078
|
+
);
|
|
26071
26079
|
let shellCmd;
|
|
26072
26080
|
let shellArgs;
|
|
26073
26081
|
const useShellUnix = !isWin && (!!spawnConfig.shell || !path15.isAbsolute(binaryPath) || isScriptBinary(binaryPath) || !looksLikeMachOOrElf(binaryPath));
|
|
@@ -40787,6 +40795,44 @@ ${effect.notification.body || ""}`.trim();
|
|
|
40787
40795
|
const content = lastVisible ? flattenContent(lastVisible.content).trim() : "";
|
|
40788
40796
|
return role === "assistant" && !!content;
|
|
40789
40797
|
}
|
|
40798
|
+
buildCompletedFinalizationDiagnostic(args) {
|
|
40799
|
+
let parsed = null;
|
|
40800
|
+
let parseError;
|
|
40801
|
+
try {
|
|
40802
|
+
parsed = this.adapter.getScriptParsedStatus();
|
|
40803
|
+
} catch (error48) {
|
|
40804
|
+
parseError = error48?.message || String(error48);
|
|
40805
|
+
}
|
|
40806
|
+
const visibleMessages = (Array.isArray(parsed?.messages) ? parsed.messages : []).filter((message) => isUserFacingChatMessage(message));
|
|
40807
|
+
const lastVisible = visibleMessages[visibleMessages.length - 1];
|
|
40808
|
+
const lastVisibleRole = typeof lastVisible?.role === "string" ? lastVisible.role.trim().toLowerCase() : null;
|
|
40809
|
+
const lastVisibleKind = typeof lastVisible?.kind === "string" ? lastVisible.kind : null;
|
|
40810
|
+
const lastVisibleContentLength = lastVisible ? flattenContent(lastVisible.content).trim().length : 0;
|
|
40811
|
+
return {
|
|
40812
|
+
providerType: this.type,
|
|
40813
|
+
sessionId: this.instanceId,
|
|
40814
|
+
providerSessionId: this.providerSessionId || null,
|
|
40815
|
+
workspace: this.workingDir,
|
|
40816
|
+
blockReason: args.blockReason,
|
|
40817
|
+
emittedAfterFinalizationTimeout: args.emittedAfterFinalizationTimeout,
|
|
40818
|
+
waitedMs: args.waitedMs,
|
|
40819
|
+
maxWaitMs: COMPLETED_FINALIZATION_MAX_WAIT_MS,
|
|
40820
|
+
adapterStatus: typeof args.latestStatus?.status === "string" ? args.latestStatus.status : null,
|
|
40821
|
+
latestVisibleStatus: args.latestVisibleStatus,
|
|
40822
|
+
parsedStatus: typeof parsed?.status === "string" ? parsed.status : parseError ? "parse_error" : "unknown",
|
|
40823
|
+
parseError: parseError || void 0,
|
|
40824
|
+
finalAssistantPresent: this.completionHasFinalAssistantMessage(parsed?.messages),
|
|
40825
|
+
visibleMessageCount: visibleMessages.length,
|
|
40826
|
+
lastVisibleRole,
|
|
40827
|
+
lastVisibleKind,
|
|
40828
|
+
lastVisibleContentLength,
|
|
40829
|
+
pendingStartedAt: this.generatingStartedAt || null,
|
|
40830
|
+
pendingFirstObservedAt: args.pending.firstObservedAt,
|
|
40831
|
+
pendingTimestamp: args.pending.timestamp,
|
|
40832
|
+
pendingDurationSec: args.pending.duration,
|
|
40833
|
+
previousBlockReason: args.pending.loggedBlockReason || null
|
|
40834
|
+
};
|
|
40835
|
+
}
|
|
40790
40836
|
hasAdapterPendingResponse() {
|
|
40791
40837
|
const adapterAny = this.adapter;
|
|
40792
40838
|
if (adapterAny?.isWaitingForResponse === true) return true;
|
|
@@ -40859,7 +40905,23 @@ ${effect.notification.body || ""}`.trim();
|
|
|
40859
40905
|
this.scheduleCompletedDebounceFlush(COMPLETED_FINALIZATION_RETRY_MS);
|
|
40860
40906
|
return;
|
|
40861
40907
|
}
|
|
40862
|
-
|
|
40908
|
+
const completionDiagnostic = this.buildCompletedFinalizationDiagnostic({
|
|
40909
|
+
blockReason,
|
|
40910
|
+
latestStatus,
|
|
40911
|
+
latestVisibleStatus,
|
|
40912
|
+
waitedMs,
|
|
40913
|
+
pending,
|
|
40914
|
+
emittedAfterFinalizationTimeout: true
|
|
40915
|
+
});
|
|
40916
|
+
LOG2.warn("CLI", `[${this.type}] emitting completed event after ${waitedMs}ms without finalized assistant turn (${blockReason})`);
|
|
40917
|
+
this.pushEvent({
|
|
40918
|
+
event: "agent:generating_completed",
|
|
40919
|
+
chatTitle: pending.chatTitle,
|
|
40920
|
+
duration: pending.duration,
|
|
40921
|
+
timestamp: pending.timestamp,
|
|
40922
|
+
finalSummary: extractFinalSummaryFromMessages(this.adapter?.getScriptParsedStatus()?.messages),
|
|
40923
|
+
completionDiagnostic
|
|
40924
|
+
});
|
|
40863
40925
|
this.completedDebouncePending = null;
|
|
40864
40926
|
this.completedDebounceTimer = null;
|
|
40865
40927
|
this.generatingStartedAt = 0;
|