@xmanrui/dsh-im 2.2.0 → 2.3.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 +6 -2
- package/README.md +6 -2
- package/lib/client.js +2 -2
- package/lib/index.js +217 -189
- package/package.json +1 -1
- package/plugin-src/client/channels/whatsapp/index.js +1 -1
- package/plugin-src/client/i18n.js +1 -1
- package/src/channels/dingtalk/dingtalk-bridge.mjs +95 -3
- package/src/channels/discord/discord-runtime.mjs +3 -0
- package/src/channels/feishu/bridge.mjs +127 -4
- package/src/channels/feishu/feishu-cards.mjs +8 -0
- package/src/channels/qq/qq-bridge.mjs +98 -8
- package/src/channels/shared/batch-input.mjs +209 -0
- package/src/channels/shared/i18n-en/feishu.mjs +3 -2
- package/src/channels/shared/i18n-en/shared-c.mjs +49 -0
- package/src/channels/shared/text-harness-bridge.mjs +111 -2
- package/src/channels/slack/slack-runtime.mjs +1 -0
- package/src/channels/telegram/telegram-runtime.mjs +4 -0
- package/src/channels/wecom/wecom-bridge.mjs +101 -4
- package/src/channels/weixin/weixin-bridge.mjs +100 -3
- package/src/channels/weixin/weixin-runtime.mjs +18 -1
- package/src/channels/whatsapp/whatsapp-runtime.mjs +29 -6
package/README.en.md
CHANGED
|
@@ -128,7 +128,7 @@ Use the proxy URL required by your network and restart the Host after changing i
|
|
|
128
128
|
|
|
129
129
|
Each Telegram bot has its own access-mode control on its bot card. Existing and newly connected bots both default to **Compatible mode**: DMs receive replies, while group messages require a mention of or reply to the bot. Restrictions apply only after explicitly switching that bot to **Safe mode (private-chat allowlist)**. Safe mode ignores every group message and admits only numeric User IDs in that bot's allowlist. Enter one ID per line. Switching back to Compatible mode retains the allowlist without enforcing it, so it is available when Safe mode is enabled again. An empty allowlist in Safe mode rejects all inbound messages for that bot.
|
|
130
130
|
|
|
131
|
-
Each WhatsApp bot also has its own access mode. Existing bots migrate to **Only me**, which is also the default for newly linked bots and accepts only self-chat messages from the linked account. **Selected contacts** additionally accepts direct messages from allowlisted phone numbers and ignores groups. Enter one number with its country or region code per line; a leading `+` is optional. **Open responses**
|
|
131
|
+
Each WhatsApp bot also has its own access mode. Existing bots migrate to **Only me**, which is also the default for newly linked bots and accepts only self-chat messages from the linked account. **Selected contacts** additionally accepts direct messages from allowlisted phone numbers and ignores groups. Enter one number with its country or region code per line; a leading `+` is optional. **Open responses** accepts all direct messages, group messages sent by the linked account, and mentions of or replies to that account from other group members; this also lets an owner-only group act as a separate conversation. Switching modes retains the allowlist. An empty Selected contacts allowlist behaves like Only me, and rejected messages are ignored silently.
|
|
132
132
|
|
|
133
133
|
## Bot commands
|
|
134
134
|
|
|
@@ -150,6 +150,9 @@ Each WhatsApp bot also has its own access mode. Existing bots migrate to **Only
|
|
|
150
150
|
| `/preset --default` | Clear this bot's explicit selection so later new Sessions follow the Host default. |
|
|
151
151
|
| `/stop` | Immediately stop this chat's running task while preserving work that has not started. |
|
|
152
152
|
| `/steer <additional instruction>` | Inject an additional instruction into this chat's running task. |
|
|
153
|
+
| `/batch` | Start batch input in a direct chat and collect up to 10 text messages. |
|
|
154
|
+
| `/send` | Submit the collected messages, in order, as one input. |
|
|
155
|
+
| `/cancel` | Cancel batch input and discard its collected messages. |
|
|
153
156
|
| `/compact` | Immediately compact older context in the Session bound to the current chat. |
|
|
154
157
|
| `/workspace <absolute workspace path>` | Switch the current bot's Harness workspace. |
|
|
155
158
|
| `/workspacelist` | List workspace absolute paths that still exist on the current Harness Host. |
|
|
@@ -177,6 +180,7 @@ If the Slack desktop app has no native Slash Command registered with the same na
|
|
|
177
180
|
- An Agent Preset change is bot-wide: it affects future new Sessions in every chat for this bot, but never modifies, stops, unbinds, or rebuilds an existing Session and never runs `/new` automatically. If this chat already has a Session, ordinary messages keep using it; the first ordinary message after `/new` creates a Session with the new setting. Presets can still be queried or changed while a task is running or awaiting interaction because the command does not touch that Session.
|
|
178
181
|
- `/stop` and `/steer` control only a running task started by this chat. Even when multiple chats bind the same Session, they do not intentionally control another chat's task. `/stop` does not delete the Session or its history, preserves queued work that has not started, and is safe to repeat.
|
|
179
182
|
- `/steer` accepts text only, including multiple lines. It neither creates another Session nor starts a second task. Send an ordinary message when no task is running; while an approval or question is pending, answer it first or use `/stop`.
|
|
183
|
+
- `/batch`, `/send`, and `/cancel` are available only in a direct chat with the bot. After `/batch`, subsequent text-only messages are held temporarily, up to 10 messages. The tenth is collected and prompts you to submit; later messages are rejected and the batch is never submitted automatically. `/send` processes the collected messages in their original order as one input, while `/cancel` discards them. Images, files, and other commands are not collected. An unsubmitted batch is lost if the bot restarts. Ordinary chat behavior is unchanged when batch input is not active.
|
|
180
184
|
- `/compact` acts only on the Harness Session already bound to the current chat and is never sent to the model. The bot reports the applicable status when the chat has no Session yet, the Session is generating a reply, or there is no compactable history.
|
|
181
185
|
- The path must be an existing absolute directory. The bot returns an actionable error and the correct usage when validation fails.
|
|
182
186
|
- `/workspacelist` takes no arguments. It combines the Harness global registry with the current bot's path. When that current path still exists and is safe to display, it appears first and is marked as current. Any listed path can be copied directly into `/workspace`.
|
|
@@ -185,7 +189,7 @@ If the Slack desktop app has no native Slash Command registered with the same na
|
|
|
185
189
|
- `/session` accepts exactly one Session ID obtained from `/sessionlist`. It neither creates a session nor immediately prompts the model; later messages in the current chat continue the bound session. Regular archived sessions can be bound without being unarchived, while subagent sessions cannot be bound.
|
|
186
190
|
- `/session` locates the session's unique workspace automatically. Binding inside the current workspace replaces only this chat's mapping. A cross-workspace binding switches the bot workspace, clears the old session mappings for all of that bot's chats, and then binds this chat, so it affects the bot's other chats. A reply already being generated may still finish.
|
|
187
191
|
- Workspace switches and session bindings only clear or replace dsh-im chat mappings. They never delete, empty, or archive old Session contents; an old Session can still be listed and bound again.
|
|
188
|
-
- Any user admitted by the current channel access policy can run these commands; there is no separate administrator role. Telegram Compatible mode follows the original DM and group mention/reply rules, while Safe mode admits only allowlisted private users. WhatsApp Only me accepts self-chat only, Selected contacts accepts self-chat plus allowlisted direct messages, and Open responses accepts every direct message
|
|
192
|
+
- Any user admitted by the current channel access policy can run these commands; there is no separate administrator role. Telegram Compatible mode follows the original DM and group mention/reply rules, while Safe mode admits only allowlisted private users. WhatsApp Only me accepts self-chat only, Selected contacts accepts self-chat plus allowlisted direct messages, and Open responses accepts every direct message, group messages from the linked account, and mentions or replies from other group members.
|
|
189
193
|
- Agent Preset names and IDs come from the same Harness Host, and any command-authorized user can change the Preset used by all future new Sessions across this bot's chats. Expose `/presetlist` and `/preset` only to trusted users.
|
|
190
194
|
- The list comes from the Harness Host's global registry and can include local absolute paths for other bots, other channels, or non-IM projects. Restrict the bot's visibility to trusted users.
|
|
191
195
|
- Session results also come from the global Harness Host. Session IDs and titles can belong to other bots, other channels, or non-IM projects, and may contain sensitive metadata. Enable these commands only when every user in the bot's visibility scope is trusted.
|
package/README.md
CHANGED
|
@@ -131,7 +131,7 @@ dsh web
|
|
|
131
131
|
|
|
132
132
|
每个 Telegram 机器人都可以在自己的卡片中切换访问模式。旧机器人和新接入机器人均默认使用**兼容模式**:私聊直接响应,群聊仅在提及机器人或回复机器人消息时响应。只有主动切换到**安全模式(私聊白名单)**后,机器人才会忽略全部群聊,并只接受该机器人白名单中的数字 User ID。白名单每行一个 ID、按机器人独立保存;切回兼容模式时会保留但不使用,再切回安全模式即可继续使用。安全模式的空白名单会拒绝该机器人的所有入站消息。
|
|
133
133
|
|
|
134
|
-
每个 WhatsApp 机器人也有独立的访问模式。旧机器人升级后和新接入机器人都默认使用**仅自己模式**,只响应已绑定账号的自聊消息。**指定联系人模式**额外接受白名单电话号码的私聊并忽略群聊;号码需包含国家或地区代码,每行一个,可带开头的
|
|
134
|
+
每个 WhatsApp 机器人也有独立的访问模式。旧机器人升级后和新接入机器人都默认使用**仅自己模式**,只响应已绑定账号的自聊消息。**指定联系人模式**额外接受白名单电话号码的私聊并忽略群聊;号码需包含国家或地区代码,每行一个,可带开头的 `+`。**开放响应模式**响应所有私聊、已绑定账号自己发出的群聊消息,以及其他群成员对该账号的提及或回复;因此也可以把“仅自己”的群当作独立会话使用。切换模式会保留白名单;指定联系人模式的空白名单等同于仅自己模式。未授权消息会被静默忽略。
|
|
135
135
|
|
|
136
136
|
## 机器人命令
|
|
137
137
|
|
|
@@ -153,6 +153,9 @@ dsh web
|
|
|
153
153
|
| `/preset --default` | 清除当前机器人的显式选择,让后续新 Session 跟随 Host 默认。 |
|
|
154
154
|
| `/stop` | 立即停止当前聊天正在运行的任务,并保留尚未开始的排队消息。 |
|
|
155
155
|
| `/steer <补充指令>` | 把补充指令立即加入当前聊天正在运行的任务。 |
|
|
156
|
+
| `/batch` | 在私聊中开启批量输入,最多收集 10 条纯文字消息。 |
|
|
157
|
+
| `/send` | 将已收集的消息按原顺序作为一次输入提交。 |
|
|
158
|
+
| `/cancel` | 取消批量输入并丢弃已收集的消息。 |
|
|
156
159
|
| `/compact` | 立即压缩当前聊天绑定会话的较早上下文。 |
|
|
157
160
|
| `/workspace <工作区绝对路径>` | 切换当前机器人的 Harness 工作区。 |
|
|
158
161
|
| `/workspacelist` | 列出当前 Harness Host 上仍然存在的工作区绝对路径。 |
|
|
@@ -180,6 +183,7 @@ Slack 桌面端若未注册同名的原生 Slash Command,会拦截直接以 `/
|
|
|
180
183
|
- Agent Preset 修改是机器人级配置,会影响该机器人所有聊天以后创建的新 Session,但不会修改、停止、解绑或重建已有 Session,也不会自动执行 `/new`。若当前聊天已有会话,继续发送消息仍使用原 Session;发送 `/new` 后的下一条普通消息才会按新设置创建 Session。任务正在运行或等待交互时也可查询或修改 Preset,因为命令不会触碰当前 Session。
|
|
181
184
|
- `/stop` 和 `/steer` 只控制当前聊天自己发起的运行任务,即使多个聊天绑定同一个 Session,也不会有意控制其他聊天的任务。`/stop` 不删除会话或历史,并保留尚未开始的排队消息;重复发送是安全的。
|
|
182
185
|
- `/steer` 只接受文字,可包含多行;它不会创建新会话或第二个任务。没有运行任务时请直接发送普通消息;等待审批或问题回答时请先处理交互,或使用 `/stop`。
|
|
186
|
+
- `/batch`、`/send` 和 `/cancel` 仅在与机器人的私聊中可用。发送 `/batch` 后,接下来的纯文字消息会暂存,最多 10 条;第 10 条仍会收录并提示提交,之后的消息不会收录,也不会自动提交。发送 `/send` 后,机器人会按原顺序将整批内容作为一次输入处理;发送 `/cancel` 会直接丢弃当前批次。图片、文件和其他命令不会被收录。机器人重启会丢失尚未提交的批次。未进入批量输入模式时,普通聊天流程不变。
|
|
183
187
|
- `/compact` 只作用于当前聊天已经绑定的 Harness 会话,不会把命令发送给模型。当前聊天尚未创建会话、会话正在生成回复或没有可压缩历史时,机器人会直接返回对应状态。
|
|
184
188
|
- 只接受已经存在的绝对目录;路径无效时机器人会返回具体提示和正确用法。
|
|
185
189
|
- `/workspacelist` 不需要参数。它合并 Harness 全局登记项与当前机器人的路径;当前路径仍存在且可安全显示时会排在首位并标记为“当前”。结果可直接复制到 `/workspace` 命令。
|
|
@@ -188,7 +192,7 @@ Slack 桌面端若未注册同名的原生 Slash Command,会拦截直接以 `/
|
|
|
188
192
|
- `/session` 只接受一个由 `/sessionlist` 获得的 Session ID。它不会新建会话或立即向模型发送消息;绑定成功后,当前聊天的后续消息会继续该会话。普通归档会话可以绑定但不会自动取消归档,子代理会话不能绑定。
|
|
189
193
|
- `/session` 会自动定位会话唯一所属的工作区。同工作区绑定只替换当前聊天的映射;跨工作区绑定会切换该机器人的工作区、清除该机器人所有聊天的旧会话映射,再绑定当前聊天,因此会影响该机器人的其他聊天。已经开始生成的回复仍可完成。
|
|
190
194
|
- 工作区切换和会话绑定只会清除或替换 dsh-im 的聊天映射,不会删除、清空或归档任何旧 Session 内容;旧 Session 仍可再次列出和绑定。
|
|
191
|
-
- 任何通过当前渠道访问策略的用户都可以执行这些命令,不另行区分管理员和普通用户。Telegram 兼容模式遵循原有私聊及群聊提及/回复规则;安全模式只允许当前机器人白名单中的私聊用户执行。WhatsApp
|
|
195
|
+
- 任何通过当前渠道访问策略的用户都可以执行这些命令,不另行区分管理员和普通用户。Telegram 兼容模式遵循原有私聊及群聊提及/回复规则;安全模式只允许当前机器人白名单中的私聊用户执行。WhatsApp 仅自己模式只接受自聊,指定联系人模式接受自聊和白名单私聊,开放响应模式接受所有私聊、已绑定账号自己发出的群聊消息,以及其他群成员的提及或回复。
|
|
192
196
|
- Agent Preset 名称和 ID 来自同一个 Harness Host,且任何有命令权限的用户都能修改该机器人所有聊天未来新 Session 的 Preset;请只向可信用户开放 `/presetlist` 和 `/preset`。
|
|
193
197
|
- 工作区列表来自 Harness Host 的全局登记信息,可能包含其他机器人、其他渠道或非 IM 项目的本机绝对路径。请将机器人可见范围限制给可信用户。
|
|
194
198
|
- 会话列表同样来自该全局 Harness Host;会话 ID 和标题可能属于其他机器人、其他渠道或非 IM 项目,并可能包含敏感元数据。开放命令前请确保所有可见用户都可信。
|
package/lib/client.js
CHANGED
|
@@ -564,7 +564,7 @@ var EN = Object.freeze({
|
|
|
564
564
|
"\u5DF2\u751F\u6548\uFF1A": "Active: ",
|
|
565
565
|
"\u53EA\u54CD\u5E94\u5DF2\u7ED1\u5B9A WhatsApp \u8D26\u53F7\u7684\u81EA\u804A\u6D88\u606F\u3002": "Only respond to self-chat messages from the linked WhatsApp account.",
|
|
566
566
|
"\u54CD\u5E94\u81EA\u804A\u548C\u767D\u540D\u5355\u8054\u7CFB\u4EBA\u7684\u79C1\u804A\uFF0C\u5FFD\u7565\u7FA4\u804A\u3002": "Respond to self-chat and allowlisted direct messages; ignore group messages.",
|
|
567
|
-
"\u54CD\u5E94\u6240\u6709\u79C1\u804A\uFF0C\u4EE5\u53CA\u7FA4\
|
|
567
|
+
"\u54CD\u5E94\u6240\u6709\u79C1\u804A\u3001\u5DF2\u7ED1\u5B9A\u8D26\u53F7\u81EA\u5DF1\u53D1\u51FA\u7684\u7FA4\u804A\u6D88\u606F\uFF0C\u4EE5\u53CA\u5176\u4ED6\u7FA4\u6210\u5458\u7684\u63D0\u53CA\u6216\u56DE\u590D\u3002": "Respond to all direct messages, group messages sent by the linked account, and mentions or replies from other group members.",
|
|
568
568
|
"\u5141\u8BB8\u79C1\u804A\u7684 WhatsApp \u7535\u8BDD\u53F7\u7801": "WhatsApp phone numbers allowed to send direct messages",
|
|
569
569
|
"\u6BCF\u884C\u4E00\u4E2A\u542B\u56FD\u5BB6\u6216\u5730\u533A\u4EE3\u7801\u7684\u53F7\u7801": "One number with country or region code per line",
|
|
570
570
|
"\u53EF\u4EE5\u5305\u542B\u5F00\u5934\u7684 +\uFF0C\u4FDD\u5B58\u65F6\u4F1A\u81EA\u52A8\u79FB\u9664\u3002": "A leading + is allowed and removed when saved.",
|
|
@@ -9351,7 +9351,7 @@ function WhatsappAccessSettings({ account, busy = false, onSave }) {
|
|
|
9351
9351
|
"span",
|
|
9352
9352
|
{ className: "dwa-accessTooltipItem" },
|
|
9353
9353
|
h2("strong", null, "\u5F00\u653E\u54CD\u5E94\u6A21\u5F0F"),
|
|
9354
|
-
h2("span", null, "\u54CD\u5E94\u6240\u6709\u79C1\u804A\uFF0C\u4EE5\u53CA\u7FA4\
|
|
9354
|
+
h2("span", null, "\u54CD\u5E94\u6240\u6709\u79C1\u804A\u3001\u5DF2\u7ED1\u5B9A\u8D26\u53F7\u81EA\u5DF1\u53D1\u51FA\u7684\u7FA4\u804A\u6D88\u606F\uFF0C\u4EE5\u53CA\u5176\u4ED6\u7FA4\u6210\u5458\u7684\u63D0\u53CA\u6216\u56DE\u590D\u3002")
|
|
9355
9355
|
)
|
|
9356
9356
|
)
|
|
9357
9357
|
)
|