@openscout/runtime 0.2.33 → 0.2.35

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.
@@ -151,18 +151,27 @@ async function discoverPeers(seeds = []) {
151
151
  continue;
152
152
  try {
153
153
  const peerAgents = await fetchPeerAgents(node.brokerUrl);
154
+ let syncedCount = 0;
154
155
  for (const agent of peerAgents) {
155
156
  if (agent.id === nodeId)
156
157
  continue;
158
+ // Skip agents that claim to be from our own node — stale cached copies
159
+ if (agent.homeNodeId === nodeId)
160
+ continue;
161
+ // Only accept agents whose home node is the peer itself
162
+ const agentHome = agent.homeNodeId || node.id;
163
+ if (agentHome !== node.id)
164
+ continue;
157
165
  const remoteAgent = {
158
166
  ...agent,
159
- homeNodeId: agent.homeNodeId || node.id,
167
+ homeNodeId: agentHome,
160
168
  authorityNodeId: agent.authorityNodeId || node.id,
161
169
  };
162
170
  await upsertAgentDurably(remoteAgent);
171
+ syncedCount++;
163
172
  }
164
- if (peerAgents.length > 0) {
165
- console.log(`[openscout-runtime] synced ${peerAgents.length} agent(s) from peer ${node.name || node.id}`);
173
+ if (syncedCount > 0) {
174
+ console.log(`[openscout-runtime] synced ${syncedCount} agent(s) from peer ${node.name || node.id}`);
166
175
  }
167
176
  }
168
177
  catch {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openscout/runtime",
3
- "version": "0.2.33",
3
+ "version": "0.2.35",
4
4
  "description": "Local runtime foundation for the OpenScout control plane",
5
5
  "type": "module",
6
6
  "bin": {
@@ -86,7 +86,7 @@
86
86
  "postpack": "node ../../scripts/restore-publish-manifest.mjs ."
87
87
  },
88
88
  "dependencies": {
89
- "@openscout/protocol": "0.2.33",
89
+ "@openscout/protocol": "0.2.35",
90
90
  "smol-toml": "^1.6.1"
91
91
  },
92
92
  "publishConfig": {
@@ -227,17 +227,24 @@ async function discoverPeers(seeds: string[] = []): Promise<NodeDefinition[]> {
227
227
  if (!node.brokerUrl) continue;
228
228
  try {
229
229
  const peerAgents = await fetchPeerAgents(node.brokerUrl);
230
+ let syncedCount = 0;
230
231
  for (const agent of peerAgents) {
231
232
  if (agent.id === nodeId) continue;
233
+ // Skip agents that claim to be from our own node — stale cached copies
234
+ if (agent.homeNodeId === nodeId) continue;
235
+ // Only accept agents whose home node is the peer itself
236
+ const agentHome = agent.homeNodeId || node.id;
237
+ if (agentHome !== node.id) continue;
232
238
  const remoteAgent: AgentDefinition = {
233
239
  ...agent,
234
- homeNodeId: agent.homeNodeId || node.id,
240
+ homeNodeId: agentHome,
235
241
  authorityNodeId: agent.authorityNodeId || node.id,
236
242
  };
237
243
  await upsertAgentDurably(remoteAgent);
244
+ syncedCount++;
238
245
  }
239
- if (peerAgents.length > 0) {
240
- console.log(`[openscout-runtime] synced ${peerAgents.length} agent(s) from peer ${node.name || node.id}`);
246
+ if (syncedCount > 0) {
247
+ console.log(`[openscout-runtime] synced ${syncedCount} agent(s) from peer ${node.name || node.id}`);
241
248
  }
242
249
  } catch {
243
250
  // Best-effort: peer may be temporarily unreachable