@xmanrui/dsh-im 4.18.0 → 4.19.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.
Files changed (51) hide show
  1. package/README.en.md +8 -3
  2. package/README.md +8 -3
  3. package/lib/client.js +809 -515
  4. package/lib/index.js +269 -267
  5. package/package.json +5 -1
  6. package/plugin-src/client/bot-alias.js +92 -0
  7. package/plugin-src/client/channels/dingtalk/api.js +3 -0
  8. package/plugin-src/client/channels/dingtalk/index.js +7 -1
  9. package/plugin-src/client/channels/feishu/api.js +3 -0
  10. package/plugin-src/client/channels/feishu/index.js +7 -1
  11. package/plugin-src/client/channels/qq/api.js +3 -0
  12. package/plugin-src/client/channels/qq/index.js +9 -1
  13. package/plugin-src/client/channels/shared/token-api.js +3 -0
  14. package/plugin-src/client/channels/shared/token-channel.js +9 -2
  15. package/plugin-src/client/channels/wecom/api.js +3 -0
  16. package/plugin-src/client/channels/wecom/index.js +9 -1
  17. package/plugin-src/client/channels/wecom-app/api.js +3 -0
  18. package/plugin-src/client/channels/wecom-app/index.js +9 -1
  19. package/plugin-src/client/channels/weixin/api.js +3 -0
  20. package/plugin-src/client/channels/weixin/index.js +7 -1
  21. package/plugin-src/client/channels/whatsapp/api.js +3 -0
  22. package/plugin-src/client/channels/whatsapp/index.js +9 -1
  23. package/plugin-src/client/i18n.js +10 -0
  24. package/plugin-src/client/styles.js +26 -0
  25. package/plugin-src/host/channels/dingtalk/rpc.mjs +11 -0
  26. package/plugin-src/host/channels/feishu/production.mjs +22 -0
  27. package/plugin-src/host/channels/feishu/rpc.mjs +14 -0
  28. package/plugin-src/host/channels/imessage/rpc.mjs +1 -0
  29. package/plugin-src/host/channels/qq/rpc.mjs +11 -0
  30. package/plugin-src/host/channels/shared/bot-alias-rpc.mjs +15 -0
  31. package/plugin-src/host/channels/shared/rpc.mjs +9 -0
  32. package/plugin-src/host/channels/slack/rpc.mjs +10 -0
  33. package/plugin-src/host/channels/wecom/rpc.mjs +11 -0
  34. package/plugin-src/host/channels/wecom-app/rpc.mjs +10 -0
  35. package/plugin-src/host/channels/weixin/rpc.mjs +11 -0
  36. package/plugin-src/host/channels/whatsapp/rpc.mjs +13 -0
  37. package/plugin-src/host/rpc-authority.mjs +3 -2
  38. package/plugin-src/host/session-sync-coordinator.mjs +19 -1
  39. package/scripts/verify-lan-management.mjs +176 -0
  40. package/src/channels/feishu/bridge.mjs +370 -7
  41. package/src/channels/feishu/feishu-cards.mjs +1 -1
  42. package/src/channels/feishu/feishu-runtime.mjs +6 -0
  43. package/src/channels/feishu/state-store.mjs +17 -0
  44. package/src/channels/shared/bot-alias.mjs +29 -0
  45. package/src/channels/shared/bot-workspace-store.mjs +71 -3
  46. package/src/channels/shared/i18n-en/shared-a.mjs +2 -2
  47. package/src/channels/shared/message-failure.mjs +2 -1
  48. package/src/channels/shared/model-command.mjs +3 -2
  49. package/src/channels/shared/session-sync-registry.mjs +34 -0
  50. package/src/channels/shared/text-harness-bridge.mjs +38 -0
  51. package/src/channels/telegram/telegram-runtime.mjs +77 -25
package/README.en.md CHANGED
@@ -134,6 +134,7 @@ Use the proxy URL required by your network and restart the Host after changing i
134
134
 
135
135
  | Default behavior | Description |
136
136
  | --- | --- |
137
+ | Bot alias | Click the pencil beside a bot name to set an alias. Saving updates the display immediately, without restarting or reconnecting. The original name is retained; choose “Restore original name” or save an empty alias to restore it. Aliases only affect names shown in the local settings page. |
137
138
  | Bot workspace | Each bot stores its workspace independently. New bots start with the Host's current working directory, which can later be changed from the bot card. |
138
139
  | Model | Every bot in each IM channel can choose a model directly below its workspace, or follow the Host default. A change applies only to later new Sessions; send `/new` and then an ordinary message in the current chat to use it. |
139
140
  | Reasoning effort | Explicitly choose an effort supported by the selected model, or follow the model default. Levels, descriptions, and defaults come from DSH. Switching models restores the new model's default effort. Each bot saves its own choice, which applies only to later new Sessions. |
@@ -240,15 +241,19 @@ node bin/dsh-im.mjs install --source .
240
241
 
241
242
  `npm run check` runs unit tests, builds the Host and Client artifacts, and verifies that the published package contains neither credentials nor standalone channel settings-page registrations.
242
243
 
243
- IM management RPCs accept loopback browsers by default. When a Web profile is deliberately served on a trusted LAN, opt the plugin into the Host authorities already trusted by Connection in that profile's `cordis.patch.yml`:
244
+ IM management uses Harness browser authentication and Host/Origin trust checks by default. Once Harness allows and authenticates access from your LAN address, you can view and configure IM bots without any extra dsh-im configuration.
245
+
246
+ To additionally restrict IM management to local access, set the following in the active Web profile's `cordis.patch.yml`:
244
247
 
245
248
  ```yaml
246
249
  - id: xmanrui-dsh-im
247
250
  config:
248
- rpcAuthority: trusted-host
251
+ rpcAuthority: loopback
249
252
  ```
250
253
 
251
- `trusted-host` allows trusted authorities to reach IM management after Harness browser authentication and Host/Origin checks. The default `loopback` policy additionally requires loopback Host and Origin values; update and inbound TTL management always remain loopback-only.
254
+ `rpcAuthority` defaults to `trusted-host`; explicitly selecting `loopback` additionally requires loopback Host and Origin values. Update and inbound TTL management always remain loopback-only.
255
+
256
+ After building the plugin, run `node scripts/verify-lan-management.mjs /path/to/built/deepseek-harness` for the LAN management HTTP integration check. It starts the original DSH CLI with an isolated temporary profile and no bot credentials, checks default access, authentication, Host/Origin checks, and explicit `loopback` restrictions, then stops the server and removes the temporary directory. Requests carry LAN Host/Origin values over loopback TCP; a browser on a second device requires separate verification. The original `0.1.5-alpha.1` CLI rejects `--host 0.0.0.0`, so that browser check needs a Harness environment that supports LAN access.
252
257
 
253
258
  ### Bot chat message language
254
259
 
package/README.md CHANGED
@@ -137,6 +137,7 @@ dsh web
137
137
 
138
138
  | 默认行为 | 说明 |
139
139
  | --- | --- |
140
+ | 机器人别名 | 点击机器人名称旁的铅笔设置别名,保存后立即显示,无需重启或重连。原名称始终保留,可点击“恢复原名称”或清空别名后保存;仅影响本机设置页中的显示名称。 |
140
141
  | 机器人工作区 | 每个机器人独立保存工作区。新机器人默认使用 Host 当时的工作目录;之后可在机器人卡片中修改。 |
141
142
  | 模型 | 每个 IM 渠道的每个机器人都可在工作区下方独立选择模型;未选择时跟随 Host 默认。切换只影响之后新建的会话;当前聊天先发送 `/new`,再发送普通消息才会使用新选择。 |
142
143
  | 思考强度 | 在模型下方显式选择该模型支持的思考强度,或跟随模型默认。档位、说明和默认值来自 DSH;切换模型后恢复新模型默认强度。每个机器人独立保存,只影响之后新建的会话。 |
@@ -243,15 +244,19 @@ node bin/dsh-im.mjs install --source .
243
244
 
244
245
  `npm run check` 运行单元测试、构建 Host/Client 产物,并验证发布包不包含凭据或独立渠道设置页注册。
245
246
 
246
- IM 管理 RPC 默认仅接受回环浏览器。如果 Web profile 在受信任的局域网内对外提供服务,可在该 profile `cordis.patch.yml` 中显式开放给 Connection 已信任的 Host authority:
247
+ IM 管理接口默认沿用 Harness 的浏览器认证和 Host/Origin 信任检查。只要 Harness 已允许并认证当前局域网访问,便可直接查看和配置 IM 机器人,无需额外修改 dsh-im 配置。
248
+
249
+ 如需将 IM 管理额外限制为仅本机访问,可在当前 Web profile 的 `cordis.patch.yml` 中设置:
247
250
 
248
251
  ```yaml
249
252
  - id: xmanrui-dsh-im
250
253
  config:
251
- rpcAuthority: trusted-host
254
+ rpcAuthority: loopback
252
255
  ```
253
256
 
254
- `trusted-host` 允许已通过 Harness 浏览器认证和 Host/Origin 检查的受信任地址访问 IM 管理接口。默认 `loopback` 还要求回环 Host 和 Origin;更新与入站 TTL 管理始终仅允许回环访问。
257
+ `rpcAuthority` 默认为 `trusted-host`;显式设置 `loopback` 会额外要求回环 Host 和 Origin。更新与入站 TTL 管理始终仅允许回环访问。
258
+
259
+ 局域网管理的 HTTP 集成测试可在构建插件后运行 `node scripts/verify-lan-management.mjs /path/to/built/deepseek-harness`。脚本启动原版 DSH CLI,使用独立临时 profile 和空机器人配置,检查默认访问、登录认证、Host/Origin 检查以及显式 `loopback` 策略,结束后停止服务并清理临时目录。测试通过回环 TCP 发送局域网 Host/Origin,不替代跨设备浏览器验收;原版 `0.1.5-alpha.1` CLI 本身拒绝 `--host 0.0.0.0`,跨设备测试需使用支持局域网访问的 Harness 环境。
255
260
 
256
261
  ### 聊天消息语言
257
262