@michengai/dsh-im-connect 0.1.58 → 0.1.60

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 (90) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/CHANGELOG.zh-CN.md +24 -0
  3. package/README.md +21 -18
  4. package/README.zh-CN.md +21 -18
  5. package/SECURITY.md +3 -3
  6. package/client.js +61 -20
  7. package/lib/channels/dingtalk-card.d.ts +3 -1
  8. package/lib/channels/dingtalk-card.d.ts.map +1 -1
  9. package/lib/channels/dingtalk-card.js +5 -3
  10. package/lib/channels/dingtalk-card.js.map +1 -1
  11. package/lib/channels/dingtalk.js +1 -1
  12. package/lib/channels/dingtalk.js.map +1 -1
  13. package/lib/channels/discord.d.ts +83 -0
  14. package/lib/channels/discord.d.ts.map +1 -0
  15. package/lib/channels/discord.js +906 -0
  16. package/lib/channels/discord.js.map +1 -0
  17. package/lib/channels/factory.d.ts.map +1 -1
  18. package/lib/channels/factory.js +4 -0
  19. package/lib/channels/factory.js.map +1 -1
  20. package/lib/channels/feishu.d.ts +4 -0
  21. package/lib/channels/feishu.d.ts.map +1 -1
  22. package/lib/channels/feishu.js +46 -6
  23. package/lib/channels/feishu.js.map +1 -1
  24. package/lib/channels/meta.d.ts.map +1 -1
  25. package/lib/channels/meta.js +10 -0
  26. package/lib/channels/meta.js.map +1 -1
  27. package/lib/channels/qq-markdown.d.ts +29 -0
  28. package/lib/channels/qq-markdown.d.ts.map +1 -0
  29. package/lib/channels/qq-markdown.js +126 -0
  30. package/lib/channels/qq-markdown.js.map +1 -0
  31. package/lib/channels/qq.d.ts.map +1 -1
  32. package/lib/channels/qq.js +61 -18
  33. package/lib/channels/qq.js.map +1 -1
  34. package/lib/channels/telegram.d.ts +12 -0
  35. package/lib/channels/telegram.d.ts.map +1 -1
  36. package/lib/channels/telegram.js +84 -3
  37. package/lib/channels/telegram.js.map +1 -1
  38. package/lib/channels/weixin.d.ts.map +1 -1
  39. package/lib/channels/weixin.js +5 -2
  40. package/lib/channels/weixin.js.map +1 -1
  41. package/lib/client.js +61 -20
  42. package/lib/engine/agent-options.d.ts +0 -1
  43. package/lib/engine/agent-options.d.ts.map +1 -1
  44. package/lib/engine/agent-options.js +2 -1
  45. package/lib/engine/agent-options.js.map +1 -1
  46. package/lib/engine/chat-commands.d.ts +2 -0
  47. package/lib/engine/chat-commands.d.ts.map +1 -1
  48. package/lib/engine/chat-commands.js +83 -49
  49. package/lib/engine/chat-commands.js.map +1 -1
  50. package/lib/engine/command-messages.d.ts +50 -22
  51. package/lib/engine/command-messages.d.ts.map +1 -1
  52. package/lib/engine/command-messages.js +50 -22
  53. package/lib/engine/command-messages.js.map +1 -1
  54. package/lib/engine/command-replies.d.ts.map +1 -1
  55. package/lib/engine/command-replies.js +6 -7
  56. package/lib/engine/command-replies.js.map +1 -1
  57. package/lib/engine/gateway.d.ts +4 -0
  58. package/lib/engine/gateway.d.ts.map +1 -1
  59. package/lib/engine/gateway.js +95 -98
  60. package/lib/engine/gateway.js.map +1 -1
  61. package/lib/engine/router.d.ts.map +1 -1
  62. package/lib/engine/router.js +10 -9
  63. package/lib/engine/router.js.map +1 -1
  64. package/lib/engine/session-id.d.ts +1 -1
  65. package/lib/engine/session-id.d.ts.map +1 -1
  66. package/lib/engine/session-id.js +1 -1
  67. package/lib/engine/session-id.js.map +1 -1
  68. package/lib/engine/split.d.ts +10 -0
  69. package/lib/engine/split.d.ts.map +1 -1
  70. package/lib/engine/split.js +263 -15
  71. package/lib/engine/split.js.map +1 -1
  72. package/package.json +1 -1
  73. package/src/channels/dingtalk-card.ts +5 -2
  74. package/src/channels/dingtalk.ts +1 -1
  75. package/src/channels/discord.ts +949 -0
  76. package/src/channels/factory.ts +3 -0
  77. package/src/channels/feishu.ts +44 -5
  78. package/src/channels/meta.ts +10 -0
  79. package/src/channels/qq-markdown.ts +126 -0
  80. package/src/channels/qq.ts +57 -16
  81. package/src/channels/telegram.ts +83 -3
  82. package/src/channels/weixin.ts +5 -2
  83. package/src/engine/agent-options.ts +3 -1
  84. package/src/engine/chat-commands.ts +82 -50
  85. package/src/engine/command-messages.ts +65 -38
  86. package/src/engine/command-replies.ts +6 -7
  87. package/src/engine/gateway.ts +91 -92
  88. package/src/engine/router.ts +11 -10
  89. package/src/engine/session-id.ts +2 -2
  90. package/src/engine/split.ts +263 -10
package/CHANGELOG.md CHANGED
@@ -4,6 +4,30 @@
4
4
 
5
5
  Recent published versions are listed below. Git tags and GitHub Releases now mirror these entries; historical sections retain links to their original release commits.
6
6
 
7
+ ## 0.1.60 - 2026-10-01
8
+
9
+ - Added Discord. Connect with a Developer Portal Bot Token. Direct messages are answered in place; the first mention in a guild text or announcement channel continues in a thread. Text commands, buttons, files, and streamed replies follow the existing channels.
10
+ - Enable the Message Content Intent and grant Send Messages, Create Public Threads, Send Messages in Threads, Read Message History, and Attach Files. Do not configure an Interactions Endpoint URL.
11
+ - Discord keeps retrying on recoverable gateway closes (4000, 1006, and similar) instead of stopping the account; only an invalid token or missing intents stop it.
12
+ - Discord has no Markdown tables, so pipe tables become a vertical block per row (first two columns as a bold title, remaining columns as `header: value`), which avoids the mobile code-block border and horizontal overflow. Headings and other text are sent verbatim; tables inside code fences stay as they are.
13
+ - Long replies now split with structure awareness: table chunks repeat the header and separator, code fences are re-closed per chunk, and the `(n/m)` marker only prefixes prose chunks instead of cutting tables or code blocks in half.
14
+ - Telegram replies use Rich Messages with Markdown so headings, bold text, and tables render; the channel falls back to plain text when that method is unavailable and remembers the result instead of retrying.
15
+ - Feishu normal replies use card Markdown so headings and tables render, split so no card holds more than five tables, with a plain-text fallback.
16
+ - QQ replies keep Markdown tables instead of downgrading them to lists; the engine splitter repeats the header across chunks, and plain text is only used when the platform rejects markdown.
17
+ - `/help` reorganised into getting around / sessions and workspaces / models and reasoning / tasks and delivery, with 24 commands and no duplicates: one entry per feature (/sessions lists, /session continues directly), the repeated model-switch line removed, and the numbering hint rewritten as the channel-neutral "tap a button or reply with the number". `/export` is now documented and `/delivery` is grouped. Group titles are bold so they are easier to scan on a phone, and the extension section no longer repeats commands already listed in the base help nor the command name inside its descriptions.
18
+ - Telegram rich Markdown now hardens plain prose line breaks so command lists are no longer joined into one run-on line; lists, headings, quotes, tables, and code fences are left untouched. Telegram parses a single newline as a CommonMark soft break.
19
+ - Tool approvals no longer fall back to the web because of DM admission, the allowlist, or an incomplete prompt. Approvals stay in the chat that started the task; groups accept only the task initiator, and a failed prompt is treated as a denial instead of being silently allowed.
20
+ - Channel copy and command errors now follow the host language everywhere: the DingTalk AI Card placeholder and empty-reply fallback, and the engine errors shown through "command failed" all use the Chinese/English table, and Discord slash-command descriptions carry zh-CN and en-US localizations.
21
+ - Continue to support DSH 0.2.0-rc.2, 0.2.0-rc.1, 0.1.7-rc.2, 0.1.7-rc.1, 0.1.2-rc.1, and the 0.1.5 release candidates.
22
+ - Restart DSH and refresh the page after upgrading.
23
+
24
+ ## 0.1.59 - 2026-09-30
25
+
26
+ - QQ replies now show headings, bold text, and links instead of the raw markers. Tables are sent as lists.
27
+ - If a WeChat question or approval prompt fails to send, it is sent once more and the answer is still collected in WeChat.
28
+ - Continue to support DSH 0.2.0-rc.2, 0.2.0-rc.1, 0.1.7-rc.2, 0.1.7-rc.1, 0.1.2-rc.1, and the 0.1.5 release candidates.
29
+ - Restart DSH and refresh the page after upgrading.
30
+
7
31
  ## 0.1.58 - 2026-09-30
8
32
 
9
33
  - Support DSH 0.2.0-rc.2, and keep 0.2.0-rc.1, 0.1.7-rc.2, 0.1.7-rc.1, 0.1.2-rc.1, and the 0.1.5 release candidates working.
@@ -4,6 +4,30 @@
4
4
 
5
5
  以下记录近期发布的版本。Git 标签与 GitHub Release 现已和这些条目同步;历史条目继续保留原始发布提交链接。
6
6
 
7
+ ## 0.1.60 - 2026-10-01
8
+
9
+ - 新增 Discord 渠道。填写 Developer Portal 的 Bot Token 即可连接;私信直接回复,服务器文字频道和公告频道第一次 @ 后在 Thread 中继续。文字命令、按钮、文件和流式回复与现有渠道一致。
10
+ - 使用前请在 Bot 设置中打开 Message Content Intent,并授予发消息、创建公开 Thread、在 Thread 中发消息、读取历史和上传文件的权限。不要配置 Interactions Endpoint URL。
11
+ - Discord 启动时遇到可恢复的网关断开(4000、1006 等)会保留自动重连,不再把账号停掉;只有 Token 无效或 Intents 未开启才会停下。
12
+ - Discord 不支持 Markdown 表格,正文里的管道表格会逐行竖排(前两列合成粗体标题,其余列写成「表头:值」),手机上不会出现边框或横向溢出;标题等其他内容原样发送,代码块内的表格不动。
13
+ - 长回复分片会保护结构:表格分片重复表头和分隔行,代码块分片补齐自己的围栏,序号前缀只加在纯文字片,不再把表格或代码块拦腰切断。
14
+ - Telegram 回复改用 Rich Message 发送 Markdown,标题、加粗和表格可以被渲染;该方法不可用时自动回退纯文本,并记住结果不再重试。
15
+ - 飞书普通回复改用卡片 Markdown,标题和表格会被渲染;按表格数量拆卡,单卡最多 5 个表格,卡片被拒时回退纯文本。
16
+ - QQ 回复保留 Markdown 表格,不再降级成列表;分片时由引擎分片器重复表头,只有平台拒绝 markdown 时才退回纯文本。
17
+ - `/help` 重排为「入口 / 会话与工作区 / 模型与推理 / 任务与交付」四组,24 条命令零重复:每个功能只留一条入口(/sessions 列表、/session 直连),删掉末尾重复的模型切换提示;序号说明改成渠道无关的「点按钮或回序号」;补上原先缺失的 /export,/delivery 归入分组。分组标题加粗,便于在手机上扫读;扩展小节不再重复基础帮助已列出的命令,描述也不再重复命令名。
18
+ - Telegram 富文本会给普通正文行补硬换行,逐条命令不再被拼成一行;列表、标题、引用、表格和代码块保持原样。原因是 Telegram 服务端按 CommonMark 解析单个换行为软换行。
19
+ - 工具审批不再因私聊准入、白名单或展示不完整而交回网页。审批一律留在发起任务的聊天里;群聊只接受任务发起者,提示发送失败时按拒绝处理,不会静默放行。
20
+ - 渠道文案与命令报错统一跟随宿主语言:钉钉 AI Card 的占位文字和空回复回退、引擎里会通过「命令执行失败」显示的报错都走中英对照;Discord 斜杠命令描述带上 zh-CN 与 en-US 本地化。
21
+ - 继续支持 DSH 0.2.0-rc.2、0.2.0-rc.1、0.1.7-rc.2、0.1.7-rc.1、0.1.2-rc.1 和 0.1.5 的候选版。
22
+ - 升级后请重启 DSH 并刷新页面。
23
+
24
+ ## 0.1.59 - 2026-09-30
25
+
26
+ - QQ 回复会显示标题、加粗和链接,不再把这些标记原样发出。表格会改成列表。
27
+ - 微信里的问题或审批如果第一次没发出去,会再发一次,并继续在微信里收集回答。
28
+ - 继续支持 DSH 0.2.0-rc.2、0.2.0-rc.1、0.1.7-rc.2、0.1.7-rc.1、0.1.2-rc.1 和 0.1.5 的候选版。
29
+ - 升级后请重启 DSH 并刷新页面。
30
+
7
31
  ## 0.1.58 - 2026-09-30
8
32
 
9
33
  - 支持 DSH 0.2.0-rc.2,并继续支持 0.2.0-rc.1、0.1.7-rc.2、0.1.7-rc.1、0.1.2-rc.1 和 0.1.5 的候选版。
package/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  # DSH IM Connect
8
8
 
9
- **Connect Feishu, Lark, DingTalk, WeCom, WeChat, QQ, and Telegram to local DeepSeek Harness**
9
+ **Connect Feishu, Lark, DingTalk, WeCom, WeChat, QQ, Telegram, and Discord to local DeepSeek Harness**
10
10
 
11
11
  [简体中文](README.zh-CN.md) · [Changelog](CHANGELOG.md) · [Apache-2.0](LICENSE)
12
12
 
@@ -15,7 +15,7 @@
15
15
  [![npm downloads](https://img.shields.io/npm/dt/%40michengai%2Fdsh-im-connect.svg?label=npm%20downloads)](https://www.npmjs.com/package/@michengai/dsh-im-connect)
16
16
  [![DSH Web Plugin](https://img.shields.io/badge/DSH%20Web-Plugin-0f766e.svg)](https://github.com/MichengAI/dsh-im-connect)
17
17
  [![Node.js 22 or later](https://img.shields.io/badge/Node.js-22%20or%20later-339933.svg?logo=node.js&logoColor=white)](https://nodejs.org/)
18
- [![Channels](https://img.shields.io/badge/channels-7-238636.svg)](#-supported-channels)
18
+ [![Channels](https://img.shields.io/badge/channels-8-238636.svg)](#-supported-channels)
19
19
  </div>
20
20
 
21
21
  > DSH IM Connect is a community-maintained DeepSeek Harness (DSH) plugin, not an official DeepSeek AI product.
@@ -24,7 +24,7 @@
24
24
 
25
25
  Send tasks to your local DSH through your usual messenger, even when you are away from the computer. Receive replies, answer questions, and handle tool approvals in the same chat.
26
26
 
27
- - **Connect familiar platforms**: DingTalk, Feishu, Lark, WeChat, WeCom, QQ, and Telegram.
27
+ - **Connect familiar platforms**: DingTalk, Feishu, Lark, WeChat, WeCom, QQ, Telegram, and Discord.
28
28
  - **Configure accounts separately**: each account has its own workspace, model, reasoning effort, permissions, and private-access mode.
29
29
  - **Handle task interactions on your phone**: send work, read replies, and answer single- or multiple-choice questions. Approved users can approve or deny tools in private chats.
30
30
  - **Keep chat records separate**: each IM chat has its own session under **Channels** in the web workspace.
@@ -42,9 +42,9 @@ Inbound messages are identified before commands, tool approvals, or injection.
42
42
  | DM from the QR scanner | WeChat / Feishu / Lark / QQ scanners are allowlisted automatically |
43
43
  | DM from anyone else | Appears on the settings pending list until approved |
44
44
  | DM after QR binding that does not return user identity | DingTalk / WeCom QR setup returns bot credentials only, so the scanner still needs settings approval |
45
- | DM after manual credentials | Telegram, and DingTalk / WeCom / QQ bound manually, require approval for every DM |
45
+ | DM after manual credentials | Telegram, Discord, and DingTalk / WeCom / QQ bound manually, require approval for every DM |
46
46
  | DM without a userId | Denied |
47
- | Tool approval | Only an allowlisted user in a DM can reply `Approve` / `Deny` (or `批准` / `拒绝`); group replies do not grant |
47
+ | Tool approval | Reply `Approve` / `Deny` (or `批准` / `拒绝`) in the chat bound to that session; works in DMs and groups, and never falls back to the web |
48
48
  | Interactive choice | Reply with an option number or text in the originating IM conversation; separate multiple choices with commas or add a custom answer; only the initiating user can answer in a group |
49
49
 
50
50
  WeChat is QR-only and DM-only, so the same WeChat account that scanned can talk immediately. A different WeChat account DMing the bot waits for settings approval.
@@ -58,7 +58,8 @@ WeChat is QR-only and DM-only, so the same WeChat account that scanned can talk
58
58
  <code>💬 WeChat</code>&nbsp;
59
59
  <code>🏢 WeCom</code>&nbsp;
60
60
  <code>🐧 QQ</code>&nbsp;
61
- <code>✈️ Telegram</code>
61
+ <code>✈️ Telegram</code>&nbsp;
62
+ <code>🎮 Discord</code>
62
63
  </p>
63
64
 
64
65
  | Channel | Status | How to connect | You need |
@@ -70,14 +71,15 @@ WeChat is QR-only and DM-only, so the same WeChat account that scanned can talk
70
71
  | 🏢 **WeCom** | ✅ Ready | QR (recommended), or Bot ID / Secret | WeCom intelligent bot |
71
72
  | 🐧 **QQ** | ✅ Ready | QR, or AppID / AppSecret | QQ Open Platform bot, not a personal QQ account |
72
73
  | ✈️ **Telegram** | ✅ Ready | Bot Token only | `@BotFather`; do not enable Webhook on the same bot |
74
+ | 🎮 **Discord** | ✅ Ready | Bot Token only | Official Developer Portal bot. Enable the Message Content Intent. The first mention in a text or announcement channel continues in a thread without another mention |
73
75
 
74
- ✅ Ready = text in and out works | *WeChat = official iLink only, no reverse-engineered personal protocol | Groups still require an @ mention
76
+ ✅ Ready = text in and out works | *WeChat = official iLink only, no reverse-engineered personal protocol | Groups still require an @ mention. Discord skips repeat mentions only inside a thread the bot created
75
77
 
76
78
  ## Image input
77
79
 
78
80
  Image input follows DSH Chat's model-capability and attachment rules rather than guessing vision support from model names:
79
81
 
80
- The receive paths cover WeChat, WeCom, DingTalk, Feishu, Lark, QQ, and Telegram. See the [image-input verification guide](docs/image-input.md) for protocol forms and live checks.
82
+ The receive paths cover WeChat, WeCom, DingTalk, Feishu, Lark, QQ, Telegram, and Discord. See the [image-input verification guide](docs/image-input.md) for protocol forms and live checks.
81
83
 
82
84
  - Use the model currently selected for the IM session, not just the global default.
83
85
  - When the model declares `image` support, store images as standard DSH attachments and submit image content to the model. Session history keeps image references rather than only local-path text.
@@ -87,7 +89,7 @@ The receive paths cover WeChat, WeCom, DingTalk, Feishu, Lark, QQ, and Telegram.
87
89
 
88
90
  ## File input
89
91
 
90
- WeChat, WeCom, DingTalk, Feishu, Lark, QQ and Telegram accept ordinary files through Chat’s upload service for the current session. Send PDFs, documents or spreadsheets for the assistant to process. Format support follows web Chat’s models, tools and file capabilities; uploading does not guarantee that every format can be understood directly.
92
+ WeChat, WeCom, DingTalk, Feishu, Lark, QQ, Telegram, and Discord accept ordinary files through Chat’s upload service for the current session. Send PDFs, documents or spreadsheets for the assistant to process. Format support follows web Chat’s models, tools and file capabilities; uploading does not guarantee that every format can be understood directly.
91
93
 
92
94
  - Requires the file-upload service in DSH `0.1.5-rc.1`, `0.1.5-rc.2`, `0.1.5-rc.3`, `0.1.7-rc.1`, `0.1.7-rc.2`, `0.2.0-rc.1`, or `0.2.0-rc.2`. On `0.1.2-rc.1`, file input asks you to upgrade; existing text and image support is unchanged.
93
95
  - Up to 4 ordinary files per message, totaling 20 MiB. Channel download limits also apply.
@@ -97,7 +99,7 @@ WeChat, WeCom, DingTalk, Feishu, Lark, QQ and Telegram accept ordinary files thr
97
99
 
98
100
  ## File delivery
99
101
 
100
- WeChat, WeCom, DingTalk, Feishu, Lark, QQ, and Telegram can return files produced by the assistant. For example: “Create a PDF report and send me the file.”
102
+ WeChat, WeCom, DingTalk, Feishu, Lark, QQ, Telegram, and Discord can return files produced by the assistant. For example: “Create a PDF report and send me the file.”
101
103
 
102
104
  - Files successfully created or edited with Chat's supported file tools are sent after the reply. On hosts with `present`, explicitly presented files are also sent, including existing files.
103
105
  - File access follows Chat: files outside the workspace are allowed when the host can read them. The plugin does not extract arbitrary paths from reply text. Files created through shell commands need to be presented explicitly.
@@ -117,9 +119,9 @@ Menus include previous, next and back actions. WeCom menus paginate to fit card
117
119
 
118
120
  Common command replies offer related next steps: for example, `/model` → select a model / adjust reasoning → back to menu. Supported channels offer buttons; text replies include the commands to send. Navigation buttons on ordinary result replies do not accept numeric shortcuts, so numbers remain chat input; only selection menus accept numbered replies. Oversized cards fall back to complete text.
119
121
 
120
- DingTalk, Telegram and Feishu/Lark use native buttons. WeCom uses cards when button count and text length fit platform limits. Other cases, QQ and WeChat use numbered text. Explicit rejections and capacity limits fall back to complete text. Uncertain network delivery produces a confirmation notice instead of resending the card. Menus are scoped to the account, chat, operator and session, expire after 15 minutes or restart, and recheck permissions on selection. Used buttons cannot execute again.
122
+ DingTalk, Telegram, Discord, and Feishu/Lark use native buttons. WeCom uses cards when button count and text length fit platform limits. Other cases, QQ and WeChat use numbered text. Explicit rejections and capacity limits fall back to complete text. Uncertain network delivery produces a confirmation notice instead of resending the card. Menus are scoped to the account, chat, operator and session, expire after 15 minutes or restart, and recheck permissions on selection. Used buttons cannot execute again.
121
123
 
122
- Approvals and questions use the same native-button channels: allow once/reject, single-choice selection, and multiple selections followed by submit. Open questions retain text input. If a card cannot show the full prompt or fails to send, text is used without omitting approval details. Existing approval eligibility and requester restrictions apply; disabling commands does not disable pending approvals or questions.
124
+ Approvals and questions use the same native-button channels: allow once/reject, single-choice selection, and multiple selections followed by submit. Open questions retain text input. Approvals always stay in the chat that started the task and never fall back to the web; a failed prompt is treated as a denial. In groups only the task initiator can approve; DMs add no extra restriction beyond chatting. Disabling commands does not disable pending approvals or questions.
123
125
 
124
126
 
125
127
  Agent presets: `/presets` (alias `/presetlist`) lists presets; `/preset` shows the current preset. `/preset number-or-ID` starts and switches to a new session in the current workspace, keeping previous sessions. Use `/preset id:ID` for numeric IDs and `/preset --default` for the default preset. Account defaults remain unchanged; later `/new` commands still use account settings. Native buttons support direct selection; text lists use numbers valid for 15 minutes.
@@ -135,13 +137,14 @@ Regular chat messages follow the actual task state. Commands continue to use tex
135
137
  - DingTalk: labels on the original message show queued, thinking, waiting for confirmation, done, failed, or cancelled.
136
138
  - Feishu / Lark: reactions indicate processing, done, or failed. Waiting keeps the processing reaction; cancellation removes it.
137
139
  - Telegram: 👀 processing, 🤔 waiting for confirmation, 👍 done, and 👎 failed. Cancellation removes the reaction. Typing is refreshed while processing.
140
+ - Discord: uses the same reactions and edits one message as the answer streams. Typing is refreshed while processing. Cancellation removes the reaction.
138
141
  - WeChat: typing is refreshed while processing and stopped when finished or waiting for confirmation. WeCom and QQ retain their existing reply behavior.
139
142
 
140
143
  Done means the turn completed normally and both text and files were delivered. Stopped or failed tasks and later queued messages are not marked done. Channel permissions and network conditions may prevent status updates without blocking chat. Text labels follow the web language setting.
141
144
 
142
145
  ## Connection diagnostics
143
146
 
144
- Use **Diagnose connection** in account settings to query platform APIs: WeChat configuration, a ping acknowledgement on the existing WeCom connection, DingTalk credentials, Feishu/Lark credentials and bot identity, QQ credentials and gateway, or Telegram bot identity and Webhook conflicts.
147
+ Use **Diagnose connection** in account settings to query platform APIs: WeChat configuration, a ping acknowledgement on the existing WeCom connection, DingTalk credentials, Feishu/Lark credentials and bot identity, QQ credentials and gateway, Telegram bot identity and Webhook conflicts, or Discord bot identity and Gateway URL.
145
148
 
146
149
  Each check reports passed, failed, or unverified, with timing and a suggested next step. No test messages are sent and no extra message polling is started. Passing one check does not verify all messaging permissions. An older backend prompts you to restart DSH and refresh the page. See the [connection diagnostics API and validation notes (Chinese)](docs/01-当前工作/I015-命令权限与Chat命令/06-账号状态检查.md).
147
150
 
@@ -235,7 +238,7 @@ Open **Settings → IM Assistant**, select **Add account** under the target chan
235
238
 
236
239
  | Goal | Action | Notes |
237
240
  | --- | --- | --- |
238
- | Add an account | Select **Add account** under a channel, choose the account settings, then scan or enter credentials | The same channel can contain multiple accounts; Feishu / Lark / WeChat are QR-only, while Telegram needs a Bot Token |
241
+ | Add an account | Select **Add account** under a channel, choose the account settings, then scan or enter credentials | The same channel can contain multiple accounts; Feishu / Lark / WeChat are QR-only, while Telegram and Discord need a Bot Token |
239
242
  | Change account settings | Expand the channel, select an account, then edit its workspace, model, reasoning effort, permission, or private-access mode in its settings dialog | Changes affect only that account and apply to its subsequent sessions immediately |
240
243
  | Pause receiving | Turn off **Receive messages** on the account row | Credentials and settings stay; only new inbound messages for that account pause |
241
244
  | Send work from IM | WeChat / Feishu / Lark / QQ QR scanners can DM immediately; DingTalk / WeCom scanners and other users need approval. Groups only need a mention | Each chat has its own channel session |
@@ -257,7 +260,7 @@ Open **Settings → IM Assistant**, select **Add account** under the target chan
257
260
 
258
261
  After `/workspace`, `/new` and continuing after archiving the current session keep the selected workspace and use the account model, Agent preset, and permission preset. `/session` and `/fork` preserve the original session configuration.
259
262
 
260
- DingTalk replies prefer official AI Card streaming. If card creation fails, plain text preserves line breaks; code fences and list markers remain literal. Do not enable Webhook on the same Telegram bot.
263
+ DingTalk replies prefer official AI Card streaming. If card creation fails, plain text preserves line breaks; code fences and list markers remain literal. QQ replies use official markdown and keep headings, bold text, links, and tables; only a platform rejection falls back to plain text (where tables become lists). Telegram replies are sent as Rich Messages with Markdown so headings, bold text, and tables render, falling back to plain text when that method is unavailable; do not enable Webhook on the same bot. Feishu normal replies also use card Markdown, so headings and tables render; cards are split so none holds more than five tables, with a plain-text fallback. Long replies split with structure awareness: table chunks repeat the header, code fences are re-closed, and the `(n/m)` marker only prefixes prose chunks. `/help` is grouped as getting around / sessions and workspaces / models and reasoning / tasks and delivery, with one entry per feature and the usable aliases marked; group titles are bold while the rest of the command copy stays plain text, which keeps them scannable on a phone. Discord renders headings, bold text, code, and lists on the client but has no Markdown tables, and mobile clients cannot scroll horizontally, so pipe tables become a vertical block per row (first two columns as a bold title, remaining columns as `header: value`). Everything else is sent verbatim. Do not configure a Discord Interactions Endpoint URL, or button clicks will not arrive through the Gateway.
261
264
 
262
265
  Send commands as separate text messages; image captions remain ordinary input. Start with `/help`; individual replies also suggest related actions.
263
266
 
@@ -281,7 +284,7 @@ Command permission does not grant DM admission or replace tool approval. Enabled
281
284
  | Account state | `channels.json` stores per-account workspace, model, permission, private access, enablement, and credential refs, not raw secrets |
282
285
  | Browser payloads | Never include tokens, secrets, App Secrets, or internal error details |
283
286
  | WeChat protocol | Official iLink only; no reverse-engineered personal WeChat protocol |
284
- | Tool approval | Only a user on the current account's allowlist can grant or deny in a DM. Even when all DM users may chat, unapproved users cannot approve tools; approvals cannot cross conversations or come from groups |
287
+ | Tool approval | The task initiator replies in the chat bound to that session. DM admission decides who can chat and no longer gates approvals, and approvals never go back to the web |
285
288
  | Interactive questions | Single-choice, multiple-choice, and custom questions return to the originating IM conversation; one conversation handles them in order, and only the initiating user can answer in a group |
286
289
 
287
290
  Keep the DSH backend listening on loopback. Remote access should use a controlled HTTPS reverse proxy, the actual authority in the Host's `trustedHosts`, and a login through that authority. Do not spoof localhost or remove authentication to bypass 403. Image-download `additionalImageHosts` does not configure management access; see [management authentication](SECURITY.md#管理面). Permission presets use the same host sandbox-policy values as Chat; `danger-full-access` does not wrap a sandbox.
@@ -312,7 +315,7 @@ This repository develops in `src` and builds to `lib`:
312
315
  - [src\index.ts](src/index.ts): host entry, config, and lifecycle.
313
316
  - [src\manager.ts](src/manager.ts): channel start/stop, authenticated management API, and credential persistence.
314
317
  - [src\engine](src/engine): session routing, slash commands, approval, splitting, and outbound push.
315
- - [src\channels](src/channels): DingTalk, Feishu, Lark, WeChat, WeCom, QQ, and Telegram adapters.
318
+ - [src\channels](src/channels): DingTalk, Feishu, Lark, WeChat, WeCom, QQ, Telegram, and Discord adapters.
316
319
  - `client.js`: settings page and workspace channel sidebar.
317
320
  - `tests\*.test.mjs`: routing, QR, credentials, QQ, delivery, and sidebar tests.
318
321
 
@@ -352,7 +355,7 @@ Sidebar tests read the built `lib/client.js`; run `npm run build` before invokin
352
355
 
353
356
  Delivery tracking starts with ordinary IM messages received after this feature is enabled. If the original result is saved but sending has not started, its final text and completion status can be recovered after reconnecting or restarting. Questions, tools, approvals, and files are never replayed. Messages handled by earlier plugin versions are not recovered retroactively.
354
357
 
355
- - Telegram, Feishu/Lark, and WeCom can attempt background delivery using a stable chat destination. DingTalk, QQ, and WeChat wait for a new message in the original chat to refresh the reply channel. Connection, expiry, and platform quotas still apply.
358
+ - Telegram, Discord, Feishu/Lark, and WeCom can attempt background delivery using a stable chat destination. DingTalk, QQ, and WeChat wait for a new message in the original chat to refresh the reply channel. Connection, expiry, and platform quotas still apply.
356
359
  - When sending was attempted but delivery is unconfirmed, automatic resend pauses. Use `/delivery` to check records, then `/delivery retry <record-ID>` if you want to resend. This may duplicate text you already received. View files in the original session on the web.
357
360
  - Records and resend actions are scoped to the original sender in the current chat, subject to admission and command permissions. Disabling an account, changing the session binding, or changing access pauses recovery. Restore the original binding and access before retrying manually.
358
361
  - Recovery is available for 7 days per record, with at most 1,000 records. Delivered and definitively rejected records are removed first when capacity is reached; expired records are cleaned up when a new message arrives. Background checks run in batches every 30 seconds. Unreadable history or unfinished tasks remain pending. Recovery does not resume task execution.
package/README.zh-CN.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  # DSH IM Connect
8
8
 
9
- **把飞书、Lark、钉钉、企业微信、微信、QQ、Telegram 接到本机 DeepSeek Harness**
9
+ **把飞书、Lark、钉钉、企业微信、微信、QQ、Telegram、Discord 接到本机 DeepSeek Harness**
10
10
 
11
11
  [English](README.md) · [更新日志](CHANGELOG.zh-CN.md) · [Apache-2.0](LICENSE)
12
12
 
@@ -15,7 +15,7 @@
15
15
  [![npm 下载量](https://img.shields.io/npm/dt/%40michengai%2Fdsh-im-connect.svg?label=npm%20%E4%B8%8B%E8%BD%BD%E9%87%8F)](https://www.npmjs.com/package/@michengai/dsh-im-connect)
16
16
  [![DSH Web Plugin](https://img.shields.io/badge/DSH%20Web-Plugin-0f766e.svg)](https://github.com/MichengAI/dsh-im-connect)
17
17
  [![Node.js 22 or later](https://img.shields.io/badge/Node.js-22%20or%20later-339933.svg?logo=node.js&logoColor=white)](https://nodejs.org/)
18
- [![Channels](https://img.shields.io/badge/channels-7-238636.svg)](#-支持的渠道)
18
+ [![Channels](https://img.shields.io/badge/channels-8-238636.svg)](#-支持的渠道)
19
19
  </div>
20
20
 
21
21
  > DSH IM Connect 是社区维护的 DeepSeek Harness(DSH)插件,并非 DeepSeek AI 官方产品。
@@ -24,7 +24,7 @@
24
24
 
25
25
  不在电脑前,也能通过常用聊天软件把任务交给本机 DSH,并在同一聊天里接收回复、回答问题和处理工具审批。
26
26
 
27
- - **连接常用消息平台**:支持钉钉、飞书、Lark、微信、企业微信、QQ 和 Telegram。
27
+ - **连接常用消息平台**:支持钉钉、飞书、Lark、微信、企业微信、QQ、Telegram 和 Discord。
28
28
  - **多个账号分别配置**:同一平台可添加多个账号,各自选择工作区、模型、推理强度、权限和私聊准入。
29
29
  - **手机上完成任务交互**:下任务、读回复、回答单选或多选问题;已批准用户可在私聊中批准或拒绝工具执行。
30
30
  - **聊天记录互不混淆**:每个 IM 聊天对应独立会话,在网页工作区「频道」中回看。
@@ -44,9 +44,9 @@
44
44
  | 私聊 · 扫码用户 | 微信 / 飞书 / Lark / QQ 扫码者自动进白名单,可直接对话 |
45
45
  | 私聊 · 其他人 | 进入设置页待批准;不批准就不能驱动助手 |
46
46
  | 私聊 · 扫码不返回身份 | 钉钉 / 企微的快捷绑定只返回机器人凭据,扫码者仍需在设置页批准 |
47
- | 私聊 · 手动凭据 | Telegram,以及手动填写凭据的钉钉 / 企微 / QQ,所有私聊都要先批准 |
47
+ | 私聊 · 手动凭据 | Telegram、Discord,以及手动填写凭据的钉钉 / 企微 / QQ,所有私聊都要先批准 |
48
48
  | 私聊缺少 userId | 拒绝 |
49
- | 工具审批 | 仅白名单用户在私聊回复「批准 / 拒绝」有效;群聊里回不算 |
49
+ | 工具审批 | 在绑定该会话的聊天里回复「批准 / 拒绝」;群聊和私聊都可以,不用去网页 |
50
50
  | 交互选择 | 在原 IM 会话回复选项序号或文字;多选用逗号分隔,也可补充自定义答案;群聊只接受任务发起者回答 |
51
51
 
52
52
  微信是扫码渠道且只支持私聊,所以连上后用**同一个微信号**即可直接用。换一个微信号私聊,会出现在设置页待批准。
@@ -60,7 +60,8 @@
60
60
  <code>💬 微信</code>&nbsp;
61
61
  <code>🏢 企业微信</code>&nbsp;
62
62
  <code>🐧 QQ</code>&nbsp;
63
- <code>✈️ Telegram</code>
63
+ <code>✈️ Telegram</code>&nbsp;
64
+ <code>🎮 Discord</code>
64
65
  </p>
65
66
 
66
67
  | 渠道 | 状态 | 接入方式 | 需要 |
@@ -72,14 +73,15 @@
72
73
  | 🏢 **企业微信** | ✅ 可用 | 扫码(推荐),或 Bot ID / Secret | 企业微信智能机器人 |
73
74
  | 🐧 **QQ** | ✅ 可用 | 扫码,或 AppID / AppSecret | QQ 开放平台机器人,不是个人号 |
74
75
  | ✈️ **Telegram** | ✅ 可用 | 仅填 Bot Token | `@BotFather`;同一 Bot 不要同时开 Webhook |
76
+ | 🎮 **Discord** | ✅ 可用 | 仅填 Bot Token | Developer Portal 的官方 Bot。打开 Message Content Intent;文字频道和公告频道第一次 @ 后在 Thread 中继续,不必重复 @ |
75
77
 
76
- ✅ 可用 = 文字收发可用 | *微信 = 只走腾讯官方 iLink,不做逆向个人号 | 群聊都需要 @ 机器人才回复
78
+ ✅ 可用 = 文字收发可用 | *微信 = 只走腾讯官方 iLink,不做逆向个人号 | 群聊都需要 @ 机器人才回复。Discord 仅文字频道和公告频道在 Bot 自己创建的 Thread 中免重复 @
77
79
 
78
80
  ## 图片输入
79
81
 
80
82
  图片输入使用与 DSH Chat 一致的模型能力和附件规则,不按模型名称猜测视觉能力:
81
83
 
82
- 覆盖微信、企业微信、钉钉、飞书、Lark、QQ 和 Telegram;具体平台消息形式和联调检查见[图片输入验收](docs/image-input.md)。
84
+ 覆盖微信、企业微信、钉钉、飞书、Lark、QQ、Telegram 和 Discord;具体平台消息形式和联调检查见[图片输入验收](docs/image-input.md)。
83
85
 
84
86
  - 以当前 IM 会话实际使用的模型为准,而不是只看全局默认模型。
85
87
  - 模型声明支持 `image` 时,将图片保存为 DSH 标准图片附件并提交给模型;会话记录保留图片引用,而不是只有本地文件路径文字。
@@ -89,7 +91,7 @@
89
91
 
90
92
  ## 文件输入
91
93
 
92
- 微信、企业微信、钉钉、飞书、Lark、QQ、Telegram 可接收普通文件,并通过 Chat 的上传服务交给当前会话。可以发送 PDF、文档、表格等文件,再让助手读取或处理;能否解析具体格式与网页 Chat 的模型、工具和文件能力一致,不承诺每种格式都能直接理解。
94
+ 微信、企业微信、钉钉、飞书、Lark、QQ、Telegram、Discord 可接收普通文件,并通过 Chat 的上传服务交给当前会话。可以发送 PDF、文档、表格等文件,再让助手读取或处理;能否解析具体格式与网页 Chat 的模型、工具和文件能力一致,不承诺每种格式都能直接理解。
93
95
 
94
96
  - 需要 DSH `0.1.5-rc.1`、`0.1.5-rc.2`、`0.1.5-rc.3`、`0.1.7-rc.1`、`0.1.7-rc.2`、`0.2.0-rc.1` 或 `0.2.0-rc.2` 的文件上传服务;`0.1.2-rc.1` 明确提示升级,文字、图片等既有能力不变。
95
97
  - 单条消息最多 4 个普通文件,累计最多 20 MiB,还受渠道下载限制约束。
@@ -99,7 +101,7 @@
99
101
 
100
102
  ## 文件回传
101
103
 
102
- 微信、企业微信、钉钉、飞书、Lark、QQ 和 Telegram 均可回传助手产出的文件。例如:“整理成 PDF 报告,并把文件发给我。”
104
+ 微信、企业微信、钉钉、飞书、Lark、QQ、Telegram 和 Discord 均可回传助手产出的文件。例如:“整理成 PDF 报告,并把文件发给我。”
103
105
 
104
106
  - 使用 Chat 支持的文件工具成功新建或修改的文件,会在回复后发送;宿主支持 `present` 时,也会发送明确交付的文件,包括已有文件。
105
107
  - 文件访问范围与 Chat 一致,允许宿主可读取的工作区外文件。不从回复正文中猜测文件路径;通过脚本等方式生成的文件,需要助手明确 `present` 交付。
@@ -119,9 +121,9 @@
119
121
 
120
122
  常用命令回复会提供相关下一步,例如 `/model` → 选择模型 / 调整推理 → 返回菜单。支持原生按钮时可点击跳转,其他情况显示可直接发送的命令。普通结果回复的导航按钮不支持数字选择,避免把聊天中的数字误当操作;只有选择菜单支持回复序号。超长卡片保留完整文字回复。
121
123
 
122
- 钉钉、Telegram、飞书/Lark 使用原生按钮;企业微信在按钮数量和正文符合平台限制时使用卡片,其他情况及 QQ、微信使用文字序号。平台明确拒绝或超出卡片容量时退回完整文字;网络异常导致发送结果未知时仅提示确认,避免重复发送。菜单按账号、聊天、操作者和会话隔离,15 分钟或重启后失效;执行时重新检查权限,旧按钮不能重复执行。
124
+ 钉钉、Telegram、Discord、飞书/Lark 使用原生按钮;企业微信在按钮数量和正文符合平台限制时使用卡片,其他情况及 QQ、微信使用文字序号。平台明确拒绝或超出卡片容量时退回完整文字;网络异常导致发送结果未知时仅提示确认,避免重复发送。菜单按账号、聊天、操作者和会话隔离,15 分钟或重启后失效;执行时重新检查权限,旧按钮不能重复执行。
123
125
 
124
- 审批与问答复用上述原生按钮渠道:审批提供批准一次/拒绝,单选题直接点选,多选题勾选后提交;开放问题保留文字回答。卡片无法完整展示或发送失败时降级文字,不省略审批详情。按钮沿用原审批资格和发起人限制,关闭命令不影响已有审批及问答。
126
+ 审批与问答复用上述原生按钮渠道:审批提供批准一次/拒绝,单选题直接点选,多选题勾选后提交;开放问题保留文字回答。审批始终留在发起任务的聊天里,不会回退到网页端;提示发送失败时按拒绝处理。群聊里只接受任务发起者批准,私聊没有额外限制,关闭命令不影响已有审批及问答。
125
127
 
126
128
 
127
129
  Agent 预设:`/presets`(别名 `/presetlist`)查看目录,`/preset` 查看当前预设,`/preset 序号或ID` 使用预设在当前工作区新建并切换会话,旧会话保留。纯数字 ID 使用 `/preset id:ID`,`/preset --default` 使用宿主默认预设。账号默认设置不变,后续 `/new` 仍按账号设置创建。原生按钮渠道可直接选择,文字渠道使用列表序号(15 分钟有效)。
@@ -137,13 +139,14 @@ IM 消息发起的处理结束后,会在正文和文件投递完成后给出
137
139
  - 钉钉:在原消息上显示排队、思考、等待确认、已完成、失败或取消标签。
138
140
  - 飞书 / Lark:使用处理中、完成和失败表情;等待确认沿用处理中表情,取消时撤下表情。
139
141
  - Telegram:使用 👀 处理中、🤔 等待确认、👍 完成、👎 失败;取消时撤下表情。处理期间持续显示输入状态。
142
+ - Discord:使用与 Telegram 相同的表情,并编辑同一条消息显示逐步生成的回答。处理期间持续显示输入状态。取消时撤下表情。
140
143
  - 微信:处理期间刷新输入状态,结束或等待确认时停止。企业微信、QQ 保持现有回复方式。
141
144
 
142
145
  “已完成”表示该回合正常结束且正文、文件均已投递;停止、失败和下一条排队消息不会误标完成。状态接口受渠道权限与网络影响,更新失败不阻塞聊天;文字标签跟随网页语言设置。
143
146
 
144
147
  ## 连接诊断
145
148
 
146
- 账号设置中的“诊断连接”会实际调用渠道接口:微信查询配置,企微检测现有连接的 ping 回执,钉钉验证应用凭据,飞书/Lark 查询鉴权与机器人身份,QQ 查询鉴权与网关,Telegram 查询机器人身份及 Webhook 冲突。
149
+ 账号设置中的“诊断连接”会实际调用渠道接口:微信查询配置,企微检测现有连接的 ping 回执,钉钉验证应用凭据,飞书/Lark 查询鉴权与机器人身份,QQ 查询鉴权与网关,Telegram 查询机器人身份及 Webhook 冲突,Discord 查询机器人身份及 Gateway 地址。
147
150
 
148
151
  每项显示通过、失败或未验证、耗时和处理建议。诊断不发送测试消息、不额外拉取聊天消息;单项通过不代表完整收发权限已验证。旧后端不支持诊断时会提示重启 DSH 并刷新页面。接口、各渠道能力边界与验证记录见[账号连接诊断](docs/01-当前工作/I015-命令权限与Chat命令/06-账号状态检查.md)。
149
152
 
@@ -235,7 +238,7 @@ dsh --profile web --dump-config
235
238
 
236
239
  | 目标 | 操作 | 说明 |
237
240
  | --- | --- | --- |
238
- | 添加账号 | 在对应渠道点击「添加账号」,选择账号配置后扫码或填写凭据 | 同一渠道可添加多个账号;飞书 / Lark / 微信仅扫码,Telegram 仅填 Bot Token |
241
+ | 添加账号 | 在对应渠道点击「添加账号」,选择账号配置后扫码或填写凭据 | 同一渠道可添加多个账号;飞书 / Lark / 微信仅扫码,Telegram 和 Discord 仅填 Bot Token |
239
242
  | 修改账号配置 | 展开渠道并选择账号,在设置弹窗中修改工作区、模型、推理强度、权限或私聊准入 | 配置只影响当前账号;保存后该账号的后续会话立即使用新配置 |
240
243
  | 暂停接收 | 关闭账号行上的「接收消息」开关 | 凭据和账号配置保留,只暂停该账号接收新消息 |
241
244
  | 在 IM 里下任务 | 微信 / 飞书 / Lark / QQ 扫码用户可直接私聊;钉钉 / 企微扫码者和其他用户需先批准。群聊只需 @ | 每个聊天对应一条独立频道会话 |
@@ -257,7 +260,7 @@ dsh --profile web --dump-config
257
260
 
258
261
  通过 `/workspace` 新建后,`/new` 和当前会话归档后的续聊会保留所选工作区,并使用账号配置的模型、Agent 与权限预设。`/session` 接续已有会话、`/fork` 分叉则保留原会话配置。
259
262
 
260
- 钉钉回复优先走官方 AI Card 流式卡片;创建失败则回退纯文本,保留换行;代码与列表标记按原文显示。Telegram 同一 Bot 不要同时开 Webhook。
263
+ 钉钉回复优先走官方 AI Card 流式卡片;创建失败则回退纯文本,保留换行;代码与列表标记按原文显示。QQ 回复走官方 markdown,保留标题、加粗、链接和表格;只有平台拒绝 markdown 时才退回纯文本(那时表格降级成列表)。Telegram 回复用 Rich Message 发送 Markdown,标题、加粗和表格可渲染;该方法不可用时自动回退纯文本,同一 Bot 不要同时开 Webhook。飞书普通回复也用卡片 Markdown,标题和表格会被渲染;按表格数量拆卡,单卡最多 5 个表格,卡片被拒时回退纯文本。长回复分片会保护结构:表格分片重复表头,代码块补齐围栏,序号只加在纯文字片。`/help` 按「入口 / 会话与工作区 / 模型与推理 / 任务与交付」分组,每个功能只列一条入口,并标出可直接使用的别名;分组标题会加粗,其余命令文案保持纯文本,便于在手机上扫读。Discord 客户端会自己渲染标题、加粗、代码和列表,但不支持 Markdown 表格,手机端又无法横向滚动,所以正文里的表格会逐行竖排成「粗体标题 + 表头:值」,其余正文原样发送;不要配置 Interactions Endpoint URL,否则按钮不会从 Gateway 进来。
261
264
 
262
265
  命令单独发送为文字,图片说明按普通消息处理。首次使用可发 `/help`,各命令回复也会给出相关操作。
263
266
 
@@ -281,7 +284,7 @@ dsh --profile web --dump-config
281
284
  | 账号状态 | `channels.json` 按账号保存工作区、模型、权限、私聊准入、启用状态和凭据引用,不保存明文 Secret |
282
285
  | 浏览器回包 | 不返回 token、secret、App Secret 或内部异常详情 |
283
286
  | 微信协议 | 只走腾讯官方 iLink,不使用逆向个人微信协议 |
284
- | 工具批准 | 仅私聊且发送者已在当前账号白名单时生效;即使账号允许所有私聊用户,未批准用户也不能审批工具,且不能跨会话或在群里批准 |
287
+ | 工具批准 | 在绑定该会话的聊天里由任务发起者回复「批准 / 拒绝」;私聊准入只决定谁能对话,不再单独卡审批,也不会交回网页 |
285
288
  | 交互问题 | 单选、多选和自定义问题回到发起任务的 IM 会话;同一会话按顺序处理,群聊只接受任务发起者回答 |
286
289
 
287
290
  DSH 后端保持本机监听;远程访问使用受控 HTTPS 反向代理,并在宿主配置实际访问地址的 `trustedHosts`、通过该地址登录。不要伪装 localhost 或删除认证检查来绕过 403;图片下载的 `additionalImageHosts` 不用于管理接口。详见 [管理面认证](SECURITY.md#管理面)。权限预设与 Chat 使用相同的 Host sandbox-policy;`danger-full-access` 不套沙箱。
@@ -312,7 +315,7 @@ dsh --profile web --dump-config
312
315
  - [src\index.ts](src/index.ts):Host 入口、配置和生命周期。
313
316
  - [src\manager.ts](src/manager.ts):渠道启停、已认证管理 API、凭据落盘。
314
317
  - [src\engine](src/engine):会话路由、斜杠命令、审批、分片和回推。
315
- - [src\channels](src/channels):钉钉、飞书、Lark、微信、企业微信、QQ、Telegram 适配器。
318
+ - [src\channels](src/channels):钉钉、飞书、Lark、微信、企业微信、QQ、Telegram、Discord 适配器。
316
319
  - `client.js`:设置页和工作区频道侧栏。
317
320
  - `tests\*.test.mjs`:路由、扫码、凭据、QQ、投递和侧栏测试。
318
321
 
@@ -352,7 +355,7 @@ npm test
352
355
 
353
356
  从本功能启用后收到的普通 IM 消息开始记录交付状态。原任务的结果已保存、但尚未开始发送时,可在恢复连接或重启后补发最终文字和结束状态;不会重新执行问题、工具或审批,也不会补发文件。旧版本处理过的消息不回溯补发。
354
357
 
355
- - Telegram、飞书/Lark、企业微信可通过稳定聊天目标后台尝试补发;钉钉、QQ、微信等待原聊天发来新消息刷新回复通道。发送仍受渠道连接、时效和配额限制。
358
+ - Telegram、Discord、飞书/Lark、企业微信可通过稳定聊天目标后台尝试补发;钉钉、QQ、微信等待原聊天发来新消息刷新回复通道。发送仍受渠道连接、时效和配额限制。
356
359
  - 已尝试发送但无法确认送达时,暂停自动补发。发送 `/delivery` 查看记录;确认需要补发后发送 `/delivery retry <记录ID>`。这可能重复已收到的文字,文件请在网页原会话查看。
357
360
  - 查询与补发仅限当前聊天的原发起人,并遵循准入和命令权限。账号停用、原会话换绑或访问权限变化会暂停补发;恢复原绑定与权限后可手动尝试。
358
361
  - 每条记录的补发窗口为 7 天,最多保存 1000 条;满额时优先清理已送达或明确未提交的终态记录,过期记录在新消息进入时清理。后台每 30 秒分批检查,历史暂不可读或任务尚未结束时继续等待。补发不是任务自动续跑。
package/SECURITY.md CHANGED
@@ -8,15 +8,15 @@
8
8
  2. **私聊未配置即拒绝**:私聊白名单为空,或消息没有 `userId`,不处理。
9
9
  3. **群聊不用绑定**:群聊只需 @ 机器人;不进待批准、不查白名单。
10
10
  4. **私聊只有扫码用户免批**:微信扫码用户和飞书 / Lark 扫码用户自动进入白名单;其他私聊用户必须在设置页批准。
11
- 5. **群聊仍需 @ 当前机器人**:未 @ 机器人、或只 @ 其他成员的群消息直接忽略,也不会写入待批准;准确 @ 机器人后默认放行。
12
- 6. **工具审批更严**:回复「批准 / 拒绝」只在私聊且发送者已在白名单时生效。群聊里的批准词不会授予 harness 权限。
11
+ 5. **群聊仍需 @ 当前机器人**:未 @ 机器人、或只 @ 其他成员的群消息直接忽略,也不会写入待批准;准确 @ 机器人后默认放行。Discord 文字频道和公告频道在首次 @ 后进入该机器人创建的 Thread,之后在这个 Thread 里不必再次 @;其他频道和创建失败的回退仍要 @。
12
+ 6. **工具审批留在原聊天**:回复「批准 / 拒绝」在绑定该会话的聊天里生效,群聊里只接受任务发起者。私聊准入只决定谁能对话,不再单独卡审批;审批不会回退到网页端,提示发送失败时按拒绝处理。
13
13
  7. **不恢复开放模式**:不再提供 `allowAllUsers` 或钉钉「配对 / 开放模式」。安全路径必须是默认路径。
14
14
 
15
15
  ## 威胁模型
16
16
 
17
17
  - 任何人私聊或在群里 @ 机器人,都可能试图驱动本机 agent。
18
18
  - 「批准」「yes」这类短文本若不做身份校验,会直接放行待处理的工具权限。
19
- - Telegram 等凭据型机器人默认接受所有私聊,必须靠白名单拦住。
19
+ - Telegram、Discord 等凭据型机器人默认接受所有私聊,必须靠白名单拦住。
20
20
 
21
21
  ## 管理面
22
22