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