@openclaw-china/dingtalk 2026.3.9 → 2026.3.11
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/index.js +33 -7
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -4250,7 +4250,7 @@ var DingtalkAccountSchema = external_exports.object({
|
|
|
4250
4250
|
/** 长任务提醒延迟(毫秒),0 表示关闭 */
|
|
4251
4251
|
longTaskNoticeDelayMs: external_exports.number().int().min(0).optional().default(3e4),
|
|
4252
4252
|
/** 是否启用 AI Card 流式响应 */
|
|
4253
|
-
enableAICard: external_exports.boolean().optional().default(
|
|
4253
|
+
enableAICard: external_exports.boolean().optional().default(false),
|
|
4254
4254
|
/** Gateway auth token(Bearer) */
|
|
4255
4255
|
gatewayToken: external_exports.string().optional(),
|
|
4256
4256
|
/** Gateway auth password(替代 gatewayToken) */
|
|
@@ -6545,6 +6545,13 @@ function getChannelConfig(cfg, channelId) {
|
|
|
6545
6545
|
const existing = channels[channelId];
|
|
6546
6546
|
return isRecord(existing) ? existing : {};
|
|
6547
6547
|
}
|
|
6548
|
+
function getGatewayAuthToken(cfg) {
|
|
6549
|
+
if (!isRecord(cfg.gateway)) {
|
|
6550
|
+
return void 0;
|
|
6551
|
+
}
|
|
6552
|
+
const auth = isRecord(cfg.gateway.auth) ? cfg.gateway.auth : void 0;
|
|
6553
|
+
return toTrimmedString2(auth?.token);
|
|
6554
|
+
}
|
|
6548
6555
|
function getPreferredAccountConfig(channelCfg) {
|
|
6549
6556
|
const accounts = channelCfg.accounts;
|
|
6550
6557
|
if (!isRecord(accounts)) {
|
|
@@ -6706,11 +6713,22 @@ async function configureDingtalk(prompter, cfg) {
|
|
|
6706
6713
|
"\u542F\u7528 AI Card \u6D41\u5F0F\u56DE\u590D\uFF08\u63A8\u8350\u5173\u95ED\uFF0C\u4F7F\u7528\u975E\u6D41\u5F0F\uFF09",
|
|
6707
6714
|
toBoolean(existing.enableAICard, false)
|
|
6708
6715
|
);
|
|
6709
|
-
|
|
6716
|
+
const patch = {
|
|
6710
6717
|
clientId,
|
|
6711
6718
|
clientSecret,
|
|
6712
6719
|
enableAICard
|
|
6713
|
-
}
|
|
6720
|
+
};
|
|
6721
|
+
if (enableAICard) {
|
|
6722
|
+
const gatewayToken = await prompter.askSecret({
|
|
6723
|
+
label: "OpenClaw Gateway Token\uFF08\u6D41\u5F0F\u8F93\u51FA\u5FC5\u9700\uFF1B\u7559\u7A7A\u5219\u4F7F\u7528\u5168\u5C40 gateway.auth.token\uFF09",
|
|
6724
|
+
existingValue: toTrimmedString2(existing.gatewayToken) ?? getGatewayAuthToken(cfg),
|
|
6725
|
+
required: false
|
|
6726
|
+
});
|
|
6727
|
+
if (gatewayToken.trim()) {
|
|
6728
|
+
patch.gatewayToken = gatewayToken;
|
|
6729
|
+
}
|
|
6730
|
+
}
|
|
6731
|
+
return mergeChannelConfig(cfg, "dingtalk", patch);
|
|
6714
6732
|
}
|
|
6715
6733
|
async function configureFeishu(prompter, cfg) {
|
|
6716
6734
|
section("\u914D\u7F6E Feishu\uFF08\u98DE\u4E66\uFF09");
|
|
@@ -8281,6 +8299,14 @@ function resolveGatewayRequestParams(runtime2, dingtalkCfg, logger) {
|
|
|
8281
8299
|
}
|
|
8282
8300
|
return { gatewayUrl, headers };
|
|
8283
8301
|
}
|
|
8302
|
+
function formatStreamingInterruptMessage(err) {
|
|
8303
|
+
const baseMessage = `\u26A0\uFE0F Response interrupted: ${String(err)}`;
|
|
8304
|
+
if (String(err).includes("Gateway error")) {
|
|
8305
|
+
return `${baseMessage}
|
|
8306
|
+
\u8BF7\u624B\u52A8\u8BBE\u7F6E channels.dingtalk.gatewayToken\uFF0C\u6216\u786E\u8BA4 OpenClaw \u5168\u5C40 gateway.auth.token \u914D\u7F6E\u6B63\u786E\u3002`;
|
|
8307
|
+
}
|
|
8308
|
+
return baseMessage;
|
|
8309
|
+
}
|
|
8284
8310
|
async function* streamFromGateway(params) {
|
|
8285
8311
|
const { runtime: runtime2, sessionKey, userContent, logger, dingtalkCfg, abortSignal } = params;
|
|
8286
8312
|
const { gatewayUrl, headers } = resolveGatewayRequestParams(runtime2, dingtalkCfg, logger);
|
|
@@ -8494,13 +8520,13 @@ async function handleAICardStreaming(params) {
|
|
|
8494
8520
|
} catch (err) {
|
|
8495
8521
|
logger.error(`AI Card streaming failed: ${String(err)}`);
|
|
8496
8522
|
try {
|
|
8497
|
-
const errorMsg =
|
|
8523
|
+
const errorMsg = formatStreamingInterruptMessage(err);
|
|
8498
8524
|
await finishAICard(card, errorMsg, (msg) => logger.debug(msg));
|
|
8499
8525
|
} catch (finishErr) {
|
|
8500
8526
|
logger.error(`Failed to finish card with error: ${String(finishErr)}`);
|
|
8501
8527
|
}
|
|
8502
8528
|
try {
|
|
8503
|
-
const fallbackText = accumulated.trim() ? accumulated :
|
|
8529
|
+
const fallbackText = accumulated.trim() ? accumulated : formatStreamingInterruptMessage(err);
|
|
8504
8530
|
const limit = dingtalkCfg.textChunkLimit ?? 4e3;
|
|
8505
8531
|
for (let i = 0; i < fallbackText.length; i += limit) {
|
|
8506
8532
|
const chunk = fallbackText.slice(i, i + limit);
|
|
@@ -9230,7 +9256,7 @@ function processDingtalkInbound(params) {
|
|
|
9230
9256
|
accountId,
|
|
9231
9257
|
log: (msg) => logger.info(msg.replace(/^\[dingtalk\]\s*/, "")),
|
|
9232
9258
|
error: (msg) => logger.error(msg.replace(/^\[dingtalk\]\s*/, "")),
|
|
9233
|
-
enableAICard: dingtalkCfg?.enableAICard ??
|
|
9259
|
+
enableAICard: dingtalkCfg?.enableAICard ?? false
|
|
9234
9260
|
}).catch((err) => {
|
|
9235
9261
|
logger.error(`error handling message: ${String(err)}`);
|
|
9236
9262
|
});
|
|
@@ -9892,7 +9918,7 @@ var dingtalkOnboardingAdapter = {
|
|
|
9892
9918
|
}
|
|
9893
9919
|
const enableAICard = await params.prompter.confirm({
|
|
9894
9920
|
message: "\u662F\u5426\u542F\u7528 AI Card \u6D41\u5F0F\u54CD\u5E94\uFF1F\uFF08\u76F4\u63A5\u56DE\u8F66\u4F7F\u7528\u63A8\u8350\u503C\uFF09",
|
|
9895
|
-
initialValue:
|
|
9921
|
+
initialValue: false
|
|
9896
9922
|
});
|
|
9897
9923
|
next = {
|
|
9898
9924
|
...next,
|