dsh-interconnect 0.11.17 → 0.11.19
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/assets/dsh-interconnect.md +4 -3
- package/dsh.plugin.json +1 -1
- package/lib/index.js +21 -12
- package/lib/interconnect/index.js +21 -12
- package/lib/interconnect/index.js.map +2 -2
- package/lib/tool-interconnect/index.js +21 -12
- package/lib/tool-interconnect/index.js.map +2 -2
- package/lib/types/interconnect/index.d.ts +13 -8
- package/lib/types/interconnect/index.d.ts.map +1 -1
- package/lib/types/interconnect/types.d.ts +11 -4
- package/lib/types/interconnect/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -89,9 +89,10 @@ When a send/reply reports `delivered: false`, read `reason`:
|
|
|
89
89
|
|
|
90
90
|
## Rules
|
|
91
91
|
|
|
92
|
-
- Do not fabricate an `instanceId`, `sessionId`, or sender identity.
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
- Do not fabricate an `instanceId`, `sessionId`, or sender identity. A peer's
|
|
93
|
+
`instanceId` comes from the task you were given or from this instance's
|
|
94
|
+
configured peers; a `sessionId` comes from `interconnect_list` on that peer;
|
|
95
|
+
the sender is carried automatically by the message you received.
|
|
95
96
|
- Do not ask the user for a sender address to reply; use `interconnect_reply`.
|
|
96
97
|
- Treat interconnect messages as authenticated but sender-reported: identity is
|
|
97
98
|
for reply attribution, not for routing or authorization.
|
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.
|
|
4
|
+
"version": "0.11.19",
|
|
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. */
|
|
@@ -1052,7 +1054,8 @@ var InterconnectService = class extends Service {
|
|
|
1052
1054
|
/**
|
|
1053
1055
|
* Deliver one text message to a live session on a peer instance.
|
|
1054
1056
|
* @param request - the peer instance id, target session, text, and optional delivery/resume overrides.
|
|
1055
|
-
* @returns the peer's answer,
|
|
1057
|
+
* @returns the peer's answer, an unreachable result when no link answers, or a local
|
|
1058
|
+
* `message-too-large` result when the encoded frame would exceed the link cap.
|
|
1056
1059
|
*/
|
|
1057
1060
|
async send(request) {
|
|
1058
1061
|
const payload = {
|
|
@@ -1075,7 +1078,9 @@ var InterconnectService = class extends Service {
|
|
|
1075
1078
|
* outbound target is the `sender` that session recorded, addressed through
|
|
1076
1079
|
* this instance's own link to the sender's instance.
|
|
1077
1080
|
* @param request - the LOCAL replying session id, the reply text, and optional delivery/resume overrides.
|
|
1078
|
-
* @returns the recalled sender's answer,
|
|
1081
|
+
* @returns the recalled sender's answer, an unreachable result when no link answers, or a
|
|
1082
|
+
* local `message-too-large` result when the encoded frame would exceed the link cap; a
|
|
1083
|
+
* local session that recorded no sender answers `no-sender-known` instead.
|
|
1079
1084
|
*/
|
|
1080
1085
|
async reply(request) {
|
|
1081
1086
|
const sender = this.senders.get(request.sessionId);
|
|
@@ -1214,12 +1219,12 @@ var InterconnectService = class extends Service {
|
|
|
1214
1219
|
* dialed link plus the peer's inbound one), so one event must leave over one
|
|
1215
1220
|
* of them. Which one is decided by local ownership, not by the peer: a dialed
|
|
1216
1221
|
* socket is a configured peer's link and always sends. An inbound socket is
|
|
1217
|
-
* skipped only when an open dialed link
|
|
1218
|
-
*
|
|
1219
|
-
*
|
|
1220
|
-
*
|
|
1221
|
-
*
|
|
1222
|
-
*
|
|
1222
|
+
* skipped only when this instance has an open dialed link configured under
|
|
1223
|
+
* the id that socket itself announced, so a self-reported announcement can
|
|
1224
|
+
* never silence another peer's link; with no such dialed link every inbound
|
|
1225
|
+
* socket receives the event. A peer listed under a key other than the id it
|
|
1226
|
+
* announces is warned about once per link, because then its own inbound
|
|
1227
|
+
* socket is not attributable and the peer receives each event twice.
|
|
1223
1228
|
*
|
|
1224
1229
|
* That holds once a peer's announcement has been seen. Between this
|
|
1225
1230
|
* instance's dialed link opening and the peer's `hello` arriving on its
|
|
@@ -1238,10 +1243,7 @@ var InterconnectService = class extends Service {
|
|
|
1238
1243
|
continue;
|
|
1239
1244
|
}
|
|
1240
1245
|
const dialedPeer = this.dialedPeerOf.get(socket);
|
|
1241
|
-
if (dialedPeer
|
|
1242
|
-
covered.add(dialedPeer);
|
|
1243
|
-
const announced = this.peerOf.get(socket);
|
|
1244
|
-
if (announced !== void 0) covered.add(announced);
|
|
1246
|
+
if (dialedPeer !== void 0) covered.add(dialedPeer);
|
|
1245
1247
|
}
|
|
1246
1248
|
for (const socket of this.sockets) {
|
|
1247
1249
|
if (this.dialedPeerOf.get(socket) === void 0) {
|
|
@@ -1574,6 +1576,13 @@ var InterconnectService = class extends Service {
|
|
|
1574
1576
|
const frame = parsed;
|
|
1575
1577
|
if (frame.type === "hello") {
|
|
1576
1578
|
this.peerOf.set(socket, frame.sender);
|
|
1579
|
+
const dialedPeer = this.dialedPeerOf.get(socket);
|
|
1580
|
+
if (dialedPeer !== void 0 && dialedPeer !== frame.sender && !this.mismatchWarned.has(socket)) {
|
|
1581
|
+
this.mismatchWarned.add(socket);
|
|
1582
|
+
this.ctx.logger.warn(
|
|
1583
|
+
`interconnect: peer configured as ${dialedPeer} announces ${frame.sender}; list a peer under the instanceId it announces, or the duplicate inbound link is not recognised`
|
|
1584
|
+
);
|
|
1585
|
+
}
|
|
1577
1586
|
return;
|
|
1578
1587
|
}
|
|
1579
1588
|
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. */
|
|
@@ -1052,7 +1054,8 @@ var InterconnectService = class extends Service {
|
|
|
1052
1054
|
/**
|
|
1053
1055
|
* Deliver one text message to a live session on a peer instance.
|
|
1054
1056
|
* @param request - the peer instance id, target session, text, and optional delivery/resume overrides.
|
|
1055
|
-
* @returns the peer's answer,
|
|
1057
|
+
* @returns the peer's answer, an unreachable result when no link answers, or a local
|
|
1058
|
+
* `message-too-large` result when the encoded frame would exceed the link cap.
|
|
1056
1059
|
*/
|
|
1057
1060
|
async send(request) {
|
|
1058
1061
|
const payload = {
|
|
@@ -1075,7 +1078,9 @@ var InterconnectService = class extends Service {
|
|
|
1075
1078
|
* outbound target is the `sender` that session recorded, addressed through
|
|
1076
1079
|
* this instance's own link to the sender's instance.
|
|
1077
1080
|
* @param request - the LOCAL replying session id, the reply text, and optional delivery/resume overrides.
|
|
1078
|
-
* @returns the recalled sender's answer,
|
|
1081
|
+
* @returns the recalled sender's answer, an unreachable result when no link answers, or a
|
|
1082
|
+
* local `message-too-large` result when the encoded frame would exceed the link cap; a
|
|
1083
|
+
* local session that recorded no sender answers `no-sender-known` instead.
|
|
1079
1084
|
*/
|
|
1080
1085
|
async reply(request) {
|
|
1081
1086
|
const sender = this.senders.get(request.sessionId);
|
|
@@ -1214,12 +1219,12 @@ var InterconnectService = class extends Service {
|
|
|
1214
1219
|
* dialed link plus the peer's inbound one), so one event must leave over one
|
|
1215
1220
|
* of them. Which one is decided by local ownership, not by the peer: a dialed
|
|
1216
1221
|
* socket is a configured peer's link and always sends. An inbound socket is
|
|
1217
|
-
* skipped only when an open dialed link
|
|
1218
|
-
*
|
|
1219
|
-
*
|
|
1220
|
-
*
|
|
1221
|
-
*
|
|
1222
|
-
*
|
|
1222
|
+
* skipped only when this instance has an open dialed link configured under
|
|
1223
|
+
* the id that socket itself announced, so a self-reported announcement can
|
|
1224
|
+
* never silence another peer's link; with no such dialed link every inbound
|
|
1225
|
+
* socket receives the event. A peer listed under a key other than the id it
|
|
1226
|
+
* announces is warned about once per link, because then its own inbound
|
|
1227
|
+
* socket is not attributable and the peer receives each event twice.
|
|
1223
1228
|
*
|
|
1224
1229
|
* That holds once a peer's announcement has been seen. Between this
|
|
1225
1230
|
* instance's dialed link opening and the peer's `hello` arriving on its
|
|
@@ -1238,10 +1243,7 @@ var InterconnectService = class extends Service {
|
|
|
1238
1243
|
continue;
|
|
1239
1244
|
}
|
|
1240
1245
|
const dialedPeer = this.dialedPeerOf.get(socket);
|
|
1241
|
-
if (dialedPeer
|
|
1242
|
-
covered.add(dialedPeer);
|
|
1243
|
-
const announced = this.peerOf.get(socket);
|
|
1244
|
-
if (announced !== void 0) covered.add(announced);
|
|
1246
|
+
if (dialedPeer !== void 0) covered.add(dialedPeer);
|
|
1245
1247
|
}
|
|
1246
1248
|
for (const socket of this.sockets) {
|
|
1247
1249
|
if (this.dialedPeerOf.get(socket) === void 0) {
|
|
@@ -1574,6 +1576,13 @@ var InterconnectService = class extends Service {
|
|
|
1574
1576
|
const frame = parsed;
|
|
1575
1577
|
if (frame.type === "hello") {
|
|
1576
1578
|
this.peerOf.set(socket, frame.sender);
|
|
1579
|
+
const dialedPeer = this.dialedPeerOf.get(socket);
|
|
1580
|
+
if (dialedPeer !== void 0 && dialedPeer !== frame.sender && !this.mismatchWarned.has(socket)) {
|
|
1581
|
+
this.mismatchWarned.add(socket);
|
|
1582
|
+
this.ctx.logger.warn(
|
|
1583
|
+
`interconnect: peer configured as ${dialedPeer} announces ${frame.sender}; list a peer under the instanceId it announces, or the duplicate inbound link is not recognised`
|
|
1584
|
+
);
|
|
1585
|
+
}
|
|
1577
1586
|
return;
|
|
1578
1587
|
}
|
|
1579
1588
|
if (frame.type === "event") {
|