@adhdev/daemon-core 0.9.82-rc.502 → 0.9.82-rc.504

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.502",
3
+ "version": "0.9.82-rc.504",
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",
@@ -47,8 +47,8 @@
47
47
  "author": "vilmire",
48
48
  "license": "AGPL-3.0-or-later",
49
49
  "dependencies": {
50
- "@adhdev/mesh-shared": "0.9.82-rc.502",
51
- "@adhdev/session-host-core": "0.9.82-rc.502",
50
+ "@adhdev/mesh-shared": "0.9.82-rc.504",
51
+ "@adhdev/session-host-core": "0.9.82-rc.504",
52
52
  "@agentclientprotocol/sdk": "^0.16.1",
53
53
  "ajv": "^8.20.0",
54
54
  "ajv-formats": "^3.0.1",
@@ -72,18 +72,26 @@ export async function pullRemoteNodeQueues(
72
72
  if (daemonIdsEquivalent(nodeDaemonId, localDaemonId)) return;
73
73
  if (daemonIdListIncludes(candidateDaemonIds, nodeDaemonId)) return;
74
74
 
75
- // Peer-connected pre-check (EVENT-DELIVERY-DELAY fix(a)): a degraded peer whose
76
- // DataChannel is not open would sink this pull into peer.connectQueue and stall
77
- // until CONNECT_TIMEOUT_MS (90s), formerly freezing the whole serial loop and
78
- // delaying completion-event recovery from healthy nodes. Skip such a node THIS
79
- // tick and retry next tick — LOSSLESS: an unconnected peer has not drained
80
- // anything (drained=0 preserved), so its events are recovered whole on the next
81
- // successful tick. Skip = delay, never loss.
82
- // • snapshot present and state !== 'connected' skip (continue next tick).
83
- // snapshot null/undefined (getter unwired, e.g. standalone) DO NOT skip;
84
- // fall through to the legacy path so this stays regression-free.
85
- const peerSnapshot = components.getMeshPeerConnectionStatus?.(nodeDaemonId);
86
- if (peerSnapshot && String(peerSnapshot.state) !== 'connected') return;
75
+ // Peer-connected pre-check (EVENT-DELIVERY-DELAY fix(a) + OFFLINE-NODE-FANOUT):
76
+ // a degraded peer whose DataChannel is not open would sink this pull into
77
+ // peer.connectQueue and stall until CONNECT_TIMEOUT_MS (90s), formerly freezing
78
+ // the whole serial loop and delaying completion-event recovery from healthy
79
+ // nodes. Skip such a node THIS tick and retry next tick — LOSSLESS: an
80
+ // unconnected peer has not drained anything (drained=0 preserved), so its events
81
+ // are recovered whole on the next successful tick. Skip = delay, never loss.
82
+ // • getter WIRED (cloud) a null/undefined snapshot means "no peer object
83
+ // right now" = NOT connected (a powered-off node whose failPeer just deleted
84
+ // the peer each cycle). Treat it EXACTLY like state !== 'connected' and skip;
85
+ // dialing here would re-queue for another 90s (the null-race the guard is
86
+ // meant to prevent). Only a snapshot with state === 'connected' proceeds.
87
+ // • getter UNWIRED (standalone) → DO NOT skip; fall through to the legacy path
88
+ // so this stays regression-free (the standalone case the guard's history
89
+ // references).
90
+ const getPeerStatus = components.getMeshPeerConnectionStatus;
91
+ if (getPeerStatus) {
92
+ const peerSnapshot = getPeerStatus(nodeDaemonId);
93
+ if (!peerSnapshot || String(peerSnapshot.state) !== 'connected') return;
94
+ }
87
95
 
88
96
  for (const pendingEventArgs of pulls) {
89
97
  let events: unknown;
@@ -185,15 +193,23 @@ export async function collectLiveNodesWithSessions(
185
193
  const isLocalNode = !nodeDaemonId
186
194
  || daemonIdListIncludes(selfIds, nodeDaemonId)
187
195
  || daemonIdsEquivalent(nodeDaemonId, localDaemonId);
188
- // Peer-connected pre-check (EVENT-DELIVERY-DELAY fix(a)): mirror pullRemoteNodeQueues.
189
- // Without this the 90s connect-deadline block re-enters via this Promise.all —
190
- // a degraded remote's get_status_metadata sinks into peer.connectQueue and stalls
191
- // the whole prune probe. Only call the remote when the peer is 'connected'; an
192
- // unconnected peer is left undecorated (empty session list), same as unreachable.
193
- // Getter unwired (null/undefined) → do NOT skip, fall through (regression-free).
196
+ // Peer-connected pre-check (EVENT-DELIVERY-DELAY fix(a) + OFFLINE-NODE-FANOUT):
197
+ // mirror pullRemoteNodeQueues. Without this the 90s connect-deadline block
198
+ // re-enters via this Promise.all — a degraded remote's get_status_metadata sinks
199
+ // into peer.connectQueue and stalls the whole prune probe. Only call the remote
200
+ // when the peer is 'connected'; an unconnected peer is left undecorated (empty
201
+ // session list), same as unreachable.
202
+ // • getter WIRED (cloud) → a null snapshot means "no peer object right now" =
203
+ // NOT connected (offline node whose failPeer deleted the peer). Skip (leave
204
+ // undecorated) rather than dialing into another 90s connect wait — the same
205
+ // null-race harden as pullRemoteNodeQueues.
206
+ // • getter UNWIRED (standalone) → do NOT skip, fall through (regression-free).
194
207
  if (!isLocalNode) {
195
- const peerSnapshot = components.getMeshPeerConnectionStatus?.(nodeDaemonId);
196
- if (peerSnapshot && String(peerSnapshot.state) !== 'connected') return node;
208
+ const getPeerStatus = components.getMeshPeerConnectionStatus;
209
+ if (getPeerStatus) {
210
+ const peerSnapshot = getPeerStatus(nodeDaemonId);
211
+ if (!peerSnapshot || String(peerSnapshot.state) !== 'connected') return node;
212
+ }
197
213
  }
198
214
  let statusResult: unknown;
199
215
  try {