@openclaw/feishu 2026.10.10 → 2026.11.2
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-dxkUGCgC.mjs → channel-D60cZ_Y_.mjs} +53 -34
- package/dist/.setup/{channel.runtime-DK9nv7tQ.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-BJ0-Wu8d.mjs → monitor-BcnMie82.mjs} +12 -8
- package/dist/.setup/{monitor.account-DIvDEG0X.mjs → monitor.account-C_u1fZ5g.mjs} +143 -98
- 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-qH0YRx2x.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) {
|
|
@@ -999,18 +1013,6 @@ function truncateSummary(text, max = 50) {
|
|
|
999
1013
|
function shouldPushStreamingUpdate(previousText, nextText) {
|
|
1000
1014
|
return !previousText || /[\n。!?!?;;::]$/.test(nextText) || nextText.length - previousText.length >= STREAMING_SIGNIFICANT_DELTA_CHARS;
|
|
1001
1015
|
}
|
|
1002
|
-
/** Merges cumulative or overlapping streaming snapshots without duplicating content. */
|
|
1003
|
-
function mergeStreamingText(previousText, nextText) {
|
|
1004
|
-
const previous = typeof previousText === "string" ? previousText : "";
|
|
1005
|
-
const next = typeof nextText === "string" ? nextText : "";
|
|
1006
|
-
if (!next) return previous;
|
|
1007
|
-
if (!previous || next === previous) return next;
|
|
1008
|
-
if (next.includes(previous)) return next;
|
|
1009
|
-
if (previous.includes(next)) return previous;
|
|
1010
|
-
const maxOverlap = Math.min(previous.length, next.length);
|
|
1011
|
-
for (let overlap = maxOverlap; overlap > 0; overlap -= 1) if (previous.slice(-overlap) === next.slice(0, overlap)) return `${previous}${next.slice(overlap)}`;
|
|
1012
|
-
return `${previous}${next}`;
|
|
1013
|
-
}
|
|
1014
1016
|
var FeishuStreamingSession = class {
|
|
1015
1017
|
constructor(client, creds, log) {
|
|
1016
1018
|
this.state = null;
|
|
@@ -1271,7 +1273,8 @@ var FeishuStreamingSession = class {
|
|
|
1271
1273
|
return this.state !== null && !this.closed;
|
|
1272
1274
|
}
|
|
1273
1275
|
};
|
|
1274
|
-
|
|
1276
|
+
//#endregion
|
|
1277
|
+
//#region extensions/feishu/src/streaming-update.ts
|
|
1275
1278
|
/** Admit captured snapshots in order while the session owns provider writes. */
|
|
1276
1279
|
function queueFeishuStreamingUpdate(params) {
|
|
1277
1280
|
const { queue, session, startPromise, text, accountId, runtime } = params;
|
|
@@ -1280,7 +1283,8 @@ function queueFeishuStreamingUpdate(params) {
|
|
|
1280
1283
|
if (session?.isActive()) session.update(text).catch((error) => runtime.error?.(`feishu[${accountId}] streaming update failed: ${String(error)}`));
|
|
1281
1284
|
});
|
|
1282
1285
|
}
|
|
1283
|
-
|
|
1286
|
+
//#endregion
|
|
1287
|
+
//#region extensions/feishu/src/typing-backoff.ts
|
|
1284
1288
|
/** Feishu API codes that should trip the typing circuit breaker. */
|
|
1285
1289
|
const FEISHU_BACKOFF_CODES = /* @__PURE__ */ new Set([
|
|
1286
1290
|
99991400,
|
|
@@ -1308,7 +1312,8 @@ function getBackoffCodeFromResponse(response) {
|
|
|
1308
1312
|
const code = response.code;
|
|
1309
1313
|
return typeof code === "number" && FEISHU_BACKOFF_CODES.has(code) ? code : void 0;
|
|
1310
1314
|
}
|
|
1311
|
-
|
|
1315
|
+
//#endregion
|
|
1316
|
+
//#region extensions/feishu/src/typing.ts
|
|
1312
1317
|
const TYPING_EMOJI = "Typing";
|
|
1313
1318
|
async function requestTypingReaction(request, operation, readResponse, runtime) {
|
|
1314
1319
|
const indicator = `typing indicator${operation === "remove" ? " removal" : ""}`;
|
|
@@ -1376,7 +1381,8 @@ async function removeTypingIndicator(params) {
|
|
|
1376
1381
|
reaction_id: state.reactionId
|
|
1377
1382
|
} }), "remove", () => void 0, runtime);
|
|
1378
1383
|
}
|
|
1379
|
-
|
|
1384
|
+
//#endregion
|
|
1385
|
+
//#region extensions/feishu/src/reply-dispatcher.ts
|
|
1380
1386
|
function mergeStreamingFinalText(previousText, nextText, appendError) {
|
|
1381
1387
|
if (!appendError || !previousText || nextText.startsWith(previousText)) return nextText;
|
|
1382
1388
|
if (previousText.endsWith(`\n\n${nextText}`)) return previousText;
|
|
@@ -1499,7 +1505,6 @@ function createFeishuReplyDispatcher(params) {
|
|
|
1499
1505
|
let reasoningText = "";
|
|
1500
1506
|
let statusLine = "";
|
|
1501
1507
|
let snapshotBaseText = "";
|
|
1502
|
-
let lastSnapshotTextLength = 0;
|
|
1503
1508
|
let hasStreamingFinalText = false;
|
|
1504
1509
|
const deliveredFinalTexts = /* @__PURE__ */ new Set();
|
|
1505
1510
|
let lastStreamingSettlement;
|
|
@@ -1537,14 +1542,7 @@ function createFeishuReplyDispatcher(params) {
|
|
|
1537
1542
|
if (options?.dedupeWithLastPartial && nextText === lastPartial) return;
|
|
1538
1543
|
if (options?.dedupeWithLastPartial) lastPartial = nextText;
|
|
1539
1544
|
if ((options?.mode ?? "snapshot") === "delta") streamText = `${streamText}${nextText}`;
|
|
1540
|
-
else {
|
|
1541
|
-
const currentSnapshotText = snapshotBaseText ? streamText.slice(snapshotBaseText.length) : streamText;
|
|
1542
|
-
if (lastSnapshotTextLength >= 20 && nextText.length < lastSnapshotTextLength * .5 && !currentSnapshotText.includes(nextText)) {
|
|
1543
|
-
snapshotBaseText = streamText;
|
|
1544
|
-
streamText = `${snapshotBaseText}${nextText}`;
|
|
1545
|
-
} else streamText = `${snapshotBaseText}${mergeStreamingText(currentSnapshotText, nextText)}`;
|
|
1546
|
-
lastSnapshotTextLength = nextText.length;
|
|
1547
|
-
}
|
|
1545
|
+
else streamText = `${snapshotBaseText}${nextText}`;
|
|
1548
1546
|
flushStreamingCardUpdate(buildCombinedStreamText(reasoningText, streamText));
|
|
1549
1547
|
};
|
|
1550
1548
|
const startStreaming = () => {
|
|
@@ -1590,7 +1588,6 @@ function createFeishuReplyDispatcher(params) {
|
|
|
1590
1588
|
reasoningText = "";
|
|
1591
1589
|
statusLine = "";
|
|
1592
1590
|
snapshotBaseText = "";
|
|
1593
|
-
lastSnapshotTextLength = 0;
|
|
1594
1591
|
hasStreamingFinalText = false;
|
|
1595
1592
|
};
|
|
1596
1593
|
const performStreamingClose = async (disposition) => {
|
|
@@ -2003,7 +2000,7 @@ function createFeishuReplyDispatcher(params) {
|
|
|
2003
2000
|
...payload,
|
|
2004
2001
|
text: payloadText
|
|
2005
2002
|
});
|
|
2006
|
-
const text = info?.kind === "final" && !hasIndependentPresentation ? mergeStreamingFinalText(streamText, reply.text
|
|
2003
|
+
const text = info?.kind === "final" && !hasIndependentPresentation ? mergeStreamingFinalText(streamText, payload.isError ? reply.text : `${snapshotBaseText}${reply.text}`, payload.isError === true && hasStreamingFinalText) : reply.text;
|
|
2007
2004
|
const hasText = reply.hasText;
|
|
2008
2005
|
const hasMedia = reply.hasMedia;
|
|
2009
2006
|
const ttsSupplement = getReplyPayloadTtsSupplement(payload);
|
|
@@ -2080,8 +2077,6 @@ function createFeishuReplyDispatcher(params) {
|
|
|
2080
2077
|
if (info?.kind === "final") {
|
|
2081
2078
|
streamText = text;
|
|
2082
2079
|
hasStreamingFinalText = true;
|
|
2083
|
-
snapshotBaseText = "";
|
|
2084
|
-
lastSnapshotTextLength = text.length;
|
|
2085
2080
|
flushStreamingCardUpdate(buildCombinedStreamText(reasoningText, streamText));
|
|
2086
2081
|
}
|
|
2087
2082
|
}
|
|
@@ -2117,6 +2112,7 @@ function createFeishuReplyDispatcher(params) {
|
|
|
2117
2112
|
replyOptions: {
|
|
2118
2113
|
onModelSelected,
|
|
2119
2114
|
disableBlockStreaming: !coreBlockStreamingEnabled,
|
|
2115
|
+
preserveProgressCallbackStartOrder: previewStreamingEnabled ? true : void 0,
|
|
2120
2116
|
onPartialReply: previewStreamingEnabled ? (payload) => {
|
|
2121
2117
|
if (!payload.text) return false;
|
|
2122
2118
|
const cleaned = stripReasoningTagsFromText(payload.text, {
|
|
@@ -2153,14 +2149,19 @@ function createFeishuReplyDispatcher(params) {
|
|
|
2153
2149
|
if (statusLineLocal) return updateStreamingStatusLine(statusLineLocal);
|
|
2154
2150
|
return false;
|
|
2155
2151
|
} : void 0,
|
|
2156
|
-
onAssistantMessageStart: previewStreamingEnabled ? () =>
|
|
2152
|
+
onAssistantMessageStart: previewStreamingEnabled ? () => {
|
|
2153
|
+
snapshotBaseText = streamText ? `${streamText}\n\n` : "";
|
|
2154
|
+
lastPartial = "";
|
|
2155
|
+
return updateStreamingStatusLine("", false);
|
|
2156
|
+
} : void 0,
|
|
2157
2157
|
onCompactionStart: previewStreamingEnabled ? () => updateStreamingStatusLine("📦 **Compacting context...**") : void 0,
|
|
2158
2158
|
onCompactionEnd: previewStreamingEnabled ? () => updateStreamingStatusLine("") : void 0
|
|
2159
2159
|
},
|
|
2160
2160
|
ensureNoVisibleReplyFallback
|
|
2161
2161
|
};
|
|
2162
2162
|
}
|
|
2163
|
-
|
|
2163
|
+
//#endregion
|
|
2164
|
+
//#region extensions/feishu/src/synthetic-event-target.ts
|
|
2164
2165
|
const directPreDispatchTargets = /* @__PURE__ */ new WeakMap();
|
|
2165
2166
|
/** Keep synthetic-only routing metadata outside the public Feishu event shape. */
|
|
2166
2167
|
function setFeishuSyntheticDirectPreDispatchTarget(event, target) {
|
|
@@ -2170,7 +2171,8 @@ function setFeishuSyntheticDirectPreDispatchTarget(event, target) {
|
|
|
2170
2171
|
function getFeishuSyntheticDirectPreDispatchTarget(event) {
|
|
2171
2172
|
return directPreDispatchTargets.get(event);
|
|
2172
2173
|
}
|
|
2173
|
-
|
|
2174
|
+
//#endregion
|
|
2175
|
+
//#region extensions/feishu/src/bot.ts
|
|
2174
2176
|
const permissionErrorNotifiedAt = /* @__PURE__ */ new Map();
|
|
2175
2177
|
const PERMISSION_ERROR_COOLDOWN_MS = 3e5;
|
|
2176
2178
|
function isFeishuTopicSessionScope(scope) {
|
|
@@ -3327,10 +3329,12 @@ async function handleFeishuMessage(params) {
|
|
|
3327
3329
|
if (turnAdoptionLifecycle) throw err;
|
|
3328
3330
|
}
|
|
3329
3331
|
}
|
|
3330
|
-
|
|
3332
|
+
//#endregion
|
|
3333
|
+
//#region extensions/feishu/src/card-action-state.ts
|
|
3331
3334
|
const processedCardActions = /* @__PURE__ */ new Map();
|
|
3332
3335
|
const resolvedCardActionChatTypes = /* @__PURE__ */ new Map();
|
|
3333
|
-
|
|
3336
|
+
//#endregion
|
|
3337
|
+
//#region extensions/feishu/src/card-ux-shared.ts
|
|
3334
3338
|
function buildFeishuActionCard(params) {
|
|
3335
3339
|
return {
|
|
3336
3340
|
schema: "2.0",
|
|
@@ -3346,8 +3350,15 @@ function buildFeishuActionCard(params) {
|
|
|
3346
3350
|
tag: "markdown",
|
|
3347
3351
|
content: params.content
|
|
3348
3352
|
}, {
|
|
3349
|
-
tag: "
|
|
3350
|
-
|
|
3353
|
+
tag: "column_set",
|
|
3354
|
+
flex_mode: "none",
|
|
3355
|
+
horizontal_spacing: "default",
|
|
3356
|
+
columns: params.actions.map((button) => ({
|
|
3357
|
+
tag: "column",
|
|
3358
|
+
width: "auto",
|
|
3359
|
+
vertical_align: "center",
|
|
3360
|
+
elements: [button]
|
|
3361
|
+
}))
|
|
3351
3362
|
}] }
|
|
3352
3363
|
};
|
|
3353
3364
|
}
|
|
@@ -3371,7 +3382,8 @@ function buildFeishuCardInteractionContext(params) {
|
|
|
3371
3382
|
...params.chatType ? { t: params.chatType } : {}
|
|
3372
3383
|
};
|
|
3373
3384
|
}
|
|
3374
|
-
|
|
3385
|
+
//#endregion
|
|
3386
|
+
//#region extensions/feishu/src/card-ux-approval.ts
|
|
3375
3387
|
const FEISHU_APPROVAL_REQUEST_ACTION = "feishu.quick_actions.request_approval";
|
|
3376
3388
|
const FEISHU_APPROVAL_CONFIRM_ACTION = "feishu.approval.confirm";
|
|
3377
3389
|
const FEISHU_APPROVAL_CANCEL_ACTION = "feishu.approval.cancel";
|
|
@@ -3400,7 +3412,8 @@ function createApprovalCard(params) {
|
|
|
3400
3412
|
})]
|
|
3401
3413
|
});
|
|
3402
3414
|
}
|
|
3403
|
-
|
|
3415
|
+
//#endregion
|
|
3416
|
+
//#region extensions/feishu/src/card-action.ts
|
|
3404
3417
|
const FEISHU_APPROVAL_CARD_TTL_MS = 3e5;
|
|
3405
3418
|
const FEISHU_CARD_ACTION_TOKEN_TTL_MS = 9e5;
|
|
3406
3419
|
function pruneExpiredCardEntries(cache, now) {
|
|
@@ -3472,6 +3485,15 @@ async function dispatchSyntheticCommand(params) {
|
|
|
3472
3485
|
chatType: params.chatType,
|
|
3473
3486
|
log: params.runtime?.log ?? console.log
|
|
3474
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
|
+
}
|
|
3475
3497
|
await handleFeishuMessage({
|
|
3476
3498
|
trackTask: params.trackTask,
|
|
3477
3499
|
cfg: params.cfg,
|
|
@@ -3484,9 +3506,6 @@ async function dispatchSyntheticCommand(params) {
|
|
|
3484
3506
|
}
|
|
3485
3507
|
const CHAT_TYPE_CACHE_TTL_MS = 18e5;
|
|
3486
3508
|
const CHAT_TYPE_CACHE_MAX_SIZE = 5e3;
|
|
3487
|
-
function sanitizeLogValue(v) {
|
|
3488
|
-
return truncateUtf16Safe(v.replace(/[\r\n]/g, " "), 500);
|
|
3489
|
-
}
|
|
3490
3509
|
function cacheResolvedCardActionChatType(cacheKey, value, now) {
|
|
3491
3510
|
const expiresAt = resolveExpiresAtMsFromDurationMs(CHAT_TYPE_CACHE_TTL_MS, { nowMs: now });
|
|
3492
3511
|
resolvedCardActionChatTypes.delete(cacheKey);
|
|
@@ -3514,13 +3533,11 @@ async function resolveCardActionChatType(params) {
|
|
|
3514
3533
|
cacheResolvedCardActionChatType(cacheKey, resolvedChatType, now);
|
|
3515
3534
|
return resolvedChatType;
|
|
3516
3535
|
}
|
|
3517
|
-
params.log(`feishu[${params.account.accountId}]: card action
|
|
3518
|
-
} else params.log(`feishu[${params.account.accountId}]:
|
|
3519
|
-
} catch
|
|
3520
|
-
|
|
3521
|
-
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`);
|
|
3522
3540
|
}
|
|
3523
|
-
return "p2p";
|
|
3524
3541
|
}
|
|
3525
3542
|
async function handleFeishuCardAction(params) {
|
|
3526
3543
|
const { cfg, event, runtime, accountId } = params;
|
|
@@ -3571,6 +3588,21 @@ async function handleFeishuCardAction(params) {
|
|
|
3571
3588
|
await sendInvalidInteractionNotice("malformed");
|
|
3572
3589
|
return;
|
|
3573
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
|
+
}
|
|
3574
3606
|
await sendCardFeishu({
|
|
3575
3607
|
cfg,
|
|
3576
3608
|
to: resolveCallbackTarget(event),
|
|
@@ -3581,12 +3613,7 @@ async function handleFeishuCardAction(params) {
|
|
|
3581
3613
|
prompt,
|
|
3582
3614
|
sessionKey: envelope.c?.s,
|
|
3583
3615
|
expiresAt,
|
|
3584
|
-
chatType
|
|
3585
|
-
event,
|
|
3586
|
-
account,
|
|
3587
|
-
chatType: envelope.c?.t,
|
|
3588
|
-
log
|
|
3589
|
-
}),
|
|
3616
|
+
chatType,
|
|
3590
3617
|
confirmLabel: command === "/reset" ? "Reset" : "Confirm"
|
|
3591
3618
|
}),
|
|
3592
3619
|
accountId
|
|
@@ -3630,7 +3657,8 @@ async function handleFeishuCardAction(params) {
|
|
|
3630
3657
|
refreshFeishuCardActionToken(event.token, account.accountId);
|
|
3631
3658
|
}
|
|
3632
3659
|
}
|
|
3633
|
-
|
|
3660
|
+
//#endregion
|
|
3661
|
+
//#region extensions/feishu/src/feishu-ingress.ts
|
|
3634
3662
|
const FEISHU_INGRESS_PAYLOAD_VERSION = 1;
|
|
3635
3663
|
const FEISHU_INGRESS_POLL_INTERVAL_MS = 500;
|
|
3636
3664
|
const FEISHU_DURABLE_EVENT_TYPES = /* @__PURE__ */ new Set(["drive.notice.comment_add_v1", "im.message.receive_v1"]);
|
|
@@ -3905,7 +3933,8 @@ function createFeishuDurableIngress(options) {
|
|
|
3905
3933
|
waitForIdle: monitor.waitForIdle
|
|
3906
3934
|
};
|
|
3907
3935
|
}
|
|
3908
|
-
|
|
3936
|
+
//#endregion
|
|
3937
|
+
//#region extensions/feishu/src/monitor.state.ts
|
|
3909
3938
|
const wsClients = /* @__PURE__ */ new Map();
|
|
3910
3939
|
const botOpenIds = /* @__PURE__ */ new Map();
|
|
3911
3940
|
const botIdentityRevisions = /* @__PURE__ */ new Map();
|
|
@@ -3936,7 +3965,8 @@ function recordWebhookStatus(runtime, accountId, path, statusCode) {
|
|
|
3936
3965
|
message: (count) => `${label}: webhook anomaly path=${path} status=${statusCode} count=${count}`
|
|
3937
3966
|
});
|
|
3938
3967
|
}
|
|
3939
|
-
|
|
3968
|
+
//#endregion
|
|
3969
|
+
//#region extensions/feishu/src/monitor.bot-identity.ts
|
|
3940
3970
|
const BOT_IDENTITY_RETRY_DELAYS_MS = [
|
|
3941
3971
|
6e4,
|
|
3942
3972
|
12e4,
|
|
@@ -3978,7 +4008,8 @@ function startBotIdentityRecovery(params) {
|
|
|
3978
4008
|
(runtime?.error ?? console.error)(`feishu[${accountId}]: bot identity background retry failed unexpectedly: ${String(err)}`);
|
|
3979
4009
|
});
|
|
3980
4010
|
}
|
|
3981
|
-
|
|
4011
|
+
//#endregion
|
|
4012
|
+
//#region extensions/feishu/src/card-ux-launcher.ts
|
|
3982
4013
|
const FEISHU_QUICK_ACTION_CARD_TTL_MS = 6e5;
|
|
3983
4014
|
const QUICK_ACTION_MENU_KEYS = /* @__PURE__ */ new Set([
|
|
3984
4015
|
"quick-actions",
|
|
@@ -4051,7 +4082,8 @@ async function maybeHandleFeishuQuickActionMenu(params) {
|
|
|
4051
4082
|
params.runtime?.log?.(`feishu[${params.accountId ?? "default"}]: opened quick-action launcher for ${params.operatorOpenId}`);
|
|
4052
4083
|
return true;
|
|
4053
4084
|
}
|
|
4054
|
-
|
|
4085
|
+
//#endregion
|
|
4086
|
+
//#region extensions/feishu/src/monitor.synthetic-error.ts
|
|
4055
4087
|
var FeishuRetryableSyntheticEventError = class extends Error {
|
|
4056
4088
|
constructor(message, options) {
|
|
4057
4089
|
super(message, options);
|
|
@@ -4061,7 +4093,8 @@ var FeishuRetryableSyntheticEventError = class extends Error {
|
|
|
4061
4093
|
function isFeishuRetryableSyntheticEventError(error) {
|
|
4062
4094
|
return error instanceof FeishuRetryableSyntheticEventError || typeof error === "object" && error !== null && "name" in error && error.name === "FeishuRetryableSyntheticEventError";
|
|
4063
4095
|
}
|
|
4064
|
-
|
|
4096
|
+
//#endregion
|
|
4097
|
+
//#region extensions/feishu/src/monitor.bot-menu-handler.ts
|
|
4065
4098
|
function createFeishuBotMenuHandler(params) {
|
|
4066
4099
|
const { cfg, accountId, runtime, chatHistories, fireAndForget } = params;
|
|
4067
4100
|
const log = runtime?.log ?? console.log;
|
|
@@ -4164,7 +4197,8 @@ function createFeishuBotMenuHandler(params) {
|
|
|
4164
4197
|
return task;
|
|
4165
4198
|
};
|
|
4166
4199
|
}
|
|
4167
|
-
|
|
4200
|
+
//#endregion
|
|
4201
|
+
//#region extensions/feishu/src/comment-dispatcher.ts
|
|
4168
4202
|
function createFeishuCommentReplyDispatcher(params) {
|
|
4169
4203
|
const core = getFeishuRuntime();
|
|
4170
4204
|
const prefixContext = createReplyPrefixContext({
|
|
@@ -4242,7 +4276,8 @@ function createFeishuCommentReplyDispatcher(params) {
|
|
|
4242
4276
|
cleanupTypingReaction: typingReaction.cleanup
|
|
4243
4277
|
};
|
|
4244
4278
|
}
|
|
4245
|
-
|
|
4279
|
+
//#endregion
|
|
4280
|
+
//#region extensions/feishu/src/monitor.comment.ts
|
|
4246
4281
|
const FEISHU_COMMENT_VERIFY_TIMEOUT_MS = 3e3;
|
|
4247
4282
|
const FEISHU_COMMENT_PAGE_SIZE = 100;
|
|
4248
4283
|
const FEISHU_COMMENT_PAGE_LIMIT = 5;
|
|
@@ -4670,7 +4705,7 @@ async function resolveDriveCommentEventTurn(params) {
|
|
|
4670
4705
|
return null;
|
|
4671
4706
|
}
|
|
4672
4707
|
const context = await fetchDriveCommentContext({
|
|
4673
|
-
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({
|
|
4674
4709
|
cfg,
|
|
4675
4710
|
accountId
|
|
4676
4711
|
})),
|
|
@@ -4739,7 +4774,8 @@ function parseFeishuDriveCommentNoticeEventPayload(value) {
|
|
|
4739
4774
|
type: readStringValue(value.type)
|
|
4740
4775
|
};
|
|
4741
4776
|
}
|
|
4742
|
-
|
|
4777
|
+
//#endregion
|
|
4778
|
+
//#region extensions/feishu/src/comment-handler.ts
|
|
4743
4779
|
function parseTimestampMs(value) {
|
|
4744
4780
|
return parseStrictNonNegativeInteger(value) ?? Date.now();
|
|
4745
4781
|
}
|
|
@@ -4986,7 +5022,8 @@ async function handleFeishuCommentEvent(params) {
|
|
|
4986
5022
|
cleanupTypingReaction();
|
|
4987
5023
|
}
|
|
4988
5024
|
}
|
|
4989
|
-
|
|
5025
|
+
//#endregion
|
|
5026
|
+
//#region extensions/feishu/src/sequential-queue.ts
|
|
4990
5027
|
const DEFAULT_TASK_TIMEOUT_MS = 3e5;
|
|
4991
5028
|
function createSequentialQueue(options = {}) {
|
|
4992
5029
|
const queues = /* @__PURE__ */ new Map();
|
|
@@ -5005,7 +5042,8 @@ function createSequentialQueue(options = {}) {
|
|
|
5005
5042
|
return next;
|
|
5006
5043
|
};
|
|
5007
5044
|
}
|
|
5008
|
-
|
|
5045
|
+
//#endregion
|
|
5046
|
+
//#region extensions/feishu/src/monitor.comment-notice-handler.ts
|
|
5009
5047
|
function buildCommentNoticeQueueKey(event) {
|
|
5010
5048
|
return `comment-doc:${event.notice_meta?.file_type?.trim() || "unknown"}:${event.notice_meta?.file_token?.trim() || "unknown"}`;
|
|
5011
5049
|
}
|
|
@@ -5056,7 +5094,8 @@ function createFeishuDriveCommentNoticeHandler(params) {
|
|
|
5056
5094
|
await settle();
|
|
5057
5095
|
};
|
|
5058
5096
|
}
|
|
5059
|
-
|
|
5097
|
+
//#endregion
|
|
5098
|
+
//#region extensions/feishu/src/monitor.message-handler.ts
|
|
5060
5099
|
function parseFeishuMessageEventPayload(value) {
|
|
5061
5100
|
if (!isRecord(value)) return null;
|
|
5062
5101
|
const sender = value.sender;
|
|
@@ -5311,7 +5350,8 @@ function createFeishuMessageReceiveHandler({ cfg, channelRuntime, accountId, run
|
|
|
5311
5350
|
if (!fireAndForget) await processing;
|
|
5312
5351
|
};
|
|
5313
5352
|
}
|
|
5314
|
-
|
|
5353
|
+
//#endregion
|
|
5354
|
+
//#region extensions/feishu/src/monitor-rate-limit-key.ts
|
|
5315
5355
|
function normalizeFeishuWebhookRateLimitClient(clientIp) {
|
|
5316
5356
|
if (!clientIp) return "unknown";
|
|
5317
5357
|
if (clientIp === "::1" || clientIp.startsWith("127.")) return "loopback";
|
|
@@ -5320,7 +5360,8 @@ function normalizeFeishuWebhookRateLimitClient(clientIp) {
|
|
|
5320
5360
|
function buildFeishuWebhookRateLimitKey(params) {
|
|
5321
5361
|
return `${params.accountId === void 0 ? params.path : `${params.accountId}:${params.path}`}:${normalizeFeishuWebhookRateLimitClient(params.clientIp)}`;
|
|
5322
5362
|
}
|
|
5323
|
-
|
|
5363
|
+
//#endregion
|
|
5364
|
+
//#region extensions/feishu/src/monitor.transport.ts
|
|
5324
5365
|
const FEISHU_WEBHOOK_ACCEPTED_HEADER = "x-openclaw-delivery-accepted";
|
|
5325
5366
|
const FEISHU_WEBHOOK_ACCEPTED_VALUE = "durable";
|
|
5326
5367
|
const FEISHU_PRE_AUTH_MAX_IN_FLIGHT = 64;
|
|
@@ -5707,7 +5748,8 @@ async function monitorWebhook(params) {
|
|
|
5707
5748
|
await cleanup();
|
|
5708
5749
|
}
|
|
5709
5750
|
}
|
|
5710
|
-
|
|
5751
|
+
//#endregion
|
|
5752
|
+
//#region extensions/feishu/src/monitor.vc-meeting-invited-handler.ts
|
|
5711
5753
|
const FEISHU_MEETING_NUMBER_PATTERN = /^\d{9}$/;
|
|
5712
5754
|
function parseInviteTimestamp(value) {
|
|
5713
5755
|
const parsed = Number.parseInt(value ?? "", 10);
|
|
@@ -5847,7 +5889,8 @@ function createFeishuVcMeetingInvitedHandler(params) {
|
|
|
5847
5889
|
return fireAndForget ? Promise.resolve() : task;
|
|
5848
5890
|
};
|
|
5849
5891
|
}
|
|
5850
|
-
|
|
5892
|
+
//#endregion
|
|
5893
|
+
//#region extensions/feishu/src/sequential-key.ts
|
|
5851
5894
|
function getFeishuSequentialKey(params) {
|
|
5852
5895
|
const { accountId, event, botOpenId, preparedContent } = params;
|
|
5853
5896
|
const baseKey = `feishu:${accountId}:${event.message.chat_id?.trim() || "unknown"}`;
|
|
@@ -5856,7 +5899,8 @@ function getFeishuSequentialKey(params) {
|
|
|
5856
5899
|
if (isBtwRequestText(text)) return `${baseKey}:btw`;
|
|
5857
5900
|
return baseKey;
|
|
5858
5901
|
}
|
|
5859
|
-
|
|
5902
|
+
//#endregion
|
|
5903
|
+
//#region extensions/feishu/src/monitor.account.ts
|
|
5860
5904
|
const FEISHU_REACTION_VERIFY_TIMEOUT_MS = 1500;
|
|
5861
5905
|
async function resolveReactionSyntheticEvent(params) {
|
|
5862
5906
|
const { cfg, accountId, event, botOpenId, fetchMessage = getMessageFeishu, verificationTimeoutMs = FEISHU_REACTION_VERIFY_TIMEOUT_MS, logger, uuid = () => crypto$1.randomUUID(), action = "created" } = params;
|
|
@@ -5866,7 +5910,7 @@ async function resolveReactionSyntheticEvent(params) {
|
|
|
5866
5910
|
const senderUserId = event.user_id?.user_id?.trim();
|
|
5867
5911
|
const senderId = senderOpenId || senderUserId;
|
|
5868
5912
|
if (!emoji || !messageId || !senderId) return null;
|
|
5869
|
-
const { resolveFeishuAccount } = await import("./doctor-contract-
|
|
5913
|
+
const { resolveFeishuAccount } = await import("./doctor-contract-BNXcJcWR.mjs").then((n) => n.l);
|
|
5870
5914
|
const reactionNotifications = resolveFeishuAccount({
|
|
5871
5915
|
cfg,
|
|
5872
5916
|
accountId
|
|
@@ -6154,4 +6198,5 @@ async function monitorSingleAccount(params) {
|
|
|
6154
6198
|
threadBindingManager?.stop();
|
|
6155
6199
|
}
|
|
6156
6200
|
}
|
|
6201
|
+
//#endregion
|
|
6157
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 };
|