@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.d.ts CHANGED
@@ -68,7 +68,7 @@ export type { MeshSchedulingRuntime, MeshNodeSchedulingRuntime, MeshNodeProvider
68
68
  export { buildMeshHostRequiredFailure, createDefaultMeshHostMetadata, isMeshHostOwner, normalizeMeshDaemonRole, requireMeshHostQueueOwner, resolveMeshHostStatus } from './mesh/mesh-host-ownership.js';
69
69
  export { triggerMeshQueue, drainPendingMeshCoordinatorEvents, getPendingMeshCoordinatorEvents, clearPendingMeshCoordinatorEvents, queuePendingMeshCoordinatorEvent, reconcileDirectDispatchCompletionFromTranscript } from './mesh/mesh-events.js';
70
70
  export type { PendingMeshCoordinatorEvent } from './mesh/mesh-events.js';
71
- export { resolveMeshSurfacedSessionPreview, readMeshCompletionSummary } from './mesh/mesh-events-utils.js';
71
+ export { resolveMeshSurfacedSessionPreview, readMeshCompletionSummary, isWeakCompletionEvidence } from './mesh/mesh-events-utils.js';
72
72
  export { resolveDeliveryDecision, createSessionDelivery, updateSessionDeliveryStatus, getActiveSessionDeliveries, markSessionDeliveriesTerminal, recordCompletionConflict, getRecentCompletionConflicts } from './mesh/mesh-delivery-policy.js';
73
73
  export type { MeshSessionDeliveryStatus, MeshSessionDeliveryKind, MeshDeliveryDecision, MeshDeliveryPolicyResult, SessionDeliveryRecord } from './mesh/mesh-delivery-policy.js';
74
74
  export { P2pRelayFailureError, buildP2pRelayFailurePayload, classifyP2pRelayFailure, isP2pRelayTransportFailure, } from './mesh/p2p-relay-failure.js';
package/dist/index.js CHANGED
@@ -389,10 +389,10 @@ function readInjected(value) {
389
389
  }
390
390
  function getDaemonBuildInfo() {
391
391
  if (cached) return cached;
392
- const commit = readInjected(true ? "bd19cb0fbe1e16db1d8d2fcd8c2c871aae3ce33b" : void 0) ?? "unknown";
393
- const commitShort = readInjected(true ? "bd19cb0f" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
394
- const version = readInjected(true ? "0.9.82-rc.420" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
395
- const builtAt = readInjected(true ? "2026-06-28T19:41:31.696Z" : void 0);
392
+ const commit = readInjected(true ? "ae90493419784d563faac61e6caab2a6f05e0719" : void 0) ?? "unknown";
393
+ const commitShort = readInjected(true ? "ae904934" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
394
+ const version = readInjected(true ? "0.9.82-rc.421" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
395
+ const builtAt = readInjected(true ? "2026-06-29T03:34:21.633Z" : void 0);
396
396
  cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
397
397
  return cached;
398
398
  }
@@ -16558,6 +16558,62 @@ function ackUnresolvedDelegateForwardByFingerprint(coordinatorDaemonId, eventNam
16558
16558
  );
16559
16559
  if (match) ackUnresolvedDelegateForward(match.id);
16560
16560
  }
16561
+ function flushPendingForMeshIdleCoordinators(components, meshId) {
16562
+ try {
16563
+ const store = MeshRuntimeStore.getInstance();
16564
+ if (store.pendingEventCount(meshId) === 0) return;
16565
+ } catch {
16566
+ }
16567
+ const idleCoordinators = [];
16568
+ try {
16569
+ for (const inst of components.instanceManager.getByCategory("cli")) {
16570
+ const state = inst.getState();
16571
+ const settings = state.settings && typeof state.settings === "object" ? state.settings : {};
16572
+ if (readNonEmptyString2(settings.meshCoordinatorFor) !== meshId) continue;
16573
+ const status = readNonEmptyString2(state.status).toLowerCase();
16574
+ const modalParked = typeof inst.isModalParked === "function" ? inst.isModalParked() === true : status === "waiting_choice" || status === "waiting_approval";
16575
+ if (status === "idle" && !modalParked) {
16576
+ idleCoordinators.push({ instance: inst, sessionId: readNonEmptyString2(state.instanceId) });
16577
+ }
16578
+ }
16579
+ } catch {
16580
+ return;
16581
+ }
16582
+ if (idleCoordinators.length === 0) return;
16583
+ const drainDaemonIds = resolveCoordinatorDrainDaemonIds(components);
16584
+ let pendingEvents;
16585
+ try {
16586
+ pendingEvents = drainPendingMeshCoordinatorEvents(meshId, drainDaemonIds.length > 0 ? drainDaemonIds : void 0);
16587
+ } catch (e) {
16588
+ LOG.warn("MeshEvents", `Event-driven coordinator drain failed for mesh ${meshId}: ${e?.message || e}`);
16589
+ return;
16590
+ }
16591
+ if (pendingEvents.length === 0) return;
16592
+ let delivered = 0;
16593
+ for (const pending of pendingEvents) {
16594
+ const wantSession = readNonEmptyString2(pending.targetCoordinatorSessionId);
16595
+ const targets = wantSession ? idleCoordinators.filter((c) => c.sessionId === wantSession) : idleCoordinators;
16596
+ if (targets.length === 0 || !pending.coordinatorMessage) {
16597
+ try {
16598
+ queuePendingMeshCoordinatorEvent(pending);
16599
+ } catch {
16600
+ }
16601
+ continue;
16602
+ }
16603
+ const message = pending.coordinatorMessage;
16604
+ const force = shouldForceInjectMeshEvent(pending.event);
16605
+ for (const c of targets) {
16606
+ c.instance.onEvent("send_message", {
16607
+ input: { text: message, textFallback: message },
16608
+ ...force ? { force: true } : {}
16609
+ });
16610
+ delivered++;
16611
+ }
16612
+ }
16613
+ if (delivered > 0) {
16614
+ LOG.info("MeshEvents", `Event-driven drain delivered ${delivered} pending event(s) to ${idleCoordinators.length} idle coordinator(s) for mesh ${meshId}`);
16615
+ }
16616
+ }
16561
16617
  function setupMeshEventForwarding(components) {
16562
16618
  components.instanceManager.onEvent((event) => {
16563
16619
  if (event.event === "agent:ready" || event.event === "agent:generating_completed") {
@@ -16629,6 +16685,7 @@ function setupMeshEventForwarding(components) {
16629
16685
  event: event.event,
16630
16686
  metadataEvent: event
16631
16687
  });
16688
+ flushPendingForMeshIdleCoordinators(components, routing.meshId);
16632
16689
  });
16633
16690
  }
16634
16691
  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;
@@ -16749,7 +16806,7 @@ function findLiveCoordinators(components) {
16749
16806
  const meshId = readNonEmptyString2(settings.meshCoordinatorFor);
16750
16807
  if (!meshId) continue;
16751
16808
  const status = readNonEmptyString2(state.status).toLowerCase();
16752
- const modalParked = status === "waiting_choice" || status === "waiting_approval";
16809
+ const modalParked = typeof inst.isModalParked === "function" ? inst.isModalParked() === true : status === "waiting_choice" || status === "waiting_approval";
16753
16810
  const sessionId = readNonEmptyString2(state.instanceId);
16754
16811
  const stateKey = `${meshId}::${sessionId || "?"}`;
16755
16812
  const prevParked = coordinatorModalParkState.get(stateKey);
@@ -23482,6 +23539,7 @@ __export(index_exports, {
23482
23539
  isSetupComplete: () => isSetupComplete,
23483
23540
  isTaskReadonly: () => isTaskReadonly,
23484
23541
  isUserFacingChatMessage: () => isUserFacingChatMessage,
23542
+ isWeakCompletionEvidence: () => isWeakCompletionEvidence,
23485
23543
  killIdeProcess: () => killIdeProcess,
23486
23544
  launchIDE: () => launchIDE,
23487
23545
  launchWithCdp: () => launchWithCdp,
@@ -41032,10 +41090,27 @@ var CliProviderInstance = class _CliProviderInstance {
41032
41090
  return null;
41033
41091
  }
41034
41092
  if (adapterStatus.status === "waiting_approval" && (!this.autoApproveEffectivelyActive(adapterStatus.status) || this.autoApproveMaskStalled())) {
41093
+ if (this.isTransientToolConsent()) {
41094
+ return null;
41095
+ }
41035
41096
  return "waiting_approval";
41036
41097
  }
41037
41098
  return null;
41038
41099
  }
41100
+ /**
41101
+ * NOTIF-HELD-DRAIN: true when this `waiting_approval` is a routine, transient tool-consent
41102
+ * of an autonomously-progressing mesh session rather than a genuine human-await modal —
41103
+ * i.e. it is a mesh coordinator/worker session, a turn is actively in flight
41104
+ * (hasAdapterPendingResponse), and no human is attending it by hand. Such a consent is
41105
+ * driven to resolution by the harness/operator as part of the in-flight turn, so holding
41106
+ * the mesh's completion events behind it (modal_parked) is the false-positive that stalls
41107
+ * delivery. Narrow by design: manual attendance or a non-progressing session falls through
41108
+ * to the genuine-modal classification.
41109
+ */
41110
+ isTransientToolConsent(now = Date.now()) {
41111
+ const isAutonomousMeshSession = this.isMeshWorkerSession() || !!this.settings.meshCoordinatorFor;
41112
+ return isAutonomousMeshSession && this.hasAdapterPendingResponse() && !this.manualAttendance.isAttended(now);
41113
+ }
41039
41114
  /** True when this session is parked on a modal awaiting a human answer. */
41040
41115
  isModalParked() {
41041
41116
  return this.resolveModalParkStatus() !== null;
@@ -65244,6 +65319,7 @@ var V1_CONTRACT_VERSION = "1.0.0";
65244
65319
  isSetupComplete,
65245
65320
  isTaskReadonly,
65246
65321
  isUserFacingChatMessage,
65322
+ isWeakCompletionEvidence,
65247
65323
  killIdeProcess,
65248
65324
  launchIDE,
65249
65325
  launchWithCdp,