@openclaw/feishu 2026.6.5-beta.5 → 2026.6.5-beta.6

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.
@@ -71,12 +71,66 @@ function formatFeishuApiFailure(error, errorPrefix, options = {}) {
71
71
  function createFeishuApiError(error, errorPrefix, options = {}) {
72
72
  return new Error(formatFeishuApiFailure(error, errorPrefix, options), { cause: error });
73
73
  }
74
+ const FEISHU_SEND_RATE_LIMIT_CODES = new Set([230020, 11232]);
75
+ const FEISHU_SEND_MAX_RETRIES = 2;
76
+ const FEISHU_SEND_RETRY_BASE_MS = 500;
77
+ /**
78
+ * Returns a numeric rate-limit signal when an AxiosError indicates a retryable
79
+ * Feishu message-API rate limit. Sources, in priority order:
80
+ * 1. Gateway-level HTTP 429 (app-wide quota; `x-ogw-ratelimit-reset` header)
81
+ * 2. Business-level `code` in `error.response.data.code` matching
82
+ * FEISHU_SEND_RATE_LIMIT_CODES (e.g. 230020 per-chat, 11232 tenant-level).
83
+ * Returns `undefined` for all other errors so they propagate without retry.
84
+ */
85
+ function getFeishuSendRateLimitCode(error) {
86
+ if (!isRecord$1(error)) return;
87
+ const response = isRecord$1(error.response) ? error.response : void 0;
88
+ if (typeof response?.status === "number" && response.status === 429) return 429;
89
+ const code = (isRecord$1(response?.data) ? response.data : void 0)?.code;
90
+ return typeof code === "number" && FEISHU_SEND_RATE_LIMIT_CODES.has(code) ? code : void 0;
91
+ }
92
+ /**
93
+ * Returns a retryable rate-limit code when a fulfilled (non-throwing) Feishu
94
+ * SDK response embeds it in the response body. The Feishu node SDK can resolve
95
+ * with `{ code: 11232, msg: "..." }` instead of throwing — see typing.ts
96
+ * (getBackoffCodeFromResponse) and issue #28157 for the same behavior on
97
+ * messageReaction.create. Without this classification, requestFeishuApi would
98
+ * `return` the rate-limited body and downstream `assertFeishuMessageApiSuccess`
99
+ * would fail once with no retry.
100
+ */
101
+ function getFeishuSendRateLimitCodeFromResponse(response) {
102
+ if (!isRecord$1(response)) return;
103
+ const code = response.code;
104
+ return typeof code === "number" && FEISHU_SEND_RATE_LIMIT_CODES.has(code) ? code : void 0;
105
+ }
74
106
  async function requestFeishuApi(request, errorPrefix, options = {}) {
75
- try {
76
- return await request();
77
- } catch (error) {
78
- throw createFeishuApiError(error, errorPrefix, options);
107
+ const retryDelayMs = options.retryDelayMs ?? FEISHU_SEND_RETRY_BASE_MS;
108
+ let lastFulfilledRateLimit;
109
+ for (let attempt = 0; attempt <= FEISHU_SEND_MAX_RETRIES; attempt++) {
110
+ if (attempt > 0) await new Promise((resolve) => {
111
+ setTimeout(resolve, attempt * retryDelayMs);
112
+ });
113
+ try {
114
+ const result = await request();
115
+ const fulfilledRateLimit = getFeishuSendRateLimitCodeFromResponse(result);
116
+ if (fulfilledRateLimit !== void 0) {
117
+ lastFulfilledRateLimit = {
118
+ response: result,
119
+ code: fulfilledRateLimit
120
+ };
121
+ if (attempt < FEISHU_SEND_MAX_RETRIES) continue;
122
+ break;
123
+ }
124
+ return result;
125
+ } catch (error) {
126
+ if (!(attempt < FEISHU_SEND_MAX_RETRIES && getFeishuSendRateLimitCode(error) !== void 0)) throw createFeishuApiError(error, errorPrefix, options);
127
+ }
79
128
  }
129
+ if (lastFulfilledRateLimit) throw createFeishuApiError(Object.assign(/* @__PURE__ */ new Error(`Request fulfilled with rate-limit code ${lastFulfilledRateLimit.code}`), { response: {
130
+ status: 200,
131
+ data: lastFulfilledRateLimit.response
132
+ } }), errorPrefix, options);
133
+ throw createFeishuApiError(/* @__PURE__ */ new Error("unreachable"), errorPrefix, options);
80
134
  }
81
135
  function readDocsLinkUrl(element) {
82
136
  const docsLink = isRecord$1(element.docs_link) ? element.docs_link : void 0;
@@ -458,4 +512,4 @@ function listEnabledFeishuAccounts(cfg) {
458
512
  })).filter((account) => account.enabled && account.configured);
459
513
  }
460
514
  //#endregion
461
- export { buildFeishuCommentTarget as _, resolveDefaultFeishuAccountId as a, createFeishuApiError as c, formatFeishuApiError as d, isRecord$1 as f, requestFeishuApi as g, readString as h, listFeishuAccountIds as i, encodeQuery as l, parseCommentContentElements as m, inspectFeishuCredentials as n, resolveFeishuAccount as o, normalizeString as p, listEnabledFeishuAccounts as r, resolveFeishuRuntimeAccount as s, accounts_exports as t, extractReplyText as u, normalizeCommentFileType as v, parseFeishuCommentTarget as y };
515
+ export { normalizeCommentFileType as _, resolveDefaultFeishuAccountId as a, encodeQuery as c, isRecord$1 as d, normalizeString as f, buildFeishuCommentTarget as g, requestFeishuApi as h, listFeishuAccountIds as i, extractReplyText as l, readString as m, inspectFeishuCredentials as n, resolveFeishuAccount as o, parseCommentContentElements as p, listEnabledFeishuAccounts as r, resolveFeishuRuntimeAccount as s, accounts_exports as t, formatFeishuApiError as u, parseFeishuCommentTarget as v };
package/dist/api.js CHANGED
@@ -1,9 +1,9 @@
1
- import { r as listEnabledFeishuAccounts } from "./accounts-Bpe6CjpS.js";
2
- import { a as setFeishuNamedAccountEnabled, i as feishuSetupAdapter, n as feishuSetupWizard, r as runFeishuLogin, t as feishuPlugin } from "./channel-DR5JCyFd.js";
1
+ import { r as listEnabledFeishuAccounts } from "./accounts-Cfzht2Hc.js";
2
+ import { a as setFeishuNamedAccountEnabled, i as feishuSetupAdapter, n as feishuSetupWizard, r as runFeishuLogin, t as feishuPlugin } from "./channel-BEX7iZKr.js";
3
3
  import { a as parseFeishuTargetId, i as parseFeishuDirectConversationId, n as buildFeishuModelOverrideParentCandidates, r as parseFeishuConversationId, t as buildFeishuConversationId } from "./conversation-id-DuL575sn.js";
4
4
  import { t as getFeishuRuntime } from "./runtime-C5JxBWZp.js";
5
5
  import { r as createFeishuClient } from "./client-BhMNZBJD.js";
6
- import { a as jsonToolResult, d as registerFeishuChatTools, f as createFeishuToolClient, h as resolveToolsConfig, m as resolveFeishuToolAccount, n as registerFeishuDriveTools, o as toolExecutionErrorResult, p as resolveAnyEnabledFeishuToolsConfig, s as unknownToolActionResult } from "./drive-BIrffRwc.js";
6
+ import { a as jsonToolResult, d as registerFeishuChatTools, f as createFeishuToolClient, h as resolveToolsConfig, m as resolveFeishuToolAccount, n as registerFeishuDriveTools, o as toolExecutionErrorResult, p as resolveAnyEnabledFeishuToolsConfig, s as unknownToolActionResult } from "./drive-8o3Omlnd.js";
7
7
  import { n as getFeishuThreadBindingManager, r as testing, t as createFeishuThreadBindingManager } from "./thread-bindings-V0bwk0A1.js";
8
8
  import { n as handleFeishuSubagentEnded, r as handleFeishuSubagentSpawning, t as handleFeishuSubagentDeliveryTarget } from "./subagent-hooks-1pqt5tAA.js";
9
9
  import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, readStringValue, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
@@ -1,6 +1,6 @@
1
- import { a as resolveDefaultFeishuAccountId, f as isRecord$2, i as listFeishuAccountIds, n as inspectFeishuCredentials, o as resolveFeishuAccount, r as listEnabledFeishuAccounts, s as resolveFeishuRuntimeAccount } from "./accounts-Bpe6CjpS.js";
1
+ import { a as resolveDefaultFeishuAccountId, d as isRecord$2, i as listFeishuAccountIds, n as inspectFeishuCredentials, o as resolveFeishuAccount, r as listEnabledFeishuAccounts, s as resolveFeishuRuntimeAccount } from "./accounts-Cfzht2Hc.js";
2
2
  import { n as looksLikeFeishuId, r as normalizeFeishuTarget, t as detectIdType } from "./targets-BUjQ1TcA.js";
3
- import { n as createFeishuSendReceipt, s as createFeishuCardInteractionEnvelope } from "./send-result-D9rgEUlm.js";
3
+ import { n as createFeishuSendReceipt, s as createFeishuCardInteractionEnvelope } from "./send-result-DSsIa4-p.js";
4
4
  import { a as parseFeishuTargetId, i as parseFeishuDirectConversationId, n as buildFeishuModelOverrideParentCandidates, r as parseFeishuConversationId, t as buildFeishuConversationId } from "./conversation-id-DuL575sn.js";
5
5
  import { t as messageActionTargetAliases } from "./security-audit-BIeA3W3Q.js";
6
6
  import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-ChjJKAJ9.js";
@@ -32,7 +32,8 @@ import { buildSecretInputSchema, hasConfiguredSecretInput as hasConfiguredSecret
32
32
  import fs from "node:fs";
33
33
  import os from "node:os";
34
34
  import path from "node:path";
35
- import { loadSessionStore, resolveAllAgentSessionStoreTargetsSync, resolveSessionFilePath, updateSessionStore } from "openclaw/plugin-sdk/session-store-runtime";
35
+ import { normalizeAgentId } from "openclaw/plugin-sdk/routing";
36
+ import { loadSessionStore, resolveSessionFilePath, resolveStorePath, updateSessionStore } from "openclaw/plugin-sdk/session-store-runtime";
36
37
  import { resolveStateDir } from "openclaw/plugin-sdk/state-paths";
37
38
  import { createChannelIngressResolver, defineStableChannelIngressIdentity } from "openclaw/plugin-sdk/channel-ingress-runtime";
38
39
  import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1, createSetupTranslator, formatDocsLink, hasConfiguredSecretInput as hasConfiguredSecretInput$1, mergeAllowFromEntries, patchTopLevelChannelConfigSection, promptSingleChannelSecretInput, splitSetupEntries } from "openclaw/plugin-sdk/setup";
@@ -460,8 +461,43 @@ function isFeishuSessionEntry(key, value) {
460
461
  const originFrom = normalizeMetadataString(origin?.from);
461
462
  return originProvider === "feishu" || originSurface.startsWith("feishu") || originFrom.startsWith("feishu:");
462
463
  }
464
+ function collectConfiguredAgentIds(cfg) {
465
+ const ids = /* @__PURE__ */ new Set();
466
+ ids.add(resolveConfiguredDefaultAgentId(cfg));
467
+ for (const agent of cfg.agents?.list ?? []) if (typeof agent.id === "string" && agent.id.trim()) ids.add(normalizeAgentId(agent.id));
468
+ return [...ids].toSorted();
469
+ }
470
+ function resolveConfiguredDefaultAgentId(cfg) {
471
+ const agents = cfg.agents?.list ?? [];
472
+ const chosen = agents.find((agent) => agent?.default) ?? agents[0];
473
+ return normalizeAgentId(typeof chosen?.id === "string" && chosen.id.trim() ? chosen.id : "main");
474
+ }
463
475
  function collectFeishuSessionTargets(params) {
464
- return resolveAllAgentSessionStoreTargetsSync(params.cfg, { env: params.env }).toSorted((left, right) => left.storePath.localeCompare(right.storePath));
476
+ const byStorePath = /* @__PURE__ */ new Map();
477
+ const addTarget = (target) => {
478
+ byStorePath.set(path.resolve(target.storePath), {
479
+ ...target,
480
+ storePath: path.resolve(target.storePath)
481
+ });
482
+ };
483
+ for (const agentId of collectConfiguredAgentIds(params.cfg)) addTarget({
484
+ agentId,
485
+ storePath: resolveStorePath(params.cfg.session?.store, {
486
+ agentId,
487
+ env: params.env
488
+ })
489
+ });
490
+ const agentsDir = path.join(params.stateDir, "agents");
491
+ for (const agentDir of safeReadDir(agentsDir)) {
492
+ if (!agentDir.isDirectory()) continue;
493
+ const agentId = normalizeAgentId(agentDir.name);
494
+ const storePath = path.join(agentsDir, agentDir.name, "sessions", "sessions.json");
495
+ if (existsFile(storePath)) addTarget({
496
+ agentId,
497
+ storePath
498
+ });
499
+ }
500
+ return [...byStorePath.values()].toSorted((left, right) => left.storePath.localeCompare(right.storePath));
465
501
  }
466
502
  function collectJsonFiles(rootDir, limit = 200) {
467
503
  const files = [];
@@ -647,7 +683,8 @@ function inspectFeishuDoctorState(params) {
647
683
  const sessionEntries = [];
648
684
  for (const target of collectFeishuSessionTargets({
649
685
  cfg: params.cfg,
650
- env
686
+ env,
687
+ stateDir
651
688
  })) {
652
689
  const store = loadSessionStore(target.storePath, { skipCache: true });
653
690
  for (const [key, entry] of Object.entries(store).toSorted(([left], [right]) => left.localeCompare(right))) {
@@ -701,17 +738,13 @@ function movePathToBackup(params) {
701
738
  return true;
702
739
  }
703
740
  function copyStoreBackup(params) {
741
+ if (!existsFile(params.storePath)) return;
704
742
  const targetPath = path.join(params.backupDir, "session-stores", params.agentId, path.basename(params.storePath));
705
743
  fs.mkdirSync(path.dirname(targetPath), {
706
744
  recursive: true,
707
745
  mode: 448
708
746
  });
709
- if (existsFile(params.storePath)) {
710
- fs.copyFileSync(params.storePath, resolveUniquePath(targetPath));
711
- return;
712
- }
713
- const store = loadSessionStore(params.storePath, { skipCache: true });
714
- if (Object.keys(store).length > 0) fs.writeFileSync(resolveUniquePath(targetPath), JSON.stringify(store, null, 2));
747
+ fs.copyFileSync(params.storePath, resolveUniquePath(targetPath));
715
748
  }
716
749
  function collectSessionArtifactPaths(params) {
717
750
  const artifacts = /* @__PURE__ */ new Set();
@@ -1702,7 +1735,7 @@ const meta = {
1702
1735
  order: 70,
1703
1736
  preferSessionLookupForAnnounceTarget: true
1704
1737
  };
1705
- const loadFeishuChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-JVkii-p6.js"), "feishuChannelRuntime");
1738
+ const loadFeishuChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-VZV9bW65.js"), "feishuChannelRuntime");
1706
1739
  function toFeishuMessageSendResult(result, kind) {
1707
1740
  const receipt = result.receipt ?? createFeishuSendReceipt({
1708
1741
  messageId: result.messageId,
@@ -2518,7 +2551,7 @@ const feishuPlugin = createChatChannelPlugin({
2518
2551
  })
2519
2552
  }),
2520
2553
  gateway: { startAccount: async (ctx) => {
2521
- const { monitorFeishuProvider } = await import("./monitor-BL8BC85p.js");
2554
+ const { monitorFeishuProvider } = await import("./monitor-DJDyXqG_.js");
2522
2555
  const account = resolveFeishuRuntimeAccount({
2523
2556
  cfg: ctx.cfg,
2524
2557
  accountId: ctx.accountId
@@ -1,2 +1,2 @@
1
- import { t as feishuPlugin } from "./channel-DR5JCyFd.js";
1
+ import { t as feishuPlugin } from "./channel-BEX7iZKr.js";
2
2
  export { feishuPlugin };
@@ -1,9 +1,9 @@
1
- import { o as resolveFeishuAccount, s as resolveFeishuRuntimeAccount, y as parseFeishuCommentTarget } from "./accounts-Bpe6CjpS.js";
2
- import { h as listFeishuDirectoryPeers, m as listFeishuDirectoryGroups, o as buildFeishuPresentationCardElements } from "./channel-DR5JCyFd.js";
1
+ import { o as resolveFeishuAccount, s as resolveFeishuRuntimeAccount, v as parseFeishuCommentTarget } from "./accounts-Cfzht2Hc.js";
2
+ import { h as listFeishuDirectoryPeers, m as listFeishuDirectoryGroups, o as buildFeishuPresentationCardElements } from "./channel-BEX7iZKr.js";
3
3
  import { r as createFeishuClient } from "./client-BhMNZBJD.js";
4
- import { c as getChatInfo, l as getChatMembers, r as cleanupAmbientCommentTypingReaction, t as deliverCommentThreadText, u as getFeishuMemberInfo } from "./drive-BIrffRwc.js";
4
+ import { c as getChatInfo, l as getChatMembers, r as cleanupAmbientCommentTypingReaction, t as deliverCommentThreadText, u as getFeishuMemberInfo } from "./drive-8o3Omlnd.js";
5
5
  import { chunkTextForOutbound } from "./runtime-api.js";
6
- import { a as sendCardFeishu, c as sendStructuredCardFeishu, g as shouldSuppressFeishuTextForVoiceMedia, h as sendMediaFeishu, i as resolveFeishuCardTemplate, n as getMessageFeishu, o as sendMarkdownCardFeishu, s as sendMessageFeishu, t as editMessageFeishu } from "./send-Cze2qlca.js";
6
+ import { a as sendCardFeishu, c as sendStructuredCardFeishu, g as shouldSuppressFeishuTextForVoiceMedia, h as sendMediaFeishu, i as resolveFeishuCardTemplate, n as getMessageFeishu, o as sendMarkdownCardFeishu, s as sendMessageFeishu, t as editMessageFeishu } from "./send-B3kteMF8.js";
7
7
  import { t as probeFeishu } from "./probe-BjKRV7em.js";
8
8
  import { interactiveReplyToPresentation, normalizeInteractiveReply, normalizeMessagePresentation, renderMessagePresentationFallbackText, resolveInteractiveTextFallback } from "openclaw/plugin-sdk/interactive-runtime";
9
9
  import { isRecord, normalizeLowercaseStringOrEmpty, normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
@@ -1,4 +1,4 @@
1
- import { d as formatFeishuApiError, f as isRecord$1, h as readString, i as listFeishuAccountIds, l as encodeQuery, o as resolveFeishuAccount, r as listEnabledFeishuAccounts, s as resolveFeishuRuntimeAccount, u as extractReplyText, y as parseFeishuCommentTarget } from "./accounts-Bpe6CjpS.js";
1
+ import { c as encodeQuery, d as isRecord$1, i as listFeishuAccountIds, l as extractReplyText, m as readString, o as resolveFeishuAccount, r as listEnabledFeishuAccounts, s as resolveFeishuRuntimeAccount, u as formatFeishuApiError, v as parseFeishuCommentTarget } from "./accounts-Cfzht2Hc.js";
2
2
  import { r as createFeishuClient } from "./client-BhMNZBJD.js";
3
3
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
4
4
  import { optionalPositiveIntegerSchema } from "openclaw/plugin-sdk/channel-actions";
@@ -1,9 +1,9 @@
1
- import { r as listEnabledFeishuAccounts, s as resolveFeishuRuntimeAccount } from "./accounts-Bpe6CjpS.js";
1
+ import { r as listEnabledFeishuAccounts, s as resolveFeishuRuntimeAccount } from "./accounts-Cfzht2Hc.js";
2
2
  import { l as fetchBotIdentityForMonitor } from "./monitor.state-r4OLFBfg.js";
3
3
  //#region extensions/feishu/src/monitor.ts
4
4
  let monitorAccountRuntimePromise;
5
5
  async function loadMonitorAccountRuntime() {
6
- monitorAccountRuntimePromise ??= import("./monitor.account-DNduGVnu.js");
6
+ monitorAccountRuntimePromise ??= import("./monitor.account-xGp5NwWv.js");
7
7
  return await monitorAccountRuntimePromise;
8
8
  }
9
9
  async function monitorFeishuProvider(opts = {}) {
@@ -1,14 +1,14 @@
1
- import { _ as buildFeishuCommentTarget, f as isRecord$1, h as readString, l as encodeQuery, m as parseCommentContentElements, p as normalizeString, s as resolveFeishuRuntimeAccount, u as extractReplyText, v as normalizeCommentFileType } from "./accounts-Bpe6CjpS.js";
1
+ import { _ as normalizeCommentFileType, c as encodeQuery, d as isRecord$1, f as normalizeString, g as buildFeishuCommentTarget, h as requestFeishuApi, l as extractReplyText, m as readString, p as parseCommentContentElements, s as resolveFeishuRuntimeAccount } from "./accounts-Cfzht2Hc.js";
2
2
  import { i as resolveReceiveIdType } from "./targets-BUjQ1TcA.js";
3
- import { c as normalizeFeishuAllowEntry, d as resolveFeishuGroupConversationIngressAccess, f as resolveFeishuGroupSenderActivationIngressAccess, l as resolveFeishuDmIngressAccess, p as resolveFeishuReplyPolicy, s as hasExplicitFeishuGroupConfig, u as resolveFeishuGroupConfig } from "./channel-DR5JCyFd.js";
4
- import { c as decodeFeishuCardAction, o as buildFeishuCardActionTextFallback, s as createFeishuCardInteractionEnvelope } from "./send-result-D9rgEUlm.js";
3
+ import { c as normalizeFeishuAllowEntry, d as resolveFeishuGroupConversationIngressAccess, f as resolveFeishuGroupSenderActivationIngressAccess, l as resolveFeishuDmIngressAccess, p as resolveFeishuReplyPolicy, s as hasExplicitFeishuGroupConfig, u as resolveFeishuGroupConfig } from "./channel-BEX7iZKr.js";
4
+ import { c as decodeFeishuCardAction, o as buildFeishuCardActionTextFallback, s as createFeishuCardInteractionEnvelope } from "./send-result-DSsIa4-p.js";
5
5
  import { t as buildFeishuConversationId } from "./conversation-id-DuL575sn.js";
6
6
  import { t as getFeishuRuntime } from "./runtime-C5JxBWZp.js";
7
7
  import { a as getFeishuUserAgent, i as createFeishuWSClient, n as createEventDispatcher, r as createFeishuClient } from "./client-BhMNZBJD.js";
8
- import { c as getChatInfo, i as createCommentTypingReactionLifecycle, t as deliverCommentThreadText } from "./drive-BIrffRwc.js";
8
+ import { c as getChatInfo, i as createCommentTypingReactionLifecycle, t as deliverCommentThreadText } from "./drive-8o3Omlnd.js";
9
9
  import { t as createFeishuThreadBindingManager } from "./thread-bindings-V0bwk0A1.js";
10
- import { createReplyPrefixContext, evaluateSupplementalContextVisibility, loadSessionStore, normalizeAgentId as normalizeAgentId$1, resolveChannelContextVisibilityMode, resolveSessionStoreEntry } from "./runtime-api.js";
11
- import { _ as normalizeFeishuExternalKey, a as sendCardFeishu, c as sendStructuredCardFeishu, d as isFeishuBroadcastMention, f as isMentionForwardRequest, g as shouldSuppressFeishuTextForVoiceMedia, h as sendMediaFeishu, i as resolveFeishuCardTemplate, l as parsePostContent, m as saveMessageResourceFeishu, n as getMessageFeishu, p as isFeishuGroupChatType, r as listFeishuThreadMessages, s as sendMessageFeishu, u as extractMentionTargets } from "./send-Cze2qlca.js";
10
+ import { createReplyPrefixContext, evaluateSupplementalContextVisibility, loadSessionStore, normalizeAgentId as normalizeAgentId$2, resolveChannelContextVisibilityMode, resolveSessionStoreEntry } from "./runtime-api.js";
11
+ import { _ as normalizeFeishuExternalKey, a as sendCardFeishu, c as sendStructuredCardFeishu, d as isFeishuBroadcastMention, f as isMentionForwardRequest, g as shouldSuppressFeishuTextForVoiceMedia, h as sendMediaFeishu, i as resolveFeishuCardTemplate, l as parsePostContent, m as saveMessageResourceFeishu, n as getMessageFeishu, p as isFeishuGroupChatType, r as listFeishuThreadMessages, s as sendMessageFeishu, u as extractMentionTargets } from "./send-B3kteMF8.js";
12
12
  import { i as waitForAbortableDelay, r as raceWithTimeoutAndAbort } from "./probe-BjKRV7em.js";
13
13
  import { a as feishuWebhookRateLimiter, c as wsClients, i as botOpenIds, l as fetchBotIdentityForMonitor, n as FEISHU_WEBHOOK_MAX_BODY_BYTES, o as httpServers, r as botNames, s as recordWebhookStatus, t as FEISHU_WEBHOOK_BODY_TIMEOUT_MS } from "./monitor.state-r4OLFBfg.js";
14
14
  import { createChannelMessageReplyPipeline, formatChannelProgressDraftLineForEntry, isChannelProgressDraftWorkToolName, resolveAgentOutboundIdentity } from "openclaw/plugin-sdk/channel-outbound";
@@ -20,9 +20,9 @@ import { stripReasoningTagsFromText } from "openclaw/plugin-sdk/text-chunking";
20
20
  import fs from "node:fs";
21
21
  import os from "node:os";
22
22
  import path from "node:path";
23
+ import { resolveInboundLastRouteSessionKey } from "openclaw/plugin-sdk/routing";
23
24
  import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
24
25
  import * as Lark from "@larksuiteoapi/node-sdk";
25
- import { resolveInboundLastRouteSessionKey } from "openclaw/plugin-sdk/routing";
26
26
  import * as crypto$1 from "node:crypto";
27
27
  import crypto, { createHash } from "node:crypto";
28
28
  import { applyBasicWebhookRequestGuards, resolveRequestClientIp } from "openclaw/plugin-sdk/webhook-ingress";
@@ -757,12 +757,12 @@ function resolveUserPath(p) {
757
757
  //#endregion
758
758
  //#region extensions/feishu/src/agent-config.ts
759
759
  const DEFAULT_AGENT_ID = "main";
760
- function normalizeAgentId(value) {
760
+ function normalizeAgentId$1(value) {
761
761
  return (value ?? "").trim().toLowerCase() || DEFAULT_AGENT_ID;
762
762
  }
763
763
  function resolveFeishuConfigReasoningDefault(cfg, agentId) {
764
- const id = normalizeAgentId(agentId);
765
- return cfg.agents?.list?.find((entry) => normalizeAgentId(entry?.id) === id)?.reasoningDefault ?? cfg.agents?.defaults?.reasoningDefault ?? "off";
764
+ const id = normalizeAgentId$1(agentId);
765
+ return cfg.agents?.list?.find((entry) => normalizeAgentId$1(entry?.id) === id)?.reasoningDefault ?? cfg.agents?.defaults?.reasoningDefault ?? "off";
766
766
  }
767
767
  //#endregion
768
768
  //#region extensions/feishu/src/reasoning-preview.ts
@@ -954,30 +954,30 @@ var FeishuStreamingSession = class {
954
954
  let sendRes;
955
955
  const sendOptions = options ?? {};
956
956
  const sendMode = resolveStreamingCardSendMode(sendOptions);
957
- if (sendMode === "reply") sendRes = await this.client.im.message.reply({
957
+ if (sendMode === "reply") sendRes = await requestFeishuApi(() => this.client.im.message.reply({
958
958
  path: { message_id: sendOptions.replyToMessageId },
959
959
  data: {
960
960
  msg_type: "interactive",
961
961
  content: cardContent,
962
962
  ...sendOptions.replyInThread ? { reply_in_thread: true } : {}
963
963
  }
964
- });
965
- else if (sendMode === "root_create") sendRes = await this.client.im.message.create({
964
+ }), "Send card failed");
965
+ else if (sendMode === "root_create") sendRes = await requestFeishuApi(() => this.client.im.message.create({
966
966
  params: { receive_id_type: receiveIdType },
967
967
  data: Object.assign({
968
968
  receive_id: receiveId,
969
969
  msg_type: "interactive",
970
970
  content: cardContent
971
971
  }, { root_id: sendOptions.rootId })
972
- });
973
- else sendRes = await this.client.im.message.create({
972
+ }), "Send card failed");
973
+ else sendRes = await requestFeishuApi(() => this.client.im.message.create({
974
974
  params: { receive_id_type: receiveIdType },
975
975
  data: {
976
976
  receive_id: receiveId,
977
977
  msg_type: "interactive",
978
978
  content: cardContent
979
979
  }
980
- });
980
+ }), "Send card failed");
981
981
  if (sendRes.code !== 0 || !sendRes.data?.message_id) throw new Error(`Send card failed: ${sendRes.msg}`);
982
982
  this.state = {
983
983
  cardId,
@@ -2188,7 +2188,7 @@ async function handleFeishuMessage(params) {
2188
2188
  const dmPolicy = feishuCfg?.dmPolicy ?? "pairing";
2189
2189
  const configAllowFrom = feishuCfg?.allowFrom ?? [];
2190
2190
  const rawBroadcastAgents = isGroup ? resolveBroadcastAgents(cfg, ctx.chatId) : null;
2191
- const broadcastAgents = rawBroadcastAgents ? uniqueStrings(rawBroadcastAgents.map((id) => normalizeAgentId$1(id))) : null;
2191
+ const broadcastAgents = rawBroadcastAgents ? uniqueStrings(rawBroadcastAgents.map((id) => normalizeAgentId$2(id))) : null;
2192
2192
  const messageCreateTimeMs = parseStrictNonNegativeInteger(event.message.create_time) ?? Date.now();
2193
2193
  let requireMention = false;
2194
2194
  if (isGroup) {
@@ -2736,12 +2736,12 @@ async function handleFeishuMessage(params) {
2736
2736
  return;
2737
2737
  }
2738
2738
  const strategy = cfg.broadcast?.strategy === "sequential" ? "sequential" : "parallel";
2739
- const activeAgentId = ctx.mentionedBot || !requireMention ? normalizeAgentId$1(route.agentId) : null;
2740
- const agentIds = (cfg.agents?.list ?? []).map((a) => normalizeAgentId$1(a.id));
2739
+ const activeAgentId = ctx.mentionedBot || !requireMention ? normalizeAgentId$2(route.agentId) : null;
2740
+ const agentIds = (cfg.agents?.list ?? []).map((a) => normalizeAgentId$2(a.id));
2741
2741
  const hasKnownAgents = agentIds.length > 0;
2742
2742
  log(`feishu[${account.accountId}]: broadcasting to ${broadcastAgents.length} agents (strategy=${strategy}, active=${activeAgentId ?? "none"})`);
2743
2743
  const dispatchForAgent = async (agentId) => {
2744
- if (hasKnownAgents && !agentIds.includes(normalizeAgentId$1(agentId))) {
2744
+ if (hasKnownAgents && !agentIds.includes(normalizeAgentId$2(agentId))) {
2745
2745
  log(`feishu[${account.accountId}]: broadcast agent ${agentId} not found in agents.list; skipping`);
2746
2746
  return;
2747
2747
  }
@@ -4249,7 +4249,7 @@ async function resolveDriveCommentEventCore(params) {
4249
4249
  return null;
4250
4250
  }
4251
4251
  const context = await fetchDriveCommentContext({
4252
- client: createClient ? createClient(account ?? { accountId }) : createFeishuClient((await import("./accounts-Bpe6CjpS.js").then((n) => n.t)).resolveFeishuAccount({
4252
+ client: createClient ? createClient(account ?? { accountId }) : createFeishuClient((await import("./accounts-Cfzht2Hc.js").then((n) => n.t)).resolveFeishuAccount({
4253
4253
  cfg,
4254
4254
  accountId
4255
4255
  })),
@@ -5197,7 +5197,7 @@ async function resolveReactionSyntheticEvent(params) {
5197
5197
  const senderId = event.user_id?.open_id;
5198
5198
  const senderUserId = event.user_id?.user_id;
5199
5199
  if (!emoji || !messageId || !senderId) return null;
5200
- const { resolveFeishuAccount } = await import("./accounts-Bpe6CjpS.js").then((n) => n.t);
5200
+ const { resolveFeishuAccount } = await import("./accounts-Cfzht2Hc.js").then((n) => n.t);
5201
5201
  const reactionNotifications = resolveFeishuAccount({
5202
5202
  cfg,
5203
5203
  accountId
@@ -3,8 +3,8 @@ import { createReplyPrefixContext } from "openclaw/plugin-sdk/channel-outbound";
3
3
  import { createChannelPairingController } from "openclaw/plugin-sdk/channel-pairing";
4
4
  import { PAIRING_APPROVED_MESSAGE, buildProbeChannelStatusSummary, createDefaultChannelRuntimeState } from "openclaw/plugin-sdk/channel-status";
5
5
  import { chunkTextForOutbound } from "openclaw/plugin-sdk/text-chunking";
6
- import { loadSessionStore, resolveSessionStoreEntry } from "openclaw/plugin-sdk/session-store-runtime";
7
6
  import { normalizeAgentId } from "openclaw/plugin-sdk/routing";
7
+ import { loadSessionStore, resolveSessionStoreEntry } from "openclaw/plugin-sdk/session-store-runtime";
8
8
  import { DEFAULT_ACCOUNT_ID, buildChannelConfigSchema, createActionGate, createDedupeCache } from "openclaw/plugin-sdk/core";
9
9
  import { buildAgentMediaPayload } from "openclaw/plugin-sdk/agent-media-payload";
10
10
  import { evaluateSupplementalContextVisibility, filterSupplementalContextItems, resolveChannelContextVisibilityMode } from "openclaw/plugin-sdk/context-visibility-runtime";
@@ -1,6 +1,6 @@
1
- import { c as createFeishuApiError, f as isRecord$1, g as requestFeishuApi, s as resolveFeishuRuntimeAccount } from "./accounts-Bpe6CjpS.js";
1
+ import { d as isRecord$1, h as requestFeishuApi, s as resolveFeishuRuntimeAccount } from "./accounts-Cfzht2Hc.js";
2
2
  import { i as resolveReceiveIdType, r as normalizeFeishuTarget } from "./targets-BUjQ1TcA.js";
3
- import { i as toFeishuSendResult, r as resolveFeishuReceiptKind, t as assertFeishuMessageApiSuccess } from "./send-result-D9rgEUlm.js";
3
+ import { i as toFeishuSendResult, r as resolveFeishuReceiptKind, t as assertFeishuMessageApiSuccess } from "./send-result-DSsIa4-p.js";
4
4
  import { t as getFeishuRuntime } from "./runtime-C5JxBWZp.js";
5
5
  import { r as createFeishuClient } from "./client-BhMNZBJD.js";
6
6
  import { parseStrictNonNegativeInteger } from "openclaw/plugin-sdk/number-runtime";
@@ -820,6 +820,8 @@ function isWithdrawnReplyError(err) {
820
820
  if (typeof code === "number" && WITHDRAWN_REPLY_ERROR_CODES.has(code)) return true;
821
821
  const response = err.response;
822
822
  if (typeof response?.data?.code === "number" && WITHDRAWN_REPLY_ERROR_CODES.has(response.data.code)) return true;
823
+ const cause = err.cause;
824
+ if (cause && cause !== err) return isWithdrawnReplyError(cause);
823
825
  return false;
824
826
  }
825
827
  /** Send a direct message as a fallback when a reply target is unavailable. */
@@ -840,16 +842,16 @@ async function sendReplyOrFallbackDirect(client, params) {
840
842
  const replyTargetFallbackError = params.replyInThread && params.allowTopLevelReplyFallback !== true ? /* @__PURE__ */ new Error("Feishu thread reply failed: reply target is unavailable and cannot safely fall back to a top-level send.") : null;
841
843
  let response;
842
844
  try {
843
- response = await client.im.message.reply({
845
+ response = await requestFeishuApi(() => client.im.message.reply({
844
846
  path: { message_id: params.replyToMessageId },
845
847
  data: {
846
848
  content: params.content,
847
849
  msg_type: params.msgType,
848
850
  ...params.replyInThread ? { reply_in_thread: true } : {}
849
851
  }
850
- });
852
+ }), params.replyErrorPrefix, { includeNestedErrorLogId: true });
851
853
  } catch (err) {
852
- if (!isWithdrawnReplyError(err)) throw createFeishuApiError(err, params.replyErrorPrefix, { includeNestedErrorLogId: true });
854
+ if (!isWithdrawnReplyError(err)) throw err;
853
855
  if (replyTargetFallbackError) throw replyTargetFallbackError;
854
856
  return sendFallbackDirect(client, params.directParams, params.directErrorPrefix);
855
857
  }
@@ -1,4 +1,4 @@
1
- import { f as isRecord } from "./accounts-Bpe6CjpS.js";
1
+ import { d as isRecord } from "./accounts-Cfzht2Hc.js";
2
2
  import { createMessageReceiptFromOutboundResults } from "openclaw/plugin-sdk/channel-outbound";
3
3
  //#region extensions/feishu/src/card-interaction.ts
4
4
  const FEISHU_CARD_INTERACTION_VERSION = "ocf1";
package/dist/setup-api.js CHANGED
@@ -1,2 +1,2 @@
1
- import { i as feishuSetupAdapter, n as feishuSetupWizard, t as feishuPlugin } from "./channel-DR5JCyFd.js";
1
+ import { i as feishuSetupAdapter, n as feishuSetupWizard, t as feishuPlugin } from "./channel-BEX7iZKr.js";
2
2
  export { feishuPlugin, feishuSetupAdapter, feishuSetupWizard };
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "@openclaw/feishu",
3
- "version": "2026.6.5-beta.5",
3
+ "version": "2026.6.5-beta.6",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@openclaw/feishu",
9
- "version": "2026.6.5-beta.5",
9
+ "version": "2026.6.5-beta.6",
10
10
  "dependencies": {
11
11
  "@larksuiteoapi/node-sdk": "1.66.0",
12
12
  "typebox": "1.1.39",
13
13
  "zod": "4.4.3"
14
14
  },
15
15
  "peerDependencies": {
16
- "openclaw": ">=2026.6.5-beta.5"
16
+ "openclaw": ">=2026.6.5-beta.6"
17
17
  },
18
18
  "peerDependenciesMeta": {
19
19
  "openclaw": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/feishu",
3
- "version": "2026.6.5-beta.5",
3
+ "version": "2026.6.5-beta.6",
4
4
  "description": "OpenClaw Feishu/Lark channel plugin for chats and workplace tools (community maintained by @m1heng).",
5
5
  "repository": {
6
6
  "type": "git",
@@ -13,7 +13,7 @@
13
13
  "zod": "4.4.3"
14
14
  },
15
15
  "peerDependencies": {
16
- "openclaw": ">=2026.6.5-beta.5"
16
+ "openclaw": ">=2026.6.5-beta.6"
17
17
  },
18
18
  "peerDependenciesMeta": {
19
19
  "openclaw": {
@@ -47,10 +47,10 @@
47
47
  "minHostVersion": ">=2026.5.29"
48
48
  },
49
49
  "compat": {
50
- "pluginApi": ">=2026.6.5-beta.5"
50
+ "pluginApi": ">=2026.6.5-beta.6"
51
51
  },
52
52
  "build": {
53
- "openclawVersion": "2026.6.5-beta.5"
53
+ "openclawVersion": "2026.6.5-beta.6"
54
54
  },
55
55
  "release": {
56
56
  "publishToClawHub": true,