dsh-interconnect 0.10.0 → 0.11.0

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/README.md CHANGED
@@ -18,7 +18,7 @@
18
18
  - `interconnect_send`:向对端实例的指定 session 投递消息;可选 `delivery` 选投递模式、`resume` 唤醒离线 session
19
19
  - `interconnect_list`:列出对端实例的 live session(id + 标题 + 状态),用于在不预先知道 session id 时寻址
20
20
  - `interconnect_ping`:探测对端实例活性与身份
21
- - `interconnect_reply`:向记录过的发送方回传消息,只需本机 session id + 文本,无需再次寻址
21
+ - `interconnect_reply`:向记录过的发送方回传消息,只需文本;回信 session 是本 agent 自己的,无需再次寻址
22
22
 
23
23
  **`skill-interconnect`** —— 配套 skill:
24
24
 
@@ -37,7 +37,7 @@
37
37
  - `interconnect_send(instanceId="peer", sessionId=..., text=...)`
38
38
  - `interconnect_ping(instanceId="peer")`
39
39
  - `interconnect_list(instanceId="peer")`
40
- - `interconnect_reply(sessionId=...)`(只需本地 session,目标从记录的 sender 解析)
40
+ - `interconnect_reply(text=...)`(只需文本;回信 session 是本 agent 自己的,目标从记录的 sender 解析)
41
41
 
42
42
  `instanceId` 是 `interconnect` 行 `peers` 映射里的键;真正用来拨号的 origin 由该映射的值给出(例如隧道端点 `http://127.0.0.1:13080`),**instanceId 本身从不出现在线上**,也不参与路由——origin 才是唯一的拨号依据。到**未配置 / 未联通**的对端 `send`/`ping`/`list` 返回 `unreachable`(无 HTTP 回退)。
43
43
 
@@ -58,19 +58,17 @@ session-b07326da-… [running]
58
58
  ### 回复(`reply`)
59
59
 
60
60
  `send` 的线负载带一个 `sender` 身份(**无地址**:`instanceId` + `sessionId`),收到消息的
61
- instance 会按「本地 session id → 该 sender」记下这份身份。之后那个 session 可以只凭**自己的
62
- session id + 文本**把消息回传给发送方,不用再次给出对端 instanceId 或远程 session id——回信
63
- 走的是本机到那个 instance 的持久链接。
61
+ instance 会按「本地 session id → 该 sender」记下这份身份。之后那个 session 回信**只需要文本**:
62
+ 回信 session 就是执行 `interconnect_reply` 的 agent 自己的 session,工具据此查出记录的 sender,
63
+ 不用再次给出本地 session id、对端 instanceId 或远程 session id——回信走的是本机到那个
64
+ instance 的持久链接。
64
65
 
65
66
  ```text
66
67
  # 源实例 A 指定目标 B 的 session,并带上自己的身份(无 baseUrl)
67
68
  interconnect_send(instanceId="b", sessionId=B-sess, text="…", sender={instanceId:A, sessionId:A-sess})
68
69
 
69
- # B 回传:只给本地 session id + 文本,目标从记录的 sender 解析
70
- interconnect_reply(sessionId=B-sess, text="reply")
71
- ```
72
- # B 回传:只给本地 session id + 文本,目标从记录的 sender 解析
73
- interconnect_reply(sessionId=B-sess, text="reply")
70
+ # B 回传:只给文本,回信 session 即执行该工具的 agent 自己的 session
71
+ interconnect_reply(text="reply")
74
72
  ```
75
73
 
76
74
  - `sender` 是**自报**的,只用于 reply 归因与寻址,**不是**路由或鉴权依据——连接本身仍由
@@ -100,8 +98,7 @@ interconnect_reply(sessionId=B-sess, text="reply")
100
98
  - **出站**:`interconnect_send`/`interconnect_reply`/`ping`/`list` 都发对应帧并等待匹配 `reqId`
101
99
  的结果(受 `requestTimeoutMs` 约束)。到**未配置或未联通**的对端直接返回 `unreachable`——
102
100
  **没有 HTTP 回退**,这是 0.9 的破坏性变化。
103
- - **入站**:`msg` 帧走 `deliver`/`reply` 逻辑(sender 记录、subagent 封栏、`no-sender-known`
104
- 等),结果经同一 socket 回 `msg-result`;`query` 帧回 `query-result`。
101
+ - **入站**:`msg` 帧携带 `send`,走 `deliver` 逻辑(sender 记录、subagent 封栏等),结果经同一 socket 回 `msg-result`;`query` 帧回 `query-result`。
105
102
  - 心跳与指数退避重连沿用既有实现。
106
103
 
107
104
  ### 投递失败的原因
@@ -128,8 +125,11 @@ interconnect_reply(sessionId=B-sess, text="reply")
128
125
 
129
126
  `interconnect_send` 不会往 subagent 拥有的 session 里投递,`interconnect_list` 也不会把它们
130
127
  列出来。那类 session 的投递权属于它的父 agent,从这里 splice 进 inbox 会和父 agent 抢。判定
131
- 直接复用 Host 的 `hasApiRemoteSubagentOwner`(`@deepseek-ai/dsh-api-remotes`),而不是自己
132
- 实现一份——这是安全规则,本地副本一定会和上游漂移。
128
+ 逻辑镜像 Host 的 `hasApiSessionSubagentOwner`(`@deepseek-ai/dsh-api-session-controller`):
129
+ Host 在 0.6 之后把这个谓词从 `@deepseek-ai/dsh-api-remotes` 移走,且没有公开导出——桌面端和
130
+ `npx @deepseek-ai/dsh web` 运行时里没有任何可 import 的 Host 绑定,所以这里逐字复制一份
131
+ (`isSessionOwnedBySubagent`,见 `src/interconnect/index.ts`)。这是安全规则,Host 改动该规则
132
+ 时必须同步此副本;tests 覆盖 origin=subagent 与 parent-owned 两条封栏分支。
133
133
 
134
134
  已实测:起一个真实 subagent 后,`interconnect_list` 不包含它;直接 `send` 到它的 id 返回
135
135
  `session-owned-by-subagent`,消息**没有**进入 inbox。
@@ -253,11 +253,16 @@ pnpm run build # esbuild → lib/
253
253
  服务(有 HTTP/WS 端点),必须 host 级;`tool-interconnect` 和 `skill-interconnect`
254
254
  也放 host,因为 `interconnect` 未做 TypeRT `@Remote`/Gateway 绑定,放进 agent preset
255
255
  的 isolate realm 会导致工具/技能行无法 inject 到该服务。
256
+ - 服务只 inject `agents` 与 `credentials`;**宿主 webserver 是可选的**。有 webserver 时入站
257
+ 升级路由注册在它上面(`webServer` 经等待式 inject fiber 接入,与组合顺序无关);没有
258
+ webserver 的 profile(例如 headless)里服务仍会拨号已配置对端并经这些出站链接投递,即
259
+ 仅出站模式。`dsh.plugin.json` 的 `inject` 与之一致,只有 `agents`、`credentials`。
256
260
  - `ws` 是运行依赖,由宿主的 node_modules 提供(构建时 external)。
257
261
 
258
262
  ## 验证
259
263
 
260
- - 38/38 单测通过(服务 + 工具 + skill);类型检查、构建均干净。
264
+ - 145/145 单测通过(服务 + 工具 + skill,含 wire 校验、畸形帧、心跳/池清理、结果帧绑定等回归用例);
265
+ 类型检查、构建均干净。
261
266
  - 已在两台机器之间实测双向互通:消息投递、WebSocket 事件推流、以及 agent 经
262
267
  `interconnect_send` 工具反向回发,均验证通过。
263
268
  - CI(GitHub Actions):clone 公开 DSH 仓库作为 sibling,跑 `pnpm run check`。
@@ -20,9 +20,9 @@ job is only to pick the right tool and the right target.
20
20
  instance/session identity is attached automatically by the tool, so you must
21
21
  NOT pass a sender parameter.
22
22
  - `interconnect_reply` — send a message back to the peer that this session last
23
- received an interconnect message from. Pass only the LOCAL session id that
24
- received the message and the reply text. The remote target is recalled
25
- automatically; do not try to look up or pass the sender address again.
23
+ received an interconnect message from. Pass only the reply text: the replying
24
+ session is this agent's own session, and the remote target is recalled
25
+ automatically, so do not try to look up or pass the sender address again.
26
26
 
27
27
  ## Sender identity is automatic
28
28
 
@@ -41,8 +41,8 @@ addresses.
41
41
  `interconnect_list(instanceId=...)` and choose a live session.
42
42
  2. Call `interconnect_send(instanceId=..., sessionId=..., text=...)`.
43
43
  3. When a message arrives on your side and you need to respond, call
44
- `interconnect_reply(sessionId=<your-local-session-id>, text=...)`. The
45
- recorded sender is used as the destination.
44
+ `interconnect_reply(text=...)`. The replying session is this agent's own
45
+ session, and the recorded sender is used as the destination.
46
46
 
47
47
  ## Delivery modes
48
48
 
package/dsh.plugin.json CHANGED
@@ -1,9 +1,9 @@
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.10.0",
4
+ "version": "0.11.0",
5
5
  "entry": {
6
6
  "name": "dsh-interconnect/interconnect",
7
- "inject": ["webServer", "agents", "credentials"]
7
+ "inject": ["agents", "credentials"]
8
8
  }
9
9
  }