@openclaw/feishu 2026.2.14 → 2026.2.15
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/package.json +1 -1
- package/src/bot.ts +2 -22
- package/src/channel.ts +8 -14
- package/src/policy.ts +8 -28
- package/src/types.ts +2 -3
package/package.json
CHANGED
package/src/bot.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ClawdbotConfig, RuntimeEnv } from "openclaw/plugin-sdk";
|
|
2
2
|
import {
|
|
3
|
+
buildAgentMediaPayload,
|
|
3
4
|
buildPendingHistoryContextFromMap,
|
|
4
5
|
recordPendingHistoryEntryIfEnabled,
|
|
5
6
|
clearHistoryEntriesIfEnabled,
|
|
@@ -433,27 +434,6 @@ async function resolveFeishuMediaList(params: {
|
|
|
433
434
|
* Build media payload for inbound context.
|
|
434
435
|
* Similar to Discord's buildDiscordMediaPayload().
|
|
435
436
|
*/
|
|
436
|
-
function buildFeishuMediaPayload(mediaList: FeishuMediaInfo[]): {
|
|
437
|
-
MediaPath?: string;
|
|
438
|
-
MediaType?: string;
|
|
439
|
-
MediaUrl?: string;
|
|
440
|
-
MediaPaths?: string[];
|
|
441
|
-
MediaUrls?: string[];
|
|
442
|
-
MediaTypes?: string[];
|
|
443
|
-
} {
|
|
444
|
-
const first = mediaList[0];
|
|
445
|
-
const mediaPaths = mediaList.map((media) => media.path);
|
|
446
|
-
const mediaTypes = mediaList.map((media) => media.contentType).filter(Boolean) as string[];
|
|
447
|
-
return {
|
|
448
|
-
MediaPath: first?.path,
|
|
449
|
-
MediaType: first?.contentType,
|
|
450
|
-
MediaUrl: first?.path,
|
|
451
|
-
MediaPaths: mediaPaths.length > 0 ? mediaPaths : undefined,
|
|
452
|
-
MediaUrls: mediaPaths.length > 0 ? mediaPaths : undefined,
|
|
453
|
-
MediaTypes: mediaTypes.length > 0 ? mediaTypes : undefined,
|
|
454
|
-
};
|
|
455
|
-
}
|
|
456
|
-
|
|
457
437
|
export function parseFeishuMessageEvent(
|
|
458
438
|
event: FeishuMessageEvent,
|
|
459
439
|
botOpenId?: string,
|
|
@@ -766,7 +746,7 @@ export async function handleFeishuMessage(params: {
|
|
|
766
746
|
log,
|
|
767
747
|
accountId: account.accountId,
|
|
768
748
|
});
|
|
769
|
-
const mediaPayload =
|
|
749
|
+
const mediaPayload = buildAgentMediaPayload(mediaList);
|
|
770
750
|
|
|
771
751
|
// Fetch quoted/replied message content if parentId exists
|
|
772
752
|
let quotedContent: string | undefined;
|
package/src/channel.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import type { ChannelMeta, ChannelPlugin, ClawdbotConfig } from "openclaw/plugin-sdk";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
buildBaseChannelStatusSummary,
|
|
4
|
+
createDefaultChannelRuntimeState,
|
|
5
|
+
DEFAULT_ACCOUNT_ID,
|
|
6
|
+
PAIRING_APPROVED_MESSAGE,
|
|
7
|
+
} from "openclaw/plugin-sdk";
|
|
3
8
|
import type { ResolvedFeishuAccount, FeishuConfig } from "./types.js";
|
|
4
9
|
import {
|
|
5
10
|
resolveFeishuAccount,
|
|
@@ -303,20 +308,9 @@ export const feishuPlugin: ChannelPlugin<ResolvedFeishuAccount> = {
|
|
|
303
308
|
},
|
|
304
309
|
outbound: feishuOutbound,
|
|
305
310
|
status: {
|
|
306
|
-
defaultRuntime: {
|
|
307
|
-
accountId: DEFAULT_ACCOUNT_ID,
|
|
308
|
-
running: false,
|
|
309
|
-
lastStartAt: null,
|
|
310
|
-
lastStopAt: null,
|
|
311
|
-
lastError: null,
|
|
312
|
-
port: null,
|
|
313
|
-
},
|
|
311
|
+
defaultRuntime: createDefaultChannelRuntimeState(DEFAULT_ACCOUNT_ID, { port: null }),
|
|
314
312
|
buildChannelSummary: ({ snapshot }) => ({
|
|
315
|
-
|
|
316
|
-
running: snapshot.running ?? false,
|
|
317
|
-
lastStartAt: snapshot.lastStartAt ?? null,
|
|
318
|
-
lastStopAt: snapshot.lastStopAt ?? null,
|
|
319
|
-
lastError: snapshot.lastError ?? null,
|
|
313
|
+
...buildBaseChannelStatusSummary(snapshot),
|
|
320
314
|
port: snapshot.port ?? null,
|
|
321
315
|
probe: snapshot.probe,
|
|
322
316
|
lastProbeAt: snapshot.lastProbeAt ?? null,
|
package/src/policy.ts
CHANGED
|
@@ -1,39 +1,19 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
AllowlistMatch,
|
|
3
|
+
ChannelGroupContext,
|
|
4
|
+
GroupToolPolicyConfig,
|
|
5
|
+
} from "openclaw/plugin-sdk";
|
|
6
|
+
import { resolveAllowlistMatchSimple } from "openclaw/plugin-sdk";
|
|
2
7
|
import type { FeishuConfig, FeishuGroupConfig } from "./types.js";
|
|
3
8
|
|
|
4
|
-
export type FeishuAllowlistMatch =
|
|
5
|
-
allowed: boolean;
|
|
6
|
-
matchKey?: string;
|
|
7
|
-
matchSource?: "wildcard" | "id" | "name";
|
|
8
|
-
};
|
|
9
|
+
export type FeishuAllowlistMatch = AllowlistMatch<"wildcard" | "id" | "name">;
|
|
9
10
|
|
|
10
11
|
export function resolveFeishuAllowlistMatch(params: {
|
|
11
12
|
allowFrom: Array<string | number>;
|
|
12
13
|
senderId: string;
|
|
13
14
|
senderName?: string | null;
|
|
14
15
|
}): FeishuAllowlistMatch {
|
|
15
|
-
|
|
16
|
-
.map((entry) => String(entry).trim().toLowerCase())
|
|
17
|
-
.filter(Boolean);
|
|
18
|
-
|
|
19
|
-
if (allowFrom.length === 0) {
|
|
20
|
-
return { allowed: false };
|
|
21
|
-
}
|
|
22
|
-
if (allowFrom.includes("*")) {
|
|
23
|
-
return { allowed: true, matchKey: "*", matchSource: "wildcard" };
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const senderId = params.senderId.toLowerCase();
|
|
27
|
-
if (allowFrom.includes(senderId)) {
|
|
28
|
-
return { allowed: true, matchKey: senderId, matchSource: "id" };
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const senderName = params.senderName?.toLowerCase();
|
|
32
|
-
if (senderName && allowFrom.includes(senderName)) {
|
|
33
|
-
return { allowed: true, matchKey: senderName, matchSource: "name" };
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return { allowed: false };
|
|
16
|
+
return resolveAllowlistMatchSimple(params);
|
|
37
17
|
}
|
|
38
18
|
|
|
39
19
|
export function resolveFeishuGroupConfig(params: {
|
package/src/types.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { BaseProbeResult } from "openclaw/plugin-sdk";
|
|
1
2
|
import type {
|
|
2
3
|
FeishuConfigSchema,
|
|
3
4
|
FeishuGroupSchema,
|
|
@@ -52,9 +53,7 @@ export type FeishuSendResult = {
|
|
|
52
53
|
chatId: string;
|
|
53
54
|
};
|
|
54
55
|
|
|
55
|
-
export type FeishuProbeResult = {
|
|
56
|
-
ok: boolean;
|
|
57
|
-
error?: string;
|
|
56
|
+
export type FeishuProbeResult = BaseProbeResult<string> & {
|
|
58
57
|
appId?: string;
|
|
59
58
|
botName?: string;
|
|
60
59
|
botOpenId?: string;
|