@xmanrui/dsh-im 0.3.0 → 0.5.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 (68) hide show
  1. package/README.md +64 -0
  2. package/assets/logo-icon.png +0 -0
  3. package/assets/logo.png +0 -0
  4. package/lib/client.js +765 -295
  5. package/lib/index.js +112 -110
  6. package/package.json +2 -1
  7. package/plugin-src/client/build.mjs +6 -1
  8. package/plugin-src/client/channels/dingtalk/api.js +2 -0
  9. package/plugin-src/client/channels/dingtalk/index.js +67 -14
  10. package/plugin-src/client/channels/feishu/api.js +2 -0
  11. package/plugin-src/client/channels/feishu/index.js +70 -22
  12. package/plugin-src/client/channels/qq/api.js +2 -0
  13. package/plugin-src/client/channels/qq/index.js +45 -8
  14. package/plugin-src/client/channels/shared/token-api.js +2 -0
  15. package/plugin-src/client/channels/shared/token-channel.js +34 -8
  16. package/plugin-src/client/channels/wecom/api.js +2 -0
  17. package/plugin-src/client/channels/wecom/index.js +45 -8
  18. package/plugin-src/client/channels/weixin/api.js +2 -0
  19. package/plugin-src/client/channels/weixin/index.js +68 -8
  20. package/plugin-src/client/channels/whatsapp/api.js +2 -0
  21. package/plugin-src/client/channels/whatsapp/index.js +27 -5
  22. package/plugin-src/client/i18n.js +15 -1
  23. package/plugin-src/client/index.js +28 -1
  24. package/plugin-src/client/styles.js +32 -9
  25. package/plugin-src/client/workspace-editor.js +96 -0
  26. package/plugin-src/client/workspace-snapshot-fence.js +28 -0
  27. package/plugin-src/host/channels/dingtalk/production.mjs +34 -11
  28. package/plugin-src/host/channels/dingtalk/rpc.mjs +17 -2
  29. package/plugin-src/host/channels/feishu/production.mjs +42 -5
  30. package/plugin-src/host/channels/feishu/rpc.mjs +17 -2
  31. package/plugin-src/host/channels/qq/production.mjs +48 -22
  32. package/plugin-src/host/channels/qq/rpc.mjs +16 -2
  33. package/plugin-src/host/channels/shared/production.mjs +48 -22
  34. package/plugin-src/host/channels/shared/rpc.mjs +15 -0
  35. package/plugin-src/host/channels/shared/workspace-rpc.mjs +25 -0
  36. package/plugin-src/host/channels/slack/production.mjs +48 -23
  37. package/plugin-src/host/channels/slack/rpc.mjs +16 -0
  38. package/plugin-src/host/channels/wecom/production.mjs +49 -23
  39. package/plugin-src/host/channels/wecom/rpc.mjs +16 -2
  40. package/plugin-src/host/channels/weixin/production.mjs +31 -11
  41. package/plugin-src/host/channels/weixin/rpc.mjs +21 -2
  42. package/plugin-src/host/channels/whatsapp/production.mjs +49 -23
  43. package/plugin-src/host/channels/whatsapp/rpc.mjs +16 -2
  44. package/src/channels/dingtalk/dingtalk-bridge.mjs +22 -11
  45. package/src/channels/dingtalk/dingtalk-controller.mjs +6 -1
  46. package/src/channels/dingtalk/harness-client.mjs +4 -3
  47. package/src/channels/dingtalk/state-store.mjs +5 -0
  48. package/src/channels/discord/discord-api.mjs +1 -1
  49. package/src/channels/feishu/bridge.mjs +36 -16
  50. package/src/channels/feishu/harness-client.mjs +6 -5
  51. package/src/channels/feishu/state-store.mjs +5 -0
  52. package/src/channels/qq/qq-bridge.mjs +25 -15
  53. package/src/channels/qq/qq-controller.mjs +8 -1
  54. package/src/channels/qq/state-store.mjs +5 -0
  55. package/src/channels/shared/bot-workspace-store.mjs +584 -0
  56. package/src/channels/shared/conversation-state-store.mjs +5 -0
  57. package/src/channels/shared/text-harness-bridge.mjs +23 -13
  58. package/src/channels/shared/workspace-command.mjs +26 -0
  59. package/src/channels/shared/workspace-session.mjs +44 -0
  60. package/src/channels/wecom/state-store.mjs +5 -0
  61. package/src/channels/wecom/wecom-bridge.mjs +22 -13
  62. package/src/channels/wecom/wecom-controller.mjs +8 -1
  63. package/src/channels/weixin/harness-client.mjs +6 -5
  64. package/src/channels/weixin/state-store.mjs +5 -0
  65. package/src/channels/weixin/weixin-api.mjs +1 -1
  66. package/src/channels/weixin/weixin-bridge.mjs +16 -6
  67. package/src/channels/weixin/weixin-controller.mjs +6 -1
  68. package/src/channels/whatsapp/whatsapp-controller.mjs +8 -1
package/README.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # dsh-im
2
2
 
3
+ <p align="center">
4
+ <img src="assets/logo.png" alt="dsh-im logo" width="160">
5
+ </p>
6
+
7
+ <p align="center"><strong>让聊天机器人轻松接入 DeepSeek Harness</strong></p>
8
+ <p align="center"><strong>Connect IM bots to DeepSeek Harness with ease</strong></p>
9
+
3
10
  ## 中文
4
11
 
5
12
  通过扫码、App Manifest 或已有机器人凭据把 IM 机器人接入 DeepSeek Harness。一个插件、一个设置入口,统一管理飞书、微信、钉钉、企业微信、QQ、Slack、Telegram、Discord 和 WhatsApp 机器人。
@@ -56,6 +63,21 @@ QQ 扫码接入使用腾讯 QQBot v2 官方流程。默认腾讯授权页会把
56
63
 
57
64
  飞书扫码绑定会把扫码者作为允许使用者;手动凭据同样无法识别扫码人,因此使用飞书应用的可见范围作为入站访问范围。请在飞书开放平台中只向信任的租户、群或成员开放应用。
58
65
 
66
+ 每个机器人维护独立的 Harness 工作区。新接入机器人会把 Harness Host 进程当时的工作目录(`process.cwd()`)记录为默认值;该路径会持久化,不会因为以后从其他目录重启 Host 而改变。设置页的机器人卡片会显示当前路径,并可直接修改。
67
+
68
+ ## 机器人命令
69
+
70
+ | 命令 | 作用 |
71
+ | --- | --- |
72
+ | `/workspace <工作区绝对路径>` | 切换当前机器人的 Harness 工作区。 |
73
+
74
+ 示例:`/workspace /Users/alice/projects/my-app`
75
+
76
+ - 只接受已经存在的绝对目录;路径无效时机器人会返回具体提示和正确用法。
77
+ - 任何已在对应平台可见范围内、能够正常向机器人发消息的用户都可以执行,不区分管理员和普通用户。
78
+ - 切换成功后只清除当前机器人的旧 Harness 会话映射,不影响其他机器人。
79
+ - 新工作区对后续消息生效;已经开始生成的回复会继续完成。
80
+
59
81
  ## 设计
60
82
 
61
83
  - Harness 中只注册一个「IM机器人」设置页;
@@ -143,6 +165,21 @@ QQ QR binding uses Tencent's official QQBot v2 flow. Tencent's default authoriza
143
165
 
144
166
  Feishu QR binding records the scanner as an allowed user. Manual credentials cannot identify a scanner, so the Feishu application's visibility becomes its inbound access scope. Restrict the application to trusted tenants, groups, or members.
145
167
 
168
+ Each bot maintains an independent Harness workspace. A newly connected bot records the Harness Host process's current working directory (`process.cwd()`) as its default; the path is persisted and does not change when the Host is later restarted from another directory. Every bot card shows the current path and lets it be edited.
169
+
170
+ ## Bot commands
171
+
172
+ | Command | Description |
173
+ | --- | --- |
174
+ | `/workspace <absolute workspace path>` | Switch the current bot's Harness workspace. |
175
+
176
+ Example: `/workspace /Users/alice/projects/my-app`
177
+
178
+ - The path must be an existing absolute directory. The bot returns an actionable error and the correct usage when validation fails.
179
+ - Any user who is already within the platform bot's visibility scope and can normally message it can run the command; there is no additional administrator/ordinary-user distinction.
180
+ - A successful switch clears only the current bot's old Harness session mappings and does not affect other bots.
181
+ - The new workspace applies to subsequent messages; a reply that has already started generating is allowed to finish.
182
+
146
183
  ## Design
147
184
 
148
185
  - Registers a single **IM Bot** settings page in Harness.
@@ -171,3 +208,30 @@ IM management RPCs accept loopback browsers by default. When a Web profile is de
171
208
  ```
172
209
 
173
210
  `trusted-host` reuses Harness's Host/Origin fence; it is not user authentication. Anyone who can reach that LAN authority can inspect bot status, scan or submit application credentials, reconnect bots, and remove bots. Enable it only on a trusted network.
211
+
212
+ ---
213
+
214
+ ## 联系方式 / Contact
215
+
216
+ 欢迎通过邮箱、微信或小红书联系我。
217
+
218
+ You can reach me by email, WeChat, or Xiaohongshu.
219
+
220
+ <table>
221
+ <tr>
222
+ <th align="center">邮箱 / Email</th>
223
+ <th align="center">微信 / WeChat</th>
224
+ <th align="center">小红书 / Xiaohongshu</th>
225
+ </tr>
226
+ <tr>
227
+ <td align="center" valign="middle">
228
+ <a href="mailto:longmanr307@gmail.com">longmanr307@gmail.com</a>
229
+ </td>
230
+ <td align="center" valign="top">
231
+ <a href="docs/images/weixin.jpg"><img src="docs/images/weixin.jpg" alt="微信二维码 / WeChat QR code" width="240"></a>
232
+ </td>
233
+ <td align="center" valign="top">
234
+ <a href="docs/images/xhs.jpg"><img src="docs/images/xhs.jpg" alt="小红书二维码 / Xiaohongshu QR code" width="240"></a>
235
+ </td>
236
+ </tr>
237
+ </table>
Binary file
Binary file