@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 CHANGED
@@ -409,10 +409,10 @@ function readInjected(value) {
409
409
  }
410
410
  function getDaemonBuildInfo() {
411
411
  if (cached) return cached;
412
- const commit = readInjected(true ? "dba171accb2a47e4b76a157f2d6a556869ef6cdf" : void 0) ?? "unknown";
413
- const commitShort = readInjected(true ? "dba171ac" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
414
- const version = readInjected(true ? "0.9.82-rc.455" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
415
- const builtAt = readInjected(true ? "2026-07-04T05:46:41.792Z" : void 0);
412
+ const commit = readInjected(true ? "49032ec6c48a0cbe6f122e2615088b38407712b6" : void 0) ?? "unknown";
413
+ const commitShort = readInjected(true ? "49032ec6" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
414
+ const version = readInjected(true ? "0.9.82-rc.456" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
415
+ const builtAt = readInjected(true ? "2026-07-04T07:05:38.214Z" : void 0);
416
416
  cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
417
417
  return cached;
418
418
  }
@@ -18418,6 +18418,20 @@ function isNegativeApprovalLabel(value) {
18418
18418
  function hasNegativeApprovalOption(buttons) {
18419
18419
  return (buttons || []).some((button) => isNegativeApprovalLabel(String(button || "")));
18420
18420
  }
18421
+ function hasReliableApprovalAffirmative(buttons) {
18422
+ return (buttons || []).some((button) => {
18423
+ const label = normalizeApprovalLabel(String(button || ""));
18424
+ if (!label) return false;
18425
+ if (/^always allow\b/.test(label)) return true;
18426
+ if (/^yes\b/.test(label)) {
18427
+ if (/\ballow\b/.test(label)) return true;
18428
+ if (/\bask again\b/.test(label)) return true;
18429
+ if (/\bduring this session\b/.test(label)) return true;
18430
+ if (/\bfrom this project\b/.test(label)) return true;
18431
+ }
18432
+ return false;
18433
+ });
18434
+ }
18421
18435
  function getApprovalPositiveHints(provider) {
18422
18436
  const customHints = Array.isArray(provider?.approvalPositiveHints) ? provider.approvalPositiveHints.map((hint) => normalizeApprovalLabel(String(hint || ""))).filter(Boolean) : [];
18423
18437
  return customHints.length > 0 ? customHints : DEFAULT_APPROVAL_POSITIVE_HINTS;
@@ -20240,7 +20254,7 @@ function scopeLines(spec, lines, questionIndex) {
20240
20254
  }
20241
20255
  }
20242
20256
  }
20243
- if (lastSep >= 0 && prevSep >= 0) {
20257
+ if (lastSep >= 0 && prevSep >= 0 && questionIndex >= prevSep && questionIndex < lastSep + 1) {
20244
20258
  return { start: prevSep, end: lastSep + 1 };
20245
20259
  }
20246
20260
  return {
@@ -20333,7 +20347,7 @@ var init_parse_approval = __esm({
20333
20347
  "src/providers/sdk/v1/builders/cli/parse-approval.ts"() {
20334
20348
  "use strict";
20335
20349
  init_visible_region();
20336
- SEPARATOR_RE = /^(?:─|━|═|━){10,}\s*$/;
20350
+ SEPARATOR_RE = /^[─━═╌╍┄┅┈┉]{10,}\s*$/;
20337
20351
  }
20338
20352
  });
20339
20353
 
@@ -30788,6 +30802,10 @@ var MANUAL_ATTENDANCE_COMMANDS = /* @__PURE__ */ new Set([
30788
30802
  "resolve_action",
30789
30803
  "pty_input"
30790
30804
  ]);
30805
+ var MANUAL_ATTENDANCE_PASSIVE_VIEW_COMMANDS = /* @__PURE__ */ new Set([
30806
+ "select_session",
30807
+ "open_panel"
30808
+ ]);
30791
30809
 
30792
30810
  // src/chat/chat-signatures.ts
30793
30811
  function hashSignatureParts(parts) {
@@ -35270,13 +35288,14 @@ var DaemonCommandHandler = class {
35270
35288
  */
35271
35289
  noteManualAttendanceIfApplicable(cmd, args) {
35272
35290
  if (!MANUAL_ATTENDANCE_COMMANDS.has(cmd)) return;
35291
+ const passive = MANUAL_ATTENDANCE_PASSIVE_VIEW_COMMANDS.has(cmd);
35273
35292
  const sessionId = this._currentRoute.session?.sessionId || (typeof args?.targetSessionId === "string" ? args.targetSessionId.trim() : "");
35274
35293
  if (!sessionId) return;
35275
35294
  const session = this._ctx.sessionRegistry?.get(sessionId);
35276
35295
  const instanceKey = session?.adapterKey || session?.instanceKey || sessionId;
35277
35296
  const instance = this._ctx.instanceManager?.getInstance(instanceKey);
35278
35297
  try {
35279
- instance?.noteManualInteraction?.();
35298
+ instance?.noteManualInteraction?.(void 0, { passive });
35280
35299
  } catch {
35281
35300
  }
35282
35301
  }
@@ -41455,6 +41474,13 @@ var CliProviderInstance = class _CliProviderInstance {
41455
41474
  // mask is dropped so the real waiting_approval surfaces. Cleared when the episode ends
41456
41475
  // (modal genuinely gone, manual attendance takes over, or auto-approve fires).
41457
41476
  autoApproveMaskSince = 0;
41477
+ // NOTIF-APPROVAL-MASKED (Q1b): the autoApproveMaskSince episode value for which a
41478
+ // stalled-approval coordinator nudge has already been emitted, so the nudge fires
41479
+ // exactly once per stalled auto-approve episode (0 = none emitted). Reusing the
41480
+ // per-episode mask-clock value as the key makes it provider-agnostic (no reliance on
41481
+ // approvalEntrySeq) and self-resetting: each new episode gets a fresh
41482
+ // autoApproveMaskSince timestamp, and the episode-end reset zeroes it.
41483
+ stalledApprovalNudgeEpisode = 0;
41458
41484
  // Provider-common manual-attendance signal: while a human is actively driving
41459
41485
  // this session from the dashboard, auto-approve holds so they can take manual
41460
41486
  // control. Background mesh workers are never attended → delegated auto-approve
@@ -42525,6 +42551,7 @@ var CliProviderInstance = class _CliProviderInstance {
42525
42551
  this.pendingAutoApprovalSince = 0;
42526
42552
  this.autoApproveInactiveSince = 0;
42527
42553
  this.autoApproveMaskSince = 0;
42554
+ this.stalledApprovalNudgeEpisode = 0;
42528
42555
  if (this.autoApproveSettleTimer) clearTimeout(this.autoApproveSettleTimer);
42529
42556
  this.autoApproveSettleTimer = setTimeout(() => {
42530
42557
  this.autoApproveSettleTimer = null;
@@ -42551,6 +42578,7 @@ var CliProviderInstance = class _CliProviderInstance {
42551
42578
  this.pendingAutoApprovalSince = 0;
42552
42579
  this.autoApproveInactiveSince = 0;
42553
42580
  this.autoApproveMaskSince = 0;
42581
+ this.stalledApprovalNudgeEpisode = 0;
42554
42582
  if (this.autoApproveSettleTimer) {
42555
42583
  clearTimeout(this.autoApproveSettleTimer);
42556
42584
  this.autoApproveSettleTimer = null;
@@ -42559,6 +42587,7 @@ var CliProviderInstance = class _CliProviderInstance {
42559
42587
  }
42560
42588
  this.autoApproveInactiveSince = 0;
42561
42589
  if (!this.autoApproveMaskSince) this.autoApproveMaskSince = now;
42590
+ this.maybeEmitStalledApprovalNudge(adapterStatus, now);
42562
42591
  const modal = adapterStatus.activeModal;
42563
42592
  const buttons = Array.isArray(modal?.buttons) ? modal.buttons.map((b) => String(b || "").trim()).filter(Boolean) : [];
42564
42593
  if (!modal || buttons.length === 0) {
@@ -42569,7 +42598,8 @@ var CliProviderInstance = class _CliProviderInstance {
42569
42598
  return autoApproveActive;
42570
42599
  }
42571
42600
  const { index: buttonIndex, label: buttonLabel } = pickApprovalButton(buttons, this.provider);
42572
- if (buttonIndex < 0 || !hasNegativeApprovalOption(buttons)) {
42601
+ const hasReliableConsentAnchor = hasNegativeApprovalOption(buttons) || hasReliableApprovalAffirmative(buttons);
42602
+ if (buttonIndex < 0 || !hasReliableConsentAnchor) {
42573
42603
  return autoApproveActive;
42574
42604
  }
42575
42605
  const modalSignature = [
@@ -42605,6 +42635,7 @@ var CliProviderInstance = class _CliProviderInstance {
42605
42635
  this.pendingAutoApprovalSince = 0;
42606
42636
  this.autoApproveInactiveSince = 0;
42607
42637
  this.autoApproveMaskSince = 0;
42638
+ this.stalledApprovalNudgeEpisode = 0;
42608
42639
  if (this.autoApproveBusyTimer) clearTimeout(this.autoApproveBusyTimer);
42609
42640
  this.autoApproveBusyTimer = setTimeout(() => {
42610
42641
  this.autoApproveBusy = false;
@@ -43158,7 +43189,8 @@ ${effect.notification.body || ""}`.trim();
43158
43189
  return false;
43159
43190
  }
43160
43191
  /** @see ProviderInstance.noteManualInteraction */
43161
- noteManualInteraction(now = Date.now()) {
43192
+ noteManualInteraction(now = Date.now(), opts) {
43193
+ if (opts?.passive && this.isMeshWorkerSession()) return;
43162
43194
  this.manualAttendance.note(now);
43163
43195
  }
43164
43196
  /**
@@ -43182,6 +43214,50 @@ ${effect.notification.body || ""}`.trim();
43182
43214
  autoApproveMaskStalled(now = Date.now()) {
43183
43215
  return this.autoApproveMaskSince > 0 && now - this.autoApproveMaskSince > _CliProviderInstance.AUTO_APPROVE_MASK_STALL_MS;
43184
43216
  }
43217
+ /**
43218
+ * NOTIF-APPROVAL-MASKED (Q1b): surface a delegated worker's STALLED auto-approve modal
43219
+ * to the mesh COORDINATOR, decoupled from the dashboard visible-status mask.
43220
+ *
43221
+ * When auto-approve is configured but the episode never settles (modal parse miss / the
43222
+ * settle gate never satisfied), getState()/detectStatusTransition() fold the raw
43223
+ * `waiting_approval` into `generating` to suppress dashboard flicker — so
43224
+ * detectStatusTransition()'s `waiting_approval` arm never runs and NO agent:waiting_approval
43225
+ * event is emitted. The coordinator's real-time approval-nudge delivery then has no input and
43226
+ * the worker's stuck modal is never surfaced (the live ~25s stall). The dashboard mask is
43227
+ * intentional and stays; this emits the coordinator nudge exactly ONCE, gated on the SAME
43228
+ * raw-waiting_approval + mask-stalled signal resolveModalParkStatus() distinguishes, the
43229
+ * instant the mask-stall threshold trips (the same moment getState un-folds the mask).
43230
+ *
43231
+ * Only delegated worker sessions qualify: a foreground session has no coordinator to notify,
43232
+ * and its own dashboard mask already reveals the modal on stall. A normally-resolving
43233
+ * auto-approve never reaches AUTO_APPROVE_MASK_STALL_MS, so it emits nothing here; and if a
43234
+ * masked approval clears just as this fires, rc.455's isApprovalNudgeResolved stale-drop
43235
+ * discards the nudge coordinator-side without noise. Dedup is per-episode (keyed on the
43236
+ * mask-clock value) so a modal that flaps between parsed/unparsed states is announced once.
43237
+ */
43238
+ maybeEmitStalledApprovalNudge(adapterStatus, now) {
43239
+ if (!this.isMeshWorkerSession()) return;
43240
+ if (adapterStatus?.status !== "waiting_approval") return;
43241
+ if (!this.autoApproveMaskStalled(now)) return;
43242
+ if (this.stalledApprovalNudgeEpisode === this.autoApproveMaskSince) return;
43243
+ this.stalledApprovalNudgeEpisode = this.autoApproveMaskSince;
43244
+ const modal = adapterStatus.activeModal;
43245
+ const dirName = workingDirBasename(this.workingDir);
43246
+ const chatTitle = `${this.provider.name} \xB7 ${dirName}`;
43247
+ this.appendRuntimeSystemMessage(
43248
+ this.formatApprovalRequestMessage(modal?.message, modal?.buttons),
43249
+ `approval_request:${now}`,
43250
+ now
43251
+ );
43252
+ this.pushEvent({
43253
+ event: "agent:waiting_approval",
43254
+ chatTitle,
43255
+ timestamp: now,
43256
+ modalMessage: modal?.message,
43257
+ modalButtons: modal?.buttons
43258
+ });
43259
+ LOG.info("CLI", `[${this.type}] stalled auto-approve nudge \u2192 coordinator (masked ${Math.round((now - this.autoApproveMaskSince) / 1e3)}s)`);
43260
+ }
43185
43261
  recordAutoApproval(modalMessage, buttonLabel, now = Date.now()) {
43186
43262
  this.appendRuntimeSystemMessage(
43187
43263
  formatAutoApprovalMessage(modalMessage, buttonLabel),