dsh-interconnect 0.11.17 → 0.11.18

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/dsh.plugin.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-interconnect",
3
3
  "description": "Cross-instance message/event handoff for DeepSeek Harness (DSH): WebSocket link, model-facing tools, and companion skill.",
4
- "version": "0.11.17",
4
+ "version": "0.11.18",
5
5
  "entry": {
6
6
  "name": "dsh-interconnect/interconnect",
7
7
  "inject": ["agents", "credentials"]
package/lib/index.js CHANGED
@@ -948,6 +948,8 @@ var InterconnectService = class extends Service {
948
948
  peerOf = /* @__PURE__ */ new WeakMap();
949
949
  /** Configured peer an outbound dial owns a socket for; absent on inbound sockets. */
950
950
  dialedPeerOf = /* @__PURE__ */ new WeakMap();
951
+ /** Dialed sockets already reported as announcing an id other than their configured key. */
952
+ mismatchWarned = /* @__PURE__ */ new WeakSet();
951
953
  /** Sender each local session last received a send from, keyed by local session id. */
952
954
  senders = /* @__PURE__ */ new Map();
953
955
  /** In-flight frames sent over a peer link, keyed by `reqId`, awaiting a correlated result. */
@@ -1214,12 +1216,12 @@ var InterconnectService = class extends Service {
1214
1216
  * dialed link plus the peer's inbound one), so one event must leave over one
1215
1217
  * of them. Which one is decided by local ownership, not by the peer: a dialed
1216
1218
  * socket is a configured peer's link and always sends. An inbound socket is
1217
- * skipped only when an open dialed link covers the id that socket itself
1218
- * announced — either because `Config.peers` lists that peer under the id, or
1219
- * because the peer announced the id over that dialed link — so an
1220
- * announcement can suppress nothing but a duplicate the controlled link
1221
- * already carries. An impostor cannot drop an event for a peer, and without a
1222
- * dialed link every inbound socket receives it.
1219
+ * skipped only when this instance has an open dialed link configured under
1220
+ * the id that socket itself announced, so a self-reported announcement can
1221
+ * never silence another peer's link; with no such dialed link every inbound
1222
+ * socket receives the event. A peer listed under a key other than the id it
1223
+ * announces is warned about once per link, because then its own inbound
1224
+ * socket is not attributable and the peer receives each event twice.
1223
1225
  *
1224
1226
  * That holds once a peer's announcement has been seen. Between this
1225
1227
  * instance's dialed link opening and the peer's `hello` arriving on its
@@ -1238,10 +1240,7 @@ var InterconnectService = class extends Service {
1238
1240
  continue;
1239
1241
  }
1240
1242
  const dialedPeer = this.dialedPeerOf.get(socket);
1241
- if (dialedPeer === void 0) continue;
1242
- covered.add(dialedPeer);
1243
- const announced = this.peerOf.get(socket);
1244
- if (announced !== void 0) covered.add(announced);
1243
+ if (dialedPeer !== void 0) covered.add(dialedPeer);
1245
1244
  }
1246
1245
  for (const socket of this.sockets) {
1247
1246
  if (this.dialedPeerOf.get(socket) === void 0) {
@@ -1574,6 +1573,13 @@ var InterconnectService = class extends Service {
1574
1573
  const frame = parsed;
1575
1574
  if (frame.type === "hello") {
1576
1575
  this.peerOf.set(socket, frame.sender);
1576
+ const dialedPeer = this.dialedPeerOf.get(socket);
1577
+ if (dialedPeer !== void 0 && dialedPeer !== frame.sender && !this.mismatchWarned.has(socket)) {
1578
+ this.mismatchWarned.add(socket);
1579
+ this.ctx.logger.warn(
1580
+ `interconnect: peer configured as ${dialedPeer} announces ${frame.sender}; list a peer under the instanceId it announces, or the duplicate inbound link is not recognised`
1581
+ );
1582
+ }
1577
1583
  return;
1578
1584
  }
1579
1585
  if (frame.type === "event") {
@@ -948,6 +948,8 @@ var InterconnectService = class extends Service {
948
948
  peerOf = /* @__PURE__ */ new WeakMap();
949
949
  /** Configured peer an outbound dial owns a socket for; absent on inbound sockets. */
950
950
  dialedPeerOf = /* @__PURE__ */ new WeakMap();
951
+ /** Dialed sockets already reported as announcing an id other than their configured key. */
952
+ mismatchWarned = /* @__PURE__ */ new WeakSet();
951
953
  /** Sender each local session last received a send from, keyed by local session id. */
952
954
  senders = /* @__PURE__ */ new Map();
953
955
  /** In-flight frames sent over a peer link, keyed by `reqId`, awaiting a correlated result. */
@@ -1214,12 +1216,12 @@ var InterconnectService = class extends Service {
1214
1216
  * dialed link plus the peer's inbound one), so one event must leave over one
1215
1217
  * of them. Which one is decided by local ownership, not by the peer: a dialed
1216
1218
  * socket is a configured peer's link and always sends. An inbound socket is
1217
- * skipped only when an open dialed link covers the id that socket itself
1218
- * announced — either because `Config.peers` lists that peer under the id, or
1219
- * because the peer announced the id over that dialed link — so an
1220
- * announcement can suppress nothing but a duplicate the controlled link
1221
- * already carries. An impostor cannot drop an event for a peer, and without a
1222
- * dialed link every inbound socket receives it.
1219
+ * skipped only when this instance has an open dialed link configured under
1220
+ * the id that socket itself announced, so a self-reported announcement can
1221
+ * never silence another peer's link; with no such dialed link every inbound
1222
+ * socket receives the event. A peer listed under a key other than the id it
1223
+ * announces is warned about once per link, because then its own inbound
1224
+ * socket is not attributable and the peer receives each event twice.
1223
1225
  *
1224
1226
  * That holds once a peer's announcement has been seen. Between this
1225
1227
  * instance's dialed link opening and the peer's `hello` arriving on its
@@ -1238,10 +1240,7 @@ var InterconnectService = class extends Service {
1238
1240
  continue;
1239
1241
  }
1240
1242
  const dialedPeer = this.dialedPeerOf.get(socket);
1241
- if (dialedPeer === void 0) continue;
1242
- covered.add(dialedPeer);
1243
- const announced = this.peerOf.get(socket);
1244
- if (announced !== void 0) covered.add(announced);
1243
+ if (dialedPeer !== void 0) covered.add(dialedPeer);
1245
1244
  }
1246
1245
  for (const socket of this.sockets) {
1247
1246
  if (this.dialedPeerOf.get(socket) === void 0) {
@@ -1574,6 +1573,13 @@ var InterconnectService = class extends Service {
1574
1573
  const frame = parsed;
1575
1574
  if (frame.type === "hello") {
1576
1575
  this.peerOf.set(socket, frame.sender);
1576
+ const dialedPeer = this.dialedPeerOf.get(socket);
1577
+ if (dialedPeer !== void 0 && dialedPeer !== frame.sender && !this.mismatchWarned.has(socket)) {
1578
+ this.mismatchWarned.add(socket);
1579
+ this.ctx.logger.warn(
1580
+ `interconnect: peer configured as ${dialedPeer} announces ${frame.sender}; list a peer under the instanceId it announces, or the duplicate inbound link is not recognised`
1581
+ );
1582
+ }
1577
1583
  return;
1578
1584
  }
1579
1585
  if (frame.type === "event") {