@openclaw/feishu 2026.5.14-beta.1 → 2026.5.14-beta.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/api.js +3 -3
- package/dist/{channel-D6lD7M4a.js → channel-1pldyM9r.js} +369 -18
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.runtime-Bz77cRNh.js → channel.runtime-BlJ_XJTS.js} +5 -6
- package/dist/contract-api.js +3 -3
- package/dist/{drive-BocW3yO6.js → drive-Av1h_Lwd.js} +1 -1
- package/dist/{monitor-CxjMmMIW.js → monitor-Dfy3D2pM.js} +2 -2
- package/dist/{monitor.account-IU61mk0S.js → monitor.account-CT3Skl8y.js} +8 -9
- package/dist/{monitor.state-D1WkvOGG.js → monitor.state-D6ByOM5W.js} +1 -1
- package/dist/{probe-BNzzU_uR.js → probe-DpPNslkb.js} +1 -1
- package/dist/runtime-api.js +1 -1
- package/dist/secret-contract-api.js +1 -1
- package/dist/{security-audit-DqJdocrN.js → security-audit-BzTLFO6g.js} +1 -1
- package/dist/security-contract-api.js +1 -1
- package/dist/{send-BaiuDxKG.js → send-DsCQVFOE.js} +3 -3
- package/dist/session-key-api.js +1 -1
- package/dist/setup-api.js +1 -1
- package/package.json +5 -5
- package/dist/directory.static-DqfUoZrD.js +0 -44
- package/dist/policy-iDTxfTYv.js +0 -181
- package/dist/send-result-zZZOR3qT.js +0 -140
- /package/dist/{app-registration-BNC02wLI.js → app-registration-BVQ8zzYj.js} +0 -0
- /package/dist/{audio-preflight.runtime-BPlzkO3l.js → audio-preflight.runtime-qKoiXN6J.js} +0 -0
- /package/dist/{client-DBVoQL5w.js → client-B18oTGHf.js} +0 -0
- /package/dist/{runtime-CG0DuRCy.js → runtime-Cc16UY23.js} +0 -0
- /package/dist/{secret-contract-Dm4Z_zQN.js → secret-contract-DIpADEx7.js} +0 -0
- /package/dist/{security-audit-shared-ByuMx9cJ.js → security-audit-shared-B6kEakHj.js} +0 -0
- /package/dist/{session-conversation-BulT2OKc.js → session-conversation-DIuxgPQi.js} +0 -0
package/dist/api.js
CHANGED
|
@@ -2,9 +2,9 @@ import { a as parseFeishuTargetId, i as parseFeishuDirectConversationId, n as bu
|
|
|
2
2
|
import { n as createFeishuThreadBindingManager, r as getFeishuThreadBindingManager, t as __testing } from "./thread-bindings-D5kDxq_j.js";
|
|
3
3
|
import { n as handleFeishuSubagentEnded, r as handleFeishuSubagentSpawning, t as handleFeishuSubagentDeliveryTarget } from "./subagent-hooks-BUPKo9Al.js";
|
|
4
4
|
import { r as listEnabledFeishuAccounts } from "./accounts-CP4tDW-z.js";
|
|
5
|
-
import { a as setFeishuNamedAccountEnabled, i as feishuSetupAdapter, n as feishuSetupWizard, r as runFeishuLogin, t as feishuPlugin } from "./channel-
|
|
6
|
-
import { t as getFeishuRuntime } from "./runtime-
|
|
7
|
-
import { a as jsonToolResult, d as registerFeishuChatTools, f as createFeishuToolClient, m as resolveFeishuToolAccount, n as registerFeishuDriveTools, o as toolExecutionErrorResult, p as resolveAnyEnabledFeishuToolsConfig, s as unknownToolActionResult } from "./drive-
|
|
5
|
+
import { a as setFeishuNamedAccountEnabled, i as feishuSetupAdapter, n as feishuSetupWizard, r as runFeishuLogin, t as feishuPlugin } from "./channel-1pldyM9r.js";
|
|
6
|
+
import { t as getFeishuRuntime } from "./runtime-Cc16UY23.js";
|
|
7
|
+
import { a as jsonToolResult, d as registerFeishuChatTools, f as createFeishuToolClient, m as resolveFeishuToolAccount, n as registerFeishuDriveTools, o as toolExecutionErrorResult, p as resolveAnyEnabledFeishuToolsConfig, s as unknownToolActionResult } from "./drive-Av1h_Lwd.js";
|
|
8
8
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, readStringValue } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
9
9
|
import { existsSync } from "node:fs";
|
|
10
10
|
import { homedir } from "node:os";
|
|
@@ -1,28 +1,25 @@
|
|
|
1
1
|
import { a as parseFeishuTargetId, i as parseFeishuDirectConversationId, n as buildFeishuModelOverrideParentCandidates, r as parseFeishuConversationId, t as buildFeishuConversationId } from "./conversation-id-Byq1c20x.js";
|
|
2
|
-
import { n as looksLikeFeishuId, r as normalizeFeishuTarget } from "./targets-Bb05cFr4.js";
|
|
2
|
+
import { n as looksLikeFeishuId, r as normalizeFeishuTarget, t as detectIdType } from "./targets-Bb05cFr4.js";
|
|
3
3
|
import { a as resolveDefaultFeishuAccountId, f as isRecord$1, i as listFeishuAccountIds, n as inspectFeishuCredentials, o as resolveFeishuAccount, r as listEnabledFeishuAccounts, s as resolveFeishuRuntimeAccount } from "./accounts-CP4tDW-z.js";
|
|
4
|
-
import {
|
|
5
|
-
import { n as
|
|
6
|
-
import { t as
|
|
7
|
-
import {
|
|
8
|
-
import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-Dm4Z_zQN.js";
|
|
9
|
-
import { t as collectFeishuSecurityAuditFindings } from "./security-audit-shared-ByuMx9cJ.js";
|
|
10
|
-
import { t as resolveFeishuSessionConversation } from "./session-conversation-BulT2OKc.js";
|
|
4
|
+
import { t as messageActionTargetAliases } from "./security-audit-BzTLFO6g.js";
|
|
5
|
+
import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-DIpADEx7.js";
|
|
6
|
+
import { t as collectFeishuSecurityAuditFindings } from "./security-audit-shared-B6kEakHj.js";
|
|
7
|
+
import { t as resolveFeishuSessionConversation } from "./session-conversation-DIuxgPQi.js";
|
|
11
8
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
12
9
|
import { getSessionBindingService } from "openclaw/plugin-sdk/conversation-runtime";
|
|
13
10
|
import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
|
|
14
11
|
import { formatAllowFromLowercase } from "openclaw/plugin-sdk/allow-from";
|
|
15
12
|
import { adaptScopedAccountAccessor, createHybridChannelConfigAdapter } from "openclaw/plugin-sdk/channel-config-helpers";
|
|
16
13
|
import { buildChannelOutboundSessionRoute, createChatChannelPlugin, stripChannelTargetPrefix } from "openclaw/plugin-sdk/channel-core";
|
|
17
|
-
import { defineChannelMessageAdapter } from "openclaw/plugin-sdk/channel-message";
|
|
14
|
+
import { createMessageReceiptFromOutboundResults, defineChannelMessageAdapter } from "openclaw/plugin-sdk/channel-message";
|
|
18
15
|
import { createPairingPrefixStripper } from "openclaw/plugin-sdk/channel-pairing";
|
|
19
16
|
import { createAllowlistProviderGroupPolicyWarningCollector, projectConfigAccountIdWarningCollector } from "openclaw/plugin-sdk/channel-policy";
|
|
20
|
-
import { createChannelDirectoryAdapter, createRuntimeDirectoryLiveAdapter } from "openclaw/plugin-sdk/directory-runtime";
|
|
17
|
+
import { createChannelDirectoryAdapter, createRuntimeDirectoryLiveAdapter, listDirectoryGroupEntriesFromMapKeysAndAllowFrom, listDirectoryUserEntriesFromAllowFromAndMapKeys } from "openclaw/plugin-sdk/directory-runtime";
|
|
21
18
|
import { normalizeMessagePresentation, renderMessagePresentationFallbackText } from "openclaw/plugin-sdk/interactive-runtime";
|
|
22
19
|
import { createLazyRuntimeNamedExport } from "openclaw/plugin-sdk/lazy-runtime";
|
|
23
20
|
import { createRuntimeOutboundDelegates } from "openclaw/plugin-sdk/outbound-runtime";
|
|
24
21
|
import { buildProbeChannelStatusSummary, createComputedAccountStatusAdapter, createDefaultChannelRuntimeState } from "openclaw/plugin-sdk/status-helpers";
|
|
25
|
-
import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$2 } from "openclaw/plugin-sdk/account-resolution";
|
|
22
|
+
import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$2, normalizeAccountId, resolveMergedAccountConfig } from "openclaw/plugin-sdk/account-resolution";
|
|
26
23
|
import { createResolvedApproverActionAuthAdapter, resolveApprovalApprovers } from "openclaw/plugin-sdk/approval-auth-runtime";
|
|
27
24
|
import { createActionGate } from "openclaw/plugin-sdk/channel-actions";
|
|
28
25
|
import { buildChannelConfigSchema } from "openclaw/plugin-sdk/channel-config-primitives";
|
|
@@ -31,6 +28,7 @@ import { chunkTextForOutbound } from "openclaw/plugin-sdk/text-chunking";
|
|
|
31
28
|
import { normalizeAccountId as normalizeAccountId$1 } from "openclaw/plugin-sdk/account-id";
|
|
32
29
|
import { z } from "zod";
|
|
33
30
|
import { buildSecretInputSchema, hasConfiguredSecretInput as hasConfiguredSecretInput$2 } from "openclaw/plugin-sdk/secret-input";
|
|
31
|
+
import { createChannelIngressResolver, defineStableChannelIngressIdentity } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
34
32
|
import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1, formatDocsLink, hasConfiguredSecretInput as hasConfiguredSecretInput$1, mergeAllowFromEntries, patchTopLevelChannelConfigSection, promptSingleChannelSecretInput, splitSetupEntries } from "openclaw/plugin-sdk/setup";
|
|
35
33
|
//#region extensions/feishu/src/approval-auth.ts
|
|
36
34
|
function normalizeFeishuApproverId(value) {
|
|
@@ -52,6 +50,100 @@ const feishuApprovalAuth = createResolvedApproverActionAuthAdapter({
|
|
|
52
50
|
normalizeSenderId: (value) => normalizeFeishuApproverId(value)
|
|
53
51
|
});
|
|
54
52
|
//#endregion
|
|
53
|
+
//#region extensions/feishu/src/card-interaction.ts
|
|
54
|
+
const FEISHU_CARD_INTERACTION_VERSION = "ocf1";
|
|
55
|
+
function isInteractionKind(value) {
|
|
56
|
+
return value === "button" || value === "quick" || value === "meta";
|
|
57
|
+
}
|
|
58
|
+
function isMetadataValue(value) {
|
|
59
|
+
return value === null || value === void 0 || typeof value === "string" || typeof value === "number" || typeof value === "boolean";
|
|
60
|
+
}
|
|
61
|
+
function createFeishuCardInteractionEnvelope(envelope) {
|
|
62
|
+
return {
|
|
63
|
+
oc: FEISHU_CARD_INTERACTION_VERSION,
|
|
64
|
+
...envelope
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function buildFeishuCardActionTextFallback(event) {
|
|
68
|
+
const actionValue = event.action.value;
|
|
69
|
+
if (isRecord$1(actionValue)) {
|
|
70
|
+
if (typeof actionValue.text === "string") return actionValue.text;
|
|
71
|
+
if (typeof actionValue.command === "string") return actionValue.command;
|
|
72
|
+
return JSON.stringify(actionValue);
|
|
73
|
+
}
|
|
74
|
+
return String(actionValue);
|
|
75
|
+
}
|
|
76
|
+
function decodeFeishuCardAction(params) {
|
|
77
|
+
const { event, now = Date.now() } = params;
|
|
78
|
+
const actionValue = event.action.value;
|
|
79
|
+
if (!isRecord$1(actionValue) || actionValue.oc !== "ocf1") return {
|
|
80
|
+
kind: "legacy",
|
|
81
|
+
text: buildFeishuCardActionTextFallback(event)
|
|
82
|
+
};
|
|
83
|
+
if (!isInteractionKind(actionValue.k) || typeof actionValue.a !== "string" || !actionValue.a) return {
|
|
84
|
+
kind: "invalid",
|
|
85
|
+
reason: "malformed"
|
|
86
|
+
};
|
|
87
|
+
if (actionValue.q !== void 0 && typeof actionValue.q !== "string") return {
|
|
88
|
+
kind: "invalid",
|
|
89
|
+
reason: "malformed"
|
|
90
|
+
};
|
|
91
|
+
if (actionValue.m !== void 0) {
|
|
92
|
+
if (!isRecord$1(actionValue.m)) return {
|
|
93
|
+
kind: "invalid",
|
|
94
|
+
reason: "malformed"
|
|
95
|
+
};
|
|
96
|
+
for (const value of Object.values(actionValue.m)) if (!isMetadataValue(value)) return {
|
|
97
|
+
kind: "invalid",
|
|
98
|
+
reason: "malformed"
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
if (actionValue.c !== void 0) {
|
|
102
|
+
if (!isRecord$1(actionValue.c)) return {
|
|
103
|
+
kind: "invalid",
|
|
104
|
+
reason: "malformed"
|
|
105
|
+
};
|
|
106
|
+
if (actionValue.c.u !== void 0 && typeof actionValue.c.u !== "string") return {
|
|
107
|
+
kind: "invalid",
|
|
108
|
+
reason: "malformed"
|
|
109
|
+
};
|
|
110
|
+
if (actionValue.c.h !== void 0 && typeof actionValue.c.h !== "string") return {
|
|
111
|
+
kind: "invalid",
|
|
112
|
+
reason: "malformed"
|
|
113
|
+
};
|
|
114
|
+
if (actionValue.c.s !== void 0 && typeof actionValue.c.s !== "string") return {
|
|
115
|
+
kind: "invalid",
|
|
116
|
+
reason: "malformed"
|
|
117
|
+
};
|
|
118
|
+
if (actionValue.c.e !== void 0 && !Number.isFinite(actionValue.c.e)) return {
|
|
119
|
+
kind: "invalid",
|
|
120
|
+
reason: "malformed"
|
|
121
|
+
};
|
|
122
|
+
if (actionValue.c.t !== void 0 && actionValue.c.t !== "p2p" && actionValue.c.t !== "group") return {
|
|
123
|
+
kind: "invalid",
|
|
124
|
+
reason: "malformed"
|
|
125
|
+
};
|
|
126
|
+
if (typeof actionValue.c.e === "number" && actionValue.c.e < now) return {
|
|
127
|
+
kind: "invalid",
|
|
128
|
+
reason: "stale"
|
|
129
|
+
};
|
|
130
|
+
const expectedUser = actionValue.c.u?.trim();
|
|
131
|
+
if (expectedUser && expectedUser !== (event.operator.open_id ?? "").trim()) return {
|
|
132
|
+
kind: "invalid",
|
|
133
|
+
reason: "wrong_user"
|
|
134
|
+
};
|
|
135
|
+
const expectedChat = actionValue.c.h?.trim();
|
|
136
|
+
if (expectedChat && expectedChat !== (event.context.chat_id ?? "").trim()) return {
|
|
137
|
+
kind: "invalid",
|
|
138
|
+
reason: "wrong_conversation"
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
return {
|
|
142
|
+
kind: "structured",
|
|
143
|
+
envelope: actionValue
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
//#endregion
|
|
55
147
|
//#region extensions/feishu/src/config-schema.ts
|
|
56
148
|
const ChannelActionsSchema = z.object({ reactions: z.boolean().optional() }).strict().optional();
|
|
57
149
|
const DmPolicySchema = z.enum([
|
|
@@ -328,6 +420,265 @@ const FeishuConfigSchema = z.object({
|
|
|
328
420
|
}
|
|
329
421
|
});
|
|
330
422
|
//#endregion
|
|
423
|
+
//#region extensions/feishu/src/directory.static.ts
|
|
424
|
+
function toFeishuDirectoryPeers(ids) {
|
|
425
|
+
return ids.map((id) => ({
|
|
426
|
+
kind: "user",
|
|
427
|
+
id
|
|
428
|
+
}));
|
|
429
|
+
}
|
|
430
|
+
function toFeishuDirectoryGroups(ids) {
|
|
431
|
+
return ids.map((id) => ({
|
|
432
|
+
kind: "group",
|
|
433
|
+
id
|
|
434
|
+
}));
|
|
435
|
+
}
|
|
436
|
+
async function listFeishuDirectoryPeers(params) {
|
|
437
|
+
const account = resolveFeishuAccount({
|
|
438
|
+
cfg: params.cfg,
|
|
439
|
+
accountId: params.accountId
|
|
440
|
+
});
|
|
441
|
+
return toFeishuDirectoryPeers(listDirectoryUserEntriesFromAllowFromAndMapKeys({
|
|
442
|
+
allowFrom: account.config.allowFrom,
|
|
443
|
+
map: account.config.dms,
|
|
444
|
+
query: params.query,
|
|
445
|
+
limit: params.limit,
|
|
446
|
+
normalizeAllowFromId: (entry) => normalizeFeishuTarget(entry) ?? entry,
|
|
447
|
+
normalizeMapKeyId: (entry) => normalizeFeishuTarget(entry) ?? entry
|
|
448
|
+
}).map((entry) => entry.id));
|
|
449
|
+
}
|
|
450
|
+
async function listFeishuDirectoryGroups(params) {
|
|
451
|
+
const account = resolveFeishuAccount({
|
|
452
|
+
cfg: params.cfg,
|
|
453
|
+
accountId: params.accountId
|
|
454
|
+
});
|
|
455
|
+
return toFeishuDirectoryGroups(listDirectoryGroupEntriesFromMapKeysAndAllowFrom({
|
|
456
|
+
groups: account.config.groups,
|
|
457
|
+
allowFrom: account.config.groupAllowFrom,
|
|
458
|
+
query: params.query,
|
|
459
|
+
limit: params.limit
|
|
460
|
+
}).map((entry) => entry.id));
|
|
461
|
+
}
|
|
462
|
+
//#endregion
|
|
463
|
+
//#region extensions/feishu/src/policy.ts
|
|
464
|
+
const FEISHU_PROVIDER_PREFIX_RE = /^(feishu|lark):/i;
|
|
465
|
+
const FEISHU_TYPED_PREFIX_RE = /^(chat|group|channel|user|dm|open_id):/i;
|
|
466
|
+
const FEISHU_ID_KIND = "plugin:feishu-id";
|
|
467
|
+
const feishuIngressIdentity = defineStableChannelIngressIdentity({
|
|
468
|
+
key: "feishu-id",
|
|
469
|
+
kind: FEISHU_ID_KIND,
|
|
470
|
+
normalize: normalizeFeishuAllowEntry,
|
|
471
|
+
sensitivity: "pii",
|
|
472
|
+
aliases: [{
|
|
473
|
+
key: "feishu-alt-id",
|
|
474
|
+
kind: FEISHU_ID_KIND,
|
|
475
|
+
normalizeEntry: () => null,
|
|
476
|
+
normalizeSubject: normalizeFeishuAllowEntry,
|
|
477
|
+
sensitivity: "pii"
|
|
478
|
+
}],
|
|
479
|
+
isWildcardEntry: (entry) => normalizeFeishuAllowEntry(entry) === "*",
|
|
480
|
+
resolveEntryId: ({ entryIndex }) => `feishu-entry-${entryIndex + 1}`
|
|
481
|
+
});
|
|
482
|
+
function normalizeFeishuAllowEntry(raw) {
|
|
483
|
+
const trimmed = raw.trim();
|
|
484
|
+
if (!trimmed) return "";
|
|
485
|
+
if (trimmed === "*") return "*";
|
|
486
|
+
let withoutProviderPrefix = trimmed;
|
|
487
|
+
while (FEISHU_PROVIDER_PREFIX_RE.test(withoutProviderPrefix)) withoutProviderPrefix = withoutProviderPrefix.replace(FEISHU_PROVIDER_PREFIX_RE, "").trim();
|
|
488
|
+
if (withoutProviderPrefix === "*") return "*";
|
|
489
|
+
const lowered = normalizeOptionalLowercaseString(withoutProviderPrefix) ?? "";
|
|
490
|
+
if (!lowered) return "";
|
|
491
|
+
const prefixed = lowered.match(FEISHU_TYPED_PREFIX_RE);
|
|
492
|
+
if (prefixed?.[1]) {
|
|
493
|
+
const kind = [
|
|
494
|
+
"chat",
|
|
495
|
+
"group",
|
|
496
|
+
"channel"
|
|
497
|
+
].includes(prefixed[1]) ? "chat" : "user";
|
|
498
|
+
const value = withoutProviderPrefix.slice(prefixed[0].length).trim();
|
|
499
|
+
return value === "*" ? "*" : value ? `${kind}:${value}` : "";
|
|
500
|
+
}
|
|
501
|
+
const detectedType = detectIdType(withoutProviderPrefix);
|
|
502
|
+
if (detectedType === "chat_id") return `chat:${withoutProviderPrefix}`;
|
|
503
|
+
if (detectedType === "open_id" || detectedType === "user_id") return `user:${withoutProviderPrefix}`;
|
|
504
|
+
return "";
|
|
505
|
+
}
|
|
506
|
+
function normalizeFeishuDmPolicy(policy) {
|
|
507
|
+
return policy === "open" || policy === "pairing" || policy === "allowlist" || policy === "disabled" ? policy : "pairing";
|
|
508
|
+
}
|
|
509
|
+
function normalizeFeishuGroupPolicy(policy) {
|
|
510
|
+
return policy === "allowall" ? "open" : policy;
|
|
511
|
+
}
|
|
512
|
+
function createFeishuIngressSubject(params) {
|
|
513
|
+
const ids = [params.primaryId, ...params.alternateIds ?? []].map((value) => value?.trim()).filter((value) => Boolean(value));
|
|
514
|
+
return {
|
|
515
|
+
stableId: ids[0],
|
|
516
|
+
aliases: { "feishu-alt-id": ids[1] }
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
function createFeishuIngressResolver(params) {
|
|
520
|
+
return createChannelIngressResolver({
|
|
521
|
+
channelId: "feishu",
|
|
522
|
+
accountId: normalizeAccountId(params.accountId) ?? "default",
|
|
523
|
+
identity: feishuIngressIdentity,
|
|
524
|
+
cfg: params.cfg,
|
|
525
|
+
...params.readAllowFromStore ? { readStoreAllowFrom: params.readAllowFromStore } : {}
|
|
526
|
+
});
|
|
527
|
+
}
|
|
528
|
+
async function resolveFeishuDmIngressAccess(params) {
|
|
529
|
+
return await createFeishuIngressResolver({
|
|
530
|
+
cfg: params.cfg,
|
|
531
|
+
accountId: params.accountId,
|
|
532
|
+
readAllowFromStore: params.readAllowFromStore
|
|
533
|
+
}).message({
|
|
534
|
+
subject: createFeishuIngressSubject({
|
|
535
|
+
primaryId: params.senderOpenId,
|
|
536
|
+
alternateIds: [params.senderUserId]
|
|
537
|
+
}),
|
|
538
|
+
conversation: {
|
|
539
|
+
kind: "direct",
|
|
540
|
+
id: params.conversationId
|
|
541
|
+
},
|
|
542
|
+
event: { mayPair: params.mayPair },
|
|
543
|
+
dmPolicy: normalizeFeishuDmPolicy(params.dmPolicy),
|
|
544
|
+
groupPolicy: "disabled",
|
|
545
|
+
allowFrom: params.allowFrom ?? [],
|
|
546
|
+
...params.command ? { command: params.command } : {}
|
|
547
|
+
});
|
|
548
|
+
}
|
|
549
|
+
async function resolveFeishuGroupConversationIngressAccess(params) {
|
|
550
|
+
const groupPolicy = normalizeFeishuGroupPolicy(params.groupPolicy);
|
|
551
|
+
const groupAllowFrom = groupPolicy === "allowlist" && params.groupExplicitlyConfigured ? [...params.groupAllowFrom ?? [], params.chatId] : params.groupAllowFrom ?? [];
|
|
552
|
+
return await createFeishuIngressResolver({
|
|
553
|
+
cfg: params.cfg,
|
|
554
|
+
accountId: params.accountId
|
|
555
|
+
}).message({
|
|
556
|
+
subject: createFeishuIngressSubject({ primaryId: params.chatId }),
|
|
557
|
+
conversation: {
|
|
558
|
+
kind: "group",
|
|
559
|
+
id: params.chatId
|
|
560
|
+
},
|
|
561
|
+
dmPolicy: "disabled",
|
|
562
|
+
groupPolicy,
|
|
563
|
+
groupAllowFrom
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
async function resolveFeishuGroupSenderActivationIngressAccess(params) {
|
|
567
|
+
const groupAllowFrom = params.allowFrom ?? [];
|
|
568
|
+
return await createFeishuIngressResolver({
|
|
569
|
+
cfg: params.cfg,
|
|
570
|
+
accountId: params.accountId
|
|
571
|
+
}).message({
|
|
572
|
+
subject: createFeishuIngressSubject({
|
|
573
|
+
primaryId: params.senderOpenId,
|
|
574
|
+
alternateIds: [params.senderUserId]
|
|
575
|
+
}),
|
|
576
|
+
conversation: {
|
|
577
|
+
kind: "group",
|
|
578
|
+
id: params.chatId
|
|
579
|
+
},
|
|
580
|
+
dmPolicy: "disabled",
|
|
581
|
+
groupPolicy: groupAllowFrom.length > 0 ? "allowlist" : "open",
|
|
582
|
+
groupAllowFrom,
|
|
583
|
+
mentionFacts: {
|
|
584
|
+
canDetectMention: true,
|
|
585
|
+
wasMentioned: params.mentionedBot
|
|
586
|
+
},
|
|
587
|
+
policy: { activation: {
|
|
588
|
+
requireMention: params.requireMention,
|
|
589
|
+
allowTextCommands: false
|
|
590
|
+
} },
|
|
591
|
+
...params.command ? { command: params.command } : {}
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
function resolveFeishuGroupConfig(params) {
|
|
595
|
+
const groups = params.cfg?.groups ?? {};
|
|
596
|
+
const wildcard = groups["*"];
|
|
597
|
+
const groupId = params.groupId?.trim();
|
|
598
|
+
if (!groupId) return;
|
|
599
|
+
const direct = groups[groupId];
|
|
600
|
+
if (direct) return direct;
|
|
601
|
+
const lowered = normalizeOptionalLowercaseString(groupId) ?? "";
|
|
602
|
+
const matchKey = Object.keys(groups).find((key) => normalizeOptionalLowercaseString(key) === lowered);
|
|
603
|
+
if (matchKey) return groups[matchKey];
|
|
604
|
+
return wildcard;
|
|
605
|
+
}
|
|
606
|
+
function hasExplicitFeishuGroupConfig(params) {
|
|
607
|
+
const groups = params.cfg?.groups ?? {};
|
|
608
|
+
const groupId = params.groupId?.trim();
|
|
609
|
+
if (!groupId) return false;
|
|
610
|
+
if (Object.prototype.hasOwnProperty.call(groups, groupId) && groupId !== "*") return true;
|
|
611
|
+
const lowered = normalizeOptionalLowercaseString(groupId) ?? "";
|
|
612
|
+
return Object.keys(groups).some((key) => key !== "*" && normalizeOptionalLowercaseString(key) === lowered);
|
|
613
|
+
}
|
|
614
|
+
function resolveFeishuGroupToolPolicy(params) {
|
|
615
|
+
const cfg = params.cfg.channels?.feishu;
|
|
616
|
+
if (!cfg) return;
|
|
617
|
+
return resolveFeishuGroupConfig({
|
|
618
|
+
cfg,
|
|
619
|
+
groupId: params.groupId
|
|
620
|
+
})?.tools;
|
|
621
|
+
}
|
|
622
|
+
function resolveFeishuReplyPolicy(params) {
|
|
623
|
+
if (params.isDirectMessage) return { requireMention: false };
|
|
624
|
+
const feishuCfg = params.cfg.channels?.feishu;
|
|
625
|
+
const resolvedCfg = resolveMergedAccountConfig({
|
|
626
|
+
channelConfig: feishuCfg,
|
|
627
|
+
accounts: feishuCfg?.accounts,
|
|
628
|
+
accountId: normalizeAccountId(params.accountId),
|
|
629
|
+
normalizeAccountId,
|
|
630
|
+
omitKeys: ["defaultAccount"]
|
|
631
|
+
});
|
|
632
|
+
const groupRequireMention = resolveFeishuGroupConfig({
|
|
633
|
+
cfg: resolvedCfg,
|
|
634
|
+
groupId: params.groupId
|
|
635
|
+
})?.requireMention;
|
|
636
|
+
return { requireMention: typeof groupRequireMention === "boolean" ? groupRequireMention : typeof resolvedCfg.requireMention === "boolean" ? resolvedCfg.requireMention : params.groupPolicy !== "open" };
|
|
637
|
+
}
|
|
638
|
+
//#endregion
|
|
639
|
+
//#region extensions/feishu/src/send-result.ts
|
|
640
|
+
function resolveFeishuReceiptKind(msgType) {
|
|
641
|
+
switch (msgType) {
|
|
642
|
+
case "audio": return "voice";
|
|
643
|
+
case "image":
|
|
644
|
+
case "media":
|
|
645
|
+
case "file": return "media";
|
|
646
|
+
case "interactive": return "card";
|
|
647
|
+
case "post":
|
|
648
|
+
case "text": return "text";
|
|
649
|
+
default: return "unknown";
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
function createFeishuSendReceipt(params) {
|
|
653
|
+
const messageId = params.messageId?.trim();
|
|
654
|
+
const chatId = params.chatId.trim();
|
|
655
|
+
return createMessageReceiptFromOutboundResults({
|
|
656
|
+
results: messageId ? [{
|
|
657
|
+
channel: "feishu",
|
|
658
|
+
messageId,
|
|
659
|
+
chatId,
|
|
660
|
+
conversationId: chatId
|
|
661
|
+
}] : [],
|
|
662
|
+
...chatId ? { threadId: chatId } : {},
|
|
663
|
+
kind: params.kind ?? "unknown"
|
|
664
|
+
});
|
|
665
|
+
}
|
|
666
|
+
function assertFeishuMessageApiSuccess(response, errorPrefix) {
|
|
667
|
+
if (response.code !== 0) throw new Error(`${errorPrefix}: ${response.msg || `code ${response.code}`}`);
|
|
668
|
+
}
|
|
669
|
+
function toFeishuSendResult(response, chatId, kind) {
|
|
670
|
+
const messageId = response.data?.message_id ?? "unknown";
|
|
671
|
+
return {
|
|
672
|
+
messageId,
|
|
673
|
+
chatId,
|
|
674
|
+
receipt: createFeishuSendReceipt({
|
|
675
|
+
messageId,
|
|
676
|
+
chatId,
|
|
677
|
+
kind
|
|
678
|
+
})
|
|
679
|
+
};
|
|
680
|
+
}
|
|
681
|
+
//#endregion
|
|
331
682
|
//#region extensions/feishu/src/session-route.ts
|
|
332
683
|
function resolveFeishuOutboundSessionRoute(params) {
|
|
333
684
|
let trimmed = stripChannelTargetPrefix(params.target, "feishu", "lark");
|
|
@@ -563,7 +914,7 @@ async function promptFeishuSetupMethod(prompter) {
|
|
|
563
914
|
});
|
|
564
915
|
}
|
|
565
916
|
async function runScanToCreate(prompter, domain) {
|
|
566
|
-
const { beginAppRegistration, initAppRegistration, pollAppRegistration, printQrCode } = await import("./app-registration-
|
|
917
|
+
const { beginAppRegistration, initAppRegistration, pollAppRegistration, printQrCode } = await import("./app-registration-BVQ8zzYj.js");
|
|
567
918
|
try {
|
|
568
919
|
await initAppRegistration(domain);
|
|
569
920
|
} catch {
|
|
@@ -648,7 +999,7 @@ async function runNewAppFlow(params) {
|
|
|
648
999
|
appSecretProbeValue = appSecretResult.resolvedValue;
|
|
649
1000
|
}
|
|
650
1001
|
if (appId && appSecretProbeValue) {
|
|
651
|
-
const { getAppOwnerOpenId } = await import("./app-registration-
|
|
1002
|
+
const { getAppOwnerOpenId } = await import("./app-registration-BVQ8zzYj.js");
|
|
652
1003
|
scanOpenId = await getAppOwnerOpenId({
|
|
653
1004
|
appId,
|
|
654
1005
|
appSecret: appSecretProbeValue,
|
|
@@ -758,7 +1109,7 @@ const feishuSetupWizard = {
|
|
|
758
1109
|
});
|
|
759
1110
|
let probeResult = null;
|
|
760
1111
|
if (configured && account.configured) try {
|
|
761
|
-
const { probeFeishu } = await import("./probe-
|
|
1112
|
+
const { probeFeishu } = await import("./probe-DpPNslkb.js").then((n) => n.n);
|
|
762
1113
|
probeResult = await probeFeishu(account);
|
|
763
1114
|
} catch {}
|
|
764
1115
|
if (!configured) return ["Feishu: needs app credentials"];
|
|
@@ -832,7 +1183,7 @@ const meta = {
|
|
|
832
1183
|
aliases: ["lark"],
|
|
833
1184
|
order: 70
|
|
834
1185
|
};
|
|
835
|
-
const loadFeishuChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-
|
|
1186
|
+
const loadFeishuChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-BlJ_XJTS.js"), "feishuChannelRuntime");
|
|
836
1187
|
function toFeishuMessageSendResult(result, kind) {
|
|
837
1188
|
const receipt = result.receipt ?? createFeishuSendReceipt({
|
|
838
1189
|
messageId: result.messageId,
|
|
@@ -888,7 +1239,7 @@ function buildFeishuPresentationCard(params) {
|
|
|
888
1239
|
};
|
|
889
1240
|
}
|
|
890
1241
|
async function createFeishuActionClient(account) {
|
|
891
|
-
const { createFeishuClient } = await import("./client-
|
|
1242
|
+
const { createFeishuClient } = await import("./client-B18oTGHf.js").then((n) => n.t);
|
|
892
1243
|
return createFeishuClient(account);
|
|
893
1244
|
}
|
|
894
1245
|
const collectFeishuSecurityWarnings = createAllowlistProviderGroupPolicyWarningCollector({
|
|
@@ -1675,7 +2026,7 @@ const feishuPlugin = createChatChannelPlugin({
|
|
|
1675
2026
|
})
|
|
1676
2027
|
}),
|
|
1677
2028
|
gateway: { startAccount: async (ctx) => {
|
|
1678
|
-
const { monitorFeishuProvider } = await import("./monitor-
|
|
2029
|
+
const { monitorFeishuProvider } = await import("./monitor-Dfy3D2pM.js");
|
|
1679
2030
|
const account = resolveFeishuRuntimeAccount({
|
|
1680
2031
|
cfg: ctx.cfg,
|
|
1681
2032
|
accountId: ctx.accountId
|
|
@@ -1742,4 +2093,4 @@ const feishuPlugin = createChatChannelPlugin({
|
|
|
1742
2093
|
}
|
|
1743
2094
|
});
|
|
1744
2095
|
//#endregion
|
|
1745
|
-
export { setFeishuNamedAccountEnabled$1 as a, feishuSetupAdapter as i, feishuSetupWizard as n, runFeishuLogin as r, feishuPlugin as t };
|
|
2096
|
+
export { buildFeishuCardActionTextFallback as _, setFeishuNamedAccountEnabled$1 as a, toFeishuSendResult as c, resolveFeishuGroupConfig as d, resolveFeishuGroupConversationIngressAccess as f, listFeishuDirectoryPeers as g, listFeishuDirectoryGroups as h, feishuSetupAdapter as i, hasExplicitFeishuGroupConfig as l, resolveFeishuReplyPolicy as m, feishuSetupWizard as n, assertFeishuMessageApiSuccess as o, resolveFeishuGroupSenderActivationIngressAccess as p, runFeishuLogin as r, resolveFeishuReceiptKind as s, feishuPlugin as t, resolveFeishuDmIngressAccess as u, createFeishuCardInteractionEnvelope as v, decodeFeishuCardAction as y };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as feishuPlugin } from "./channel-
|
|
1
|
+
import { t as feishuPlugin } from "./channel-1pldyM9r.js";
|
|
2
2
|
export { feishuPlugin };
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { o as resolveFeishuAccount, s as resolveFeishuRuntimeAccount, y as parseFeishuCommentTarget } from "./accounts-CP4tDW-z.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { r as
|
|
5
|
-
import { c as getChatInfo, l as getChatMembers, r as cleanupAmbientCommentTypingReaction, t as deliverCommentThreadText, u as getFeishuMemberInfo } from "./drive-BocW3yO6.js";
|
|
2
|
+
import { g as listFeishuDirectoryPeers, h as listFeishuDirectoryGroups, v as createFeishuCardInteractionEnvelope } from "./channel-1pldyM9r.js";
|
|
3
|
+
import { r as createFeishuClient } from "./client-B18oTGHf.js";
|
|
4
|
+
import { c as getChatInfo, l as getChatMembers, r as cleanupAmbientCommentTypingReaction, t as deliverCommentThreadText, u as getFeishuMemberInfo } from "./drive-Av1h_Lwd.js";
|
|
6
5
|
import { chunkTextForOutbound } from "./runtime-api.js";
|
|
7
|
-
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-
|
|
8
|
-
import { t as probeFeishu } from "./probe-
|
|
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-DsCQVFOE.js";
|
|
7
|
+
import { t as probeFeishu } from "./probe-DpPNslkb.js";
|
|
9
8
|
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
10
9
|
import { interactiveReplyToPresentation, normalizeInteractiveReply, normalizeMessagePresentation, renderMessagePresentationFallbackText, resolveInteractiveTextFallback } from "openclaw/plugin-sdk/interactive-runtime";
|
|
11
10
|
import path from "node:path";
|
package/dist/contract-api.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { a as parseFeishuTargetId, i as parseFeishuDirectConversationId, r as parseFeishuConversationId, t as buildFeishuConversationId } from "./conversation-id-Byq1c20x.js";
|
|
2
2
|
import { n as createFeishuThreadBindingManager, t as __testing } from "./thread-bindings-D5kDxq_j.js";
|
|
3
|
-
import { t as messageActionTargetAliases } from "./security-audit-
|
|
4
|
-
import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-
|
|
5
|
-
import { t as collectFeishuSecurityAuditFindings } from "./security-audit-shared-
|
|
3
|
+
import { t as messageActionTargetAliases } from "./security-audit-BzTLFO6g.js";
|
|
4
|
+
import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-DIpADEx7.js";
|
|
5
|
+
import { t as collectFeishuSecurityAuditFindings } from "./security-audit-shared-B6kEakHj.js";
|
|
6
6
|
//#region extensions/feishu/contract-api.ts
|
|
7
7
|
const feishuSessionBindingAdapterChannels = ["feishu"];
|
|
8
8
|
//#endregion
|
|
@@ -1,5 +1,5 @@
|
|
|
1
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-CP4tDW-z.js";
|
|
2
|
-
import { r as createFeishuClient } from "./client-
|
|
2
|
+
import { r as createFeishuClient } from "./client-B18oTGHf.js";
|
|
3
3
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
5
5
|
import { Type } from "typebox";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { r as listEnabledFeishuAccounts, s as resolveFeishuRuntimeAccount } from "./accounts-CP4tDW-z.js";
|
|
2
|
-
import { l as fetchBotIdentityForMonitor } from "./monitor.state-
|
|
2
|
+
import { l as fetchBotIdentityForMonitor } from "./monitor.state-D6ByOM5W.js";
|
|
3
3
|
//#region extensions/feishu/src/monitor.ts
|
|
4
4
|
let monitorAccountRuntimePromise;
|
|
5
5
|
async function loadMonitorAccountRuntime() {
|
|
6
|
-
monitorAccountRuntimePromise ??= import("./monitor.account-
|
|
6
|
+
monitorAccountRuntimePromise ??= import("./monitor.account-CT3Skl8y.js");
|
|
7
7
|
return await monitorAccountRuntimePromise;
|
|
8
8
|
}
|
|
9
9
|
async function monitorFeishuProvider(opts = {}) {
|
|
@@ -2,15 +2,14 @@ import { t as buildFeishuConversationId } from "./conversation-id-Byq1c20x.js";
|
|
|
2
2
|
import { i as resolveReceiveIdType } from "./targets-Bb05cFr4.js";
|
|
3
3
|
import { n as createFeishuThreadBindingManager } from "./thread-bindings-D5kDxq_j.js";
|
|
4
4
|
import { _ as buildFeishuCommentTarget, f as isRecord$3, h as readString$2, l as encodeQuery, m as parseCommentContentElements, p as normalizeString, s as resolveFeishuRuntimeAccount, u as extractReplyText, v as normalizeCommentFileType } from "./accounts-CP4tDW-z.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { c as getChatInfo, i as createCommentTypingReactionLifecycle, t as deliverCommentThreadText } from "./drive-BocW3yO6.js";
|
|
5
|
+
import { _ as buildFeishuCardActionTextFallback, d as resolveFeishuGroupConfig, f as resolveFeishuGroupConversationIngressAccess, l as hasExplicitFeishuGroupConfig, m as resolveFeishuReplyPolicy, p as resolveFeishuGroupSenderActivationIngressAccess, u as resolveFeishuDmIngressAccess, v as createFeishuCardInteractionEnvelope, y as decodeFeishuCardAction } from "./channel-1pldyM9r.js";
|
|
6
|
+
import { t as getFeishuRuntime } from "./runtime-Cc16UY23.js";
|
|
7
|
+
import { a as getFeishuUserAgent, i as createFeishuWSClient, n as createEventDispatcher, r as createFeishuClient } from "./client-B18oTGHf.js";
|
|
8
|
+
import { c as getChatInfo, i as createCommentTypingReactionLifecycle, t as deliverCommentThreadText } from "./drive-Av1h_Lwd.js";
|
|
10
9
|
import { buildAgentMediaPayload, 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-
|
|
12
|
-
import { i as waitForAbortableDelay, r as raceWithTimeoutAndAbort } from "./probe-
|
|
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-
|
|
10
|
+
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-DsCQVFOE.js";
|
|
11
|
+
import { i as waitForAbortableDelay, r as raceWithTimeoutAndAbort } from "./probe-DpPNslkb.js";
|
|
12
|
+
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-D6ByOM5W.js";
|
|
14
13
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
15
14
|
import { ensureConfiguredBindingRouteReady, resolveConfiguredBindingRoute, resolveRuntimeConversationBindingRoute } from "openclaw/plugin-sdk/conversation-runtime";
|
|
16
15
|
import { createChannelMessageReplyPipeline } from "openclaw/plugin-sdk/channel-message";
|
|
@@ -1679,7 +1678,7 @@ async function resolveFeishuAudioPreflightTranscript(params) {
|
|
|
1679
1678
|
const audioMedia = params.mediaList.filter((media) => media.contentType?.startsWith("audio/"));
|
|
1680
1679
|
if (audioMedia.length === 0) return;
|
|
1681
1680
|
try {
|
|
1682
|
-
const { transcribeFirstAudio } = await import("./audio-preflight.runtime-
|
|
1681
|
+
const { transcribeFirstAudio } = await import("./audio-preflight.runtime-qKoiXN6J.js");
|
|
1683
1682
|
return await transcribeFirstAudio({
|
|
1684
1683
|
ctx: {
|
|
1685
1684
|
MediaPaths: audioMedia.map((media) => media.path),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as probeFeishu } from "./probe-
|
|
1
|
+
import { t as probeFeishu } from "./probe-DpPNslkb.js";
|
|
2
2
|
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
3
|
import { WEBHOOK_ANOMALY_COUNTER_DEFAULTS, WEBHOOK_RATE_LIMIT_DEFAULTS, createFixedWindowRateLimiter, createWebhookAnomalyTracker } from "openclaw/plugin-sdk/webhook-ingress";
|
|
4
4
|
//#region extensions/feishu/src/monitor.startup.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-DUslC3ob.js";
|
|
2
|
-
import { r as createFeishuClient } from "./client-
|
|
2
|
+
import { r as createFeishuClient } from "./client-B18oTGHf.js";
|
|
3
3
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
4
4
|
//#region extensions/feishu/src/async.ts
|
|
5
5
|
const RACE_TIMEOUT = Symbol("race-timeout");
|
package/dist/runtime-api.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as setFeishuRuntime } from "./runtime-
|
|
1
|
+
import { n as setFeishuRuntime } from "./runtime-Cc16UY23.js";
|
|
2
2
|
import { normalizeAgentId } from "openclaw/plugin-sdk/routing";
|
|
3
3
|
import { createReplyPrefixContext } from "openclaw/plugin-sdk/channel-message";
|
|
4
4
|
import { createChannelPairingController } from "openclaw/plugin-sdk/channel-pairing";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries, t as channelSecrets } from "./secret-contract-
|
|
1
|
+
import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries, t as channelSecrets } from "./secret-contract-DIpADEx7.js";
|
|
2
2
|
export { channelSecrets, collectRuntimeConfigAssignments, secretTargetRegistryEntries };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as collectFeishuSecurityAuditFindings } from "./security-audit-shared-
|
|
1
|
+
import { t as collectFeishuSecurityAuditFindings } from "./security-audit-shared-B6kEakHj.js";
|
|
2
2
|
export { collectFeishuSecurityAuditFindings };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { i as resolveReceiveIdType, r as normalizeFeishuTarget } from "./targets-Bb05cFr4.js";
|
|
2
2
|
import { c as createFeishuApiError, f as isRecord$2, g as requestFeishuApi, s as resolveFeishuRuntimeAccount } from "./accounts-CP4tDW-z.js";
|
|
3
|
-
import {
|
|
4
|
-
import { t as getFeishuRuntime } from "./runtime-
|
|
5
|
-
import { r as createFeishuClient } from "./client-
|
|
3
|
+
import { c as toFeishuSendResult, o as assertFeishuMessageApiSuccess, s as resolveFeishuReceiptKind } from "./channel-1pldyM9r.js";
|
|
4
|
+
import { t as getFeishuRuntime } from "./runtime-Cc16UY23.js";
|
|
5
|
+
import { r as createFeishuClient } from "./client-B18oTGHf.js";
|
|
6
6
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
7
|
import { convertMarkdownTables } from "openclaw/plugin-sdk/text-chunking";
|
|
8
8
|
import fs from "node:fs";
|
package/dist/session-key-api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as resolveFeishuSessionConversation } from "./session-conversation-
|
|
1
|
+
import { t as resolveFeishuSessionConversation } from "./session-conversation-DIuxgPQi.js";
|
|
2
2
|
export { resolveFeishuSessionConversation as resolveSessionConversation };
|
package/dist/setup-api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as feishuSetupAdapter, n as feishuSetupWizard, t as feishuPlugin } from "./channel-
|
|
1
|
+
import { i as feishuSetupAdapter, n as feishuSetupWizard, t as feishuPlugin } from "./channel-1pldyM9r.js";
|
|
2
2
|
export { feishuPlugin, feishuSetupAdapter, feishuSetupWizard };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/feishu",
|
|
3
|
-
"version": "2026.5.14-beta.
|
|
3
|
+
"version": "2026.5.14-beta.2",
|
|
4
4
|
"description": "OpenClaw Feishu/Lark channel plugin (community maintained by @m1heng)",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
},
|
|
9
9
|
"type": "module",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@larksuiteoapi/node-sdk": "1.
|
|
11
|
+
"@larksuiteoapi/node-sdk": "1.64.0",
|
|
12
12
|
"typebox": "1.1.38",
|
|
13
13
|
"zod": "4.4.3"
|
|
14
14
|
},
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"openclaw": "workspace:*"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
|
-
"openclaw": ">=2026.5.14-beta.
|
|
20
|
+
"openclaw": ">=2026.5.14-beta.2"
|
|
21
21
|
},
|
|
22
22
|
"peerDependenciesMeta": {
|
|
23
23
|
"openclaw": {
|
|
@@ -48,10 +48,10 @@
|
|
|
48
48
|
"minHostVersion": ">=2026.4.25"
|
|
49
49
|
},
|
|
50
50
|
"compat": {
|
|
51
|
-
"pluginApi": ">=2026.5.14-beta.
|
|
51
|
+
"pluginApi": ">=2026.5.14-beta.2"
|
|
52
52
|
},
|
|
53
53
|
"build": {
|
|
54
|
-
"openclawVersion": "2026.5.14-beta.
|
|
54
|
+
"openclawVersion": "2026.5.14-beta.2"
|
|
55
55
|
},
|
|
56
56
|
"release": {
|
|
57
57
|
"publishToClawHub": true,
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { r as normalizeFeishuTarget } from "./targets-Bb05cFr4.js";
|
|
2
|
-
import { o as resolveFeishuAccount } from "./accounts-CP4tDW-z.js";
|
|
3
|
-
import { listDirectoryGroupEntriesFromMapKeysAndAllowFrom, listDirectoryUserEntriesFromAllowFromAndMapKeys } from "openclaw/plugin-sdk/directory-runtime";
|
|
4
|
-
//#region extensions/feishu/src/directory.static.ts
|
|
5
|
-
function toFeishuDirectoryPeers(ids) {
|
|
6
|
-
return ids.map((id) => ({
|
|
7
|
-
kind: "user",
|
|
8
|
-
id
|
|
9
|
-
}));
|
|
10
|
-
}
|
|
11
|
-
function toFeishuDirectoryGroups(ids) {
|
|
12
|
-
return ids.map((id) => ({
|
|
13
|
-
kind: "group",
|
|
14
|
-
id
|
|
15
|
-
}));
|
|
16
|
-
}
|
|
17
|
-
async function listFeishuDirectoryPeers(params) {
|
|
18
|
-
const account = resolveFeishuAccount({
|
|
19
|
-
cfg: params.cfg,
|
|
20
|
-
accountId: params.accountId
|
|
21
|
-
});
|
|
22
|
-
return toFeishuDirectoryPeers(listDirectoryUserEntriesFromAllowFromAndMapKeys({
|
|
23
|
-
allowFrom: account.config.allowFrom,
|
|
24
|
-
map: account.config.dms,
|
|
25
|
-
query: params.query,
|
|
26
|
-
limit: params.limit,
|
|
27
|
-
normalizeAllowFromId: (entry) => normalizeFeishuTarget(entry) ?? entry,
|
|
28
|
-
normalizeMapKeyId: (entry) => normalizeFeishuTarget(entry) ?? entry
|
|
29
|
-
}).map((entry) => entry.id));
|
|
30
|
-
}
|
|
31
|
-
async function listFeishuDirectoryGroups(params) {
|
|
32
|
-
const account = resolveFeishuAccount({
|
|
33
|
-
cfg: params.cfg,
|
|
34
|
-
accountId: params.accountId
|
|
35
|
-
});
|
|
36
|
-
return toFeishuDirectoryGroups(listDirectoryGroupEntriesFromMapKeysAndAllowFrom({
|
|
37
|
-
groups: account.config.groups,
|
|
38
|
-
allowFrom: account.config.groupAllowFrom,
|
|
39
|
-
query: params.query,
|
|
40
|
-
limit: params.limit
|
|
41
|
-
}).map((entry) => entry.id));
|
|
42
|
-
}
|
|
43
|
-
//#endregion
|
|
44
|
-
export { listFeishuDirectoryPeers as n, listFeishuDirectoryGroups as t };
|
package/dist/policy-iDTxfTYv.js
DELETED
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import { t as detectIdType } from "./targets-Bb05cFr4.js";
|
|
2
|
-
import { normalizeOptionalLowercaseString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
|
-
import { normalizeAccountId, resolveMergedAccountConfig } from "openclaw/plugin-sdk/account-resolution";
|
|
4
|
-
import { createChannelIngressResolver, defineStableChannelIngressIdentity } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
5
|
-
//#region extensions/feishu/src/policy.ts
|
|
6
|
-
const FEISHU_PROVIDER_PREFIX_RE = /^(feishu|lark):/i;
|
|
7
|
-
const FEISHU_TYPED_PREFIX_RE = /^(chat|group|channel|user|dm|open_id):/i;
|
|
8
|
-
const FEISHU_ID_KIND = "plugin:feishu-id";
|
|
9
|
-
const feishuIngressIdentity = defineStableChannelIngressIdentity({
|
|
10
|
-
key: "feishu-id",
|
|
11
|
-
kind: FEISHU_ID_KIND,
|
|
12
|
-
normalize: normalizeFeishuAllowEntry,
|
|
13
|
-
sensitivity: "pii",
|
|
14
|
-
aliases: [{
|
|
15
|
-
key: "feishu-alt-id",
|
|
16
|
-
kind: FEISHU_ID_KIND,
|
|
17
|
-
normalizeEntry: () => null,
|
|
18
|
-
normalizeSubject: normalizeFeishuAllowEntry,
|
|
19
|
-
sensitivity: "pii"
|
|
20
|
-
}],
|
|
21
|
-
isWildcardEntry: (entry) => normalizeFeishuAllowEntry(entry) === "*",
|
|
22
|
-
resolveEntryId: ({ entryIndex }) => `feishu-entry-${entryIndex + 1}`
|
|
23
|
-
});
|
|
24
|
-
function normalizeFeishuAllowEntry(raw) {
|
|
25
|
-
const trimmed = raw.trim();
|
|
26
|
-
if (!trimmed) return "";
|
|
27
|
-
if (trimmed === "*") return "*";
|
|
28
|
-
let withoutProviderPrefix = trimmed;
|
|
29
|
-
while (FEISHU_PROVIDER_PREFIX_RE.test(withoutProviderPrefix)) withoutProviderPrefix = withoutProviderPrefix.replace(FEISHU_PROVIDER_PREFIX_RE, "").trim();
|
|
30
|
-
if (withoutProviderPrefix === "*") return "*";
|
|
31
|
-
const lowered = normalizeOptionalLowercaseString(withoutProviderPrefix) ?? "";
|
|
32
|
-
if (!lowered) return "";
|
|
33
|
-
const prefixed = lowered.match(FEISHU_TYPED_PREFIX_RE);
|
|
34
|
-
if (prefixed?.[1]) {
|
|
35
|
-
const kind = [
|
|
36
|
-
"chat",
|
|
37
|
-
"group",
|
|
38
|
-
"channel"
|
|
39
|
-
].includes(prefixed[1]) ? "chat" : "user";
|
|
40
|
-
const value = withoutProviderPrefix.slice(prefixed[0].length).trim();
|
|
41
|
-
return value === "*" ? "*" : value ? `${kind}:${value}` : "";
|
|
42
|
-
}
|
|
43
|
-
const detectedType = detectIdType(withoutProviderPrefix);
|
|
44
|
-
if (detectedType === "chat_id") return `chat:${withoutProviderPrefix}`;
|
|
45
|
-
if (detectedType === "open_id" || detectedType === "user_id") return `user:${withoutProviderPrefix}`;
|
|
46
|
-
return "";
|
|
47
|
-
}
|
|
48
|
-
function normalizeFeishuDmPolicy(policy) {
|
|
49
|
-
return policy === "open" || policy === "pairing" || policy === "allowlist" || policy === "disabled" ? policy : "pairing";
|
|
50
|
-
}
|
|
51
|
-
function normalizeFeishuGroupPolicy(policy) {
|
|
52
|
-
return policy === "allowall" ? "open" : policy;
|
|
53
|
-
}
|
|
54
|
-
function createFeishuIngressSubject(params) {
|
|
55
|
-
const ids = [params.primaryId, ...params.alternateIds ?? []].map((value) => value?.trim()).filter((value) => Boolean(value));
|
|
56
|
-
return {
|
|
57
|
-
stableId: ids[0],
|
|
58
|
-
aliases: { "feishu-alt-id": ids[1] }
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
function createFeishuIngressResolver(params) {
|
|
62
|
-
return createChannelIngressResolver({
|
|
63
|
-
channelId: "feishu",
|
|
64
|
-
accountId: normalizeAccountId(params.accountId) ?? "default",
|
|
65
|
-
identity: feishuIngressIdentity,
|
|
66
|
-
cfg: params.cfg,
|
|
67
|
-
...params.readAllowFromStore ? { readStoreAllowFrom: params.readAllowFromStore } : {}
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
async function resolveFeishuDmIngressAccess(params) {
|
|
71
|
-
return await createFeishuIngressResolver({
|
|
72
|
-
cfg: params.cfg,
|
|
73
|
-
accountId: params.accountId,
|
|
74
|
-
readAllowFromStore: params.readAllowFromStore
|
|
75
|
-
}).message({
|
|
76
|
-
subject: createFeishuIngressSubject({
|
|
77
|
-
primaryId: params.senderOpenId,
|
|
78
|
-
alternateIds: [params.senderUserId]
|
|
79
|
-
}),
|
|
80
|
-
conversation: {
|
|
81
|
-
kind: "direct",
|
|
82
|
-
id: params.conversationId
|
|
83
|
-
},
|
|
84
|
-
event: { mayPair: params.mayPair },
|
|
85
|
-
dmPolicy: normalizeFeishuDmPolicy(params.dmPolicy),
|
|
86
|
-
groupPolicy: "disabled",
|
|
87
|
-
allowFrom: params.allowFrom ?? [],
|
|
88
|
-
...params.command ? { command: params.command } : {}
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
async function resolveFeishuGroupConversationIngressAccess(params) {
|
|
92
|
-
const groupPolicy = normalizeFeishuGroupPolicy(params.groupPolicy);
|
|
93
|
-
const groupAllowFrom = groupPolicy === "allowlist" && params.groupExplicitlyConfigured ? [...params.groupAllowFrom ?? [], params.chatId] : params.groupAllowFrom ?? [];
|
|
94
|
-
return await createFeishuIngressResolver({
|
|
95
|
-
cfg: params.cfg,
|
|
96
|
-
accountId: params.accountId
|
|
97
|
-
}).message({
|
|
98
|
-
subject: createFeishuIngressSubject({ primaryId: params.chatId }),
|
|
99
|
-
conversation: {
|
|
100
|
-
kind: "group",
|
|
101
|
-
id: params.chatId
|
|
102
|
-
},
|
|
103
|
-
dmPolicy: "disabled",
|
|
104
|
-
groupPolicy,
|
|
105
|
-
groupAllowFrom
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
async function resolveFeishuGroupSenderActivationIngressAccess(params) {
|
|
109
|
-
const groupAllowFrom = params.allowFrom ?? [];
|
|
110
|
-
return await createFeishuIngressResolver({
|
|
111
|
-
cfg: params.cfg,
|
|
112
|
-
accountId: params.accountId
|
|
113
|
-
}).message({
|
|
114
|
-
subject: createFeishuIngressSubject({
|
|
115
|
-
primaryId: params.senderOpenId,
|
|
116
|
-
alternateIds: [params.senderUserId]
|
|
117
|
-
}),
|
|
118
|
-
conversation: {
|
|
119
|
-
kind: "group",
|
|
120
|
-
id: params.chatId
|
|
121
|
-
},
|
|
122
|
-
dmPolicy: "disabled",
|
|
123
|
-
groupPolicy: groupAllowFrom.length > 0 ? "allowlist" : "open",
|
|
124
|
-
groupAllowFrom,
|
|
125
|
-
mentionFacts: {
|
|
126
|
-
canDetectMention: true,
|
|
127
|
-
wasMentioned: params.mentionedBot
|
|
128
|
-
},
|
|
129
|
-
policy: { activation: {
|
|
130
|
-
requireMention: params.requireMention,
|
|
131
|
-
allowTextCommands: false
|
|
132
|
-
} },
|
|
133
|
-
...params.command ? { command: params.command } : {}
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
function resolveFeishuGroupConfig(params) {
|
|
137
|
-
const groups = params.cfg?.groups ?? {};
|
|
138
|
-
const wildcard = groups["*"];
|
|
139
|
-
const groupId = params.groupId?.trim();
|
|
140
|
-
if (!groupId) return;
|
|
141
|
-
const direct = groups[groupId];
|
|
142
|
-
if (direct) return direct;
|
|
143
|
-
const lowered = normalizeOptionalLowercaseString(groupId) ?? "";
|
|
144
|
-
const matchKey = Object.keys(groups).find((key) => normalizeOptionalLowercaseString(key) === lowered);
|
|
145
|
-
if (matchKey) return groups[matchKey];
|
|
146
|
-
return wildcard;
|
|
147
|
-
}
|
|
148
|
-
function hasExplicitFeishuGroupConfig(params) {
|
|
149
|
-
const groups = params.cfg?.groups ?? {};
|
|
150
|
-
const groupId = params.groupId?.trim();
|
|
151
|
-
if (!groupId) return false;
|
|
152
|
-
if (Object.prototype.hasOwnProperty.call(groups, groupId) && groupId !== "*") return true;
|
|
153
|
-
const lowered = normalizeOptionalLowercaseString(groupId) ?? "";
|
|
154
|
-
return Object.keys(groups).some((key) => key !== "*" && normalizeOptionalLowercaseString(key) === lowered);
|
|
155
|
-
}
|
|
156
|
-
function resolveFeishuGroupToolPolicy(params) {
|
|
157
|
-
const cfg = params.cfg.channels?.feishu;
|
|
158
|
-
if (!cfg) return;
|
|
159
|
-
return resolveFeishuGroupConfig({
|
|
160
|
-
cfg,
|
|
161
|
-
groupId: params.groupId
|
|
162
|
-
})?.tools;
|
|
163
|
-
}
|
|
164
|
-
function resolveFeishuReplyPolicy(params) {
|
|
165
|
-
if (params.isDirectMessage) return { requireMention: false };
|
|
166
|
-
const feishuCfg = params.cfg.channels?.feishu;
|
|
167
|
-
const resolvedCfg = resolveMergedAccountConfig({
|
|
168
|
-
channelConfig: feishuCfg,
|
|
169
|
-
accounts: feishuCfg?.accounts,
|
|
170
|
-
accountId: normalizeAccountId(params.accountId),
|
|
171
|
-
normalizeAccountId,
|
|
172
|
-
omitKeys: ["defaultAccount"]
|
|
173
|
-
});
|
|
174
|
-
const groupRequireMention = resolveFeishuGroupConfig({
|
|
175
|
-
cfg: resolvedCfg,
|
|
176
|
-
groupId: params.groupId
|
|
177
|
-
})?.requireMention;
|
|
178
|
-
return { requireMention: typeof groupRequireMention === "boolean" ? groupRequireMention : typeof resolvedCfg.requireMention === "boolean" ? resolvedCfg.requireMention : params.groupPolicy !== "open" };
|
|
179
|
-
}
|
|
180
|
-
//#endregion
|
|
181
|
-
export { resolveFeishuGroupSenderActivationIngressAccess as a, resolveFeishuGroupConversationIngressAccess as i, resolveFeishuDmIngressAccess as n, resolveFeishuGroupToolPolicy as o, resolveFeishuGroupConfig as r, resolveFeishuReplyPolicy as s, hasExplicitFeishuGroupConfig as t };
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { f as isRecord } from "./accounts-CP4tDW-z.js";
|
|
2
|
-
import { createMessageReceiptFromOutboundResults } from "openclaw/plugin-sdk/channel-message";
|
|
3
|
-
//#region extensions/feishu/src/card-interaction.ts
|
|
4
|
-
const FEISHU_CARD_INTERACTION_VERSION = "ocf1";
|
|
5
|
-
function isInteractionKind(value) {
|
|
6
|
-
return value === "button" || value === "quick" || value === "meta";
|
|
7
|
-
}
|
|
8
|
-
function isMetadataValue(value) {
|
|
9
|
-
return value === null || value === void 0 || typeof value === "string" || typeof value === "number" || typeof value === "boolean";
|
|
10
|
-
}
|
|
11
|
-
function createFeishuCardInteractionEnvelope(envelope) {
|
|
12
|
-
return {
|
|
13
|
-
oc: FEISHU_CARD_INTERACTION_VERSION,
|
|
14
|
-
...envelope
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
function buildFeishuCardActionTextFallback(event) {
|
|
18
|
-
const actionValue = event.action.value;
|
|
19
|
-
if (isRecord(actionValue)) {
|
|
20
|
-
if (typeof actionValue.text === "string") return actionValue.text;
|
|
21
|
-
if (typeof actionValue.command === "string") return actionValue.command;
|
|
22
|
-
return JSON.stringify(actionValue);
|
|
23
|
-
}
|
|
24
|
-
return String(actionValue);
|
|
25
|
-
}
|
|
26
|
-
function decodeFeishuCardAction(params) {
|
|
27
|
-
const { event, now = Date.now() } = params;
|
|
28
|
-
const actionValue = event.action.value;
|
|
29
|
-
if (!isRecord(actionValue) || actionValue.oc !== "ocf1") return {
|
|
30
|
-
kind: "legacy",
|
|
31
|
-
text: buildFeishuCardActionTextFallback(event)
|
|
32
|
-
};
|
|
33
|
-
if (!isInteractionKind(actionValue.k) || typeof actionValue.a !== "string" || !actionValue.a) return {
|
|
34
|
-
kind: "invalid",
|
|
35
|
-
reason: "malformed"
|
|
36
|
-
};
|
|
37
|
-
if (actionValue.q !== void 0 && typeof actionValue.q !== "string") return {
|
|
38
|
-
kind: "invalid",
|
|
39
|
-
reason: "malformed"
|
|
40
|
-
};
|
|
41
|
-
if (actionValue.m !== void 0) {
|
|
42
|
-
if (!isRecord(actionValue.m)) return {
|
|
43
|
-
kind: "invalid",
|
|
44
|
-
reason: "malformed"
|
|
45
|
-
};
|
|
46
|
-
for (const value of Object.values(actionValue.m)) if (!isMetadataValue(value)) return {
|
|
47
|
-
kind: "invalid",
|
|
48
|
-
reason: "malformed"
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
if (actionValue.c !== void 0) {
|
|
52
|
-
if (!isRecord(actionValue.c)) return {
|
|
53
|
-
kind: "invalid",
|
|
54
|
-
reason: "malformed"
|
|
55
|
-
};
|
|
56
|
-
if (actionValue.c.u !== void 0 && typeof actionValue.c.u !== "string") return {
|
|
57
|
-
kind: "invalid",
|
|
58
|
-
reason: "malformed"
|
|
59
|
-
};
|
|
60
|
-
if (actionValue.c.h !== void 0 && typeof actionValue.c.h !== "string") return {
|
|
61
|
-
kind: "invalid",
|
|
62
|
-
reason: "malformed"
|
|
63
|
-
};
|
|
64
|
-
if (actionValue.c.s !== void 0 && typeof actionValue.c.s !== "string") return {
|
|
65
|
-
kind: "invalid",
|
|
66
|
-
reason: "malformed"
|
|
67
|
-
};
|
|
68
|
-
if (actionValue.c.e !== void 0 && !Number.isFinite(actionValue.c.e)) return {
|
|
69
|
-
kind: "invalid",
|
|
70
|
-
reason: "malformed"
|
|
71
|
-
};
|
|
72
|
-
if (actionValue.c.t !== void 0 && actionValue.c.t !== "p2p" && actionValue.c.t !== "group") return {
|
|
73
|
-
kind: "invalid",
|
|
74
|
-
reason: "malformed"
|
|
75
|
-
};
|
|
76
|
-
if (typeof actionValue.c.e === "number" && actionValue.c.e < now) return {
|
|
77
|
-
kind: "invalid",
|
|
78
|
-
reason: "stale"
|
|
79
|
-
};
|
|
80
|
-
const expectedUser = actionValue.c.u?.trim();
|
|
81
|
-
if (expectedUser && expectedUser !== (event.operator.open_id ?? "").trim()) return {
|
|
82
|
-
kind: "invalid",
|
|
83
|
-
reason: "wrong_user"
|
|
84
|
-
};
|
|
85
|
-
const expectedChat = actionValue.c.h?.trim();
|
|
86
|
-
if (expectedChat && expectedChat !== (event.context.chat_id ?? "").trim()) return {
|
|
87
|
-
kind: "invalid",
|
|
88
|
-
reason: "wrong_conversation"
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
return {
|
|
92
|
-
kind: "structured",
|
|
93
|
-
envelope: actionValue
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
//#endregion
|
|
97
|
-
//#region extensions/feishu/src/send-result.ts
|
|
98
|
-
function resolveFeishuReceiptKind(msgType) {
|
|
99
|
-
switch (msgType) {
|
|
100
|
-
case "audio": return "voice";
|
|
101
|
-
case "image":
|
|
102
|
-
case "media":
|
|
103
|
-
case "file": return "media";
|
|
104
|
-
case "interactive": return "card";
|
|
105
|
-
case "post":
|
|
106
|
-
case "text": return "text";
|
|
107
|
-
default: return "unknown";
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
function createFeishuSendReceipt(params) {
|
|
111
|
-
const messageId = params.messageId?.trim();
|
|
112
|
-
const chatId = params.chatId.trim();
|
|
113
|
-
return createMessageReceiptFromOutboundResults({
|
|
114
|
-
results: messageId ? [{
|
|
115
|
-
channel: "feishu",
|
|
116
|
-
messageId,
|
|
117
|
-
chatId,
|
|
118
|
-
conversationId: chatId
|
|
119
|
-
}] : [],
|
|
120
|
-
...chatId ? { threadId: chatId } : {},
|
|
121
|
-
kind: params.kind ?? "unknown"
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
function assertFeishuMessageApiSuccess(response, errorPrefix) {
|
|
125
|
-
if (response.code !== 0) throw new Error(`${errorPrefix}: ${response.msg || `code ${response.code}`}`);
|
|
126
|
-
}
|
|
127
|
-
function toFeishuSendResult(response, chatId, kind) {
|
|
128
|
-
const messageId = response.data?.message_id ?? "unknown";
|
|
129
|
-
return {
|
|
130
|
-
messageId,
|
|
131
|
-
chatId,
|
|
132
|
-
receipt: createFeishuSendReceipt({
|
|
133
|
-
messageId,
|
|
134
|
-
chatId,
|
|
135
|
-
kind
|
|
136
|
-
})
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
//#endregion
|
|
140
|
-
export { FEISHU_CARD_INTERACTION_VERSION as a, decodeFeishuCardAction as c, toFeishuSendResult as i, createFeishuSendReceipt as n, buildFeishuCardActionTextFallback as o, resolveFeishuReceiptKind as r, createFeishuCardInteractionEnvelope as s, assertFeishuMessageApiSuccess as t };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|