@yaoyuanchao/dingtalk 1.3.5 → 1.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,13 @@ 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
+ ## [1.3.6] - 2026-01-28
9
+
10
+ ### Fixed
11
+
12
+ - **Stream ACK method name** — corrected `socketResponse()` to `socketCallBackResponse()` (the actual SDK method); previous typo caused ACK to silently fail, triggering DingTalk 60-second retry
13
+ - **Audio message handling** — skip .amr file download when DingTalk ASR recognition text is available; prevents agent from being confused by audio attachment and trying Whisper instead of reading the already-transcribed text
14
+
8
15
  ## [1.3.5] - 2026-01-28
9
16
 
10
17
  ### Fixed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yaoyuanchao/dingtalk",
3
- "version": "1.3.5",
3
+ "version": "1.3.6",
4
4
  "type": "module",
5
5
  "description": "DingTalk channel plugin for Clawdbot with Stream Mode support",
6
6
  "license": "MIT",
package/src/monitor.ts CHANGED
@@ -53,8 +53,9 @@ export async function startDingTalkMonitor(ctx: DingTalkMonitorContext): Promise
53
53
 
54
54
  client.registerCallbackListener(TOPIC_ROBOT, async (downstream: any) => {
55
55
  // Immediately ACK to prevent DingTalk from retrying (60s timeout)
56
+ // SDK method is socketCallBackResponse, not socketResponse
56
57
  try {
57
- client.socketResponse(downstream.headers.messageId, { status: 'SUCCESS' });
58
+ client.socketCallBackResponse(downstream.headers.messageId, { status: 'SUCCESS' });
58
59
  } catch (_) { /* best-effort ACK */ }
59
60
 
60
61
  try {
@@ -318,11 +319,16 @@ async function processInboundMessage(
318
319
  // Extract message content using structured extractor
319
320
  const extracted = await extractMessageContent(msg, account, log);
320
321
 
321
- // Download media if present (picture/audio/video/file)
322
+ // Download media if present (picture/video/file — but skip audio when ASR text exists)
322
323
  let mediaPath: string | undefined;
323
324
  let mediaType: string | undefined;
324
325
 
325
- if (extracted.mediaDownloadCode && account.clientId && account.clientSecret) {
326
+ // For audio messages with successful ASR recognition, use the text directly
327
+ // and skip downloading the .amr file (which would confuse the agent into
328
+ // trying Whisper instead of reading the already-transcribed text).
329
+ const skipMediaDownload = extracted.messageType === 'audio' && !!extracted.text;
330
+
331
+ if (!skipMediaDownload && extracted.mediaDownloadCode && account.clientId && account.clientSecret) {
326
332
  const robotCode = account.robotCode || account.clientId;
327
333
  try {
328
334
  const result = await downloadMediaFile(
@@ -342,6 +348,8 @@ async function processInboundMessage(
342
348
  } catch (err) {
343
349
  log?.warn?.(`[dingtalk] Media download error: ${err}`);
344
350
  }
351
+ } else if (skipMediaDownload) {
352
+ log?.info?.("[dingtalk] Audio ASR text available, skipping .amr download");
345
353
  }
346
354
 
347
355
  let rawBody = extracted.text;