@jeik/dingtalk-connector 0.8.27-fix1 → 0.8.27-fix3
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/dist/entry-bundled.mjs +1 -1
- package/dist/{gateway-methods--aKsyMs-.mjs → gateway-methods-CfTm9PW_.mjs} +1 -1
- package/dist/gateway-methods-UECIpwQ9.mjs +2 -0
- package/dist/index.mjs +2 -2
- package/dist/{message-handler-31oFEtyt.mjs → message-handler-CCbPqctq.mjs} +25 -24
- package/dist/{messaging-WleKf54h.mjs → messaging-Dvlan9M0.mjs} +5 -1
- package/dist/{runtime-C7zQrH65.mjs → runtime-8WBX1FSq.mjs} +2 -2
- package/package.json +1 -1
- package/src/core/message-handler.ts +7 -11
- package/src/services/messaging/card.ts +2 -0
- package/dist/gateway-methods-BQd4E0Sk.mjs +0 -2
package/dist/entry-bundled.mjs
CHANGED
|
@@ -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-
|
|
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-
|
|
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 {
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as initDingtalkPluginConfigSchema, i as dingtalkPlugin, n as setDingtalkRuntime } from "./runtime-
|
|
2
|
-
import { t as registerGatewayMethods } from "./gateway-methods
|
|
1
|
+
import { a as initDingtalkPluginConfigSchema, i as dingtalkPlugin, n as setDingtalkRuntime } from "./runtime-8WBX1FSq.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-
|
|
2
|
+
import { r as CHANNEL_ID, t as getDingtalkRuntime } from "./runtime-8WBX1FSq.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-
|
|
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";
|
|
@@ -2265,28 +2265,29 @@ async function handleDingTalkMessageInternal(params) {
|
|
|
2265
2265
|
}
|
|
2266
2266
|
} catch (err) {
|
|
2267
2267
|
log?.error?.(`SDK dispatch 失败: ${err.message}`);
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
await
|
|
2271
|
-
}
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2268
|
+
if (replyOptions?.onError) {
|
|
2269
|
+
log?.info?.(`[DingTalk] 统一错误定稿:调用 replyOptions.onError 处理同步异常`);
|
|
2270
|
+
await replyOptions.onError(err, { kind: "invoke" });
|
|
2271
|
+
} else {
|
|
2272
|
+
const errorText = matchModelErrorText(err.message, { includeCatchAll: true }) ?? `⚠️ 抱歉,处理请求时出错: ${err.message}`;
|
|
2273
|
+
log?.warn?.(`[DingTalk] replyOptions.onError 不存在,走极端兜底纯文本发送`);
|
|
2274
|
+
try {
|
|
2275
|
+
const token = await getAccessToken(config);
|
|
2276
|
+
const body = {
|
|
2277
|
+
msgtype: "text",
|
|
2278
|
+
text: { content: errorText }
|
|
2279
|
+
};
|
|
2280
|
+
if (!isDirect) body.at = {
|
|
2281
|
+
atUserIds: [senderId],
|
|
2282
|
+
isAtAll: false
|
|
2283
|
+
};
|
|
2284
|
+
await dingtalkHttp.post(sessionWebhook, body, { headers: {
|
|
2285
|
+
"x-acs-dingtalk-access-token": token,
|
|
2286
|
+
"Content-Type": "application/json"
|
|
2287
|
+
} });
|
|
2288
|
+
} catch (fallbackErr) {
|
|
2289
|
+
log?.error?.(`错误消息发送也失败: ${fallbackErr.message}`);
|
|
2290
|
+
}
|
|
2290
2291
|
}
|
|
2291
2292
|
}
|
|
2292
2293
|
try {
|
|
@@ -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
|
|
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-
|
|
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-
|
|
958
|
+
import("./message-handler-CCbPqctq.mjs"),
|
|
959
959
|
import("./connection-fc6B4z4G.mjs")
|
|
960
960
|
]);
|
|
961
961
|
const { resolveDingtalkAccount, listEnabledDingtalkAccounts } = accountsModule;
|
package/package.json
CHANGED
|
@@ -1906,18 +1906,14 @@ export async function handleDingTalkMessageInternal(params: HandleMessageParams)
|
|
|
1906
1906
|
} catch (err: any) {
|
|
1907
1907
|
log?.error?.(`SDK dispatch 失败: ${err.message}`);
|
|
1908
1908
|
|
|
1909
|
-
//
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
if (earlyCard) {
|
|
1914
|
-
try {
|
|
1915
|
-
await finishAICard(earlyCard, errorText, config, log, undefined, undefined, data.conversationId);
|
|
1916
|
-
} catch (cardErr: any) {
|
|
1917
|
-
log?.error?.(`更新错误卡片失败: ${cardErr.message}`);
|
|
1918
|
-
}
|
|
1909
|
+
// 使用与正常回放相同的底层逻辑统一处理错误定稿
|
|
1910
|
+
if (replyOptions?.onError) {
|
|
1911
|
+
log?.info?.(`[DingTalk] 统一错误定稿:调用 replyOptions.onError 处理同步异常`);
|
|
1912
|
+
await replyOptions.onError(err, { kind: 'invoke' });
|
|
1919
1913
|
} else {
|
|
1920
|
-
//
|
|
1914
|
+
// 极端兜底(理论上必有 onError)
|
|
1915
|
+
const errorText = matchModelErrorText(err.message, { includeCatchAll: true }) ?? `⚠️ 抱歉,处理请求时出错: ${err.message}`;
|
|
1916
|
+
log?.warn?.(`[DingTalk] replyOptions.onError 不存在,走极端兜底纯文本发送`);
|
|
1921
1917
|
try {
|
|
1922
1918
|
const token = await getAccessToken(config);
|
|
1923
1919
|
const body: any = {
|
|
@@ -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
|
}
|