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

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