@adhdev/daemon-core 0.9.82-rc.455 → 0.9.82-rc.456
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 +85 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +85 -9
- package/dist/index.mjs.map +1 -1
- package/dist/providers/approval-utils.d.ts +25 -0
- package/dist/providers/cli-provider-instance.d.ts +26 -1
- package/dist/providers/manual-attendance.d.ts +16 -0
- package/dist/providers/provider-instance.d.ts +8 -1
- package/package.json +3 -3
- package/src/commands/handler.ts +6 -3
- package/src/providers/approval-utils.ts +42 -0
- package/src/providers/cli-provider-instance.ts +87 -6
- package/src/providers/manual-attendance.ts +20 -0
- package/src/providers/provider-instance.ts +6 -1
- package/src/providers/sdk/v1/builders/cli/parse-approval.ts +13 -2
package/dist/index.mjs
CHANGED
|
@@ -404,10 +404,10 @@ function readInjected(value) {
|
|
|
404
404
|
}
|
|
405
405
|
function getDaemonBuildInfo() {
|
|
406
406
|
if (cached) return cached;
|
|
407
|
-
const commit = readInjected(true ? "
|
|
408
|
-
const commitShort = readInjected(true ? "
|
|
409
|
-
const version = readInjected(true ? "0.9.82-rc.
|
|
410
|
-
const builtAt = readInjected(true ? "2026-07-
|
|
407
|
+
const commit = readInjected(true ? "49032ec6c48a0cbe6f122e2615088b38407712b6" : void 0) ?? "unknown";
|
|
408
|
+
const commitShort = readInjected(true ? "49032ec6" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
409
|
+
const version = readInjected(true ? "0.9.82-rc.456" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
410
|
+
const builtAt = readInjected(true ? "2026-07-04T07:05:38.214Z" : void 0);
|
|
411
411
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
412
412
|
return cached;
|
|
413
413
|
}
|
|
@@ -18413,6 +18413,20 @@ function isNegativeApprovalLabel(value) {
|
|
|
18413
18413
|
function hasNegativeApprovalOption(buttons) {
|
|
18414
18414
|
return (buttons || []).some((button) => isNegativeApprovalLabel(String(button || "")));
|
|
18415
18415
|
}
|
|
18416
|
+
function hasReliableApprovalAffirmative(buttons) {
|
|
18417
|
+
return (buttons || []).some((button) => {
|
|
18418
|
+
const label = normalizeApprovalLabel(String(button || ""));
|
|
18419
|
+
if (!label) return false;
|
|
18420
|
+
if (/^always allow\b/.test(label)) return true;
|
|
18421
|
+
if (/^yes\b/.test(label)) {
|
|
18422
|
+
if (/\ballow\b/.test(label)) return true;
|
|
18423
|
+
if (/\bask again\b/.test(label)) return true;
|
|
18424
|
+
if (/\bduring this session\b/.test(label)) return true;
|
|
18425
|
+
if (/\bfrom this project\b/.test(label)) return true;
|
|
18426
|
+
}
|
|
18427
|
+
return false;
|
|
18428
|
+
});
|
|
18429
|
+
}
|
|
18416
18430
|
function getApprovalPositiveHints(provider) {
|
|
18417
18431
|
const customHints = Array.isArray(provider?.approvalPositiveHints) ? provider.approvalPositiveHints.map((hint) => normalizeApprovalLabel(String(hint || ""))).filter(Boolean) : [];
|
|
18418
18432
|
return customHints.length > 0 ? customHints : DEFAULT_APPROVAL_POSITIVE_HINTS;
|
|
@@ -20234,7 +20248,7 @@ function scopeLines(spec, lines, questionIndex) {
|
|
|
20234
20248
|
}
|
|
20235
20249
|
}
|
|
20236
20250
|
}
|
|
20237
|
-
if (lastSep >= 0 && prevSep >= 0) {
|
|
20251
|
+
if (lastSep >= 0 && prevSep >= 0 && questionIndex >= prevSep && questionIndex < lastSep + 1) {
|
|
20238
20252
|
return { start: prevSep, end: lastSep + 1 };
|
|
20239
20253
|
}
|
|
20240
20254
|
return {
|
|
@@ -20327,7 +20341,7 @@ var init_parse_approval = __esm({
|
|
|
20327
20341
|
"src/providers/sdk/v1/builders/cli/parse-approval.ts"() {
|
|
20328
20342
|
"use strict";
|
|
20329
20343
|
init_visible_region();
|
|
20330
|
-
SEPARATOR_RE = /^
|
|
20344
|
+
SEPARATOR_RE = /^[─━═╌╍┄┅┈┉]{10,}\s*$/;
|
|
20331
20345
|
}
|
|
20332
20346
|
});
|
|
20333
20347
|
|
|
@@ -30381,6 +30395,10 @@ var MANUAL_ATTENDANCE_COMMANDS = /* @__PURE__ */ new Set([
|
|
|
30381
30395
|
"resolve_action",
|
|
30382
30396
|
"pty_input"
|
|
30383
30397
|
]);
|
|
30398
|
+
var MANUAL_ATTENDANCE_PASSIVE_VIEW_COMMANDS = /* @__PURE__ */ new Set([
|
|
30399
|
+
"select_session",
|
|
30400
|
+
"open_panel"
|
|
30401
|
+
]);
|
|
30384
30402
|
|
|
30385
30403
|
// src/chat/chat-signatures.ts
|
|
30386
30404
|
function hashSignatureParts(parts) {
|
|
@@ -34863,13 +34881,14 @@ var DaemonCommandHandler = class {
|
|
|
34863
34881
|
*/
|
|
34864
34882
|
noteManualAttendanceIfApplicable(cmd, args) {
|
|
34865
34883
|
if (!MANUAL_ATTENDANCE_COMMANDS.has(cmd)) return;
|
|
34884
|
+
const passive = MANUAL_ATTENDANCE_PASSIVE_VIEW_COMMANDS.has(cmd);
|
|
34866
34885
|
const sessionId = this._currentRoute.session?.sessionId || (typeof args?.targetSessionId === "string" ? args.targetSessionId.trim() : "");
|
|
34867
34886
|
if (!sessionId) return;
|
|
34868
34887
|
const session = this._ctx.sessionRegistry?.get(sessionId);
|
|
34869
34888
|
const instanceKey = session?.adapterKey || session?.instanceKey || sessionId;
|
|
34870
34889
|
const instance = this._ctx.instanceManager?.getInstance(instanceKey);
|
|
34871
34890
|
try {
|
|
34872
|
-
instance?.noteManualInteraction?.();
|
|
34891
|
+
instance?.noteManualInteraction?.(void 0, { passive });
|
|
34873
34892
|
} catch {
|
|
34874
34893
|
}
|
|
34875
34894
|
}
|
|
@@ -41048,6 +41067,13 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
41048
41067
|
// mask is dropped so the real waiting_approval surfaces. Cleared when the episode ends
|
|
41049
41068
|
// (modal genuinely gone, manual attendance takes over, or auto-approve fires).
|
|
41050
41069
|
autoApproveMaskSince = 0;
|
|
41070
|
+
// NOTIF-APPROVAL-MASKED (Q1b): the autoApproveMaskSince episode value for which a
|
|
41071
|
+
// stalled-approval coordinator nudge has already been emitted, so the nudge fires
|
|
41072
|
+
// exactly once per stalled auto-approve episode (0 = none emitted). Reusing the
|
|
41073
|
+
// per-episode mask-clock value as the key makes it provider-agnostic (no reliance on
|
|
41074
|
+
// approvalEntrySeq) and self-resetting: each new episode gets a fresh
|
|
41075
|
+
// autoApproveMaskSince timestamp, and the episode-end reset zeroes it.
|
|
41076
|
+
stalledApprovalNudgeEpisode = 0;
|
|
41051
41077
|
// Provider-common manual-attendance signal: while a human is actively driving
|
|
41052
41078
|
// this session from the dashboard, auto-approve holds so they can take manual
|
|
41053
41079
|
// control. Background mesh workers are never attended → delegated auto-approve
|
|
@@ -42118,6 +42144,7 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
42118
42144
|
this.pendingAutoApprovalSince = 0;
|
|
42119
42145
|
this.autoApproveInactiveSince = 0;
|
|
42120
42146
|
this.autoApproveMaskSince = 0;
|
|
42147
|
+
this.stalledApprovalNudgeEpisode = 0;
|
|
42121
42148
|
if (this.autoApproveSettleTimer) clearTimeout(this.autoApproveSettleTimer);
|
|
42122
42149
|
this.autoApproveSettleTimer = setTimeout(() => {
|
|
42123
42150
|
this.autoApproveSettleTimer = null;
|
|
@@ -42144,6 +42171,7 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
42144
42171
|
this.pendingAutoApprovalSince = 0;
|
|
42145
42172
|
this.autoApproveInactiveSince = 0;
|
|
42146
42173
|
this.autoApproveMaskSince = 0;
|
|
42174
|
+
this.stalledApprovalNudgeEpisode = 0;
|
|
42147
42175
|
if (this.autoApproveSettleTimer) {
|
|
42148
42176
|
clearTimeout(this.autoApproveSettleTimer);
|
|
42149
42177
|
this.autoApproveSettleTimer = null;
|
|
@@ -42152,6 +42180,7 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
42152
42180
|
}
|
|
42153
42181
|
this.autoApproveInactiveSince = 0;
|
|
42154
42182
|
if (!this.autoApproveMaskSince) this.autoApproveMaskSince = now;
|
|
42183
|
+
this.maybeEmitStalledApprovalNudge(adapterStatus, now);
|
|
42155
42184
|
const modal = adapterStatus.activeModal;
|
|
42156
42185
|
const buttons = Array.isArray(modal?.buttons) ? modal.buttons.map((b) => String(b || "").trim()).filter(Boolean) : [];
|
|
42157
42186
|
if (!modal || buttons.length === 0) {
|
|
@@ -42162,7 +42191,8 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
42162
42191
|
return autoApproveActive;
|
|
42163
42192
|
}
|
|
42164
42193
|
const { index: buttonIndex, label: buttonLabel } = pickApprovalButton(buttons, this.provider);
|
|
42165
|
-
|
|
42194
|
+
const hasReliableConsentAnchor = hasNegativeApprovalOption(buttons) || hasReliableApprovalAffirmative(buttons);
|
|
42195
|
+
if (buttonIndex < 0 || !hasReliableConsentAnchor) {
|
|
42166
42196
|
return autoApproveActive;
|
|
42167
42197
|
}
|
|
42168
42198
|
const modalSignature = [
|
|
@@ -42198,6 +42228,7 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
42198
42228
|
this.pendingAutoApprovalSince = 0;
|
|
42199
42229
|
this.autoApproveInactiveSince = 0;
|
|
42200
42230
|
this.autoApproveMaskSince = 0;
|
|
42231
|
+
this.stalledApprovalNudgeEpisode = 0;
|
|
42201
42232
|
if (this.autoApproveBusyTimer) clearTimeout(this.autoApproveBusyTimer);
|
|
42202
42233
|
this.autoApproveBusyTimer = setTimeout(() => {
|
|
42203
42234
|
this.autoApproveBusy = false;
|
|
@@ -42751,7 +42782,8 @@ ${effect.notification.body || ""}`.trim();
|
|
|
42751
42782
|
return false;
|
|
42752
42783
|
}
|
|
42753
42784
|
/** @see ProviderInstance.noteManualInteraction */
|
|
42754
|
-
noteManualInteraction(now = Date.now()) {
|
|
42785
|
+
noteManualInteraction(now = Date.now(), opts) {
|
|
42786
|
+
if (opts?.passive && this.isMeshWorkerSession()) return;
|
|
42755
42787
|
this.manualAttendance.note(now);
|
|
42756
42788
|
}
|
|
42757
42789
|
/**
|
|
@@ -42775,6 +42807,50 @@ ${effect.notification.body || ""}`.trim();
|
|
|
42775
42807
|
autoApproveMaskStalled(now = Date.now()) {
|
|
42776
42808
|
return this.autoApproveMaskSince > 0 && now - this.autoApproveMaskSince > _CliProviderInstance.AUTO_APPROVE_MASK_STALL_MS;
|
|
42777
42809
|
}
|
|
42810
|
+
/**
|
|
42811
|
+
* NOTIF-APPROVAL-MASKED (Q1b): surface a delegated worker's STALLED auto-approve modal
|
|
42812
|
+
* to the mesh COORDINATOR, decoupled from the dashboard visible-status mask.
|
|
42813
|
+
*
|
|
42814
|
+
* When auto-approve is configured but the episode never settles (modal parse miss / the
|
|
42815
|
+
* settle gate never satisfied), getState()/detectStatusTransition() fold the raw
|
|
42816
|
+
* `waiting_approval` into `generating` to suppress dashboard flicker — so
|
|
42817
|
+
* detectStatusTransition()'s `waiting_approval` arm never runs and NO agent:waiting_approval
|
|
42818
|
+
* event is emitted. The coordinator's real-time approval-nudge delivery then has no input and
|
|
42819
|
+
* the worker's stuck modal is never surfaced (the live ~25s stall). The dashboard mask is
|
|
42820
|
+
* intentional and stays; this emits the coordinator nudge exactly ONCE, gated on the SAME
|
|
42821
|
+
* raw-waiting_approval + mask-stalled signal resolveModalParkStatus() distinguishes, the
|
|
42822
|
+
* instant the mask-stall threshold trips (the same moment getState un-folds the mask).
|
|
42823
|
+
*
|
|
42824
|
+
* Only delegated worker sessions qualify: a foreground session has no coordinator to notify,
|
|
42825
|
+
* and its own dashboard mask already reveals the modal on stall. A normally-resolving
|
|
42826
|
+
* auto-approve never reaches AUTO_APPROVE_MASK_STALL_MS, so it emits nothing here; and if a
|
|
42827
|
+
* masked approval clears just as this fires, rc.455's isApprovalNudgeResolved stale-drop
|
|
42828
|
+
* discards the nudge coordinator-side without noise. Dedup is per-episode (keyed on the
|
|
42829
|
+
* mask-clock value) so a modal that flaps between parsed/unparsed states is announced once.
|
|
42830
|
+
*/
|
|
42831
|
+
maybeEmitStalledApprovalNudge(adapterStatus, now) {
|
|
42832
|
+
if (!this.isMeshWorkerSession()) return;
|
|
42833
|
+
if (adapterStatus?.status !== "waiting_approval") return;
|
|
42834
|
+
if (!this.autoApproveMaskStalled(now)) return;
|
|
42835
|
+
if (this.stalledApprovalNudgeEpisode === this.autoApproveMaskSince) return;
|
|
42836
|
+
this.stalledApprovalNudgeEpisode = this.autoApproveMaskSince;
|
|
42837
|
+
const modal = adapterStatus.activeModal;
|
|
42838
|
+
const dirName = workingDirBasename(this.workingDir);
|
|
42839
|
+
const chatTitle = `${this.provider.name} \xB7 ${dirName}`;
|
|
42840
|
+
this.appendRuntimeSystemMessage(
|
|
42841
|
+
this.formatApprovalRequestMessage(modal?.message, modal?.buttons),
|
|
42842
|
+
`approval_request:${now}`,
|
|
42843
|
+
now
|
|
42844
|
+
);
|
|
42845
|
+
this.pushEvent({
|
|
42846
|
+
event: "agent:waiting_approval",
|
|
42847
|
+
chatTitle,
|
|
42848
|
+
timestamp: now,
|
|
42849
|
+
modalMessage: modal?.message,
|
|
42850
|
+
modalButtons: modal?.buttons
|
|
42851
|
+
});
|
|
42852
|
+
LOG.info("CLI", `[${this.type}] stalled auto-approve nudge \u2192 coordinator (masked ${Math.round((now - this.autoApproveMaskSince) / 1e3)}s)`);
|
|
42853
|
+
}
|
|
42778
42854
|
recordAutoApproval(modalMessage, buttonLabel, now = Date.now()) {
|
|
42779
42855
|
this.appendRuntimeSystemMessage(
|
|
42780
42856
|
formatAutoApprovalMessage(modalMessage, buttonLabel),
|