@adhdev/daemon-standalone 0.8.88 → 0.8.90
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
|
@@ -29514,8 +29514,8 @@ var require_dist2 = __commonJS({
|
|
|
29514
29514
|
scope,
|
|
29515
29515
|
runtimeSettings
|
|
29516
29516
|
} = options;
|
|
29517
|
-
const buffer = scope ? sliceFromOffset(accumulatedBuffer, scope.bufferStart)
|
|
29518
|
-
const rawBuffer = scope ? sliceFromOffset(accumulatedRawBuffer, scope.rawBufferStart)
|
|
29517
|
+
const buffer = scope ? sliceFromOffset(accumulatedBuffer, scope.bufferStart) : accumulatedBuffer;
|
|
29518
|
+
const rawBuffer = scope ? sliceFromOffset(accumulatedRawBuffer, scope.rawBufferStart) : accumulatedRawBuffer;
|
|
29519
29519
|
const screenText = terminalScreenText;
|
|
29520
29520
|
const recentBuffer = buffer.slice(-1e3) || recentOutputBuffer;
|
|
29521
29521
|
return {
|
|
@@ -29547,8 +29547,8 @@ var require_dist2 = __commonJS({
|
|
|
29547
29547
|
}
|
|
29548
29548
|
function buildCliTraceParseSnapshot(options) {
|
|
29549
29549
|
const { accumulatedBuffer, accumulatedRawBuffer, responseBuffer, partialResponse, scope } = options;
|
|
29550
|
-
const scopedBuffer = scope ? sliceFromOffset(accumulatedBuffer, scope.bufferStart)
|
|
29551
|
-
const scopedRawBuffer = scope ? sliceFromOffset(accumulatedRawBuffer, scope.rawBufferStart)
|
|
29550
|
+
const scopedBuffer = scope ? sliceFromOffset(accumulatedBuffer, scope.bufferStart) : accumulatedBuffer;
|
|
29551
|
+
const scopedRawBuffer = scope ? sliceFromOffset(accumulatedRawBuffer, scope.rawBufferStart) : accumulatedRawBuffer;
|
|
29552
29552
|
return {
|
|
29553
29553
|
currentTurnScope: scope || null,
|
|
29554
29554
|
responseBuffer: summarizeCliTraceText(responseBuffer, 1200),
|
|
@@ -30208,6 +30208,7 @@ var require_dist2 = __commonJS({
|
|
|
30208
30208
|
looksLikeClaudeGeneratingLine(line) {
|
|
30209
30209
|
const trimmed = String(line || "").trim();
|
|
30210
30210
|
if (!trimmed) return false;
|
|
30211
|
+
if (/^⏵⏵\s+accept edits on/i.test(trimmed)) return false;
|
|
30211
30212
|
if (/esc to (cancel|interrupt|stop)/i.test(trimmed)) return true;
|
|
30212
30213
|
if (/^[✻✶✳✢✽⠂⠐⠒⠓⠦⠴⠶⠷⠿]+\s+\S+.*\b(?:thinking|thought for \d+s?)\b/i.test(trimmed)) return true;
|
|
30213
30214
|
if (/^[✻✶✳✢✽⠂⠐⠒⠓⠦⠴⠶⠷⠿]+\s+[A-Z][A-Za-z-]{3,}ing\b.*(?:…|\.{3})/u.test(trimmed)) return true;
|
|
@@ -30308,8 +30309,7 @@ var require_dist2 = __commonJS({
|
|
|
30308
30309
|
const buttons = Array.isArray(modal.buttons) ? modal.buttons : [];
|
|
30309
30310
|
if (buttons.length !== 1) return false;
|
|
30310
30311
|
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);
|
|
30312
|
+
return looksLikeConfirmOnlyLabel(buttonLabel);
|
|
30313
30313
|
}
|
|
30314
30314
|
async waitForInteractivePrompt(maxWaitMs = 5e3) {
|
|
30315
30315
|
const startedAt = Date.now();
|
|
@@ -30521,7 +30521,7 @@ var require_dist2 = __commonJS({
|
|
|
30521
30521
|
`[${this.cliType}] settled diagnostics prompt=${JSON.stringify(this.currentTurnScope.prompt).slice(0, 140)} scriptStatus=${String(scriptStatus || "")} parsedStatus=${String(parsedTranscript?.status || "")} parsedMsgCount=${parsedMessages.length} lastParsedAssistant=${JSON.stringify(summarizeCliTraceText(lastParsedAssistant?.content || "", 120)).slice(0, 160)} visibleIdlePrompt=${String(visibleIdlePrompt)} visibleAssistantCandidate=${String(visibleAssistantCandidate)} responseBuffer=${JSON.stringify(summarizeCliTraceText(this.responseBuffer, 160)).slice(0, 220)} screen=${JSON.stringify(summarizeCliTraceText(screenText, 160)).slice(0, 220)}`
|
|
30522
30522
|
);
|
|
30523
30523
|
}
|
|
30524
|
-
const shouldHoldGenerating = scriptStatus === "idle" && this.isWaitingForResponse && !modal && recentInteractiveActivity && !(visibleIdlePrompt && visibleAssistantCandidate);
|
|
30524
|
+
const shouldHoldGenerating = scriptStatus === "idle" && this.isWaitingForResponse && !modal && recentInteractiveActivity && !(visibleIdlePrompt && visibleAssistantCandidate) && !(parsedTranscript?.status === "idle" && !!lastParsedAssistant);
|
|
30525
30525
|
if (shouldHoldGenerating) {
|
|
30526
30526
|
this.clearIdleFinishCandidate("hold_generating_recent_activity");
|
|
30527
30527
|
this.setStatus("generating", "recent_activity_hold");
|
|
@@ -30923,13 +30923,22 @@ var require_dist2 = __commonJS({
|
|
|
30923
30923
|
return null;
|
|
30924
30924
|
}
|
|
30925
30925
|
}
|
|
30926
|
+
projectEffectiveStatus(startupModal = null) {
|
|
30927
|
+
if (this.parseErrorMessage) return "error";
|
|
30928
|
+
if (startupModal) return "waiting_approval";
|
|
30929
|
+
if (this.isWaitingForResponse && this.currentTurnScope && this.currentStatus === "idle") return "generating";
|
|
30930
|
+
return this.currentStatus;
|
|
30931
|
+
}
|
|
30926
30932
|
// ─── Public API (CliAdapter) ───────────────────
|
|
30927
30933
|
getStatus() {
|
|
30934
|
+
const screenText = this.terminalScreen.getText() || "";
|
|
30935
|
+
const startupModal = this.startupParseGate ? this.getStartupConfirmationModal(screenText) : null;
|
|
30936
|
+
const effectiveStatus = this.projectEffectiveStatus(startupModal);
|
|
30928
30937
|
return {
|
|
30929
|
-
status:
|
|
30938
|
+
status: effectiveStatus,
|
|
30930
30939
|
messages: [...this.committedMessages],
|
|
30931
30940
|
workingDir: this.workingDir,
|
|
30932
|
-
activeModal: this.activeModal,
|
|
30941
|
+
activeModal: startupModal || this.activeModal,
|
|
30933
30942
|
errorMessage: this.parseErrorMessage || void 0,
|
|
30934
30943
|
errorReason: this.parseErrorMessage ? "parse_error" : void 0
|
|
30935
30944
|
};
|
|
@@ -30983,7 +30992,8 @@ var require_dist2 = __commonJS({
|
|
|
30983
30992
|
receivedAt: typeof message.receivedAt === "number" ? message.receivedAt : message.timestamp
|
|
30984
30993
|
}));
|
|
30985
30994
|
const parsedLastAssistant = [...parsedHydratedMessages].reverse().find((message) => message.role === "assistant" && typeof message.content === "string" && message.content.trim());
|
|
30986
|
-
const
|
|
30995
|
+
const visibleIdlePrompt = this.looksLikeVisibleIdlePrompt(screenText);
|
|
30996
|
+
const shouldAdoptParsedIdleReplay = !this.currentTurnScope && !this.activeModal && !!parsedLastAssistant && parsedHydratedMessages.length > committedHydratedMessages.length && (this.currentStatus === "idle" || this.currentStatus === "generating" && this.isWaitingForResponse && parsed.status === "idle" && visibleIdlePrompt);
|
|
30987
30997
|
if (shouldAdoptParsedIdleReplay) {
|
|
30988
30998
|
this.committedMessages = normalizeCliParsedMessages(parsed.messages, {
|
|
30989
30999
|
committedMessages: this.committedMessages,
|
|
@@ -30991,6 +31001,18 @@ var require_dist2 = __commonJS({
|
|
|
30991
31001
|
lastOutputAt: this.lastOutputAt
|
|
30992
31002
|
});
|
|
30993
31003
|
this.syncMessageViews();
|
|
31004
|
+
if (this.currentStatus !== "idle" || this.isWaitingForResponse) {
|
|
31005
|
+
this.responseBuffer = "";
|
|
31006
|
+
this.isWaitingForResponse = false;
|
|
31007
|
+
this.responseSettleIgnoreUntil = 0;
|
|
31008
|
+
this.submitRetryUsed = false;
|
|
31009
|
+
this.submitRetryPromptSnippet = "";
|
|
31010
|
+
this.finishRetryCount = 0;
|
|
31011
|
+
this.currentTurnScope = null;
|
|
31012
|
+
this.activeModal = null;
|
|
31013
|
+
this.setStatus("idle", "parsed_idle_replay_commit");
|
|
31014
|
+
this.onStatusChange?.();
|
|
31015
|
+
}
|
|
30994
31016
|
}
|
|
30995
31017
|
const effectiveCommittedHydratedMessages = shouldAdoptParsedIdleReplay ? this.committedMessages.map((message, index) => buildChatMessage({
|
|
30996
31018
|
...message,
|
|
@@ -31601,8 +31623,9 @@ ${data.message || ""}`.trim();
|
|
|
31601
31623
|
this.ptyProcess?.write(data);
|
|
31602
31624
|
}
|
|
31603
31625
|
resolveModal(buttonIndex) {
|
|
31604
|
-
|
|
31605
|
-
const modal = this.activeModal;
|
|
31626
|
+
const screenText = this.terminalScreen.getText() || "";
|
|
31627
|
+
const modal = this.activeModal || this.getStartupConfirmationModal(screenText);
|
|
31628
|
+
if (!this.ptyProcess || this.currentStatus !== "waiting_approval" && !modal) return;
|
|
31606
31629
|
this.clearIdleFinishCandidate("resolve_modal");
|
|
31607
31630
|
this.recordTrace("resolve_modal", {
|
|
31608
31631
|
buttonIndex,
|
|
@@ -31617,7 +31640,10 @@ ${data.message || ""}`.trim();
|
|
|
31617
31640
|
}
|
|
31618
31641
|
this.setStatus("generating", "approval_resolved");
|
|
31619
31642
|
this.onStatusChange?.();
|
|
31620
|
-
|
|
31643
|
+
const startupTrustModal = /Quick safety check|project trust|Confirm Claude Code project trust|trust (?:this project|the contents of this directory|the files in this folder)/i.test(String(modal?.message || ""));
|
|
31644
|
+
if (startupTrustModal && buttonIndex in this.approvalKeys) {
|
|
31645
|
+
this.ptyProcess.write(`${this.approvalKeys[buttonIndex]}\r`);
|
|
31646
|
+
} else if (this.shouldResolveModalWithEnter(modal, buttonIndex)) {
|
|
31621
31647
|
this.ptyProcess.write("\r");
|
|
31622
31648
|
} else if (buttonIndex in this.approvalKeys) {
|
|
31623
31649
|
this.ptyProcess.write(this.approvalKeys[buttonIndex]);
|
|
@@ -31638,20 +31664,24 @@ ${data.message || ""}`.trim();
|
|
|
31638
31664
|
}
|
|
31639
31665
|
}
|
|
31640
31666
|
getDebugState() {
|
|
31667
|
+
const screenText = sanitizeTerminalText(this.terminalScreen.getText());
|
|
31668
|
+
const startupModal = this.startupParseGate ? this.getStartupConfirmationModal(screenText) : null;
|
|
31669
|
+
const effectiveStatus = this.projectEffectiveStatus(startupModal);
|
|
31670
|
+
const effectiveReady = this.ready || !!startupModal;
|
|
31641
31671
|
return {
|
|
31642
31672
|
type: this.cliType,
|
|
31643
31673
|
name: this.cliName,
|
|
31644
31674
|
providerResolution: this.providerResolutionMeta,
|
|
31645
|
-
status:
|
|
31646
|
-
ready:
|
|
31675
|
+
status: effectiveStatus,
|
|
31676
|
+
ready: effectiveReady,
|
|
31647
31677
|
startupParseGate: this.startupParseGate,
|
|
31648
31678
|
spawnAt: this.spawnAt,
|
|
31649
31679
|
workingDir: this.workingDir,
|
|
31650
|
-
messages: this.messages
|
|
31651
|
-
committedMessages: this.committedMessages
|
|
31652
|
-
structuredMessages: this.structuredMessages
|
|
31680
|
+
messages: this.messages,
|
|
31681
|
+
committedMessages: this.committedMessages,
|
|
31682
|
+
structuredMessages: this.structuredMessages,
|
|
31653
31683
|
messageCount: this.committedMessages.length,
|
|
31654
|
-
screenText:
|
|
31684
|
+
screenText: screenText.slice(-4e3),
|
|
31655
31685
|
currentTurnScope: this.currentTurnScope,
|
|
31656
31686
|
startupBuffer: this.startupBuffer.slice(-4e3),
|
|
31657
31687
|
recentOutputBuffer: this.recentOutputBuffer.slice(-500),
|
|
@@ -31666,7 +31696,7 @@ ${data.message || ""}`.trim();
|
|
|
31666
31696
|
lastScreenChangeAt: this.lastScreenChangeAt,
|
|
31667
31697
|
lastScreenSnapshot: this.lastScreenSnapshot.slice(-500),
|
|
31668
31698
|
isWaitingForResponse: this.isWaitingForResponse,
|
|
31669
|
-
activeModal: this.activeModal,
|
|
31699
|
+
activeModal: startupModal || this.activeModal,
|
|
31670
31700
|
lastApprovalResolvedAt: this.lastApprovalResolvedAt,
|
|
31671
31701
|
sendDelayMs: this.sendDelayMs,
|
|
31672
31702
|
sendKey: this.sendKey,
|