@openclaw/feishu 2026.5.12-beta.8 → 2026.5.14-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/api.js +3 -3
- package/dist/{channel-COlXCApz.js → channel-D6lD7M4a.js} +2 -2
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.runtime-Bt1Lk06Y.js → channel.runtime-Bz77cRNh.js} +1 -1
- package/dist/{monitor-BZgAq8ET.js → monitor-CxjMmMIW.js} +1 -1
- package/dist/{monitor.account-CI4_rDnC.js → monitor.account-IU61mk0S.js} +55 -28
- package/dist/{send-DiFpqzBJ.js → send-BaiuDxKG.js} +34 -34
- package/dist/setup-api.js +1 -1
- package/package.json +4 -4
package/dist/api.js
CHANGED
|
@@ -2,7 +2,7 @@ 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-
|
|
5
|
+
import { a as setFeishuNamedAccountEnabled, i as feishuSetupAdapter, n as feishuSetupWizard, r as runFeishuLogin, t as feishuPlugin } from "./channel-D6lD7M4a.js";
|
|
6
6
|
import { t as getFeishuRuntime } from "./runtime-CG0DuRCy.js";
|
|
7
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-BocW3yO6.js";
|
|
8
8
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, readStringValue } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -861,7 +861,7 @@ async function uploadImageToDocx(client, blockId, imageBuffer, fileName, docToke
|
|
|
861
861
|
return fileToken;
|
|
862
862
|
}
|
|
863
863
|
async function downloadImage(url, maxBytes) {
|
|
864
|
-
return (await getFeishuRuntime().channel.media.
|
|
864
|
+
return (await getFeishuRuntime().channel.media.readRemoteMediaBuffer({
|
|
865
865
|
url,
|
|
866
866
|
maxBytes
|
|
867
867
|
})).buffer;
|
|
@@ -921,7 +921,7 @@ async function resolveUploadInput(url, filePath, maxBytes, localRoots, explicitF
|
|
|
921
921
|
if (!url && !filePath) throw new Error("Either url, file_path, or image (base64/data URI) must be provided");
|
|
922
922
|
if (url && filePath) throw new Error("Provide only one of url or file_path");
|
|
923
923
|
if (url) {
|
|
924
|
-
const fetched = await getFeishuRuntime().channel.media.
|
|
924
|
+
const fetched = await getFeishuRuntime().channel.media.readRemoteMediaBuffer({
|
|
925
925
|
url,
|
|
926
926
|
maxBytes
|
|
927
927
|
});
|
|
@@ -832,7 +832,7 @@ const meta = {
|
|
|
832
832
|
aliases: ["lark"],
|
|
833
833
|
order: 70
|
|
834
834
|
};
|
|
835
|
-
const loadFeishuChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-
|
|
835
|
+
const loadFeishuChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-Bz77cRNh.js"), "feishuChannelRuntime");
|
|
836
836
|
function toFeishuMessageSendResult(result, kind) {
|
|
837
837
|
const receipt = result.receipt ?? createFeishuSendReceipt({
|
|
838
838
|
messageId: result.messageId,
|
|
@@ -1675,7 +1675,7 @@ const feishuPlugin = createChatChannelPlugin({
|
|
|
1675
1675
|
})
|
|
1676
1676
|
}),
|
|
1677
1677
|
gateway: { startAccount: async (ctx) => {
|
|
1678
|
-
const { monitorFeishuProvider } = await import("./monitor-
|
|
1678
|
+
const { monitorFeishuProvider } = await import("./monitor-CxjMmMIW.js");
|
|
1679
1679
|
const account = resolveFeishuRuntimeAccount({
|
|
1680
1680
|
cfg: ctx.cfg,
|
|
1681
1681
|
accountId: ctx.accountId
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as feishuPlugin } from "./channel-
|
|
1
|
+
import { t as feishuPlugin } from "./channel-D6lD7M4a.js";
|
|
2
2
|
export { feishuPlugin };
|
|
@@ -4,7 +4,7 @@ import { n as listFeishuDirectoryPeers, t as listFeishuDirectoryGroups } from ".
|
|
|
4
4
|
import { r as createFeishuClient } from "./client-DBVoQL5w.js";
|
|
5
5
|
import { c as getChatInfo, l as getChatMembers, r as cleanupAmbientCommentTypingReaction, t as deliverCommentThreadText, u as getFeishuMemberInfo } from "./drive-BocW3yO6.js";
|
|
6
6
|
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-
|
|
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-BaiuDxKG.js";
|
|
8
8
|
import { t as probeFeishu } from "./probe-BNzzU_uR.js";
|
|
9
9
|
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
10
10
|
import { interactiveReplyToPresentation, normalizeInteractiveReply, normalizeMessagePresentation, renderMessagePresentationFallbackText, resolveInteractiveTextFallback } from "openclaw/plugin-sdk/interactive-runtime";
|
|
@@ -3,7 +3,7 @@ import { l as fetchBotIdentityForMonitor } from "./monitor.state-D1WkvOGG.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-IU61mk0S.js");
|
|
7
7
|
return await monitorAccountRuntimePromise;
|
|
8
8
|
}
|
|
9
9
|
async function monitorFeishuProvider(opts = {}) {
|
|
@@ -8,7 +8,7 @@ import { t as getFeishuRuntime } from "./runtime-CG0DuRCy.js";
|
|
|
8
8
|
import { a as getFeishuUserAgent, i as createFeishuWSClient, n as createEventDispatcher, r as createFeishuClient } from "./client-DBVoQL5w.js";
|
|
9
9
|
import { c as getChatInfo, i as createCommentTypingReactionLifecycle, t as deliverCommentThreadText } from "./drive-BocW3yO6.js";
|
|
10
10
|
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
|
|
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-BaiuDxKG.js";
|
|
12
12
|
import { i as waitForAbortableDelay, r as raceWithTimeoutAndAbort } from "./probe-BNzzU_uR.js";
|
|
13
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-D1WkvOGG.js";
|
|
14
14
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -23,7 +23,7 @@ import path from "node:path";
|
|
|
23
23
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
24
24
|
import * as Lark from "@larksuiteoapi/node-sdk";
|
|
25
25
|
import { createPersistentDedupe } from "openclaw/plugin-sdk/persistent-dedupe";
|
|
26
|
-
import { applyBasicWebhookRequestGuards } from "openclaw/plugin-sdk/webhook-ingress";
|
|
26
|
+
import { applyBasicWebhookRequestGuards, resolveRequestClientIp } from "openclaw/plugin-sdk/webhook-ingress";
|
|
27
27
|
import { fetchWithSsrFGuard } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
28
28
|
import { resolveSendableOutboundReplyParts, resolveTextChunksWithFallback, sendMediaWithLeadingCaption } from "openclaw/plugin-sdk/reply-payload";
|
|
29
29
|
import { safeEqualSecret } from "openclaw/plugin-sdk/security-runtime";
|
|
@@ -220,6 +220,12 @@ function parseMediaKeys(content, messageType) {
|
|
|
220
220
|
function toMessageResourceType(messageType) {
|
|
221
221
|
return messageType === "image" ? "image" : "file";
|
|
222
222
|
}
|
|
223
|
+
async function resolveSavedFeishuMedia(params) {
|
|
224
|
+
if ("saved" in params.result) return params.result.saved;
|
|
225
|
+
const core = getFeishuRuntime();
|
|
226
|
+
const contentType = params.result.contentType ?? await core.media.detectMime({ buffer: params.result.buffer });
|
|
227
|
+
return await core.channel.media.saveMediaBuffer(params.result.buffer, contentType, "inbound", params.maxBytes, params.result.fileName ?? params.originalFilename);
|
|
228
|
+
}
|
|
223
229
|
function inferPlaceholder(messageType) {
|
|
224
230
|
switch (messageType) {
|
|
225
231
|
case "image": return "<media:image>";
|
|
@@ -243,22 +249,23 @@ async function resolveFeishuMediaList(params) {
|
|
|
243
249
|
"post"
|
|
244
250
|
].includes(messageType)) return [];
|
|
245
251
|
const out = [];
|
|
246
|
-
const core = getFeishuRuntime();
|
|
247
252
|
if (messageType === "post") {
|
|
248
253
|
const { imageKeys, mediaKeys } = parsePostContent(content);
|
|
249
254
|
if (imageKeys.length === 0 && mediaKeys.length === 0) return [];
|
|
250
255
|
if (imageKeys.length > 0) log?.(`feishu: post message contains ${imageKeys.length} embedded image(s)`);
|
|
251
256
|
if (mediaKeys.length > 0) log?.(`feishu: post message contains ${mediaKeys.length} embedded media file(s)`);
|
|
252
257
|
for (const imageKey of imageKeys) try {
|
|
253
|
-
const
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
258
|
+
const saved = await resolveSavedFeishuMedia({
|
|
259
|
+
result: await saveMessageResourceFeishu({
|
|
260
|
+
cfg,
|
|
261
|
+
messageId,
|
|
262
|
+
fileKey: imageKey,
|
|
263
|
+
type: "image",
|
|
264
|
+
accountId,
|
|
265
|
+
maxBytes
|
|
266
|
+
}),
|
|
267
|
+
maxBytes
|
|
259
268
|
});
|
|
260
|
-
const contentType = result.contentType ?? await core.media.detectMime({ buffer: result.buffer });
|
|
261
|
-
const saved = await core.channel.media.saveMediaBuffer(result.buffer, contentType, "inbound", maxBytes);
|
|
262
269
|
out.push({
|
|
263
270
|
path: saved.path,
|
|
264
271
|
contentType: saved.contentType,
|
|
@@ -269,15 +276,19 @@ async function resolveFeishuMediaList(params) {
|
|
|
269
276
|
log?.(`feishu: failed to download embedded image ${imageKey}: ${String(err)}`);
|
|
270
277
|
}
|
|
271
278
|
for (const media of mediaKeys) try {
|
|
272
|
-
const
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
279
|
+
const saved = await resolveSavedFeishuMedia({
|
|
280
|
+
result: await saveMessageResourceFeishu({
|
|
281
|
+
cfg,
|
|
282
|
+
messageId,
|
|
283
|
+
fileKey: media.fileKey,
|
|
284
|
+
type: "file",
|
|
285
|
+
accountId,
|
|
286
|
+
maxBytes,
|
|
287
|
+
originalFilename: media.fileName
|
|
288
|
+
}),
|
|
289
|
+
maxBytes,
|
|
290
|
+
originalFilename: media.fileName
|
|
278
291
|
});
|
|
279
|
-
const contentType = result.contentType ?? await core.media.detectMime({ buffer: result.buffer });
|
|
280
|
-
const saved = await core.channel.media.saveMediaBuffer(result.buffer, contentType, "inbound", maxBytes);
|
|
281
292
|
out.push({
|
|
282
293
|
path: saved.path,
|
|
283
294
|
contentType: saved.contentType,
|
|
@@ -294,15 +305,19 @@ async function resolveFeishuMediaList(params) {
|
|
|
294
305
|
try {
|
|
295
306
|
const fileKey = mediaKeys.fileKey || mediaKeys.imageKey;
|
|
296
307
|
if (!fileKey) return [];
|
|
297
|
-
const
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
308
|
+
const saved = await resolveSavedFeishuMedia({
|
|
309
|
+
result: await saveMessageResourceFeishu({
|
|
310
|
+
cfg,
|
|
311
|
+
messageId,
|
|
312
|
+
fileKey,
|
|
313
|
+
type: toMessageResourceType(messageType),
|
|
314
|
+
accountId,
|
|
315
|
+
maxBytes,
|
|
316
|
+
originalFilename: mediaKeys.fileName
|
|
317
|
+
}),
|
|
318
|
+
maxBytes,
|
|
319
|
+
originalFilename: mediaKeys.fileName
|
|
303
320
|
});
|
|
304
|
-
const contentType = result.contentType ?? await core.media.detectMime({ buffer: result.buffer });
|
|
305
|
-
const saved = await core.channel.media.saveMediaBuffer(result.buffer, contentType, "inbound", maxBytes, result.fileName || mediaKeys.fileName);
|
|
306
321
|
out.push({
|
|
307
322
|
path: saved.path,
|
|
308
323
|
contentType: saved.contentType,
|
|
@@ -4526,6 +4541,14 @@ function respondText(res, statusCode, body) {
|
|
|
4526
4541
|
res.setHeader("Content-Type", "text/plain; charset=utf-8");
|
|
4527
4542
|
res.end(body);
|
|
4528
4543
|
}
|
|
4544
|
+
function normalizeFeishuWebhookRateLimitClient(clientIp) {
|
|
4545
|
+
if (!clientIp) return "unknown";
|
|
4546
|
+
if (clientIp === "::1" || clientIp.startsWith("127.")) return "loopback";
|
|
4547
|
+
return clientIp;
|
|
4548
|
+
}
|
|
4549
|
+
function buildFeishuWebhookRateLimitKey(params) {
|
|
4550
|
+
return `${params.accountId}:${params.path}:${normalizeFeishuWebhookRateLimitClient(params.clientIp)}`;
|
|
4551
|
+
}
|
|
4529
4552
|
function getFeishuWsReconnectDelayMs(attempt) {
|
|
4530
4553
|
return Math.min(FEISHU_WS_RECONNECT_INITIAL_DELAY_MS * 2 ** Math.max(0, attempt - 1), FEISHU_WS_RECONNECT_MAX_DELAY_MS);
|
|
4531
4554
|
}
|
|
@@ -4674,7 +4697,11 @@ async function monitorWebhook({ account, accountId, runtime, abortSignal, eventD
|
|
|
4674
4697
|
req,
|
|
4675
4698
|
res,
|
|
4676
4699
|
rateLimiter: feishuWebhookRateLimiter,
|
|
4677
|
-
rateLimitKey:
|
|
4700
|
+
rateLimitKey: buildFeishuWebhookRateLimitKey({
|
|
4701
|
+
accountId,
|
|
4702
|
+
path,
|
|
4703
|
+
clientIp: resolveRequestClientIp(req)
|
|
4704
|
+
}),
|
|
4678
4705
|
nowMs: Date.now(),
|
|
4679
4706
|
requireJsonContentType: true
|
|
4680
4707
|
})) return;
|
|
@@ -11,6 +11,8 @@ import { mediaKindFromMime } from "openclaw/plugin-sdk/media-mime";
|
|
|
11
11
|
import { MEDIA_FFMPEG_MAX_AUDIO_DURATION_SECS, runFfmpeg } from "openclaw/plugin-sdk/media-runtime";
|
|
12
12
|
import { readRegularFile, writeExternalFileWithinRoot } from "openclaw/plugin-sdk/security-runtime";
|
|
13
13
|
import { Readable } from "node:stream";
|
|
14
|
+
import { saveMediaBuffer, saveMediaStream } from "openclaw/plugin-sdk/media-store";
|
|
15
|
+
import "openclaw/plugin-sdk/response-limit-runtime";
|
|
14
16
|
import { resolvePreferredOpenClawTmpDir, withTempDownloadPath, withTempWorkspace } from "openclaw/plugin-sdk/temp-path";
|
|
15
17
|
import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/markdown-table-runtime";
|
|
16
18
|
//#region extensions/feishu/src/external-keys.ts
|
|
@@ -141,35 +143,29 @@ function extractFeishuDownloadMetadata(response) {
|
|
|
141
143
|
fileName: (disposition ? decodeDispositionFileName(disposition) : void 0) ?? responseWithOptionalFields.file_name ?? responseWithOptionalFields.fileName ?? responseWithOptionalFields.data?.file_name ?? responseWithOptionalFields.data?.fileName
|
|
142
144
|
};
|
|
143
145
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
for await (const chunk of stream) chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
147
|
-
return Buffer.concat(chunks);
|
|
146
|
+
function mediaLimitError(maxBytes) {
|
|
147
|
+
return /* @__PURE__ */ new Error(`Media exceeds ${Math.round(maxBytes / (1024 * 1024))}MB limit`);
|
|
148
148
|
}
|
|
149
|
-
async function
|
|
150
|
-
const { response } = params;
|
|
151
|
-
if (Buffer.isBuffer(response)) return response;
|
|
152
|
-
if (response instanceof ArrayBuffer) return Buffer.from(response);
|
|
149
|
+
async function saveFeishuResponseMedia(params) {
|
|
150
|
+
const { response, maxBytes, contentType, fileName } = params;
|
|
151
|
+
if (Buffer.isBuffer(response)) return saveMediaBuffer(response, contentType, "inbound", maxBytes, fileName);
|
|
152
|
+
if (response instanceof ArrayBuffer) return saveMediaBuffer(Buffer.from(response), contentType, "inbound", maxBytes, fileName);
|
|
153
153
|
const responseWithOptionalFields = response;
|
|
154
154
|
if (responseWithOptionalFields.code !== void 0 && responseWithOptionalFields.code !== 0) throw new Error(`${params.errorPrefix}: ${responseWithOptionalFields.msg || `code ${responseWithOptionalFields.code}`}`);
|
|
155
|
-
if (responseWithOptionalFields.data && Buffer.isBuffer(responseWithOptionalFields.data)) return responseWithOptionalFields.data;
|
|
156
|
-
if (responseWithOptionalFields.data instanceof ArrayBuffer) return Buffer.from(responseWithOptionalFields.data);
|
|
157
|
-
if (typeof response.getReadableStream === "function") return
|
|
155
|
+
if (responseWithOptionalFields.data && Buffer.isBuffer(responseWithOptionalFields.data)) return saveMediaBuffer(responseWithOptionalFields.data, contentType, "inbound", maxBytes, fileName);
|
|
156
|
+
if (responseWithOptionalFields.data instanceof ArrayBuffer) return saveMediaBuffer(Buffer.from(responseWithOptionalFields.data), contentType, "inbound", maxBytes, fileName);
|
|
157
|
+
if (typeof response.getReadableStream === "function") return saveMediaStream(response.getReadableStream(), contentType, "inbound", maxBytes, fileName);
|
|
158
158
|
if (typeof response.writeFile === "function") return await withTempDownloadPath({ prefix: params.tmpDirPrefix }, async (tmpPath) => {
|
|
159
159
|
await response.writeFile(tmpPath);
|
|
160
|
-
|
|
160
|
+
if ((await fs.promises.stat(tmpPath)).size > maxBytes) throw mediaLimitError(maxBytes);
|
|
161
|
+
return await saveMediaStream(fs.createReadStream(tmpPath), contentType, "inbound", maxBytes, fileName);
|
|
161
162
|
});
|
|
162
|
-
if (responseWithOptionalFields[Symbol.asyncIterator])
|
|
163
|
-
|
|
164
|
-
const chunks = [];
|
|
165
|
-
for await (const chunk of asyncIterable) chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
166
|
-
return Buffer.concat(chunks);
|
|
167
|
-
}
|
|
168
|
-
if (response instanceof Readable) return readReadableBuffer(response);
|
|
163
|
+
if (responseWithOptionalFields[Symbol.asyncIterator]) return saveMediaStream(responseWithOptionalFields, contentType, "inbound", maxBytes, fileName);
|
|
164
|
+
if (response instanceof Readable) return saveMediaStream(response, contentType, "inbound", maxBytes, fileName);
|
|
169
165
|
const keys = Object.keys(response);
|
|
170
166
|
throw new Error(`${params.errorPrefix}: unexpected response format. Keys: [${keys.join(", ")}]`);
|
|
171
167
|
}
|
|
172
|
-
async function
|
|
168
|
+
async function saveMessageResourceWithType(params) {
|
|
173
169
|
const response = await params.client.im.messageResource.get({
|
|
174
170
|
path: {
|
|
175
171
|
message_id: params.messageId,
|
|
@@ -177,21 +173,21 @@ async function downloadMessageResourceWithType(params) {
|
|
|
177
173
|
},
|
|
178
174
|
params: { type: params.type }
|
|
179
175
|
});
|
|
176
|
+
const meta = extractFeishuDownloadMetadata(response);
|
|
180
177
|
return {
|
|
181
|
-
|
|
178
|
+
saved: await saveFeishuResponseMedia({
|
|
182
179
|
response,
|
|
183
180
|
tmpDirPrefix: "openclaw-feishu-resource-",
|
|
184
|
-
errorPrefix: "Feishu message resource download failed"
|
|
181
|
+
errorPrefix: "Feishu message resource download failed",
|
|
182
|
+
maxBytes: params.maxBytes,
|
|
183
|
+
contentType: meta.contentType,
|
|
184
|
+
fileName: meta.fileName ?? params.originalFilename
|
|
185
185
|
}),
|
|
186
|
-
...
|
|
186
|
+
...meta
|
|
187
187
|
};
|
|
188
188
|
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
* Used for downloading files, audio, and video from messages.
|
|
192
|
-
*/
|
|
193
|
-
async function downloadMessageResourceFeishu(params) {
|
|
194
|
-
const { cfg, messageId, fileKey, type, accountId } = params;
|
|
189
|
+
async function saveMessageResourceFeishu(params) {
|
|
190
|
+
const { cfg, messageId, fileKey, type, accountId, maxBytes, originalFilename } = params;
|
|
195
191
|
const normalizedFileKey = normalizeFeishuExternalKey(fileKey);
|
|
196
192
|
if (!normalizedFileKey) throw new Error("Feishu message resource download failed: invalid file_key");
|
|
197
193
|
const { client } = createConfiguredFeishuMediaClient({
|
|
@@ -199,20 +195,24 @@ async function downloadMessageResourceFeishu(params) {
|
|
|
199
195
|
accountId
|
|
200
196
|
});
|
|
201
197
|
try {
|
|
202
|
-
return await
|
|
198
|
+
return await saveMessageResourceWithType({
|
|
203
199
|
client,
|
|
204
200
|
messageId,
|
|
205
201
|
fileKey: normalizedFileKey,
|
|
206
|
-
type
|
|
202
|
+
type,
|
|
203
|
+
maxBytes,
|
|
204
|
+
originalFilename
|
|
207
205
|
});
|
|
208
206
|
} catch (err) {
|
|
209
207
|
if (type !== "file" || !isHttpStatusError(err, 502)) throw err;
|
|
210
208
|
try {
|
|
211
|
-
return await
|
|
209
|
+
return await saveMessageResourceWithType({
|
|
212
210
|
client,
|
|
213
211
|
messageId,
|
|
214
212
|
fileKey: normalizedFileKey,
|
|
215
|
-
type: "media"
|
|
213
|
+
type: "media",
|
|
214
|
+
maxBytes,
|
|
215
|
+
originalFilename
|
|
216
216
|
});
|
|
217
217
|
} catch {
|
|
218
218
|
throw err;
|
|
@@ -1207,4 +1207,4 @@ async function sendMarkdownCardFeishu(params) {
|
|
|
1207
1207
|
});
|
|
1208
1208
|
}
|
|
1209
1209
|
//#endregion
|
|
1210
|
-
export { normalizeFeishuExternalKey as _, sendCardFeishu as a, sendStructuredCardFeishu as c, isFeishuBroadcastMention as d, isMentionForwardRequest as f, shouldSuppressFeishuTextForVoiceMedia as g, sendMediaFeishu as h, resolveFeishuCardTemplate as i, parsePostContent as l,
|
|
1210
|
+
export { normalizeFeishuExternalKey as _, sendCardFeishu as a, sendStructuredCardFeishu as c, isFeishuBroadcastMention as d, isMentionForwardRequest as f, shouldSuppressFeishuTextForVoiceMedia as g, sendMediaFeishu as h, resolveFeishuCardTemplate as i, parsePostContent as l, saveMessageResourceFeishu as m, getMessageFeishu as n, sendMarkdownCardFeishu as o, isFeishuGroupChatType as p, listFeishuThreadMessages as r, sendMessageFeishu as s, editMessageFeishu as t, extractMentionTargets as u };
|
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-D6lD7M4a.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.
|
|
3
|
+
"version": "2026.5.14-beta.1",
|
|
4
4
|
"description": "OpenClaw Feishu/Lark channel plugin (community maintained by @m1heng)",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"openclaw": "workspace:*"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
|
-
"openclaw": ">=2026.5.
|
|
20
|
+
"openclaw": ">=2026.5.14-beta.1"
|
|
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.
|
|
51
|
+
"pluginApi": ">=2026.5.14-beta.1"
|
|
52
52
|
},
|
|
53
53
|
"build": {
|
|
54
|
-
"openclawVersion": "2026.5.
|
|
54
|
+
"openclawVersion": "2026.5.14-beta.1"
|
|
55
55
|
},
|
|
56
56
|
"release": {
|
|
57
57
|
"publishToClawHub": true,
|