adhdev 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/cli/index.js +51 -21
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +51 -21
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10999,8 +10999,8 @@ function buildCliParseInput(options) {
|
|
|
10999
10999
|
scope,
|
|
11000
11000
|
runtimeSettings
|
|
11001
11001
|
} = options;
|
|
11002
|
-
const buffer = scope ? sliceFromOffset(accumulatedBuffer, scope.bufferStart)
|
|
11003
|
-
const rawBuffer = scope ? sliceFromOffset(accumulatedRawBuffer, scope.rawBufferStart)
|
|
11002
|
+
const buffer = scope ? sliceFromOffset(accumulatedBuffer, scope.bufferStart) : accumulatedBuffer;
|
|
11003
|
+
const rawBuffer = scope ? sliceFromOffset(accumulatedRawBuffer, scope.rawBufferStart) : accumulatedRawBuffer;
|
|
11004
11004
|
const screenText = terminalScreenText;
|
|
11005
11005
|
const recentBuffer = buffer.slice(-1e3) || recentOutputBuffer;
|
|
11006
11006
|
return {
|
|
@@ -11032,8 +11032,8 @@ function summarizeCliTraceMessages(messages, limit = 3) {
|
|
|
11032
11032
|
}
|
|
11033
11033
|
function buildCliTraceParseSnapshot(options) {
|
|
11034
11034
|
const { accumulatedBuffer, accumulatedRawBuffer, responseBuffer, partialResponse, scope } = options;
|
|
11035
|
-
const scopedBuffer = scope ? sliceFromOffset(accumulatedBuffer, scope.bufferStart)
|
|
11036
|
-
const scopedRawBuffer = scope ? sliceFromOffset(accumulatedRawBuffer, scope.rawBufferStart)
|
|
11035
|
+
const scopedBuffer = scope ? sliceFromOffset(accumulatedBuffer, scope.bufferStart) : accumulatedBuffer;
|
|
11036
|
+
const scopedRawBuffer = scope ? sliceFromOffset(accumulatedRawBuffer, scope.rawBufferStart) : accumulatedRawBuffer;
|
|
11037
11037
|
return {
|
|
11038
11038
|
currentTurnScope: scope || null,
|
|
11039
11039
|
responseBuffer: summarizeCliTraceText(responseBuffer, 1200),
|
|
@@ -11697,6 +11697,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
11697
11697
|
looksLikeClaudeGeneratingLine(line) {
|
|
11698
11698
|
const trimmed = String(line || "").trim();
|
|
11699
11699
|
if (!trimmed) return false;
|
|
11700
|
+
if (/^⏵⏵\s+accept edits on/i.test(trimmed)) return false;
|
|
11700
11701
|
if (/esc to (cancel|interrupt|stop)/i.test(trimmed)) return true;
|
|
11701
11702
|
if (/^[✻✶✳✢✽⠂⠐⠒⠓⠦⠴⠶⠷⠿]+\s+\S+.*\b(?:thinking|thought for \d+s?)\b/i.test(trimmed)) return true;
|
|
11702
11703
|
if (/^[✻✶✳✢✽⠂⠐⠒⠓⠦⠴⠶⠷⠿]+\s+[A-Z][A-Za-z-]{3,}ing\b.*(?:…|\.{3})/u.test(trimmed)) return true;
|
|
@@ -11797,8 +11798,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
11797
11798
|
const buttons = Array.isArray(modal.buttons) ? modal.buttons : [];
|
|
11798
11799
|
if (buttons.length !== 1) return false;
|
|
11799
11800
|
const buttonLabel = String(buttons[0] || "").trim();
|
|
11800
|
-
|
|
11801
|
-
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);
|
|
11801
|
+
return looksLikeConfirmOnlyLabel(buttonLabel);
|
|
11802
11802
|
}
|
|
11803
11803
|
async waitForInteractivePrompt(maxWaitMs = 5e3) {
|
|
11804
11804
|
const startedAt = Date.now();
|
|
@@ -12010,7 +12010,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
12010
12010
|
`[${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)}`
|
|
12011
12011
|
);
|
|
12012
12012
|
}
|
|
12013
|
-
const shouldHoldGenerating = scriptStatus === "idle" && this.isWaitingForResponse && !modal && recentInteractiveActivity && !(visibleIdlePrompt && visibleAssistantCandidate);
|
|
12013
|
+
const shouldHoldGenerating = scriptStatus === "idle" && this.isWaitingForResponse && !modal && recentInteractiveActivity && !(visibleIdlePrompt && visibleAssistantCandidate) && !(parsedTranscript?.status === "idle" && !!lastParsedAssistant);
|
|
12014
12014
|
if (shouldHoldGenerating) {
|
|
12015
12015
|
this.clearIdleFinishCandidate("hold_generating_recent_activity");
|
|
12016
12016
|
this.setStatus("generating", "recent_activity_hold");
|
|
@@ -12412,13 +12412,22 @@ var init_provider_cli_adapter = __esm({
|
|
|
12412
12412
|
return null;
|
|
12413
12413
|
}
|
|
12414
12414
|
}
|
|
12415
|
+
projectEffectiveStatus(startupModal = null) {
|
|
12416
|
+
if (this.parseErrorMessage) return "error";
|
|
12417
|
+
if (startupModal) return "waiting_approval";
|
|
12418
|
+
if (this.isWaitingForResponse && this.currentTurnScope && this.currentStatus === "idle") return "generating";
|
|
12419
|
+
return this.currentStatus;
|
|
12420
|
+
}
|
|
12415
12421
|
// ─── Public API (CliAdapter) ───────────────────
|
|
12416
12422
|
getStatus() {
|
|
12423
|
+
const screenText = this.terminalScreen.getText() || "";
|
|
12424
|
+
const startupModal = this.startupParseGate ? this.getStartupConfirmationModal(screenText) : null;
|
|
12425
|
+
const effectiveStatus = this.projectEffectiveStatus(startupModal);
|
|
12417
12426
|
return {
|
|
12418
|
-
status:
|
|
12427
|
+
status: effectiveStatus,
|
|
12419
12428
|
messages: [...this.committedMessages],
|
|
12420
12429
|
workingDir: this.workingDir,
|
|
12421
|
-
activeModal: this.activeModal,
|
|
12430
|
+
activeModal: startupModal || this.activeModal,
|
|
12422
12431
|
errorMessage: this.parseErrorMessage || void 0,
|
|
12423
12432
|
errorReason: this.parseErrorMessage ? "parse_error" : void 0
|
|
12424
12433
|
};
|
|
@@ -12472,7 +12481,8 @@ var init_provider_cli_adapter = __esm({
|
|
|
12472
12481
|
receivedAt: typeof message.receivedAt === "number" ? message.receivedAt : message.timestamp
|
|
12473
12482
|
}));
|
|
12474
12483
|
const parsedLastAssistant = [...parsedHydratedMessages].reverse().find((message) => message.role === "assistant" && typeof message.content === "string" && message.content.trim());
|
|
12475
|
-
const
|
|
12484
|
+
const visibleIdlePrompt = this.looksLikeVisibleIdlePrompt(screenText);
|
|
12485
|
+
const shouldAdoptParsedIdleReplay = !this.currentTurnScope && !this.activeModal && !!parsedLastAssistant && parsedHydratedMessages.length > committedHydratedMessages.length && (this.currentStatus === "idle" || this.currentStatus === "generating" && this.isWaitingForResponse && parsed.status === "idle" && visibleIdlePrompt);
|
|
12476
12486
|
if (shouldAdoptParsedIdleReplay) {
|
|
12477
12487
|
this.committedMessages = normalizeCliParsedMessages(parsed.messages, {
|
|
12478
12488
|
committedMessages: this.committedMessages,
|
|
@@ -12480,6 +12490,18 @@ var init_provider_cli_adapter = __esm({
|
|
|
12480
12490
|
lastOutputAt: this.lastOutputAt
|
|
12481
12491
|
});
|
|
12482
12492
|
this.syncMessageViews();
|
|
12493
|
+
if (this.currentStatus !== "idle" || this.isWaitingForResponse) {
|
|
12494
|
+
this.responseBuffer = "";
|
|
12495
|
+
this.isWaitingForResponse = false;
|
|
12496
|
+
this.responseSettleIgnoreUntil = 0;
|
|
12497
|
+
this.submitRetryUsed = false;
|
|
12498
|
+
this.submitRetryPromptSnippet = "";
|
|
12499
|
+
this.finishRetryCount = 0;
|
|
12500
|
+
this.currentTurnScope = null;
|
|
12501
|
+
this.activeModal = null;
|
|
12502
|
+
this.setStatus("idle", "parsed_idle_replay_commit");
|
|
12503
|
+
this.onStatusChange?.();
|
|
12504
|
+
}
|
|
12483
12505
|
}
|
|
12484
12506
|
const effectiveCommittedHydratedMessages = shouldAdoptParsedIdleReplay ? this.committedMessages.map((message, index) => buildChatMessage({
|
|
12485
12507
|
...message,
|
|
@@ -13090,8 +13112,9 @@ ${data.message || ""}`.trim();
|
|
|
13090
13112
|
this.ptyProcess?.write(data);
|
|
13091
13113
|
}
|
|
13092
13114
|
resolveModal(buttonIndex) {
|
|
13093
|
-
|
|
13094
|
-
const modal = this.activeModal;
|
|
13115
|
+
const screenText = this.terminalScreen.getText() || "";
|
|
13116
|
+
const modal = this.activeModal || this.getStartupConfirmationModal(screenText);
|
|
13117
|
+
if (!this.ptyProcess || this.currentStatus !== "waiting_approval" && !modal) return;
|
|
13095
13118
|
this.clearIdleFinishCandidate("resolve_modal");
|
|
13096
13119
|
this.recordTrace("resolve_modal", {
|
|
13097
13120
|
buttonIndex,
|
|
@@ -13106,7 +13129,10 @@ ${data.message || ""}`.trim();
|
|
|
13106
13129
|
}
|
|
13107
13130
|
this.setStatus("generating", "approval_resolved");
|
|
13108
13131
|
this.onStatusChange?.();
|
|
13109
|
-
|
|
13132
|
+
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 || ""));
|
|
13133
|
+
if (startupTrustModal && buttonIndex in this.approvalKeys) {
|
|
13134
|
+
this.ptyProcess.write(`${this.approvalKeys[buttonIndex]}\r`);
|
|
13135
|
+
} else if (this.shouldResolveModalWithEnter(modal, buttonIndex)) {
|
|
13110
13136
|
this.ptyProcess.write("\r");
|
|
13111
13137
|
} else if (buttonIndex in this.approvalKeys) {
|
|
13112
13138
|
this.ptyProcess.write(this.approvalKeys[buttonIndex]);
|
|
@@ -13127,20 +13153,24 @@ ${data.message || ""}`.trim();
|
|
|
13127
13153
|
}
|
|
13128
13154
|
}
|
|
13129
13155
|
getDebugState() {
|
|
13156
|
+
const screenText = sanitizeTerminalText(this.terminalScreen.getText());
|
|
13157
|
+
const startupModal = this.startupParseGate ? this.getStartupConfirmationModal(screenText) : null;
|
|
13158
|
+
const effectiveStatus = this.projectEffectiveStatus(startupModal);
|
|
13159
|
+
const effectiveReady = this.ready || !!startupModal;
|
|
13130
13160
|
return {
|
|
13131
13161
|
type: this.cliType,
|
|
13132
13162
|
name: this.cliName,
|
|
13133
13163
|
providerResolution: this.providerResolutionMeta,
|
|
13134
|
-
status:
|
|
13135
|
-
ready:
|
|
13164
|
+
status: effectiveStatus,
|
|
13165
|
+
ready: effectiveReady,
|
|
13136
13166
|
startupParseGate: this.startupParseGate,
|
|
13137
13167
|
spawnAt: this.spawnAt,
|
|
13138
13168
|
workingDir: this.workingDir,
|
|
13139
|
-
messages: this.messages
|
|
13140
|
-
committedMessages: this.committedMessages
|
|
13141
|
-
structuredMessages: this.structuredMessages
|
|
13169
|
+
messages: this.messages,
|
|
13170
|
+
committedMessages: this.committedMessages,
|
|
13171
|
+
structuredMessages: this.structuredMessages,
|
|
13142
13172
|
messageCount: this.committedMessages.length,
|
|
13143
|
-
screenText:
|
|
13173
|
+
screenText: screenText.slice(-4e3),
|
|
13144
13174
|
currentTurnScope: this.currentTurnScope,
|
|
13145
13175
|
startupBuffer: this.startupBuffer.slice(-4e3),
|
|
13146
13176
|
recentOutputBuffer: this.recentOutputBuffer.slice(-500),
|
|
@@ -13155,7 +13185,7 @@ ${data.message || ""}`.trim();
|
|
|
13155
13185
|
lastScreenChangeAt: this.lastScreenChangeAt,
|
|
13156
13186
|
lastScreenSnapshot: this.lastScreenSnapshot.slice(-500),
|
|
13157
13187
|
isWaitingForResponse: this.isWaitingForResponse,
|
|
13158
|
-
activeModal: this.activeModal,
|
|
13188
|
+
activeModal: startupModal || this.activeModal,
|
|
13159
13189
|
lastApprovalResolvedAt: this.lastApprovalResolvedAt,
|
|
13160
13190
|
sendDelayMs: this.sendDelayMs,
|
|
13161
13191
|
sendKey: this.sendKey,
|
|
@@ -54773,7 +54803,7 @@ var init_adhdev_daemon = __esm({
|
|
|
54773
54803
|
init_version();
|
|
54774
54804
|
init_src();
|
|
54775
54805
|
init_runtime_defaults();
|
|
54776
|
-
pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.
|
|
54806
|
+
pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.90" });
|
|
54777
54807
|
AdhdevDaemon = class _AdhdevDaemon {
|
|
54778
54808
|
localHttpServer = null;
|
|
54779
54809
|
localWss = null;
|