@adhdev/daemon-core 0.9.82-rc.159 → 0.9.82-rc.160

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adhdev/daemon-core",
3
- "version": "0.9.82-rc.159",
3
+ "version": "0.9.82-rc.160",
4
4
  "description": "ADHDev daemon core — CDP, IDE detection, providers, command execution",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -5556,7 +5556,13 @@ export class DaemonCommandRouter {
5556
5556
  const meshHost = resolveMeshHostStatus(mesh);
5557
5557
 
5558
5558
  const refreshRequested = args?.refresh === true || args?.forceRefresh === true;
5559
- const pendingCoordinatorEventCount = getPendingMeshCoordinatorEvents(meshId).length;
5559
+ // See (B3) below: scope the peek to this daemon when the
5560
+ // caller doesn't tell us, otherwise scoped events look
5561
+ // missing and we falsely return a stale cache.
5562
+ const peekScope = typeof args?.coordinatorDaemonId === 'string' && args.coordinatorDaemonId.trim()
5563
+ ? args.coordinatorDaemonId.trim()
5564
+ : (this.deps.statusInstanceId || undefined);
5565
+ const pendingCoordinatorEventCount = getPendingMeshCoordinatorEvents(meshId, peekScope).length;
5560
5566
  const hadAggregateCache = this.aggregateMeshStatusCache.has(meshId);
5561
5567
  if (!refreshRequested && pendingCoordinatorEventCount === 0) {
5562
5568
  const cachedStatus = this.getCachedAggregateMeshStatus(meshId, mesh, { requireDirectPeerTruth: args?.requireDirectPeerTruth === true });
@@ -5903,12 +5909,18 @@ export class DaemonCommandRouter {
5903
5909
  nodeStatuses.push(status);
5904
5910
  }
5905
5911
 
5906
- // (B3) Pass coordinatorDaemonId when the caller declares
5907
- // it so v1.5 unicast routing (targetCoordinatorDaemonId)
5908
- // delivers events to the right coordinator.
5912
+ // (B3) Resolve the coordinator daemon scope for the drain.
5913
+ // Emit-time always tags events with the worker's
5914
+ // targetCoordinatorDaemonId and writes them to the
5915
+ // scoped pending-events file. If the caller (MCP tool,
5916
+ // dashboard, etc.) doesn't tell us which coordinator
5917
+ // they're running under, fall back to *this daemon's*
5918
+ // ID — the caller reached us over our IPC/WS, so they
5919
+ // are by definition under this daemon. Falling back to
5920
+ // undefined would silently miss every scoped event.
5909
5921
  const callerCoordinatorDaemonId = typeof args?.coordinatorDaemonId === 'string' && args.coordinatorDaemonId.trim()
5910
5922
  ? args.coordinatorDaemonId.trim()
5911
- : undefined;
5923
+ : (this.deps.statusInstanceId || undefined);
5912
5924
  const pendingCoordinatorEvents = drainPendingMeshCoordinatorEvents(meshId, callerCoordinatorDaemonId);
5913
5925
  const previewFreshness = (() => {
5914
5926
  const localRepoRoot = nodeStatuses