@adhdev/daemon-core 0.9.82-rc.235 → 0.9.82-rc.237

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
@@ -7688,6 +7688,31 @@ function setupMeshEventForwarding(components) {
7688
7688
  metadataEvent: event
7689
7689
  });
7690
7690
  });
7691
+ components.instanceManager.onEvent((event) => {
7692
+ if (event.event !== "agent:ready" && event.event !== "agent:generating_completed") return;
7693
+ const instanceId = readNonEmptyString2(event.instanceId);
7694
+ if (!instanceId) return;
7695
+ const sourceInstance = components.instanceManager.getInstance(instanceId);
7696
+ if (!sourceInstance || sourceInstance.category !== "cli") return;
7697
+ const state = sourceInstance.getState();
7698
+ const settings = state.settings && typeof state.settings === "object" ? state.settings : {};
7699
+ const coordinatorMeshId = readNonEmptyString2(settings.meshCoordinatorFor);
7700
+ if (!coordinatorMeshId) return;
7701
+ const status = readNonEmptyString2(state.status).toLowerCase();
7702
+ if (status !== "idle") return;
7703
+ try {
7704
+ const localDaemonId = readNonEmptyString2(loadConfig().machineId) || void 0;
7705
+ const pendingEvents = drainPendingMeshCoordinatorEvents(coordinatorMeshId, localDaemonId);
7706
+ if (pendingEvents.length === 0) return;
7707
+ LOG.info("MeshEvents", `Auto-flushing ${pendingEvents.length} pending coordinator event(s) for mesh ${coordinatorMeshId} on coordinator idle`);
7708
+ for (const pending of pendingEvents) {
7709
+ if (!pending.coordinatorMessage) continue;
7710
+ sourceInstance.onEvent("send_message", { input: { text: pending.coordinatorMessage, textFallback: pending.coordinatorMessage } });
7711
+ }
7712
+ } catch (e) {
7713
+ LOG.warn("MeshEvents", `Failed to auto-flush pending coordinator events: ${e?.message || e}`);
7714
+ }
7715
+ });
7691
7716
  }
7692
7717
  var REMOTE_IDLE_SESSION_TTL_MS, meshByWorkspaceCache, MESH_WORKSPACE_CACHE_TTL_MS, IDLE_AUTO_FAST_FORWARD_THROTTLE_MS, idleAutoFastForwardLastAttempt, INTENTIONAL_CLEANUP_STOP_SUPPRESSION_MS, RECENT_COMPLETION_FINGERPRINT_TTL_MS, autoLaunchInProgress, autoLaunchCooldownUntil, AUTO_LAUNCH_COOLDOWN_MS, MESH_COORDINATOR_EVENTS, EVENT_TO_LEDGER_KIND;
7693
7718
  var init_mesh_events_coordinator = __esm({