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/cli/index.js
CHANGED
|
@@ -11940,8 +11940,8 @@ function buildCliParseInput(options) {
|
|
|
11940
11940
|
scope,
|
|
11941
11941
|
runtimeSettings
|
|
11942
11942
|
} = options;
|
|
11943
|
-
const buffer = scope ? sliceFromOffset(accumulatedBuffer, scope.bufferStart)
|
|
11944
|
-
const rawBuffer = scope ? sliceFromOffset(accumulatedRawBuffer, scope.rawBufferStart)
|
|
11943
|
+
const buffer = scope ? sliceFromOffset(accumulatedBuffer, scope.bufferStart) : accumulatedBuffer;
|
|
11944
|
+
const rawBuffer = scope ? sliceFromOffset(accumulatedRawBuffer, scope.rawBufferStart) : accumulatedRawBuffer;
|
|
11945
11945
|
const screenText = terminalScreenText;
|
|
11946
11946
|
const recentBuffer = buffer.slice(-1e3) || recentOutputBuffer;
|
|
11947
11947
|
return {
|
|
@@ -11973,8 +11973,8 @@ function summarizeCliTraceMessages(messages, limit = 3) {
|
|
|
11973
11973
|
}
|
|
11974
11974
|
function buildCliTraceParseSnapshot(options) {
|
|
11975
11975
|
const { accumulatedBuffer, accumulatedRawBuffer, responseBuffer, partialResponse, scope } = options;
|
|
11976
|
-
const scopedBuffer = scope ? sliceFromOffset(accumulatedBuffer, scope.bufferStart)
|
|
11977
|
-
const scopedRawBuffer = scope ? sliceFromOffset(accumulatedRawBuffer, scope.rawBufferStart)
|
|
11976
|
+
const scopedBuffer = scope ? sliceFromOffset(accumulatedBuffer, scope.bufferStart) : accumulatedBuffer;
|
|
11977
|
+
const scopedRawBuffer = scope ? sliceFromOffset(accumulatedRawBuffer, scope.rawBufferStart) : accumulatedRawBuffer;
|
|
11978
11978
|
return {
|
|
11979
11979
|
currentTurnScope: scope || null,
|
|
11980
11980
|
responseBuffer: summarizeCliTraceText(responseBuffer, 1200),
|
|
@@ -12638,6 +12638,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
12638
12638
|
looksLikeClaudeGeneratingLine(line) {
|
|
12639
12639
|
const trimmed = String(line || "").trim();
|
|
12640
12640
|
if (!trimmed) return false;
|
|
12641
|
+
if (/^⏵⏵\s+accept edits on/i.test(trimmed)) return false;
|
|
12641
12642
|
if (/esc to (cancel|interrupt|stop)/i.test(trimmed)) return true;
|
|
12642
12643
|
if (/^[✻✶✳✢✽⠂⠐⠒⠓⠦⠴⠶⠷⠿]+\s+\S+.*\b(?:thinking|thought for \d+s?)\b/i.test(trimmed)) return true;
|
|
12643
12644
|
if (/^[✻✶✳✢✽⠂⠐⠒⠓⠦⠴⠶⠷⠿]+\s+[A-Z][A-Za-z-]{3,}ing\b.*(?:…|\.{3})/u.test(trimmed)) return true;
|
|
@@ -12738,8 +12739,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
12738
12739
|
const buttons = Array.isArray(modal.buttons) ? modal.buttons : [];
|
|
12739
12740
|
if (buttons.length !== 1) return false;
|
|
12740
12741
|
const buttonLabel = String(buttons[0] || "").trim();
|
|
12741
|
-
|
|
12742
|
-
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);
|
|
12742
|
+
return looksLikeConfirmOnlyLabel(buttonLabel);
|
|
12743
12743
|
}
|
|
12744
12744
|
async waitForInteractivePrompt(maxWaitMs = 5e3) {
|
|
12745
12745
|
const startedAt = Date.now();
|
|
@@ -12951,7 +12951,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
12951
12951
|
`[${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)}`
|
|
12952
12952
|
);
|
|
12953
12953
|
}
|
|
12954
|
-
const shouldHoldGenerating = scriptStatus === "idle" && this.isWaitingForResponse && !modal && recentInteractiveActivity && !(visibleIdlePrompt && visibleAssistantCandidate);
|
|
12954
|
+
const shouldHoldGenerating = scriptStatus === "idle" && this.isWaitingForResponse && !modal && recentInteractiveActivity && !(visibleIdlePrompt && visibleAssistantCandidate) && !(parsedTranscript?.status === "idle" && !!lastParsedAssistant);
|
|
12955
12955
|
if (shouldHoldGenerating) {
|
|
12956
12956
|
this.clearIdleFinishCandidate("hold_generating_recent_activity");
|
|
12957
12957
|
this.setStatus("generating", "recent_activity_hold");
|
|
@@ -13353,13 +13353,22 @@ var init_provider_cli_adapter = __esm({
|
|
|
13353
13353
|
return null;
|
|
13354
13354
|
}
|
|
13355
13355
|
}
|
|
13356
|
+
projectEffectiveStatus(startupModal = null) {
|
|
13357
|
+
if (this.parseErrorMessage) return "error";
|
|
13358
|
+
if (startupModal) return "waiting_approval";
|
|
13359
|
+
if (this.isWaitingForResponse && this.currentTurnScope && this.currentStatus === "idle") return "generating";
|
|
13360
|
+
return this.currentStatus;
|
|
13361
|
+
}
|
|
13356
13362
|
// ─── Public API (CliAdapter) ───────────────────
|
|
13357
13363
|
getStatus() {
|
|
13364
|
+
const screenText = this.terminalScreen.getText() || "";
|
|
13365
|
+
const startupModal = this.startupParseGate ? this.getStartupConfirmationModal(screenText) : null;
|
|
13366
|
+
const effectiveStatus = this.projectEffectiveStatus(startupModal);
|
|
13358
13367
|
return {
|
|
13359
|
-
status:
|
|
13368
|
+
status: effectiveStatus,
|
|
13360
13369
|
messages: [...this.committedMessages],
|
|
13361
13370
|
workingDir: this.workingDir,
|
|
13362
|
-
activeModal: this.activeModal,
|
|
13371
|
+
activeModal: startupModal || this.activeModal,
|
|
13363
13372
|
errorMessage: this.parseErrorMessage || void 0,
|
|
13364
13373
|
errorReason: this.parseErrorMessage ? "parse_error" : void 0
|
|
13365
13374
|
};
|
|
@@ -13413,7 +13422,8 @@ var init_provider_cli_adapter = __esm({
|
|
|
13413
13422
|
receivedAt: typeof message.receivedAt === "number" ? message.receivedAt : message.timestamp
|
|
13414
13423
|
}));
|
|
13415
13424
|
const parsedLastAssistant = [...parsedHydratedMessages].reverse().find((message) => message.role === "assistant" && typeof message.content === "string" && message.content.trim());
|
|
13416
|
-
const
|
|
13425
|
+
const visibleIdlePrompt = this.looksLikeVisibleIdlePrompt(screenText);
|
|
13426
|
+
const shouldAdoptParsedIdleReplay = !this.currentTurnScope && !this.activeModal && !!parsedLastAssistant && parsedHydratedMessages.length > committedHydratedMessages.length && (this.currentStatus === "idle" || this.currentStatus === "generating" && this.isWaitingForResponse && parsed.status === "idle" && visibleIdlePrompt);
|
|
13417
13427
|
if (shouldAdoptParsedIdleReplay) {
|
|
13418
13428
|
this.committedMessages = normalizeCliParsedMessages(parsed.messages, {
|
|
13419
13429
|
committedMessages: this.committedMessages,
|
|
@@ -13421,6 +13431,18 @@ var init_provider_cli_adapter = __esm({
|
|
|
13421
13431
|
lastOutputAt: this.lastOutputAt
|
|
13422
13432
|
});
|
|
13423
13433
|
this.syncMessageViews();
|
|
13434
|
+
if (this.currentStatus !== "idle" || this.isWaitingForResponse) {
|
|
13435
|
+
this.responseBuffer = "";
|
|
13436
|
+
this.isWaitingForResponse = false;
|
|
13437
|
+
this.responseSettleIgnoreUntil = 0;
|
|
13438
|
+
this.submitRetryUsed = false;
|
|
13439
|
+
this.submitRetryPromptSnippet = "";
|
|
13440
|
+
this.finishRetryCount = 0;
|
|
13441
|
+
this.currentTurnScope = null;
|
|
13442
|
+
this.activeModal = null;
|
|
13443
|
+
this.setStatus("idle", "parsed_idle_replay_commit");
|
|
13444
|
+
this.onStatusChange?.();
|
|
13445
|
+
}
|
|
13424
13446
|
}
|
|
13425
13447
|
const effectiveCommittedHydratedMessages = shouldAdoptParsedIdleReplay ? this.committedMessages.map((message, index) => buildChatMessage({
|
|
13426
13448
|
...message,
|
|
@@ -14031,8 +14053,9 @@ ${data.message || ""}`.trim();
|
|
|
14031
14053
|
this.ptyProcess?.write(data);
|
|
14032
14054
|
}
|
|
14033
14055
|
resolveModal(buttonIndex) {
|
|
14034
|
-
|
|
14035
|
-
const modal = this.activeModal;
|
|
14056
|
+
const screenText = this.terminalScreen.getText() || "";
|
|
14057
|
+
const modal = this.activeModal || this.getStartupConfirmationModal(screenText);
|
|
14058
|
+
if (!this.ptyProcess || this.currentStatus !== "waiting_approval" && !modal) return;
|
|
14036
14059
|
this.clearIdleFinishCandidate("resolve_modal");
|
|
14037
14060
|
this.recordTrace("resolve_modal", {
|
|
14038
14061
|
buttonIndex,
|
|
@@ -14047,7 +14070,10 @@ ${data.message || ""}`.trim();
|
|
|
14047
14070
|
}
|
|
14048
14071
|
this.setStatus("generating", "approval_resolved");
|
|
14049
14072
|
this.onStatusChange?.();
|
|
14050
|
-
|
|
14073
|
+
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 || ""));
|
|
14074
|
+
if (startupTrustModal && buttonIndex in this.approvalKeys) {
|
|
14075
|
+
this.ptyProcess.write(`${this.approvalKeys[buttonIndex]}\r`);
|
|
14076
|
+
} else if (this.shouldResolveModalWithEnter(modal, buttonIndex)) {
|
|
14051
14077
|
this.ptyProcess.write("\r");
|
|
14052
14078
|
} else if (buttonIndex in this.approvalKeys) {
|
|
14053
14079
|
this.ptyProcess.write(this.approvalKeys[buttonIndex]);
|
|
@@ -14068,20 +14094,24 @@ ${data.message || ""}`.trim();
|
|
|
14068
14094
|
}
|
|
14069
14095
|
}
|
|
14070
14096
|
getDebugState() {
|
|
14097
|
+
const screenText = sanitizeTerminalText(this.terminalScreen.getText());
|
|
14098
|
+
const startupModal = this.startupParseGate ? this.getStartupConfirmationModal(screenText) : null;
|
|
14099
|
+
const effectiveStatus = this.projectEffectiveStatus(startupModal);
|
|
14100
|
+
const effectiveReady = this.ready || !!startupModal;
|
|
14071
14101
|
return {
|
|
14072
14102
|
type: this.cliType,
|
|
14073
14103
|
name: this.cliName,
|
|
14074
14104
|
providerResolution: this.providerResolutionMeta,
|
|
14075
|
-
status:
|
|
14076
|
-
ready:
|
|
14105
|
+
status: effectiveStatus,
|
|
14106
|
+
ready: effectiveReady,
|
|
14077
14107
|
startupParseGate: this.startupParseGate,
|
|
14078
14108
|
spawnAt: this.spawnAt,
|
|
14079
14109
|
workingDir: this.workingDir,
|
|
14080
|
-
messages: this.messages
|
|
14081
|
-
committedMessages: this.committedMessages
|
|
14082
|
-
structuredMessages: this.structuredMessages
|
|
14110
|
+
messages: this.messages,
|
|
14111
|
+
committedMessages: this.committedMessages,
|
|
14112
|
+
structuredMessages: this.structuredMessages,
|
|
14083
14113
|
messageCount: this.committedMessages.length,
|
|
14084
|
-
screenText:
|
|
14114
|
+
screenText: screenText.slice(-4e3),
|
|
14085
14115
|
currentTurnScope: this.currentTurnScope,
|
|
14086
14116
|
startupBuffer: this.startupBuffer.slice(-4e3),
|
|
14087
14117
|
recentOutputBuffer: this.recentOutputBuffer.slice(-500),
|
|
@@ -14096,7 +14126,7 @@ ${data.message || ""}`.trim();
|
|
|
14096
14126
|
lastScreenChangeAt: this.lastScreenChangeAt,
|
|
14097
14127
|
lastScreenSnapshot: this.lastScreenSnapshot.slice(-500),
|
|
14098
14128
|
isWaitingForResponse: this.isWaitingForResponse,
|
|
14099
|
-
activeModal: this.activeModal,
|
|
14129
|
+
activeModal: startupModal || this.activeModal,
|
|
14100
14130
|
lastApprovalResolvedAt: this.lastApprovalResolvedAt,
|
|
14101
14131
|
sendDelayMs: this.sendDelayMs,
|
|
14102
14132
|
sendKey: this.sendKey,
|
|
@@ -86478,7 +86508,7 @@ var init_adhdev_daemon = __esm({
|
|
|
86478
86508
|
init_version();
|
|
86479
86509
|
init_src();
|
|
86480
86510
|
init_runtime_defaults();
|
|
86481
|
-
pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.
|
|
86511
|
+
pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.90" });
|
|
86482
86512
|
AdhdevDaemon = class _AdhdevDaemon {
|
|
86483
86513
|
localHttpServer = null;
|
|
86484
86514
|
localWss = null;
|