@jeik/dingtalk-connector 0.8.27-fix1 → 0.8.27-fix2

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.
@@ -23,7 +23,7 @@ var entry_bundled_default = defineBundledChannelEntry({
23
23
  exportName: "setDingtalkRuntime"
24
24
  },
25
25
  async registerFull(api) {
26
- const { registerGatewayMethods } = await import("./gateway-methods-BQd4E0Sk.mjs");
26
+ const { registerGatewayMethods } = await import("./gateway-methods-UECIpwQ9.mjs");
27
27
  registerGatewayMethods(api);
28
28
  }
29
29
  });
@@ -1,7 +1,7 @@
1
1
  import { a as resolveDingtalkAccount, t as listDingtalkAccountIds } from "./accounts-BAzdqkAV.mjs";
2
2
  import { t as dingtalkHttp } from "./http-client-DFWZgO1n.mjs";
3
3
  import { r as getAccessToken, t as DINGTALK_API } from "./utils-CIfI_3Jh.mjs";
4
- import { c as prepareMultiBotMentions, d as finishAICard, i as sendProactive, s as buildBotMentionTable } from "./messaging-WleKf54h.mjs";
4
+ import { c as prepareMultiBotMentions, d as finishAICard, i as sendProactive, s as buildBotMentionTable } from "./messaging-Dvlan9M0.mjs";
5
5
  import { d as getUnionId, h as recallEmotionReply } from "./utils-legacy-DQ3HeGHh.mjs";
6
6
  //#region src/docs.ts
7
7
  var DingtalkDocsClient = class {
@@ -0,0 +1,2 @@
1
+ import { t as registerGatewayMethods } from "./gateway-methods-CfTm9PW_.mjs";
2
+ export { registerGatewayMethods };
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { a as initDingtalkPluginConfigSchema, i as dingtalkPlugin, n as setDingtalkRuntime } from "./runtime-C7zQrH65.mjs";
2
- import { t as registerGatewayMethods } from "./gateway-methods--aKsyMs-.mjs";
1
+ import { a as initDingtalkPluginConfigSchema, i as dingtalkPlugin, n as setDingtalkRuntime } from "./runtime-BGp1YsZg.mjs";
2
+ import { t as registerGatewayMethods } from "./gateway-methods-CfTm9PW_.mjs";
3
3
  //#region index.ts
4
4
  /**
5
5
  * 检测同一 plugin id 在多个路径被加载的情况。
@@ -1,9 +1,9 @@
1
1
  import { a as resolveDingtalkAccount } from "./accounts-BAzdqkAV.mjs";
2
- import { r as CHANNEL_ID, t as getDingtalkRuntime } from "./runtime-C7zQrH65.mjs";
2
+ import { r as CHANNEL_ID, t as getDingtalkRuntime } from "./runtime-BGp1YsZg.mjs";
3
3
  import { n as createLoggerFromConfig } from "./logger-mZ9OSbmD.mjs";
4
4
  import { t as dingtalkHttp } from "./http-client-DFWZgO1n.mjs";
5
5
  import { i as getOapiAccessToken } from "./utils-CIfI_3Jh.mjs";
6
- import { S as finalClean, _ as FINAL_TAG, a as sendTextMessage, b as estimateTokens, d as finishAICard, g as unregisterActiveCard, h as streamAICard, i as sendProactive, m as registerActiveCard, p as isQpsLimitError, r as sendMessage, t as sendMarkdownMessage, u as createAICardForTarget, v as PROCESS_TAG, x as extractFinal, y as displayClean } from "./messaging-WleKf54h.mjs";
6
+ import { S as finalClean, _ as FINAL_TAG, a as sendTextMessage, b as estimateTokens, d as finishAICard, g as unregisterActiveCard, h as streamAICard, i as sendProactive, m as registerActiveCard, p as isQpsLimitError, r as sendMessage, t as sendMarkdownMessage, u as createAICardForTarget, v as PROCESS_TAG, x as extractFinal, y as displayClean } from "./messaging-Dvlan9M0.mjs";
7
7
  import { a as QUEUE_BUSY_ACK_PHRASES, n as normalizeSlashCommand, t as buildSessionContext } from "./session-DJ4jYqPv.mjs";
8
8
  import { c as formatSenderRoles, f as getUserProfile, h as recallEmotionReply, l as getAccessToken, o as formatHiredDateShanghai, r as addEmotionReply, s as formatSenderDisplayLabel, t as DINGTALK_API, u as getOapiAccessToken$1 } from "./utils-legacy-DQ3HeGHh.mjs";
9
9
  import "./chunk-upload-BBQgGtcZ.mjs";
@@ -2266,12 +2266,14 @@ async function handleDingTalkMessageInternal(params) {
2266
2266
  } catch (err) {
2267
2267
  log?.error?.(`SDK dispatch 失败: ${err.message}`);
2268
2268
  const errorText = matchModelErrorText(err.message, { includeCatchAll: true }) ?? `⚠️ 抱歉,处理请求时出错: ${err.message}`;
2269
+ let cardSuccess = false;
2269
2270
  if (earlyCard) try {
2270
2271
  await finishAICard(earlyCard, errorText, config, log, void 0, void 0, data.conversationId);
2272
+ cardSuccess = true;
2271
2273
  } catch (cardErr) {
2272
2274
  log?.error?.(`更新错误卡片失败: ${cardErr.message}`);
2273
2275
  }
2274
- else try {
2276
+ if (!cardSuccess) try {
2275
2277
  const token = await getAccessToken(config);
2276
2278
  const body = {
2277
2279
  msgtype: "text",
@@ -429,8 +429,12 @@ async function finishAICard(card, content, config, log, contentVar, skipInputing
429
429
  return;
430
430
  } catch (retryErr) {
431
431
  log?.error?.(`[DingTalk][AICard] FINISHED 重试失败:${retryErr.message}`);
432
+ throw retryErr;
432
433
  }
433
- } else log?.error?.(`[DingTalk][AICard] FINISHED 更新失败:${err.message}`);
434
+ } else {
435
+ log?.error?.(`[DingTalk][AICard] FINISHED 更新失败:${err.message}`);
436
+ throw err;
437
+ }
434
438
  }
435
439
  }
436
440
  //#endregion
@@ -3,7 +3,7 @@ import { a as resolveDingtalkAccount, c as addWildcardAllowFrom, d as hasConfigu
3
3
  import { t as createLogger } from "./logger-mZ9OSbmD.mjs";
4
4
  import { t as dingtalkHttp } from "./http-client-DFWZgO1n.mjs";
5
5
  import "./utils-CIfI_3Jh.mjs";
6
- import { S as finalClean, f as getActiveCardForConversation, n as sendMediaToDingTalk, o as sendTextToDingTalk } from "./messaging-WleKf54h.mjs";
6
+ import { S as finalClean, f as getActiveCardForConversation, n as sendMediaToDingTalk, o as sendTextToDingTalk } from "./messaging-Dvlan9M0.mjs";
7
7
  import { createRequire } from "node:module";
8
8
  import { z, z as z$1 } from "zod";
9
9
  //#region src/secret-input.ts
@@ -955,7 +955,7 @@ async function monitorDingtalkProvider(opts = {}) {
955
955
  const log = createLogger(cfg.channels?.["dingtalk-connector"]?.debug ?? false);
956
956
  const [accountsModule, monitorAccountModule, monitorSingleModule] = await Promise.all([
957
957
  import("./accounts-BQptOmgB.mjs"),
958
- import("./message-handler-31oFEtyt.mjs"),
958
+ import("./message-handler-a7kE1IEx.mjs"),
959
959
  import("./connection-fc6B4z4G.mjs")
960
960
  ]);
961
961
  const { resolveDingtalkAccount, listEnabledDingtalkAccounts } = accountsModule;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jeik/dingtalk-connector",
3
- "version": "0.8.27-fix1",
3
+ "version": "0.8.27-fix2",
4
4
  "description": "OpenClaw DingTalk channel plugin (fork) | 钉钉 OpenClaw 渠道插件(fork 自官方,含标记/卡片渲染修复)",
5
5
  "type": "module",
6
6
  "exports": {
@@ -1910,13 +1910,17 @@ export async function handleDingTalkMessageInternal(params: HandleMessageParams)
1910
1910
  const errorText = matchModelErrorText(err.message, { includeCatchAll: true }) ?? `⚠️ 抱歉,处理请求时出错: ${err.message}`;
1911
1911
 
1912
1912
  // 如果已经建了 AI Card,则更新报错状态到 Card,避免停留在"正在召唤大模型"
1913
+ let cardSuccess = false;
1913
1914
  if (earlyCard) {
1914
1915
  try {
1915
1916
  await finishAICard(earlyCard, errorText, config, log, undefined, undefined, data.conversationId);
1917
+ cardSuccess = true;
1916
1918
  } catch (cardErr: any) {
1917
1919
  log?.error?.(`更新错误卡片失败: ${cardErr.message}`);
1918
1920
  }
1919
- } else {
1921
+ }
1922
+
1923
+ if (!cardSuccess) {
1920
1924
  // 降级:发送错误文本消息
1921
1925
  try {
1922
1926
  const token = await getAccessToken(config);
@@ -674,9 +674,11 @@ export async function finishAICard(
674
674
  log?.error?.(
675
675
  `[DingTalk][AICard] FINISHED 重试失败:${retryErr.message}`,
676
676
  );
677
+ throw retryErr;
677
678
  }
678
679
  } else {
679
680
  log?.error?.(`[DingTalk][AICard] FINISHED 更新失败:${err.message}`);
681
+ throw err;
680
682
  }
681
683
  }
682
684
  }
@@ -1,2 +0,0 @@
1
- import { t as registerGatewayMethods } from "./gateway-methods--aKsyMs-.mjs";
2
- export { registerGatewayMethods };