@xmanrui/dsh-im 2.5.0 → 3.0.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.en.md +4 -4
- package/README.md +4 -4
- package/bin/dsh-im.mjs +1 -1
- package/lib/client.js +1410 -1409
- package/lib/index.js +206 -206
- package/package.json +2 -2
- package/plugin-src/client/channels/dingtalk/index.js +0 -17
- package/plugin-src/client/channels/dingtalk/styles.js +2 -2
- package/plugin-src/client/channels/feishu/index.js +0 -29
- package/plugin-src/client/channels/feishu/styles.js +2 -2
- package/plugin-src/client/channels/qq/index.js +0 -9
- package/plugin-src/client/channels/wecom/index.js +0 -9
- package/plugin-src/client/channels/weixin/index.js +0 -19
- package/plugin-src/client/channels/weixin/styles.js +2 -2
- package/plugin-src/client/index.js +4 -4
- package/scripts/verify-package.mjs +48 -11
- package/src/channels/dingtalk/dingtalk-api.mjs +101 -5
- package/src/channels/dingtalk/dingtalk-bridge.mjs +198 -22
- package/src/channels/discord/discord-api.mjs +35 -0
- package/src/channels/discord/discord-bridge.mjs +1 -0
- package/src/channels/discord/discord-runtime.mjs +26 -0
- package/src/channels/feishu/bridge.mjs +21 -28
- package/src/channels/feishu/message-utils.mjs +1 -1
- package/src/channels/shared/connection-test.mjs +1 -1
- package/src/channels/shared/i18n-en/feishu.mjs +6 -6
- package/src/channels/shared/i18n-en/shared-c.mjs +2 -2
- package/src/channels/shared/status-reaction.mjs +107 -0
- package/src/channels/shared/text-harness-bridge.mjs +58 -6
- package/src/channels/slack/manifest.mjs +1 -0
- package/src/channels/slack/slack-api.mjs +28 -0
- package/src/channels/slack/slack-bridge.mjs +5 -0
- package/src/channels/slack/slack-runtime.mjs +24 -0
- package/src/channels/telegram/telegram-api.mjs +9 -0
- package/src/channels/telegram/telegram-bridge.mjs +1 -0
- package/src/channels/telegram/telegram-runtime.mjs +20 -0
- package/src/channels/whatsapp/whatsapp-bridge.mjs +1 -0
- package/src/channels/whatsapp/whatsapp-runtime.mjs +36 -0
package/README.en.md
CHANGED
|
@@ -58,7 +58,7 @@ Connect IM bots to DeepSeek Harness by scanning a QR code, using an App Manifest
|
|
|
58
58
|
|
|
59
59
|
Other IM platforms can be added through the same channel-adapter structure.
|
|
60
60
|
|
|
61
|
-
All nine built-in channels can send JPEG, PNG, and WebP images, plus GIFs sent as image files, with optional captions to Harness. Each image is limited to 5 MB, and images in one message are limited to 20 MB in total. Downloading images or files from Feishu user messages requires the `im:message:readonly` tenant scope, shown on the confirmation page as **Read direct and group messages**; Feishu currently offers no narrower image-only scope for that download endpoint. Apps created through the built-in QR flow request it by default; for existing or manually connected apps, click **Complete permissions**
|
|
61
|
+
All nine built-in channels can send JPEG, PNG, and WebP images, plus GIFs sent as image files, with optional captions to Harness. Each image is limited to 5 MB, and images in one message are limited to 20 MB in total. Downloading images or files from Feishu user messages requires the `im:message:readonly` tenant scope, shown on the confirmation page as **Read direct and group messages**; Feishu currently offers no narrower image-only scope for that download endpoint. Apps created through the built-in QR flow request it by default; for existing or manually connected apps, click **Complete permissions** on the IM Bot settings page and scan the QR code to incrementally add that scope, `im:resource` for uploading bot-sent images or files, and the card callback.
|
|
62
62
|
|
|
63
63
|
### Result-file and image delivery
|
|
64
64
|
|
|
@@ -73,7 +73,7 @@ After the model calls the file-return tool, the plugin hands the specified file
|
|
|
73
73
|
| DingTalk | The app needs `qyapi_base`, and the bot must support file messages. The current OAPI and bot capability determine the accepted formats and sizes. |
|
|
74
74
|
| WeCom | The app needs media-upload and file-message capability; the WeCom API response determines the actual range. |
|
|
75
75
|
| QQ | The bot needs file-message capability and remains subject to QQ's daily upload quota; the bot reports when the quota is exhausted. |
|
|
76
|
-
| Slack | The Bot Token needs `files:write`; the Workspace's current policy determines the actual size limit. After changing scopes, re-authorize/reinstall the App and reconnect the bot. |
|
|
76
|
+
| Slack | The Bot Token needs `files:read`, `files:write`, and `reactions:write`; the Workspace's current policy determines the actual file-size limit. After changing scopes, re-authorize/reinstall the App and reconnect the bot. |
|
|
77
77
|
| Telegram | The bot must be allowed to send documents in the current chat; the Bot API response determines the actual range. |
|
|
78
78
|
| Discord | Enable **Message Content Intent** in the Developer Portal. The bot needs **Send Messages**, **Create Public Threads**, **Send Messages in Threads**, and **Read Message History**; result-file delivery also requires **Attach Files**. The current account and server capability determine the actual attachment allowance. |
|
|
79
79
|
| WhatsApp | The linked session must support Document Messages; the WhatsApp/Baileys response determines the actual range. |
|
|
@@ -96,7 +96,7 @@ Install the published stable release from npm (recommended):
|
|
|
96
96
|
dsh plugin --profile web add -w @xmanrui/dsh-im
|
|
97
97
|
```
|
|
98
98
|
|
|
99
|
-
Restart `dsh web`, then open **Settings →
|
|
99
|
+
Restart `dsh web`, refresh the browser, then open **Settings → IM Bot**. The top-level IM Bot entry uses `order: 21` to follow **Agent Presets**, and the Plugins page no longer retains the old entry. Upgrading preserves existing bots, credentials, workspaces, Agent Presets, and Session bindings.
|
|
100
100
|
|
|
101
101
|
To try the latest code before it is published to npm, use the GitHub-source installer instead:
|
|
102
102
|
|
|
@@ -214,7 +214,7 @@ If the Slack desktop app has no native Slash Command registered with the same na
|
|
|
214
214
|
|
|
215
215
|
## Design
|
|
216
216
|
|
|
217
|
-
- Registers one **IM Bot** settings page containing nine IM channels and one AI Office Connector.
|
|
217
|
+
- Registers one top-level **IM Bot** settings page containing nine IM channels and one AI Office Connector.
|
|
218
218
|
- Maintains the Host, client, and runtime sources for all nine channels and the Office Connector in this repository without external standalone plugins.
|
|
219
219
|
- Follows the DeepSeek Harness language preference and switches the settings UI live between Chinese and English. Bot chat messages follow the Host's `language` config (Chinese by default; `en` switches them to English), with Chinese always as the fallback so untranslated text is sent verbatim.
|
|
220
220
|
- Uses logos for WeChat, Feishu, DingTalk, WeCom, QQ, Slack, Telegram, Discord, WhatsApp, and AI Office navigation without enable/disable switches.
|
package/README.md
CHANGED
|
@@ -61,7 +61,7 @@ Connect IM bots to DeepSeek Harness by scanning a QR code, using an App Manifest
|
|
|
61
61
|
|
|
62
62
|
其他 IM 平台可继续按同一渠道适配器结构接入。
|
|
63
63
|
|
|
64
|
-
九个内置渠道均支持把 JPEG、PNG、WebP 图片,以及以图片文件方式发送的 GIF,连同可选文字说明发送给 Harness;单张图片上限为 5 MB,单条消息中的图片总大小上限为 20 MB。飞书下载用户消息中的图片或文件需要租户权限 `im:message:readonly`,确认页将其显示为“获取单聊、群组消息”;飞书目前没有为该下载接口提供仅限图片的更窄权限。扫码新建的应用会默认申请;已有或手动绑定的应用可私聊机器人执行 `/repair
|
|
64
|
+
九个内置渠道均支持把 JPEG、PNG、WebP 图片,以及以图片文件方式发送的 GIF,连同可选文字说明发送给 Harness;单张图片上限为 5 MB,单条消息中的图片总大小上限为 20 MB。飞书下载用户消息中的图片或文件需要租户权限 `im:message:readonly`,确认页将其显示为“获取单聊、群组消息”;飞书目前没有为该下载接口提供仅限图片的更窄权限。扫码新建的应用会默认申请;已有或手动绑定的应用可私聊机器人执行 `/repair`,或在「IM机器人」设置页点击“补全权限”,扫码增量补全该权限、上传机器人图片或文件所需的 `im:resource`,以及卡片回调。
|
|
65
65
|
|
|
66
66
|
### 结果文件与图片回传
|
|
67
67
|
|
|
@@ -76,7 +76,7 @@ Connect IM bots to DeepSeek Harness by scanning a QR code, using an App Manifest
|
|
|
76
76
|
| 钉钉 | 应用需开通 `qyapi_base`,机器人需具备文件消息能力;实际格式和大小以当前 OAPI 与机器人能力返回为准。 |
|
|
77
77
|
| 企业微信 | 应用需具备素材上传和文件消息能力,实际可发送范围以企业微信接口返回为准。 |
|
|
78
78
|
| QQ | 机器人需具备文件消息能力,并受 QQ 当日文件上传配额约束;额度耗尽时会明确提示稍后重试。 |
|
|
79
|
-
| Slack | Bot Token 需有 `files:write
|
|
79
|
+
| Slack | Bot Token 需有 `files:read`、`files:write` 和 `reactions:write`;实际文件大小上限由 Workspace 当前策略决定。已有 App 新增或变更 Scope 后,必须重新授权/安装 App 并重新连接机器人。 |
|
|
80
80
|
| Telegram | 机器人必须能在当前聊天发送文档,实际可发送范围以 Bot API 返回为准。 |
|
|
81
81
|
| Discord | Developer Portal 的 Bot 设置中需启用 **Message Content Intent**;机器人需有 **Send Messages**、**Create Public Threads**、**Send Messages in Threads** 和 **Read Message History** 权限;发送结果文件还需 **Attach Files**。实际附件额度由当前账号与服务器能力决定。 |
|
|
82
82
|
| WhatsApp | 当前绑定会话需支持 Document Message,实际可发送范围以 WhatsApp/Baileys 返回为准。 |
|
|
@@ -99,7 +99,7 @@ Heartbeat 成功响应必须是 JSON:`{"ok":true,"protocolVersion":"office-har
|
|
|
99
99
|
dsh plugin --profile web add -w @xmanrui/dsh-im
|
|
100
100
|
```
|
|
101
101
|
|
|
102
|
-
重启 `dsh web
|
|
102
|
+
重启 `dsh web`、刷新浏览器,然后打开「设置 → IM机器人」。IM机器人使用 `order: 21`,尽量排在一级设置菜单的「Agent 预设」之后;插件页面不再保留旧入口。从旧版升级不会改变已有机器人、凭据、工作区、Agent Preset 或会话绑定。
|
|
103
103
|
|
|
104
104
|
如需试用尚未发布到 npm 的最新代码,可以改用 GitHub 源安装器:
|
|
105
105
|
|
|
@@ -217,7 +217,7 @@ Slack 桌面端若未注册同名的原生 Slash Command,会拦截直接以 `/
|
|
|
217
217
|
|
|
218
218
|
## 设计
|
|
219
219
|
|
|
220
|
-
- Harness
|
|
220
|
+
- Harness 一级设置菜单中只注册一个「IM机器人」设置页,其中包含九个 IM 渠道和一个 AI Office Connector;
|
|
221
221
|
- 九个渠道及 Office Connector 的 Host、客户端与运行时源码都在本仓库维护,不依赖外部独立插件;
|
|
222
222
|
- 设置页跟随 DeepSeek Harness 的语言选择,在中文和 English 之间即时切换;机器人发出的聊天消息跟随 Host 的 `language` 配置(默认中文;设为 `en` 即为英文),中文始终为兜底,未收录的文案原样输出;
|
|
223
223
|
- 左侧使用 Logo 切换微信、飞书、钉钉、企业微信、QQ、Slack、Telegram、Discord、WhatsApp 和 AI Office,不使用启用/停用开关;
|
package/bin/dsh-im.mjs
CHANGED
|
@@ -82,7 +82,7 @@ try {
|
|
|
82
82
|
for (const packageName of legacy) {
|
|
83
83
|
runDsh(['plugin', '--profile', profile, 'remove', packageName]);
|
|
84
84
|
}
|
|
85
|
-
console.log('\nIM 机器人插件已安装。请重启 dsh web
|
|
85
|
+
console.log('\nIM 机器人插件已安装。请重启 dsh web、刷新浏览器,然后打开「设置 → IM机器人」。');
|
|
86
86
|
if (legacy.size > 0) {
|
|
87
87
|
console.log('已用 dsh-im 替换独立飞书/微信/钉钉插件;原有凭据和扫码绑定保持不变。');
|
|
88
88
|
}
|