@adhdev/daemon-core 0.8.96 → 0.8.97
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 +32 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -2
- package/dist/index.mjs.map +1 -1
- package/dist/providers/cli-provider-instance.d.ts +2 -0
- package/node_modules/@adhdev/session-host-core/package.json +1 -1
- package/package.json +1 -1
- package/src/cli-adapters/provider-cli-adapter.ts +33 -1
- package/src/providers/cli-provider-instance.ts +13 -1
package/dist/index.js
CHANGED
|
@@ -1857,6 +1857,28 @@ __export(provider_cli_adapter_exports, {
|
|
|
1857
1857
|
ProviderCliAdapter: () => ProviderCliAdapter,
|
|
1858
1858
|
normalizeCliProviderForRuntime: () => normalizeCliProviderForRuntime
|
|
1859
1859
|
});
|
|
1860
|
+
function normalizeComparableTranscriptText(value) {
|
|
1861
|
+
return sanitizeTerminalText(String(value || "")).replace(/\s+/g, " ").trim();
|
|
1862
|
+
}
|
|
1863
|
+
function parsedTranscriptIsRicherThanCommitted(parsedMessages, committedMessages) {
|
|
1864
|
+
if (!Array.isArray(parsedMessages) || !Array.isArray(committedMessages)) return false;
|
|
1865
|
+
if (parsedMessages.length > committedMessages.length) return true;
|
|
1866
|
+
if (parsedMessages.length !== committedMessages.length) return false;
|
|
1867
|
+
for (let index = 0; index < parsedMessages.length; index += 1) {
|
|
1868
|
+
const parsed = parsedMessages[index];
|
|
1869
|
+
const committed = committedMessages[index];
|
|
1870
|
+
if (!parsed || !committed) return false;
|
|
1871
|
+
if ((parsed.role || "") !== (committed.role || "")) return false;
|
|
1872
|
+
if (parsed.id && committed.id && String(parsed.id) !== String(committed.id)) return false;
|
|
1873
|
+
if (typeof parsed.index === "number" && typeof committed.index === "number" && parsed.index !== committed.index) return false;
|
|
1874
|
+
const parsedText = normalizeComparableTranscriptText(parsed.content);
|
|
1875
|
+
const committedText = normalizeComparableTranscriptText(committed.content);
|
|
1876
|
+
if (!parsedText || !committedText || parsedText === committedText) continue;
|
|
1877
|
+
if (parsedText.length > committedText.length && parsedText.startsWith(committedText)) return true;
|
|
1878
|
+
return false;
|
|
1879
|
+
}
|
|
1880
|
+
return false;
|
|
1881
|
+
}
|
|
1860
1882
|
var os10, ProviderCliAdapter;
|
|
1861
1883
|
var init_provider_cli_adapter = __esm({
|
|
1862
1884
|
"src/cli-adapters/provider-cli-adapter.ts"() {
|
|
@@ -3184,7 +3206,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
3184
3206
|
}));
|
|
3185
3207
|
const parsedLastAssistant = [...parsedHydratedMessages].reverse().find((message) => message.role === "assistant" && typeof message.content === "string" && message.content.trim());
|
|
3186
3208
|
const visibleIdlePrompt = this.looksLikeVisibleIdlePrompt(screenText);
|
|
3187
|
-
const shouldAdoptParsedIdleReplay = !this.currentTurnScope && !this.activeModal && !!parsedLastAssistant && parsedHydratedMessages
|
|
3209
|
+
const shouldAdoptParsedIdleReplay = !this.currentTurnScope && !this.activeModal && !!parsedLastAssistant && parsedTranscriptIsRicherThanCommitted(parsedHydratedMessages, committedHydratedMessages) && (this.currentStatus === "idle" || this.currentStatus === "generating" && this.isWaitingForResponse && parsed.status === "idle" && visibleIdlePrompt);
|
|
3188
3210
|
if (shouldAdoptParsedIdleReplay) {
|
|
3189
3211
|
this.committedMessages = normalizeCliParsedMessages(parsed.messages, {
|
|
3190
3212
|
committedMessages: this.committedMessages,
|
|
@@ -12696,6 +12718,8 @@ var CliProviderInstance = class {
|
|
|
12696
12718
|
generatingDebounceTimer = null;
|
|
12697
12719
|
generatingDebouncePending = null;
|
|
12698
12720
|
lastApprovalEventAt = 0;
|
|
12721
|
+
autoApproveBusy = false;
|
|
12722
|
+
autoApproveBusyTimer = null;
|
|
12699
12723
|
controlValues = {};
|
|
12700
12724
|
summaryMetadata = void 0;
|
|
12701
12725
|
appliedEffectKeys = /* @__PURE__ */ new Set();
|
|
@@ -12987,7 +13011,13 @@ var CliProviderInstance = class {
|
|
|
12987
13011
|
const parsedStatus = this.adapter.getScriptParsedStatus?.() || null;
|
|
12988
13012
|
const rawStatus = adapterStatus.status;
|
|
12989
13013
|
const autoApproveActive = rawStatus === "waiting_approval" && this.shouldAutoApprove();
|
|
12990
|
-
if (autoApproveActive) {
|
|
13014
|
+
if (autoApproveActive && !this.autoApproveBusy) {
|
|
13015
|
+
this.autoApproveBusy = true;
|
|
13016
|
+
if (this.autoApproveBusyTimer) clearTimeout(this.autoApproveBusyTimer);
|
|
13017
|
+
this.autoApproveBusyTimer = setTimeout(() => {
|
|
13018
|
+
this.autoApproveBusy = false;
|
|
13019
|
+
this.autoApproveBusyTimer = null;
|
|
13020
|
+
}, 2e3);
|
|
12991
13021
|
const { index: buttonIndex, label: buttonLabel } = pickApprovalButton(adapterStatus.activeModal?.buttons, this.provider);
|
|
12992
13022
|
this.recordAutoApproval(adapterStatus.activeModal?.message, buttonLabel, now);
|
|
12993
13023
|
setTimeout(() => {
|