@colin3191/feishu 0.1.2 → 0.2.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/index.ts +3 -3
- package/package.json +5 -5
- package/src/accounts.ts +6 -6
- package/src/bot.ts +4 -4
- package/src/channel.ts +3 -3
- package/src/directory.ts +5 -5
- package/src/media.ts +8 -8
- package/src/monitor.ts +3 -3
- package/src/onboarding.ts +10 -10
- package/src/outbound.ts +1 -1
- package/src/policy.ts +1 -1
- package/src/reactions.ts +4 -4
- package/src/reply-dispatcher.ts +3 -3
- package/src/runtime.ts +1 -1
- package/src/send.ts +7 -7
- package/src/typing.ts +3 -3
package/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import { emptyPluginConfigSchema } from "
|
|
1
|
+
import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
|
|
2
|
+
import { emptyPluginConfigSchema } from "openclaw/plugin-sdk";
|
|
3
3
|
import { feishuPlugin } from "./src/channel.js";
|
|
4
4
|
import { setFeishuRuntime } from "./src/runtime.js";
|
|
5
5
|
|
|
@@ -32,7 +32,7 @@ const plugin = {
|
|
|
32
32
|
name: "Feishu",
|
|
33
33
|
description: "Feishu/Lark channel plugin",
|
|
34
34
|
configSchema: emptyPluginConfigSchema(),
|
|
35
|
-
register(api:
|
|
35
|
+
register(api: OpenClawPluginApi) {
|
|
36
36
|
setFeishuRuntime(api.runtime);
|
|
37
37
|
api.registerChannel({ plugin: feishuPlugin });
|
|
38
38
|
},
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@colin3191/feishu",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "
|
|
5
|
+
"description": "OpenClaw Feishu/Lark channel plugin",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"files": [
|
|
8
8
|
"index.ts",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"url": "git+https://github.com/m1heng/clawdbot-feishu.git"
|
|
15
15
|
},
|
|
16
16
|
"keywords": [
|
|
17
|
-
"
|
|
17
|
+
"openclaw",
|
|
18
18
|
"feishu",
|
|
19
19
|
"lark",
|
|
20
20
|
"飞书",
|
|
@@ -50,11 +50,11 @@
|
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/node": "^25.0.10",
|
|
53
|
-
"
|
|
53
|
+
"openclaw": "2026.1.29",
|
|
54
54
|
"tsx": "^4.21.0",
|
|
55
55
|
"typescript": "^5.7.0"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
|
-
"
|
|
58
|
+
"openclaw": ">=2026.1.29"
|
|
59
59
|
}
|
|
60
60
|
}
|
package/src/accounts.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import { DEFAULT_ACCOUNT_ID } from "
|
|
1
|
+
import type { OpenClawConfig } from "openclaw/plugin-sdk";
|
|
2
|
+
import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk";
|
|
3
3
|
import type { FeishuConfig, FeishuDomain, ResolvedFeishuAccount } from "./types.js";
|
|
4
4
|
|
|
5
5
|
export function resolveFeishuCredentials(cfg?: FeishuConfig): {
|
|
@@ -22,7 +22,7 @@ export function resolveFeishuCredentials(cfg?: FeishuConfig): {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
export function resolveFeishuAccount(params: {
|
|
25
|
-
cfg:
|
|
25
|
+
cfg: OpenClawConfig;
|
|
26
26
|
accountId?: string | null;
|
|
27
27
|
}): ResolvedFeishuAccount {
|
|
28
28
|
const feishuCfg = params.cfg.channels?.feishu as FeishuConfig | undefined;
|
|
@@ -38,15 +38,15 @@ export function resolveFeishuAccount(params: {
|
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
export function listFeishuAccountIds(_cfg:
|
|
41
|
+
export function listFeishuAccountIds(_cfg: OpenClawConfig): string[] {
|
|
42
42
|
return [DEFAULT_ACCOUNT_ID];
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
export function resolveDefaultFeishuAccountId(_cfg:
|
|
45
|
+
export function resolveDefaultFeishuAccountId(_cfg: OpenClawConfig): string {
|
|
46
46
|
return DEFAULT_ACCOUNT_ID;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
export function listEnabledFeishuAccounts(cfg:
|
|
49
|
+
export function listEnabledFeishuAccounts(cfg: OpenClawConfig): ResolvedFeishuAccount[] {
|
|
50
50
|
return listFeishuAccountIds(cfg)
|
|
51
51
|
.map((accountId) => resolveFeishuAccount({ cfg, accountId }))
|
|
52
52
|
.filter((account) => account.enabled && account.configured);
|
package/src/bot.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { OpenClawConfig, RuntimeEnv } from "openclaw/plugin-sdk";
|
|
2
2
|
import {
|
|
3
3
|
buildPendingHistoryContextFromMap,
|
|
4
4
|
recordPendingHistoryEntryIfEnabled,
|
|
5
5
|
clearHistoryEntriesIfEnabled,
|
|
6
6
|
DEFAULT_GROUP_HISTORY_LIMIT,
|
|
7
7
|
type HistoryEntry,
|
|
8
|
-
} from "
|
|
8
|
+
} from "openclaw/plugin-sdk";
|
|
9
9
|
import type { FeishuConfig, FeishuMessageContext, FeishuMediaInfo } from "./types.js";
|
|
10
10
|
import { getFeishuRuntime } from "./runtime.js";
|
|
11
11
|
import { createFeishuClient } from "./client.js";
|
|
@@ -243,7 +243,7 @@ function inferPlaceholder(messageType: string): string {
|
|
|
243
243
|
* Similar to Discord's resolveMediaList().
|
|
244
244
|
*/
|
|
245
245
|
async function resolveFeishuMediaList(params: {
|
|
246
|
-
cfg:
|
|
246
|
+
cfg: OpenClawConfig;
|
|
247
247
|
messageId: string;
|
|
248
248
|
messageType: string;
|
|
249
249
|
content: string;
|
|
@@ -414,7 +414,7 @@ export function parseFeishuMessageEvent(
|
|
|
414
414
|
}
|
|
415
415
|
|
|
416
416
|
export async function handleFeishuMessage(params: {
|
|
417
|
-
cfg:
|
|
417
|
+
cfg: OpenClawConfig;
|
|
418
418
|
event: FeishuMessageEvent;
|
|
419
419
|
botOpenId?: string;
|
|
420
420
|
runtime?: RuntimeEnv;
|
package/src/channel.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ChannelPlugin,
|
|
2
|
-
import { DEFAULT_ACCOUNT_ID, PAIRING_APPROVED_MESSAGE } from "
|
|
1
|
+
import type { ChannelPlugin, OpenClawConfig } from "openclaw/plugin-sdk";
|
|
2
|
+
import { DEFAULT_ACCOUNT_ID, PAIRING_APPROVED_MESSAGE } from "openclaw/plugin-sdk";
|
|
3
3
|
import type { ResolvedFeishuAccount, FeishuConfig } from "./types.js";
|
|
4
4
|
import { resolveFeishuAccount, resolveFeishuCredentials } from "./accounts.js";
|
|
5
5
|
import { feishuOutbound } from "./outbound.js";
|
|
@@ -104,7 +104,7 @@ export const feishuPlugin: ChannelPlugin<ResolvedFeishuAccount> = {
|
|
|
104
104
|
},
|
|
105
105
|
}),
|
|
106
106
|
deleteAccount: ({ cfg }) => {
|
|
107
|
-
const next = { ...cfg } as
|
|
107
|
+
const next = { ...cfg } as OpenClawConfig;
|
|
108
108
|
const nextChannels = { ...cfg.channels };
|
|
109
109
|
delete (nextChannels as Record<string, unknown>).feishu;
|
|
110
110
|
if (Object.keys(nextChannels).length > 0) {
|
package/src/directory.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { OpenClawConfig } from "openclaw/plugin-sdk";
|
|
2
2
|
import type { FeishuConfig } from "./types.js";
|
|
3
3
|
import { createFeishuClient } from "./client.js";
|
|
4
4
|
import { normalizeFeishuTarget } from "./targets.js";
|
|
@@ -16,7 +16,7 @@ export type FeishuDirectoryGroup = {
|
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
export async function listFeishuDirectoryPeers(params: {
|
|
19
|
-
cfg:
|
|
19
|
+
cfg: OpenClawConfig;
|
|
20
20
|
query?: string;
|
|
21
21
|
limit?: number;
|
|
22
22
|
}): Promise<FeishuDirectoryPeer[]> {
|
|
@@ -44,7 +44,7 @@ export async function listFeishuDirectoryPeers(params: {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
export async function listFeishuDirectoryGroups(params: {
|
|
47
|
-
cfg:
|
|
47
|
+
cfg: OpenClawConfig;
|
|
48
48
|
query?: string;
|
|
49
49
|
limit?: number;
|
|
50
50
|
}): Promise<FeishuDirectoryGroup[]> {
|
|
@@ -71,7 +71,7 @@ export async function listFeishuDirectoryGroups(params: {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
export async function listFeishuDirectoryPeersLive(params: {
|
|
74
|
-
cfg:
|
|
74
|
+
cfg: OpenClawConfig;
|
|
75
75
|
query?: string;
|
|
76
76
|
limit?: number;
|
|
77
77
|
}): Promise<FeishuDirectoryPeer[]> {
|
|
@@ -115,7 +115,7 @@ export async function listFeishuDirectoryPeersLive(params: {
|
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
export async function listFeishuDirectoryGroupsLive(params: {
|
|
118
|
-
cfg:
|
|
118
|
+
cfg: OpenClawConfig;
|
|
119
119
|
query?: string;
|
|
120
120
|
limit?: number;
|
|
121
121
|
}): Promise<FeishuDirectoryGroup[]> {
|
package/src/media.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { OpenClawConfig } from "openclaw/plugin-sdk";
|
|
2
2
|
import type { FeishuConfig } from "./types.js";
|
|
3
3
|
import { createFeishuClient } from "./client.js";
|
|
4
4
|
import { resolveReceiveIdType, normalizeFeishuTarget } from "./targets.js";
|
|
@@ -23,7 +23,7 @@ export type DownloadMessageResourceResult = {
|
|
|
23
23
|
* Used for downloading images sent in messages.
|
|
24
24
|
*/
|
|
25
25
|
export async function downloadImageFeishu(params: {
|
|
26
|
-
cfg:
|
|
26
|
+
cfg: OpenClawConfig;
|
|
27
27
|
imageKey: string;
|
|
28
28
|
}): Promise<DownloadImageResult> {
|
|
29
29
|
const { cfg, imageKey } = params;
|
|
@@ -99,7 +99,7 @@ export async function downloadImageFeishu(params: {
|
|
|
99
99
|
* Used for downloading files, audio, and video from messages.
|
|
100
100
|
*/
|
|
101
101
|
export async function downloadMessageResourceFeishu(params: {
|
|
102
|
-
cfg:
|
|
102
|
+
cfg: OpenClawConfig;
|
|
103
103
|
messageId: string;
|
|
104
104
|
fileKey: string;
|
|
105
105
|
type: "image" | "file";
|
|
@@ -193,7 +193,7 @@ export type SendMediaResult = {
|
|
|
193
193
|
* Supports: JPEG, PNG, WEBP, GIF, TIFF, BMP, ICO
|
|
194
194
|
*/
|
|
195
195
|
export async function uploadImageFeishu(params: {
|
|
196
|
-
cfg:
|
|
196
|
+
cfg: OpenClawConfig;
|
|
197
197
|
image: Buffer | string; // Buffer or file path
|
|
198
198
|
imageType?: "message" | "avatar";
|
|
199
199
|
}): Promise<UploadImageResult> {
|
|
@@ -237,7 +237,7 @@ export async function uploadImageFeishu(params: {
|
|
|
237
237
|
* Max file size: 30MB
|
|
238
238
|
*/
|
|
239
239
|
export async function uploadFileFeishu(params: {
|
|
240
|
-
cfg:
|
|
240
|
+
cfg: OpenClawConfig;
|
|
241
241
|
file: Buffer | string; // Buffer or file path
|
|
242
242
|
fileName: string;
|
|
243
243
|
fileType: "opus" | "mp4" | "pdf" | "doc" | "xls" | "ppt" | "stream";
|
|
@@ -283,7 +283,7 @@ export async function uploadFileFeishu(params: {
|
|
|
283
283
|
* Send an image message using an image_key
|
|
284
284
|
*/
|
|
285
285
|
export async function sendImageFeishu(params: {
|
|
286
|
-
cfg:
|
|
286
|
+
cfg: OpenClawConfig;
|
|
287
287
|
to: string;
|
|
288
288
|
imageKey: string;
|
|
289
289
|
replyToMessageId?: string;
|
|
@@ -345,7 +345,7 @@ export async function sendImageFeishu(params: {
|
|
|
345
345
|
* Send a file message using a file_key
|
|
346
346
|
*/
|
|
347
347
|
export async function sendFileFeishu(params: {
|
|
348
|
-
cfg:
|
|
348
|
+
cfg: OpenClawConfig;
|
|
349
349
|
to: string;
|
|
350
350
|
fileKey: string;
|
|
351
351
|
replyToMessageId?: string;
|
|
@@ -455,7 +455,7 @@ function isLocalPath(urlOrPath: string): boolean {
|
|
|
455
455
|
* Upload and send media (image or file) from URL, local path, or buffer
|
|
456
456
|
*/
|
|
457
457
|
export async function sendMediaFeishu(params: {
|
|
458
|
-
cfg:
|
|
458
|
+
cfg: OpenClawConfig;
|
|
459
459
|
to: string;
|
|
460
460
|
mediaUrl?: string;
|
|
461
461
|
mediaBuffer?: Buffer;
|
package/src/monitor.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as Lark from "@larksuiteoapi/node-sdk";
|
|
2
|
-
import type {
|
|
2
|
+
import type { OpenClawConfig, RuntimeEnv, HistoryEntry } from "openclaw/plugin-sdk";
|
|
3
3
|
import type { FeishuConfig } from "./types.js";
|
|
4
4
|
import { createFeishuWSClient, createEventDispatcher } from "./client.js";
|
|
5
5
|
import { resolveFeishuCredentials } from "./accounts.js";
|
|
@@ -7,7 +7,7 @@ import { handleFeishuMessage, type FeishuMessageEvent, type FeishuBotAddedEvent
|
|
|
7
7
|
import { probeFeishu } from "./probe.js";
|
|
8
8
|
|
|
9
9
|
export type MonitorFeishuOpts = {
|
|
10
|
-
config?:
|
|
10
|
+
config?: OpenClawConfig;
|
|
11
11
|
runtime?: RuntimeEnv;
|
|
12
12
|
abortSignal?: AbortSignal;
|
|
13
13
|
accountId?: string;
|
|
@@ -55,7 +55,7 @@ export async function monitorFeishuProvider(opts: MonitorFeishuOpts = {}): Promi
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
async function monitorWebSocket(params: {
|
|
58
|
-
cfg:
|
|
58
|
+
cfg: OpenClawConfig;
|
|
59
59
|
feishuCfg: FeishuConfig;
|
|
60
60
|
runtime?: RuntimeEnv;
|
|
61
61
|
abortSignal?: AbortSignal;
|
package/src/onboarding.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
ChannelOnboardingAdapter,
|
|
3
3
|
ChannelOnboardingDmPolicy,
|
|
4
|
-
|
|
4
|
+
OpenClawConfig,
|
|
5
5
|
DmPolicy,
|
|
6
6
|
WizardPrompter,
|
|
7
|
-
} from "
|
|
8
|
-
import { addWildcardAllowFrom, DEFAULT_ACCOUNT_ID, formatDocsLink } from "
|
|
7
|
+
} from "openclaw/plugin-sdk";
|
|
8
|
+
import { addWildcardAllowFrom, DEFAULT_ACCOUNT_ID, formatDocsLink } from "openclaw/plugin-sdk";
|
|
9
9
|
|
|
10
10
|
import { resolveFeishuCredentials } from "./accounts.js";
|
|
11
11
|
import { probeFeishu } from "./probe.js";
|
|
@@ -13,7 +13,7 @@ import type { FeishuConfig } from "./types.js";
|
|
|
13
13
|
|
|
14
14
|
const channel = "feishu" as const;
|
|
15
15
|
|
|
16
|
-
function setFeishuDmPolicy(cfg:
|
|
16
|
+
function setFeishuDmPolicy(cfg: OpenClawConfig, dmPolicy: DmPolicy): OpenClawConfig {
|
|
17
17
|
const allowFrom =
|
|
18
18
|
dmPolicy === "open"
|
|
19
19
|
? addWildcardAllowFrom(cfg.channels?.feishu?.allowFrom)?.map((entry) => String(entry))
|
|
@@ -31,7 +31,7 @@ function setFeishuDmPolicy(cfg: ClawdbotConfig, dmPolicy: DmPolicy): ClawdbotCon
|
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
function setFeishuAllowFrom(cfg:
|
|
34
|
+
function setFeishuAllowFrom(cfg: OpenClawConfig, allowFrom: string[]): OpenClawConfig {
|
|
35
35
|
return {
|
|
36
36
|
...cfg,
|
|
37
37
|
channels: {
|
|
@@ -52,9 +52,9 @@ function parseAllowFromInput(raw: string): string[] {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
async function promptFeishuAllowFrom(params: {
|
|
55
|
-
cfg:
|
|
55
|
+
cfg: OpenClawConfig;
|
|
56
56
|
prompter: WizardPrompter;
|
|
57
|
-
}): Promise<
|
|
57
|
+
}): Promise<OpenClawConfig> {
|
|
58
58
|
const existing = params.cfg.channels?.feishu?.allowFrom ?? [];
|
|
59
59
|
await params.prompter.note(
|
|
60
60
|
[
|
|
@@ -103,9 +103,9 @@ async function noteFeishuCredentialHelp(prompter: WizardPrompter): Promise<void>
|
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
function setFeishuGroupPolicy(
|
|
106
|
-
cfg:
|
|
106
|
+
cfg: OpenClawConfig,
|
|
107
107
|
groupPolicy: "open" | "allowlist" | "disabled",
|
|
108
|
-
):
|
|
108
|
+
): OpenClawConfig {
|
|
109
109
|
return {
|
|
110
110
|
...cfg,
|
|
111
111
|
channels: {
|
|
@@ -119,7 +119,7 @@ function setFeishuGroupPolicy(
|
|
|
119
119
|
};
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
function setFeishuGroupAllowFrom(cfg:
|
|
122
|
+
function setFeishuGroupAllowFrom(cfg: OpenClawConfig, groupAllowFrom: string[]): OpenClawConfig {
|
|
123
123
|
return {
|
|
124
124
|
...cfg,
|
|
125
125
|
channels: {
|
package/src/outbound.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ChannelOutboundAdapter } from "
|
|
1
|
+
import type { ChannelOutboundAdapter } from "openclaw/plugin-sdk";
|
|
2
2
|
import { getFeishuRuntime } from "./runtime.js";
|
|
3
3
|
import { sendMessageFeishu } from "./send.js";
|
|
4
4
|
import { sendMediaFeishu } from "./media.js";
|
package/src/policy.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ChannelGroupContext, GroupToolPolicyConfig } from "
|
|
1
|
+
import type { ChannelGroupContext, GroupToolPolicyConfig } from "openclaw/plugin-sdk";
|
|
2
2
|
import type { FeishuConfig, FeishuGroupConfig } from "./types.js";
|
|
3
3
|
|
|
4
4
|
export type FeishuAllowlistMatch = {
|
package/src/reactions.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { OpenClawConfig } from "openclaw/plugin-sdk";
|
|
2
2
|
import type { FeishuConfig } from "./types.js";
|
|
3
3
|
import { createFeishuClient } from "./client.js";
|
|
4
4
|
|
|
@@ -15,7 +15,7 @@ export type FeishuReaction = {
|
|
|
15
15
|
* @see https://open.feishu.cn/document/server-docs/im-v1/message-reaction/emojis-introduce
|
|
16
16
|
*/
|
|
17
17
|
export async function addReactionFeishu(params: {
|
|
18
|
-
cfg:
|
|
18
|
+
cfg: OpenClawConfig;
|
|
19
19
|
messageId: string;
|
|
20
20
|
emojiType: string;
|
|
21
21
|
}): Promise<{ reactionId: string }> {
|
|
@@ -56,7 +56,7 @@ export async function addReactionFeishu(params: {
|
|
|
56
56
|
* Remove a reaction from a message.
|
|
57
57
|
*/
|
|
58
58
|
export async function removeReactionFeishu(params: {
|
|
59
|
-
cfg:
|
|
59
|
+
cfg: OpenClawConfig;
|
|
60
60
|
messageId: string;
|
|
61
61
|
reactionId: string;
|
|
62
62
|
}): Promise<void> {
|
|
@@ -84,7 +84,7 @@ export async function removeReactionFeishu(params: {
|
|
|
84
84
|
* List all reactions for a message.
|
|
85
85
|
*/
|
|
86
86
|
export async function listReactionsFeishu(params: {
|
|
87
|
-
cfg:
|
|
87
|
+
cfg: OpenClawConfig;
|
|
88
88
|
messageId: string;
|
|
89
89
|
emojiType?: string;
|
|
90
90
|
}): Promise<FeishuReaction[]> {
|
package/src/reply-dispatcher.ts
CHANGED
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
createReplyPrefixContext,
|
|
3
3
|
createTypingCallbacks,
|
|
4
4
|
logTypingFailure,
|
|
5
|
-
type
|
|
5
|
+
type OpenClawConfig,
|
|
6
6
|
type RuntimeEnv,
|
|
7
7
|
type ReplyPayload,
|
|
8
|
-
} from "
|
|
8
|
+
} from "openclaw/plugin-sdk";
|
|
9
9
|
import { getFeishuRuntime } from "./runtime.js";
|
|
10
10
|
import { sendMessageFeishu, sendMarkdownCardFeishu } from "./send.js";
|
|
11
11
|
import type { FeishuConfig } from "./types.js";
|
|
@@ -28,7 +28,7 @@ function shouldUseCard(text: string): boolean {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
export type CreateFeishuReplyDispatcherParams = {
|
|
31
|
-
cfg:
|
|
31
|
+
cfg: OpenClawConfig;
|
|
32
32
|
agentId: string;
|
|
33
33
|
runtime: RuntimeEnv;
|
|
34
34
|
chatId: string;
|
package/src/runtime.ts
CHANGED
package/src/send.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { OpenClawConfig } from "openclaw/plugin-sdk";
|
|
2
2
|
import type { FeishuConfig, FeishuSendResult } from "./types.js";
|
|
3
3
|
import { createFeishuClient } from "./client.js";
|
|
4
4
|
import { resolveReceiveIdType, normalizeFeishuTarget } from "./targets.js";
|
|
@@ -19,7 +19,7 @@ export type FeishuMessageInfo = {
|
|
|
19
19
|
* Useful for fetching quoted/replied message content.
|
|
20
20
|
*/
|
|
21
21
|
export async function getMessageFeishu(params: {
|
|
22
|
-
cfg:
|
|
22
|
+
cfg: OpenClawConfig;
|
|
23
23
|
messageId: string;
|
|
24
24
|
}): Promise<FeishuMessageInfo | null> {
|
|
25
25
|
const { cfg, messageId } = params;
|
|
@@ -87,7 +87,7 @@ export async function getMessageFeishu(params: {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
export type SendFeishuMessageParams = {
|
|
90
|
-
cfg:
|
|
90
|
+
cfg: OpenClawConfig;
|
|
91
91
|
to: string;
|
|
92
92
|
text: string;
|
|
93
93
|
replyToMessageId?: string;
|
|
@@ -154,7 +154,7 @@ export async function sendMessageFeishu(params: SendFeishuMessageParams): Promis
|
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
export type SendFeishuCardParams = {
|
|
157
|
-
cfg:
|
|
157
|
+
cfg: OpenClawConfig;
|
|
158
158
|
to: string;
|
|
159
159
|
card: Record<string, unknown>;
|
|
160
160
|
replyToMessageId?: string;
|
|
@@ -215,7 +215,7 @@ export async function sendCardFeishu(params: SendFeishuCardParams): Promise<Feis
|
|
|
215
215
|
}
|
|
216
216
|
|
|
217
217
|
export async function updateCardFeishu(params: {
|
|
218
|
-
cfg:
|
|
218
|
+
cfg: OpenClawConfig;
|
|
219
219
|
messageId: string;
|
|
220
220
|
card: Record<string, unknown>;
|
|
221
221
|
}): Promise<void> {
|
|
@@ -261,7 +261,7 @@ export function buildMarkdownCard(text: string): Record<string, unknown> {
|
|
|
261
261
|
* This renders markdown properly in Feishu (code blocks, tables, bold/italic, etc.)
|
|
262
262
|
*/
|
|
263
263
|
export async function sendMarkdownCardFeishu(params: {
|
|
264
|
-
cfg:
|
|
264
|
+
cfg: OpenClawConfig;
|
|
265
265
|
to: string;
|
|
266
266
|
text: string;
|
|
267
267
|
replyToMessageId?: string;
|
|
@@ -276,7 +276,7 @@ export async function sendMarkdownCardFeishu(params: {
|
|
|
276
276
|
* Note: Feishu only allows editing messages within 24 hours.
|
|
277
277
|
*/
|
|
278
278
|
export async function editMessageFeishu(params: {
|
|
279
|
-
cfg:
|
|
279
|
+
cfg: OpenClawConfig;
|
|
280
280
|
messageId: string;
|
|
281
281
|
text: string;
|
|
282
282
|
}): Promise<void> {
|
package/src/typing.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { OpenClawConfig } from "openclaw/plugin-sdk";
|
|
2
2
|
import type { FeishuConfig } from "./types.js";
|
|
3
3
|
import { createFeishuClient } from "./client.js";
|
|
4
4
|
|
|
@@ -16,7 +16,7 @@ export type TypingIndicatorState = {
|
|
|
16
16
|
* Add a typing indicator (reaction) to a message
|
|
17
17
|
*/
|
|
18
18
|
export async function addTypingIndicator(params: {
|
|
19
|
-
cfg:
|
|
19
|
+
cfg: OpenClawConfig;
|
|
20
20
|
messageId: string;
|
|
21
21
|
}): Promise<TypingIndicatorState> {
|
|
22
22
|
const { cfg, messageId } = params;
|
|
@@ -48,7 +48,7 @@ export async function addTypingIndicator(params: {
|
|
|
48
48
|
* Remove a typing indicator (reaction) from a message
|
|
49
49
|
*/
|
|
50
50
|
export async function removeTypingIndicator(params: {
|
|
51
|
-
cfg:
|
|
51
|
+
cfg: OpenClawConfig;
|
|
52
52
|
state: TypingIndicatorState;
|
|
53
53
|
}): Promise<void> {
|
|
54
54
|
const { cfg, state } = params;
|