@openclaw-china/dingtalk 2026.3.9-1 → 2026.3.10

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 CHANGED
@@ -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
- return mergeChannelConfig(cfg, "dingtalk", {
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 = `\u26A0\uFE0F Response interrupted: ${String(err)}`;
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 : `\u26A0\uFE0F Response interrupted: ${String(err)}`;
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);