@adhdev/daemon-standalone 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
|
@@ -30308,8 +30308,7 @@ var require_dist2 = __commonJS({
|
|
|
30308
30308
|
const buttons = Array.isArray(modal.buttons) ? modal.buttons : [];
|
|
30309
30309
|
if (buttons.length !== 1) return false;
|
|
30310
30310
|
const buttonLabel = String(buttons[0] || "").trim();
|
|
30311
|
-
|
|
30312
|
-
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);
|
|
30311
|
+
return looksLikeConfirmOnlyLabel(buttonLabel);
|
|
30313
30312
|
}
|
|
30314
30313
|
async waitForInteractivePrompt(maxWaitMs = 5e3) {
|
|
30315
30314
|
const startedAt = Date.now();
|
|
@@ -30925,11 +30924,14 @@ var require_dist2 = __commonJS({
|
|
|
30925
30924
|
}
|
|
30926
30925
|
// ─── Public API (CliAdapter) ───────────────────
|
|
30927
30926
|
getStatus() {
|
|
30927
|
+
const screenText = this.terminalScreen.getText() || "";
|
|
30928
|
+
const startupModal = this.startupParseGate ? this.getStartupConfirmationModal(screenText) : null;
|
|
30929
|
+
const effectiveStatus = this.parseErrorMessage ? "error" : startupModal ? "waiting_approval" : this.currentStatus;
|
|
30928
30930
|
return {
|
|
30929
|
-
status:
|
|
30931
|
+
status: effectiveStatus,
|
|
30930
30932
|
messages: [...this.committedMessages],
|
|
30931
30933
|
workingDir: this.workingDir,
|
|
30932
|
-
activeModal: this.activeModal,
|
|
30934
|
+
activeModal: startupModal || this.activeModal,
|
|
30933
30935
|
errorMessage: this.parseErrorMessage || void 0,
|
|
30934
30936
|
errorReason: this.parseErrorMessage ? "parse_error" : void 0
|
|
30935
30937
|
};
|
|
@@ -30983,7 +30985,8 @@ var require_dist2 = __commonJS({
|
|
|
30983
30985
|
receivedAt: typeof message.receivedAt === "number" ? message.receivedAt : message.timestamp
|
|
30984
30986
|
}));
|
|
30985
30987
|
const parsedLastAssistant = [...parsedHydratedMessages].reverse().find((message) => message.role === "assistant" && typeof message.content === "string" && message.content.trim());
|
|
30986
|
-
const
|
|
30988
|
+
const visibleIdlePrompt = this.looksLikeVisibleIdlePrompt(screenText);
|
|
30989
|
+
const shouldAdoptParsedIdleReplay = !this.currentTurnScope && !this.activeModal && !!parsedLastAssistant && parsedHydratedMessages.length > committedHydratedMessages.length && (this.currentStatus === "idle" || this.currentStatus === "generating" && this.isWaitingForResponse && parsed.status === "idle" && visibleIdlePrompt);
|
|
30987
30990
|
if (shouldAdoptParsedIdleReplay) {
|
|
30988
30991
|
this.committedMessages = normalizeCliParsedMessages(parsed.messages, {
|
|
30989
30992
|
committedMessages: this.committedMessages,
|
|
@@ -30991,6 +30994,18 @@ var require_dist2 = __commonJS({
|
|
|
30991
30994
|
lastOutputAt: this.lastOutputAt
|
|
30992
30995
|
});
|
|
30993
30996
|
this.syncMessageViews();
|
|
30997
|
+
if (this.currentStatus !== "idle" || this.isWaitingForResponse) {
|
|
30998
|
+
this.responseBuffer = "";
|
|
30999
|
+
this.isWaitingForResponse = false;
|
|
31000
|
+
this.responseSettleIgnoreUntil = 0;
|
|
31001
|
+
this.submitRetryUsed = false;
|
|
31002
|
+
this.submitRetryPromptSnippet = "";
|
|
31003
|
+
this.finishRetryCount = 0;
|
|
31004
|
+
this.currentTurnScope = null;
|
|
31005
|
+
this.activeModal = null;
|
|
31006
|
+
this.setStatus("idle", "parsed_idle_replay_commit");
|
|
31007
|
+
this.onStatusChange?.();
|
|
31008
|
+
}
|
|
30994
31009
|
}
|
|
30995
31010
|
const effectiveCommittedHydratedMessages = shouldAdoptParsedIdleReplay ? this.committedMessages.map((message, index) => buildChatMessage({
|
|
30996
31011
|
...message,
|
|
@@ -31601,8 +31616,9 @@ ${data.message || ""}`.trim();
|
|
|
31601
31616
|
this.ptyProcess?.write(data);
|
|
31602
31617
|
}
|
|
31603
31618
|
resolveModal(buttonIndex) {
|
|
31604
|
-
|
|
31605
|
-
const modal = this.activeModal;
|
|
31619
|
+
const screenText = this.terminalScreen.getText() || "";
|
|
31620
|
+
const modal = this.activeModal || this.getStartupConfirmationModal(screenText);
|
|
31621
|
+
if (!this.ptyProcess || this.currentStatus !== "waiting_approval" && !modal) return;
|
|
31606
31622
|
this.clearIdleFinishCandidate("resolve_modal");
|
|
31607
31623
|
this.recordTrace("resolve_modal", {
|
|
31608
31624
|
buttonIndex,
|
|
@@ -31617,7 +31633,10 @@ ${data.message || ""}`.trim();
|
|
|
31617
31633
|
}
|
|
31618
31634
|
this.setStatus("generating", "approval_resolved");
|
|
31619
31635
|
this.onStatusChange?.();
|
|
31620
|
-
|
|
31636
|
+
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 || ""));
|
|
31637
|
+
if (startupTrustModal && buttonIndex in this.approvalKeys) {
|
|
31638
|
+
this.ptyProcess.write(`${this.approvalKeys[buttonIndex]}\r`);
|
|
31639
|
+
} else if (this.shouldResolveModalWithEnter(modal, buttonIndex)) {
|
|
31621
31640
|
this.ptyProcess.write("\r");
|
|
31622
31641
|
} else if (buttonIndex in this.approvalKeys) {
|
|
31623
31642
|
this.ptyProcess.write(this.approvalKeys[buttonIndex]);
|
|
@@ -31638,20 +31657,24 @@ ${data.message || ""}`.trim();
|
|
|
31638
31657
|
}
|
|
31639
31658
|
}
|
|
31640
31659
|
getDebugState() {
|
|
31660
|
+
const screenText = sanitizeTerminalText(this.terminalScreen.getText());
|
|
31661
|
+
const startupModal = this.startupParseGate ? this.getStartupConfirmationModal(screenText) : null;
|
|
31662
|
+
const effectiveStatus = startupModal ? "waiting_approval" : this.currentStatus;
|
|
31663
|
+
const effectiveReady = this.ready || !!startupModal;
|
|
31641
31664
|
return {
|
|
31642
31665
|
type: this.cliType,
|
|
31643
31666
|
name: this.cliName,
|
|
31644
31667
|
providerResolution: this.providerResolutionMeta,
|
|
31645
|
-
status:
|
|
31646
|
-
ready:
|
|
31668
|
+
status: effectiveStatus,
|
|
31669
|
+
ready: effectiveReady,
|
|
31647
31670
|
startupParseGate: this.startupParseGate,
|
|
31648
31671
|
spawnAt: this.spawnAt,
|
|
31649
31672
|
workingDir: this.workingDir,
|
|
31650
|
-
messages: this.messages
|
|
31651
|
-
committedMessages: this.committedMessages
|
|
31652
|
-
structuredMessages: this.structuredMessages
|
|
31673
|
+
messages: this.messages,
|
|
31674
|
+
committedMessages: this.committedMessages,
|
|
31675
|
+
structuredMessages: this.structuredMessages,
|
|
31653
31676
|
messageCount: this.committedMessages.length,
|
|
31654
|
-
screenText:
|
|
31677
|
+
screenText: screenText.slice(-4e3),
|
|
31655
31678
|
currentTurnScope: this.currentTurnScope,
|
|
31656
31679
|
startupBuffer: this.startupBuffer.slice(-4e3),
|
|
31657
31680
|
recentOutputBuffer: this.recentOutputBuffer.slice(-500),
|
|
@@ -31666,7 +31689,7 @@ ${data.message || ""}`.trim();
|
|
|
31666
31689
|
lastScreenChangeAt: this.lastScreenChangeAt,
|
|
31667
31690
|
lastScreenSnapshot: this.lastScreenSnapshot.slice(-500),
|
|
31668
31691
|
isWaitingForResponse: this.isWaitingForResponse,
|
|
31669
|
-
activeModal: this.activeModal,
|
|
31692
|
+
activeModal: startupModal || this.activeModal,
|
|
31670
31693
|
lastApprovalResolvedAt: this.lastApprovalResolvedAt,
|
|
31671
31694
|
sendDelayMs: this.sendDelayMs,
|
|
31672
31695
|
sendKey: this.sendKey,
|