@adhdev/daemon-core 0.9.82-rc.100 → 0.9.82-rc.101
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/cli-adapters/provider-cli-adapter.d.ts +3 -0
- package/dist/index.js +60 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +60 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/cli-adapters/provider-cli-adapter.ts +64 -0
- package/src/providers/cli-provider-instance.ts +9 -3
package/dist/index.mjs
CHANGED
|
@@ -5610,6 +5610,11 @@ ${lastSnapshot}`;
|
|
|
5610
5610
|
this.idleTimeout = setTimeout(() => {
|
|
5611
5611
|
if (this.isWaitingForResponse && !this.hasActionableApproval()) {
|
|
5612
5612
|
if (this.shouldDeferIdleTimeoutFinish()) return;
|
|
5613
|
+
const parsed = this.runParseSession();
|
|
5614
|
+
if (this.shouldKeepCodexTurnOpenForFinish(parsed)) {
|
|
5615
|
+
this.rescheduleCodexFinishCheck("codex_idle_timeout_not_final");
|
|
5616
|
+
return;
|
|
5617
|
+
}
|
|
5613
5618
|
this.clearIdleFinishCandidate("idle_timeout_finish");
|
|
5614
5619
|
this.finishResponse();
|
|
5615
5620
|
}
|
|
@@ -5618,6 +5623,11 @@ ${lastSnapshot}`;
|
|
|
5618
5623
|
finishResponse() {
|
|
5619
5624
|
if (this.submitPendingUntil > Date.now()) return;
|
|
5620
5625
|
if (this.responseSettleIgnoreUntil > Date.now()) return;
|
|
5626
|
+
const parsedBeforeFinish = this.runParseSession();
|
|
5627
|
+
if (this.shouldKeepCodexTurnOpenForFinish(parsedBeforeFinish)) {
|
|
5628
|
+
this.rescheduleCodexFinishCheck("codex_finish_not_final");
|
|
5629
|
+
return;
|
|
5630
|
+
}
|
|
5621
5631
|
this.clearIdleFinishCandidate("finish_response_enter");
|
|
5622
5632
|
this.recordTrace("finish_response", {
|
|
5623
5633
|
...buildCliTraceParseSnapshot({
|
|
@@ -5833,6 +5843,44 @@ ${lastSnapshot}`;
|
|
|
5833
5843
|
});
|
|
5834
5844
|
return !!lastAssistant;
|
|
5835
5845
|
}
|
|
5846
|
+
parsedStatusHasFinalStandardAssistantMessage(parsed) {
|
|
5847
|
+
const messages = Array.isArray(parsed?.messages) ? parsed.messages : [];
|
|
5848
|
+
const lastAssistant = [...messages].reverse().find((message) => {
|
|
5849
|
+
if (!message || message.role !== "assistant") return false;
|
|
5850
|
+
return typeof message.content === "string" && message.content.trim().length > 0;
|
|
5851
|
+
});
|
|
5852
|
+
if (!lastAssistant) return false;
|
|
5853
|
+
const kind = typeof lastAssistant.kind === "string" && lastAssistant.kind.trim() ? lastAssistant.kind.trim() : "standard";
|
|
5854
|
+
return kind === "standard" && lastAssistant.meta?.streaming !== true;
|
|
5855
|
+
}
|
|
5856
|
+
shouldKeepCodexTurnOpenForFinish(parsed) {
|
|
5857
|
+
if (this.cliType !== "codex-cli") return false;
|
|
5858
|
+
if (!this.isWaitingForResponse || !this.currentTurnScope || this.hasActionableApproval()) return false;
|
|
5859
|
+
const parsedStatus = typeof parsed?.status === "string" ? parsed.status.trim() : "";
|
|
5860
|
+
if (parsedStatus !== "idle") return true;
|
|
5861
|
+
if (parsed?.activeModal || parsed?.modal) return true;
|
|
5862
|
+
return !this.parsedStatusHasFinalStandardAssistantMessage(parsed);
|
|
5863
|
+
}
|
|
5864
|
+
rescheduleCodexFinishCheck(reason) {
|
|
5865
|
+
this.clearIdleFinishCandidate(reason);
|
|
5866
|
+
this.setStatus("generating", reason);
|
|
5867
|
+
if (this.idleTimeout) clearTimeout(this.idleTimeout);
|
|
5868
|
+
this.idleTimeout = setTimeout(() => {
|
|
5869
|
+
if (!this.isWaitingForResponse || this.hasActionableApproval()) return;
|
|
5870
|
+
this.settledBuffer = this.recentOutputBuffer;
|
|
5871
|
+
this.evaluateSettled();
|
|
5872
|
+
}, this.getIdleFinishConfirmMs());
|
|
5873
|
+
this.recordTrace("codex_finish_deferred", {
|
|
5874
|
+
reason,
|
|
5875
|
+
...buildCliTraceParseSnapshot({
|
|
5876
|
+
accumulatedBuffer: this.accumulatedBuffer,
|
|
5877
|
+
accumulatedRawBuffer: this.accumulatedRawBuffer,
|
|
5878
|
+
responseBuffer: this.responseBuffer,
|
|
5879
|
+
partialResponse: this.responseBuffer,
|
|
5880
|
+
scope: this.currentTurnScope
|
|
5881
|
+
})
|
|
5882
|
+
});
|
|
5883
|
+
}
|
|
5836
5884
|
projectEffectiveStatus(startupModal = null) {
|
|
5837
5885
|
if (this.parseErrorMessage) return "error";
|
|
5838
5886
|
if (this.hasActionableApproval(startupModal)) return "waiting_approval";
|
|
@@ -5910,6 +5958,8 @@ ${lastSnapshot}`;
|
|
|
5910
5958
|
}),
|
|
5911
5959
|
activeModal,
|
|
5912
5960
|
providerSessionId: typeof parsed.providerSessionId === "string" ? parsed.providerSessionId : void 0,
|
|
5961
|
+
errorMessage: typeof parsed.errorMessage === "string" && parsed.errorMessage.trim() ? parsed.errorMessage.trim() : void 0,
|
|
5962
|
+
errorReason: typeof parsed.errorReason === "string" && parsed.errorReason.trim() ? parsed.errorReason.trim() : void 0,
|
|
5913
5963
|
...bufferState ? { bufferState } : {},
|
|
5914
5964
|
...parsed.transcriptAuthority === "provider" || parsed.transcriptAuthority === "daemon" ? { transcriptAuthority: parsed.transcriptAuthority } : this.providerOwnsTranscript() ? { transcriptAuthority: "provider" } : {},
|
|
5915
5965
|
...parsed.coverage === "full" || parsed.coverage === "tail" || parsed.coverage === "current-turn" ? { coverage: parsed.coverage } : this.providerOwnsTranscript() ? { coverage: this.shouldUseFullProviderTranscriptContext() ? "full" : "tail" } : {}
|
|
@@ -6713,6 +6763,9 @@ ${lastSnapshot}`;
|
|
|
6713
6763
|
const parsedDebugState = this.getParsedDebugState();
|
|
6714
6764
|
const parsedMessages = Array.isArray(parsedDebugState?.messages) ? parsedDebugState.messages : [];
|
|
6715
6765
|
let effectiveStatus = this.projectEffectiveStatus(startupModal);
|
|
6766
|
+
if (parsedDebugState?.status === "error") {
|
|
6767
|
+
effectiveStatus = "error";
|
|
6768
|
+
}
|
|
6716
6769
|
if (startupDetectedStatus === "waiting_approval") {
|
|
6717
6770
|
effectiveStatus = "waiting_approval";
|
|
6718
6771
|
}
|
|
@@ -6740,6 +6793,8 @@ ${lastSnapshot}`;
|
|
|
6740
6793
|
providerSessionId: parsedDebugState.providerSessionId,
|
|
6741
6794
|
transcriptAuthority: parsedDebugState.transcriptAuthority,
|
|
6742
6795
|
coverage: parsedDebugState.coverage,
|
|
6796
|
+
errorMessage: parsedDebugState.errorMessage,
|
|
6797
|
+
errorReason: parsedDebugState.errorReason,
|
|
6743
6798
|
activeModal: parsedDebugState.activeModal,
|
|
6744
6799
|
messageCount: parsedMessages.length
|
|
6745
6800
|
} : null,
|
|
@@ -19690,8 +19745,10 @@ var CliProviderInstance = class {
|
|
|
19690
19745
|
if (typeof this.adapter.getScriptParsedStatus === "function") {
|
|
19691
19746
|
try {
|
|
19692
19747
|
parsedStatus = this.adapter.getScriptParsedStatus() || null;
|
|
19693
|
-
|
|
19694
|
-
|
|
19748
|
+
const parsedErrorMessage = typeof parsedStatus?.errorMessage === "string" && parsedStatus.errorMessage.trim() ? parsedStatus.errorMessage.trim() : void 0;
|
|
19749
|
+
const parsedErrorReason = typeof parsedStatus?.errorReason === "string" && parsedStatus.errorReason.trim() ? parsedStatus.errorReason.trim() : void 0;
|
|
19750
|
+
this.errorMessage = parsedErrorMessage;
|
|
19751
|
+
this.errorReason = parsedErrorReason;
|
|
19695
19752
|
} catch (error) {
|
|
19696
19753
|
parseErrorMessage = error?.message || String(error);
|
|
19697
19754
|
this.errorMessage = parseErrorMessage;
|
|
@@ -19702,7 +19759,7 @@ var CliProviderInstance = class {
|
|
|
19702
19759
|
this.errorReason = void 0;
|
|
19703
19760
|
}
|
|
19704
19761
|
const autoApproveActive = this.maybeAutoApproveStatus(adapterStatus, Date.now());
|
|
19705
|
-
const visibleStatus = parseErrorMessage ? "error" : autoApproveActive ? "generating" : adapterStatus.status;
|
|
19762
|
+
const visibleStatus = parseErrorMessage || parsedStatus?.status === "error" ? "error" : autoApproveActive ? "generating" : adapterStatus.status;
|
|
19706
19763
|
const parsedProviderSessionId = normalizeProviderSessionId(
|
|
19707
19764
|
this.provider,
|
|
19708
19765
|
typeof parsedStatus?.providerSessionId === "string" ? parsedStatus.providerSessionId : ""
|