@openclaw/feishu 2026.5.24-beta.2 → 2026.5.25-beta.1
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/{accounts-CRcvqpsl.js → accounts-CXnY5H8g.js} +2 -2
- package/dist/api.js +7 -7
- package/dist/{channel-Br99IozO.js → channel-CBVi0Pse.js} +124 -170
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.runtime-C8KEo0lg.js → channel.runtime-qTiXSDEF.js} +65 -102
- package/dist/{drive-DMbtRzY9.js → drive-DwgWWkJi.js} +1 -1
- package/dist/{monitor-CPSt9A7K.js → monitor-OdRQj8yf.js} +2 -2
- package/dist/{monitor.account-CbepO5r8.js → monitor.account-DilSvSo7.js} +66 -83
- package/dist/{send-DxNatQGH.js → send-DQClIwTI.js} +14 -17
- package/dist/send-result-CHvu8Rr7.js +140 -0
- package/dist/setup-api.js +1 -1
- package/node_modules/qs/CHANGELOG.md +178 -0
- package/node_modules/qs/README.md +19 -1
- package/node_modules/qs/dist/qs.js +17 -17
- package/node_modules/qs/eslint.config.mjs +1 -0
- package/node_modules/qs/lib/parse.js +57 -25
- package/node_modules/qs/lib/stringify.js +11 -4
- package/node_modules/qs/lib/utils.js +2 -0
- package/node_modules/qs/package.json +3 -3
- package/node_modules/qs/test/parse.js +195 -4
- package/node_modules/qs/test/stringify.js +138 -0
- package/node_modules/qs/test/utils.js +38 -3
- package/node_modules/ws/lib/receiver.js +54 -0
- package/node_modules/ws/lib/websocket-server.js +8 -0
- package/node_modules/ws/lib/websocket.js +14 -0
- package/node_modules/ws/package.json +1 -1
- package/npm-shrinkwrap.json +9 -9
- package/package.json +4 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import { isRecord, normalizeOptionalString, readStringValue } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
2
|
+
import { isRecord, normalizeOptionalString, normalizeStringEntries, readStringValue } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
3
|
import { DEFAULT_ACCOUNT_ID, createAccountListHelpers, hasConfiguredAccountValue, normalizeAccountId, normalizeOptionalAccountId, resolveMergedAccountConfig } from "openclaw/plugin-sdk/account-resolution";
|
|
4
4
|
import { coerceSecretRef } from "openclaw/plugin-sdk/provider-auth";
|
|
5
5
|
//#region extensions/feishu/src/comment-target.ts
|
|
@@ -125,7 +125,7 @@ function isReasonableFeishuLinkToken(token) {
|
|
|
125
125
|
return typeof token === "string" && token.length >= FEISHU_LINK_TOKEN_MIN_LENGTH && token.length <= FEISHU_LINK_TOKEN_MAX_LENGTH;
|
|
126
126
|
}
|
|
127
127
|
function parseCommentLinkedDocumentPath(pathname) {
|
|
128
|
-
const segments = pathname.split("/")
|
|
128
|
+
const segments = normalizeStringEntries(pathname.split("/"));
|
|
129
129
|
const offset = segments[0]?.toLowerCase() === "space" ? 1 : 0;
|
|
130
130
|
const kind = COMMENT_LINK_KIND_ALIASES.get(segments[offset]?.toLowerCase() ?? "");
|
|
131
131
|
const token = normalizeString(segments[offset + 1]);
|
package/dist/api.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { a as parseFeishuTargetId, i as parseFeishuDirectConversationId, n as buildFeishuModelOverrideParentCandidates, r as parseFeishuConversationId, t as buildFeishuConversationId } from "./conversation-id-DuL575sn.js";
|
|
2
2
|
import { n as getFeishuThreadBindingManager, r as testing, t as createFeishuThreadBindingManager } from "./thread-bindings-D24m3Cjy.js";
|
|
3
3
|
import { n as handleFeishuSubagentEnded, r as handleFeishuSubagentSpawning, t as handleFeishuSubagentDeliveryTarget } from "./subagent-hooks-fuyBHOVu.js";
|
|
4
|
-
import { r as listEnabledFeishuAccounts } from "./accounts-
|
|
5
|
-
import { a as setFeishuNamedAccountEnabled, i as feishuSetupAdapter, n as feishuSetupWizard, r as runFeishuLogin, t as feishuPlugin } from "./channel-
|
|
4
|
+
import { r as listEnabledFeishuAccounts } from "./accounts-CXnY5H8g.js";
|
|
5
|
+
import { a as setFeishuNamedAccountEnabled, i as feishuSetupAdapter, n as feishuSetupWizard, r as runFeishuLogin, t as feishuPlugin } from "./channel-CBVi0Pse.js";
|
|
6
6
|
import { t as getFeishuRuntime } from "./runtime-C5JxBWZp.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-
|
|
8
|
-
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, readStringValue } from "openclaw/plugin-sdk/string-coerce-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-DwgWWkJi.js";
|
|
8
|
+
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, readStringValue, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
9
9
|
import { existsSync } from "node:fs";
|
|
10
10
|
import { homedir } from "node:os";
|
|
11
11
|
import { basename, isAbsolute, resolve } from "node:path";
|
|
@@ -680,7 +680,7 @@ function normalizeConvertedBlockTree(blocks, firstLevelIds) {
|
|
|
680
680
|
const parentId = typeof block?.parent_id === "string" ? block.parent_id : "";
|
|
681
681
|
return !childIds.has(blockId) && (!parentId || !byId.has(parentId));
|
|
682
682
|
}).toSorted((a, b) => (originalOrder.get(a.block_id ?? "__missing__") ?? 0) - (originalOrder.get(b.block_id ?? "__missing__") ?? 0)).map((block) => block.block_id).filter((blockId) => typeof blockId === "string");
|
|
683
|
-
const
|
|
683
|
+
const uniqueRootIds = uniqueStrings((firstLevelIds && firstLevelIds.length > 0 ? firstLevelIds : inferredTopLevelIds).filter((id) => typeof id === "string" && byId.has(id)));
|
|
684
684
|
const orderedBlocks = [];
|
|
685
685
|
const visited = /* @__PURE__ */ new Set();
|
|
686
686
|
const visit = (blockId) => {
|
|
@@ -691,12 +691,12 @@ function normalizeConvertedBlockTree(blocks, firstLevelIds) {
|
|
|
691
691
|
orderedBlocks.push(block);
|
|
692
692
|
for (const childId of normalizeChildIds(block?.children)) visit(childId);
|
|
693
693
|
};
|
|
694
|
-
for (const rootId of
|
|
694
|
+
for (const rootId of uniqueRootIds) visit(rootId);
|
|
695
695
|
for (const block of blocks) if (typeof block?.block_id === "string") visit(block.block_id);
|
|
696
696
|
else orderedBlocks.push(block);
|
|
697
697
|
return {
|
|
698
698
|
orderedBlocks,
|
|
699
|
-
rootIds:
|
|
699
|
+
rootIds: uniqueRootIds
|
|
700
700
|
};
|
|
701
701
|
}
|
|
702
702
|
async function insertBlocks(client, docToken, blocks, parentBlockId, index) {
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { a as parseFeishuTargetId, i as parseFeishuDirectConversationId, n as buildFeishuModelOverrideParentCandidates, r as parseFeishuConversationId, t as buildFeishuConversationId } from "./conversation-id-DuL575sn.js";
|
|
2
2
|
import { n as looksLikeFeishuId, r as normalizeFeishuTarget, t as detectIdType } from "./targets-BUjQ1TcA.js";
|
|
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-
|
|
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-CXnY5H8g.js";
|
|
4
|
+
import { n as createFeishuSendReceipt, s as createFeishuCardInteractionEnvelope } from "./send-result-CHvu8Rr7.js";
|
|
4
5
|
import { t as messageActionTargetAliases } from "./security-audit-BIeA3W3Q.js";
|
|
5
6
|
import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-ChjJKAJ9.js";
|
|
6
7
|
import { t as collectFeishuSecurityAuditFindings } from "./security-audit-shared-BIHeF-S_.js";
|
|
7
8
|
import { t as resolveFeishuSessionConversation } from "./session-conversation-CZSMgac-.js";
|
|
8
|
-
import { normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
9
|
+
import { normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
9
10
|
import { getSessionBindingService } from "openclaw/plugin-sdk/conversation-runtime";
|
|
10
11
|
import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
|
|
11
12
|
import { formatAllowFromLowercase } from "openclaw/plugin-sdk/allow-from";
|
|
12
13
|
import { adaptScopedAccountAccessor, createHybridChannelConfigAdapter } from "openclaw/plugin-sdk/channel-config-helpers";
|
|
13
14
|
import { buildChannelOutboundSessionRoute, createChatChannelPlugin, stripChannelTargetPrefix } from "openclaw/plugin-sdk/channel-core";
|
|
14
|
-
import {
|
|
15
|
+
import { defineChannelMessageAdapter } from "openclaw/plugin-sdk/channel-message";
|
|
15
16
|
import { createPairingPrefixStripper } from "openclaw/plugin-sdk/channel-pairing";
|
|
16
17
|
import { createAllowlistProviderGroupPolicyWarningCollector, projectConfigAccountIdWarningCollector } from "openclaw/plugin-sdk/channel-policy";
|
|
17
18
|
import { createChannelDirectoryAdapter, createRuntimeDirectoryLiveAdapter, listDirectoryGroupEntriesFromMapKeysAndAllowFrom, listDirectoryUserEntriesFromAllowFromAndMapKeys } from "openclaw/plugin-sdk/directory-runtime";
|
|
@@ -50,100 +51,6 @@ const feishuApprovalAuth = createResolvedApproverActionAuthAdapter({
|
|
|
50
51
|
normalizeSenderId: (value) => normalizeFeishuApproverId(value)
|
|
51
52
|
});
|
|
52
53
|
//#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
|
|
147
54
|
//#region extensions/feishu/src/config-schema.ts
|
|
148
55
|
const ChannelActionsSchema = z.object({ reactions: z.boolean().optional() }).strict().optional();
|
|
149
56
|
const DmPolicySchema = z.enum([
|
|
@@ -636,46 +543,120 @@ function resolveFeishuReplyPolicy(params) {
|
|
|
636
543
|
return { requireMention: typeof groupRequireMention === "boolean" ? groupRequireMention : typeof resolvedCfg.requireMention === "boolean" ? resolvedCfg.requireMention : params.groupPolicy !== "open" };
|
|
637
544
|
}
|
|
638
545
|
//#endregion
|
|
639
|
-
//#region extensions/feishu/src/
|
|
640
|
-
function
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
546
|
+
//#region extensions/feishu/src/presentation-card.ts
|
|
547
|
+
function escapeFeishuCardMarkdownText(text) {
|
|
548
|
+
return text.replace(/[&<>]/g, (char) => {
|
|
549
|
+
switch (char) {
|
|
550
|
+
case "&": return "&";
|
|
551
|
+
case "<": return "<";
|
|
552
|
+
case ">": return ">";
|
|
553
|
+
default: return char;
|
|
554
|
+
}
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
function resolveSafeFeishuButtonUrl(url) {
|
|
558
|
+
const trimmed = url?.trim();
|
|
559
|
+
if (!trimmed) return;
|
|
560
|
+
try {
|
|
561
|
+
const parsed = new URL(trimmed);
|
|
562
|
+
return parsed.protocol === "https:" || parsed.protocol === "http:" ? trimmed : void 0;
|
|
563
|
+
} catch {
|
|
564
|
+
return;
|
|
650
565
|
}
|
|
651
566
|
}
|
|
652
|
-
function
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
567
|
+
function resolveFeishuButtonUrl(button) {
|
|
568
|
+
return button.url ?? button.webApp?.url ?? button.web_app?.url;
|
|
569
|
+
}
|
|
570
|
+
function mapFeishuButtonType(style) {
|
|
571
|
+
if (style === "primary" || style === "success") return "primary";
|
|
572
|
+
if (style === "danger") return "danger";
|
|
573
|
+
return "default";
|
|
574
|
+
}
|
|
575
|
+
function buildFeishuPayloadButton(button) {
|
|
576
|
+
const behaviors = [];
|
|
577
|
+
const rendered = {
|
|
578
|
+
tag: "button",
|
|
579
|
+
text: {
|
|
580
|
+
tag: "plain_text",
|
|
581
|
+
content: button.label
|
|
582
|
+
},
|
|
583
|
+
type: mapFeishuButtonType(button.style)
|
|
584
|
+
};
|
|
585
|
+
const url = resolveFeishuButtonUrl(button);
|
|
586
|
+
if (url) {
|
|
587
|
+
const safeUrl = resolveSafeFeishuButtonUrl(url);
|
|
588
|
+
if (safeUrl) behaviors.push({
|
|
589
|
+
type: "open_url",
|
|
590
|
+
default_url: safeUrl
|
|
591
|
+
});
|
|
592
|
+
}
|
|
593
|
+
if (button.value) behaviors.push({
|
|
594
|
+
type: "callback",
|
|
595
|
+
value: createFeishuCardInteractionEnvelope({
|
|
596
|
+
k: "quick",
|
|
597
|
+
a: "feishu.payload.button",
|
|
598
|
+
q: button.value
|
|
599
|
+
})
|
|
664
600
|
});
|
|
601
|
+
if (behaviors.length === 0) return;
|
|
602
|
+
rendered.behaviors = behaviors;
|
|
603
|
+
return rendered;
|
|
604
|
+
}
|
|
605
|
+
function buildFeishuCardElementsForBlock(block) {
|
|
606
|
+
if (block.type === "text") return [{
|
|
607
|
+
tag: "markdown",
|
|
608
|
+
content: escapeFeishuCardMarkdownText(block.text)
|
|
609
|
+
}];
|
|
610
|
+
if (block.type === "context") return [{
|
|
611
|
+
tag: "markdown",
|
|
612
|
+
content: `<font color='grey'>${escapeFeishuCardMarkdownText(block.text)}</font>`
|
|
613
|
+
}];
|
|
614
|
+
if (block.type === "divider") return [{ tag: "hr" }];
|
|
615
|
+
if (block.type === "buttons") return block.buttons.map((button) => buildFeishuPayloadButton(button)).filter((button) => Boolean(button));
|
|
616
|
+
const labels = block.options.map((option) => `- ${option.label}`).join("\n");
|
|
617
|
+
return [{
|
|
618
|
+
tag: "markdown",
|
|
619
|
+
content: `${escapeFeishuCardMarkdownText(block.placeholder?.trim() || "Options")}:\n${escapeFeishuCardMarkdownText(labels)}`
|
|
620
|
+
}];
|
|
621
|
+
}
|
|
622
|
+
function resolvePresentationHeaderTemplate(tone) {
|
|
623
|
+
if (tone === "danger") return "red";
|
|
624
|
+
if (tone === "warning") return "orange";
|
|
625
|
+
if (tone === "success") return "green";
|
|
626
|
+
return "blue";
|
|
627
|
+
}
|
|
628
|
+
function buildFeishuPresentationCardElements(params) {
|
|
629
|
+
const elements = [];
|
|
630
|
+
const fallbackText = params.fallbackText?.trim();
|
|
631
|
+
if (fallbackText) elements.push({
|
|
632
|
+
tag: "markdown",
|
|
633
|
+
content: escapeFeishuCardMarkdownText(fallbackText)
|
|
634
|
+
});
|
|
635
|
+
for (const block of params.presentation.blocks) for (const element of buildFeishuCardElementsForBlock(block)) elements.push(element);
|
|
636
|
+
if (elements.length > 0) return elements;
|
|
637
|
+
return [{
|
|
638
|
+
tag: "markdown",
|
|
639
|
+
content: renderMessagePresentationFallbackText({
|
|
640
|
+
text: params.fallbackText,
|
|
641
|
+
presentation: params.presentation.title ? {
|
|
642
|
+
...params.presentation.tone ? { tone: params.presentation.tone } : {},
|
|
643
|
+
blocks: params.presentation.blocks
|
|
644
|
+
} : params.presentation
|
|
645
|
+
})
|
|
646
|
+
}];
|
|
665
647
|
}
|
|
666
|
-
function
|
|
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";
|
|
648
|
+
function buildFeishuPresentationCard(params) {
|
|
671
649
|
return {
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
650
|
+
schema: "2.0",
|
|
651
|
+
config: { width_mode: "fill" },
|
|
652
|
+
...params.presentation.title ? { header: {
|
|
653
|
+
title: {
|
|
654
|
+
tag: "plain_text",
|
|
655
|
+
content: params.presentation.title
|
|
656
|
+
},
|
|
657
|
+
template: resolvePresentationHeaderTemplate(params.presentation.tone)
|
|
658
|
+
} } : {},
|
|
659
|
+
body: { elements: buildFeishuPresentationCardElements(params) }
|
|
679
660
|
};
|
|
680
661
|
}
|
|
681
662
|
//#endregion
|
|
@@ -756,19 +737,15 @@ const t = createSetupTranslator();
|
|
|
756
737
|
const channel = "feishu";
|
|
757
738
|
const SCAN_TO_CREATE_TP = "ob_cli_app";
|
|
758
739
|
const FEISHU_SETUP_FLOW_KEY = "_flow";
|
|
759
|
-
function normalizeString(value) {
|
|
760
|
-
if (typeof value !== "string") return;
|
|
761
|
-
return value.trim() || void 0;
|
|
762
|
-
}
|
|
763
740
|
function isFeishuConfigured(cfg) {
|
|
764
741
|
const feishuCfg = cfg.channels?.feishu;
|
|
765
742
|
const isAppIdConfigured = (value) => {
|
|
766
|
-
if (
|
|
743
|
+
if (normalizeOptionalString(value)) return true;
|
|
767
744
|
if (!value || typeof value !== "object") return false;
|
|
768
745
|
const rec = value;
|
|
769
|
-
const source =
|
|
770
|
-
const id =
|
|
771
|
-
if (source === "env" && id) return Boolean(
|
|
746
|
+
const source = normalizeOptionalString(rec.source)?.toLowerCase();
|
|
747
|
+
const id = normalizeOptionalString(rec.id);
|
|
748
|
+
if (source === "env" && id) return Boolean(normalizeOptionalString(process.env[id]));
|
|
772
749
|
return hasConfiguredSecretInput$1(value);
|
|
773
750
|
};
|
|
774
751
|
const topLevelConfigured = isAppIdConfigured(feishuCfg?.appId) && hasConfiguredSecretInput$1(feishuCfg?.appSecret);
|
|
@@ -984,7 +961,7 @@ async function runNewAppFlow(params) {
|
|
|
984
961
|
await noteFeishuCredentialHelp(prompter);
|
|
985
962
|
appId = await promptFeishuAppId({
|
|
986
963
|
prompter,
|
|
987
|
-
initialValue:
|
|
964
|
+
initialValue: normalizeOptionalString(process.env.FEISHU_APP_ID)
|
|
988
965
|
});
|
|
989
966
|
const appSecretResult = await promptSingleChannelSecretInput({
|
|
990
967
|
cfg: next,
|
|
@@ -1049,11 +1026,11 @@ async function runEditFlow(params) {
|
|
|
1049
1026
|
const next = params.cfg;
|
|
1050
1027
|
const feishuCfg = next.channels?.feishu;
|
|
1051
1028
|
const resolveAppIdLabel = (value) => {
|
|
1052
|
-
const asString =
|
|
1029
|
+
const asString = normalizeOptionalString(value);
|
|
1053
1030
|
if (asString) return asString;
|
|
1054
1031
|
if (value && typeof value === "object") {
|
|
1055
1032
|
const rec = value;
|
|
1056
|
-
if (
|
|
1033
|
+
if (normalizeOptionalString(rec.source) && normalizeOptionalString(rec.id)) return normalizeOptionalString(process.env[rec.id]) ?? `env:${String(rec.id)}`;
|
|
1057
1034
|
if (hasConfiguredSecretInput$1(value)) return "(configured)";
|
|
1058
1035
|
}
|
|
1059
1036
|
};
|
|
@@ -1177,6 +1154,7 @@ function containsLegacyFeishuCardCommandValue(node) {
|
|
|
1177
1154
|
if (Array.isArray(node)) return node.some((item) => containsLegacyFeishuCardCommandValue(item));
|
|
1178
1155
|
if (!isRecord$1(node)) return false;
|
|
1179
1156
|
if (node.tag === "button" && hasLegacyFeishuCardCommandValue(node.value)) return true;
|
|
1157
|
+
if (node.tag === "button" && Array.isArray(node.behaviors) && node.behaviors.some((behavior) => isRecord$1(behavior) && hasLegacyFeishuCardCommandValue(behavior.value))) return true;
|
|
1180
1158
|
return Object.values(node).some((value) => containsLegacyFeishuCardCommandValue(value));
|
|
1181
1159
|
}
|
|
1182
1160
|
const meta = {
|
|
@@ -1189,7 +1167,7 @@ const meta = {
|
|
|
1189
1167
|
aliases: ["lark"],
|
|
1190
1168
|
order: 70
|
|
1191
1169
|
};
|
|
1192
|
-
const loadFeishuChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-
|
|
1170
|
+
const loadFeishuChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-qTiXSDEF.js"), "feishuChannelRuntime");
|
|
1193
1171
|
function toFeishuMessageSendResult(result, kind) {
|
|
1194
1172
|
const receipt = result.receipt ?? createFeishuSendReceipt({
|
|
1195
1173
|
messageId: result.messageId,
|
|
@@ -1220,30 +1198,6 @@ const feishuMessageAdapter = defineChannelMessageAdapter({
|
|
|
1220
1198
|
}
|
|
1221
1199
|
}
|
|
1222
1200
|
});
|
|
1223
|
-
function buildFeishuPresentationCard(params) {
|
|
1224
|
-
const fallbackPresentation = {
|
|
1225
|
-
...params.presentation.tone ? { tone: params.presentation.tone } : {},
|
|
1226
|
-
blocks: params.presentation.blocks
|
|
1227
|
-
};
|
|
1228
|
-
return {
|
|
1229
|
-
schema: "2.0",
|
|
1230
|
-
config: { width_mode: "fill" },
|
|
1231
|
-
...params.presentation.title ? { header: {
|
|
1232
|
-
title: {
|
|
1233
|
-
tag: "plain_text",
|
|
1234
|
-
content: params.presentation.title
|
|
1235
|
-
},
|
|
1236
|
-
template: "blue"
|
|
1237
|
-
} } : {},
|
|
1238
|
-
body: { elements: [{
|
|
1239
|
-
tag: "markdown",
|
|
1240
|
-
content: renderMessagePresentationFallbackText({
|
|
1241
|
-
text: params.fallbackText,
|
|
1242
|
-
presentation: fallbackPresentation
|
|
1243
|
-
})
|
|
1244
|
-
}] }
|
|
1245
|
-
};
|
|
1246
|
-
}
|
|
1247
1201
|
async function createFeishuActionClient(account) {
|
|
1248
1202
|
const { createFeishuClient } = await import("./client-BnH2fRL2.js").then((n) => n.t);
|
|
1249
1203
|
return createFeishuClient(account);
|
|
@@ -2032,7 +1986,7 @@ const feishuPlugin = createChatChannelPlugin({
|
|
|
2032
1986
|
})
|
|
2033
1987
|
}),
|
|
2034
1988
|
gateway: { startAccount: async (ctx) => {
|
|
2035
|
-
const { monitorFeishuProvider } = await import("./monitor-
|
|
1989
|
+
const { monitorFeishuProvider } = await import("./monitor-OdRQj8yf.js");
|
|
2036
1990
|
const account = resolveFeishuRuntimeAccount({
|
|
2037
1991
|
cfg: ctx.cfg,
|
|
2038
1992
|
accountId: ctx.accountId
|
|
@@ -2112,4 +2066,4 @@ const feishuPlugin = createChatChannelPlugin({
|
|
|
2112
2066
|
}
|
|
2113
2067
|
});
|
|
2114
2068
|
//#endregion
|
|
2115
|
-
export {
|
|
2069
|
+
export { setFeishuNamedAccountEnabled$1 as a, normalizeFeishuAllowEntry as c, resolveFeishuGroupConversationIngressAccess as d, resolveFeishuGroupSenderActivationIngressAccess as f, listFeishuDirectoryPeers as h, feishuSetupAdapter as i, resolveFeishuDmIngressAccess as l, listFeishuDirectoryGroups as m, feishuSetupWizard as n, buildFeishuPresentationCardElements as o, resolveFeishuReplyPolicy as p, runFeishuLogin as r, hasExplicitFeishuGroupConfig as s, feishuPlugin as t, resolveFeishuGroupConfig as u };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as feishuPlugin } from "./channel-
|
|
1
|
+
import { t as feishuPlugin } from "./channel-CBVi0Pse.js";
|
|
2
2
|
export { feishuPlugin };
|