@adhdev/daemon-core 0.8.88 → 0.8.89
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.mjs
CHANGED
|
@@ -2459,8 +2459,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
2459
2459
|
const buttons = Array.isArray(modal.buttons) ? modal.buttons : [];
|
|
2460
2460
|
if (buttons.length !== 1) return false;
|
|
2461
2461
|
const buttonLabel = String(buttons[0] || "").trim();
|
|
2462
|
-
|
|
2463
|
-
return looksLikeConfirmOnlyLabel(buttonLabel) || /Quick safety check|project trust|trust (?:this project|the contents of this directory|the files in this folder)|Enter to confirm/i.test(modalText);
|
|
2462
|
+
return looksLikeConfirmOnlyLabel(buttonLabel);
|
|
2464
2463
|
}
|
|
2465
2464
|
async waitForInteractivePrompt(maxWaitMs = 5e3) {
|
|
2466
2465
|
const startedAt = Date.now();
|
|
@@ -3076,11 +3075,14 @@ var init_provider_cli_adapter = __esm({
|
|
|
3076
3075
|
}
|
|
3077
3076
|
// ─── Public API (CliAdapter) ───────────────────
|
|
3078
3077
|
getStatus() {
|
|
3078
|
+
const screenText = this.terminalScreen.getText() || "";
|
|
3079
|
+
const startupModal = this.startupParseGate ? this.getStartupConfirmationModal(screenText) : null;
|
|
3080
|
+
const effectiveStatus = this.parseErrorMessage ? "error" : startupModal ? "waiting_approval" : this.currentStatus;
|
|
3079
3081
|
return {
|
|
3080
|
-
status:
|
|
3082
|
+
status: effectiveStatus,
|
|
3081
3083
|
messages: [...this.committedMessages],
|
|
3082
3084
|
workingDir: this.workingDir,
|
|
3083
|
-
activeModal: this.activeModal,
|
|
3085
|
+
activeModal: startupModal || this.activeModal,
|
|
3084
3086
|
errorMessage: this.parseErrorMessage || void 0,
|
|
3085
3087
|
errorReason: this.parseErrorMessage ? "parse_error" : void 0
|
|
3086
3088
|
};
|
|
@@ -3134,7 +3136,8 @@ var init_provider_cli_adapter = __esm({
|
|
|
3134
3136
|
receivedAt: typeof message.receivedAt === "number" ? message.receivedAt : message.timestamp
|
|
3135
3137
|
}));
|
|
3136
3138
|
const parsedLastAssistant = [...parsedHydratedMessages].reverse().find((message) => message.role === "assistant" && typeof message.content === "string" && message.content.trim());
|
|
3137
|
-
const
|
|
3139
|
+
const visibleIdlePrompt = this.looksLikeVisibleIdlePrompt(screenText);
|
|
3140
|
+
const shouldAdoptParsedIdleReplay = !this.currentTurnScope && !this.activeModal && !!parsedLastAssistant && parsedHydratedMessages.length > committedHydratedMessages.length && (this.currentStatus === "idle" || this.currentStatus === "generating" && this.isWaitingForResponse && parsed.status === "idle" && visibleIdlePrompt);
|
|
3138
3141
|
if (shouldAdoptParsedIdleReplay) {
|
|
3139
3142
|
this.committedMessages = normalizeCliParsedMessages(parsed.messages, {
|
|
3140
3143
|
committedMessages: this.committedMessages,
|
|
@@ -3142,6 +3145,18 @@ var init_provider_cli_adapter = __esm({
|
|
|
3142
3145
|
lastOutputAt: this.lastOutputAt
|
|
3143
3146
|
});
|
|
3144
3147
|
this.syncMessageViews();
|
|
3148
|
+
if (this.currentStatus !== "idle" || this.isWaitingForResponse) {
|
|
3149
|
+
this.responseBuffer = "";
|
|
3150
|
+
this.isWaitingForResponse = false;
|
|
3151
|
+
this.responseSettleIgnoreUntil = 0;
|
|
3152
|
+
this.submitRetryUsed = false;
|
|
3153
|
+
this.submitRetryPromptSnippet = "";
|
|
3154
|
+
this.finishRetryCount = 0;
|
|
3155
|
+
this.currentTurnScope = null;
|
|
3156
|
+
this.activeModal = null;
|
|
3157
|
+
this.setStatus("idle", "parsed_idle_replay_commit");
|
|
3158
|
+
this.onStatusChange?.();
|
|
3159
|
+
}
|
|
3145
3160
|
}
|
|
3146
3161
|
const effectiveCommittedHydratedMessages = shouldAdoptParsedIdleReplay ? this.committedMessages.map((message, index) => buildChatMessage({
|
|
3147
3162
|
...message,
|
|
@@ -3752,8 +3767,9 @@ ${data.message || ""}`.trim();
|
|
|
3752
3767
|
this.ptyProcess?.write(data);
|
|
3753
3768
|
}
|
|
3754
3769
|
resolveModal(buttonIndex) {
|
|
3755
|
-
|
|
3756
|
-
const modal = this.activeModal;
|
|
3770
|
+
const screenText = this.terminalScreen.getText() || "";
|
|
3771
|
+
const modal = this.activeModal || this.getStartupConfirmationModal(screenText);
|
|
3772
|
+
if (!this.ptyProcess || this.currentStatus !== "waiting_approval" && !modal) return;
|
|
3757
3773
|
this.clearIdleFinishCandidate("resolve_modal");
|
|
3758
3774
|
this.recordTrace("resolve_modal", {
|
|
3759
3775
|
buttonIndex,
|
|
@@ -3768,7 +3784,10 @@ ${data.message || ""}`.trim();
|
|
|
3768
3784
|
}
|
|
3769
3785
|
this.setStatus("generating", "approval_resolved");
|
|
3770
3786
|
this.onStatusChange?.();
|
|
3771
|
-
|
|
3787
|
+
const startupTrustModal = /Quick safety check|project trust|trust (?:this project|the contents of this directory|the files in this folder)/i.test(String(modal?.message || ""));
|
|
3788
|
+
if (startupTrustModal && buttonIndex in this.approvalKeys) {
|
|
3789
|
+
this.ptyProcess.write(`${this.approvalKeys[buttonIndex]}\r`);
|
|
3790
|
+
} else if (this.shouldResolveModalWithEnter(modal, buttonIndex)) {
|
|
3772
3791
|
this.ptyProcess.write("\r");
|
|
3773
3792
|
} else if (buttonIndex in this.approvalKeys) {
|
|
3774
3793
|
this.ptyProcess.write(this.approvalKeys[buttonIndex]);
|
|
@@ -3789,20 +3808,24 @@ ${data.message || ""}`.trim();
|
|
|
3789
3808
|
}
|
|
3790
3809
|
}
|
|
3791
3810
|
getDebugState() {
|
|
3811
|
+
const screenText = sanitizeTerminalText(this.terminalScreen.getText());
|
|
3812
|
+
const startupModal = this.startupParseGate ? this.getStartupConfirmationModal(screenText) : null;
|
|
3813
|
+
const effectiveStatus = startupModal ? "waiting_approval" : this.currentStatus;
|
|
3814
|
+
const effectiveReady = this.ready || !!startupModal;
|
|
3792
3815
|
return {
|
|
3793
3816
|
type: this.cliType,
|
|
3794
3817
|
name: this.cliName,
|
|
3795
3818
|
providerResolution: this.providerResolutionMeta,
|
|
3796
|
-
status:
|
|
3797
|
-
ready:
|
|
3819
|
+
status: effectiveStatus,
|
|
3820
|
+
ready: effectiveReady,
|
|
3798
3821
|
startupParseGate: this.startupParseGate,
|
|
3799
3822
|
spawnAt: this.spawnAt,
|
|
3800
3823
|
workingDir: this.workingDir,
|
|
3801
|
-
messages: this.messages
|
|
3802
|
-
committedMessages: this.committedMessages
|
|
3803
|
-
structuredMessages: this.structuredMessages
|
|
3824
|
+
messages: this.messages,
|
|
3825
|
+
committedMessages: this.committedMessages,
|
|
3826
|
+
structuredMessages: this.structuredMessages,
|
|
3804
3827
|
messageCount: this.committedMessages.length,
|
|
3805
|
-
screenText:
|
|
3828
|
+
screenText: screenText.slice(-4e3),
|
|
3806
3829
|
currentTurnScope: this.currentTurnScope,
|
|
3807
3830
|
startupBuffer: this.startupBuffer.slice(-4e3),
|
|
3808
3831
|
recentOutputBuffer: this.recentOutputBuffer.slice(-500),
|
|
@@ -3817,7 +3840,7 @@ ${data.message || ""}`.trim();
|
|
|
3817
3840
|
lastScreenChangeAt: this.lastScreenChangeAt,
|
|
3818
3841
|
lastScreenSnapshot: this.lastScreenSnapshot.slice(-500),
|
|
3819
3842
|
isWaitingForResponse: this.isWaitingForResponse,
|
|
3820
|
-
activeModal: this.activeModal,
|
|
3843
|
+
activeModal: startupModal || this.activeModal,
|
|
3821
3844
|
lastApprovalResolvedAt: this.lastApprovalResolvedAt,
|
|
3822
3845
|
sendDelayMs: this.sendDelayMs,
|
|
3823
3846
|
sendKey: this.sendKey,
|