@xmanrui/dsh-im 1.0.1 → 1.1.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 (52) hide show
  1. package/README.en.md +20 -0
  2. package/README.md +20 -0
  3. package/THIRD_PARTY_NOTICES.md +1 -1
  4. package/assets/logo-dsh-im-chinese-readme-3x2.png +0 -0
  5. package/assets/logo_cn.png +0 -0
  6. package/lib/client.js +603 -560
  7. package/lib/index.js +163 -163
  8. package/package.json +2 -1
  9. package/plugin-src/client/agent-preset.js +15 -6
  10. package/plugin-src/client/channel-card-meta.js +48 -0
  11. package/plugin-src/client/channels/dingtalk/index.js +25 -19
  12. package/plugin-src/client/channels/dingtalk/styles.js +0 -6
  13. package/plugin-src/client/channels/feishu/index.js +41 -35
  14. package/plugin-src/client/channels/feishu/styles.js +0 -5
  15. package/plugin-src/client/channels/qq/index.js +24 -16
  16. package/plugin-src/client/channels/shared/token-channel.js +32 -24
  17. package/plugin-src/client/channels/wecom/index.js +24 -16
  18. package/plugin-src/client/channels/weixin/index.js +29 -23
  19. package/plugin-src/client/channels/weixin/styles.js +0 -5
  20. package/plugin-src/client/channels/whatsapp/index.js +27 -23
  21. package/plugin-src/client/i18n.js +2 -0
  22. package/plugin-src/client/styles.js +23 -8
  23. package/plugin-src/host/channels/feishu/production.mjs +26 -1
  24. package/plugin-src/host/index.mjs +14 -1
  25. package/scripts/verify-package.mjs +3 -2
  26. package/src/channels/dingtalk/dingtalk-api.mjs +215 -2
  27. package/src/channels/dingtalk/dingtalk-bridge.mjs +155 -4
  28. package/src/channels/discord/discord-api.mjs +134 -6
  29. package/src/channels/discord/discord-runtime.mjs +15 -4
  30. package/src/channels/feishu/bridge.mjs +223 -15
  31. package/src/channels/feishu/feishu-app.mjs +18 -15
  32. package/src/channels/feishu/feishu-channel.mjs +227 -1
  33. package/src/channels/feishu/feishu-runtime.mjs +4 -0
  34. package/src/channels/feishu/plugin-controller.mjs +1 -0
  35. package/src/channels/qq/qq-bridge.mjs +217 -10
  36. package/src/channels/shared/editable-message-stream.mjs +18 -1
  37. package/src/channels/shared/harness-client.mjs +99 -7
  38. package/src/channels/shared/semantic/artifact.mjs +748 -0
  39. package/src/channels/shared/semantic/delivery.mjs +153 -0
  40. package/src/channels/shared/text-harness-bridge.mjs +149 -3
  41. package/src/channels/shared/workspace-session.mjs +15 -1
  42. package/src/channels/slack/manifest.mjs +1 -0
  43. package/src/channels/slack/slack-api.mjs +167 -4
  44. package/src/channels/slack/slack-runtime.mjs +21 -5
  45. package/src/channels/telegram/telegram-api.mjs +111 -5
  46. package/src/channels/telegram/telegram-runtime.mjs +18 -4
  47. package/src/channels/wecom/wecom-bridge.mjs +260 -12
  48. package/src/channels/weixin/weixin-api.mjs +268 -2
  49. package/src/channels/weixin/weixin-bridge.mjs +134 -3
  50. package/src/channels/weixin/weixin-controller.mjs +5 -1
  51. package/src/channels/weixin/weixin-runtime.mjs +5 -1
  52. package/src/channels/whatsapp/whatsapp-runtime.mjs +108 -5
package/README.en.md CHANGED
@@ -59,6 +59,24 @@ Other IM platforms can be added through the same channel-adapter structure.
59
59
 
60
60
  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.
61
61
 
62
+ ### Result-file delivery
63
+
64
+ All nine built-in channels can return any file readable by Harness as a native channel attachment. Existing files and files created by the current task can both be sent directly. The capability is available to every connected bot by default, with no switch or per-bot allowlist, while existing text, image, streaming, command, and Session behavior remains unchanged.
65
+
66
+ After the model calls the file-return tool, the plugin hands the specified file to the channel's native attachment API. The plugin adds no rules for file origin, creation time, workspace boundary, extension, content, count, size, or lifetime; the file only needs to exist and be readable. A channel may still reject delivery according to its own permissions, quota, file capability, or account tier, and the plugin reports that provider result.
67
+
68
+ | Channel | Platform requirements |
69
+ | --- | --- |
70
+ | WeChat | The current binding protocol and conversation must support native file messages; the WeChat API response determines the actual range. |
71
+ | Feishu | Feishu's file-upload API requires a non-empty file no larger than the platform's 30 MB limit. The app needs the `im:resource` tenant scope (**Read and upload images or other files**). Apps created through the built-in QR flow request it by default; existing or manually connected apps still need it added and approved. The Feishu developer console currently has no separate `im:resource:upload` scope. |
72
+ | 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. |
73
+ | WeCom | The app needs media-upload and file-message capability; the WeCom API response determines the actual range. |
74
+ | QQ | The bot needs file-message capability and remains subject to QQ's daily upload quota; the bot reports when the quota is exhausted. |
75
+ | 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
+ | Telegram | The bot must be allowed to send documents in the current chat; the Bot API response determines the actual range. |
77
+ | Discord | The bot needs **Send Messages**, **Attach Files**, and **Read Message History**. The current account and server capability determine the actual attachment allowance. |
78
+ | WhatsApp | The linked session must support Document Messages; the WhatsApp/Baileys response determines the actual range. |
79
+
62
80
  ## AI Office Connector
63
81
 
64
82
  The **AI Office** page lets the local Harness connect outward to a public Office. The machine needs no public IP, forwarded port, or WebSocket server. The Device Token is written only to the Harness credential provider; the ordinary config file contains only the device ID, Office origin, workspace aliases, and instruction-preset aliases. Office selects aliases and never receives local absolute paths.
@@ -89,6 +107,8 @@ A GitHub-source installation fetches and builds a Git dependency directly. With
89
107
 
90
108
  After installation, follow the built-in instructions on each channel page to scan a QR code or enter credentials. Secrets and Tokens are sent only to the local Harness Host and stored through its protected credential provider; status responses and bot lists never return them.
91
109
 
110
+ If this machine must use a forward proxy to reach Feishu, set `HTTPS_PROXY` to a full HTTP proxy URL before starting `dsh web` (for example, `http://proxy:8080`; lowercase `https_proxy` is also supported, with `HTTP_PROXY` accepted as a fallback), then restart the Host after changing it. Feishu registration and credential verification reuse the SDK's proxy-aware HTTP client, while the message WebSocket explicitly uses that proxy; the WebSocket path does not currently read `ALL_PROXY` or `NO_PROXY`.
111
+
92
112
  | Default behavior | Description |
93
113
  | --- | --- |
94
114
  | 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. |
package/README.md CHANGED
@@ -62,6 +62,24 @@ Connect IM bots to DeepSeek Harness by scanning a QR code, using an App Manifest
62
62
 
63
63
  九个内置渠道均支持把 JPEG、PNG、WebP 图片,以及以图片文件方式发送的 GIF,连同可选文字说明发送给 Harness;单张图片上限为 5 MB,单条消息中的图片总大小上限为 20 MB。
64
64
 
65
+ ### 结果文件回传
66
+
67
+ 九个内置渠道均已实现把 Harness 可读取的文件作为渠道原生附件回传。已有文件和当前任务新生成的文件都可以直接发送;该能力对所有已连接机器人默认可用,无需开关或机器人白名单,原有文字、图片、流式回复、命令和会话行为保持不变。
68
+
69
+ 模型调用文件回传工具后,插件把指定文件交给当前渠道的原生附件接口。插件不额外设置文件来源、创建时间、工作区边界、扩展名、内容、数量、大小或有效期规则;文件只需真实存在且可读取。渠道平台仍可能依据自身权限、配额、文件能力或账号等级拒绝发送,插件会按平台返回结果提示。
70
+
71
+ | 渠道 | 平台要求 |
72
+ | --- | --- |
73
+ | 微信 | 当前绑定协议和会话需支持原生文件消息,实际可发送范围以微信接口返回为准。 |
74
+ | 飞书 | 飞书文件上传接口要求文件非空且不超过平台 30 MB;应用需有租户权限 `im:resource`(“读取与上传图片或文件资源”)。内置扫码流程新建应用时默认申请该权限;已有或手动绑定的应用仍需在开发者后台添加并完成必要审批。飞书开发者后台当前没有单独的 `im:resource:upload` 权限。 |
75
+ | 钉钉 | 应用需开通 `qyapi_base`,机器人需具备文件消息能力;实际格式和大小以当前 OAPI 与机器人能力返回为准。 |
76
+ | 企业微信 | 应用需具备素材上传和文件消息能力,实际可发送范围以企业微信接口返回为准。 |
77
+ | QQ | 机器人需具备文件消息能力,并受 QQ 当日文件上传配额约束;额度耗尽时会明确提示稍后重试。 |
78
+ | Slack | Bot Token 需有 `files:write`;实际大小上限由 Workspace 当前策略决定。已有 App 新增或变更 Scope 后,必须重新授权/安装 App 并重新连接机器人。 |
79
+ | Telegram | 机器人必须能在当前聊天发送文档,实际可发送范围以 Bot API 返回为准。 |
80
+ | Discord | 机器人需有 **Send Messages**、**Attach Files** 和 **Read Message History** 权限;实际附件额度由当前账号与服务器能力决定。 |
81
+ | WhatsApp | 当前绑定会话需支持 Document Message,实际可发送范围以 WhatsApp/Baileys 返回为准。 |
82
+
65
83
  ## AI Office Connector
66
84
 
67
85
  「AI Office」页让本机 Harness 主动连接公网 Office,本机无需公网 IP、端口转发或 WebSocket 服务。Device Token 只写入 Harness 凭据存储;普通配置文件仅保存设备 ID、Office Origin、工作区 alias 和 Instruction Preset alias。Office 只能选择 alias,不会收到本机绝对路径。
@@ -92,6 +110,8 @@ GitHub 源安装会直接拉取并构建 Git 依赖;pnpm 10 及以上版本可
92
110
 
93
111
  安装后,在对应渠道页面按照内置引导完成扫码或凭据配置。所有 Secret 和 Token 只提交给本机 Harness Host,并写入受保护的凭据存储;状态接口和机器人列表不会回传这些凭据。
94
112
 
113
+ 如果本机必须通过正向代理访问飞书,请在启动 `dsh web` 前把 `HTTPS_PROXY` 设置为包含协议的 HTTP 代理 URL(例如 `http://proxy:8080`;也支持小写 `https_proxy`,并兼容使用 `HTTP_PROXY` 作为回退),修改后重启 Host。飞书注册和凭据验证会复用 SDK 的代理感知 HTTP 客户端,消息长连接会显式通过这个代理建立 WebSocket;长连接目前不读取 `ALL_PROXY` 或 `NO_PROXY`。
114
+
95
115
  | 默认行为 | 说明 |
96
116
  | --- | --- |
97
117
  | 机器人工作区 | 每个机器人独立保存工作区。新机器人默认使用 Host 当时的工作目录;之后可在机器人卡片中修改。 |
@@ -6,7 +6,7 @@ The DingTalk device-authorization request sequence and AI Card streaming protoco
6
6
 
7
7
  The WeCom QR-authorization request sequence is adapted from the official [`@wecom/wecom-openclaw-cli`](https://www.npmjs.com/package/@wecom/wecom-openclaw-cli) 1.1.0 package, whose npm metadata declares the ISC License. No CLI source or OpenClaw runtime is bundled in this package.
8
8
 
9
- The Host bundle includes [`@larksuiteoapi/node-sdk`](https://github.com/larksuite/node-sdk) 1.73.0, [`@whiskeysockets/baileys`](https://github.com/WhiskeySockets/Baileys) 7.0.0-rc14, and their [`protobufjs`](https://github.com/protobufjs/protobuf.js) 7.6.5 runtime. The Lark SDK and Baileys are licensed under the MIT License. protobufjs is licensed under the BSD 3-Clause License; both license texts are reproduced below.
9
+ The Host bundle includes [`@larksuiteoapi/node-sdk`](https://github.com/larksuite/node-sdk) 1.73.0, [`@whiskeysockets/baileys`](https://github.com/WhiskeySockets/Baileys) 7.0.0-rc14, [`https-proxy-agent`](https://github.com/TooTallNate/proxy-agents) 5.0.1, and their [`protobufjs`](https://github.com/protobufjs/protobuf.js) 7.6.5 runtime. The Lark SDK, Baileys, and https-proxy-agent are licensed under the MIT License. protobufjs is licensed under the BSD 3-Clause License; both license texts are reproduced below.
10
10
 
11
11
  This package depends at runtime on [`dingtalk-stream`](https://github.com/open-dingtalk/dingtalk-stream-sdk-nodejs) 2.1.4, [`@wecom/aibot-node-sdk`](https://github.com/WecomTeam/aibot-node-sdk) 1.0.7, [`@tencent-connect/qqbot-nodejs`](https://github.com/tencent-connect/qqbot) 1.0.4, and [`qrcode`](https://github.com/soldair/node-qrcode) 1.5.4. These packages are licensed under the MIT License; `dingtalk-stream` is copyright 2023 钉钉开放平台团队.
12
12
 
Binary file