@adhdev/daemon-core 0.9.82-rc.389 → 0.9.82-rc.390

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
@@ -383,10 +383,10 @@ function readInjected(value) {
383
383
  }
384
384
  function getDaemonBuildInfo() {
385
385
  if (cached) return cached;
386
- const commit = readInjected(true ? "f82b4b4cdb13171d2666cc959054b788af4f2ea5" : void 0) ?? "unknown";
387
- const commitShort = readInjected(true ? "f82b4b4c" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
388
- const version = readInjected(true ? "0.9.82-rc.389" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
389
- const builtAt = readInjected(true ? "2026-06-26T06:17:18.789Z" : void 0);
386
+ const commit = readInjected(true ? "25bb0512a5fd46999cb1fe21ef4ab7e2ed23a6c6" : void 0) ?? "unknown";
387
+ const commitShort = readInjected(true ? "25bb0512" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
388
+ const version = readInjected(true ? "0.9.82-rc.390" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
389
+ const builtAt = readInjected(true ? "2026-06-26T09:55:40.652Z" : void 0);
390
390
  cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
391
391
  return cached;
392
392
  }
@@ -39155,6 +39155,24 @@ var CliProviderInstance = class _CliProviderInstance {
39155
39155
  * from scratch rather than firing on a stale timestamp.
39156
39156
  */
39157
39157
  static AUTO_APPROVE_GATE_HYSTERESIS_MS = 1500;
39158
+ /**
39159
+ * STATUS-MISMATCH: upper bound on how long the auto-approve→`generating` SURFACE
39160
+ * mask may hide a worker's `waiting_approval` (status + activeModal) before we give
39161
+ * up and surface the real prompt. The mask exists because auto-approve is expected
39162
+ * to resolve the modal momentarily; but if it STALLS without ever calling
39163
+ * resolveModal — the modal signature never settles for AUTO_APPROVE_SETTLE_MS (a
39164
+ * perpetually-flapping/streaming prompt), no concrete modal is ever captured, or the
39165
+ * modal is a picker/non-affirmative we never auto-pick — the mask would persist
39166
+ * forever and read_chat / mesh_status / the dashboard would NEVER see the pending
39167
+ * approval (the coordinator cannot mesh_approve what it cannot see). Once an episode
39168
+ * exceeds this bound we stop masking. Generously larger than
39169
+ * AUTO_APPROVE_SETTLE_MS (600) + AUTO_APPROVE_GATE_HYSTERESIS_MS (1500) so a
39170
+ * legitimately slow-settling / blip-flapping prompt is never unmasked early; a
39171
+ * genuine never-resolving stall surfaces within this window. The settle gate keeps
39172
+ * running underneath, so a prompt that finally stabilises still auto-approves, and
39173
+ * mesh_approve (raw FSM, unmasked) works throughout.
39174
+ */
39175
+ static AUTO_APPROVE_MASK_STALL_MS = 4500;
39158
39176
  adapter;
39159
39177
  context = null;
39160
39178
  events = [];
@@ -39188,6 +39206,14 @@ var CliProviderInstance = class _CliProviderInstance {
39188
39206
  // a settle gate was in progress. Drives AUTO_APPROVE_GATE_HYSTERESIS_MS so a
39189
39207
  // brief generating flip does not immediately wipe the settle clock.
39190
39208
  autoApproveInactiveSince = 0;
39209
+ // STATUS-MISMATCH: wall-clock when the CURRENT auto-approve episode (waiting_approval
39210
+ // + shouldAutoApprove) first began wanting to mask. Unlike pendingAutoApprovalSince it
39211
+ // is NOT reset when the modal signature changes (a still-streaming/flapping prompt) and
39212
+ // survives the same hysteresis blips the settle gate does, so it measures the TRUE age
39213
+ // of an unresolved auto-approve. Once it exceeds AUTO_APPROVE_MASK_STALL_MS the surface
39214
+ // mask is dropped so the real waiting_approval surfaces. Cleared when the episode ends
39215
+ // (modal genuinely gone, manual attendance takes over, or auto-approve fires).
39216
+ autoApproveMaskSince = 0;
39191
39217
  // Provider-common manual-attendance signal: while a human is actively driving
39192
39218
  // this session from the dashboard, auto-approve holds so they can take manual
39193
39219
  // control. Background mesh workers are never attended → delegated auto-approve
@@ -39335,7 +39361,8 @@ var CliProviderInstance = class _CliProviderInstance {
39335
39361
  this.provider,
39336
39362
  typeof adapterStatus?.providerSessionId === "string" ? adapterStatus.providerSessionId : ""
39337
39363
  );
39338
- const autoApproveActive = this.maybeAutoApproveStatus(adapterStatus, Date.now());
39364
+ const nowMs = Date.now();
39365
+ const autoApproveActive = this.maybeAutoApproveStatus(adapterStatus, nowMs) && !this.autoApproveMaskStalled(nowMs);
39339
39366
  const autoApproveHoldIdle = this.autoApproveBusy && adapterStatus.status === "idle";
39340
39367
  let visibleStatus = parseErrorMessage || parsedStatus?.status === "error" ? "error" : autoApproveActive || autoApproveHoldIdle ? "generating" : adapterStatus.status;
39341
39368
  if (isCliGeneratingLikeStatus(visibleStatus) && this.lastStatus === "idle") {
@@ -39476,7 +39503,8 @@ var CliProviderInstance = class _CliProviderInstance {
39476
39503
  }
39477
39504
  getHotChatSessionState() {
39478
39505
  const adapterStatus = this.adapter.getStatus({ allowParse: false });
39479
- const autoApproveActive = this.autoApproveEffectivelyActive(adapterStatus.status);
39506
+ const nowMs = Date.now();
39507
+ const autoApproveActive = this.autoApproveEffectivelyActive(adapterStatus.status, nowMs) && !this.autoApproveMaskStalled(nowMs);
39480
39508
  const autoApproveHoldIdle = this.autoApproveBusy && adapterStatus.status === "idle";
39481
39509
  const visibleStatus = autoApproveActive || autoApproveHoldIdle ? "generating" : adapterStatus.status;
39482
39510
  const runtime = this.adapter.getRuntimeMetadata();
@@ -39491,7 +39519,8 @@ var CliProviderInstance = class _CliProviderInstance {
39491
39519
  }
39492
39520
  getSessionModalState(sessionId) {
39493
39521
  const adapterStatus = this.adapter.getStatus({ allowParse: true });
39494
- const autoApproveActive = this.autoApproveEffectivelyActive(adapterStatus.status);
39522
+ const nowMs = Date.now();
39523
+ const autoApproveActive = this.autoApproveEffectivelyActive(adapterStatus.status, nowMs) && !this.autoApproveMaskStalled(nowMs);
39495
39524
  const autoApproveHoldIdle = this.autoApproveBusy && adapterStatus.status === "idle";
39496
39525
  const visibleStatus = autoApproveActive || autoApproveHoldIdle ? "generating" : adapterStatus.status;
39497
39526
  const dirName = workingDirBasename(this.workingDir);
@@ -39604,7 +39633,7 @@ var CliProviderInstance = class _CliProviderInstance {
39604
39633
  } catch {
39605
39634
  return null;
39606
39635
  }
39607
- if (adapterStatus.status === "waiting_approval" && !this.autoApproveEffectivelyActive(adapterStatus.status)) {
39636
+ if (adapterStatus.status === "waiting_approval" && (!this.autoApproveEffectivelyActive(adapterStatus.status) || this.autoApproveMaskStalled())) {
39608
39637
  return "waiting_approval";
39609
39638
  }
39610
39639
  return null;
@@ -40143,6 +40172,7 @@ var CliProviderInstance = class _CliProviderInstance {
40143
40172
  this.pendingAutoApprovalSignature = "";
40144
40173
  this.pendingAutoApprovalSince = 0;
40145
40174
  this.autoApproveInactiveSince = 0;
40175
+ this.autoApproveMaskSince = 0;
40146
40176
  if (this.autoApproveSettleTimer) clearTimeout(this.autoApproveSettleTimer);
40147
40177
  this.autoApproveSettleTimer = setTimeout(() => {
40148
40178
  this.autoApproveSettleTimer = null;
@@ -40168,6 +40198,7 @@ var CliProviderInstance = class _CliProviderInstance {
40168
40198
  this.pendingAutoApprovalSignature = "";
40169
40199
  this.pendingAutoApprovalSince = 0;
40170
40200
  this.autoApproveInactiveSince = 0;
40201
+ this.autoApproveMaskSince = 0;
40171
40202
  if (this.autoApproveSettleTimer) {
40172
40203
  clearTimeout(this.autoApproveSettleTimer);
40173
40204
  this.autoApproveSettleTimer = null;
@@ -40175,6 +40206,7 @@ var CliProviderInstance = class _CliProviderInstance {
40175
40206
  return autoApproveActive;
40176
40207
  }
40177
40208
  this.autoApproveInactiveSince = 0;
40209
+ if (!this.autoApproveMaskSince) this.autoApproveMaskSince = now;
40178
40210
  const modal = adapterStatus.activeModal;
40179
40211
  const buttons = Array.isArray(modal?.buttons) ? modal.buttons.map((b) => String(b || "").trim()).filter(Boolean) : [];
40180
40212
  if (!modal || buttons.length === 0) {
@@ -40220,6 +40252,7 @@ var CliProviderInstance = class _CliProviderInstance {
40220
40252
  this.pendingAutoApprovalSignature = "";
40221
40253
  this.pendingAutoApprovalSince = 0;
40222
40254
  this.autoApproveInactiveSince = 0;
40255
+ this.autoApproveMaskSince = 0;
40223
40256
  if (this.autoApproveBusyTimer) clearTimeout(this.autoApproveBusyTimer);
40224
40257
  this.autoApproveBusyTimer = setTimeout(() => {
40225
40258
  this.autoApproveBusy = false;
@@ -40661,6 +40694,16 @@ ${effect.notification.body || ""}`.trim();
40661
40694
  autoApproveEffectivelyActive(status, now = Date.now()) {
40662
40695
  return status === "waiting_approval" && this.shouldAutoApprove() && !this.manualAttendance.isAttended(now);
40663
40696
  }
40697
+ // STATUS-MISMATCH: true once the current auto-approve episode has been masking
40698
+ // waiting_approval behind `generating` for longer than AUTO_APPROVE_MASK_STALL_MS without
40699
+ // resolving (the settle gate never fired). When stalled, the surface mask must be dropped
40700
+ // so read_chat / mesh_status / the dashboard see the real waiting_approval + modal (and a
40701
+ // coordinator can mesh_approve it). autoApproveMaskSince is maintained by
40702
+ // maybeAutoApproveStatus (driven by getState + the recheck timer during a waiting episode);
40703
+ // this read is side-effect-free so getStatusMetadata can consult it too.
40704
+ autoApproveMaskStalled(now = Date.now()) {
40705
+ return this.autoApproveMaskSince > 0 && now - this.autoApproveMaskSince > _CliProviderInstance.AUTO_APPROVE_MASK_STALL_MS;
40706
+ }
40664
40707
  recordAutoApproval(modalMessage, buttonLabel, now = Date.now()) {
40665
40708
  this.appendRuntimeSystemMessage(
40666
40709
  formatAutoApprovalMessage(modalMessage, buttonLabel),
@@ -48805,11 +48848,12 @@ var meshEventsHandlers = {
48805
48848
  get_pending_mesh_events: async (ctx, args) => {
48806
48849
  const meshId = typeof args?.meshId === "string" ? args.meshId.trim() : "";
48807
48850
  const coordinatorDaemonId = typeof args?.coordinatorDaemonId === "string" && args.coordinatorDaemonId.trim() ? args.coordinatorDaemonId.trim() : void 0;
48851
+ const hasLiveCliCoordinator = meshId ? resolveCoordinatorDrainDeliverability(ctx.deps, meshId).hasLiveCliCoordinator : false;
48808
48852
  if (meshId && shouldHoldPendingDrainForBusyLocalCoordinator(ctx.deps, meshId, coordinatorDaemonId)) {
48809
- return { success: true, events: [], heldForBusyLocalCoordinator: true };
48853
+ return { success: true, events: [], heldForBusyLocalCoordinator: true, hasLiveCliCoordinator };
48810
48854
  }
48811
48855
  const events = drainPendingMeshCoordinatorEvents(meshId || void 0, coordinatorDaemonId);
48812
- return { success: true, events };
48856
+ return { success: true, events, hasLiveCliCoordinator };
48813
48857
  },
48814
48858
  interactive_prompt_response: async (ctx, args) => {
48815
48859
  const sessionId = typeof args?.targetSessionId === "string" && args.targetSessionId.trim() ? args.targetSessionId.trim() : typeof args?.sessionId === "string" && args.sessionId.trim() ? args.sessionId.trim() : "";