@adhdev/daemon-core 0.9.82-rc.420 → 0.9.82-rc.421

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.mjs CHANGED
@@ -384,10 +384,10 @@ function readInjected(value) {
384
384
  }
385
385
  function getDaemonBuildInfo() {
386
386
  if (cached) return cached;
387
- const commit = readInjected(true ? "bd19cb0fbe1e16db1d8d2fcd8c2c871aae3ce33b" : void 0) ?? "unknown";
388
- const commitShort = readInjected(true ? "bd19cb0f" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
389
- const version = readInjected(true ? "0.9.82-rc.420" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
390
- const builtAt = readInjected(true ? "2026-06-28T19:41:31.696Z" : void 0);
387
+ const commit = readInjected(true ? "ae90493419784d563faac61e6caab2a6f05e0719" : void 0) ?? "unknown";
388
+ const commitShort = readInjected(true ? "ae904934" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
389
+ const version = readInjected(true ? "0.9.82-rc.421" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
390
+ const builtAt = readInjected(true ? "2026-06-29T03:34:21.633Z" : void 0);
391
391
  cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
392
392
  return cached;
393
393
  }
@@ -16553,6 +16553,62 @@ function ackUnresolvedDelegateForwardByFingerprint(coordinatorDaemonId, eventNam
16553
16553
  );
16554
16554
  if (match) ackUnresolvedDelegateForward(match.id);
16555
16555
  }
16556
+ function flushPendingForMeshIdleCoordinators(components, meshId) {
16557
+ try {
16558
+ const store = MeshRuntimeStore.getInstance();
16559
+ if (store.pendingEventCount(meshId) === 0) return;
16560
+ } catch {
16561
+ }
16562
+ const idleCoordinators = [];
16563
+ try {
16564
+ for (const inst of components.instanceManager.getByCategory("cli")) {
16565
+ const state = inst.getState();
16566
+ const settings = state.settings && typeof state.settings === "object" ? state.settings : {};
16567
+ if (readNonEmptyString2(settings.meshCoordinatorFor) !== meshId) continue;
16568
+ const status = readNonEmptyString2(state.status).toLowerCase();
16569
+ const modalParked = typeof inst.isModalParked === "function" ? inst.isModalParked() === true : status === "waiting_choice" || status === "waiting_approval";
16570
+ if (status === "idle" && !modalParked) {
16571
+ idleCoordinators.push({ instance: inst, sessionId: readNonEmptyString2(state.instanceId) });
16572
+ }
16573
+ }
16574
+ } catch {
16575
+ return;
16576
+ }
16577
+ if (idleCoordinators.length === 0) return;
16578
+ const drainDaemonIds = resolveCoordinatorDrainDaemonIds(components);
16579
+ let pendingEvents;
16580
+ try {
16581
+ pendingEvents = drainPendingMeshCoordinatorEvents(meshId, drainDaemonIds.length > 0 ? drainDaemonIds : void 0);
16582
+ } catch (e) {
16583
+ LOG.warn("MeshEvents", `Event-driven coordinator drain failed for mesh ${meshId}: ${e?.message || e}`);
16584
+ return;
16585
+ }
16586
+ if (pendingEvents.length === 0) return;
16587
+ let delivered = 0;
16588
+ for (const pending of pendingEvents) {
16589
+ const wantSession = readNonEmptyString2(pending.targetCoordinatorSessionId);
16590
+ const targets = wantSession ? idleCoordinators.filter((c) => c.sessionId === wantSession) : idleCoordinators;
16591
+ if (targets.length === 0 || !pending.coordinatorMessage) {
16592
+ try {
16593
+ queuePendingMeshCoordinatorEvent(pending);
16594
+ } catch {
16595
+ }
16596
+ continue;
16597
+ }
16598
+ const message = pending.coordinatorMessage;
16599
+ const force = shouldForceInjectMeshEvent(pending.event);
16600
+ for (const c of targets) {
16601
+ c.instance.onEvent("send_message", {
16602
+ input: { text: message, textFallback: message },
16603
+ ...force ? { force: true } : {}
16604
+ });
16605
+ delivered++;
16606
+ }
16607
+ }
16608
+ if (delivered > 0) {
16609
+ LOG.info("MeshEvents", `Event-driven drain delivered ${delivered} pending event(s) to ${idleCoordinators.length} idle coordinator(s) for mesh ${meshId}`);
16610
+ }
16611
+ }
16556
16612
  function setupMeshEventForwarding(components) {
16557
16613
  components.instanceManager.onEvent((event) => {
16558
16614
  if (event.event === "agent:ready" || event.event === "agent:generating_completed") {
@@ -16624,6 +16680,7 @@ function setupMeshEventForwarding(components) {
16624
16680
  event: event.event,
16625
16681
  metadataEvent: event
16626
16682
  });
16683
+ flushPendingForMeshIdleCoordinators(components, routing.meshId);
16627
16684
  });
16628
16685
  }
16629
16686
  var REMOTE_IDLE_SESSION_TTL_MS, meshByWorkspaceCache, MESH_WORKSPACE_CACHE_TTL_MS, INTENTIONAL_CLEANUP_STOP_SUPPRESSION_MS, RECENT_COMPLETION_FINGERPRINT_TTL_MS, RECONCILED_COMPLETION_SOURCES, coordinatorForwardLanes;
@@ -16744,7 +16801,7 @@ function findLiveCoordinators(components) {
16744
16801
  const meshId = readNonEmptyString2(settings.meshCoordinatorFor);
16745
16802
  if (!meshId) continue;
16746
16803
  const status = readNonEmptyString2(state.status).toLowerCase();
16747
- const modalParked = status === "waiting_choice" || status === "waiting_approval";
16804
+ const modalParked = typeof inst.isModalParked === "function" ? inst.isModalParked() === true : status === "waiting_choice" || status === "waiting_approval";
16748
16805
  const sessionId = readNonEmptyString2(state.instanceId);
16749
16806
  const stateKey = `${meshId}::${sessionId || "?"}`;
16750
16807
  const prevParked = coordinatorModalParkState.get(stateKey);
@@ -40637,10 +40694,27 @@ var CliProviderInstance = class _CliProviderInstance {
40637
40694
  return null;
40638
40695
  }
40639
40696
  if (adapterStatus.status === "waiting_approval" && (!this.autoApproveEffectivelyActive(adapterStatus.status) || this.autoApproveMaskStalled())) {
40697
+ if (this.isTransientToolConsent()) {
40698
+ return null;
40699
+ }
40640
40700
  return "waiting_approval";
40641
40701
  }
40642
40702
  return null;
40643
40703
  }
40704
+ /**
40705
+ * NOTIF-HELD-DRAIN: true when this `waiting_approval` is a routine, transient tool-consent
40706
+ * of an autonomously-progressing mesh session rather than a genuine human-await modal —
40707
+ * i.e. it is a mesh coordinator/worker session, a turn is actively in flight
40708
+ * (hasAdapterPendingResponse), and no human is attending it by hand. Such a consent is
40709
+ * driven to resolution by the harness/operator as part of the in-flight turn, so holding
40710
+ * the mesh's completion events behind it (modal_parked) is the false-positive that stalls
40711
+ * delivery. Narrow by design: manual attendance or a non-progressing session falls through
40712
+ * to the genuine-modal classification.
40713
+ */
40714
+ isTransientToolConsent(now = Date.now()) {
40715
+ const isAutonomousMeshSession = this.isMeshWorkerSession() || !!this.settings.meshCoordinatorFor;
40716
+ return isAutonomousMeshSession && this.hasAdapterPendingResponse() && !this.manualAttendance.isAttended(now);
40717
+ }
40644
40718
  /** True when this session is parked on a modal awaiting a human answer. */
40645
40719
  isModalParked() {
40646
40720
  return this.resolveModalParkStatus() !== null;
@@ -64860,6 +64934,7 @@ export {
64860
64934
  isSetupComplete,
64861
64935
  isTaskReadonly,
64862
64936
  isUserFacingChatMessage,
64937
+ isWeakCompletionEvidence,
64863
64938
  killIdeProcess,
64864
64939
  launchIDE,
64865
64940
  launchWithCdp,