@openclaw/feishu 2026.11.1 → 2026.11.3
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/.setup/{app-registration-d8dxhKp-.mjs → app-registration-CYU0G5Oo.mjs} +3 -2
- package/dist/.setup/{channel-oXfjraK8.mjs → channel-D60cZ_Y_.mjs} +53 -34
- package/dist/.setup/{channel.runtime-DwAtbHg3.mjs → channel.runtime-Cg4V7VC2.mjs} +14 -10
- package/dist/.setup/{chat-CfRBIQrw.mjs → chat-qj1pEIcO.mjs} +5 -3
- package/dist/.setup/{client-DlpvvLoz.mjs → client-BTiFlqqL.mjs} +7 -4
- package/dist/.setup/{conversation-id-i1ICr3ID.mjs → conversation-id-D00i9uy5.mjs} +4 -2
- package/dist/.setup/{doctor-contract-CWB6EycD.mjs → doctor-contract-BNXcJcWR.mjs} +20 -10
- package/dist/.setup/{json-response-BX9Htr9f.mjs → json-response-DXajw_FU.mjs} +2 -1
- package/dist/.setup/{message-action-contract-C9KL891-.mjs → message-action-contract-Bhxj8Zrf.mjs} +2 -1
- package/dist/.setup/{monitor-DHVCTSyT.mjs → monitor-BcnMie82.mjs} +12 -8
- package/dist/.setup/{monitor.account-P2wAHXqG.mjs → monitor.account-C_u1fZ5g.mjs} +126 -70
- package/dist/.setup/{probe-BiQj7eM4.mjs → probe-s0hiM44D.mjs} +6 -4
- package/dist/.setup/{reply-delivery-result-QS_FCE--.mjs → reply-delivery-result-DknmIzOB.mjs} +70 -37
- package/dist/.setup/{runtime-6V3uDMw5.mjs → runtime-C5JxBWZp.mjs} +2 -1
- package/dist/.setup/runtime-setter-api-CG-RC4_r.mjs +3 -0
- package/dist/.setup/{secret-contract-DbKGdEJP.mjs → secret-contract-DEyvsehF.mjs} +2 -1
- package/dist/.setup/secret-contract-api-DsHOG5s6.mjs +3 -0
- package/dist/.setup/{security-audit-CYRW0D76.mjs → security-audit-b86aSgH2.mjs} +2 -1
- package/dist/.setup/{session-conversation-CFw-zLLy.mjs → session-conversation-BSBNK5Mq.mjs} +3 -2
- package/dist/.setup/setup-api-Di55YmQ0.mjs +3 -0
- package/dist/.setup/{subagent-hooks-CA-gJ3Cu.mjs → subagent-hooks-CvVuM0O4.mjs} +5 -4
- package/dist/.setup/{thread-bindings-6eyktxK_.mjs → thread-bindings-BxKmOara.mjs} +2 -1
- package/dist/api.js +32 -20
- package/dist/channel-entry.js +2 -1
- package/dist/channel-plugin-api.js +2 -1
- package/dist/configured-state.js +2 -1
- package/dist/contract-api.js +3 -3
- package/dist/doctor-contract-api.js +2 -1
- package/dist/index.js +2 -1
- package/dist/runtime-api.js +1 -1
- package/dist/runtime-setter-api.js +2 -1
- package/dist/secret-contract-api.js +2 -1
- package/dist/security-contract-api.js +2 -1
- package/dist/session-binding-contract-api.js +2 -1
- package/dist/session-key-api.js +2 -1
- package/dist/setup-api.js +2 -1
- package/dist/setup-entry.js +5 -4
- package/dist/subagent-hooks-api.js +3 -2
- package/package.json +4 -4
- package/dist/.setup/runtime-setter-api-DSLLnejl.mjs +0 -2
- package/dist/.setup/secret-contract-api-DHseJ7sg.mjs +0 -2
- package/dist/.setup/setup-api-DuREj_Gj.mjs +0 -2
- package/dist/.source-module-urls/6579f1b33dd01f8f0aaea28311ed6df1a635f9ad1e6fa86dcba53bca46407e55.json +0 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { c as normalizeFeishuExternalKey, g as resolveFeishuRuntimeAccount, h as resolveFeishuAccount, s as normalizeFeishuWebhookPath } from "./doctor-contract-
|
|
2
|
-
import { o as resolveConfiguredFeishuGroupSessionScope, t as buildFeishuConversationId, u as resolveReceiveIdType } from "./conversation-id-
|
|
3
|
-
import { c as resolveFeishuLegacyWebhookListener, l as gateway_config_runtime_exports, s as describeFeishuWebhookPathConflict } from "./channel-
|
|
4
|
-
import { A as sendMessageFeishu, At as resolveFeishuGroupConfig, B as parseInteractiveCardContent, D as getMessageFeishu, Dt as hasExplicitFeishuGroupConfig, F as isFeishuBroadcastMention, Ft as normalizeFeishuChatType, G as resolveFeishuIdentityEmoji, H as resolveFeishuSenderName, I as isMentionForwardRequest, It as resolveFeishuChatType, L as normalizeMentions, Mt as resolveFeishuGroupSenderActivationIngressAccess, N as formatFeishuMediaContent, O as listFeishuThreadMessages, Ot as normalizeFeishuAllowEntry, P as extractMentionTargets, Pt as resolveFeishuReplyPolicy, R as isFeishuGroupChatType, Rt as createFeishuCardInteractionEnvelope, S as sendMediaFeishu, T as chunkFeishuCardMarkdown, V as parsePostContent, W as buildFeishuMediaFallbackText, _t as shouldUseFeishuCard, a as shouldSendNoVisibleReplyFallback, b as withinCardTableLimit, ct as buildFeishuCommentTarget, d as consumeFeishuPresentationFallbackMarker, ft as resolveFeishuCardTemplate, ht as materializeFeishuPostMarkdownSoftBreaks, i as noVisibleFeishuReplyDelivery, it as extractReplyText, j as sendStructuredCardFeishu, jt as resolveFeishuGroupConversationIngressAccess, k as sendCardFeishu, kt as resolveFeishuDmIngressAccess, lt as normalizeCommentFileType, mt as chunkFeishuPostMarkdown, n as createFeishuReplyDeliveryResult, nt as createCommentTypingReactionLifecycle, ot as parseCommentContentElements, q as deliverCommentThreadText, r as mergeFeishuReplyDeliveryResults, rt as encodeQuery, st as requestFeishuApi, t as createFeishuPartialReplyDeliveryError, u as buildFeishuPresentationFallback, v as renderFeishuReplyPayload, w as shouldSuppressFeishuTextForVoiceMedia, x as saveMessageResourceFeishu, y as resolveFeishuRichReply, z as normalizeFeishuEventChatType, zt as decodeFeishuCardAction } from "./reply-delivery-result-
|
|
5
|
-
import { t as getFeishuRuntime } from "./runtime-
|
|
6
|
-
import { a as getFeishuUserAgent, f as resolveConfiguredHttpTimeoutMs, i as createFeishuWSClient, n as createEventDispatcher, r as createFeishuClient } from "./client-
|
|
7
|
-
import { t as createFeishuThreadBindingManager } from "./thread-bindings-
|
|
8
|
-
import { r as getChatInfo } from "./chat-
|
|
1
|
+
import { c as normalizeFeishuExternalKey, g as resolveFeishuRuntimeAccount, h as resolveFeishuAccount, s as normalizeFeishuWebhookPath } from "./doctor-contract-BNXcJcWR.mjs";
|
|
2
|
+
import { o as resolveConfiguredFeishuGroupSessionScope, t as buildFeishuConversationId, u as resolveReceiveIdType } from "./conversation-id-D00i9uy5.mjs";
|
|
3
|
+
import { c as resolveFeishuLegacyWebhookListener, l as gateway_config_runtime_exports, s as describeFeishuWebhookPathConflict } from "./channel-D60cZ_Y_.mjs";
|
|
4
|
+
import { A as sendMessageFeishu, At as resolveFeishuGroupConfig, B as parseInteractiveCardContent, D as getMessageFeishu, Dt as hasExplicitFeishuGroupConfig, F as isFeishuBroadcastMention, Ft as normalizeFeishuChatType, G as resolveFeishuIdentityEmoji, H as resolveFeishuSenderName, I as isMentionForwardRequest, It as resolveFeishuChatType, L as normalizeMentions, Mt as resolveFeishuGroupSenderActivationIngressAccess, N as formatFeishuMediaContent, O as listFeishuThreadMessages, Ot as normalizeFeishuAllowEntry, P as extractMentionTargets, Pt as resolveFeishuReplyPolicy, R as isFeishuGroupChatType, Rt as createFeishuCardInteractionEnvelope, S as sendMediaFeishu, T as chunkFeishuCardMarkdown, V as parsePostContent, W as buildFeishuMediaFallbackText, _t as shouldUseFeishuCard, a as shouldSendNoVisibleReplyFallback, b as withinCardTableLimit, ct as buildFeishuCommentTarget, d as consumeFeishuPresentationFallbackMarker, ft as resolveFeishuCardTemplate, ht as materializeFeishuPostMarkdownSoftBreaks, i as noVisibleFeishuReplyDelivery, it as extractReplyText, j as sendStructuredCardFeishu, jt as resolveFeishuGroupConversationIngressAccess, k as sendCardFeishu, kt as resolveFeishuDmIngressAccess, lt as normalizeCommentFileType, mt as chunkFeishuPostMarkdown, n as createFeishuReplyDeliveryResult, nt as createCommentTypingReactionLifecycle, ot as parseCommentContentElements, q as deliverCommentThreadText, r as mergeFeishuReplyDeliveryResults, rt as encodeQuery, st as requestFeishuApi, t as createFeishuPartialReplyDeliveryError, u as buildFeishuPresentationFallback, v as renderFeishuReplyPayload, w as shouldSuppressFeishuTextForVoiceMedia, x as saveMessageResourceFeishu, y as resolveFeishuRichReply, z as normalizeFeishuEventChatType, zt as decodeFeishuCardAction } from "./reply-delivery-result-DknmIzOB.mjs";
|
|
5
|
+
import { t as getFeishuRuntime } from "./runtime-C5JxBWZp.mjs";
|
|
6
|
+
import { a as getFeishuUserAgent, f as resolveConfiguredHttpTimeoutMs, i as createFeishuWSClient, n as createEventDispatcher, r as createFeishuClient } from "./client-BTiFlqqL.mjs";
|
|
7
|
+
import { t as createFeishuThreadBindingManager } from "./thread-bindings-BxKmOara.mjs";
|
|
8
|
+
import { r as getChatInfo } from "./chat-qj1pEIcO.mjs";
|
|
9
9
|
import { evaluateSupplementalContextVisibility, normalizeAgentId as normalizeAgentId$1, resolveChannelContextVisibilityMode } from "../runtime-api.js";
|
|
10
|
-
import { t as readFeishuJsonResponse } from "./json-response-
|
|
11
|
-
import { a as waitForAbortableDelay, i as raceWithTimeoutAndAbort } from "./probe-
|
|
12
|
-
import { t as fetchBotIdentityForMonitor } from "./monitor-
|
|
10
|
+
import { t as readFeishuJsonResponse } from "./json-response-DXajw_FU.mjs";
|
|
11
|
+
import { a as waitForAbortableDelay, i as raceWithTimeoutAndAbort } from "./probe-s0hiM44D.mjs";
|
|
12
|
+
import { t as fetchBotIdentityForMonitor } from "./monitor-BcnMie82.mjs";
|
|
13
13
|
import { resolveAgentConfig } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
14
14
|
import { DEFAULT_INGRESS_ADOPTION_STALL_MS, bindIngressLifecycleToReplyOptions, createChannelIngressError, createChannelIngressMonitor, createChannelMessageReplyPipeline, createReplyPrefixContext, formatChannelProgressDraftLineForEntry, resolveAgentOutboundIdentity, resolveChannelPreviewStreamMode, resolveChannelStreamingBlockEnabled, waitUntilAbort } from "openclaw/plugin-sdk/channel-outbound";
|
|
15
15
|
import { createChannelPairingController } from "openclaw/plugin-sdk/channel-pairing";
|
|
@@ -50,7 +50,7 @@ import { channelBlockedPatch, channelReadyPatch } from "openclaw/plugin-sdk/gate
|
|
|
50
50
|
import { createWebhookInFlightLimiter, readWebhookBodyOrReject, sendHttpRequestRejection } from "openclaw/plugin-sdk/webhook-request-guards";
|
|
51
51
|
import { canonicalizeWebhookRouteKey, registerPluginHttpRoute, registerWebhookTarget, resolveSingleWebhookTarget } from "openclaw/plugin-sdk/webhook-targets";
|
|
52
52
|
import { isAbortRequestText, isBtwRequestText } from "openclaw/plugin-sdk/command-primitives-runtime";
|
|
53
|
-
|
|
53
|
+
//#region src/channels/mention-gating.ts
|
|
54
54
|
function resolveBotThreadMentionPolicy(params) {
|
|
55
55
|
if (!params.isBotOwnedThread || params.requireMentionInBotThreads === void 0) return {
|
|
56
56
|
requireMention: params.requireMention,
|
|
@@ -61,7 +61,8 @@ function resolveBotThreadMentionPolicy(params) {
|
|
|
61
61
|
implicitMentionKinds: params.requireMentionInBotThreads ? params.implicitMentionKinds?.filter((kind) => kind === "native") : params.implicitMentionKinds
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
//#endregion
|
|
65
|
+
//#region extensions/feishu/src/bot-agent-body.ts
|
|
65
66
|
const MAX_MENTION_CONTEXT_NAME_LENGTH = 80;
|
|
66
67
|
function formatMentionNameForAgentContext(name) {
|
|
67
68
|
const normalized = Array.from(name, (char) => {
|
|
@@ -91,7 +92,8 @@ function buildFeishuAgentBody(params) {
|
|
|
91
92
|
}
|
|
92
93
|
return messageBody;
|
|
93
94
|
}
|
|
94
|
-
|
|
95
|
+
//#endregion
|
|
96
|
+
//#region extensions/feishu/src/bot-broadcast.ts
|
|
95
97
|
function createFeishuBroadcastIngressSettlement(params) {
|
|
96
98
|
const lanes = /* @__PURE__ */ new Set();
|
|
97
99
|
const failures = [];
|
|
@@ -246,7 +248,8 @@ function buildBroadcastSessionKey(baseSessionKey, originalAgentId, targetAgentId
|
|
|
246
248
|
const prefix = `agent:${originalAgentId}:`;
|
|
247
249
|
return baseSessionKey.startsWith(prefix) ? `agent:${targetAgentId}:${baseSessionKey.slice(prefix.length)}` : baseSessionKey;
|
|
248
250
|
}
|
|
249
|
-
|
|
251
|
+
//#endregion
|
|
252
|
+
//#region extensions/feishu/src/bot-content.ts
|
|
250
253
|
function resolveFeishuGroupSession(params) {
|
|
251
254
|
const { chatId, senderOpenId, messageId, rootId, threadId, chatType, groupConfig, feishuCfg } = params;
|
|
252
255
|
const normalizedThreadId = threadId?.trim();
|
|
@@ -403,9 +406,11 @@ async function resolveFeishuMediaList(params) {
|
|
|
403
406
|
}
|
|
404
407
|
return out;
|
|
405
408
|
}
|
|
406
|
-
|
|
409
|
+
//#endregion
|
|
410
|
+
//#region extensions/feishu/src/bot-group-name-state.ts
|
|
407
411
|
const feishuGroupNameCache = /* @__PURE__ */ new Map();
|
|
408
|
-
|
|
412
|
+
//#endregion
|
|
413
|
+
//#region extensions/feishu/src/bot-group-name.ts
|
|
409
414
|
const GROUP_NAME_CACHE_TTL_MS = 18e5;
|
|
410
415
|
const GROUP_NAME_CACHE_MAX_SIZE = 500;
|
|
411
416
|
function evictGroupNameCache() {
|
|
@@ -444,7 +449,8 @@ async function resolveGroupName(params) {
|
|
|
444
449
|
evictGroupNameCache();
|
|
445
450
|
return resolvedName;
|
|
446
451
|
}
|
|
447
|
-
|
|
452
|
+
//#endregion
|
|
453
|
+
//#region extensions/feishu/src/bot-name.ts
|
|
448
454
|
const POSITIVE_TTL_MS = 6e5;
|
|
449
455
|
const NEGATIVE_TTL_MS = 6e4;
|
|
450
456
|
const MAX_CACHE_ENTRIES = 5e3;
|
|
@@ -576,7 +582,8 @@ async function resolveFeishuBotName(params) {
|
|
|
576
582
|
inflight.delete(key);
|
|
577
583
|
}
|
|
578
584
|
}
|
|
579
|
-
|
|
585
|
+
//#endregion
|
|
586
|
+
//#region extensions/feishu/src/bot-thread-mentions.ts
|
|
580
587
|
async function prepareFeishuThreadRoot(params) {
|
|
581
588
|
let { cfg, account } = params;
|
|
582
589
|
const { ctx, botOpenId, log } = params;
|
|
@@ -621,7 +628,8 @@ async function prepareFeishuThreadRoot(params) {
|
|
|
621
628
|
getRootMessageInfo
|
|
622
629
|
};
|
|
623
630
|
}
|
|
624
|
-
|
|
631
|
+
//#endregion
|
|
632
|
+
//#region extensions/feishu/src/dedup-state.ts
|
|
625
633
|
const DEDUPE_NAMESPACE_PREFIX = "feishu.dedup";
|
|
626
634
|
const DEDUP_TTL_MS = 864e5;
|
|
627
635
|
const MEMORY_MAX_SIZE = 1e3;
|
|
@@ -644,7 +652,8 @@ const feishuDedupeState = {
|
|
|
644
652
|
this.guard = createFeishuDedupeGuard();
|
|
645
653
|
}
|
|
646
654
|
};
|
|
647
|
-
|
|
655
|
+
//#endregion
|
|
656
|
+
//#region extensions/feishu/src/dedup.ts
|
|
648
657
|
function dedupeOptions(namespace, log) {
|
|
649
658
|
return {
|
|
650
659
|
...namespace ? { namespace } : {},
|
|
@@ -684,7 +693,8 @@ async function hasProcessedFeishuMessage(messageId, namespace = "global", log) {
|
|
|
684
693
|
async function warmupDedupFromPluginState(namespace, log) {
|
|
685
694
|
return await feishuDedupeState.guard.warmup(namespace, (error) => log?.(`feishu-dedup: warmup persistent state error: ${String(error)}`));
|
|
686
695
|
}
|
|
687
|
-
|
|
696
|
+
//#endregion
|
|
697
|
+
//#region extensions/feishu/src/dedupe-key.ts
|
|
688
698
|
function resolvePostMediaParts(content) {
|
|
689
699
|
const { attachments } = parsePostContent(content, { includeTopLevelFiles: false });
|
|
690
700
|
return ["image", "file"].flatMap((kind) => attachments.filter((attachment) => attachment.kind === kind).map((attachment) => `${kind}_key:${attachment.key}`));
|
|
@@ -736,7 +746,8 @@ function resolveFeishuMessageDedupeKey(event) {
|
|
|
736
746
|
}
|
|
737
747
|
return messageId;
|
|
738
748
|
}
|
|
739
|
-
|
|
749
|
+
//#endregion
|
|
750
|
+
//#region extensions/feishu/src/dynamic-agent.ts
|
|
740
751
|
var DynamicAgentMutationSkipped = class extends Error {
|
|
741
752
|
constructor(cfg) {
|
|
742
753
|
super("dynamic agent mutation skipped");
|
|
@@ -889,7 +900,8 @@ function resolveUserPath(p) {
|
|
|
889
900
|
if (p.startsWith("~/")) return path.join(os.homedir(), p.slice(2));
|
|
890
901
|
return p;
|
|
891
902
|
}
|
|
892
|
-
|
|
903
|
+
//#endregion
|
|
904
|
+
//#region extensions/feishu/src/reasoning-preview.ts
|
|
893
905
|
async function resolveFeishuReasoningPreviewEnabled(params) {
|
|
894
906
|
const configDefault = resolveAgentConfig(params.cfg, params.agentId)?.reasoningDefault ?? params.cfg.agents?.defaults?.reasoningDefault ?? "off";
|
|
895
907
|
if (!params.sessionKey) return configDefault === "stream";
|
|
@@ -905,9 +917,11 @@ async function resolveFeishuReasoningPreviewEnabled(params) {
|
|
|
905
917
|
}
|
|
906
918
|
return configDefault === "stream";
|
|
907
919
|
}
|
|
908
|
-
|
|
920
|
+
//#endregion
|
|
921
|
+
//#region extensions/feishu/src/reply-dispatcher-state.ts
|
|
909
922
|
const streamingStartBackoffUntilByAccount = /* @__PURE__ */ new Map();
|
|
910
|
-
|
|
923
|
+
//#endregion
|
|
924
|
+
//#region extensions/feishu/src/streaming-card.ts
|
|
911
925
|
/** Provider finalization failed after a streaming card may already be visible. */
|
|
912
926
|
var FeishuStreamingFinalizationError = class extends Error {
|
|
913
927
|
constructor(cause, result) {
|
|
@@ -1259,7 +1273,8 @@ var FeishuStreamingSession = class {
|
|
|
1259
1273
|
return this.state !== null && !this.closed;
|
|
1260
1274
|
}
|
|
1261
1275
|
};
|
|
1262
|
-
|
|
1276
|
+
//#endregion
|
|
1277
|
+
//#region extensions/feishu/src/streaming-update.ts
|
|
1263
1278
|
/** Admit captured snapshots in order while the session owns provider writes. */
|
|
1264
1279
|
function queueFeishuStreamingUpdate(params) {
|
|
1265
1280
|
const { queue, session, startPromise, text, accountId, runtime } = params;
|
|
@@ -1268,7 +1283,8 @@ function queueFeishuStreamingUpdate(params) {
|
|
|
1268
1283
|
if (session?.isActive()) session.update(text).catch((error) => runtime.error?.(`feishu[${accountId}] streaming update failed: ${String(error)}`));
|
|
1269
1284
|
});
|
|
1270
1285
|
}
|
|
1271
|
-
|
|
1286
|
+
//#endregion
|
|
1287
|
+
//#region extensions/feishu/src/typing-backoff.ts
|
|
1272
1288
|
/** Feishu API codes that should trip the typing circuit breaker. */
|
|
1273
1289
|
const FEISHU_BACKOFF_CODES = /* @__PURE__ */ new Set([
|
|
1274
1290
|
99991400,
|
|
@@ -1296,7 +1312,8 @@ function getBackoffCodeFromResponse(response) {
|
|
|
1296
1312
|
const code = response.code;
|
|
1297
1313
|
return typeof code === "number" && FEISHU_BACKOFF_CODES.has(code) ? code : void 0;
|
|
1298
1314
|
}
|
|
1299
|
-
|
|
1315
|
+
//#endregion
|
|
1316
|
+
//#region extensions/feishu/src/typing.ts
|
|
1300
1317
|
const TYPING_EMOJI = "Typing";
|
|
1301
1318
|
async function requestTypingReaction(request, operation, readResponse, runtime) {
|
|
1302
1319
|
const indicator = `typing indicator${operation === "remove" ? " removal" : ""}`;
|
|
@@ -1364,7 +1381,8 @@ async function removeTypingIndicator(params) {
|
|
|
1364
1381
|
reaction_id: state.reactionId
|
|
1365
1382
|
} }), "remove", () => void 0, runtime);
|
|
1366
1383
|
}
|
|
1367
|
-
|
|
1384
|
+
//#endregion
|
|
1385
|
+
//#region extensions/feishu/src/reply-dispatcher.ts
|
|
1368
1386
|
function mergeStreamingFinalText(previousText, nextText, appendError) {
|
|
1369
1387
|
if (!appendError || !previousText || nextText.startsWith(previousText)) return nextText;
|
|
1370
1388
|
if (previousText.endsWith(`\n\n${nextText}`)) return previousText;
|
|
@@ -2142,7 +2160,8 @@ function createFeishuReplyDispatcher(params) {
|
|
|
2142
2160
|
ensureNoVisibleReplyFallback
|
|
2143
2161
|
};
|
|
2144
2162
|
}
|
|
2145
|
-
|
|
2163
|
+
//#endregion
|
|
2164
|
+
//#region extensions/feishu/src/synthetic-event-target.ts
|
|
2146
2165
|
const directPreDispatchTargets = /* @__PURE__ */ new WeakMap();
|
|
2147
2166
|
/** Keep synthetic-only routing metadata outside the public Feishu event shape. */
|
|
2148
2167
|
function setFeishuSyntheticDirectPreDispatchTarget(event, target) {
|
|
@@ -2152,7 +2171,8 @@ function setFeishuSyntheticDirectPreDispatchTarget(event, target) {
|
|
|
2152
2171
|
function getFeishuSyntheticDirectPreDispatchTarget(event) {
|
|
2153
2172
|
return directPreDispatchTargets.get(event);
|
|
2154
2173
|
}
|
|
2155
|
-
|
|
2174
|
+
//#endregion
|
|
2175
|
+
//#region extensions/feishu/src/bot.ts
|
|
2156
2176
|
const permissionErrorNotifiedAt = /* @__PURE__ */ new Map();
|
|
2157
2177
|
const PERMISSION_ERROR_COOLDOWN_MS = 3e5;
|
|
2158
2178
|
function isFeishuTopicSessionScope(scope) {
|
|
@@ -3309,10 +3329,12 @@ async function handleFeishuMessage(params) {
|
|
|
3309
3329
|
if (turnAdoptionLifecycle) throw err;
|
|
3310
3330
|
}
|
|
3311
3331
|
}
|
|
3312
|
-
|
|
3332
|
+
//#endregion
|
|
3333
|
+
//#region extensions/feishu/src/card-action-state.ts
|
|
3313
3334
|
const processedCardActions = /* @__PURE__ */ new Map();
|
|
3314
3335
|
const resolvedCardActionChatTypes = /* @__PURE__ */ new Map();
|
|
3315
|
-
|
|
3336
|
+
//#endregion
|
|
3337
|
+
//#region extensions/feishu/src/card-ux-shared.ts
|
|
3316
3338
|
function buildFeishuActionCard(params) {
|
|
3317
3339
|
return {
|
|
3318
3340
|
schema: "2.0",
|
|
@@ -3360,7 +3382,8 @@ function buildFeishuCardInteractionContext(params) {
|
|
|
3360
3382
|
...params.chatType ? { t: params.chatType } : {}
|
|
3361
3383
|
};
|
|
3362
3384
|
}
|
|
3363
|
-
|
|
3385
|
+
//#endregion
|
|
3386
|
+
//#region extensions/feishu/src/card-ux-approval.ts
|
|
3364
3387
|
const FEISHU_APPROVAL_REQUEST_ACTION = "feishu.quick_actions.request_approval";
|
|
3365
3388
|
const FEISHU_APPROVAL_CONFIRM_ACTION = "feishu.approval.confirm";
|
|
3366
3389
|
const FEISHU_APPROVAL_CANCEL_ACTION = "feishu.approval.cancel";
|
|
@@ -3389,7 +3412,8 @@ function createApprovalCard(params) {
|
|
|
3389
3412
|
})]
|
|
3390
3413
|
});
|
|
3391
3414
|
}
|
|
3392
|
-
|
|
3415
|
+
//#endregion
|
|
3416
|
+
//#region extensions/feishu/src/card-action.ts
|
|
3393
3417
|
const FEISHU_APPROVAL_CARD_TTL_MS = 3e5;
|
|
3394
3418
|
const FEISHU_CARD_ACTION_TOKEN_TTL_MS = 9e5;
|
|
3395
3419
|
function pruneExpiredCardEntries(cache, now) {
|
|
@@ -3461,6 +3485,15 @@ async function dispatchSyntheticCommand(params) {
|
|
|
3461
3485
|
chatType: params.chatType,
|
|
3462
3486
|
log: params.runtime?.log ?? console.log
|
|
3463
3487
|
});
|
|
3488
|
+
if (!resolvedChatType) {
|
|
3489
|
+
await sendMessageFeishu({
|
|
3490
|
+
cfg: params.cfg,
|
|
3491
|
+
to: resolveCallbackTarget(params.event),
|
|
3492
|
+
text: "⚠️ Could not verify this chat's conversation type, so this action was not run. Try clicking again later.",
|
|
3493
|
+
accountId: params.account.accountId
|
|
3494
|
+
});
|
|
3495
|
+
return;
|
|
3496
|
+
}
|
|
3464
3497
|
await handleFeishuMessage({
|
|
3465
3498
|
trackTask: params.trackTask,
|
|
3466
3499
|
cfg: params.cfg,
|
|
@@ -3473,9 +3506,6 @@ async function dispatchSyntheticCommand(params) {
|
|
|
3473
3506
|
}
|
|
3474
3507
|
const CHAT_TYPE_CACHE_TTL_MS = 18e5;
|
|
3475
3508
|
const CHAT_TYPE_CACHE_MAX_SIZE = 5e3;
|
|
3476
|
-
function sanitizeLogValue(v) {
|
|
3477
|
-
return truncateUtf16Safe(v.replace(/[\r\n]/g, " "), 500);
|
|
3478
|
-
}
|
|
3479
3509
|
function cacheResolvedCardActionChatType(cacheKey, value, now) {
|
|
3480
3510
|
const expiresAt = resolveExpiresAtMsFromDurationMs(CHAT_TYPE_CACHE_TTL_MS, { nowMs: now });
|
|
3481
3511
|
resolvedCardActionChatTypes.delete(cacheKey);
|
|
@@ -3503,13 +3533,11 @@ async function resolveCardActionChatType(params) {
|
|
|
3503
3533
|
cacheResolvedCardActionChatType(cacheKey, resolvedChatType, now);
|
|
3504
3534
|
return resolvedChatType;
|
|
3505
3535
|
}
|
|
3506
|
-
params.log(`feishu[${params.account.accountId}]: card action
|
|
3507
|
-
} else params.log(`feishu[${params.account.accountId}]:
|
|
3508
|
-
} catch
|
|
3509
|
-
|
|
3510
|
-
params.log(`feishu[${params.account.accountId}]: failed to resolve chat type: ${sanitizeLogValue(message)}; defaulting to p2p`);
|
|
3536
|
+
params.log(`feishu[${params.account.accountId}]: card action chat type unavailable; action refused`);
|
|
3537
|
+
} else params.log(`feishu[${params.account.accountId}]: card action chat type unavailable; action refused`);
|
|
3538
|
+
} catch {
|
|
3539
|
+
params.log(`feishu[${params.account.accountId}]: card action chat type unavailable; action refused`);
|
|
3511
3540
|
}
|
|
3512
|
-
return "p2p";
|
|
3513
3541
|
}
|
|
3514
3542
|
async function handleFeishuCardAction(params) {
|
|
3515
3543
|
const { cfg, event, runtime, accountId } = params;
|
|
@@ -3560,6 +3588,21 @@ async function handleFeishuCardAction(params) {
|
|
|
3560
3588
|
await sendInvalidInteractionNotice("malformed");
|
|
3561
3589
|
return;
|
|
3562
3590
|
}
|
|
3591
|
+
const chatType = await resolveCardActionChatType({
|
|
3592
|
+
event,
|
|
3593
|
+
account,
|
|
3594
|
+
chatType: envelope.c?.t,
|
|
3595
|
+
log
|
|
3596
|
+
});
|
|
3597
|
+
if (!chatType) {
|
|
3598
|
+
await sendMessageFeishu({
|
|
3599
|
+
cfg,
|
|
3600
|
+
to: resolveCallbackTarget(event),
|
|
3601
|
+
text: "⚠️ Could not verify this chat's conversation type, so this action was not run. Try clicking again later.",
|
|
3602
|
+
accountId
|
|
3603
|
+
});
|
|
3604
|
+
return;
|
|
3605
|
+
}
|
|
3563
3606
|
await sendCardFeishu({
|
|
3564
3607
|
cfg,
|
|
3565
3608
|
to: resolveCallbackTarget(event),
|
|
@@ -3570,12 +3613,7 @@ async function handleFeishuCardAction(params) {
|
|
|
3570
3613
|
prompt,
|
|
3571
3614
|
sessionKey: envelope.c?.s,
|
|
3572
3615
|
expiresAt,
|
|
3573
|
-
chatType
|
|
3574
|
-
event,
|
|
3575
|
-
account,
|
|
3576
|
-
chatType: envelope.c?.t,
|
|
3577
|
-
log
|
|
3578
|
-
}),
|
|
3616
|
+
chatType,
|
|
3579
3617
|
confirmLabel: command === "/reset" ? "Reset" : "Confirm"
|
|
3580
3618
|
}),
|
|
3581
3619
|
accountId
|
|
@@ -3619,7 +3657,8 @@ async function handleFeishuCardAction(params) {
|
|
|
3619
3657
|
refreshFeishuCardActionToken(event.token, account.accountId);
|
|
3620
3658
|
}
|
|
3621
3659
|
}
|
|
3622
|
-
|
|
3660
|
+
//#endregion
|
|
3661
|
+
//#region extensions/feishu/src/feishu-ingress.ts
|
|
3623
3662
|
const FEISHU_INGRESS_PAYLOAD_VERSION = 1;
|
|
3624
3663
|
const FEISHU_INGRESS_POLL_INTERVAL_MS = 500;
|
|
3625
3664
|
const FEISHU_DURABLE_EVENT_TYPES = /* @__PURE__ */ new Set(["drive.notice.comment_add_v1", "im.message.receive_v1"]);
|
|
@@ -3894,7 +3933,8 @@ function createFeishuDurableIngress(options) {
|
|
|
3894
3933
|
waitForIdle: monitor.waitForIdle
|
|
3895
3934
|
};
|
|
3896
3935
|
}
|
|
3897
|
-
|
|
3936
|
+
//#endregion
|
|
3937
|
+
//#region extensions/feishu/src/monitor.state.ts
|
|
3898
3938
|
const wsClients = /* @__PURE__ */ new Map();
|
|
3899
3939
|
const botOpenIds = /* @__PURE__ */ new Map();
|
|
3900
3940
|
const botIdentityRevisions = /* @__PURE__ */ new Map();
|
|
@@ -3925,7 +3965,8 @@ function recordWebhookStatus(runtime, accountId, path, statusCode) {
|
|
|
3925
3965
|
message: (count) => `${label}: webhook anomaly path=${path} status=${statusCode} count=${count}`
|
|
3926
3966
|
});
|
|
3927
3967
|
}
|
|
3928
|
-
|
|
3968
|
+
//#endregion
|
|
3969
|
+
//#region extensions/feishu/src/monitor.bot-identity.ts
|
|
3929
3970
|
const BOT_IDENTITY_RETRY_DELAYS_MS = [
|
|
3930
3971
|
6e4,
|
|
3931
3972
|
12e4,
|
|
@@ -3967,7 +4008,8 @@ function startBotIdentityRecovery(params) {
|
|
|
3967
4008
|
(runtime?.error ?? console.error)(`feishu[${accountId}]: bot identity background retry failed unexpectedly: ${String(err)}`);
|
|
3968
4009
|
});
|
|
3969
4010
|
}
|
|
3970
|
-
|
|
4011
|
+
//#endregion
|
|
4012
|
+
//#region extensions/feishu/src/card-ux-launcher.ts
|
|
3971
4013
|
const FEISHU_QUICK_ACTION_CARD_TTL_MS = 6e5;
|
|
3972
4014
|
const QUICK_ACTION_MENU_KEYS = /* @__PURE__ */ new Set([
|
|
3973
4015
|
"quick-actions",
|
|
@@ -4040,7 +4082,8 @@ async function maybeHandleFeishuQuickActionMenu(params) {
|
|
|
4040
4082
|
params.runtime?.log?.(`feishu[${params.accountId ?? "default"}]: opened quick-action launcher for ${params.operatorOpenId}`);
|
|
4041
4083
|
return true;
|
|
4042
4084
|
}
|
|
4043
|
-
|
|
4085
|
+
//#endregion
|
|
4086
|
+
//#region extensions/feishu/src/monitor.synthetic-error.ts
|
|
4044
4087
|
var FeishuRetryableSyntheticEventError = class extends Error {
|
|
4045
4088
|
constructor(message, options) {
|
|
4046
4089
|
super(message, options);
|
|
@@ -4050,7 +4093,8 @@ var FeishuRetryableSyntheticEventError = class extends Error {
|
|
|
4050
4093
|
function isFeishuRetryableSyntheticEventError(error) {
|
|
4051
4094
|
return error instanceof FeishuRetryableSyntheticEventError || typeof error === "object" && error !== null && "name" in error && error.name === "FeishuRetryableSyntheticEventError";
|
|
4052
4095
|
}
|
|
4053
|
-
|
|
4096
|
+
//#endregion
|
|
4097
|
+
//#region extensions/feishu/src/monitor.bot-menu-handler.ts
|
|
4054
4098
|
function createFeishuBotMenuHandler(params) {
|
|
4055
4099
|
const { cfg, accountId, runtime, chatHistories, fireAndForget } = params;
|
|
4056
4100
|
const log = runtime?.log ?? console.log;
|
|
@@ -4153,7 +4197,8 @@ function createFeishuBotMenuHandler(params) {
|
|
|
4153
4197
|
return task;
|
|
4154
4198
|
};
|
|
4155
4199
|
}
|
|
4156
|
-
|
|
4200
|
+
//#endregion
|
|
4201
|
+
//#region extensions/feishu/src/comment-dispatcher.ts
|
|
4157
4202
|
function createFeishuCommentReplyDispatcher(params) {
|
|
4158
4203
|
const core = getFeishuRuntime();
|
|
4159
4204
|
const prefixContext = createReplyPrefixContext({
|
|
@@ -4231,7 +4276,8 @@ function createFeishuCommentReplyDispatcher(params) {
|
|
|
4231
4276
|
cleanupTypingReaction: typingReaction.cleanup
|
|
4232
4277
|
};
|
|
4233
4278
|
}
|
|
4234
|
-
|
|
4279
|
+
//#endregion
|
|
4280
|
+
//#region extensions/feishu/src/monitor.comment.ts
|
|
4235
4281
|
const FEISHU_COMMENT_VERIFY_TIMEOUT_MS = 3e3;
|
|
4236
4282
|
const FEISHU_COMMENT_PAGE_SIZE = 100;
|
|
4237
4283
|
const FEISHU_COMMENT_PAGE_LIMIT = 5;
|
|
@@ -4659,7 +4705,7 @@ async function resolveDriveCommentEventTurn(params) {
|
|
|
4659
4705
|
return null;
|
|
4660
4706
|
}
|
|
4661
4707
|
const context = await fetchDriveCommentContext({
|
|
4662
|
-
client: createClient ? createClient(account ?? { accountId }) : createFeishuClient((await import("./doctor-contract-
|
|
4708
|
+
client: createClient ? createClient(account ?? { accountId }) : createFeishuClient((await import("./doctor-contract-BNXcJcWR.mjs").then((n) => n.l)).resolveFeishuAccount({
|
|
4663
4709
|
cfg,
|
|
4664
4710
|
accountId
|
|
4665
4711
|
})),
|
|
@@ -4728,7 +4774,8 @@ function parseFeishuDriveCommentNoticeEventPayload(value) {
|
|
|
4728
4774
|
type: readStringValue(value.type)
|
|
4729
4775
|
};
|
|
4730
4776
|
}
|
|
4731
|
-
|
|
4777
|
+
//#endregion
|
|
4778
|
+
//#region extensions/feishu/src/comment-handler.ts
|
|
4732
4779
|
function parseTimestampMs(value) {
|
|
4733
4780
|
return parseStrictNonNegativeInteger(value) ?? Date.now();
|
|
4734
4781
|
}
|
|
@@ -4975,7 +5022,8 @@ async function handleFeishuCommentEvent(params) {
|
|
|
4975
5022
|
cleanupTypingReaction();
|
|
4976
5023
|
}
|
|
4977
5024
|
}
|
|
4978
|
-
|
|
5025
|
+
//#endregion
|
|
5026
|
+
//#region extensions/feishu/src/sequential-queue.ts
|
|
4979
5027
|
const DEFAULT_TASK_TIMEOUT_MS = 3e5;
|
|
4980
5028
|
function createSequentialQueue(options = {}) {
|
|
4981
5029
|
const queues = /* @__PURE__ */ new Map();
|
|
@@ -4994,7 +5042,8 @@ function createSequentialQueue(options = {}) {
|
|
|
4994
5042
|
return next;
|
|
4995
5043
|
};
|
|
4996
5044
|
}
|
|
4997
|
-
|
|
5045
|
+
//#endregion
|
|
5046
|
+
//#region extensions/feishu/src/monitor.comment-notice-handler.ts
|
|
4998
5047
|
function buildCommentNoticeQueueKey(event) {
|
|
4999
5048
|
return `comment-doc:${event.notice_meta?.file_type?.trim() || "unknown"}:${event.notice_meta?.file_token?.trim() || "unknown"}`;
|
|
5000
5049
|
}
|
|
@@ -5045,7 +5094,8 @@ function createFeishuDriveCommentNoticeHandler(params) {
|
|
|
5045
5094
|
await settle();
|
|
5046
5095
|
};
|
|
5047
5096
|
}
|
|
5048
|
-
|
|
5097
|
+
//#endregion
|
|
5098
|
+
//#region extensions/feishu/src/monitor.message-handler.ts
|
|
5049
5099
|
function parseFeishuMessageEventPayload(value) {
|
|
5050
5100
|
if (!isRecord(value)) return null;
|
|
5051
5101
|
const sender = value.sender;
|
|
@@ -5300,7 +5350,8 @@ function createFeishuMessageReceiveHandler({ cfg, channelRuntime, accountId, run
|
|
|
5300
5350
|
if (!fireAndForget) await processing;
|
|
5301
5351
|
};
|
|
5302
5352
|
}
|
|
5303
|
-
|
|
5353
|
+
//#endregion
|
|
5354
|
+
//#region extensions/feishu/src/monitor-rate-limit-key.ts
|
|
5304
5355
|
function normalizeFeishuWebhookRateLimitClient(clientIp) {
|
|
5305
5356
|
if (!clientIp) return "unknown";
|
|
5306
5357
|
if (clientIp === "::1" || clientIp.startsWith("127.")) return "loopback";
|
|
@@ -5309,7 +5360,8 @@ function normalizeFeishuWebhookRateLimitClient(clientIp) {
|
|
|
5309
5360
|
function buildFeishuWebhookRateLimitKey(params) {
|
|
5310
5361
|
return `${params.accountId === void 0 ? params.path : `${params.accountId}:${params.path}`}:${normalizeFeishuWebhookRateLimitClient(params.clientIp)}`;
|
|
5311
5362
|
}
|
|
5312
|
-
|
|
5363
|
+
//#endregion
|
|
5364
|
+
//#region extensions/feishu/src/monitor.transport.ts
|
|
5313
5365
|
const FEISHU_WEBHOOK_ACCEPTED_HEADER = "x-openclaw-delivery-accepted";
|
|
5314
5366
|
const FEISHU_WEBHOOK_ACCEPTED_VALUE = "durable";
|
|
5315
5367
|
const FEISHU_PRE_AUTH_MAX_IN_FLIGHT = 64;
|
|
@@ -5696,7 +5748,8 @@ async function monitorWebhook(params) {
|
|
|
5696
5748
|
await cleanup();
|
|
5697
5749
|
}
|
|
5698
5750
|
}
|
|
5699
|
-
|
|
5751
|
+
//#endregion
|
|
5752
|
+
//#region extensions/feishu/src/monitor.vc-meeting-invited-handler.ts
|
|
5700
5753
|
const FEISHU_MEETING_NUMBER_PATTERN = /^\d{9}$/;
|
|
5701
5754
|
function parseInviteTimestamp(value) {
|
|
5702
5755
|
const parsed = Number.parseInt(value ?? "", 10);
|
|
@@ -5836,7 +5889,8 @@ function createFeishuVcMeetingInvitedHandler(params) {
|
|
|
5836
5889
|
return fireAndForget ? Promise.resolve() : task;
|
|
5837
5890
|
};
|
|
5838
5891
|
}
|
|
5839
|
-
|
|
5892
|
+
//#endregion
|
|
5893
|
+
//#region extensions/feishu/src/sequential-key.ts
|
|
5840
5894
|
function getFeishuSequentialKey(params) {
|
|
5841
5895
|
const { accountId, event, botOpenId, preparedContent } = params;
|
|
5842
5896
|
const baseKey = `feishu:${accountId}:${event.message.chat_id?.trim() || "unknown"}`;
|
|
@@ -5845,7 +5899,8 @@ function getFeishuSequentialKey(params) {
|
|
|
5845
5899
|
if (isBtwRequestText(text)) return `${baseKey}:btw`;
|
|
5846
5900
|
return baseKey;
|
|
5847
5901
|
}
|
|
5848
|
-
|
|
5902
|
+
//#endregion
|
|
5903
|
+
//#region extensions/feishu/src/monitor.account.ts
|
|
5849
5904
|
const FEISHU_REACTION_VERIFY_TIMEOUT_MS = 1500;
|
|
5850
5905
|
async function resolveReactionSyntheticEvent(params) {
|
|
5851
5906
|
const { cfg, accountId, event, botOpenId, fetchMessage = getMessageFeishu, verificationTimeoutMs = FEISHU_REACTION_VERIFY_TIMEOUT_MS, logger, uuid = () => crypto$1.randomUUID(), action = "created" } = params;
|
|
@@ -5855,7 +5910,7 @@ async function resolveReactionSyntheticEvent(params) {
|
|
|
5855
5910
|
const senderUserId = event.user_id?.user_id?.trim();
|
|
5856
5911
|
const senderId = senderOpenId || senderUserId;
|
|
5857
5912
|
if (!emoji || !messageId || !senderId) return null;
|
|
5858
|
-
const { resolveFeishuAccount } = await import("./doctor-contract-
|
|
5913
|
+
const { resolveFeishuAccount } = await import("./doctor-contract-BNXcJcWR.mjs").then((n) => n.l);
|
|
5859
5914
|
const reactionNotifications = resolveFeishuAccount({
|
|
5860
5915
|
cfg,
|
|
5861
5916
|
accountId
|
|
@@ -6143,4 +6198,5 @@ async function monitorSingleAccount(params) {
|
|
|
6143
6198
|
threadBindingManager?.stop();
|
|
6144
6199
|
}
|
|
6145
6200
|
}
|
|
6201
|
+
//#endregion
|
|
6146
6202
|
export { FeishuRetryableSyntheticEventError, monitorSingleAccount, resolveReactionSyntheticEvent };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { _ as __exportAll } from "./doctor-contract-
|
|
2
|
-
import { r as createFeishuClient } from "./client-
|
|
1
|
+
import { _ as __exportAll } from "./doctor-contract-BNXcJcWR.mjs";
|
|
2
|
+
import { r as createFeishuClient } from "./client-BTiFlqqL.mjs";
|
|
3
3
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
4
4
|
import { isFutureDateTimestampMs, resolveExpiresAtMsFromDurationMs, resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
|
|
5
5
|
import { sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
|
|
6
6
|
import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
|
|
7
7
|
import { createHash } from "node:crypto";
|
|
8
8
|
import { racePromiseWithAbortSignal, raceWithTimeout } from "openclaw/plugin-sdk/time-runtime";
|
|
9
|
-
|
|
9
|
+
//#region extensions/feishu/src/async.ts
|
|
10
10
|
const RACE_TIMEOUT = Symbol("race-timeout");
|
|
11
11
|
const RACE_ABORT = Symbol("race-abort");
|
|
12
12
|
async function raceWithTimeoutAndAbort(promise, options = {}) {
|
|
@@ -38,7 +38,8 @@ function waitForAbortableDelay(delayMs, abortSignal) {
|
|
|
38
38
|
throw error;
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region extensions/feishu/src/probe.ts
|
|
42
43
|
var probe_exports = /* @__PURE__ */ __exportAll({
|
|
43
44
|
probeFeishu: () => probeFeishu,
|
|
44
45
|
registerFeishuAiAgent: () => registerFeishuAiAgent
|
|
@@ -174,4 +175,5 @@ async function registerFeishuAiAgent(creds, options = {}) {
|
|
|
174
175
|
};
|
|
175
176
|
}
|
|
176
177
|
}
|
|
178
|
+
//#endregion
|
|
177
179
|
export { waitForAbortableDelay as a, raceWithTimeoutAndAbort as i, probe_exports as n, registerFeishuAiAgent as r, probeFeishu as t };
|