@yaoyuanchao/dingtalk 1.5.2 → 1.5.4

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,20 @@ 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.5.3] - 2026-02-03
9
+
10
+ ### Improved
11
+
12
+ - **sendAttachment action** — Now accepts both `target` and `to` parameters (agent may use either)
13
+ - **Context inference** — Tries to infer target from `conversationTarget` if not explicitly provided
14
+ - **Better error messages** — Returns clear error descriptions instead of silent `null` when parameters are missing
15
+
16
+ ## [1.5.2] - 2026-02-03
17
+
18
+ ### Fixed
19
+
20
+ - **OpenClaw plugin install** — Added `openclaw.extensions` field for proper plugin installation
21
+
8
22
  ## [1.5.1] - 2026-02-03
9
23
 
10
24
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yaoyuanchao/dingtalk",
3
- "version": "1.5.2",
3
+ "version": "1.5.4",
4
4
  "type": "module",
5
5
  "description": "DingTalk channel plugin for ClawdBot/OpenClaw with Stream Mode support",
6
6
  "license": "MIT",
package/src/channel.ts CHANGED
@@ -359,7 +359,7 @@ export const dingtalkPlugin = {
359
359
  },
360
360
 
361
361
  async handleAction(ctx: any) {
362
- const { action, params, cfg, accountId } = ctx;
362
+ const { action, params, cfg, accountId, conversationTarget } = ctx;
363
363
 
364
364
  // Only handle sendAttachment action
365
365
  if (action !== 'sendAttachment') {
@@ -368,10 +368,28 @@ export const dingtalkPlugin = {
368
368
 
369
369
  const buffer = params?.buffer;
370
370
  const filename = params?.filename || 'attachment.bin';
371
- const target = params?.target;
372
371
 
373
- if (!buffer || !target) {
374
- return null; // Let SDK handle if missing required params
372
+ // Accept both 'target' and 'to' parameters (agent may use either)
373
+ // Also try to infer from conversation context if neither provided
374
+ let target = params?.target || params?.to;
375
+
376
+ // Try to get target from conversation context if not explicitly provided
377
+ if (!target && conversationTarget) {
378
+ target = conversationTarget;
379
+ console.log(`[dingtalk] sendAttachment: inferred target from context: ${target}`);
380
+ }
381
+
382
+ if (!buffer) {
383
+ console.warn('[dingtalk] sendAttachment: missing buffer parameter');
384
+ return { ok: false, error: 'Missing buffer parameter. Use base64-encoded file content.' };
385
+ }
386
+
387
+ if (!target) {
388
+ console.warn('[dingtalk] sendAttachment: missing target/to parameter');
389
+ return {
390
+ ok: false,
391
+ error: 'Missing target parameter. Use "to" or "target" with format: "dm:userId" or "group:conversationId" or just "userId" for DM.'
392
+ };
375
393
  }
376
394
 
377
395
  const account = resolveDingTalkAccount({ cfg, accountId });
package/src/monitor.ts CHANGED
@@ -144,6 +144,18 @@ async function extractMessageContent(
144
144
  return extractPictureContent(msg, log);
145
145
  }
146
146
 
147
+ case 'markdown': {
148
+ // DingTalk markdown messages have content in content.text or content.title
149
+ const markdownText = content?.text?.trim() || '';
150
+ const markdownTitle = content?.title?.trim() || '';
151
+ const text = markdownText || markdownTitle || '[Markdown消息]';
152
+ log?.info?.("[dingtalk] Markdown message received (" + text.length + " chars)");
153
+ return {
154
+ text,
155
+ messageType: 'markdown',
156
+ };
157
+ }
158
+
147
159
  case 'audio': {
148
160
  // DingTalk provides speech recognition result in content.recognition
149
161
  const recognition = content?.recognition;