@jeik/dingtalk-connector 0.8.27 → 0.8.29
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 +48 -0
- package/README.en.md +40 -82
- package/README.md +50 -93
- package/dist/background-work-DkaSDqWk.mjs +53 -0
- package/dist/card-content-cache-C7-XHhHw.mjs +2 -0
- package/dist/{card-content-cache-CYUzCaQJ.mjs → card-content-cache-DT_OYThh.mjs} +15 -1
- package/dist/chunk-upload-BKM1y4Ba.mjs +2 -0
- package/dist/{chunk-upload-BBQgGtcZ.mjs → chunk-upload-CIU5G_ay.mjs} +1 -1
- package/dist/{common-DE0gd0Jg.mjs → common-BfIYs1yC.mjs} +3 -3
- package/dist/{common-B_A78n8u.mjs → common-C0Oaf0z-.mjs} +1 -1
- package/dist/connection-obtrPkj4.mjs +641 -0
- package/dist/entry-bundled.mjs +1 -1
- package/dist/{gateway-methods--aKsyMs-.mjs → gateway-methods-BdcpfxEZ.mjs} +1 -1
- package/dist/gateway-methods-DQ6TwOAr.mjs +2 -0
- package/dist/index.mjs +2 -2
- package/dist/{logger-mZ9OSbmD.mjs → logger-CnBTcwyq.mjs} +16 -2
- package/dist/logger-D8H2IcYz.mjs +2 -0
- package/dist/{media-BqpUGCni.mjs → media-DDtX37T2.mjs} +1 -1
- package/dist/{media-DnQB2BrL.mjs → media-g8tJtpfU.mjs} +29 -20
- package/dist/{message-handler-DQZiKx3i.mjs → message-handler-BrO2i7tg.mjs} +251 -139
- package/dist/{messaging-WleKf54h.mjs → messaging-CK0Wz3Ze.mjs} +23 -21
- package/dist/{runtime-DzZo6Gvk.mjs → runtime-DbqGRyhI.mjs} +6 -5
- package/dist/{utils-Bjh4r_qS.mjs → utils-Bwz2Fls_.mjs} +1 -1
- package/docs/RELEASE_NOTES_V0.8.28.md +56 -0
- package/docs/RELEASE_NOTES_V0.8.29.md +57 -0
- package/openclaw.plugin.json +9 -5
- package/package.json +2 -2
- package/src/config/schema.ts +2 -1
- package/src/core/connection.ts +504 -220
- package/src/core/message-handler.ts +197 -102
- package/src/reply-dispatcher.ts +244 -93
- package/src/services/media.ts +60 -27
- package/src/services/messaging/card-content-cache.ts +11 -6
- package/src/services/messaging/card.ts +2 -0
- package/src/services/messaging.ts +52 -38
- package/src/utils/background-work.ts +65 -0
- package/src/utils/logger.ts +23 -2
- package/dist/card-content-cache-Dwd8HICP.mjs +0 -2
- package/dist/chunk-upload-DaLXXZH3.mjs +0 -2
- package/dist/connection-fc6B4z4G.mjs +0 -423
- package/dist/gateway-methods-BQd4E0Sk.mjs +0 -2
- package/dist/logger-BmJkQkm1.mjs +0 -2
- /package/dist/{game-xiyou-CAT0ilSj.mjs → game-xiyou-uwsv23AC.mjs} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,54 @@ 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.29] - 2026-07-25
|
|
9
|
+
|
|
10
|
+
### 主题
|
|
11
|
+
|
|
12
|
+
正式版加固:默认日志更轻、排障只靠配置 `debug: true`;继承 0.8.28 连接/消息/错误卡能力。
|
|
13
|
+
|
|
14
|
+
### 变更
|
|
15
|
+
|
|
16
|
+
- 🧹 **默认静默诊断刷屏** — 无图文本回复不再输出 LocalImage / MediaIdTrace / CardCache / Quote 成功路径
|
|
17
|
+
- 🔍 **debug 配置统一开关** — 顶层或账号 `"debug": true` 打开连接摘要、图片 mediaId、引用回填、队列计数等详细日志;**不再依赖环境变量**
|
|
18
|
+
- 📚 **文档** — 安装命令精简为三条递进指导;README 中英同步至 0.8.29
|
|
19
|
+
|
|
20
|
+
### 继承(0.8.28)
|
|
21
|
+
|
|
22
|
+
- 基于官方 0.8.24 的长连接更稳、消息少丢、模型错误中文定稿、本仓库独有答案卡/图片能力
|
|
23
|
+
|
|
24
|
+
### 安装
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
# 1)装最新
|
|
28
|
+
openclaw plugins install @jeik/dingtalk-connector --force && openclaw gateway restart
|
|
29
|
+
|
|
30
|
+
# 2)若不是最新,指定版本
|
|
31
|
+
openclaw plugins install @jeik/dingtalk-connector@0.8.29 --force && openclaw gateway restart
|
|
32
|
+
|
|
33
|
+
# 3)仍失败时走 npm 官方源
|
|
34
|
+
NPM_CONFIG_REGISTRY=https://registry.npmjs.org openclaw plugins install @jeik/dingtalk-connector@0.8.29 --force && openclaw gateway restart
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## [0.8.28] - 2026-07-25
|
|
38
|
+
|
|
39
|
+
### 主题
|
|
40
|
+
|
|
41
|
+
基于**官方最新 0.8.24**,并保留**本仓库独有**优化:连接更稳、消息少丢、错误提示更清楚。
|
|
42
|
+
|
|
43
|
+
### 本版重点
|
|
44
|
+
|
|
45
|
+
- 长连接:能收消息才显示已连接;少假死误重连
|
|
46
|
+
- 消息:进队后再 ACK;排队反馈更及时
|
|
47
|
+
- 错误:503 / 欠费 / 无通道等中文定稿,少卡「正在召唤大模型」
|
|
48
|
+
- 本仓库独有:答案卡、图片全路径、首响等
|
|
49
|
+
|
|
50
|
+
### 安装
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
openclaw plugins install @jeik/dingtalk-connector@0.8.28 --force && openclaw gateway restart
|
|
54
|
+
```
|
|
55
|
+
|
|
8
56
|
## [0.8.26] - 2026-07-25
|
|
9
57
|
|
|
10
58
|
### 修复与优化 / Fixed & Improved
|
package/README.en.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
<img alt="DingTalk" src="https://raw.githubusercontent.com/DingTalk-Real-AI/dingtalk-openclaw-connector/main/docs/images/dingtalk.svg" width="72" height="72" />
|
|
3
3
|
<h1>dingtalk-openclaw-connector(Community Maintained Fork)</h1>
|
|
4
|
-
<p>Community
|
|
5
|
-
|
|
4
|
+
<p>Community-enhanced fork based on official <strong>v0.8.24</strong>: adopts official long-connection improvements, plus stronger message delivery, queue feedback, and error-card UX.<br/>
|
|
5
|
+
Keeps <strong>this repo’s unique</strong> extras (images, answer cards, first-response UX) and continues to fix issues not yet covered upstream.</p>
|
|
6
6
|
|
|
7
|
-
<p><strong>Current
|
|
7
|
+
<p><strong>Current release: <a href="https://www.npmjs.com/package/@jeik/dingtalk-connector">@jeik/dingtalk-connector</a> v0.8.29</strong></p>
|
|
8
8
|
|
|
9
9
|
<p>
|
|
10
10
|
<a href="https://www.npmjs.com/package/@jeik/dingtalk-connector"><img src="https://img.shields.io/npm/v/@jeik/dingtalk-connector.svg?style=flat&colorA=18181B&colorB=28CF8D" alt="npm version" /></a>
|
|
@@ -23,52 +23,31 @@
|
|
|
23
23
|
|
|
24
24
|
## 🔧 Recent Updates
|
|
25
25
|
|
|
26
|
-
### 🚀 v0.8.
|
|
26
|
+
### 🚀 v0.8.29 · 2026-07-25 (current)
|
|
27
27
|
|
|
28
|
-
**Theme:
|
|
28
|
+
**Theme: production hardening · quieter logs · debug config only**
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
|
33
|
-
|
|
34
|
-
|
|
|
30
|
+
Built on **0.8.28** (steadier connection / fewer lost messages / clearer error cards):
|
|
31
|
+
|
|
32
|
+
| Experience | Effect |
|
|
33
|
+
|------------|--------|
|
|
34
|
+
| 🧹 **Quieter by default** | No LocalImage / MediaIdTrace / CardCache spam on normal text replies |
|
|
35
|
+
| 🔍 **Simple debug** | Set `"debug": true` for connection, image, quote, and queue diagnostics (no env vars) |
|
|
36
|
+
| 🔗 **Connection / queue** | Connected only when messages can be received; better multi-send and post-error recovery |
|
|
37
|
+
| ⚠️ **Model failures** | 503 / billing / no-channel settle to clear Chinese cards instead of spinning forever |
|
|
38
|
+
| 🃏 **This repo’s unique extras** | Answer cards, full image paths, first-response UX remain |
|
|
35
39
|
|
|
36
40
|
```bash
|
|
37
|
-
|
|
41
|
+
openclaw plugins install @jeik/dingtalk-connector --force && openclaw gateway restart
|
|
38
42
|
```
|
|
39
43
|
|
|
40
|
-
### 📦 v0.8.
|
|
41
|
-
|
|
42
|
-
`file://` no longer misclassified as remote (grey-image fix).
|
|
43
|
-
|
|
44
|
-
### 📦 v0.8.21-fix46 · 2026-07-20
|
|
45
|
-
|
|
46
|
-
Always-on local MD image diagnostics.
|
|
44
|
+
### 📦 v0.8.28 · 2026-07-25
|
|
47
45
|
|
|
48
|
-
|
|
46
|
+
Official 0.8.24-aligned connection & delivery hardening (included in 0.8.29).
|
|
49
47
|
|
|
50
|
-
|
|
48
|
+
### 📦 v0.8.26 / 0.8.25 and earlier
|
|
51
49
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
Remote `media` download-then-upload.
|
|
55
|
-
|
|
56
|
-
### 📦 v0.8.21-fix37 · 2026-07-20
|
|
57
|
-
|
|
58
|
-
Local images (incl. `/mnt`) · `messageImageMd` · LocalImage diagnostics.
|
|
59
|
-
|
|
60
|
-
---
|
|
61
|
-
|
|
62
|
-
### Earlier releases (summary)
|
|
63
|
-
|
|
64
|
-
| Date | Highlights |
|
|
65
|
-
|------|------------|
|
|
66
|
-
| 2026-07-14 | **fix31** — serial stream queue; dual-card threshold; error mapping; ACK UX; wizard accountId; drop `cardToolVar`/`cardProcessVar` |
|
|
67
|
-
| 2026-06-29 | Answer-card 500 fix; threshold 500; deferred card create; empty message-card fix; tool progress; wizard upgrades |
|
|
68
|
-
| 2026-06-28 | npm `@jeik/dingtalk-connector`; premature finalization fix |
|
|
69
|
-
| 2026-05 | MD images; multi-turn spam; 4.29 empty reply; WS phantom reconnect |
|
|
70
|
-
|
|
71
|
-
Full log: [CHANGELOG.md](CHANGELOG.md) · [FIXES.md](FIXES.md) · [Release fix48](docs/RELEASE_NOTES_V0.8.21-fix49.md)
|
|
50
|
+
Target ID rules, sender identity, answer cards, image fixes — see [CHANGELOG.md](CHANGELOG.md).
|
|
72
51
|
|
|
73
52
|
---
|
|
74
53
|
|
|
@@ -239,68 +218,43 @@ Community contributions (features & bug fixes) are always welcome — submit a P
|
|
|
239
218
|
|
|
240
219
|
| Item | Description |
|
|
241
220
|
|------|-------------|
|
|
242
|
-
| Base |
|
|
243
|
-
| Fixes |
|
|
221
|
+
| Base | Aligned with official **v0.8.24** long-connection work + this repo’s unique extras |
|
|
222
|
+
| Fixes | Silent connection, lost messages, stuck error cards, grey images, etc. |
|
|
244
223
|
| Maintenance | Community maintained, continuously tracking official updates |
|
|
245
224
|
|
|
246
225
|
---
|
|
247
226
|
|
|
248
227
|
## Requirements & Installation
|
|
249
228
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
-
|
|
253
|
-
-
|
|
254
|
-
|
|
255
|
-
> If below this version, upgrade with: `npm install -g openclaw`
|
|
256
|
-
|
|
257
|
-
---
|
|
258
|
-
|
|
259
|
-
## Installation
|
|
260
|
-
|
|
261
|
-
> Same channel id as the official plugin (`dingtalk-connector`); `--force` overwrites in place — **no uninstall** needed.
|
|
262
|
-
> **Current stable: `0.8.21-fix31`** (npm `latest`). Always run `openclaw gateway restart` after install/upgrade.
|
|
263
|
-
|
|
264
|
-
### Option 1: npm (recommended)
|
|
229
|
+
- **OpenClaw** installed and running ([website](https://openclaw.ai/))
|
|
230
|
+
- **Version**: OpenClaw ≥ **2026.4.9** (`openclaw -v`)
|
|
231
|
+
- Same channel id as official (`dingtalk-connector`); `--force` overwrites — **no uninstall** needed
|
|
232
|
+
- Always `openclaw gateway restart` after install/upgrade
|
|
265
233
|
|
|
266
234
|
Package: [`@jeik/dingtalk-connector`](https://www.npmjs.com/package/@jeik/dingtalk-connector)
|
|
267
235
|
|
|
268
|
-
|
|
236
|
+
### Three install commands (try in order)
|
|
269
237
|
|
|
270
238
|
```bash
|
|
271
|
-
|
|
239
|
+
# 1) Install latest
|
|
240
|
+
openclaw plugins install @jeik/dingtalk-connector --force && openclaw gateway restart
|
|
272
241
|
|
|
273
|
-
#
|
|
274
|
-
|
|
275
|
-
```
|
|
276
|
-
|
|
277
|
-
**2) Plugin only** (credentials already set / manual setup):
|
|
242
|
+
# 2) If you did not get the latest, pin the version
|
|
243
|
+
openclaw plugins install @jeik/dingtalk-connector@0.8.29 --force && openclaw gateway restart
|
|
278
244
|
|
|
279
|
-
|
|
280
|
-
openclaw plugins install @jeik/dingtalk-connector --force
|
|
281
|
-
openclaw gateway restart
|
|
245
|
+
# 3) If it still fails, force the official npm registry
|
|
246
|
+
NPM_CONFIG_REGISTRY=https://registry.npmjs.org openclaw plugins install @jeik/dingtalk-connector@0.8.29 --force && openclaw gateway restart
|
|
282
247
|
```
|
|
283
248
|
|
|
284
|
-
|
|
249
|
+
> Optional QR wizard: `npx @jeik/dingtalk-connector install --force`
|
|
285
250
|
|
|
286
|
-
|
|
287
|
-
openclaw plugins install @jeik/dingtalk-connector --force
|
|
288
|
-
openclaw gateway restart
|
|
289
|
-
```
|
|
290
|
-
|
|
291
|
-
### Option 2: Local tgz / from source (dev / offline)
|
|
251
|
+
### Local tgz / from source (dev / offline)
|
|
292
252
|
|
|
293
253
|
```bash
|
|
294
254
|
git clone https://github.com/jeikl/dingtalk-openclaw-connector-fix-Community.git
|
|
295
255
|
cd dingtalk-openclaw-connector-fix-Community
|
|
296
|
-
# optional: pin a release (this is a git tag, not a branch)
|
|
297
|
-
# git fetch --tags && git checkout v0.8.21-fix31
|
|
298
|
-
|
|
299
256
|
npm install && npm run build && npm pack
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
openclaw plugins install ./jeik-dingtalk-connector-0.8.21-fix31.tgz --force
|
|
303
|
-
openclaw gateway restart
|
|
257
|
+
openclaw plugins install ./jeik-dingtalk-connector-0.8.29.tgz --force && openclaw gateway restart
|
|
304
258
|
```
|
|
305
259
|
|
|
306
260
|
### Smoke check
|
|
@@ -308,9 +262,13 @@ openclaw gateway restart
|
|
|
308
262
|
```bash
|
|
309
263
|
openclaw -v
|
|
310
264
|
openclaw plugins list
|
|
311
|
-
# Send a DingTalk message —
|
|
265
|
+
# Send a DingTalk message — first “summoning model…”, then streaming / answer card
|
|
312
266
|
```
|
|
313
267
|
|
|
268
|
+
### Debug logs
|
|
269
|
+
|
|
270
|
+
Set `"debug": true` under `channels.dingtalk-connector` (or a specific account), then restart the gateway. No environment variables required.
|
|
271
|
+
|
|
314
272
|
---
|
|
315
273
|
|
|
316
274
|
## Usage Guide
|
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
<img alt="DingTalk" src="https://raw.githubusercontent.com/DingTalk-Real-AI/dingtalk-openclaw-connector/main/docs/images/dingtalk.svg" width="72" height="72" />
|
|
3
3
|
<h1>dingtalk-openclaw-connector(社区维护版)</h1>
|
|
4
|
-
<p
|
|
5
|
-
|
|
4
|
+
<p>基于官方最新 <strong>v0.8.24</strong> 的社区增强版:吸收官方长连接改进,并重点优化消息接收、排队反馈与模型错误展示。<br/>
|
|
5
|
+
保留社区在图片、答案卡、首响体验上的增强,持续修官方暂未覆盖的实际使用问题。</p>
|
|
6
6
|
|
|
7
|
-
<p><strong
|
|
7
|
+
<p><strong>当前正式版:<a href="https://www.npmjs.com/package/@jeik/dingtalk-connector">@jeik/dingtalk-connector</a> v0.8.29</strong></p>
|
|
8
8
|
|
|
9
9
|
<p>
|
|
10
10
|
<a href="https://www.npmjs.com/package/@jeik/dingtalk-connector"><img src="https://img.shields.io/npm/v/@jeik/dingtalk-connector.svg?style=flat&colorA=18181B&colorB=28CF8D" alt="npm version" /></a>
|
|
@@ -23,60 +23,31 @@
|
|
|
23
23
|
|
|
24
24
|
## 🔧 最近更新
|
|
25
25
|
|
|
26
|
-
### 🚀 v0.8.
|
|
26
|
+
### 🚀 v0.8.29 · 2026-07-25(当前正式版)
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
**主题:正式加固 · 日志更干净 · 排障只开 debug**
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|--|------|
|
|
32
|
-
| 🎯 **目标 ID 约束强化** | 出站消息回复指引强化,约束 target ID 完整保留 Base64/特殊字符后缀(如 `==`、`=`)与大小写 |
|
|
30
|
+
在 **0.8.28**(连接更稳 / 消息少丢 / 错误卡可定稿)基础上再打磨:
|
|
33
31
|
|
|
34
|
-
| |
|
|
35
|
-
|
|
36
|
-
|
|
|
37
|
-
|
|
|
38
|
-
|
|
|
32
|
+
| 体验 | 效果 |
|
|
33
|
+
|------|------|
|
|
34
|
+
| 🧹 **默认日志更轻** | 无图正常回复不再刷 LocalImage / MediaIdTrace / CardCache |
|
|
35
|
+
| 🔍 **排障更简单** | 配置 `"debug": true` 即输出连接、图片、引用、队列详细日志(无需环境变量) |
|
|
36
|
+
| 🔗 **连接 / 队列** | 继承 0.8.28:能收消息才算在线;连发、错误后再发更稳;排队反馈更及时 |
|
|
37
|
+
| ⚠️ **模型故障** | 503 / 欠费 / 无通道等更容易定格中文错误,少卡「正在召唤大模型」 |
|
|
38
|
+
| 🃏 **本仓库独有** | 答案卡、图片全路径、首响体验等继续保留 |
|
|
39
39
|
|
|
40
40
|
```bash
|
|
41
|
-
|
|
41
|
+
openclaw plugins install @jeik/dingtalk-connector --force && openclaw gateway restart
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
-
### 📦 v0.8.
|
|
45
|
-
|
|
46
|
-
`message` 工具默认答案卡(可关);增强模板字段一致。
|
|
47
|
-
|
|
48
|
-
### 📦 v0.8.21-fix47 · 2026-07-20
|
|
49
|
-
|
|
50
|
-
`file://` 本地图误判远程修复(不再 `fetch failed` 灰图)。
|
|
51
|
-
|
|
52
|
-
### 📦 v0.8.21-fix46 · 2026-07-20
|
|
53
|
-
|
|
54
|
-
本地 MD 图灰图诊断日志(LocalImage / MediaIdTrace)。
|
|
55
|
-
|
|
56
|
-
### 📦 v0.8.21-fix45 · 2026-07-20
|
|
57
|
-
|
|
58
|
-
图 + 下载链接单气泡 · 只认 `![]` · 引用卡片缓存 · residual 误报修复。
|
|
59
|
-
|
|
60
|
-
### 📦 v0.8.21-fix38 · 2026-07-20
|
|
61
|
-
|
|
62
|
-
message 远程 `media` 下载上传。
|
|
44
|
+
### 📦 v0.8.28 · 2026-07-25
|
|
63
45
|
|
|
64
|
-
|
|
46
|
+
基于官方 0.8.24 的长连接与消息体验加固(当前能力已并入 0.8.29)。
|
|
65
47
|
|
|
66
|
-
|
|
48
|
+
### 📦 v0.8.26 / 0.8.25 及更早
|
|
67
49
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
### 更早版本(摘要)
|
|
71
|
-
|
|
72
|
-
| 日期 | 版本 / 要点 |
|
|
73
|
-
|------|-------------|
|
|
74
|
-
| 2026-07-14 | **fix31** — 流式串行队列防半截;双卡 `answerActToken`;错误中文映射;召唤 ACK;安装向导 accountId 推导;去掉 `cardToolVar`/`cardProcessVar` |
|
|
75
|
-
| 2026-06-29 | 答案卡 500 修复;阈值默认 500;延迟建卡;message 空卡修复;答案卡模式;工具进度展示;过程消息误终稿修复;安装向导增强 |
|
|
76
|
-
| 2026-06-28 | 上线 npm `@jeik/dingtalk-connector`;过程消息提前定稿修复 |
|
|
77
|
-
| 2026-05 | MD 直链/本地图;多轮刷屏;4.29+ 无文本输出;WebSocket 幻影重连 |
|
|
78
|
-
|
|
79
|
-
完整说明:[CHANGELOG.md](CHANGELOG.md) · [FIXES.md](FIXES.md) · [Release fix48](docs/RELEASE_NOTES_V0.8.21-fix49.md)
|
|
50
|
+
目标 ID 约束、发送人身份、答案卡、图片修复等——详见 [CHANGELOG.md](CHANGELOG.md)。
|
|
80
51
|
|
|
81
52
|
---
|
|
82
53
|
|
|
@@ -212,9 +183,23 @@ message 远程 `media` 下载上传。
|
|
|
212
183
|
| `answerCardTemplateId` | string | `d246b7f5-1783-4e9b-bb46-bef52d63050e.schema` | 答案静态卡模板 |
|
|
213
184
|
| `messageAnswerCard` | boolean | **true** | message 工具正文走答案静态卡;`false`=普通消息 |
|
|
214
185
|
| `messageImageMd` | boolean | **false** | message 图文:`false` 文图分开;`true` 可合并 markdown |
|
|
186
|
+
| `debug` | boolean | **false** | 详细诊断日志(连接/图片 mediaId/引用回填/队列)。**日常关闭**;排障时顶层或某账号设 `true`,改完 `openclaw gateway restart` |
|
|
215
187
|
|
|
216
188
|
> `answerCard` = 对话流式收尾;`messageAnswerCard` = message 工具外发。
|
|
217
189
|
|
|
190
|
+
**临时开排障日志示例:**
|
|
191
|
+
|
|
192
|
+
```json
|
|
193
|
+
"channels": {
|
|
194
|
+
"dingtalk-connector": {
|
|
195
|
+
"enabled": true,
|
|
196
|
+
"clientId": "…",
|
|
197
|
+
"clientSecret": "…",
|
|
198
|
+
"debug": true
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|
|
218
203
|
---
|
|
219
204
|
|
|
220
205
|
## 🎯 回复标记 + 答案卡 + 工具进度(核心增强)
|
|
@@ -251,79 +236,51 @@ message 远程 `media` 下载上传。
|
|
|
251
236
|
|
|
252
237
|
| 项目 | 说明 |
|
|
253
238
|
|------|------|
|
|
254
|
-
| 基础版本 |
|
|
255
|
-
| 修复内容 |
|
|
239
|
+
| 基础版本 | 对齐官方 **v0.8.24** 长连接能力,并叠加本仓库独有优化 |
|
|
240
|
+
| 修复内容 | 连接假死、消息丢失、错误卡卡住、图片灰图等实际使用问题 |
|
|
256
241
|
| 维护方式 | 社区维护,持续跟进官方更新 |
|
|
257
242
|
|
|
258
243
|
---
|
|
259
244
|
|
|
260
245
|
## 安装与要求
|
|
261
246
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
-
|
|
265
|
-
-
|
|
266
|
-
|
|
267
|
-
> 如低于此版本,执行 `npm install -g openclaw` 升级。
|
|
268
|
-
|
|
269
|
-
---
|
|
270
|
-
|
|
271
|
-
## 安装
|
|
272
|
-
|
|
273
|
-
> 与官方插件同 channel id(`dingtalk-connector`),`--force` 直接覆盖更新,**无需先卸载**官方版或旧版。
|
|
274
|
-
> **当前稳定版:`0.8.21-fix31`**(npm `latest` 已指向本版)。安装/更新后**必须** `openclaw gateway restart`。
|
|
275
|
-
|
|
276
|
-
### 方式一:npm(推荐)
|
|
247
|
+
- **OpenClaw** 已安装并正常运行([官网](https://openclaw.ai/))
|
|
248
|
+
- **版本**:OpenClaw ≥ **2026.4.9**(`openclaw -v`)
|
|
249
|
+
- 与官方插件同 channel id(`dingtalk-connector`),`--force` 可直接覆盖,**无需先卸载**
|
|
250
|
+
- 安装/更新后**必须** `openclaw gateway restart`
|
|
277
251
|
|
|
278
252
|
包名:[`@jeik/dingtalk-connector`](https://www.npmjs.com/package/@jeik/dingtalk-connector)
|
|
279
253
|
|
|
280
|
-
|
|
254
|
+
### 三条安装命令(按顺序试)
|
|
281
255
|
|
|
282
256
|
```bash
|
|
283
|
-
|
|
257
|
+
# 1)装最新
|
|
258
|
+
openclaw plugins install @jeik/dingtalk-connector --force && openclaw gateway restart
|
|
284
259
|
|
|
285
|
-
#
|
|
286
|
-
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
**2)只装插件**(凭证已配好,或走手动配置文档):
|
|
260
|
+
# 2)若装到的不是最新,指定版本号
|
|
261
|
+
openclaw plugins install @jeik/dingtalk-connector@0.8.29 --force && openclaw gateway restart
|
|
290
262
|
|
|
291
|
-
|
|
292
|
-
openclaw plugins install @jeik/dingtalk-connector --force
|
|
293
|
-
openclaw gateway restart
|
|
263
|
+
# 3)若仍装不了,强制走 npm 官方源
|
|
264
|
+
NPM_CONFIG_REGISTRY=https://registry.npmjs.org openclaw plugins install @jeik/dingtalk-connector@0.8.29 --force && openclaw gateway restart
|
|
294
265
|
```
|
|
295
266
|
|
|
296
|
-
|
|
267
|
+
> 一键扫码建机器人(可选):`npx @jeik/dingtalk-connector install --force`
|
|
297
268
|
|
|
298
|
-
|
|
299
|
-
openclaw plugins install @jeik/dingtalk-connector --force
|
|
300
|
-
openclaw gateway restart
|
|
301
|
-
```
|
|
302
|
-
|
|
303
|
-
### 方式二:本地 tgz / 源码构建(开发、离线、预发验证)
|
|
269
|
+
### 本地 tgz / 源码(开发、离线)
|
|
304
270
|
|
|
305
271
|
```bash
|
|
306
272
|
git clone https://github.com/jeikl/dingtalk-openclaw-connector-fix-Community.git
|
|
307
273
|
cd dingtalk-openclaw-connector-fix-Community
|
|
308
|
-
# 可选:钉到某次发布(这是 git tag,不是分支;clone 后可直接 checkout)
|
|
309
|
-
# git fetch --tags && git checkout v0.8.21-fix31
|
|
310
|
-
|
|
311
274
|
npm install && npm run build && npm pack
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
openclaw plugins install ./jeik-dingtalk-connector-0.8.21-fix31.tgz --force
|
|
315
|
-
openclaw gateway restart
|
|
275
|
+
openclaw plugins install ./jeik-dingtalk-connector-0.8.29.tgz --force && openclaw gateway restart
|
|
316
276
|
```
|
|
317
277
|
|
|
318
|
-
> 国内若 clone 慢,可用镜像前缀,例如:
|
|
319
|
-
> `git clone https://ghfast.top/https://github.com/jeikl/dingtalk-openclaw-connector-fix-Community.git`
|
|
320
|
-
|
|
321
278
|
### 安装后自检
|
|
322
279
|
|
|
323
280
|
```bash
|
|
324
|
-
openclaw -v #
|
|
281
|
+
openclaw -v # ≥ 2026.4.9
|
|
325
282
|
openclaw plugins list # 应看到 dingtalk-connector / @jeik/dingtalk-connector
|
|
326
|
-
#
|
|
283
|
+
# 发一条钉钉消息:应先「正在召唤大模型…」,再流式/答案卡
|
|
327
284
|
```
|
|
328
285
|
|
|
329
286
|
---
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { r as isDingtalkDebug } from "./logger-CnBTcwyq.mjs";
|
|
2
|
+
//#region src/utils/background-work.ts
|
|
3
|
+
/**
|
|
4
|
+
* 后台任务引用计数。
|
|
5
|
+
*
|
|
6
|
+
* 钉钉 WS 回调只「入队」后就返回,真正的 AI 跑在 sessionQueues 后台 Promise 里。
|
|
7
|
+
* 若只在 WS 回调里 markMessageProcessingStart/End,会在入队后立刻 End,
|
|
8
|
+
* 长任务(尤其 503 重试)期间心跳超时会触发幽灵重连 → 后续消息「网关没反应」。
|
|
9
|
+
*
|
|
10
|
+
* 用法:session 队列任务创建后 trackBackgroundWork(taskPromise)。
|
|
11
|
+
* connection 层订阅计数变化,在 count>0 时保持处理中 keepAlive。
|
|
12
|
+
*/
|
|
13
|
+
let activeCount = 0;
|
|
14
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
15
|
+
function getActiveBackgroundWorkCount() {
|
|
16
|
+
return activeCount;
|
|
17
|
+
}
|
|
18
|
+
/** 订阅计数变化;返回取消订阅函数 */
|
|
19
|
+
function onBackgroundWorkCountChange(listener) {
|
|
20
|
+
listeners.add(listener);
|
|
21
|
+
return () => {
|
|
22
|
+
listeners.delete(listener);
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function notify() {
|
|
26
|
+
for (const listener of listeners) try {
|
|
27
|
+
listener(activeCount);
|
|
28
|
+
} catch {}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* 跟踪一个后台 Promise:开始 +1,settle -1。
|
|
32
|
+
* 重复 settle 安全(只减一次)。
|
|
33
|
+
*/
|
|
34
|
+
function trackBackgroundWork(work, label) {
|
|
35
|
+
activeCount += 1;
|
|
36
|
+
notify();
|
|
37
|
+
let settled = false;
|
|
38
|
+
const done = () => {
|
|
39
|
+
if (settled) return;
|
|
40
|
+
settled = true;
|
|
41
|
+
activeCount = Math.max(0, activeCount - 1);
|
|
42
|
+
notify();
|
|
43
|
+
};
|
|
44
|
+
work.then(done, done);
|
|
45
|
+
if (label && typeof process !== "undefined" && isDingtalkDebug()) {
|
|
46
|
+
console.log(`[DingTalk][bgWork] +1 label=${label} count=${activeCount}`);
|
|
47
|
+
work.finally(() => {
|
|
48
|
+
console.log(`[DingTalk][bgWork] -1 label=${label} count=${activeCount}`);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
//#endregion
|
|
53
|
+
export { onBackgroundWorkCountChange as n, trackBackgroundWork as r, getActiveBackgroundWorkCount as t };
|
|
@@ -1,4 +1,18 @@
|
|
|
1
|
+
import { r as isDingtalkDebug } from "./logger-CnBTcwyq.mjs";
|
|
1
2
|
//#region src/services/messaging/card-content-cache.ts
|
|
3
|
+
/**
|
|
4
|
+
* AI / 交互卡片正文缓存
|
|
5
|
+
*
|
|
6
|
+
* 钉钉「引用 AI 卡片」时,回调里的 repliedMsg 经常是:
|
|
7
|
+
* { msgType: "interactiveCard", content: {} 或仅有 templateId }
|
|
8
|
+
* 不带可读正文 → 模型侧只看到 `[引用] [interactiveCard消息]`。
|
|
9
|
+
*
|
|
10
|
+
* 对策:我们在 finishAICard / 定稿时把 outTrackId → 正文 记下来;
|
|
11
|
+
* 引用时仅用载荷里的 outTrackId / msgId 等精确回填。
|
|
12
|
+
* 默认不做「会话最近一条」兜底(会把错误卡片正文当成用户引用的内容)。
|
|
13
|
+
*
|
|
14
|
+
* 内存 LRU + TTL,进程重启后清空(可接受)。
|
|
15
|
+
*/
|
|
2
16
|
const MAX_ENTRIES = 300;
|
|
3
17
|
/** 默认保留 7 天(引用历史卡片) */
|
|
4
18
|
const DEFAULT_TTL_MS = 10080 * 60 * 1e3;
|
|
@@ -39,7 +53,7 @@ function rememberCardContent(params) {
|
|
|
39
53
|
byConversation.set(cid, next);
|
|
40
54
|
byKey.set(normalizeKey("convRef", `${cid}|${ref}`), entry);
|
|
41
55
|
}
|
|
42
|
-
try {
|
|
56
|
+
if (isDingtalkDebug()) try {
|
|
43
57
|
console.log(`[DingTalk][CardCache] 已缓存 | outTrack=${params.outTrackId || "-"} conv=${params.conversationId || "-"} len=${text.length}`);
|
|
44
58
|
} catch {}
|
|
45
59
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as createLogger } from "./logger-
|
|
1
|
+
import { t as createLogger } from "./logger-CnBTcwyq.mjs";
|
|
2
2
|
import { r as dingtalkUploadHttp } from "./http-client-DFWZgO1n.mjs";
|
|
3
|
-
import { t as CHUNK_CONFIG } from "./chunk-upload-
|
|
3
|
+
import { t as CHUNK_CONFIG } from "./chunk-upload-CIU5G_ay.mjs";
|
|
4
4
|
import * as fs from "fs";
|
|
5
5
|
import * as path from "path";
|
|
6
6
|
import FormData from "form-data";
|
|
@@ -48,7 +48,7 @@ async function uploadMediaToDingTalk(filePath, mediaType, oapiToken, maxSize = 2
|
|
|
48
48
|
if ((mediaType === "video" || mediaType === "file") && fileSize > CHUNK_CONFIG.SIZE_THRESHOLD) {
|
|
49
49
|
log?.info?.(`文件超过 20MB,使用分块上传:${absPath} (${fileSizeMB}MB)`);
|
|
50
50
|
try {
|
|
51
|
-
const { uploadLargeFileByChunks } = await import("./chunk-upload-
|
|
51
|
+
const { uploadLargeFileByChunks } = await import("./chunk-upload-BKM1y4Ba.mjs");
|
|
52
52
|
const downloadCode = await uploadLargeFileByChunks(absPath, mediaType, oapiToken, debugEnabled);
|
|
53
53
|
if (downloadCode) {
|
|
54
54
|
log?.info?.(`分块上传成功:${absPath}, download_code: ${downloadCode}`);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as VIDEO_MARKER_PATTERN, r as FILE_MARKER_PATTERN, t as AUDIO_MARKER_PATTERN } from "./common-
|
|
1
|
+
import { i as VIDEO_MARKER_PATTERN, r as FILE_MARKER_PATTERN, t as AUDIO_MARKER_PATTERN } from "./common-BfIYs1yC.mjs";
|
|
2
2
|
export { AUDIO_MARKER_PATTERN, FILE_MARKER_PATTERN, VIDEO_MARKER_PATTERN };
|