@jeik/dingtalk-connector 0.8.27-fix3 → 0.8.28
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 +49 -0
- package/README.en.md +28 -35
- package/README.md +28 -43
- package/dist/background-work-Cxb4b-91.mjs +42 -0
- package/dist/card-content-cache-c4Ls96eJ.mjs +2 -0
- package/dist/chunk-upload-PwhogwfE.mjs +2 -0
- package/dist/{common-DE0gd0Jg.mjs → common-BZiVgd3A.mjs} +2 -2
- package/dist/{common-B_A78n8u.mjs → common-DgL28gCZ.mjs} +1 -1
- package/dist/{connection-fc6B4z4G.mjs → connection-CZ7ZoN5_.mjs} +313 -86
- package/dist/entry-bundled.mjs +1 -1
- package/dist/gateway-methods-BkI1gKaC.mjs +2 -0
- package/dist/{gateway-methods-CfTm9PW_.mjs → gateway-methods-kNX3qvqw.mjs} +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{message-handler-CCbPqctq.mjs → message-handler-B1usz1wb.mjs} +237 -122
- package/dist/{messaging-Dvlan9M0.mjs → messaging-DVS3UKOp.mjs} +1 -1
- package/dist/{runtime-8WBX1FSq.mjs → runtime-A6G7WAWn.mjs} +3 -3
- package/docs/RELEASE_NOTES_V0.8.28.md +56 -0
- package/package.json +2 -2
- package/src/core/connection.ts +465 -158
- package/src/core/message-handler.ts +175 -84
- package/src/reply-dispatcher.ts +234 -77
- package/src/utils/background-work.ts +63 -0
- package/dist/card-content-cache-Dwd8HICP.mjs +0 -2
- package/dist/chunk-upload-DaLXXZH3.mjs +0 -2
- package/dist/gateway-methods-UECIpwQ9.mjs +0 -2
- /package/dist/{card-content-cache-CYUzCaQJ.mjs → card-content-cache-bDQFz2u8.mjs} +0 -0
- /package/dist/{chunk-upload-BBQgGtcZ.mjs → chunk-upload-BE71drPg.mjs} +0 -0
- /package/dist/{game-xiyou-CAT0ilSj.mjs → game-xiyou-uwsv23AC.mjs} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,55 @@ 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.28] - 2026-07-25
|
|
9
|
+
|
|
10
|
+
### 主题
|
|
11
|
+
|
|
12
|
+
基于**官方最新 0.8.24** 继续做社区增强:把连接做稳、消息少丢、错误提示更清楚。少折腾、多好用。
|
|
13
|
+
|
|
14
|
+
### 基于官方 0.8.24 吸收的能力
|
|
15
|
+
|
|
16
|
+
- 更稳的长连接思路:连接建立后再挂心跳相关监听,减少「看起来连着、其实收不到消息」的假死重连
|
|
17
|
+
- 机器人忙着回上一条时,处理过程中也会保持连接活跃,长回复不容易被中途掐断
|
|
18
|
+
- 上游 SDK 刷屏日志过滤,控制台更干净,少误判成故障
|
|
19
|
+
- 空回复时的友好提示(尤其是群聊配置不当的情况)
|
|
20
|
+
|
|
21
|
+
> 说明:官方给其他插件用的「卡片创建/更新开放接口」本版**未合入**(对话体验不依赖它)。需要时可后续单独加。
|
|
22
|
+
|
|
23
|
+
### 本版重点优化(效果向)
|
|
24
|
+
|
|
25
|
+
**1. 长连接更稳**
|
|
26
|
+
- 只有钉钉确认「这条连接可以收机器人消息」之后,才对外显示已连接
|
|
27
|
+
- 连不上会自动多试几轮,而不是假装在线
|
|
28
|
+
- 正常使用时尽量不乱拆连接,减少「连发好几条消息完全没反应」
|
|
29
|
+
|
|
30
|
+
**2. 消息更少丢、反馈更快**
|
|
31
|
+
- 消息进队成功后再向钉钉确认已收到,失败可让平台重发,避免「确认了却其实没处理」
|
|
32
|
+
- 同一会话排队处理更可靠:任务进行中再发消息,更容易马上出现「已排队 / 处理中」提示和思考中表情
|
|
33
|
+
- 单条任务卡住太久会自动放开队列,避免后面消息永远等不到
|
|
34
|
+
|
|
35
|
+
**3. 模型出错时体验更好**
|
|
36
|
+
- 上游欠费、无可用线路、503 等失败时,群聊/私聊都更容易定格成清晰中文错误卡片
|
|
37
|
+
- 减少卡在「正在召唤大模型…」或莫名「思考完成」却看不到原因的情况
|
|
38
|
+
- 错误结束后继续发消息,响应能力明显好于旧版
|
|
39
|
+
|
|
40
|
+
**4. 社区原有增强(继续保留)**
|
|
41
|
+
- 即时首响卡片、大段答案独立答案卡、图片/本地图修复、中文错误映射、强制群聊正常回复合流等
|
|
42
|
+
|
|
43
|
+
### 安装
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
npx -y @jeik/dingtalk-connector@0.8.28 install --force
|
|
47
|
+
openclaw gateway restart
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
或:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
openclaw plugins install @jeik/dingtalk-connector@0.8.28 --force
|
|
54
|
+
openclaw gateway restart
|
|
55
|
+
```
|
|
56
|
+
|
|
8
57
|
## [0.8.26] - 2026-07-25
|
|
9
58
|
|
|
10
59
|
### 修复与优化 / 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 community 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.28</strong> (recommended for production; install: <code>npx -y @jeik/dingtalk-connector@0.8.28 install --force</code>).</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,45 @@
|
|
|
23
23
|
|
|
24
24
|
## 🔧 Recent Updates
|
|
25
25
|
|
|
26
|
-
### 🚀 v0.8.
|
|
26
|
+
### 🚀 v0.8.28 · 2026-07-25 (current)
|
|
27
27
|
|
|
28
|
-
**Theme:
|
|
28
|
+
**Theme: based on official 0.8.24 · steadier connection · fewer lost messages · clearer errors**
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|--|--------|
|
|
32
|
-
| ✨ **`messageAnswerCard`** | **Default `true`**: message body uses static answer card; set `false` for plain text/markdown |
|
|
33
|
-
| 🔧 **Registered** | `schema` + `openclaw.plugin.json` (channels / accounts / uiHints) |
|
|
34
|
-
| 📎 **Independent** | Separate from session-stream `answerCard`; media still uses normal APIs |
|
|
30
|
+
Built on community enhancements, aligned with official **0.8.24** connection work, and focused on real UX: “sent but no reply”, stuck error cards, and missing “queued” feedback.
|
|
35
31
|
|
|
36
|
-
|
|
37
|
-
npx -y @jeik/dingtalk-connector install --force && openclaw gateway restart
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
### 📦 v0.8.21-fix47 · 2026-07-20
|
|
41
|
-
|
|
42
|
-
`file://` no longer misclassified as remote (grey-image fix).
|
|
32
|
+
#### From official 0.8.24
|
|
43
33
|
|
|
44
|
-
|
|
34
|
+
- More reliable long-connection setup and keepalive (fewer “connected but silent” cases)
|
|
35
|
+
- Long AI runs less likely to get cut mid-task by connection flapping
|
|
36
|
+
- Cleaner console logs for easier ops
|
|
45
37
|
|
|
46
|
-
|
|
38
|
+
#### Extra community improvements (what you’ll notice)
|
|
47
39
|
|
|
48
|
-
|
|
40
|
+
| Experience | Effect |
|
|
41
|
+
|------------|--------|
|
|
42
|
+
| 🔗 **Connection** | Marks “connected” only when the bot can actually receive messages; auto-retries instead of faking online |
|
|
43
|
+
| 📩 **Fewer lost messages** | Much better after errors, after a reply finishes, or when sending several messages quickly |
|
|
44
|
+
| ⏳ **Queue feedback** | While the previous message is still running, new messages more reliably show “queued / processing” + thinking reaction |
|
|
45
|
+
| ⚠️ **Model failures** | Billing / no channel / 503-style failures settle into clear Chinese error cards instead of spinning forever |
|
|
46
|
+
| 🃏 **Answer cards & images** | Existing community answer-card and full image-path fixes remain |
|
|
49
47
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
```bash
|
|
49
|
+
npx -y @jeik/dingtalk-connector@0.8.28 install --force && openclaw gateway restart
|
|
50
|
+
```
|
|
53
51
|
|
|
54
|
-
|
|
52
|
+
### 📦 v0.8.26 · 2026-07-25
|
|
55
53
|
|
|
56
|
-
|
|
54
|
+
Stricter outbound target ID rules (keep `==` suffixes and case).
|
|
57
55
|
|
|
58
|
-
|
|
56
|
+
### 📦 v0.8.25 · 2026-07-24
|
|
59
57
|
|
|
60
|
-
|
|
58
|
+
Sender role/title identity; bare DingTalk IDs as direct chat.
|
|
61
59
|
|
|
62
|
-
###
|
|
60
|
+
### 📦 v0.8.21-fix49 and earlier
|
|
63
61
|
|
|
64
|
-
|
|
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 |
|
|
62
|
+
Answer cards, image path fixes, streaming finalize, Chinese error mapping — see [CHANGELOG.md](CHANGELOG.md).
|
|
70
63
|
|
|
71
|
-
Full log: [CHANGELOG.md](CHANGELOG.md) · [FIXES.md](FIXES.md)
|
|
64
|
+
Full log: [CHANGELOG.md](CHANGELOG.md) · [FIXES.md](FIXES.md)
|
|
72
65
|
|
|
73
66
|
---
|
|
74
67
|
|
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>当前发布版:<a href="https://www.npmjs.com/package/@jeik/dingtalk-connector">@jeik/dingtalk-connector</a> v0.8.
|
|
7
|
+
<p><strong>当前发布版:<a href="https://www.npmjs.com/package/@jeik/dingtalk-connector">@jeik/dingtalk-connector</a> v0.8.28</strong>(推荐生产;一键安装:`npx -y @jeik/dingtalk-connector@0.8.28 install --force`)</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,45 @@
|
|
|
23
23
|
|
|
24
24
|
## 🔧 最近更新
|
|
25
25
|
|
|
26
|
-
### 🚀 v0.8.
|
|
26
|
+
### 🚀 v0.8.28 · 2026-07-25(当前正式版)
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
**主题:基于官方 0.8.24 · 长连接更稳 · 消息少丢 · 错误提示更清楚**
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|--|------|
|
|
32
|
-
| 🎯 **目标 ID 约束强化** | 出站消息回复指引强化,约束 target ID 完整保留 Base64/特殊字符后缀(如 `==`、`=`)与大小写 |
|
|
30
|
+
本版在社区增强能力之上,对齐官方 **0.8.24** 的连接改进,并重点打磨「发了消息却没反应」「错误卡卡住」「排队提示不出现」等真实使用体验。
|
|
33
31
|
|
|
34
|
-
|
|
35
|
-
|--|------|
|
|
36
|
-
| 👤 **发送人岗位与身份** | 自动前置推送发送人真名、岗位 (Title)、入职时间及老板/主管角色信息 |
|
|
37
|
-
| 🎯 **`targets` 解析修复** | 无前缀裸钉钉用户 ID 自动智能推导为 `direct`(单聊)类型 |
|
|
38
|
-
| 🛠️ **消息处理增强** | 消息处理器底层逻辑优化与工具库稳定性提升 |
|
|
32
|
+
#### 基于官方 0.8.24 吸收了什么
|
|
39
33
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
### 📦 v0.8.21-fix49 · 2026-07-21
|
|
45
|
-
|
|
46
|
-
`message` 工具默认答案卡(可关);增强模板字段一致。
|
|
47
|
-
|
|
48
|
-
### 📦 v0.8.21-fix47 · 2026-07-20
|
|
49
|
-
|
|
50
|
-
`file://` 本地图误判远程修复(不再 `fetch failed` 灰图)。
|
|
34
|
+
- 更稳妥的长连接建立与保活方式,减少假死、误重连
|
|
35
|
+
- 机器人处理长任务时连接不易被中途掐断
|
|
36
|
+
- 控制台少刷无用日志,排障更清爽
|
|
51
37
|
|
|
52
|
-
|
|
38
|
+
#### 社区本版额外优化(你会感受到的效果)
|
|
53
39
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
40
|
+
| 体验 | 效果 |
|
|
41
|
+
|------|------|
|
|
42
|
+
| 🔗 **连接更靠谱** | 只有真正能收消息时才显示「已连接」;连不上会自动多试几轮,而不是假装在线 |
|
|
43
|
+
| 📩 **消息更少丢** | 明显缓解:连发多条、错误回复后、任务刚结束时「发了没进网关」的情况 |
|
|
44
|
+
| ⏳ **排队反馈更及时** | 上一条还在处理时再发,更容易马上看到「已排队 / 处理中」和思考中表情 |
|
|
45
|
+
| ⚠️ **模型故障更好懂** | 欠费、无可用线路、503 等失败时,卡片更容易定格成中文说明,少卡在「正在召唤大模型」 |
|
|
46
|
+
| 🃏 **答案卡 / 图片等** | 社区原有大段答案独立卡片、图片全路径修复等能力继续保留 |
|
|
59
47
|
|
|
60
|
-
|
|
48
|
+
```bash
|
|
49
|
+
npx -y @jeik/dingtalk-connector@0.8.28 install --force && openclaw gateway restart
|
|
50
|
+
```
|
|
61
51
|
|
|
62
|
-
|
|
52
|
+
### 📦 v0.8.26 · 2026-07-25
|
|
63
53
|
|
|
64
|
-
|
|
54
|
+
目标 ID 填写约束(保留 `==` 等后缀与大小写)。
|
|
65
55
|
|
|
66
|
-
|
|
56
|
+
### 📦 v0.8.25 · 2026-07-24
|
|
67
57
|
|
|
68
|
-
|
|
58
|
+
发送人岗位与身份信息;裸钉钉 ID 推导为单聊。
|
|
69
59
|
|
|
70
|
-
###
|
|
60
|
+
### 📦 v0.8.21-fix49 及更早
|
|
71
61
|
|
|
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 幻影重连 |
|
|
62
|
+
答案卡、图片全路径修复、流式定稿、中文错误映射等——详见 [CHANGELOG.md](CHANGELOG.md)。
|
|
78
63
|
|
|
79
|
-
完整说明:[CHANGELOG.md](CHANGELOG.md) · [FIXES.md](FIXES.md)
|
|
64
|
+
完整说明:[CHANGELOG.md](CHANGELOG.md) · [FIXES.md](FIXES.md)
|
|
80
65
|
|
|
81
66
|
---
|
|
82
67
|
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
//#region src/utils/background-work.ts
|
|
2
|
+
let activeCount = 0;
|
|
3
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
4
|
+
function getActiveBackgroundWorkCount() {
|
|
5
|
+
return activeCount;
|
|
6
|
+
}
|
|
7
|
+
/** 订阅计数变化;返回取消订阅函数 */
|
|
8
|
+
function onBackgroundWorkCountChange(listener) {
|
|
9
|
+
listeners.add(listener);
|
|
10
|
+
return () => {
|
|
11
|
+
listeners.delete(listener);
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function notify() {
|
|
15
|
+
for (const listener of listeners) try {
|
|
16
|
+
listener(activeCount);
|
|
17
|
+
} catch {}
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* 跟踪一个后台 Promise:开始 +1,settle -1。
|
|
21
|
+
* 重复 settle 安全(只减一次)。
|
|
22
|
+
*/
|
|
23
|
+
function trackBackgroundWork(work, label) {
|
|
24
|
+
activeCount += 1;
|
|
25
|
+
notify();
|
|
26
|
+
let settled = false;
|
|
27
|
+
const done = () => {
|
|
28
|
+
if (settled) return;
|
|
29
|
+
settled = true;
|
|
30
|
+
activeCount = Math.max(0, activeCount - 1);
|
|
31
|
+
notify();
|
|
32
|
+
};
|
|
33
|
+
work.then(done, done);
|
|
34
|
+
if (label && typeof process !== "undefined" && process.env?.DINGTALK_DEBUG_QUEUE === "1") {
|
|
35
|
+
console.log(`[DingTalk][bgWork] +1 label=${label} count=${activeCount}`);
|
|
36
|
+
work.finally(() => {
|
|
37
|
+
console.log(`[DingTalk][bgWork] -1 label=${label} count=${activeCount}`);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
export { onBackgroundWorkCountChange as n, trackBackgroundWork as r, getActiveBackgroundWorkCount as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as createLogger } from "./logger-mZ9OSbmD.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-BE71drPg.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-PwhogwfE.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-BZiVgd3A.mjs";
|
|
2
2
|
export { AUDIO_MARKER_PATTERN, FILE_MARKER_PATTERN, VIDEO_MARKER_PATTERN };
|