@dingtalk-real-ai/dingtalk-connector 0.8.6 → 0.8.8

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 (73) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.en.md +59 -4
  3. package/README.md +59 -4
  4. package/docs/DEAP_AGENT_GUIDE.en.md +115 -0
  5. package/docs/DEAP_AGENT_GUIDE.md +115 -0
  6. package/docs/images/image-5.png +0 -0
  7. package/docs/images/image-6.png +0 -0
  8. package/docs/images/image-7.png +0 -0
  9. package/install-npm.sh +167 -0
  10. package/openclaw.plugin.json +1 -1
  11. package/package.json +8 -4
  12. package/skills/dws/SKILL.md +124 -0
  13. package/skills/dws/references/error-codes.md +93 -0
  14. package/skills/dws/references/field-rules.md +105 -0
  15. package/skills/dws/references/global-reference.md +36 -0
  16. package/skills/dws/references/intent-guide.md +179 -0
  17. package/skills/dws/references/products/aiapp.md +412 -0
  18. package/skills/dws/references/products/aitable-record-ops.md +135 -0
  19. package/skills/dws/references/products/aitable.md +511 -0
  20. package/skills/dws/references/products/attendance.md +93 -0
  21. package/skills/dws/references/products/calendar.md +217 -0
  22. package/skills/dws/references/products/chat.md +297 -0
  23. package/skills/dws/references/products/contact.md +108 -0
  24. package/skills/dws/references/products/ding.md +57 -0
  25. package/skills/dws/references/products/doc.md +371 -0
  26. package/skills/dws/references/products/drive.md +140 -0
  27. package/skills/dws/references/products/mail.md +109 -0
  28. package/skills/dws/references/products/minutes.md +204 -0
  29. package/skills/dws/references/products/oa.md +180 -0
  30. package/skills/dws/references/products/report.md +164 -0
  31. package/skills/dws/references/products/simple.md +110 -0
  32. package/skills/dws/references/products/todo.md +146 -0
  33. package/skills/dws/references/products/workbench.md +39 -0
  34. package/skills/dws/references/url-patterns.md +12 -0
  35. package/skills/dws/scripts/aiapp_create_and_poll.py +138 -0
  36. package/skills/dws/scripts/attendance_my_record.py +91 -0
  37. package/skills/dws/scripts/attendance_team_shift.py +89 -0
  38. package/skills/dws/scripts/bot_broadcast.py +112 -0
  39. package/skills/dws/scripts/bulk_add_fields.py +250 -0
  40. package/skills/dws/scripts/calendar_free_slot_finder.py +195 -0
  41. package/skills/dws/scripts/calendar_schedule_meeting.py +159 -0
  42. package/skills/dws/scripts/calendar_today_agenda.py +132 -0
  43. package/skills/dws/scripts/chat_export_messages.py +136 -0
  44. package/skills/dws/scripts/chat_history_with_user.py +142 -0
  45. package/skills/dws/scripts/contact_dept_members.py +110 -0
  46. package/skills/dws/scripts/doc_create_and_write.py +112 -0
  47. package/skills/dws/scripts/drive_tree_list.py +124 -0
  48. package/skills/dws/scripts/finance_daily_cashflow.py +70 -0
  49. package/skills/dws/scripts/finance_expense_flow.py +128 -0
  50. package/skills/dws/scripts/import_records.py +330 -0
  51. package/skills/dws/scripts/mail_send_with_cc.py +122 -0
  52. package/skills/dws/scripts/mail_unread_summary.py +114 -0
  53. package/skills/dws/scripts/minutes_extract_todos.py +110 -0
  54. package/skills/dws/scripts/minutes_recent_summary.py +114 -0
  55. package/skills/dws/scripts/oa_batch_approve.py +136 -0
  56. package/skills/dws/scripts/oa_pending_review.py +118 -0
  57. package/skills/dws/scripts/report_inbox_today.py +114 -0
  58. package/skills/dws/scripts/todo_batch_create.py +159 -0
  59. package/skills/dws/scripts/todo_daily_summary.py +169 -0
  60. package/skills/dws/scripts/todo_overdue_check.py +122 -0
  61. package/skills/dws/scripts/upload_attachment.py +190 -0
  62. package/src/channel.ts +23 -2
  63. package/src/core/connection.ts +37 -14
  64. package/src/core/message-handler.ts +20 -43
  65. package/src/core/provider.ts +4 -0
  66. package/src/onboarding.ts +27 -61
  67. package/src/reply-dispatcher.ts +101 -146
  68. package/src/sdk/helpers.ts +7 -2
  69. package/src/services/media/common.ts +3 -2
  70. package/src/services/media.ts +34 -32
  71. package/src/utils/constants.ts +0 -3
  72. package/src/utils/session.ts +3 -1
  73. package/src/utils/utils-legacy.ts +15 -4
package/CHANGELOG.md CHANGED
@@ -5,6 +5,46 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.8.8] - 2026-03-29
9
+
10
+ ### 修复 / Fixes
11
+ - 🐛 **多 block 流式响应产生多条独立气泡** ([#369](https://github.com/DingTalk-Real-AI/dingtalk-openclaw-connector/issues/369)) - 重构 `startStreaming` 并发控制逻辑,从 `isCreatingCard` 布尔标志改为 `cardCreationPromise`,彻底消除多 block 响应场景下每个 block 新建独立 AI Card 气泡的问题
12
+ **Multi-block streaming response creates multiple bubbles** - Refactored `startStreaming` concurrency control from boolean flag to `cardCreationPromise`, eliminating independent AI Card bubbles per block in multi-block responses
13
+
14
+ - 🐛 **Web UI Connected / Last inbound 显示 n/a** - 新增 `onStatusChange` 回调在连接建立/断开/收到消息时上报状态字段;补全 `buildSessionContext` 中 `conversationId` 和 `groupSubject` 字段透传
15
+ **Web UI shows n/a for Connected and Last inbound** - Added `onStatusChange` callback to report status fields on connection events; fixed `buildSessionContext` field passthrough
16
+
17
+ - 🐛 **AI Card 函数调用参数错误** - 修复 `reply-dispatcher.ts` 中 `createAICardForTarget`、`streamAICard`、`finishAICard` 参数从 `params.runtime` 改为 `account.config/log`
18
+ **AI Card function call parameter error** - Fixed parameters in `reply-dispatcher.ts` from `params.runtime` to `account.config/log`
19
+
20
+ - 🐛 **sendFileProactive 参数错误导致文件发送失败** - 修复 `processFileMarkers` 和 `processRawMediaPaths` 错误传入 `downloadUrl`,改为正确的 `cleanMediaId`
21
+ **File sending failure due to wrong sendFileProactive parameter** - Fixed incorrect `downloadUrl` parameter, now correctly uses `cleanMediaId`
22
+
23
+ - 🐛 **纯多账号配置下 probe 被跳过** ([#381](https://github.com/DingTalk-Real-AI/dingtalk-openclaw-connector/issues/381)) - `getStatus()` 改用 `resolveDingtalkAccount()` 统一获取账号信息,修复纯多账号配置下状态显示不准确的问题
24
+ **Probe skipped in pure multi-account config** - `getStatus()` now uses `resolveDingtalkAccount()` for unified account resolution
25
+
26
+ ### 改进 / Improvements
27
+ - ✅ **音频时长提取安全性改进** ([#134](https://github.com/DingTalk-Real-AI/dingtalk-openclaw-connector/issues/134)) - `extractAudioDuration` 改用 `fluent-ffmpeg` 的 `ffprobe` API,消除安全扫描误报
28
+ **Audio duration extraction security improvement** - Changed to `fluent-ffmpeg` `ffprobe` API, eliminating security scan false positives
29
+
30
+ - ✅ **SDK 接口迁移** - `onboarding.ts` 类型引用迁移到新版 `ChannelSetupWizardAdapter`,导入路径更新为 `openclaw/plugin-sdk/setup`
31
+ **SDK interface migration** - Migrated to `ChannelSetupWizardAdapter` and updated import path to `openclaw/plugin-sdk/setup`
32
+
33
+ ## [0.8.7] - 2026-03-26
34
+
35
+ ### 修复 / Fixes
36
+ - 🐛 **账号 ID 大小写敏感修复** - 修复 `normalizeAccountId` 函数强制将账号 ID 转为小写(`.toLowerCase()`)导致驼峰命名账号(如 `zhizaoDashuIP`)无法匹配配置的问题。现在账号 ID 仅做 `trim()` 处理,保留原始大小写,与配置文件中的 key 严格匹配
37
+ **Account ID case-sensitivity fix** - Fixed `normalizeAccountId` forcibly lowercasing account IDs, which caused camelCase account IDs (e.g., `zhizaoDashuIP`) to fail configuration lookup. Account IDs are now only trimmed, preserving original casing for strict matching against config keys
38
+
39
+ - 🐛 **WebSocket 连接代理控制统一** - 修复 `src/core/connection.ts` 中 WebSocket 连接未遵循 `DINGTALK_FORCE_PROXY` 环境变量的问题,现在与 HTTP 请求保持一致的代理控制逻辑
40
+ **Unified proxy control for WebSocket connections** - Fixed WebSocket connections not respecting the `DINGTALK_FORCE_PROXY` environment variable; proxy control is now consistent with HTTP requests
41
+
42
+ - 🐛 **媒体下载代理控制统一** - 修复 `src/core/message-handler.ts` 中图片/文件下载时代理配置与 HTTP 客户端不一致的问题,确保所有媒体下载请求统一遵循代理控制策略
43
+ **Unified proxy control for media downloads** - Fixed inconsistent proxy configuration for image/file downloads; all media download requests now follow the unified proxy control policy
44
+
45
+ - 🐛 **多账号消息去重误判** - 修复多账号(多机器人)场景下,同一条群消息 @多个机器人时,第二个机器人因去重缓存未按账号隔离,误将消息判定为重复而跳过处理的问题。`checkAndMarkDingtalkMessage` 的去重 key 现在带有 `accountId` 前缀,不同机器人账号的去重缓存完全隔离
46
+ **Multi-account message deduplication false positive** - Fixed an issue where a group message mentioning multiple bots caused the second bot to skip processing due to a shared deduplication cache. The deduplication key now includes an `accountId` prefix, fully isolating each bot's cache
47
+
8
48
  ## [0.8.6] - 2026-03-24
9
49
 
10
50
  ### 改进 / Improvements
package/README.en.md CHANGED
@@ -19,6 +19,7 @@
19
19
  - [Configuration](#configuration)
20
20
  - [Troubleshooting](#troubleshooting)
21
21
  - [Advanced Topics](#advanced-topics)
22
+ - [DingTalk DEAP Agent Integration](docs/DEAP_AGENT_GUIDE.en.md)
22
23
  - [License](#license)
23
24
 
24
25
  ---
@@ -61,19 +62,67 @@ Whenever you see `~/.openclaw/openclaw.json` below, it is equivalent to the abov
61
62
 
62
63
  ### Step 1: Install the Plugin
63
64
 
65
+ #### Method A: Install via npm (Recommended)
66
+
64
67
  ```bash
65
- # Recommended: Install from npm
66
68
  openclaw plugins install @dingtalk-real-ai/dingtalk-connector
69
+ ```
70
+
71
+ #### Method B: Install from Local Source
72
+
73
+ If you want to develop or modify the plugin, clone the repository first:
74
+
75
+ ```bash
76
+ # 1. Clone the plugin repository
77
+ git clone https://github.com/DingTalk-Real-AI/dingtalk-openclaw-connector.git
78
+ cd dingtalk-openclaw-connector
79
+
80
+ # 2. Install dependencies (required)
81
+ npm install
82
+
83
+ # 3. Install in link mode (changes take effect immediately)
84
+ openclaw plugins install -l .
85
+ ```
86
+
87
+ #### Method C: Manual Installation
88
+
89
+ 1. Download or copy this repository to `~/.openclaw/extensions/dingtalk-connector`.
90
+ 2. Make sure it contains `index.ts`, `openclaw.plugin.json`, and `package.json`.
91
+ 3. Run `npm install` in that directory to install dependencies.
92
+
93
+ #### Method D: China Mainland Installation (npm Mirror)
94
+
95
+ If `openclaw plugins install` gets stuck at `Installing plugin dependencies...` or fails with `npm install failed` due to network issues in China, you can specify a mirror registry for that install:
96
+
97
+ ```bash
98
+ NPM_CONFIG_REGISTRY=https://registry.npmmirror.com openclaw plugins install @dingtalk-real-ai/dingtalk-connector
99
+ ```
100
+
101
+ If the plugin is in a partially installed state (e.g., the extension directory exists but dependencies are incomplete), you can manually reinstall dependencies:
102
+
103
+ ```bash
104
+ cd ~/.openclaw/extensions/dingtalk-connector
105
+ rm -rf node_modules package-lock.json
106
+ NPM_CONFIG_REGISTRY=https://registry.npmmirror.com npm install
107
+ ```
108
+
109
+ To make the mirror permanent, set the default npm registry:
67
110
 
68
- # Alternative: Install from Git
69
- openclaw plugins install https://github.com/DingTalk-Real-AI/dingtalk-openclaw-connector.git
111
+ ```bash
112
+ npm config set registry https://registry.npmmirror.com
113
+ ```
114
+
115
+ Or add to `~/.npmrc`:
116
+
117
+ ```
118
+ registry=https://registry.npmmirror.com
70
119
  ```
71
120
 
72
121
  **Verify installation**:
73
122
  ```bash
74
123
  openclaw plugins list
75
124
  ```
76
- You should see `✓ DingTalk Channel (v0.8.0) - loaded`
125
+ You should see `✓ DingTalk Channel (v0.8.6) - loaded`
77
126
 
78
127
  ---
79
128
 
@@ -412,6 +461,12 @@ dingtalk-openclaw-connector/
412
461
 
413
462
  ---
414
463
 
464
+ ## DingTalk DEAP Agent Integration
465
+
466
+ Connect DingTalk DEAP Agent with OpenClaw Gateway to enable natural language-driven local device operations. See **[DingTalk DEAP Agent Integration Guide](docs/DEAP_AGENT_GUIDE.en.md)** for details.
467
+
468
+ ---
469
+
415
470
  ## License
416
471
 
417
472
  [MIT](LICENSE)
package/README.md CHANGED
@@ -19,6 +19,7 @@
19
19
  - [配置说明](#配置说明)
20
20
  - [常见问题](#常见问题)
21
21
  - [进阶主题](#进阶主题)
22
+ - [钉钉 DEAP Agent 集成](docs/DEAP_AGENT_GUIDE.md)
22
23
  - [许可证](#许可证)
23
24
 
24
25
  ---
@@ -93,19 +94,67 @@ yarn global add openclaw@latest
93
94
 
94
95
  ### 步骤 1:安装插件
95
96
 
97
+ #### 方法 A:通过 npm 包安装(推荐)
98
+
96
99
  ```bash
97
- # 推荐:从 npm 安装
98
100
  openclaw plugins install @dingtalk-real-ai/dingtalk-connector
101
+ ```
102
+
103
+ #### 方法 B:通过本地源码安装
104
+
105
+ 如果你想对插件进行二次开发,可以先克隆仓库:
106
+
107
+ ```bash
108
+ # 1. 克隆插件仓库
109
+ git clone https://github.com/DingTalk-Real-AI/dingtalk-openclaw-connector.git
110
+ cd dingtalk-openclaw-connector
111
+
112
+ # 2. 安装依赖(必需)
113
+ npm install
114
+
115
+ # 3. 以链接模式安装(方便修改代码后实时生效)
116
+ openclaw plugins install -l .
117
+ ```
118
+
119
+ #### 方法 C:手动安装
120
+
121
+ 1. 将本仓库下载或复制到 `~/.openclaw/extensions/dingtalk-connector`。
122
+ 2. 确保包含 `index.ts`、`openclaw.plugin.json` 和 `package.json`。
123
+ 3. 在该目录下运行 `npm install` 安装依赖。
124
+
125
+ #### 方法 D:国内网络环境安装(npm 镜像源)
126
+
127
+ 如果你在国内网络环境下执行 `openclaw plugins install` 时卡在 `Installing plugin dependencies...` 或出现 `npm install failed`,可临时为该次安装指定镜像源:
128
+
129
+ ```bash
130
+ NPM_CONFIG_REGISTRY=https://registry.npmmirror.com openclaw plugins install @dingtalk-real-ai/dingtalk-connector
131
+ ```
132
+
133
+ 如果插件已处于半安装状态(例如扩展目录存在但依赖未装全),可进入插件目录手动补装依赖:
134
+
135
+ ```bash
136
+ cd ~/.openclaw/extensions/dingtalk-connector
137
+ rm -rf node_modules package-lock.json
138
+ NPM_CONFIG_REGISTRY=https://registry.npmmirror.com npm install
139
+ ```
140
+
141
+ 如果希望长期生效,可设置 npm 默认镜像:
99
142
 
100
- # 或者:从 Git 安装
101
- openclaw plugins install https://github.com/DingTalk-Real-AI/dingtalk-openclaw-connector.git
143
+ ```bash
144
+ npm config set registry https://registry.npmmirror.com
145
+ ```
146
+
147
+ 或写入 `~/.npmrc`:
148
+
149
+ ```
150
+ registry=https://registry.npmmirror.com
102
151
  ```
103
152
 
104
153
  **验证安装**:
105
154
  ```bash
106
155
  openclaw plugins list
107
156
  ```
108
- 你应该看到 `✓ DingTalk Channel (v0.8.0) - loaded`
157
+ 你应该看到 `✓ DingTalk Channel (v0.8.6) - loaded`
109
158
 
110
159
  ---
111
160
 
@@ -455,6 +504,12 @@ dingtalk-openclaw-connector/
455
504
 
456
505
  ---
457
506
 
507
+ ## 钉钉 DEAP Agent 集成
508
+
509
+ 通过钉钉 DEAP Agent 与 OpenClaw Gateway 连接,实现自然语言驱动的本地设备操作能力。详见 **[钉钉 DEAP Agent 集成指南](docs/DEAP_AGENT_GUIDE.md)**。
510
+
511
+ ---
512
+
458
513
  ## 许可证
459
514
 
460
515
  [MIT](LICENSE)
@@ -0,0 +1,115 @@
1
+ # DingTalk DEAP Agent Integration
2
+
3
+ > [中文版](DEAP_AGENT_GUIDE.md)
4
+
5
+ Connect DingTalk [DEAP](https://deap.dingtalk.com) Agent with [OpenClaw](https://openclaw.ai) Gateway to enable natural language-driven local device operations.
6
+
7
+ ## Key Features
8
+
9
+ - ✅ **Natural Language Interaction** - Users type natural language commands in the DingTalk chat (e.g., "Find PDF files on my desktop"), and the Agent automatically parses and executes the corresponding operations
10
+ - ✅ **NAT Traversal** - Designed for local devices without public IPs, establishing a stable communication tunnel between local and cloud environments via the Connector client
11
+ - ✅ **Cross-Platform Support** - Provides native binaries for Windows, macOS, and Linux, ensuring smooth operation across all platforms
12
+
13
+ ## System Architecture
14
+
15
+ This solution uses a layered architecture with three core components:
16
+
17
+ 1. **OpenClaw Gateway** - Deployed on the local device, provides a standardized HTTP interface for receiving and processing operation commands from the cloud, leveraging the OpenClaw engine to execute tasks
18
+ 2. **DingTalk OpenClaw Connector** - Runs locally, building a communication tunnel between local and cloud environments to solve the problem of local devices without public IPs
19
+ 3. **DingTalk DEAP MCP** - An extension module for the DEAP Agent, responsible for forwarding user natural language requests to the OpenClaw Gateway via the cloud tunnel
20
+
21
+ ```mermaid
22
+ graph LR
23
+ subgraph "DingTalk App"
24
+ A["User chats with Agent"] --> B["DEAP Agent"]
25
+ end
26
+
27
+ subgraph "Local Environment"
28
+ D["DingTalk OpenClaw Connector"] --> C["OpenClaw Gateway"]
29
+ C --> E["PC Operation Execution"]
30
+ end
31
+
32
+ B -.-> D
33
+ ```
34
+
35
+ ## Implementation Guide
36
+
37
+ ### Step 1: Set Up the Local Environment
38
+
39
+ Ensure the OpenClaw Gateway is installed and running on your local device. The default address is `127.0.0.1:18789`:
40
+
41
+ ```bash
42
+ openclaw gateway start
43
+ ```
44
+
45
+ #### Configure Gateway Parameters
46
+
47
+ 1. Visit the [Configuration Page](http://127.0.0.1:18789/config)
48
+ 2. In the **Overview**, set the Gateway Token and save it securely:
49
+ ![alt text](images/image-5.png)
50
+ 3. Switch to **Infrastructure** and enable the `OpenAI Chat Completions Endpoint`:
51
+ ![alt text](images/image-6.png)
52
+
53
+ 4. Click the `Save` button in the top-right corner to save your configuration
54
+
55
+ ### Step 2: Obtain Required Parameters
56
+
57
+ #### Get corpId
58
+
59
+ Log in to the [DingTalk Developer Platform](https://open-dev.dingtalk.com) to find your enterprise CorpId:
60
+
61
+ <img width="864" height="450" alt="Get corpId from DingTalk Developer Platform" src="https://github.com/user-attachments/assets/18ec9830-2d43-489a-a73f-530972685225" />
62
+
63
+ #### Get apiKey
64
+
65
+ Log in to the [DingTalk DEAP Platform](https://deap.dingtalk.com), navigate to **Security & Permissions** → **API-Key Management** to create a new API Key:
66
+
67
+ <img width="1222" height="545" alt="DingTalk DEAP Platform API-Key Management" src="https://github.com/user-attachments/assets/dfe29984-4432-49c1-8226-0f9b60fbb5bc" />
68
+
69
+ ### Step 3: Start the Connector Client
70
+
71
+ 1. Download the installer for your operating system from the [Releases](https://github.com/hoskii/dingtalk-openclaw-connector/releases/tag/v0.0.1) page
72
+ 2. Extract and run the Connector in the corresponding directory (macOS example):
73
+
74
+ ```bash
75
+ unzip connector-mac.zip
76
+ ./connector-darwin -deapCorpId YOUR_CORP_ID -deapApiKey YOUR_API_KEY
77
+ ```
78
+ ![alt text](images/image-7.png)
79
+
80
+ ### Step 4: Configure the DEAP Agent
81
+
82
+ 1. Log in to the [DingTalk DEAP Platform](https://deap.dingtalk.com) and create a new agent:
83
+
84
+ <img width="2444" height="1486" alt="Create New Agent" src="https://github.com/user-attachments/assets/0b7f0855-f991-4aeb-b6e6-7576346b4477" />
85
+
86
+ 2. In the skill management page, search for and integrate the OpenClaw skill:
87
+
88
+ <img width="3430" height="1732" alt="Add OpenClaw Skill" src="https://github.com/user-attachments/assets/d44f0038-f863-4c1f-afa7-b774d875e4ba" />
89
+
90
+ 3. Configure skill parameters:
91
+
92
+ | Parameter | Source | Description |
93
+ | ------------ | ---------- | -------------------------------------------------------------------------------------- |
94
+ | apikey | From Step 2 | DEAP Platform API Key |
95
+ | apihost | Default | Typically `127.0.0.1:18789`. On Windows, you may need to use `localhost:18789` instead |
96
+ | gatewayToken | From Step 1 | Gateway authentication token |
97
+
98
+ <img width="3426" height="1752" alt="Configure OpenClaw Skill Parameters" src="https://github.com/user-attachments/assets/bc725789-382f-41b5-bbdb-ba8f29923d5c" />
99
+
100
+ Note that OpenClaw is an MCP, so you also need to configure its trigger rules. The MCP will only be invoked when the rules are satisfied:
101
+ <img width="1088" height="526" alt="image" src="https://github.com/user-attachments/assets/8b0b6f6d-70ff-4edc-b674-7a24126aadfa" />
102
+
103
+ 4. Publish the Agent:
104
+
105
+ <img width="3416" height="1762" alt="Publish Agent" src="https://github.com/user-attachments/assets/3f8c3fdb-5f2b-4a4b-8896-35202e713bf3" />
106
+
107
+ ### Step 5: Start Using
108
+
109
+ 1. Search for and find your Agent in the DingTalk App:
110
+
111
+ <img width="1260" height="436" alt="Search for Agent" src="https://github.com/user-attachments/assets/30feff80-1b28-4274-830b-7045aed14980" />
112
+
113
+ 2. Start your natural language conversation:
114
+
115
+ <img width="1896" height="1240" alt="Chat with Agent" src="https://github.com/user-attachments/assets/2a80aab8-3fbf-4d18-beea-770577cb1a40" />
@@ -0,0 +1,115 @@
1
+ # 钉钉 DEAP Agent 集成
2
+
3
+ > [English Version](DEAP_AGENT_GUIDE.en.md)
4
+
5
+ 通过将钉钉 [DEAP](https://deap.dingtalk.com) Agent 与 [OpenClaw](https://openclaw.ai) Gateway 连接,实现自然语言驱动的本地设备操作能力。
6
+
7
+ ## 核心功能
8
+
9
+ - ✅ **自然语言交互** - 用户在钉钉对话框中输入自然语言指令(如"帮我查找桌面上的 PDF 文件"),Agent 将自动解析并执行相应操作
10
+ - ✅ **内网穿透机制** - 专为本地设备无公网 IP 场景设计,通过 Connector 客户端建立稳定的内外网通信隧道
11
+ - ✅ **跨平台兼容** - 提供 Windows、macOS 和 Linux 系统的原生二进制执行文件,确保各平台下的顺畅运行
12
+
13
+ ## 系统架构
14
+
15
+ 该方案采用分层架构模式,包含三个核心组件:
16
+
17
+ 1. **OpenClaw Gateway** - 部署于本地设备,提供标准化 HTTP 接口,负责接收并处理来自云端的操作指令,调动 OpenClaw 引擎执行具体任务
18
+ 2. **DingTalk OpenClaw Connector** - 运行于本地环境,构建本地与云端的通信隧道,解决内网设备无公网 IP 的问题
19
+ 3. **DingTalk DEAP MCP** - 作为 DEAP Agent 的扩展能力模块,负责将用户自然语言请求经由云端隧道转发至 OpenClaw Gateway
20
+
21
+ ```mermaid
22
+ graph LR
23
+ subgraph "钉钉 App"
24
+ A["用户与 Agent 对话"] --> B["DEAP Agent"]
25
+ end
26
+
27
+ subgraph "本地环境"
28
+ D["DingTalk OpenClaw Connector"] --> C["OpenClaw Gateway"]
29
+ C --> E["PC 操作执行"]
30
+ end
31
+
32
+ B -.-> D
33
+ ```
34
+
35
+ ## 实施指南
36
+
37
+ ### 第一步:部署本地环境
38
+
39
+ 确认本地设备已成功安装并启动 OpenClaw Gateway,默认监听地址为 `127.0.0.1:18789`:
40
+
41
+ ```bash
42
+ openclaw gateway start
43
+ ```
44
+
45
+ #### 配置 Gateway 参数
46
+
47
+ 1. 访问 [配置页面](http://127.0.0.1:18789/config)
48
+ 2. 在 **概览** 中设置 Gateway Token 并妥善保存:
49
+ ![alt text](images/image-5.png)
50
+ 3. 切换至 **基础设施**,启用 `OpenAI Chat Completions Endpoint` 功能:
51
+ ![alt text](images/image-6.png)
52
+
53
+ 4. 点击右上角 `Save` 按钮完成配置保存
54
+
55
+ ### 第二步:获取必要参数
56
+
57
+ #### 获取 corpId
58
+
59
+ 登录 [钉钉开发者平台](https://open-dev.dingtalk.com) 查看企业 CorpId:
60
+
61
+ <img width="864" height="450" alt="钉钉开发者平台获取 corpId" src="https://github.com/user-attachments/assets/18ec9830-2d43-489a-a73f-530972685225" />
62
+
63
+ #### 获取 apiKey
64
+
65
+ 登录 [钉钉 DEAP 平台](https://deap.dingtalk.com),在 **安全与权限** → **API-Key 管理** 页面创建新的 API Key:
66
+
67
+ <img width="1222" height="545" alt="钉钉 DEAP 平台 API-Key 管理" src="https://github.com/user-attachments/assets/dfe29984-4432-49c1-8226-0f9b60fbb5bc" />
68
+
69
+ ### 第三步:启动 Connector 客户端
70
+
71
+ 1. 从 [Releases](https://github.com/hoskii/dingtalk-openclaw-connector/releases/tag/v0.0.1) 页面下载适配您操作系统的安装包
72
+ 2. 解压后在对应目录运行 Connector(以 macOS 为例):
73
+
74
+ ```bash
75
+ unzip connector-mac.zip
76
+ ./connector-darwin -deapCorpId YOUR_CORP_ID -deapApiKey YOUR_API_KEY
77
+ ```
78
+ ![alt text](images/image-7.png)
79
+
80
+ ### 第四步:配置 DEAP Agent
81
+
82
+ 1. 登录 [钉钉 DEAP 平台](https://deap.dingtalk.com),创建新的智能体:
83
+
84
+ <img width="2444" height="1486" alt="新建智能体界面" src="https://github.com/user-attachments/assets/0b7f0855-f991-4aeb-b6e6-7576346b4477" />
85
+
86
+ 2. 在技能管理页面,搜索并集成 OpenClaw 技能:
87
+
88
+ <img width="3430" height="1732" alt="添加 OpenClaw 技能" src="https://github.com/user-attachments/assets/d44f0038-f863-4c1f-afa7-b774d875e4ba" />
89
+
90
+ 3. 配置技能参数:
91
+
92
+ | 参数 | 来源 | 说明 |
93
+ | ------------ | ---------- | -------------------------------------------------------------------------------------- |
94
+ | apikey | 第二步获取 | DEAP 平台 API Key |
95
+ | apihost | 默认值 | 通常为 `127.0.0.1:18789`,在Windows环境下可能需要配置为 `localhost:18789` 才能正常工作 |
96
+ | gatewayToken | 第一步获取 | Gateway 配置的认证令牌 |
97
+
98
+ <img width="3426" height="1752" alt="配置 OpenClaw 技能参数" src="https://github.com/user-attachments/assets/bc725789-382f-41b5-bbdb-ba8f29923d5c" />
99
+
100
+ 注意 OpenClaw 属于一个MCP,还需要配置他的触发规则,满足规则的情况下才会使用这个MCP:
101
+ <img width="1088" height="526" alt="image" src="https://github.com/user-attachments/assets/8b0b6f6d-70ff-4edc-b674-7a24126aadfa" />
102
+
103
+ 4. 发布 Agent:
104
+
105
+ <img width="3416" height="1762" alt="发布 Agent" src="https://github.com/user-attachments/assets/3f8c3fdb-5f2b-4a4b-8896-35202e713bf3" />
106
+
107
+ ### 第五步:开始使用
108
+
109
+ 1. 在钉钉 App 中搜索并找到您创建的 Agent:
110
+
111
+ <img width="1260" height="436" alt="搜索 Agent" src="https://github.com/user-attachments/assets/30feff80-1b28-4274-830b-7045aed14980" />
112
+
113
+ 2. 开始自然语言对话体验:
114
+
115
+ <img width="1896" height="1240" alt="与 Agent 对话" src="https://github.com/user-attachments/assets/2a80aab8-3fbf-4d18-beea-770577cb1a40" />
Binary file
Binary file
Binary file
package/install-npm.sh ADDED
@@ -0,0 +1,167 @@
1
+ #!/usr/bin/env bash
2
+ # =============================================================================
3
+ # install-npm.sh
4
+ # 将 dingtalk-connector 插件从本地 git 路径安装切换到 npm 包安装
5
+ #
6
+ # 流程:
7
+ # 1. 备份当前 openclaw.json 配置文件
8
+ # 2. 写入最小化干净配置(让 openclaw plugins 命令能正常运行)
9
+ # 3. 卸载旧插件(清除本地路径安装记录)
10
+ # 4. 从 npm 安装最新版插件
11
+ # 5. 恢复备份的配置文件(保留用户的所有业务配置)
12
+ # =============================================================================
13
+
14
+ set -euo pipefail
15
+
16
+ # ============ 常量 ============
17
+ OPENCLAW_CONFIG="$HOME/.openclaw/openclaw.json"
18
+ PLUGIN_NAME="dingtalk-connector"
19
+ NPM_PACKAGE="@dingtalk-real-ai/dingtalk-connector"
20
+ TIMESTAMP=$(date +%Y%m%d_%H%M%S)
21
+ BACKUP_FILE="${OPENCLAW_CONFIG}.migrate_backup.${TIMESTAMP}"
22
+
23
+ # ============ 颜色输出 ============
24
+ RED='\033[0;31m'
25
+ GREEN='\033[0;32m'
26
+ YELLOW='\033[1;33m'
27
+ BLUE='\033[0;34m'
28
+ NC='\033[0m' # No Color
29
+
30
+ log_info() { echo -e "${BLUE}[INFO]${NC} $*"; }
31
+ log_success() { echo -e "${GREEN}[OK]${NC} $*"; }
32
+ log_warn() { echo -e "${YELLOW}[WARN]${NC} $*"; }
33
+ log_error() { echo -e "${RED}[ERROR]${NC} $*" >&2; }
34
+
35
+ # ============ 错误恢复 ============
36
+ # 如果脚本中途失败,自动恢复备份
37
+ restore_on_error() {
38
+ if [[ -f "$BACKUP_FILE" ]]; then
39
+ log_warn "脚本异常退出,正在恢复备份配置..."
40
+ cp "$BACKUP_FILE" "$OPENCLAW_CONFIG"
41
+ log_warn "已恢复备份: $BACKUP_FILE"
42
+ fi
43
+ }
44
+ trap restore_on_error ERR
45
+
46
+ # ============ 前置检查 ============
47
+ echo ""
48
+ echo "============================================================"
49
+ echo " DingTalk Connector — 切换到 npm 安装"
50
+ echo "============================================================"
51
+ echo ""
52
+
53
+ if [[ ! -f "$OPENCLAW_CONFIG" ]]; then
54
+ log_error "找不到 OpenClaw 配置文件: $OPENCLAW_CONFIG"
55
+ exit 1
56
+ fi
57
+
58
+ if ! command -v openclaw &>/dev/null; then
59
+ log_error "找不到 openclaw 命令,请确认已安装 OpenClaw CLI"
60
+ exit 1
61
+ fi
62
+
63
+ # ============ 步骤 1:备份配置文件 ============
64
+ log_info "步骤 1/5:备份当前配置文件..."
65
+ cp "$OPENCLAW_CONFIG" "$BACKUP_FILE"
66
+ log_success "备份已保存至: $BACKUP_FILE"
67
+
68
+ # ============ 步骤 2:写入最小化干净配置 ============
69
+ log_info "步骤 2/5:写入临时干净配置(用于执行插件命令)..."
70
+
71
+ # 提取当前配置中 plugins 以外的所有字段,保留业务配置结构
72
+ # 同时写入一个空的 plugins 配置,让 openclaw 能正常初始化
73
+ python3 - <<'PYEOF'
74
+ import json, sys, os
75
+
76
+ config_path = os.path.expanduser("~/.openclaw/openclaw.json")
77
+
78
+ with open(config_path, "r") as f:
79
+ original = json.load(f)
80
+
81
+ # 保留所有非 plugins 字段,plugins 置为空(让 openclaw 重新初始化)
82
+ clean_config = {k: v for k, v in original.items() if k != "plugins"}
83
+ clean_config["plugins"] = {
84
+ "load": {},
85
+ "entries": {},
86
+ "allow": [],
87
+ "installs": {}
88
+ }
89
+
90
+ with open(config_path, "w") as f:
91
+ json.dump(clean_config, f, indent=2)
92
+
93
+ print(" 干净配置写入完成")
94
+ PYEOF
95
+
96
+ log_success "临时干净配置写入完成"
97
+
98
+ # ============ 步骤 3:卸载旧插件 ============
99
+ log_info "步骤 3/5:卸载旧版插件 (${PLUGIN_NAME})..."
100
+ if openclaw plugins uninstall "$PLUGIN_NAME" --yes 2>&1 | grep -v "^$"; then
101
+ log_success "旧插件卸载完成"
102
+ else
103
+ log_warn "卸载命令返回非零,可能插件本来就未安装,继续执行..."
104
+ fi
105
+
106
+ # ============ 步骤 4:从 npm 安装最新版插件 ============
107
+ log_info "步骤 4/5:从 npm 安装最新版插件 (${NPM_PACKAGE})..."
108
+ echo ""
109
+ openclaw plugins install "$NPM_PACKAGE"
110
+ echo ""
111
+ log_success "npm 插件安装完成"
112
+
113
+ # ============ 步骤 5:恢复备份配置(保留业务配置) ============
114
+ log_info "步骤 5/5:将新安装的插件信息合并回原始业务配置..."
115
+
116
+ python3 - <<'PYEOF'
117
+ import json, os
118
+
119
+ config_path = os.path.expanduser("~/.openclaw/openclaw.json")
120
+ import glob
121
+ backup_files = sorted(glob.glob(config_path + ".migrate_backup.*"))
122
+ backup_path = backup_files[-1] # 取最新的备份
123
+
124
+ with open(config_path, "r") as f:
125
+ new_config = json.load(f)
126
+
127
+ with open(backup_path, "r") as f:
128
+ original_config = json.load(f)
129
+
130
+ # 策略:以原始业务配置为基础,只替换 plugins.installs 为新安装的结果
131
+ # 这样保留了用户所有的 channels、agents、bindings 等业务配置
132
+ merged = dict(original_config)
133
+ merged["plugins"] = dict(original_config.get("plugins", {}))
134
+
135
+ # 用新安装的 installs 记录覆盖旧的(包含新的 npm source 信息)
136
+ new_installs = new_config.get("plugins", {}).get("installs", {})
137
+ if new_installs:
138
+ merged["plugins"]["installs"] = new_installs
139
+ # 同步更新 entries 和 allow(保留原有的 enabled 状态)
140
+ for plugin_id in new_installs:
141
+ if plugin_id not in merged["plugins"].get("entries", {}):
142
+ merged["plugins"].setdefault("entries", {})[plugin_id] = {"enabled": True}
143
+ if plugin_id not in merged["plugins"].get("allow", []):
144
+ merged["plugins"].setdefault("allow", []).append(plugin_id)
145
+
146
+ with open(config_path, "w") as f:
147
+ json.dump(merged, f, indent=2)
148
+
149
+ print(f" 已合并配置,新插件安装信息:")
150
+ for plugin_id, install_info in new_installs.items():
151
+ print(f" - {plugin_id}: {install_info.get('spec', 'unknown')} (source: {install_info.get('source', 'unknown')})")
152
+ PYEOF
153
+
154
+ log_success "配置合并完成"
155
+
156
+ # ============ 完成 ============
157
+ echo ""
158
+ echo "============================================================"
159
+ log_success "迁移完成!"
160
+ echo ""
161
+ echo " 备份文件: $BACKUP_FILE"
162
+ echo " 如需回滚: cp \"$BACKUP_FILE\" \"$OPENCLAW_CONFIG\""
163
+ echo ""
164
+ echo " 下一步:重启 OpenClaw Gateway 使新插件生效"
165
+ echo " openclaw gateway --force"
166
+ echo "============================================================"
167
+ echo ""
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "dingtalk-connector",
3
3
  "name": "DingTalk Channel",
4
- "version": "0.8.6",
4
+ "version": "0.8.8",
5
5
  "description": "DingTalk (钉钉) messaging channel via Stream mode with AI Card streaming",
6
6
  "author": "DingTalk Real Team",
7
7
  "main": "index.ts",