@dingtalk-real-ai/dingtalk-connector 0.8.17 → 0.8.18-beta.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/CHANGELOG.md CHANGED
@@ -8,15 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8
8
  ## [0.8.17] - 2026-04-16
9
9
 
10
10
  ### 新增 / Added
11
- - ✨ **钉钉工作台 (DWS) CLI 集成** - 安装插件时自动安装 `dws` CLI 工具,支持 AI 表格、日历、通讯录、群聊与机器人、待办、审批、考勤、日志等钉钉产品能力;凭证自动注入,无需手动配置
11
+ - ✨ **钉钉 DWS CLI 集成** - 安装插件时自动安装 `dws` CLI 工具,支持 AI 表格、日历、通讯录、群聊与机器人、待办、审批、考勤、日志等钉钉产品能力;凭证自动注入,无需手动配置
12
12
  **DingTalk Workspace (DWS) CLI integration** - Auto-installs `dws` CLI during plugin setup, enabling AI Table, Calendar, Contacts, Chat & Bot, Todo, Approval, Attendance, Report and more; credentials injected automatically
13
13
 
14
14
  - ✨ **Agent Skills 体系** - 新增三组内置 Skill 文档:`dingtalk-channel-rules`(频道能力路由规范)、`dingtalk-troubleshoot`(常见问题排查)、`dws-cli`(DWS CLI 使用指南与产品参考),通过 `openclaw.plugin.json` 注册
15
15
  **Agent Skills system** - Added three built-in Skill document sets: `dingtalk-channel-rules` (channel capability routing), `dingtalk-troubleshoot` (troubleshooting), `dws-cli` (DWS CLI guide & product references), registered via `openclaw.plugin.json`
16
16
 
17
- - ✨ **多 Agent 协作文档** - 新增 `docs/MULTI_AGENT_COLLABORATION.md`,描述 Connector 与 DWS 的职责边界和协作模式
18
- **Multi-Agent collaboration docs** - Added `docs/MULTI_AGENT_COLLABORATION.md` describing Connector vs DWS responsibility boundary and collaboration patterns
19
-
20
17
  ### 修复 / Fixes
21
18
  - 🐛 **AI Card finishAICard QPS 限流** - `finishAICard` 的 PUT 请求现在也经过全局令牌桶限流器 `waitForToken()`,避免多会话并发结束时触发 403 QpsLimit
22
19
  **AI Card finishAICard QPS rate limiting** - `finishAICard` PUT request now goes through global token bucket `waitForToken()` to prevent 403 QpsLimit when multiple conversations finish concurrently
package/README.en.md CHANGED
@@ -25,6 +25,9 @@ This plugin provides comprehensive DingTalk integration for OpenClaw:
25
25
  | Category | Capabilities |
26
26
  |----------|-------------|
27
27
  | 💬 Messaging | Receive group/DM messages, auto-reply, send text/Markdown, @mentions |
28
+ | ✅ Tasks | Create personal tasks, check status, set deadlines |
29
+ | 📊 AI Sheets | Create sheets, read/write rows, conditional queries |
30
+ | 📅 Calendar | Calendar management, event management (create/query/modify/delete/search), attendee management, free/busy queries |
28
31
 
29
32
  Additionally, the plugin supports:
30
33
 
@@ -35,17 +38,15 @@ Additionally, the plugin supports:
35
38
  - 🖼️ **Rich Media**: Receive images/audio/file attachments, auto-upload local images
36
39
  - 🔄 **Session Management**: Multi-turn conversation context, isolated sessions for DMs/groups
37
40
 
38
- > 🚧 **Coming Soon** — The following business capabilities are under active development and launching soon! 🎉
41
+ > 🚧 **Coming Soon** — The following capabilities are under active development!
39
42
 
40
43
  | Category | Capabilities |
41
44
  |----------|-------------|
42
- | 📄 Docs | Create, append, search, and list DingTalk documents |
43
- | 📅 Calendar | Create/query events, auto-attach DingTalk meeting links, DING reminders, free/busy queries |
44
- | 📊 AI Sheets | Create sheets, read/write rows, conditional queries |
45
- | ✅ Tasks | Create personal/group tasks, check status, set deadlines |
45
+ | 🔔 DING | Send urgent DING reminders to users/groups |
46
+ | Tasks | Create group tasks, check status, set deadlines |
46
47
  | 📝 Reports | Submit daily/weekly reports, query history |
47
48
  | 📁 Drive | Upload/download files to DingTalk Drive |
48
- | 🔔 DING | Send urgent DING reminders to users/groups |
49
+ | 📄 Docs | Create, append, search, and list DingTalk documents |
49
50
 
50
51
  ---
51
52
 
package/README.md CHANGED
@@ -25,6 +25,9 @@
25
25
  | 类别 | 能力 |
26
26
  |------|------|
27
27
  | 💬 消息收发 | 接收群聊/私聊消息,自动回复,发送文本/Markdown,@成员 |
28
+ | ✅ 待办任务 | 创建个人待办,查状态,设截止时间 |
29
+ | 📊 AI 表格 | 创建表格,读写行数据,条件查询 |
30
+ | 📅 日历日程 | 日历管理、日程管理(创建/查询/修改/删除/搜索)、参会人管理、忙闲查询 |
28
31
 
29
32
  此外,插件还支持:
30
33
 
@@ -35,17 +38,15 @@
35
38
  - 🖼️ **富媒体处理**:接收图片/音频/文件附件,自动上传本地图片
36
39
  - 🔄 **会话管理**:多轮对话上下文保持,私聊/群聊会话隔离
37
40
 
38
- > 🚧 **Coming Soon** — 以下业务能力正在开发中,即将上线,敬请期待!🎉
41
+ > 🚧 **Coming Soon** — 以下能力正在开发中,敬请期待!
39
42
 
40
43
  | 类别 | 能力 |
41
44
  |------|------|
42
- | 📄 钉钉文档 | 创建、追加、搜索、列举钉钉文档 |
43
- | 📅 日历会议 | 创建/查询日程,自动带钉钉会议链接,DING 提醒,忙闲查询 |
44
- | 📊 AI 表格 | 创建表格,读写行数据,条件查询 |
45
- | ✅ 待办任务 | 创建个人/群待办,查状态,设截止时间 |
45
+ | 待办任务 | 创建群待办,查状态,设截止时间 |
46
+ | 🔔 DING 消息 | 向用户/群发送强提醒 DING |
46
47
  | 📝 日志 | 提交日报/周报,查历史日志 |
47
48
  | 📁 文件云盘 | 上传/下载文件到钉钉云盘 |
48
- | 🔔 DING 消息 | 向用户/群发送强提醒 DING |
49
+ | 📄 钉钉文档 | 创建、追加、搜索、列举钉钉文档 |
49
50
 
50
51
  ---
51
52
 
@@ -169,6 +169,32 @@ function clearStaging() {
169
169
  } catch {}
170
170
  }
171
171
 
172
+ /**
173
+ * Check if existing config has both dingtalk channels (with credentials) and bindings.
174
+ * In multi-Agent scenarios, overwriting would break the existing routing setup.
175
+ */
176
+ function hasExistingMultiAgentConfig(cfg) {
177
+ const dingtalkCfg = cfg?.channels?.[CHANNEL_ID];
178
+ if (!dingtalkCfg) return false;
179
+
180
+ // Check if channels already has credentials configured
181
+ const hasChannelCreds = Boolean(dingtalkCfg.clientId && dingtalkCfg.clientSecret);
182
+ // Also check accounts sub-keys for multi-account scenario
183
+ const hasAccountCreds = dingtalkCfg.accounts && Object.values(dingtalkCfg.accounts).some(
184
+ (acc) => acc && acc.clientId && acc.clientSecret
185
+ );
186
+ const hasCreds = hasChannelCreds || hasAccountCreds;
187
+ if (!hasCreds) return false;
188
+
189
+ // Check if bindings reference dingtalk-connector
190
+ const bindings = Array.isArray(cfg.bindings) ? cfg.bindings : [];
191
+ const hasDingtalkBindings = bindings.some(
192
+ (b) => !b?.match?.channel || String(b.match.channel) === CHANNEL_ID
193
+ );
194
+
195
+ return hasDingtalkBindings;
196
+ }
197
+
172
198
  function saveCredentials(clientId, clientSecret, { isLocal = false, pluginInstalled = true } = {}) {
173
199
  const cfg = readConfig();
174
200
 
@@ -179,6 +205,20 @@ function saveCredentials(clientId, clientSecret, { isLocal = false, pluginInstal
179
205
  const writePluginEntries = pluginInstalled || isLocal;
180
206
 
181
207
  if (writePluginEntries) {
208
+ // ── Multi-Agent protection ──
209
+ // If existing config already has dingtalk channels+credentials AND bindings,
210
+ // overwriting could break multi-Agent routing. Show credentials and let user decide.
211
+ if (hasExistingMultiAgentConfig(cfg)) {
212
+ console.log('\n' + bold('⚠ 检测到已有钉钉 channels 和 bindings 配置(多 Agent 场景)'));
213
+ console.log(dim(' 直接覆盖可能影响现有的多 Agent 路由配置,已跳过自动写入。') + '\n');
214
+ console.log(cyan(' 本次选择/创建的机器人信息:'));
215
+ console.log(green(` Client ID: ${clientId}`));
216
+ console.log(green(` Client Secret: ${clientSecret}`) + '\n');
217
+ console.log(dim(' 请自行决定是否修改 ~/.openclaw/openclaw.json 中的配置。'));
218
+ console.log(dim(' 如需新增账号,可在 channels.dingtalk-connector.accounts 下添加。') + '\n');
219
+ return;
220
+ }
221
+
182
222
  // ── channels.[CHANNEL_ID] ──
183
223
  if (!cfg.channels) cfg.channels = {};
184
224
  if (!cfg.channels[CHANNEL_ID]) cfg.channels[CHANNEL_ID] = {};
@@ -2,13 +2,13 @@
2
2
 
3
3
  ## 🎉 新版本亮点 / Highlights
4
4
 
5
- 本次版本最大亮点是 **钉钉工作台 (DWS) CLI 集成** 和 **Agent Skills 体系**,让钉钉机器人不仅能聊天,还能直接操作 AI 表格、日历、通讯录、待办、审批等钉钉产品能力。同时引入 `tsdown` 预编译构建,提升插件启动速度和兼容性。
5
+ 本次版本最大亮点是 **钉钉 DWS CLI 集成** 和 **Agent Skills 体系**,让钉钉机器人不仅能聊天,还能直接操作 AI 表格、日历、通讯录、待办、审批等钉钉产品能力。同时引入 `tsdown` 预编译构建,提升插件启动速度和兼容性。
6
6
 
7
7
  The highlight of this release is **DingTalk Workspace (DWS) CLI integration** and the **Agent Skills system**, enabling the bot to not only chat but also directly operate DingTalk products like AI Table, Calendar, Contacts, Todo, Approval, and more. Additionally, `tsdown` pre-compiled build is introduced for faster startup and better compatibility.
8
8
 
9
9
  ## ✨ 新增 / Added
10
10
 
11
- - **钉钉工作台 (DWS) CLI 集成 / DWS CLI Integration**
11
+ - **钉钉 DWS CLI 集成 / DWS CLI Integration**
12
12
  安装插件时自动安装 `dws` CLI 工具,支持 AI 表格、日历、通讯录、群聊与机器人、待办、审批、考勤、日志等钉钉产品能力。凭证自动注入,无需手动配置。可通过 `--skip-dws` 参数跳过。
13
13
  Auto-installs `dws` CLI during plugin setup, enabling AI Table, Calendar, Contacts, Chat & Bot, Todo, Approval, Attendance, Report and more. Credentials injected automatically. Use `--skip-dws` to skip.
14
14
 
@@ -23,10 +23,6 @@ The highlight of this release is **DingTalk Workspace (DWS) CLI integration** an
23
23
  - `dingtalk-troubleshoot` — Troubleshooting guide
24
24
  - `dws-cli` — DWS CLI guide with 9 product reference docs (AI Table, Calendar, Contacts, etc.)
25
25
 
26
- - **多 Agent 协作文档 / Multi-Agent Collaboration Docs**
27
- 新增 `docs/MULTI_AGENT_COLLABORATION.md`,描述 Connector 与 DWS 的协作模式。
28
- Added `docs/MULTI_AGENT_COLLABORATION.md` describing Connector vs DWS collaboration patterns.
29
-
30
26
  ## 🐛 修复 / Fixes
31
27
 
32
28
  - **AI Card finishAICard QPS 限流 / finishAICard QPS rate limiting**
@@ -70,7 +66,7 @@ The highlight of this release is **DingTalk Workspace (DWS) CLI integration** an
70
66
  ## 📥 安装升级 / Installation & Upgrade
71
67
 
72
68
  ```bash
73
- npx --yes --package @dingtalk-real-ai/dingtalk-connector dingtalk-connector install
69
+ npx -y @dingtalk-real-ai/dingtalk-connector@0.8.17 install
74
70
  ```
75
71
 
76
72
  或手动安装:
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "dingtalk-connector",
3
3
  "name": "DingTalk Channel",
4
- "version": "0.8.17",
4
+ "version": "0.8.18-beta.0",
5
5
  "description": "Official OpenClaw DingTalk channel plugin | 钉钉官方 OpenClaw 插件",
6
6
  "author": "DingTalk Real Team",
7
7
  "main": "index.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dingtalk-real-ai/dingtalk-connector",
3
- "version": "0.8.17",
3
+ "version": "0.8.18-beta.0",
4
4
  "description": "Official OpenClaw DingTalk channel plugin | 钉钉官方 OpenClaw 插件",
5
5
  "type": "module",
6
6
  "exports": {
@@ -99,7 +99,7 @@
99
99
  "mammoth": "^1.8.0"
100
100
  },
101
101
  "peerDependencies": {
102
- "openclaw": ">=2026.3.23"
102
+ "openclaw": ">=2026.4.9"
103
103
  },
104
104
  "peerDependenciesMeta": {
105
105
  "openclaw": {
@@ -138,7 +138,7 @@
138
138
  "@types/node": "^20.19.37",
139
139
  "@vitest/coverage-v8": "^2.0.0",
140
140
  "@vitest/ui": "^2.1.9",
141
- "openclaw": ">=2026.3.23",
141
+ "openclaw": "^2026.4.9",
142
142
  "tsdown": "^0.21.4",
143
143
  "typescript": "^5.6.0",
144
144
  "vitest": "^2.1.9"
@@ -1,116 +0,0 @@
1
- # 钉钉多 Agent 协作指南 (Multi-Agent Collaboration)
2
-
3
- 本文档旨在介绍如何在 DingTalk OpenClaw Connector 环境下实现多 Agent 的支持与深度协作。
4
-
5
- ---
6
-
7
- ## 一、多 Agent 能力支持 (Support)
8
-
9
- 多 Agent 支持是指将同一个钉钉连接器实例(Connector)连接到多个专业的 AI Agent,根据会话来源(如特定的用户或特定的群聊)将消息路由到对应的 Agent 处理。
10
-
11
- ### 1.1 核心路由逻辑
12
- Connector 通过读取 `openclaw.json` 中的 `bindings` 配置来决定消息去向。
13
- - **配置位置**: `openclaw.json` -> `bindings`
14
- - **匹配维度**: 账号 ID (`accountId`)、会话类型 (`peer.kind`)、具体 ID (`peer.id`)。
15
- - **代码实现参考**: [message-handler.ts](file:///Users/xinzhizhu/dingtalk-openclaw-connector/src/core/message-handler.ts) 中的 `Agent 路由解析`。
16
-
17
- ### 1.2 配置示例
18
- 以下示例展示了如何将“客服账号”路由到 `support-agent`,将“技术群”路由到 `dev-agent`:
19
-
20
- ```json
21
- {
22
- "bindings": [
23
- {
24
- "agentId": "dev-agent",
25
- "match": {
26
- "channel": "dingtalk-connector",
27
- "peer": { "kind": "group", "id": "cid_tech_group_id_xxx" }
28
- }
29
- },
30
- {
31
- "agentId": "support-agent",
32
- "match": {
33
- "channel": "dingtalk-connector",
34
- "accountId": "customer_service_bot"
35
- }
36
- }
37
- ],
38
- "defaultAgent": "main"
39
- }
40
- ```
41
-
42
- > [!TIP]
43
- > 详见 [AGENT_ROUTING.md](file:///Users/xinzhizhu/dingtalk-openclaw-connector/docs/AGENT_ROUTING.md) 获取完整的路由匹配与 Session 隔离规范。
44
-
45
- ---
46
-
47
- ## 二、协作模式一:基于钉钉文档的状态共享 (State Sharing)
48
-
49
- 多 Agent 协作最常见的场景是“信息接力”。例如,Agent A 负责分析需求并写入文档,Agent B 随后读取该文档并生成代码。
50
-
51
- ### 2.1 协作原理
52
- 利用 `docs.*` 系列工具,Agent 可以打破会话上下文的限制,通过外部媒介(钉钉文档)进行异步协作。
53
- - **能力提供者**: [docs.ts](file:///Users/xinzhizhu/dingtalk-openclaw-connector/src/docs.ts)
54
- - **核心工具**:
55
- - `docs.create`: 创建协作起点。
56
- - `docs.append`: 追加处理进度或中间产物。
57
- - `docs.read`: 获取协作文档的最新内容。
58
-
59
- ### 2.2 协作流程示例
60
- 1. **Agent A (项目经理)**: 收到群聊指令,调用 `docs.create` 创建《项目需求.md》。
61
- 2. **Agent B (架构师)**: 监听或被提及后,调用 `docs.read` 读取该文档,并使用 `docs.append` 补充架构方案。
62
- 3. **用户**: 在钉钉中直接看到文档链接并参与评论。
63
-
64
- ---
65
-
66
- ## 三、协作模式二:基于 Gateway Methods 的跨 Agent 通信
67
-
68
- Connector 注册了一系列 RPC 方法(Gateway Methods),允许一个 Agent 间接地触达另一个 Agent 的用户或环境。
69
-
70
- ### 3.1 关键 RPC 方法
71
- - **`dingtalk-connector.sendToGroup`**: 允许 Agent 跨越自身绑定的群聊,向其他群发送通知。
72
- - **`dingtalk-connector.docs.create/append`**: 允许 Agent 在没有直接文档访问权限的情况下,通过 Connector 代理操作。
73
-
74
- ### 3.2 协作场景:自动化报警接力
75
- 1. **运维 Agent**: 检测到系统异常,调用 `gateway.call('dingtalk-connector.sendToGroup', { ... })` 向“紧急处理群”发送报警。
76
- 2. **值班 Agent**: 在该群接收到消息(由于 bindings 配置),开始介入处理。
77
-
78
- ---
79
-
80
- ## 四、实战:构建多 Agent 协作工作流
81
-
82
- 以下是一个完整的配置片段,展示了多账号与多 Agent 的配合:
83
-
84
- ```json5
85
- {
86
- "agents": {
87
- "list": [
88
- { "id": "manager", "name": "项目主管" },
89
- { "id": "executor", "name": "执行专家" }
90
- ]
91
- },
92
- "channels": {
93
- "dingtalk-connector": {
94
- "accounts": {
95
- "bot_a": { "clientId": "...", "clientSecret": "..." },
96
- "bot_b": { "clientId": "...", "clientSecret": "..." }
97
- }
98
- }
99
- },
100
- "bindings": [
101
- // bot_a 接收所有指令,由 manager 处理
102
- { "agentId": "manager", "match": { "accountId": "bot_a" } },
103
- // 所有的执行类任务路由到 executor
104
- { "agentId": "executor", "match": { "peer": { "kind": "group", "id": "executor_group_id" } } }
105
- ]
106
- }
107
- ```
108
-
109
- ### 协作建议
110
- - **使用统一的 Workspace**: 确保协作的 Agent 能够访问到相同的本地媒体文件路径(通过 `resolveAgentWorkspaceDir` 实现)。
111
- - **统一 SessionKey**: 如需强耦合,可配置 `sharedMemoryAcrossConversations: true` 共享长期记忆。
112
-
113
- ---
114
-
115
- > [!IMPORTANT]
116
- > 本文档为初版,由 DingTalk Real Team持续维护。如有问题请提交 Issue。