@dingtalk-real-ai/dingtalk-connector 0.7.6 → 0.7.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 (49) hide show
  1. package/.github/workflows/issue-to-AI-table.yml +52 -0
  2. package/CHANGELOG.md +36 -0
  3. package/README.md +23 -21
  4. package/docs/RELEASE_NOTES_V0.7.7.md +122 -0
  5. package/docs/RELEASE_NOTES_V0.7.8.md +101 -0
  6. package/openclaw.plugin.json +1 -1
  7. package/package.json +13 -5
  8. package/plugin.ts +210 -19
  9. package/tests/README.md +54 -0
  10. package/tests/ai-card/PLAN.md +54 -0
  11. package/tests/ai-card/ai-card.test.ts +372 -0
  12. package/tests/audio/PLAN.md +64 -0
  13. package/tests/audio/audio.test.ts +283 -0
  14. package/tests/bindings/PLAN.md +99 -0
  15. package/tests/bindings/bindings.test.ts +191 -0
  16. package/tests/card-update/PLAN.md +29 -0
  17. package/tests/card-update/card-update.test.ts +127 -0
  18. package/tests/config-token/PLAN.md +94 -0
  19. package/tests/config-token/config-token.test.ts +153 -0
  20. package/tests/core/PLAN.md +65 -0
  21. package/tests/core/core.test.ts +286 -0
  22. package/tests/deliver-payload/PLAN.md +59 -0
  23. package/tests/deliver-payload/deliver-payload.test.ts +91 -0
  24. package/tests/download/PLAN.md +47 -0
  25. package/tests/download/download.test.ts +261 -0
  26. package/tests/file-markers/PLAN.md +74 -0
  27. package/tests/file-markers/file-markers.test.ts +105 -0
  28. package/tests/index.ts +129 -0
  29. package/tests/integration/PLAN.md +65 -0
  30. package/tests/integration/integration.test.ts +232 -0
  31. package/tests/mcp-tools/PLAN.md +67 -0
  32. package/tests/mcp-tools/mcp-tools.test.ts +327 -0
  33. package/tests/media/PLAN.md +37 -0
  34. package/tests/media/media.test.ts +50 -0
  35. package/tests/message-extract/PLAN.md +83 -0
  36. package/tests/message-extract/message-extract.test.ts +205 -0
  37. package/tests/proactive/PLAN.md +88 -0
  38. package/tests/proactive/proactive.test.ts +502 -0
  39. package/tests/prompts/PLAN.md +71 -0
  40. package/tests/prompts/prompts.test.ts +64 -0
  41. package/tests/send-message/PLAN.md +44 -0
  42. package/tests/send-message/send-message.test.ts +228 -0
  43. package/tests/session/PLAN.md +90 -0
  44. package/tests/session/session.test.ts +166 -0
  45. package/tests/upload/PLAN.md +72 -0
  46. package/tests/upload/upload.test.ts +390 -0
  47. package/tests/video/PLAN.md +118 -0
  48. package/tests/video/video.test.ts +40 -0
  49. package/vitest.config.ts +13 -0
@@ -0,0 +1,52 @@
1
+ # Issue 变更推送到 Webhook
2
+ # 当有 Issue 变更时,发送指定格式的数据到 webhook
3
+ name: 📤 Issue Webhook Notification
4
+
5
+ on:
6
+ issues:
7
+ types: [opened, reopened, closed, edited, labeled, unlabeled]
8
+
9
+ jobs:
10
+ notify:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - name: 📬 Send Issue to Webhook
14
+ uses: actions/github-script@v7
15
+ with:
16
+ script: |
17
+ const webhook = process.env.ISSUE_WEBHOOK_URL;
18
+ if (!webhook) {
19
+ console.log('⚠️ ISSUE_WEBHOOK_URL not set, skipping notification');
20
+ return;
21
+ }
22
+
23
+ const payload = context.payload;
24
+ const issue = payload.issue;
25
+ const action = payload.action;
26
+
27
+ // 构建指定格式的数据
28
+ const webhookPayload = {
29
+ action: action,
30
+ issue: {
31
+ id: issue.id,
32
+ number: issue.number,
33
+ title: issue.title,
34
+ body: issue.body,
35
+ state: issue.state,
36
+ html_url: issue.html_url
37
+ }
38
+ };
39
+
40
+ const response = await fetch(webhook, {
41
+ method: 'POST',
42
+ headers: { 'Content-Type': 'application/json' },
43
+ body: JSON.stringify(webhookPayload)
44
+ });
45
+
46
+ if (response.ok) {
47
+ console.log('✅ Webhook notification sent successfully');
48
+ } else {
49
+ console.log('❌ Failed to send webhook notification:', response.status, response.statusText);
50
+ }
51
+ env:
52
+ ISSUE_WEBHOOK_URL: ${{ secrets.DINGTALK_AI_TABLE_WEBHOOK }}
package/CHANGELOG.md CHANGED
@@ -6,6 +6,42 @@
6
6
  This document records all significant changes. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
7
7
  and version numbers follow [Semantic Versioning](https://semver.org/).
8
8
 
9
+ ## [0.7.8] - 2026-03-13
10
+
11
+ ### 修复 / Fixes
12
+ - 🐛 **AI 卡片模版与渲染优化** - 更新 AI 卡片模版 ID,使卡片样式与最新官方规范保持一致,并提升多终端展示效果
13
+ **AI card template & rendering optimization** - Updated the AI card template ID to match the latest official standard and improved rendering across clients
14
+ - 🐛 **Markdown 表格渲染修复** - 在发送到钉钉前自动为 Markdown 表格头部补充必要空行,避免因缺少空行导致表格被当作普通文本渲染
15
+ **Markdown table rendering fix** - Automatically inserts required blank lines before Markdown table headers to prevent DingTalk from rendering tables as plain text
16
+ - 🐛 **消息去重逻辑优化** - 将消息去重维度从「账号 + 消息 ID」简化为单一「消息 ID」,避免多账号场景下的重复处理或误判
17
+ **Message de-duplication optimization** - Simplified de-duplication from `(accountId, messageId)` to `messageId` only, preventing duplicate handling or misjudgment in multi-account scenarios
18
+
19
+ ### 改进 / Improvements
20
+ - ✅ **统一 Markdown 修正管道** - 对 AI 卡片流式内容、最终内容、普通 Markdown 消息及 `sampleMarkdown` 卡片文本统一应用 Markdown 修正规则,确保表格等格式在各入口行为一致
21
+ **Unified Markdown normalization pipeline** - Applies the same Markdown normalization to streaming AI card content, final content, regular Markdown messages, and `sampleMarkdown` card text for consistent behavior
22
+ - ✅ **AI 卡片状态内容一致性** - 在完成 AI 卡片时,对展示内容和写入 `cardParamMap.msgContent` 的内容使用同一份 Markdown 修正结果,确保用户看到的内容与内部状态一致
23
+ **Consistent AI card status content** - Ensures the same normalized Markdown is used both for the visible content and `cardParamMap.msgContent` when finishing AI cards
24
+
25
+ ## [0.7.7] - 2026-03-13
26
+
27
+ ### 新增 / Added
28
+ - ✨ **自定义 Gateway URL 支持** - 新增 `gatewayBaseUrl` 配置项,支持通过自定义 URL(如 Nginx 反向代理到 TLS/HTTPS Gateway)访问 Gateway
29
+ **Custom Gateway URL support** - Added `gatewayBaseUrl` option to allow using a custom URL (e.g., Nginx reverse proxy to a TLS/HTTPS Gateway)
30
+ - ✨ **钉钉「思考中」表情反馈** - 在处理用户消息期间为原消息贴上「🤔思考中」表情,处理结束后自动撤回,清晰展示处理进度
31
+ **DingTalk “thinking” emotion feedback** - Attaches a “🤔 Thinking” emotion to the original user message while processing and automatically recalls it after completion to clearly indicate progress
32
+ - ✨ **测试基础设施完善** - 引入 Vitest 及多种测试脚本(run/watch/coverage/ui/integration),为后续自动化测试和回归验证提供基础
33
+ **Improved testing infrastructure** - Introduced Vitest and multiple test scripts (run/watch/coverage/ui/integration) to enable better automated and regression testing
34
+ - ✨ **Issue Webhook 工作流** - 新增 GitHub Actions 工作流,将 Issue 变更以统一 JSON 格式推送到配置的 Webhook
35
+ **Issue webhook workflow** - Added a GitHub Actions workflow to push Issue changes as unified JSON payloads to a configured webhook
36
+
37
+ ### 修复 / Fixes
38
+ - 🐛 **媒体元数据与缩略图提取更健壮** - ffprobe 或缩略图生成失败时不再中断主流程,而是返回默认元数据或空缩略图
39
+ **More robust media metadata & thumbnail extraction** - ffprobe or thumbnail generation failures no longer abort the main flow but return default metadata or a null thumbnail instead
40
+ - 🐛 **音频时长提取兼容性改进** - 使用动态 `import('child_process')` 替代 `require('child_process')`,提升在不同运行环境下的兼容性
41
+ **Audio duration extraction compatibility** - Replaced `require('child_process')` with dynamic `import('child_process')` to improve compatibility across environments
42
+ - 🐛 **主动消息用户列表校验** - 为主动消息的 `userIds` 列表增加空值过滤,避免因无效用户 ID 导致请求失败
43
+ **Proactive message user list validation** - Added empty value filtering for the `userIds` list in proactive messages to prevent request failures caused by invalid IDs
44
+
9
45
  ## [0.7.6] - 2026-03-12
10
46
 
11
47
  ### 修复 / Fixes
package/README.md CHANGED
@@ -1,8 +1,9 @@
1
- # DingTalk OpenClaw Connector
1
+ # Offical DingTalk OpenClaw Connector
2
+ ## 钉钉官方OpenClaw连接器
2
3
 
3
4
  以下提供两种方案连接到 [OpenClaw](https://openclaw.ai) Gateway,分别是钉钉机器人和钉钉 DEAP Agent。
4
5
 
5
- > 📝 **版本信息**:当前版本 v0.7.6 | [查看变更日志](CHANGELOG.md) | [发布说明](docs/RELEASE_NOTES_V0.7.6.md) | [发布指南](RELEASE.md)
6
+ > 📝 **版本信息**:当前版本 v0.7.7 | [查看变更日志](CHANGELOG.md) | [发布说明](docs/RELEASE_NOTES_V0.7.7.md) | [发布指南](RELEASE.md)
6
7
 
7
8
  ## 快速导航
8
9
 
@@ -86,6 +87,7 @@ openclaw plugins install -l .
86
87
  "channels": {
87
88
  "dingtalk-connector": {
88
89
  "enabled": true,
90
+ "gatewayBaseUrl": "http://localhost:18789", // 可选:如果Gateway地址是TLS/HTTPS,see PR #117
89
91
  "clientId": "dingxxxxxxxxx", // 钉钉 AppKey
90
92
  "clientSecret": "your_secret_here", // 钉钉 AppSecret
91
93
  "gatewayToken": "", // 可选:Gateway 认证 token, openclaw.json配置中 gateway.auth.token 的值
@@ -97,19 +99,17 @@ openclaw plugins install -l .
97
99
  "asyncMode": false, // 可选:异步模式,立即回执用户消息,后台处理并推送结果(默认:false)
98
100
  "ackText": "🫡 任务已接收" // 可选:异步模式下的回执消息文本(默认:'🫡 任务已接收,处理中...')
99
101
  }
100
- },
101
- "gateway": { // gateway通常是已有的节点,配置时注意把http部分追加到已有节点下
102
- "http": {
103
- "endpoints": {
104
- "chatCompletions": {
105
- "enabled": true
106
- }
107
- }
108
- }
109
102
  }
110
103
  }
111
104
  ```
112
105
 
106
+ 执行配置命令
107
+
108
+ ```bash
109
+ openclaw config set gateway.http.endpoints.chatCompletions.enabled true
110
+ ```
111
+
112
+
113
113
  或者在 OpenClaw Dashboard 页面配置:
114
114
 
115
115
  <img width="1916" height="1996" alt="image" src="https://github.com/user-attachments/assets/00b585ca-c1df-456c-9c65-7345a718b94b" />
@@ -129,21 +129,20 @@ openclaw plugins list # 确认 dingtalk-connector 已加载
129
129
  ## 创建钉钉机器人
130
130
 
131
131
  1. 打开 [钉钉开放平台](https://open.dingtalk.com/)
132
- 2. 进入 **应用开发** → **企业内部开发** → 创建应用
133
- 3. 添加 **机器人** 能力,消息接收模式选择 **Stream 模式**
134
- 4. 开通权限:
135
- - `Card.Streaming.Write` - AI Card 流式响应
136
- - `Card.Instance.Write` - AI Card 实例写入
137
- - `qyapi_robot_sendmsg` - 主动发送消息
138
- - 如需使用文档 API 功能,还需开通文档相关权限
139
- 5. **发布应用**,记录 **AppKey** 和 **AppSecret**
132
+ 2. 进入 **应用开发** → **企业内部开发** → 创建openclaw机器人
133
+ <img width="2529" height="961" alt="image" src="https://github.com/user-attachments/assets/4163dc50-808c-43c2-84bd-a1e8dde42e05" />
134
+ 3. 创建好机器人后,保存一下生成的clientId和clientSecret, 后续配置参数需要
135
+ <img width="687" height="540" alt="image" src="https://github.com/user-attachments/assets/c036ea46-9750-4814-8c24-3e4b54bd2788" />
136
+
137
+ 或者在机器人详情中 也可以拿到
138
+ <img width="1527" height="377" alt="image" src="https://github.com/user-attachments/assets/3cf2a661-ed81-441d-9cda-024a6a5377cc" />
140
139
 
141
140
  ## 配置参考
142
141
 
143
142
  | 配置项 | 环境变量 | 说明 |
144
143
  |--------|----------|------|
145
- | `clientId` | `DINGTALK_CLIENT_ID` | 钉钉 AppKey |
146
- | `clientSecret` | `DINGTALK_CLIENT_SECRET` | 钉钉 AppSecret |
144
+ | `clientId` | `DINGTALK_CLIENT_ID` | 上一步创建openclaw机器人给到的 clinetId |
145
+ | `clientSecret` | `DINGTALK_CLIENT_SECRET` | 上一步创建openclaw机器人给到的 clientSecret |
147
146
  | `gatewayToken` | `OPENCLAW_GATEWAY_TOKEN` | Gateway 认证 token(可选) |
148
147
  | `gatewayPassword` | — | Gateway 认证 password(可选,与 token 二选一) |
149
148
  | `sessionTimeout` | — | ⚠️ 已废弃,请使用 Gateway 的 [`session.reset.idleMinutes`](https://docs.openclaw.ai/gateway/configuration) 配置 |
@@ -679,6 +678,9 @@ openclaw gateway start
679
678
 
680
679
  <img width="3426" height="1752" alt="配置 OpenClaw 技能参数" src="https://github.com/user-attachments/assets/bc725789-382f-41b5-bbdb-ba8f29923d5c" />
681
680
 
681
+ 注意 OpenClaw 属于一个MCP,还需要配置他的触发规则,满足规则的情况下才会使用这个MCP:
682
+ <img width="1088" height="526" alt="image" src="https://github.com/user-attachments/assets/8b0b6f6d-70ff-4edc-b674-7a24126aadfa" />
683
+
682
684
  4. 发布 Agent:
683
685
 
684
686
  <img width="3416" height="1762" alt="发布 Agent" src="https://github.com/user-attachments/assets/3f8c3fdb-5f2b-4a4b-8896-35202e713bf3" />
@@ -0,0 +1,122 @@
1
+ # Release Notes - v0.7.7
2
+
3
+ ## ✨ 功能与体验改进 / Features & Improvements
4
+
5
+ - **自定义 Gateway URL 支持 / Custom Gateway URL Support**
6
+ 通过新增 `gatewayBaseUrl` 配置项,支持将请求发送到自定义的 Gateway 地址,例如通过 Nginx 反向代理到启用 TLS/HTTPS 的 Gateway。
7
+ With the new `gatewayBaseUrl` option, requests can be sent to a custom Gateway URL, such as an Nginx reverse proxy in front of a TLS/HTTPS-enabled Gateway.
8
+
9
+ - **钉钉「思考中」表情反馈 / DingTalk “Thinking” Emotion Feedback**
10
+ 在处理用户消息期间,Connector 会在原消息上贴上「🤔思考中」表情,处理结束后自动撤回,以更直观地展示处理进度。
11
+ While processing a user message, the connector attaches a “🤔 Thinking” emotion to the original message and automatically recalls it after completion to clearly indicate processing progress.
12
+
13
+ - **测试基础设施完善 / Testing Infrastructure Enhancement**
14
+ 引入 Vitest 测试框架与多种测试脚本(单次运行、watch、覆盖率、UI、集成测试),为后续质量保障和回归测试打下基础。
15
+ Introduced the Vitest testing framework and multiple test scripts (run, watch, coverage, UI, integration) to improve quality assurance and regression testing.
16
+
17
+ - **文档与示例优化 / Documentation & Examples Improvements**
18
+ 更新 README,补充了 OpenClaw 官方连接器定位、Gateway TLS/HTTPS 配置示例、钉钉机器人创建引导图、以及在 OpenClaw 中配置 MCP 触发规则的截图说明。
19
+ Updated README with official connector positioning, Gateway TLS/HTTPS configuration example, DingTalk bot creation walkthrough images, and screenshots for configuring MCP trigger rules in OpenClaw.
20
+
21
+ ## 🐛 修复 / Fixes
22
+
23
+ - **媒体元数据与缩略图提取健壮性提升 / More Robust Media Metadata & Thumbnail Extraction**
24
+ 当 ffprobe 或缩略图生成失败(例如环境缺少依赖、视频流缺失)时,不再抛出异常中断主流程,而是安全返回默认元数据或空缩略图,确保消息处理不中断。
25
+ When ffprobe or thumbnail generation fails (e.g., missing dependencies or video stream), the connector no longer throws and aborts the main flow, but safely returns default metadata or a null thumbnail so message handling continues.
26
+
27
+ - **音频时长提取兼容性改进 / Audio Duration Extraction Compatibility**
28
+ 使用动态 `import('child_process')` 替代 `require('child_process')`,提升在不同打包/运行环境下的兼容性。
29
+ Switched from `require('child_process')` to dynamic `import('child_process')` to improve compatibility across different bundling and runtime environments.
30
+
31
+ - **主动消息用户列表校验 / Proactive Message User List Validation**
32
+ 在向多个用户发送主动消息时,对 `userIds` 列表进行空值过滤,避免因无效用户 ID 导致的请求失败。
33
+ Filters out empty values from the `userIds` list when sending proactive messages to multiple users, preventing request failures caused by invalid user IDs.
34
+
35
+ ## 📋 技术细节 / Technical Details
36
+
37
+ ### Gateway URL 配置 / Gateway URL Configuration
38
+
39
+ - `GatewayOptions` 接口新增 `gatewayBaseUrl?: string` 字段,用于指定自定义 Gateway URL(例如 `http://127.0.0.1:18788`)。
40
+ - `streamFromGateway` 中优先使用 `gatewayBaseUrl` 构造请求地址,否则回退到本地端口逻辑:
41
+ `gatewayBaseUrl ? \`\${gatewayBaseUrl}/v1/chat/completions\` : \`http://127.0.0.1:\${port}/v1/chat/completions\``。
42
+ - 插件配置新增 `gatewayBaseUrl` 字段说明,帮助用户在 TLS/HTTPS 或 Nginx 代理场景下正确配置。
43
+
44
+ ### 钉钉表情反馈逻辑 / DingTalk Emotion Feedback Logic
45
+
46
+ - 新增 `addEmotionReply`:在处理用户消息前,为该消息贴上「🤔思考中」表情,使用机器人凭证调用 `robot/emotion/reply` 接口。
47
+ - 新增 `recallEmotionReply`:在消息处理完成后的 `finally` 块内调用,撤回之前贴上的表情,通过 `robot/emotion/recall` 接口实现。
48
+ - 以上调用均带有完善的错误日志,失败不会中断主消息处理流程,仅记录警告日志。
49
+
50
+ ### 媒体处理健壮性 / Media Handling Robustness
51
+
52
+ - `extractVideoMetadata`:
53
+ - 将 Promise 回调中的错误处理改为返回 `{ duration: 0, width: 0, height: 0 }`,而非直接 reject。
54
+ - 当未找到视频流时,同样返回默认元数据结构。
55
+ - 外层 `catch` 中也返回默认元数据,确保调用方不需要对 `null` 做额外分支判断。
56
+ - `extractVideoThumbnail`:
57
+ - 截图失败时不再 reject,而是 resolve `null`,由上层逻辑决定是否展示缩略图。
58
+ - `extractAudioDuration`:
59
+ - 使用 `await import('child_process')` 获取 `execFile`,提高 ESM/打包场景下的兼容性。
60
+
61
+ ### 测试与依赖 / Testing & Dependencies
62
+
63
+ - 在 `package.json` 中:
64
+ - 将 `test` 脚本更新为 `vitest run`,并新增 `test:watch`、`test:coverage`、`test:ui`、`test:integration` 等脚本。
65
+ - 新增开发依赖:`@types/node`、`typescript`、`vitest`。
66
+ - 这些变更为后续补充单元测试、集成测试以及 CI 集成提供基础设施支持。
67
+
68
+ ### CI 工作流 / CI Workflow
69
+
70
+ - 新增 `.github/workflows/issue-to-AI-table.yml`:
71
+ - 监听 Issue 的创建、重开、关闭、编辑、打标签/去标签等事件。
72
+ - 将 Issue 的关键信息(编号、标题、内容、状态、链接等)以统一格式推送到配置的 Webhook(`ISSUE_WEBHOOK_URL`)。
73
+ - 可用于接入内部 AI 分析、需求盘点或看板同步等自动化流程。
74
+
75
+ ## 📥 安装升级 / Installation & Upgrade
76
+
77
+ ```bash
78
+ # 通过 npm 安装最新版本 / Install latest version via npm
79
+ openclaw plugins install @dingtalk-real-ai/dingtalk-connector
80
+
81
+ # 或升级现有版本 / Or upgrade existing version
82
+ openclaw plugins update dingtalk-connector
83
+
84
+ # 通过 Git 安装 / Install via Git
85
+ openclaw plugins install https://github.com/DingTalk-Real-AI/dingtalk-openclaw-connector.git
86
+ ```
87
+
88
+ ## ⚠️ 升级注意事项 / Upgrade Notes
89
+
90
+ ### 兼容性说明 / Compatibility Notes
91
+
92
+ - **向下兼容 / Backward Compatible**:本次更新为小版本改进,保留了 v0.7.x 既有行为,对现有配置完全兼容。
93
+ - **推荐使用 `gatewayBaseUrl` 配置 TLS 场景 / Recommended for TLS via `gatewayBaseUrl`**:
94
+ 在通过 Nginx 或其他代理为 Gateway 启用 TLS/HTTPS 的场景下,建议配置 `gatewayBaseUrl`,以确保 Connector 能够直接访问代理层地址。
95
+ - **媒体处理更安全 / Safer Media Handling**:即便视频/音频元数据提取失败,也不会影响消息主流程,仅在日志中记录错误。
96
+
97
+ ### 验证步骤 / Verification Steps
98
+
99
+ 升级到此版本后,建议进行以下验证:
100
+
101
+ 1. **Gateway URL 验证 / Gateway URL Verification**
102
+ - 配置 `gatewayBaseUrl` 指向你的 Nginx/Gateway 代理地址。
103
+ - 发送一条消息,确认能够正常与 Gateway 通信。
104
+ 2. **钉钉表情反馈验证 / DingTalk Emotion Feedback Verification**
105
+ - 在钉钉中向机器人发送一条消息。
106
+ - 确认消息上出现「🤔思考中」表情。
107
+ - 等待 AI 回复结束后,确认该表情被自动撤回。
108
+ 3. **媒体消息兼容性验证 / Media Message Compatibility Verification**
109
+ - 发送包含视频或音频的消息,在缺少部分 ffmpeg 依赖的环境下确认不会导致整个会话失败,仅记录错误日志。
110
+
111
+ ## 🔗 相关链接 / Related Links
112
+
113
+ - [完整变更日志 / Full Changelog](https://github.com/DingTalk-Real-AI/dingtalk-openclaw-connector/blob/main/CHANGELOG.md)
114
+ - [使用文档 / Documentation](https://github.com/DingTalk-Real-AI/dingtalk-openclaw-connector/blob/main/README.md)
115
+ - [问题反馈 / Issue Feedback](https://github.com/DingTalk-Real-AI/dingtalk-openclaw-connector/issues)
116
+
117
+ ---
118
+
119
+ **发布日期 / Release Date**:2026-03-13
120
+ **版本号 / Version**:v0.7.7
121
+ **兼容性 / Compatibility**:OpenClaw Gateway 0.4.0+
122
+
@@ -0,0 +1,101 @@
1
+ # Release Notes - v0.7.8
2
+
3
+ ## ✨ 功能与体验改进 / Features & Improvements
4
+
5
+ - **AI 卡片模版更新与展示效果优化 / AI Card Template & Rendering Improvements**
6
+ 升级钉钉 AI 卡片模版 ID,使卡片样式与最新官方规范保持一致,并优化多终端的展示效果与兼容性。
7
+ Updated the DingTalk AI card template ID to align with the latest official template standard, improving visual consistency and compatibility across different clients.
8
+
9
+ - **Markdown 表格渲染修复与自动优化 / Markdown Table Rendering Fix & Auto-Adjustment**
10
+ 新增 Markdown 预处理逻辑,在发送到钉钉前自动为表格头部补充必要的空行,避免因缺少空行导致的表格无法正确渲染问题;支持缩进表格场景。
11
+ Added a Markdown preprocessing step that automatically inserts a blank line before table headers when needed, ensuring DingTalk renders tables correctly, including indented table cases.
12
+
13
+ - **统一的 Markdown 修正管道 / Unified Markdown Normalization Pipeline**
14
+ 对 AI 卡片流式更新、AI 卡片最终内容提交、普通 Markdown 消息发送以及卡片 `sampleMarkdown` 内容,统一通过同一套 Markdown 修正函数进行处理,确保所有下发到钉钉的文本在表格渲染等细节上行为一致。
15
+ Unified the Markdown normalization logic used for streaming AI card updates, final AI card content, regular Markdown messages, and `sampleMarkdown` card payloads, ensuring consistent behavior of table rendering and formatting in DingTalk.
16
+
17
+ - **AI 卡片状态信息更准确 / More Accurate AI Card Status Content**
18
+ 在完成 AI 卡片时,对用于展示的内容与写入 `cardParamMap` 中的 `msgContent` 同步应用 Markdown 修正逻辑,保证用户看到的内容与卡片内部状态字段保持完全一致。
19
+ When finalizing AI cards, the same Markdown fixes are now applied both to the displayed content and the `msgContent` stored in `cardParamMap`, keeping the visible card and its internal state in sync.
20
+
21
+ ## 🐛 修复 / Fixes
22
+
23
+ - **Markdown 表格无法正确显示的问题 / Incorrect Markdown Table Rendering**
24
+ 修复了部分场景下 Markdown 表格前缺少空行,导致钉钉不将其识别为表格而当作普通文本渲染的问题;现在会自动检测表头与分隔行模式并在需要时插入空行。
25
+ Fixed an issue where missing blank lines before Markdown tables caused DingTalk to render them as plain text; the connector now detects table headers and divider lines and inserts a blank line when necessary.
26
+
27
+ - **消息去重维度优化 / Message De-duplication Scope Optimization**
28
+ 优化消息去重逻辑,从「按账号+消息 ID」改为仅基于「消息 ID」维度标记与判断,避免在多账号场景中出现某些重复消息未被正确拦截或误判的情况。
29
+ Improved the message de-duplication mechanism by switching from an account-scoped `(accountId, messageId)` key to a global `messageId` key, preventing edge cases where duplicate messages across accounts might not be handled correctly.
30
+
31
+ ## 📋 技术细节 / Technical Details
32
+
33
+ ### AI 卡片模版 & 内容处理 / AI Card Template & Content Handling
34
+
35
+ - 更新 `AI_CARD_TEMPLATE_ID` 为新的模版 ID,以匹配最新的钉钉 AI 卡片样式规范。
36
+ - 新增 `ensureTableBlankLines(text: string)` 工具函数:
37
+ - 将文本按行拆分,识别包含竖线的表格行与 `---` 分隔行。
38
+ - 当前行看起来像表头、下一行是分隔行、且前一行既不是空行也不是表格行时,会在表头前插入一个空行。
39
+ - 支持带缩进的表格写法,保持原有内容顺序与缩进风格不变。
40
+ - 在以下路径中统一使用 `ensureTableBlankLines`:
41
+ - AI 卡片流式内容更新(`streamAICard`)中的 `content` 字段。
42
+ - AI 卡片结束时(`finishAICard`)的最终内容与日志长度统计。
43
+ - 普通 Markdown 消息发送(`sendMarkdownMessage`),在追加 `@user` 之前先做表格修正。
44
+ - `buildMsgPayload` 中 `sampleMarkdown` 类型的 `text` 字段。
45
+ - 为单元测试导出 `__testables.ensureTableBlankLines`,便于在不依赖具体业务逻辑的情况下验证 Markdown 修正规则。
46
+
47
+ ### 消息去重逻辑 / Message De-duplication Logic
48
+
49
+ - 去重检查由 `isMessageProcessed(accountId, messageId)` 简化为 `isMessageProcessed(messageId)`,对同一消息 ID 统一判重。
50
+ - 标记逻辑由 `markMessageProcessed(accountId, messageId)` 更新为 `markMessageProcessed(messageId)`,减少多账号场景下可能出现的重复处理路径。
51
+ - 保持原有日志信息与跳过处理分支不变,仅调整内部去重键值结构。
52
+
53
+ ## 📥 安装升级 / Installation & Upgrade
54
+
55
+ ```bash
56
+ # 通过 npm 安装最新版本 / Install latest version via npm
57
+ openclaw plugins install @dingtalk-real-ai/dingtalk-connector
58
+
59
+ # 或升级现有版本 / Or upgrade existing version
60
+ openclaw plugins update dingtalk-connector
61
+
62
+ # 通过 Git 安装 / Install via Git
63
+ openclaw plugins install https://github.com/DingTalk-Real-AI/dingtalk-openclaw-connector.git
64
+ ```
65
+
66
+ ## ⚠️ 升级注意事项 / Upgrade Notes
67
+
68
+ ### 兼容性说明 / Compatibility Notes
69
+
70
+ - **向下兼容 / Backward Compatible**:本次为小版本修复和体验优化更新,在保留 v0.7.x 既有行为的前提下增强了 Markdown 表格渲染与消息去重逻辑,对现有配置完全兼容。
71
+ - **Markdown 表格渲染更稳定 / More Robust Markdown Tables**:即便原始内容中未严格遵守表格前空行的写法,Connector 也会自动做最小化修正,以提高在钉钉中的可读性。
72
+ - **消息去重语义更清晰 / Clearer De-duplication Semantics**:以 `messageId` 为唯一维度进行去重,更贴合钉钉消息唯一标识的语义。
73
+
74
+ ### 验证步骤 / Verification Steps
75
+
76
+ 升级到此版本后,建议进行以下验证:
77
+
78
+ 1. **AI 卡片模版与渲染验证 / AI Card Template & Rendering Verification**
79
+ - 触发一次典型的 AI 卡片对话,观察新模版下的卡片布局与字段展示是否符合预期。
80
+ - 在含有多段文字与表格的回复中,确认卡片内 Markdown 表格渲染正常。
81
+
82
+ 2. **Markdown 表格兼容性验证 / Markdown Table Compatibility Verification**
83
+ - 通过机器人发送包含 Markdown 表格的消息(包含表头、分隔行与多列数据),且故意在表格前省略空行。
84
+ - 在移动端及 PC 端查看,确认钉钉能够正确以表格形式渲染内容。
85
+
86
+ 3. **消息去重行为验证 / Message De-duplication Behavior Verification**
87
+ - 在相同会话中模拟重复推送同一个 `messageId` 的回调(或快速重复发送同一条消息)。
88
+ - 确认日志中出现去重命中提示,并且业务处理逻辑只执行一次。
89
+
90
+ ## 🔗 相关链接 / Related Links
91
+
92
+ - [完整变更日志 / Full Changelog](https://github.com/DingTalk-Real-AI/dingtalk-openclaw-connector/blob/main/CHANGELOG.md)
93
+ - [使用文档 / Documentation](https://github.com/DingTalk-Real-AI/dingtalk-openclaw-connector/blob/main/README.md)
94
+ - [问题反馈 / Issue Feedback](https://github.com/DingTalk-Real-AI/dingtalk-openclaw-connector/issues)
95
+
96
+ ---
97
+
98
+ **发布日期 / Release Date**:2026-03-13
99
+ **版本号 / Version**:v0.7.8
100
+ **兼容性 / Compatibility**:OpenClaw Gateway 0.4.0+
101
+
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "dingtalk-connector",
3
3
  "name": "DingTalk Channel",
4
- "version": "0.7.6",
4
+ "version": "0.7.8",
5
5
  "description": "DingTalk (钉钉) messaging channel via Stream mode with AI Card streaming",
6
6
  "author": "DingTalk Real Team",
7
7
  "channels": ["dingtalk-connector"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dingtalk-real-ai/dingtalk-connector",
3
- "version": "0.7.6",
3
+ "version": "0.7.8",
4
4
  "description": "DingTalk (钉钉) channel connector — Stream mode with AI Card streaming",
5
5
  "main": "plugin.ts",
6
6
  "type": "module",
@@ -8,8 +8,11 @@
8
8
  "build": "echo 'No build needed - jiti loads TS at runtime'",
9
9
  "lint": "echo 'Lint check skipped'",
10
10
  "lint:fix": "echo 'Lint fix skipped'",
11
- "test": "echo 'Tests skipped'",
12
- "test:watch": "echo 'Tests skipped'",
11
+ "test": "vitest run",
12
+ "test:watch": "vitest --watch",
13
+ "test:coverage": "vitest run --coverage",
14
+ "test:ui": "vitest --ui",
15
+ "test:integration": "vitest run tests/integration",
13
16
  "type-check": "npx tsc --noEmit",
14
17
  "version:check": "echo 'Version check skipped'",
15
18
  "release:prepare": "echo 'Release prepare skipped'",
@@ -39,13 +42,18 @@
39
42
  "access": "public"
40
43
  },
41
44
  "dependencies": {
42
- "dingtalk-stream": "^2.1.4",
45
+ "@ffmpeg-installer/ffmpeg": "^1.1.0",
43
46
  "axios": "^1.6.0",
47
+ "dingtalk-stream": "^2.1.4",
44
48
  "fluent-ffmpeg": "^2.1.3",
45
- "@ffmpeg-installer/ffmpeg": "^1.1.0",
46
49
  "mammoth": "^1.8.0",
47
50
  "pdf-parse": "^1.1.1"
48
51
  },
52
+ "devDependencies": {
53
+ "@types/node": "^20.19.37",
54
+ "typescript": "^5.6.0",
55
+ "vitest": "^1.6.0"
56
+ },
49
57
  "openclaw": {
50
58
  "extensions": [
51
59
  "./plugin.ts"