@openclaw/feishu 2026.7.2-beta.1 → 2026.7.2-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 +322 -176
- package/dist/{app-registration-BwQ-aGTe.js → app-registration-BzkyrVZu.js} +11 -11
- package/dist/{channel-DdPQ2HGh.js → channel-X30GQVwc.js} +20 -36
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.runtime-DJ_B-bpG.js → channel.runtime-By2uqa3Q.js} +6 -6
- package/dist/{client-BUC-R2Wi.js → client-87BmeMpj.js} +51 -16
- package/dist/{drive-Bpe8ONK_.js → drive-B4E8OXZ0.js} +2 -2
- package/dist/{monitor-M3iYtoh4.js → monitor-CHl0bWzb.js} +2 -2
- package/dist/{monitor.account-F99J862T.js → monitor.account-BSRV2hIF.js} +90 -91
- package/dist/{monitor.startup-DpZzunQn.js → monitor.startup-Cy8NPGAX.js} +1 -1
- package/dist/{probe-CAloGqgG.js → probe-BgboTHIn.js} +1 -1
- package/dist/{send-CpnLYueT.js → send-DrWM_Ilf.js} +57 -7
- package/dist/{send-result-CPS7AozW.js → send-result-DsqTk27v.js} +9 -5
- package/dist/setup-api.js +1 -1
- package/npm-shrinkwrap.json +3 -3
- package/openclaw.plugin.json +10 -8
- package/package.json +4 -4
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as readFeishuJsonResponse } from "./json-response-CheljwGr.js";
|
|
2
2
|
import { finiteSecondsToTimerSafeMilliseconds } from "openclaw/plugin-sdk/number-runtime";
|
|
3
|
+
import { renderQrTerminal } from "openclaw/plugin-sdk/media-runtime";
|
|
3
4
|
import { sleep } from "openclaw/plugin-sdk/runtime-env";
|
|
4
5
|
import { fetchWithSsrFGuard } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
5
|
-
import { renderQrTerminal } from "openclaw/plugin-sdk/media-runtime";
|
|
6
6
|
//#region extensions/feishu/src/app-registration.ts
|
|
7
7
|
/**
|
|
8
8
|
* Feishu app registration via OAuth device-code flow.
|
|
@@ -14,7 +14,7 @@ import { renderQrTerminal } from "openclaw/plugin-sdk/media-runtime";
|
|
|
14
14
|
const FEISHU_ACCOUNTS_URL = "https://accounts.feishu.cn";
|
|
15
15
|
const LARK_ACCOUNTS_URL = "https://accounts.larksuite.com";
|
|
16
16
|
const REGISTRATION_PATH = "/oauth/v1/app/registration";
|
|
17
|
-
const
|
|
17
|
+
const APP_REGISTRATION_REQUEST_TIMEOUT_MS = 1e4;
|
|
18
18
|
const DEFAULT_REGISTRATION_POLL_INTERVAL_SECONDS = 5;
|
|
19
19
|
const DEFAULT_REGISTRATION_EXPIRE_SECONDS = 600;
|
|
20
20
|
function accountsBaseUrl(domain) {
|
|
@@ -26,20 +26,22 @@ async function postRegistration(baseUrl, body, options) {
|
|
|
26
26
|
init: {
|
|
27
27
|
method: "POST",
|
|
28
28
|
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
29
|
-
body: new URLSearchParams(body).toString()
|
|
30
|
-
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS)
|
|
29
|
+
body: new URLSearchParams(body).toString()
|
|
31
30
|
},
|
|
32
31
|
auditContext: "feishu.app-registration.post",
|
|
33
32
|
fetchImpl: options?.fetchImpl,
|
|
34
|
-
lookupFn: options?.lookupFn
|
|
33
|
+
lookupFn: options?.lookupFn,
|
|
34
|
+
timeoutMs: options?.timeoutMs
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
async function fetchFeishuJson(params) {
|
|
38
|
+
const timeoutMs = params.timeoutMs ?? APP_REGISTRATION_REQUEST_TIMEOUT_MS;
|
|
38
39
|
const { response, release } = await fetchWithSsrFGuard({
|
|
39
40
|
url: params.url,
|
|
40
41
|
init: params.init,
|
|
41
42
|
fetchImpl: params.fetchImpl,
|
|
42
43
|
lookupFn: params.lookupFn,
|
|
44
|
+
timeoutMs,
|
|
43
45
|
policy: { allowedHostnames: [new URL(params.url).hostname] },
|
|
44
46
|
auditContext: params.auditContext
|
|
45
47
|
});
|
|
@@ -90,7 +92,7 @@ async function pollAppRegistration(params) {
|
|
|
90
92
|
let currentInterval = params.interval;
|
|
91
93
|
let domain = initialDomain;
|
|
92
94
|
let domainSwitched = false;
|
|
93
|
-
const expireInMs = finiteSecondsToTimerSafeMilliseconds(expireIn) ??
|
|
95
|
+
const expireInMs = finiteSecondsToTimerSafeMilliseconds(expireIn) ?? DEFAULT_REGISTRATION_EXPIRE_SECONDS * 1e3;
|
|
94
96
|
const deadline = Date.now() + expireInMs;
|
|
95
97
|
while (Date.now() < deadline) {
|
|
96
98
|
if (abortSignal?.aborted) return { status: "timeout" };
|
|
@@ -164,8 +166,7 @@ async function getAppOwnerOpenId(params) {
|
|
|
164
166
|
body: JSON.stringify({
|
|
165
167
|
app_id: params.appId,
|
|
166
168
|
app_secret: params.appSecret
|
|
167
|
-
})
|
|
168
|
-
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS)
|
|
169
|
+
})
|
|
169
170
|
},
|
|
170
171
|
auditContext: "feishu.app-registration.owner-token",
|
|
171
172
|
fetchImpl: params.fetchImpl,
|
|
@@ -179,8 +180,7 @@ async function getAppOwnerOpenId(params) {
|
|
|
179
180
|
headers: {
|
|
180
181
|
Authorization: `Bearer ${tokenData.tenant_access_token}`,
|
|
181
182
|
"Content-Type": "application/json"
|
|
182
|
-
}
|
|
183
|
-
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS)
|
|
183
|
+
}
|
|
184
184
|
},
|
|
185
185
|
auditContext: "feishu.app-registration.owner-app",
|
|
186
186
|
fetchImpl: params.fetchImpl,
|
|
@@ -195,7 +195,7 @@ async function getAppOwnerOpenId(params) {
|
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
197
|
function sleepRegistrationPollInterval(intervalSeconds) {
|
|
198
|
-
return sleep(finiteSecondsToTimerSafeMilliseconds(intervalSeconds) ??
|
|
198
|
+
return sleep(finiteSecondsToTimerSafeMilliseconds(intervalSeconds) ?? DEFAULT_REGISTRATION_POLL_INTERVAL_SECONDS * 1e3);
|
|
199
199
|
}
|
|
200
200
|
//#endregion
|
|
201
201
|
export { beginAppRegistration, getAppOwnerOpenId, initAppRegistration, pollAppRegistration, printQrCode };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as resolveDefaultFeishuAccountId, d as isRecord$1, i as listFeishuAccountIds, n as inspectFeishuCredentials, o as resolveFeishuAccount, r as listEnabledFeishuAccounts, s as resolveFeishuRuntimeAccount } from "./accounts-BDoGHJDk.js";
|
|
2
2
|
import { i as resolveReceiveIdType, n as looksLikeFeishuId, r as normalizeFeishuTarget } from "./targets-BUjQ1TcA.js";
|
|
3
|
-
import {
|
|
3
|
+
import { A as resolveFeishuChatType, D as resolveFeishuGroupToolPolicy, N as createFeishuCardInteractionEnvelope, _ as canEnumerateAllFeishuPeers, a as readNativeFeishuCardJson, b as resolveFeishuChatReadPreliminaryAuthorization, g as canEnumerateAllFeishuGroups, h as authorizeFeishuChatMemberRead, k as normalizeFeishuChatType, m as assertFeishuChatReadAllowed, n as createFeishuSendReceipt, u as chunkFeishuMarkdown, v as isFeishuGroupReadAllowed, w as resolveFeishuGroupConfig, y as isFeishuGroupReadEnabled } from "./send-result-DsqTk27v.js";
|
|
4
4
|
import { a as parseFeishuTargetId, i as parseFeishuDirectConversationId, n as buildFeishuModelOverrideParentCandidates, o as resolveConfiguredFeishuGroupSessionScope, r as parseFeishuConversationId, t as buildFeishuConversationId } from "./conversation-id-BeJL-wq7.js";
|
|
5
5
|
import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-DXH5hux1.js";
|
|
6
6
|
import { t as messageActionTargetAliases } from "./security-audit-BIeA3W3Q.js";
|
|
@@ -27,7 +27,7 @@ import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$2 } from "openclaw/plugin-sdk/
|
|
|
27
27
|
import { createChannelApprovalAuth } from "openclaw/plugin-sdk/approval-auth-runtime";
|
|
28
28
|
import { PAIRING_APPROVED_MESSAGE } from "openclaw/plugin-sdk/channel-status";
|
|
29
29
|
import { normalizeAccountId as normalizeAccountId$1 } from "openclaw/plugin-sdk/account-id";
|
|
30
|
-
import { buildChannelConfigSchema } from "openclaw/plugin-sdk/channel-config-schema";
|
|
30
|
+
import { DmPolicySchema, GroupPolicySchema, buildChannelConfigSchema, buildGroupEntrySchema, buildMultiAccountChannelSchema } from "openclaw/plugin-sdk/channel-config-schema";
|
|
31
31
|
import { z } from "zod";
|
|
32
32
|
import { buildSecretInputSchema, hasConfiguredSecretInput as hasConfiguredSecretInput$2 } from "openclaw/plugin-sdk/secret-input";
|
|
33
33
|
import fs from "node:fs";
|
|
@@ -36,7 +36,7 @@ import path from "node:path";
|
|
|
36
36
|
import { normalizeAgentId } from "openclaw/plugin-sdk/routing";
|
|
37
37
|
import { deleteSessionEntry, isValidAgentHarnessSessionStoreEntry, listSessionEntries, loadTranscriptEventsSync, parseSqliteSessionFileMarker, resolveSessionStoreBackupPaths, resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
|
|
38
38
|
import { resolveStateDir } from "openclaw/plugin-sdk/state-paths";
|
|
39
|
-
import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1, createSetupTranslator, formatDocsLink, hasConfiguredSecretInput as hasConfiguredSecretInput$1, mergeAllowFromEntries, patchTopLevelChannelConfigSection, promptSingleChannelSecretInput, splitSetupEntries } from "openclaw/plugin-sdk/setup";
|
|
39
|
+
import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1, createSetupTranslator, formatDocsLink, hasConfiguredSecretInput as hasConfiguredSecretInput$1, mergeAllowFromEntries, patchTopLevelChannelConfigSection, promptSingleChannelSecretInput, setSetupChannelEnabled, splitSetupEntries } from "openclaw/plugin-sdk/setup";
|
|
40
40
|
//#region extensions/feishu/src/approval-auth.ts
|
|
41
41
|
function normalizeFeishuApproverId(value) {
|
|
42
42
|
const trimmed = normalizeOptionalLowercaseString(normalizeFeishuTarget(String(value)));
|
|
@@ -55,16 +55,7 @@ const feishuApprovalAuth = createChannelApprovalAuth({
|
|
|
55
55
|
//#endregion
|
|
56
56
|
//#region extensions/feishu/src/config-schema.ts
|
|
57
57
|
const ChannelActionsSchema = z.object({ reactions: z.boolean().optional() }).strict().optional();
|
|
58
|
-
const
|
|
59
|
-
"open",
|
|
60
|
-
"pairing",
|
|
61
|
-
"allowlist"
|
|
62
|
-
]);
|
|
63
|
-
const GroupPolicySchema = z.union([z.enum([
|
|
64
|
-
"open",
|
|
65
|
-
"allowlist",
|
|
66
|
-
"disabled"
|
|
67
|
-
]), z.literal("allowall").transform(() => "open")]);
|
|
58
|
+
const FeishuGroupPolicySchema = z.union([GroupPolicySchema, z.literal("allowall").transform(() => "open")]);
|
|
68
59
|
const FeishuDomainSchema = z.union([z.enum(["feishu", "lark"]), z.string().url().startsWith("https://")]);
|
|
69
60
|
const FeishuConnectionModeSchema = z.enum(["websocket", "webhook"]);
|
|
70
61
|
const TtsOverrideSchema = z.object({
|
|
@@ -196,17 +187,12 @@ const ReactionNotificationModeSchema = z.enum([
|
|
|
196
187
|
* causing the reply to appear as a topic (话题) under the original message.
|
|
197
188
|
*/
|
|
198
189
|
const ReplyInThreadSchema = z.enum(["disabled", "enabled"]).optional();
|
|
199
|
-
const FeishuGroupSchema =
|
|
200
|
-
requireMention: z.boolean().optional(),
|
|
190
|
+
const FeishuGroupSchema = buildGroupEntrySchema({
|
|
201
191
|
tools: ToolPolicySchema,
|
|
202
|
-
skills: z.array(z.string()).optional(),
|
|
203
|
-
enabled: z.boolean().optional(),
|
|
204
|
-
allowFrom: z.array(z.union([z.string(), z.number()])).optional(),
|
|
205
|
-
systemPrompt: z.string().optional(),
|
|
206
192
|
groupSessionScope: GroupSessionScopeSchema,
|
|
207
193
|
topicSessionMode: TopicSessionModeSchema,
|
|
208
194
|
replyInThread: ReplyInThreadSchema
|
|
209
|
-
}).
|
|
195
|
+
}).omit({ toolsBySender: true });
|
|
210
196
|
const FeishuSharedConfigShape = {
|
|
211
197
|
webhookHost: z.string().optional(),
|
|
212
198
|
webhookPort: z.number().int().positive().optional(),
|
|
@@ -215,7 +201,7 @@ const FeishuSharedConfigShape = {
|
|
|
215
201
|
configWrites: z.boolean().optional(),
|
|
216
202
|
dmPolicy: DmPolicySchema.optional(),
|
|
217
203
|
allowFrom: z.array(z.union([z.string(), z.number()])).optional(),
|
|
218
|
-
groupPolicy:
|
|
204
|
+
groupPolicy: FeishuGroupPolicySchema.optional(),
|
|
219
205
|
groupAllowFrom: z.array(z.union([z.string(), z.number()])).optional(),
|
|
220
206
|
groupSenderAllowFrom: z.array(z.union([z.string(), z.number()])).optional(),
|
|
221
207
|
requireMention: z.boolean().optional(),
|
|
@@ -255,7 +241,7 @@ const FeishuAccountConfigSchema = z.object({
|
|
|
255
241
|
groupSessionScope: GroupSessionScopeSchema,
|
|
256
242
|
topicSessionMode: TopicSessionModeSchema
|
|
257
243
|
}).strict();
|
|
258
|
-
const FeishuChannelConfigSchema = buildChannelConfigSchema(z.object({
|
|
244
|
+
const FeishuChannelConfigSchema = buildChannelConfigSchema(buildMultiAccountChannelSchema(z.object({
|
|
259
245
|
enabled: z.boolean().optional(),
|
|
260
246
|
defaultAccount: z.string().optional(),
|
|
261
247
|
appId: z.string().optional(),
|
|
@@ -268,15 +254,17 @@ const FeishuChannelConfigSchema = buildChannelConfigSchema(z.object({
|
|
|
268
254
|
...FeishuSharedConfigShape,
|
|
269
255
|
dmPolicy: DmPolicySchema.optional().default("pairing"),
|
|
270
256
|
reactionNotifications: ReactionNotificationModeSchema.optional().default("own"),
|
|
271
|
-
groupPolicy:
|
|
257
|
+
groupPolicy: FeishuGroupPolicySchema.optional().default("allowlist"),
|
|
272
258
|
requireMention: z.boolean().optional(),
|
|
273
259
|
groupSessionScope: GroupSessionScopeSchema,
|
|
274
260
|
topicSessionMode: TopicSessionModeSchema,
|
|
275
261
|
dynamicAgentCreation: DynamicAgentCreationSchema,
|
|
276
262
|
typingIndicator: z.boolean().optional().default(true),
|
|
277
|
-
resolveSenderNames: z.boolean().optional().default(true)
|
|
278
|
-
|
|
279
|
-
|
|
263
|
+
resolveSenderNames: z.boolean().optional().default(true)
|
|
264
|
+
}).strict(), {
|
|
265
|
+
accountSchema: FeishuAccountConfigSchema,
|
|
266
|
+
optionalAccount: true
|
|
267
|
+
}).superRefine((value, ctx) => {
|
|
280
268
|
const defaultAccount = value.defaultAccount?.trim();
|
|
281
269
|
if (defaultAccount && value.accounts && Object.keys(value.accounts).length > 0) {
|
|
282
270
|
const normalizedDefaultAccount = normalizeAccountId$1(defaultAccount);
|
|
@@ -1381,7 +1369,7 @@ function applyNewAppSecurityPolicy(cfg, accountId, openId, groupPolicy) {
|
|
|
1381
1369
|
next = patchFeishuConfig(next, accountId, groupPatch);
|
|
1382
1370
|
return next;
|
|
1383
1371
|
}
|
|
1384
|
-
const loadAppRegistrationModule = createLazyRuntimeModule(() => import("./app-registration-
|
|
1372
|
+
const loadAppRegistrationModule = createLazyRuntimeModule(() => import("./app-registration-BzkyrVZu.js"));
|
|
1385
1373
|
async function promptFeishuDomain(params) {
|
|
1386
1374
|
return await params.prompter.select({
|
|
1387
1375
|
message: t("wizard.feishu.domainPrompt"),
|
|
@@ -1606,7 +1594,7 @@ const feishuSetupWizard = {
|
|
|
1606
1594
|
});
|
|
1607
1595
|
let probeResult = null;
|
|
1608
1596
|
if (configured && account.configured) try {
|
|
1609
|
-
const { probeFeishu } = await import("./probe-
|
|
1597
|
+
const { probeFeishu } = await import("./probe-BgboTHIn.js").then((n) => n.n);
|
|
1610
1598
|
probeResult = await probeFeishu(account);
|
|
1611
1599
|
} catch {}
|
|
1612
1600
|
if (!configured) return [formatFeishuStatusLine("needs-credentials")];
|
|
@@ -1642,11 +1630,7 @@ const feishuSetupWizard = {
|
|
|
1642
1630
|
});
|
|
1643
1631
|
},
|
|
1644
1632
|
dmPolicy: feishuDmPolicy,
|
|
1645
|
-
disable: (cfg) =>
|
|
1646
|
-
cfg,
|
|
1647
|
-
channel,
|
|
1648
|
-
patch: { enabled: false }
|
|
1649
|
-
})
|
|
1633
|
+
disable: (cfg) => setSetupChannelEnabled(cfg, channel, false)
|
|
1650
1634
|
};
|
|
1651
1635
|
//#endregion
|
|
1652
1636
|
//#region extensions/feishu/src/channel.ts
|
|
@@ -1682,7 +1666,7 @@ const meta = {
|
|
|
1682
1666
|
order: 70,
|
|
1683
1667
|
preferSessionLookupForAnnounceTarget: true
|
|
1684
1668
|
};
|
|
1685
|
-
const loadFeishuChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-
|
|
1669
|
+
const loadFeishuChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-By2uqa3Q.js"), "feishuChannelRuntime");
|
|
1686
1670
|
function toFeishuMessageSendResult(result, kind) {
|
|
1687
1671
|
const receipt = result.receipt ?? createFeishuSendReceipt({
|
|
1688
1672
|
messageId: result.messageId,
|
|
@@ -1726,7 +1710,7 @@ const feishuMessageAdapter = defineChannelMessageAdapter({
|
|
|
1726
1710
|
}
|
|
1727
1711
|
});
|
|
1728
1712
|
async function createFeishuActionClient(account) {
|
|
1729
|
-
const { createFeishuClient } = await import("./client-
|
|
1713
|
+
const { createFeishuClient } = await import("./client-87BmeMpj.js").then((n) => n.t);
|
|
1730
1714
|
return createFeishuClient(account);
|
|
1731
1715
|
}
|
|
1732
1716
|
async function resolveFeishuChatTypeById(params) {
|
|
@@ -2771,7 +2755,7 @@ const feishuPlugin = createChatChannelPlugin({
|
|
|
2771
2755
|
})
|
|
2772
2756
|
}),
|
|
2773
2757
|
gateway: { startAccount: async (ctx) => {
|
|
2774
|
-
const { monitorFeishuProvider } = await import("./monitor-
|
|
2758
|
+
const { monitorFeishuProvider } = await import("./monitor-CHl0bWzb.js");
|
|
2775
2759
|
const account = resolveFeishuRuntimeAccount({
|
|
2776
2760
|
cfg: ctx.cfg,
|
|
2777
2761
|
accountId: ctx.accountId
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as feishuPlugin } from "./channel-
|
|
1
|
+
import { t as feishuPlugin } from "./channel-X30GQVwc.js";
|
|
2
2
|
export { feishuPlugin };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { o as resolveFeishuAccount, s as resolveFeishuRuntimeAccount, v as parseFeishuCommentTarget } from "./accounts-BDoGHJDk.js";
|
|
2
|
-
import { c as isFeishuCardWithinEnvelope, l as listFeishuDirectoryGroups, o as assertFeishuCardWithinEnvelope, s as buildFeishuPresentationCardElements, u as listFeishuDirectoryPeers } from "./channel-
|
|
3
|
-
import { a as readNativeFeishuCardJson, d as chunkFeishuPostMarkdown, f as materializeFeishuPostMarkdownSoftBreaks, o as resolveFeishuCardTemplate, s as sanitizeNativeFeishuCard, u as chunkFeishuMarkdown } from "./send-result-
|
|
4
|
-
import { r as createFeishuClient } from "./client-
|
|
5
|
-
import { c as buildFeishuDirectChatMembers, d as getFeishuMemberInfo, l as getChatInfo, r as cleanupAmbientCommentTypingReaction, s as assertFeishuChatMember, t as deliverCommentThreadText, u as getChatMembers } from "./drive-
|
|
6
|
-
import { a as sendMarkdownCardFeishu, h as shouldSuppressFeishuTextForVoiceMedia, i as sendCardFeishu, m as sendMediaFeishu, n as getMessageFeishu, o as sendMessageFeishu, s as sendStructuredCardFeishu, t as editMessageFeishu, v as resolveFeishuIdentityHeaderTitle } from "./send-
|
|
7
|
-
import { t as probeFeishu } from "./probe-
|
|
2
|
+
import { c as isFeishuCardWithinEnvelope, l as listFeishuDirectoryGroups, o as assertFeishuCardWithinEnvelope, s as buildFeishuPresentationCardElements, u as listFeishuDirectoryPeers } from "./channel-X30GQVwc.js";
|
|
3
|
+
import { a as readNativeFeishuCardJson, d as chunkFeishuPostMarkdown, f as materializeFeishuPostMarkdownSoftBreaks, o as resolveFeishuCardTemplate, s as sanitizeNativeFeishuCard, u as chunkFeishuMarkdown } from "./send-result-DsqTk27v.js";
|
|
4
|
+
import { r as createFeishuClient } from "./client-87BmeMpj.js";
|
|
5
|
+
import { c as buildFeishuDirectChatMembers, d as getFeishuMemberInfo, l as getChatInfo, r as cleanupAmbientCommentTypingReaction, s as assertFeishuChatMember, t as deliverCommentThreadText, u as getChatMembers } from "./drive-B4E8OXZ0.js";
|
|
6
|
+
import { a as sendMarkdownCardFeishu, h as shouldSuppressFeishuTextForVoiceMedia, i as sendCardFeishu, m as sendMediaFeishu, n as getMessageFeishu, o as sendMessageFeishu, s as sendStructuredCardFeishu, t as editMessageFeishu, v as resolveFeishuIdentityHeaderTitle } from "./send-DrWM_Ilf.js";
|
|
7
|
+
import { t as probeFeishu } from "./probe-BgboTHIn.js";
|
|
8
8
|
import { createReplyToFanout } from "openclaw/plugin-sdk/channel-outbound";
|
|
9
9
|
import { interactiveReplyToPresentation, normalizeInteractiveReply, normalizeMessagePresentation, renderMessagePresentationFallbackText, resolveInteractiveTextFallback } from "openclaw/plugin-sdk/interactive-runtime";
|
|
10
10
|
import { isRecord, normalizeLowercaseStringOrEmpty, normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -62,8 +62,28 @@ function setRequestUserAgent(req) {
|
|
|
62
62
|
return req;
|
|
63
63
|
}
|
|
64
64
|
Lark.defaultHttpInstance.interceptors?.request?.use(setRequestUserAgent);
|
|
65
|
-
|
|
66
|
-
return
|
|
65
|
+
function isManagedProxyActive() {
|
|
66
|
+
return process.env["OPENCLAW_PROXY_ACTIVE"] === "1";
|
|
67
|
+
}
|
|
68
|
+
let cachedFeishuProxyAgent;
|
|
69
|
+
let pendingFeishuProxyAgent;
|
|
70
|
+
async function getFeishuProxyAgent() {
|
|
71
|
+
if (cachedFeishuProxyAgent) return cachedFeishuProxyAgent;
|
|
72
|
+
if (pendingFeishuProxyAgent) return pendingFeishuProxyAgent;
|
|
73
|
+
let resolutionError;
|
|
74
|
+
const pending = resolveAmbientNodeProxyAgent({ onError: (error) => {
|
|
75
|
+
resolutionError = error;
|
|
76
|
+
} }).then((agent) => {
|
|
77
|
+
if (!agent && isManagedProxyActive()) throw new Error("Feishu managed proxy is active but no proxy agent could be created", { cause: resolutionError });
|
|
78
|
+
cachedFeishuProxyAgent = agent;
|
|
79
|
+
return agent;
|
|
80
|
+
});
|
|
81
|
+
pendingFeishuProxyAgent = pending;
|
|
82
|
+
try {
|
|
83
|
+
return await pending;
|
|
84
|
+
} finally {
|
|
85
|
+
if (pendingFeishuProxyAgent === pending) pendingFeishuProxyAgent = void 0;
|
|
86
|
+
}
|
|
67
87
|
}
|
|
68
88
|
const clientCache = /* @__PURE__ */ new Map();
|
|
69
89
|
function resolveDomain(domain) {
|
|
@@ -74,25 +94,38 @@ function resolveDomain(domain) {
|
|
|
74
94
|
/**
|
|
75
95
|
* Create an HTTP instance that delegates to the Lark SDK's default instance
|
|
76
96
|
* but injects a default request timeout and User-Agent header to prevent
|
|
77
|
-
* indefinite hangs
|
|
97
|
+
* indefinite hangs, set a standardized User-Agent per OAPI best practices, and
|
|
98
|
+
* keep axios from taking a separate ambient proxy path for HTTPS requests.
|
|
78
99
|
*/
|
|
79
|
-
function
|
|
100
|
+
function createFeishuHttpInstance(defaultTimeoutMs) {
|
|
80
101
|
const base = feishuClientSdk.defaultHttpInstance;
|
|
81
|
-
function
|
|
82
|
-
|
|
102
|
+
async function injectRequestOptions(opts) {
|
|
103
|
+
const next = {
|
|
83
104
|
timeout: defaultTimeoutMs,
|
|
84
105
|
...opts
|
|
85
106
|
};
|
|
107
|
+
const agent = await getFeishuProxyAgent();
|
|
108
|
+
if (agent) {
|
|
109
|
+
if (isManagedProxyActive()) {
|
|
110
|
+
next.httpAgent = agent;
|
|
111
|
+
next.httpsAgent = agent;
|
|
112
|
+
} else {
|
|
113
|
+
next.httpAgent ??= agent;
|
|
114
|
+
next.httpsAgent ??= agent;
|
|
115
|
+
}
|
|
116
|
+
next.proxy = false;
|
|
117
|
+
}
|
|
118
|
+
return next;
|
|
86
119
|
}
|
|
87
120
|
return {
|
|
88
|
-
request: (opts) => base.request(
|
|
89
|
-
get: (url, opts) => base.get(url,
|
|
90
|
-
post: (url, data, opts) => base.post(url, data,
|
|
91
|
-
put: (url, data, opts) => base.put(url, data,
|
|
92
|
-
patch: (url, data, opts) => base.patch(url, data,
|
|
93
|
-
delete: (url, opts) => base.delete(url,
|
|
94
|
-
head: (url, opts) => base.head(url,
|
|
95
|
-
options: (url, opts) => base.options(url,
|
|
121
|
+
request: async (opts) => base.request(await injectRequestOptions(opts)),
|
|
122
|
+
get: async (url, opts) => base.get(url, await injectRequestOptions(opts)),
|
|
123
|
+
post: async (url, data, opts) => base.post(url, data, await injectRequestOptions(opts)),
|
|
124
|
+
put: async (url, data, opts) => base.put(url, data, await injectRequestOptions(opts)),
|
|
125
|
+
patch: async (url, data, opts) => base.patch(url, data, await injectRequestOptions(opts)),
|
|
126
|
+
delete: async (url, opts) => base.delete(url, await injectRequestOptions(opts)),
|
|
127
|
+
head: async (url, opts) => base.head(url, await injectRequestOptions(opts)),
|
|
128
|
+
options: async (url, opts) => base.options(url, await injectRequestOptions(opts))
|
|
96
129
|
};
|
|
97
130
|
}
|
|
98
131
|
/**
|
|
@@ -110,7 +143,7 @@ function createFeishuClient(creds) {
|
|
|
110
143
|
appSecret,
|
|
111
144
|
appType: feishuClientSdk.AppType.SelfBuild,
|
|
112
145
|
domain: resolveDomain(domain),
|
|
113
|
-
httpInstance:
|
|
146
|
+
httpInstance: createFeishuHttpInstance(defaultHttpTimeoutMs)
|
|
114
147
|
});
|
|
115
148
|
clientCache.set(accountId, {
|
|
116
149
|
client,
|
|
@@ -130,11 +163,13 @@ function createFeishuClient(creds) {
|
|
|
130
163
|
async function createFeishuWSClient(account, callbacks = {}) {
|
|
131
164
|
const { accountId, appId, appSecret, domain } = account;
|
|
132
165
|
if (!appId || !appSecret) throw new Error(`Feishu credentials not configured for account "${accountId}"`);
|
|
133
|
-
const agent = await
|
|
166
|
+
const agent = await getFeishuProxyAgent();
|
|
167
|
+
const defaultHttpTimeoutMs = resolveConfiguredHttpTimeoutMs(account);
|
|
134
168
|
return new feishuClientSdk.WSClient({
|
|
135
169
|
appId,
|
|
136
170
|
appSecret,
|
|
137
171
|
domain: resolveDomain(domain),
|
|
172
|
+
httpInstance: createFeishuHttpInstance(defaultHttpTimeoutMs),
|
|
138
173
|
...callbacks,
|
|
139
174
|
loggerLevel: feishuClientSdk.LoggerLevel.info,
|
|
140
175
|
wsConfig: FEISHU_WS_CONFIG,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { c as encodeQuery, d as isRecord$1, i as listFeishuAccountIds, l as extractReplyText, m as readString, o as resolveFeishuAccount, r as listEnabledFeishuAccounts, s as resolveFeishuRuntimeAccount, u as formatFeishuApiError, v as parseFeishuCommentTarget } from "./accounts-BDoGHJDk.js";
|
|
2
|
-
import {
|
|
3
|
-
import { r as createFeishuClient } from "./client-
|
|
2
|
+
import { A as resolveFeishuChatType, b as resolveFeishuChatReadPreliminaryAuthorization, h as authorizeFeishuChatMemberRead, m as assertFeishuChatReadAllowed } from "./send-result-DsqTk27v.js";
|
|
3
|
+
import { r as createFeishuClient } from "./client-87BmeMpj.js";
|
|
4
4
|
import { optionalPositiveIntegerSchema } from "openclaw/plugin-sdk/channel-actions";
|
|
5
5
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
6
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { r as listEnabledFeishuAccounts, s as resolveFeishuRuntimeAccount } from "./accounts-BDoGHJDk.js";
|
|
2
|
-
import { t as fetchBotIdentityForMonitor } from "./monitor.startup-
|
|
2
|
+
import { t as fetchBotIdentityForMonitor } from "./monitor.startup-Cy8NPGAX.js";
|
|
3
3
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
4
4
|
//#region extensions/feishu/src/monitor.ts
|
|
5
|
-
const loadMonitorAccountRuntime = createLazyRuntimeModule(() => import("./monitor.account-
|
|
5
|
+
const loadMonitorAccountRuntime = createLazyRuntimeModule(() => import("./monitor.account-BSRV2hIF.js"));
|
|
6
6
|
async function monitorFeishuProvider(opts = {}) {
|
|
7
7
|
const cfg = opts.config;
|
|
8
8
|
if (!cfg) throw new Error("Config is required for Feishu monitor");
|