dsh-interconnect 0.11.9 → 0.11.10

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.8",
4
+ "version": "0.11.10",
5
5
  "entry": {
6
6
  "name": "dsh-interconnect/interconnect",
7
7
  "inject": ["agents", "credentials"]
package/lib/index.js CHANGED
@@ -1284,10 +1284,22 @@ var InterconnectService = class extends Service {
1284
1284
  }
1285
1285
  this.sendFrame(socket, { type: "query-result", reqId, result });
1286
1286
  }
1287
- /** Surface one remote notification to local listeners and the log. */
1287
+ /**
1288
+ * Surface one remote notification to local listeners and the log.
1289
+ *
1290
+ * `ctx.parallel` is used instead of `ctx.emit`: `emit` maps listeners without
1291
+ * awaiting them, so a listener that returns a rejected promise would surface
1292
+ * as an unhandled rejection, while `parallel` settles every listener and
1293
+ * aggregates their failures.
1294
+ */
1288
1295
  receiveEvent(eventPayload) {
1289
- this.ctx.logger.info(`interconnect: remote event ${eventPayload.notification.kind} from ${eventPayload.sender}`);
1290
- this.ctx.emit("interconnect/event", eventPayload.notification, eventPayload.sender);
1296
+ const { notification, sender } = eventPayload;
1297
+ this.ctx.logger.info(`interconnect: remote event ${notification.kind} from ${sender}`);
1298
+ void this.ctx.parallel("interconnect/event", notification, sender).catch((error) => {
1299
+ const reasons = error instanceof AggregateError ? error.errors : [error];
1300
+ const detail = reasons.map((reason) => reason instanceof Error ? reason.message : String(reason)).join("; ");
1301
+ this.ctx.logger.warn(`interconnect: listener for a ${notification.kind} event from ${sender} threw: ${detail}`);
1302
+ });
1291
1303
  }
1292
1304
  /**
1293
1305
  * Summarize the live local sessions so a sender can discover valid targets
@@ -1525,15 +1537,7 @@ var InterconnectService = class extends Service {
1525
1537
  return;
1526
1538
  }
1527
1539
  if (frame.type === "event") {
1528
- const sender = this.peerOf.get(socket) ?? "unknown-peer";
1529
- const kind = frame.notification.kind;
1530
- try {
1531
- this.receiveEvent({ sender, notification: frame.notification });
1532
- } catch (error) {
1533
- this.ctx.logger.warn(
1534
- `interconnect: listener for a ${kind} event from ${sender} threw: ` + (error instanceof Error ? error.message : String(error))
1535
- );
1536
- }
1540
+ this.receiveEvent({ sender: this.peerOf.get(socket) ?? "unknown-peer", notification: frame.notification });
1537
1541
  return;
1538
1542
  }
1539
1543
  if (frame.type === "msg-result") {
@@ -1284,10 +1284,22 @@ var InterconnectService = class extends Service {
1284
1284
  }
1285
1285
  this.sendFrame(socket, { type: "query-result", reqId, result });
1286
1286
  }
1287
- /** Surface one remote notification to local listeners and the log. */
1287
+ /**
1288
+ * Surface one remote notification to local listeners and the log.
1289
+ *
1290
+ * `ctx.parallel` is used instead of `ctx.emit`: `emit` maps listeners without
1291
+ * awaiting them, so a listener that returns a rejected promise would surface
1292
+ * as an unhandled rejection, while `parallel` settles every listener and
1293
+ * aggregates their failures.
1294
+ */
1288
1295
  receiveEvent(eventPayload) {
1289
- this.ctx.logger.info(`interconnect: remote event ${eventPayload.notification.kind} from ${eventPayload.sender}`);
1290
- this.ctx.emit("interconnect/event", eventPayload.notification, eventPayload.sender);
1296
+ const { notification, sender } = eventPayload;
1297
+ this.ctx.logger.info(`interconnect: remote event ${notification.kind} from ${sender}`);
1298
+ void this.ctx.parallel("interconnect/event", notification, sender).catch((error) => {
1299
+ const reasons = error instanceof AggregateError ? error.errors : [error];
1300
+ const detail = reasons.map((reason) => reason instanceof Error ? reason.message : String(reason)).join("; ");
1301
+ this.ctx.logger.warn(`interconnect: listener for a ${notification.kind} event from ${sender} threw: ${detail}`);
1302
+ });
1291
1303
  }
1292
1304
  /**
1293
1305
  * Summarize the live local sessions so a sender can discover valid targets
@@ -1525,15 +1537,7 @@ var InterconnectService = class extends Service {
1525
1537
  return;
1526
1538
  }
1527
1539
  if (frame.type === "event") {
1528
- const sender = this.peerOf.get(socket) ?? "unknown-peer";
1529
- const kind = frame.notification.kind;
1530
- try {
1531
- this.receiveEvent({ sender, notification: frame.notification });
1532
- } catch (error) {
1533
- this.ctx.logger.warn(
1534
- `interconnect: listener for a ${kind} event from ${sender} threw: ` + (error instanceof Error ? error.message : String(error))
1535
- );
1536
- }
1540
+ this.receiveEvent({ sender: this.peerOf.get(socket) ?? "unknown-peer", notification: frame.notification });
1537
1541
  return;
1538
1542
  }
1539
1543
  if (frame.type === "msg-result") {