@elizaos/plugin-feishu 2.0.0-alpha
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.d.ts +148 -0
- package/dist/accounts.d.ts.map +1 -0
- package/dist/actions/index.d.ts +2 -0
- package/dist/actions/index.d.ts.map +1 -0
- package/dist/actions/sendMessage.d.ts +4 -0
- package/dist/actions/sendMessage.d.ts.map +1 -0
- package/dist/constants.d.ts +20 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/environment.d.ts +38 -0
- package/dist/environment.d.ts.map +1 -0
- package/dist/formatting.d.ts +104 -0
- package/dist/formatting.d.ts.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1391 -0
- package/dist/index.js.map +19 -0
- package/dist/messageManager.d.ts +52 -0
- package/dist/messageManager.d.ts.map +1 -0
- package/dist/providers/chatState.d.ts +7 -0
- package/dist/providers/chatState.d.ts.map +1 -0
- package/dist/providers/index.d.ts +2 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/service.d.ts +56 -0
- package/dist/service.d.ts.map +1 -0
- package/dist/types.d.ts +288 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +94 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import type { IAgentRuntime } from "@elizaos/core";
|
|
2
|
+
/**
|
|
3
|
+
* Default account identifier used when no specific account is configured
|
|
4
|
+
*/
|
|
5
|
+
export declare const DEFAULT_ACCOUNT_ID = "default";
|
|
6
|
+
/**
|
|
7
|
+
* Token source indicator
|
|
8
|
+
*/
|
|
9
|
+
export type FeishuTokenSource = "config" | "env" | "character" | "none";
|
|
10
|
+
/**
|
|
11
|
+
* Group-specific configuration
|
|
12
|
+
*/
|
|
13
|
+
export interface FeishuGroupConfig {
|
|
14
|
+
/** If false, ignore messages from this group */
|
|
15
|
+
enabled?: boolean;
|
|
16
|
+
/** Allowlist for users in this group */
|
|
17
|
+
allowFrom?: Array<string | number>;
|
|
18
|
+
/** Require bot mention to respond */
|
|
19
|
+
requireMention?: boolean;
|
|
20
|
+
/** Custom system prompt for this group */
|
|
21
|
+
systemPrompt?: string;
|
|
22
|
+
/** Skills enabled for this group */
|
|
23
|
+
skills?: string[];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Configuration for a single Feishu account
|
|
27
|
+
*/
|
|
28
|
+
export interface FeishuAccountConfig {
|
|
29
|
+
/** Optional display name for this account */
|
|
30
|
+
name?: string;
|
|
31
|
+
/** Bot display name */
|
|
32
|
+
botName?: string;
|
|
33
|
+
/** If false, do not start this Feishu account */
|
|
34
|
+
enabled?: boolean;
|
|
35
|
+
/** Feishu App ID */
|
|
36
|
+
appId?: string;
|
|
37
|
+
/** Feishu App Secret */
|
|
38
|
+
appSecret?: string;
|
|
39
|
+
/** Path to file containing app secret */
|
|
40
|
+
appSecretFile?: string;
|
|
41
|
+
/** Encrypt key for event callback */
|
|
42
|
+
encryptKey?: string;
|
|
43
|
+
/** Verification token for event callback */
|
|
44
|
+
verificationToken?: string;
|
|
45
|
+
/** Base API URL (for self-hosted Feishu) */
|
|
46
|
+
apiUrl?: string;
|
|
47
|
+
/** Allowlist for DM senders */
|
|
48
|
+
allowFrom?: Array<string | number>;
|
|
49
|
+
/** Allowlist for groups */
|
|
50
|
+
groupAllowFrom?: Array<string | number>;
|
|
51
|
+
/** DM access policy */
|
|
52
|
+
dmPolicy?: "open" | "allowlist" | "pairing" | "disabled";
|
|
53
|
+
/** Group message access policy */
|
|
54
|
+
groupPolicy?: "open" | "allowlist" | "disabled";
|
|
55
|
+
/** Max media size in MB */
|
|
56
|
+
mediaMaxMb?: number;
|
|
57
|
+
/** Text chunk limit for messages */
|
|
58
|
+
textChunkLimit?: number;
|
|
59
|
+
/** Webhook path for event callbacks */
|
|
60
|
+
webhookPath?: string;
|
|
61
|
+
/** Group-specific configurations */
|
|
62
|
+
groups?: Record<string, FeishuGroupConfig>;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Multi-account Feishu configuration structure
|
|
66
|
+
*/
|
|
67
|
+
export interface FeishuMultiAccountConfig {
|
|
68
|
+
/** Default/base configuration applied to all accounts */
|
|
69
|
+
enabled?: boolean;
|
|
70
|
+
appId?: string;
|
|
71
|
+
appSecret?: string;
|
|
72
|
+
appSecretFile?: string;
|
|
73
|
+
encryptKey?: string;
|
|
74
|
+
verificationToken?: string;
|
|
75
|
+
apiUrl?: string;
|
|
76
|
+
dmPolicy?: "open" | "allowlist" | "pairing" | "disabled";
|
|
77
|
+
groupPolicy?: "open" | "allowlist" | "disabled";
|
|
78
|
+
mediaMaxMb?: number;
|
|
79
|
+
textChunkLimit?: number;
|
|
80
|
+
webhookPath?: string;
|
|
81
|
+
/** Per-account configuration overrides */
|
|
82
|
+
accounts?: Record<string, FeishuAccountConfig>;
|
|
83
|
+
/** Group configurations at base level */
|
|
84
|
+
groups?: Record<string, FeishuGroupConfig>;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Resolved Feishu account with all configuration merged
|
|
88
|
+
*/
|
|
89
|
+
export interface ResolvedFeishuAccount {
|
|
90
|
+
accountId: string;
|
|
91
|
+
enabled: boolean;
|
|
92
|
+
name?: string;
|
|
93
|
+
appId: string;
|
|
94
|
+
appSecret: string;
|
|
95
|
+
tokenSource: FeishuTokenSource;
|
|
96
|
+
configured: boolean;
|
|
97
|
+
config: FeishuAccountConfig;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Normalizes an account ID, returning the default if not provided
|
|
101
|
+
*/
|
|
102
|
+
export declare function normalizeAccountId(accountId?: string | null): string;
|
|
103
|
+
/**
|
|
104
|
+
* Gets the multi-account configuration from runtime settings
|
|
105
|
+
*/
|
|
106
|
+
export declare function getMultiAccountConfig(runtime: IAgentRuntime): FeishuMultiAccountConfig;
|
|
107
|
+
/**
|
|
108
|
+
* Lists all configured account IDs
|
|
109
|
+
*/
|
|
110
|
+
export declare function listFeishuAccountIds(runtime: IAgentRuntime): string[];
|
|
111
|
+
/**
|
|
112
|
+
* Resolves the default account ID to use
|
|
113
|
+
*/
|
|
114
|
+
export declare function resolveDefaultFeishuAccountId(runtime: IAgentRuntime): string;
|
|
115
|
+
/**
|
|
116
|
+
* Resolves a complete Feishu account configuration
|
|
117
|
+
*/
|
|
118
|
+
export declare function resolveFeishuAccount(runtime: IAgentRuntime, accountId?: string | null): ResolvedFeishuAccount;
|
|
119
|
+
/**
|
|
120
|
+
* Lists all enabled Feishu accounts
|
|
121
|
+
*/
|
|
122
|
+
export declare function listEnabledFeishuAccounts(runtime: IAgentRuntime): ResolvedFeishuAccount[];
|
|
123
|
+
/**
|
|
124
|
+
* Checks if multi-account mode is enabled
|
|
125
|
+
*/
|
|
126
|
+
export declare function isMultiAccountEnabled(runtime: IAgentRuntime): boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Resolves group configuration for a specific group
|
|
129
|
+
*/
|
|
130
|
+
export declare function resolveFeishuGroupConfig(runtime: IAgentRuntime, accountId: string, groupId: string): FeishuGroupConfig | undefined;
|
|
131
|
+
/**
|
|
132
|
+
* Checks if a user is allowed based on policy and allowlist
|
|
133
|
+
*/
|
|
134
|
+
export declare function isFeishuUserAllowed(params: {
|
|
135
|
+
userId: string;
|
|
136
|
+
accountConfig: FeishuAccountConfig;
|
|
137
|
+
isGroup: boolean;
|
|
138
|
+
groupId?: string;
|
|
139
|
+
groupConfig?: FeishuGroupConfig;
|
|
140
|
+
}): boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Checks if mention is required in a group
|
|
143
|
+
*/
|
|
144
|
+
export declare function isFeishuMentionRequired(params: {
|
|
145
|
+
accountConfig: FeishuAccountConfig;
|
|
146
|
+
groupConfig?: FeishuGroupConfig;
|
|
147
|
+
}): boolean;
|
|
148
|
+
//# sourceMappingURL=accounts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../src/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EAAE;IAC9C,aAAa,EAAE,mBAAmB,CAAC;IACnC,WAAW,CAAC,EAAE,iBAAiB,CAAC;CACjC,GAAG,OAAO,CAGV"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sendMessage.d.ts","sourceRoot":"","sources":["../../src/actions/sendMessage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EAQP,MAAM,eAAe,CAAC;AAIvB,eAAO,MAAM,mBAAmB,wBAAwB,CAAC;AAEzD,eAAO,MAAM,iBAAiB,EAAE,MA0F/B,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Service name used to register and retrieve the Feishu service.
|
|
3
|
+
*/
|
|
4
|
+
export declare const FEISHU_SERVICE_NAME = "feishu";
|
|
5
|
+
/**
|
|
6
|
+
* Default API domains for Feishu and Lark.
|
|
7
|
+
*/
|
|
8
|
+
export declare const FEISHU_DOMAINS: {
|
|
9
|
+
readonly feishu: "https://open.feishu.cn";
|
|
10
|
+
readonly lark: "https://open.larksuite.com";
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Maximum message length for Feishu text messages.
|
|
14
|
+
*/
|
|
15
|
+
export declare const MAX_MESSAGE_LENGTH = 4000;
|
|
16
|
+
/**
|
|
17
|
+
* Default timeout for API requests in milliseconds.
|
|
18
|
+
*/
|
|
19
|
+
export declare const DEFAULT_TIMEOUT_MS = 30000;
|
|
20
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,mBAAmB,WAAW,CAAC;AAE5C;;GAEG;AACH,eAAO,MAAM,cAAc;;;CAGjB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,kBAAkB,OAAO,CAAC;AAEvC;;GAEG;AACH,eAAO,MAAM,kBAAkB,QAAQ,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { IAgentRuntime } from "@elizaos/core";
|
|
2
|
+
/**
|
|
3
|
+
* Configuration for the Feishu service.
|
|
4
|
+
*/
|
|
5
|
+
export interface FeishuConfig {
|
|
6
|
+
/** Application ID (cli_xxx format) */
|
|
7
|
+
appId: string;
|
|
8
|
+
/** Application secret */
|
|
9
|
+
appSecret: string;
|
|
10
|
+
/** Domain: 'feishu' for China or 'lark' for global */
|
|
11
|
+
domain: "feishu" | "lark";
|
|
12
|
+
/** API base URL */
|
|
13
|
+
apiRoot: string;
|
|
14
|
+
/** Allowed chat IDs (empty means all allowed) */
|
|
15
|
+
allowedChatIds: string[];
|
|
16
|
+
/** Test chat ID for testing */
|
|
17
|
+
testChatId?: string;
|
|
18
|
+
/** Whether to ignore bot messages */
|
|
19
|
+
shouldIgnoreBotMessages: boolean;
|
|
20
|
+
/** Whether to respond only to mentions */
|
|
21
|
+
shouldRespondOnlyToMentions: boolean;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Validates and returns the Feishu configuration from runtime settings.
|
|
25
|
+
*/
|
|
26
|
+
export declare function getFeishuConfig(runtime: IAgentRuntime): FeishuConfig | null;
|
|
27
|
+
/**
|
|
28
|
+
* Validates the Feishu configuration.
|
|
29
|
+
*/
|
|
30
|
+
export declare function validateConfig(config: FeishuConfig): {
|
|
31
|
+
valid: boolean;
|
|
32
|
+
error?: string;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Checks if a chat is allowed based on configuration.
|
|
36
|
+
*/
|
|
37
|
+
export declare function isChatAllowed(config: FeishuConfig, chatId: string): boolean;
|
|
38
|
+
//# sourceMappingURL=environment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../src/environment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAGnD;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,yBAAyB;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,sDAAsD;IACtD,MAAM,EAAE,QAAQ,GAAG,MAAM,CAAC;IAC1B,mBAAmB;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,iDAAiD;IACjD,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,+BAA+B;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qCAAqC;IACrC,uBAAuB,EAAE,OAAO,CAAC;IACjC,0CAA0C;IAC1C,2BAA2B,EAAE,OAAO,CAAC;CACtC;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,aAAa,GAAG,YAAY,GAAG,IAAI,CAyD3E;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,YAAY,GAAG;IACpD,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAcA;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAK3E"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Feishu text chunk limit
|
|
3
|
+
*/
|
|
4
|
+
export declare const FEISHU_TEXT_CHUNK_LIMIT = 4000;
|
|
5
|
+
/**
|
|
6
|
+
* Feishu Post (rich text) element types
|
|
7
|
+
*/
|
|
8
|
+
export type FeishuPostElement = {
|
|
9
|
+
tag: "text";
|
|
10
|
+
text: string;
|
|
11
|
+
style?: string[];
|
|
12
|
+
} | {
|
|
13
|
+
tag: "a";
|
|
14
|
+
text: string;
|
|
15
|
+
href: string;
|
|
16
|
+
style?: string[];
|
|
17
|
+
} | {
|
|
18
|
+
tag: "at";
|
|
19
|
+
user_id: string;
|
|
20
|
+
} | {
|
|
21
|
+
tag: "img";
|
|
22
|
+
image_key: string;
|
|
23
|
+
} | {
|
|
24
|
+
tag: "media";
|
|
25
|
+
file_key: string;
|
|
26
|
+
} | {
|
|
27
|
+
tag: "emotion";
|
|
28
|
+
emoji_type: string;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* A line of Feishu Post content
|
|
32
|
+
*/
|
|
33
|
+
export type FeishuPostLine = FeishuPostElement[];
|
|
34
|
+
/**
|
|
35
|
+
* Feishu Post content structure
|
|
36
|
+
*/
|
|
37
|
+
export interface FeishuPostContent {
|
|
38
|
+
zh_cn?: {
|
|
39
|
+
title?: string;
|
|
40
|
+
content: FeishuPostLine[];
|
|
41
|
+
};
|
|
42
|
+
en_us?: {
|
|
43
|
+
title?: string;
|
|
44
|
+
content: FeishuPostLine[];
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Result of formatting markdown for Feishu
|
|
49
|
+
*/
|
|
50
|
+
export interface FeishuFormattedChunk {
|
|
51
|
+
post: FeishuPostContent;
|
|
52
|
+
text: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Options for text chunking
|
|
56
|
+
*/
|
|
57
|
+
export interface ChunkFeishuTextOpts {
|
|
58
|
+
limit?: number;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Convert markdown to Feishu Post format
|
|
62
|
+
*/
|
|
63
|
+
export declare function markdownToFeishuPost(markdown: string): FeishuPostContent;
|
|
64
|
+
/**
|
|
65
|
+
* Chunk text for Feishu messages
|
|
66
|
+
*/
|
|
67
|
+
export declare function chunkFeishuText(text: string, opts?: ChunkFeishuTextOpts): string[];
|
|
68
|
+
/**
|
|
69
|
+
* Convert markdown to Feishu Post chunks
|
|
70
|
+
*/
|
|
71
|
+
export declare function markdownToFeishuChunks(markdown: string, limit?: number): FeishuFormattedChunk[];
|
|
72
|
+
/**
|
|
73
|
+
* Check if text contains markdown formatting
|
|
74
|
+
*/
|
|
75
|
+
export declare function containsMarkdown(text: string): boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Strip markdown formatting from text
|
|
78
|
+
*/
|
|
79
|
+
export declare function stripMarkdown(text: string): string;
|
|
80
|
+
/**
|
|
81
|
+
* Format Feishu user mention
|
|
82
|
+
*/
|
|
83
|
+
export declare function formatFeishuUserMention(userId: string): string;
|
|
84
|
+
/**
|
|
85
|
+
* Format Feishu user mention for all users
|
|
86
|
+
*/
|
|
87
|
+
export declare function formatFeishuAtAll(): string;
|
|
88
|
+
/**
|
|
89
|
+
* Truncate text to a maximum length
|
|
90
|
+
*/
|
|
91
|
+
export declare function truncateText(text: string, maxLength: number): string;
|
|
92
|
+
/**
|
|
93
|
+
* Resolve system location for logging
|
|
94
|
+
*/
|
|
95
|
+
export declare function resolveFeishuSystemLocation(params: {
|
|
96
|
+
chatType: "p2p" | "group";
|
|
97
|
+
chatId: string;
|
|
98
|
+
chatName?: string;
|
|
99
|
+
}): string;
|
|
100
|
+
/**
|
|
101
|
+
* Check if chat is a group chat
|
|
102
|
+
*/
|
|
103
|
+
export declare function isGroupChat(chatType: string): boolean;
|
|
104
|
+
//# sourceMappingURL=formatting.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatting.d.ts","sourceRoot":"","sources":["../src/formatting.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,uBAAuB,OAAO,CAAC;AAE5C;;GAEG;AACH,MAAM,MAAM,iBAAiB,GACzB;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,GAC/C;IAAE,GAAG,EAAE,GAAG,CAAC;IAAC,IAA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AgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAgBtD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAkClD;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAQpE;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE;IAClD,QAAQ,EAAE,KAAK,GAAG,OAAO,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,MAAM,CAIT;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAErD"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Plugin } from "@elizaos/core";
|
|
2
|
+
import { SEND_MESSAGE_ACTION, sendMessageAction } from "./actions";
|
|
3
|
+
import { FEISHU_SERVICE_NAME } from "./constants";
|
|
4
|
+
import { MessageManager } from "./messageManager";
|
|
5
|
+
import { CHAT_STATE_PROVIDER, chatStateProvider } from "./providers";
|
|
6
|
+
import { FeishuService } from "./service";
|
|
7
|
+
declare const feishuPlugin: Plugin;
|
|
8
|
+
export { FeishuService, MessageManager, sendMessageAction, SEND_MESSAGE_ACTION, chatStateProvider, CHAT_STATE_PROVIDER, FEISHU_SERVICE_NAME, };
|
|
9
|
+
export { DEFAULT_ACCOUNT_ID, type FeishuAccountConfig, type FeishuGroupConfig, type FeishuMultiAccountConfig, type FeishuTokenSource, isFeishuMentionRequired, isFeishuUserAllowed, isMultiAccountEnabled, listEnabledFeishuAccounts, listFeishuAccountIds, normalizeAccountId, type ResolvedFeishuAccount, resolveDefaultFeishuAccountId, resolveFeishuAccount, resolveFeishuGroupConfig, } from "./accounts";
|
|
10
|
+
export * from "./constants";
|
|
11
|
+
export * from "./environment";
|
|
12
|
+
export { type ChunkFeishuTextOpts, chunkFeishuText, containsMarkdown, FEISHU_TEXT_CHUNK_LIMIT, type FeishuFormattedChunk, type FeishuPostContent, type FeishuPostElement, type FeishuPostLine, formatFeishuAtAll, formatFeishuUserMention, isGroupChat, markdownToFeishuChunks, markdownToFeishuPost, resolveFeishuSystemLocation, stripMarkdown, truncateText, } from "./formatting";
|
|
13
|
+
export * from "./types";
|
|
14
|
+
export default feishuPlugin;
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C,QAAA,MAAM,YAAY,EAAE,MAOnB,CAAC;AAEF,OAAO,EACL,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,GACpB,CAAC;AAGF,OAAO,EACL,kBAAkB,EAClB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,EACtB,uBAAuB,EACvB,mBAAmB,EACnB,qBAAqB,EACrB,yBAAyB,EACzB,oBAAoB,EACpB,kBAAkB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