@adhdev/daemon-standalone 0.9.82-rc.267 → 0.9.82-rc.269
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 +234 -33
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/public/assets/index-C5JKUf-W.js +113 -0
- package/public/assets/index-DelY1D_j.js +113 -0
- package/public/index.html +1 -1
- package/vendor/mcp-server/index.js +254 -26
- package/vendor/mcp-server/index.js.map +1 -1
package/dist/index.js
CHANGED
|
@@ -29973,10 +29973,10 @@ var require_dist3 = __commonJS({
|
|
|
29973
29973
|
}
|
|
29974
29974
|
function getDaemonBuildInfo() {
|
|
29975
29975
|
if (cached2) return cached2;
|
|
29976
|
-
const commit = readInjected(true ? "
|
|
29977
|
-
const commitShort = readInjected(true ? "
|
|
29978
|
-
const version2 = readInjected(true ? "0.9.82-rc.
|
|
29979
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
29976
|
+
const commit = readInjected(true ? "025d8bef81a66e7b44a5ba5d5a04e063db46db4e" : void 0) ?? "unknown";
|
|
29977
|
+
const commitShort = readInjected(true ? "025d8bef" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
29978
|
+
const version2 = readInjected(true ? "0.9.82-rc.269" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
29979
|
+
const builtAt = readInjected(true ? "2026-06-14T22:12:06.668Z" : void 0);
|
|
29980
29980
|
cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
|
|
29981
29981
|
return cached2;
|
|
29982
29982
|
}
|
|
@@ -39276,7 +39276,7 @@ Next step: ${nextStep}`;
|
|
|
39276
39276
|
"@adhdev/ghostty-vt-node"
|
|
39277
39277
|
];
|
|
39278
39278
|
cachedBindingError = null;
|
|
39279
|
-
GhosttyVtTerminalBackend = class {
|
|
39279
|
+
GhosttyVtTerminalBackend = class _GhosttyVtTerminalBackend {
|
|
39280
39280
|
kind = "ghostty-vt";
|
|
39281
39281
|
terminal;
|
|
39282
39282
|
rows;
|
|
@@ -39298,17 +39298,30 @@ Next step: ${nextStep}`;
|
|
|
39298
39298
|
if (!data || this.disposed) return;
|
|
39299
39299
|
this.terminal.write(data);
|
|
39300
39300
|
}
|
|
39301
|
+
formatLines() {
|
|
39302
|
+
const raw = this.terminal.formatPlainText({ trim: false }) || "";
|
|
39303
|
+
if (!raw) return [];
|
|
39304
|
+
return raw.split("\n").map((row) => row.replace(/\s+$/, ""));
|
|
39305
|
+
}
|
|
39306
|
+
static trimBlankEnds(lines) {
|
|
39307
|
+
let first = 0;
|
|
39308
|
+
let last = lines.length;
|
|
39309
|
+
while (first < last && !lines[first]) first += 1;
|
|
39310
|
+
while (last > first && !lines[last - 1]) last -= 1;
|
|
39311
|
+
return lines.slice(first, last).join("\n");
|
|
39312
|
+
}
|
|
39301
39313
|
getText() {
|
|
39302
39314
|
if (this.disposed) return "";
|
|
39303
|
-
const
|
|
39304
|
-
if (
|
|
39305
|
-
const lines = raw.split("\n").map((row) => row.replace(/\s+$/, ""));
|
|
39315
|
+
const lines = this.formatLines();
|
|
39316
|
+
if (lines.length === 0) return "";
|
|
39306
39317
|
const viewport = lines.length > this.rows ? lines.slice(-this.rows) : lines;
|
|
39307
|
-
|
|
39308
|
-
|
|
39309
|
-
|
|
39310
|
-
|
|
39311
|
-
|
|
39318
|
+
return _GhosttyVtTerminalBackend.trimBlankEnds(viewport);
|
|
39319
|
+
}
|
|
39320
|
+
getTextWithScrollback() {
|
|
39321
|
+
if (this.disposed) return "";
|
|
39322
|
+
const lines = this.formatLines();
|
|
39323
|
+
if (lines.length === 0) return "";
|
|
39324
|
+
return _GhosttyVtTerminalBackend.trimBlankEnds(lines);
|
|
39312
39325
|
}
|
|
39313
39326
|
getCursorPosition() {
|
|
39314
39327
|
if (this.disposed) return { col: 0, row: 0 };
|
|
@@ -39361,6 +39374,10 @@ Next step: ${nextStep}`;
|
|
|
39361
39374
|
getText() {
|
|
39362
39375
|
return this.terminal.getText();
|
|
39363
39376
|
}
|
|
39377
|
+
/** Full buffer including scrollback history (see backend doc). */
|
|
39378
|
+
getTextWithScrollback() {
|
|
39379
|
+
return this.terminal.getTextWithScrollback();
|
|
39380
|
+
}
|
|
39364
39381
|
getCursorPosition() {
|
|
39365
39382
|
return this.terminal.getCursorPosition();
|
|
39366
39383
|
}
|
|
@@ -44827,11 +44844,22 @@ ${lastSnapshot}`;
|
|
|
44827
44844
|
if (response.promptId !== prompt.promptId) throw new Error("Interactive prompt response does not match active prompt");
|
|
44828
44845
|
const steps = [];
|
|
44829
44846
|
for (const question of prompt.questions) {
|
|
44830
|
-
if (question.multiSelect) throw new Error("Claude TUI multi-select prompts are not supported yet");
|
|
44831
44847
|
const answer = response.answers[question.questionId];
|
|
44832
44848
|
if (!answer) throw new Error(`Missing answer for ${question.questionId}`);
|
|
44833
44849
|
const freeformText = answer.freeformText?.trim() ?? "";
|
|
44834
|
-
if (
|
|
44850
|
+
if (question.multiSelect) {
|
|
44851
|
+
const labels = answer.selectedLabels;
|
|
44852
|
+
if (labels.length === 0) {
|
|
44853
|
+
throw new Error(`Expected at least one selected label for ${question.questionId}`);
|
|
44854
|
+
}
|
|
44855
|
+
for (const label of labels) {
|
|
44856
|
+
const selectedIndex = question.options.findIndex((option) => option.label === label);
|
|
44857
|
+
if (selectedIndex < 0) throw new Error(`Unknown option for ${question.questionId}: ${label}`);
|
|
44858
|
+
steps.push(String(selectedIndex + 1));
|
|
44859
|
+
steps.push(" ");
|
|
44860
|
+
}
|
|
44861
|
+
steps.push("\r");
|
|
44862
|
+
} else if (freeformText) {
|
|
44835
44863
|
const typeOptionIndex = question.options.findIndex((o) => /^Type something\.?$/i.test(o.label));
|
|
44836
44864
|
const optionNumber = typeOptionIndex >= 0 ? typeOptionIndex + 1 : question.options.length;
|
|
44837
44865
|
steps.push(String(optionNumber));
|
|
@@ -49926,6 +49954,24 @@ ${cleanBody}`;
|
|
|
49926
49954
|
var savedHistoryFileSummaryCache = /* @__PURE__ */ new Map();
|
|
49927
49955
|
var savedHistoryBackgroundRefresh = /* @__PURE__ */ new Set();
|
|
49928
49956
|
var savedHistoryRollupInFlight = /* @__PURE__ */ new Set();
|
|
49957
|
+
var BOUNDED_TAIL_CACHE_MAX_ENTRIES = 64;
|
|
49958
|
+
var boundedTailReadCache = /* @__PURE__ */ new Map();
|
|
49959
|
+
function readBoundedTailCache(key, signature) {
|
|
49960
|
+
const cached22 = boundedTailReadCache.get(key);
|
|
49961
|
+
if (!cached22 || cached22.signature !== signature) return null;
|
|
49962
|
+
boundedTailReadCache.delete(key);
|
|
49963
|
+
boundedTailReadCache.set(key, cached22);
|
|
49964
|
+
return cached22.result;
|
|
49965
|
+
}
|
|
49966
|
+
function writeBoundedTailCache(key, signature, result) {
|
|
49967
|
+
boundedTailReadCache.delete(key);
|
|
49968
|
+
boundedTailReadCache.set(key, { signature, result });
|
|
49969
|
+
while (boundedTailReadCache.size > BOUNDED_TAIL_CACHE_MAX_ENTRIES) {
|
|
49970
|
+
const oldest = boundedTailReadCache.keys().next().value;
|
|
49971
|
+
if (oldest === void 0) break;
|
|
49972
|
+
boundedTailReadCache.delete(oldest);
|
|
49973
|
+
}
|
|
49974
|
+
}
|
|
49929
49975
|
function normalizeHistoryComparable(text) {
|
|
49930
49976
|
return String(text || "").replace(/\s+/g, " ").trim();
|
|
49931
49977
|
}
|
|
@@ -50810,12 +50856,73 @@ ${cleanBody}`;
|
|
|
50810
50856
|
const sliced = collapsed.slice(startInclusive, endExclusive);
|
|
50811
50857
|
return { messages: sliced, hasMore: startInclusive > 0 };
|
|
50812
50858
|
}
|
|
50859
|
+
var BOUNDED_TAIL_MAX_LIMIT = 5e3;
|
|
50860
|
+
var BOUNDED_TAIL_SLACK = 50;
|
|
50861
|
+
function isBoundedTailRequest(limit, offset, excludeRecentCount) {
|
|
50862
|
+
const numericLimit = Number(limit);
|
|
50863
|
+
if (!Number.isFinite(numericLimit) || numericLimit <= 0) return false;
|
|
50864
|
+
if (numericLimit > BOUNDED_TAIL_MAX_LIMIT) return false;
|
|
50865
|
+
const numericOffset = Number(offset);
|
|
50866
|
+
const numericExclude = Number(excludeRecentCount);
|
|
50867
|
+
if (!Number.isFinite(numericOffset) || !Number.isFinite(numericExclude)) return false;
|
|
50868
|
+
return true;
|
|
50869
|
+
}
|
|
50870
|
+
function readBoundedTailRecords(agentType, dir, files, needed) {
|
|
50871
|
+
const collected = [];
|
|
50872
|
+
const seen = /* @__PURE__ */ new Set();
|
|
50873
|
+
let readAllFiles = true;
|
|
50874
|
+
for (let f = 0; f < files.length; f++) {
|
|
50875
|
+
const filePath = path12.join(dir, files[f]);
|
|
50876
|
+
let content;
|
|
50877
|
+
try {
|
|
50878
|
+
content = fs52.readFileSync(filePath, "utf-8");
|
|
50879
|
+
} catch {
|
|
50880
|
+
continue;
|
|
50881
|
+
}
|
|
50882
|
+
const lines = content.trim().split("\n").filter(Boolean);
|
|
50883
|
+
for (let i = lines.length - 1; i >= 0; i--) {
|
|
50884
|
+
try {
|
|
50885
|
+
const parsed = JSON.parse(lines[i]);
|
|
50886
|
+
const sanitizedMessage = sanitizeHistoryMessage(agentType, parsed);
|
|
50887
|
+
if (!sanitizedMessage) continue;
|
|
50888
|
+
const hash2 = buildHistoryMessageHash(agentType, sanitizedMessage);
|
|
50889
|
+
if (seen.has(hash2)) continue;
|
|
50890
|
+
seen.add(hash2);
|
|
50891
|
+
collected.push(sanitizedMessage);
|
|
50892
|
+
} catch {
|
|
50893
|
+
}
|
|
50894
|
+
}
|
|
50895
|
+
if (collected.length >= needed && f < files.length - 1) {
|
|
50896
|
+
readAllFiles = false;
|
|
50897
|
+
break;
|
|
50898
|
+
}
|
|
50899
|
+
}
|
|
50900
|
+
collected.reverse();
|
|
50901
|
+
return { records: collected, readAllFiles };
|
|
50902
|
+
}
|
|
50813
50903
|
function readChatHistory(agentType, offset = 0, limit = 30, historySessionId, excludeRecentCount = 0, historyBehavior) {
|
|
50814
50904
|
try {
|
|
50815
50905
|
const sanitized = agentType.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
50816
50906
|
const dir = path12.join(HISTORY_DIR, sanitized);
|
|
50817
50907
|
if (!fs52.existsSync(dir)) return { messages: [], hasMore: false };
|
|
50818
50908
|
const files = listHistoryFiles(dir, historySessionId);
|
|
50909
|
+
const bounded = isBoundedTailRequest(limit, offset, excludeRecentCount);
|
|
50910
|
+
if (bounded) {
|
|
50911
|
+
const fileSignatures = buildSavedHistoryFileSignatureMap(dir, files);
|
|
50912
|
+
const cacheKey = `${sanitized}\0${historySessionId || ""}\0${offset}\0${limit}\0${excludeRecentCount}\0${historyBehavior?.collapseConsecutiveAssistantTurns ? "1" : "0"}`;
|
|
50913
|
+
const signature = buildSavedHistoryCacheSignature(files, fileSignatures);
|
|
50914
|
+
const cached22 = readBoundedTailCache(cacheKey, signature);
|
|
50915
|
+
if (cached22) return cached22;
|
|
50916
|
+
const numericLimit = Math.max(1, Number(limit));
|
|
50917
|
+
const numericOffset = Math.max(0, Number(offset));
|
|
50918
|
+
const numericExclude = Math.max(0, Number(excludeRecentCount));
|
|
50919
|
+
const needed = numericLimit + numericOffset + numericExclude + Math.max(BOUNDED_TAIL_SLACK, numericLimit);
|
|
50920
|
+
const { records, readAllFiles } = readBoundedTailRecords(agentType, dir, files, needed);
|
|
50921
|
+
const result = pageHistoryRecords(agentType, records, offset, limit, excludeRecentCount, historyBehavior);
|
|
50922
|
+
const boundedResult = readAllFiles ? result : { messages: result.messages, hasMore: true };
|
|
50923
|
+
writeBoundedTailCache(cacheKey, signature, boundedResult);
|
|
50924
|
+
return boundedResult;
|
|
50925
|
+
}
|
|
50819
50926
|
const allMessages = [];
|
|
50820
50927
|
const seen = /* @__PURE__ */ new Set();
|
|
50821
50928
|
for (const file2 of files) {
|
|
@@ -53973,6 +54080,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
53973
54080
|
var CHAT_SOURCE_REGISTRY = new ChatSourceRegistry();
|
|
53974
54081
|
var RECENT_SEND_WINDOW_MS = 1200;
|
|
53975
54082
|
var READ_CHAT_PROVIDER_EVAL_TIMEOUT_MS = 25e3;
|
|
54083
|
+
var HOT_TAIL_MIN_LIMIT = 60;
|
|
53976
54084
|
var HERMES_CLI_STARTING_SEND_SETTLE_MS = 2e3;
|
|
53977
54085
|
var CLI_NATIVE_TRANSCRIPT_PROVIDERS = /* @__PURE__ */ new Set(["codex-cli", "claude-cli", "hermes-cli", "antigravity-cli"]);
|
|
53978
54086
|
var warnedLegacyNativeAllowlistHits = /* @__PURE__ */ new Set();
|
|
@@ -54515,7 +54623,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
54515
54623
|
const history = readChatHistory(
|
|
54516
54624
|
args.providerType,
|
|
54517
54625
|
0,
|
|
54518
|
-
Math.max(args.tailLimit || 0,
|
|
54626
|
+
Math.max(args.tailLimit || 0, HOT_TAIL_MIN_LIMIT),
|
|
54519
54627
|
targetSessionId,
|
|
54520
54628
|
0,
|
|
54521
54629
|
args.historyBehavior
|
|
@@ -55408,7 +55516,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
55408
55516
|
const nativeHistoryLimit = Math.max(
|
|
55409
55517
|
normalizeReadChatTailLimit(args) || 0,
|
|
55410
55518
|
returnedMessages.length,
|
|
55411
|
-
|
|
55519
|
+
HOT_TAIL_MIN_LIMIT
|
|
55412
55520
|
);
|
|
55413
55521
|
const nativeHistorySessionId = supportsNative ? resolveCliNativeHistorySessionId(args, historySessionId, providerSessionId) : void 0;
|
|
55414
55522
|
const targetSessionId = typeof args?.targetSessionId === "string" ? args.targetSessionId.trim() : "";
|
|
@@ -58847,6 +58955,15 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
58847
58955
|
snapshot() {
|
|
58848
58956
|
return this.lastScreen || this.computeScreen();
|
|
58849
58957
|
}
|
|
58958
|
+
/**
|
|
58959
|
+
* Full-buffer snapshot including scrollback history. Unlike snapshot()
|
|
58960
|
+
* (visible viewport only), this survives a tall prompt whose top has
|
|
58961
|
+
* scrolled off-screen — used for content-pattern extraction (modal
|
|
58962
|
+
* buttons / approval anchors), NOT for cursor-relative conditions.
|
|
58963
|
+
*/
|
|
58964
|
+
snapshotWithScrollback() {
|
|
58965
|
+
return this.screen.getTextWithScrollback();
|
|
58966
|
+
}
|
|
58850
58967
|
getCursorPosition() {
|
|
58851
58968
|
const pos = this.screen.getCursorPosition();
|
|
58852
58969
|
return { row: pos.row, col: pos.col };
|
|
@@ -59019,6 +59136,18 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
59019
59136
|
getScreen() {
|
|
59020
59137
|
return this.adapter.snapshot();
|
|
59021
59138
|
}
|
|
59139
|
+
/** Scrollback-inclusive screen as line array — used only for modal/button
|
|
59140
|
+
* content extraction so a tall prompt's off-screen anchors stay matchable.
|
|
59141
|
+
* Falls back to the viewport snapshot if scrollback read is unavailable. */
|
|
59142
|
+
scrollbackLines() {
|
|
59143
|
+
let screen = "";
|
|
59144
|
+
try {
|
|
59145
|
+
screen = this.adapter.snapshotWithScrollback();
|
|
59146
|
+
} catch {
|
|
59147
|
+
}
|
|
59148
|
+
if (!screen) screen = this.adapter.snapshot();
|
|
59149
|
+
return screen.split("\n").map((l) => l.endsWith("\r") ? l.slice(0, -1) : l);
|
|
59150
|
+
}
|
|
59022
59151
|
getSpecPath() {
|
|
59023
59152
|
return this.opts.specPath;
|
|
59024
59153
|
}
|
|
@@ -59200,9 +59329,12 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
59200
59329
|
const screen = this.adapter.snapshot();
|
|
59201
59330
|
const lines = screen.split("\n").map((l) => l.endsWith("\r") ? l.slice(0, -1) : l);
|
|
59202
59331
|
const sections = resolveSections(this.spec.sections ?? {}, lines);
|
|
59203
|
-
const
|
|
59332
|
+
const modalLines = state.modal ? this.scrollbackLines() : lines;
|
|
59333
|
+
const modalSections = state.modal ? resolveSections(this.spec.sections ?? {}, modalLines) : sections;
|
|
59334
|
+
const modalFullScreen = modalLines.join("\n");
|
|
59335
|
+
const modal = this.deriveModal(state, modalSections, modalFullScreen);
|
|
59204
59336
|
const controls = this.deriveControls(state.id);
|
|
59205
|
-
const title = modal?.title ?? this.deriveTitle(state,
|
|
59337
|
+
const title = modal?.title ?? this.deriveTitle(state, modalSections, modalFullScreen);
|
|
59206
59338
|
const next = {
|
|
59207
59339
|
// status is derived from the FSM state itself (statusForState), NOT from
|
|
59208
59340
|
// whether a modal was parsed this frame. A modal state whose buttons briefly
|
|
@@ -61061,7 +61193,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
61061
61193
|
}
|
|
61062
61194
|
throw new Error(`CLI runtime did not become ready within ${timeoutMs}ms`);
|
|
61063
61195
|
}
|
|
61064
|
-
var CliProviderInstance = class {
|
|
61196
|
+
var CliProviderInstance = class _CliProviderInstance {
|
|
61065
61197
|
constructor(provider, workingDir, cliArgs = [], instanceId, transportFactory, options) {
|
|
61066
61198
|
this.provider = provider;
|
|
61067
61199
|
this.workingDir = workingDir;
|
|
@@ -61081,6 +61213,18 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
61081
61213
|
}
|
|
61082
61214
|
type;
|
|
61083
61215
|
category = "cli";
|
|
61216
|
+
/**
|
|
61217
|
+
* Quiet period an approval modal's signature must be stable before
|
|
61218
|
+
* auto-approve sends the approve key. Guards against firing on a prompt
|
|
61219
|
+
* that is still streaming into the PTY (the "resolves too fast" symptom):
|
|
61220
|
+
* while the modal text/buttons are still changing, every frame yields a
|
|
61221
|
+
* new signature and the settle clock restarts. Once the prompt finishes
|
|
61222
|
+
* rendering the signature holds and the key is sent after this window.
|
|
61223
|
+
* Bounded + small so genuine approvals stay timely. The FSM is already
|
|
61224
|
+
* authoritative over the `waiting_approval` state; this only delays the
|
|
61225
|
+
* keystroke until the modal *content* has settled.
|
|
61226
|
+
*/
|
|
61227
|
+
static AUTO_APPROVE_SETTLE_MS = 600;
|
|
61084
61228
|
adapter;
|
|
61085
61229
|
context = null;
|
|
61086
61230
|
events = [];
|
|
@@ -61094,6 +61238,14 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
61094
61238
|
autoApproveBusy = false;
|
|
61095
61239
|
autoApproveBusyTimer = null;
|
|
61096
61240
|
lastAutoApprovalSignature = "";
|
|
61241
|
+
// Settle gate: the approval modal's signature + the wall-clock when this
|
|
61242
|
+
// exact signature was first observed. Auto-approve only fires once the
|
|
61243
|
+
// SAME signature has been stable for AUTO_APPROVE_SETTLE_MS, so a prompt
|
|
61244
|
+
// still streaming into the PTY (its buttons/message changing frame to
|
|
61245
|
+
// frame) keeps resetting the timer and is never approved half-rendered.
|
|
61246
|
+
pendingAutoApprovalSignature = "";
|
|
61247
|
+
pendingAutoApprovalSince = 0;
|
|
61248
|
+
autoApproveSettleTimer = null;
|
|
61097
61249
|
controlValues = {};
|
|
61098
61250
|
summaryMetadata = void 0;
|
|
61099
61251
|
appliedEffectKeys = /* @__PURE__ */ new Set();
|
|
@@ -61528,6 +61680,14 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
61528
61680
|
dispose() {
|
|
61529
61681
|
this.adapter.shutdown();
|
|
61530
61682
|
this.monitor.reset();
|
|
61683
|
+
if (this.autoApproveSettleTimer) {
|
|
61684
|
+
clearTimeout(this.autoApproveSettleTimer);
|
|
61685
|
+
this.autoApproveSettleTimer = null;
|
|
61686
|
+
}
|
|
61687
|
+
if (this.autoApproveBusyTimer) {
|
|
61688
|
+
clearTimeout(this.autoApproveBusyTimer);
|
|
61689
|
+
this.autoApproveBusyTimer = null;
|
|
61690
|
+
}
|
|
61531
61691
|
this.appliedEffectKeys.clear();
|
|
61532
61692
|
try {
|
|
61533
61693
|
this.cachedSqliteDb?.close();
|
|
@@ -61878,6 +62038,12 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
61878
62038
|
const autoApproveActive = adapterStatus?.status === "waiting_approval" && this.shouldAutoApprove();
|
|
61879
62039
|
if (!autoApproveActive) {
|
|
61880
62040
|
this.lastAutoApprovalSignature = "";
|
|
62041
|
+
this.pendingAutoApprovalSignature = "";
|
|
62042
|
+
this.pendingAutoApprovalSince = 0;
|
|
62043
|
+
if (this.autoApproveSettleTimer) {
|
|
62044
|
+
clearTimeout(this.autoApproveSettleTimer);
|
|
62045
|
+
this.autoApproveSettleTimer = null;
|
|
62046
|
+
}
|
|
61881
62047
|
return autoApproveActive;
|
|
61882
62048
|
}
|
|
61883
62049
|
const modal = adapterStatus.activeModal;
|
|
@@ -61896,22 +62062,57 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
61896
62062
|
buttons.join("|"),
|
|
61897
62063
|
buttonIndex
|
|
61898
62064
|
].join("::");
|
|
61899
|
-
if (
|
|
61900
|
-
|
|
61901
|
-
|
|
61902
|
-
|
|
61903
|
-
this.
|
|
61904
|
-
|
|
61905
|
-
|
|
61906
|
-
|
|
61907
|
-
|
|
61908
|
-
this.
|
|
61909
|
-
setTimeout(() => {
|
|
61910
|
-
this.
|
|
61911
|
-
|
|
62065
|
+
if (this.autoApproveBusy && signature === this.lastAutoApprovalSignature) {
|
|
62066
|
+
return autoApproveActive;
|
|
62067
|
+
}
|
|
62068
|
+
if (signature !== this.pendingAutoApprovalSignature) {
|
|
62069
|
+
this.pendingAutoApprovalSignature = signature;
|
|
62070
|
+
this.pendingAutoApprovalSince = now;
|
|
62071
|
+
}
|
|
62072
|
+
const settledForMs = now - this.pendingAutoApprovalSince;
|
|
62073
|
+
if (settledForMs < _CliProviderInstance.AUTO_APPROVE_SETTLE_MS) {
|
|
62074
|
+
if (this.autoApproveSettleTimer) clearTimeout(this.autoApproveSettleTimer);
|
|
62075
|
+
this.autoApproveSettleTimer = setTimeout(() => {
|
|
62076
|
+
this.autoApproveSettleTimer = null;
|
|
62077
|
+
this.recheckAutoApproveSettled();
|
|
62078
|
+
}, _CliProviderInstance.AUTO_APPROVE_SETTLE_MS - settledForMs + 20);
|
|
62079
|
+
return autoApproveActive;
|
|
62080
|
+
}
|
|
62081
|
+
if (this.autoApproveSettleTimer) {
|
|
62082
|
+
clearTimeout(this.autoApproveSettleTimer);
|
|
62083
|
+
this.autoApproveSettleTimer = null;
|
|
61912
62084
|
}
|
|
62085
|
+
this.autoApproveBusy = true;
|
|
62086
|
+
this.lastAutoApprovalSignature = signature;
|
|
62087
|
+
this.pendingAutoApprovalSignature = "";
|
|
62088
|
+
this.pendingAutoApprovalSince = 0;
|
|
62089
|
+
if (this.autoApproveBusyTimer) clearTimeout(this.autoApproveBusyTimer);
|
|
62090
|
+
this.autoApproveBusyTimer = setTimeout(() => {
|
|
62091
|
+
this.autoApproveBusy = false;
|
|
62092
|
+
this.autoApproveBusyTimer = null;
|
|
62093
|
+
this.lastAutoApprovalSignature = "";
|
|
62094
|
+
}, 5e3);
|
|
62095
|
+
this.recordAutoApproval(modal?.message, buttonLabel, now);
|
|
62096
|
+
setTimeout(() => {
|
|
62097
|
+
this.adapter.resolveModal(buttonIndex);
|
|
62098
|
+
}, 0);
|
|
61913
62099
|
return autoApproveActive;
|
|
61914
62100
|
}
|
|
62101
|
+
/**
|
|
62102
|
+
* Re-drive the auto-approve check after the settle quiet window elapses.
|
|
62103
|
+
* The PTY may have gone silent once the approval prompt finished painting,
|
|
62104
|
+
* so no status-change frame is guaranteed to re-enter maybeAutoApproveStatus
|
|
62105
|
+
* — this timer-driven re-check picks up the now-settled modal and fires.
|
|
62106
|
+
* Deliberately lighter than detectStatusTransition(): it only re-evaluates
|
|
62107
|
+
* the approval decision; the next real PTY frame refreshes visible status.
|
|
62108
|
+
*/
|
|
62109
|
+
recheckAutoApproveSettled() {
|
|
62110
|
+
try {
|
|
62111
|
+
const adapterStatus = this.adapter.getStatus({ allowParse: false });
|
|
62112
|
+
this.maybeAutoApproveStatus(adapterStatus, Date.now());
|
|
62113
|
+
} catch {
|
|
62114
|
+
}
|
|
62115
|
+
}
|
|
61915
62116
|
detectStatusTransition() {
|
|
61916
62117
|
const now = Date.now();
|
|
61917
62118
|
const adapterStatus = this.adapter.getStatus({ allowParse: false });
|