@elizaos/plugin-feishu 2.0.0-beta.1 → 2.0.3-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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Shaw Walters and elizaOS Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,146 +1,98 @@
1
- # Feishu/Lark Client Plugin for ElizaOS
1
+ # @elizaos/plugin-feishu
2
2
 
3
- This plugin integrates a Feishu (飞书) / Lark client with ElizaOS, allowing agents to interact via ByteDance's enterprise collaboration platform. It supports both the Chinese Feishu platform and the global Lark platform.
3
+ Feishu (飞书) / Lark messaging connector for elizaOS agents. Connects an Eliza
4
+ agent to ByteDance's enterprise collaboration platform — Feishu for China, Lark
5
+ globally — over a persistent WebSocket event subscription using the Lark Open
6
+ Platform API (`@larksuiteoapi/node-sdk`).
4
7
 
5
- ## Features
8
+ The plugin registers a `FeishuService` that opens the WebSocket connection,
9
+ routes inbound messages to the agent runtime as standard elizaOS message events,
10
+ and exposes a message connector (`send_message`, `send_card`, `send_image`,
11
+ `send_file`). It is opt-in and auto-enables when a `feishu` connector block is
12
+ present in the agent config (see `auto-enable.ts`).
6
13
 
7
- - **Seamless Feishu/Lark Integration**: Connects ElizaOS agents to Feishu/Lark through the Open Platform API.
8
- - **WebSocket Real-time Events**: Receives messages and events via WebSocket for low-latency interactions.
9
- - **Multi-region Support**: Works with both Feishu (China) and Lark (Global) platforms.
10
- - **Configuration Validation**: Ensures required settings are properly configured before starting.
11
- - **DM and Group Support**: Handles both direct messages and group conversations.
14
+ ## Setup
12
15
 
13
- ## Configuration Options
16
+ ### 1. Create a Feishu/Lark app
14
17
 
15
- | Key | Type | Default | Description |
16
- | --- | ---- | ------- | ----------- |
17
- | `FEISHU_APP_ID` | String | Required | Application ID from Feishu/Lark Open Platform (cli_xxx format). |
18
- | `FEISHU_APP_SECRET` | String | Required | Application secret for authentication. |
19
- | `FEISHU_DOMAIN` | String | `"feishu"` | Domain to use: `"feishu"` for China or `"lark"` for global. |
20
- | `FEISHU_ALLOWED_CHATS` | JSON Array | `[]` | List of chat IDs the bot is allowed to interact with. |
21
- | `FEISHU_TEST_CHAT_ID` | String | - | Chat ID for running tests. |
18
+ 1. Open the [Feishu Open Platform](https://open.feishu.cn/) or
19
+ [Lark Open Platform](https://open.larksuite.com/) and create an application.
20
+ 2. Enable the **Bot** capability (send/receive messages) and **Event
21
+ Subscription** in **long connection / WebSocket** mode.
22
+ 3. Copy the App ID (`cli_xxx`) and App Secret from the credentials page.
22
23
 
23
- ## Pre-Requisites
24
+ ### 2. Provide credentials
24
25
 
25
- ### 1. Create a Feishu/Lark App
26
-
27
- 1. Go to the [Feishu Open Platform](https://open.feishu.cn/) or [Lark Open Platform](https://open.larksuite.com/)
28
- 2. Create a new application
29
- 3. Enable the following capabilities:
30
- - **Bot** - For sending and receiving messages
31
- - **Event Subscription** - Enable WebSocket mode for real-time events
32
- 4. Copy your App ID and App Secret from the credentials page
33
-
34
- ### 2. Configure Environment Variables
35
-
36
- Add the following to your `.env` file:
26
+ Set the env vars (read via `runtime.getSetting` in `src/environment.ts`):
37
27
 
38
28
  ```env
39
29
  FEISHU_APP_ID=cli_xxx
40
30
  FEISHU_APP_SECRET=your-app-secret
41
- FEISHU_DOMAIN=feishu # or "lark" for global
31
+ FEISHU_DOMAIN=feishu # or "lark" for global
42
32
  ```
43
33
 
44
- ### 3. Configure Your Character
34
+ The env vars act as the `"default"` account. For multiple accounts, set
35
+ `character.settings.feishu` instead (see `src/accounts.ts`,
36
+ `FeishuMultiAccountConfig`).
37
+
38
+ ### 3. Enable the connector
45
39
 
46
- Create or modify your character configuration file:
40
+ Add a `feishu` block to the character `connectors` config. The plugin
41
+ auto-enables when the block is present and not explicitly disabled:
47
42
 
48
43
  ```json
49
44
  {
50
- "clients": ["feishu"],
51
- "settings": {
52
- "feishu": {
53
- "appId": "cli_xxx",
54
- "appSecret": "your-app-secret",
55
- "domain": "feishu"
56
- }
45
+ "connectors": {
46
+ "feishu": { "enabled": true }
57
47
  }
58
48
  }
59
49
  ```
60
50
 
61
- ## Usage
62
-
63
- ### Starting the Bot
64
-
65
- From the project root:
66
-
67
- ```bash
68
- npm run dev
69
- ```
70
-
71
- Or using bun:
72
-
73
- ```bash
74
- bun start --character="characters/your-character.json"
75
- ```
76
-
77
- ## API Endpoints
78
-
79
- The plugin connects to the following Feishu/Lark API endpoints:
80
-
81
- | Domain | Base URL |
82
- | ------ | -------- |
83
- | Feishu (China) | `https://open.feishu.cn` |
84
- | Lark (Global) | `https://open.larksuite.com` |
85
-
86
- ## Message Types Supported
51
+ ## Config
87
52
 
88
- - Text messages
89
- - Rich text (post) messages
90
- - Interactive cards
91
- - Image messages
92
- - File messages
53
+ | Env var | Required | Default | Description |
54
+ |---|---|---|---|
55
+ | `FEISHU_APP_ID` | Yes | — | App ID (`cli_xxx` format; must start with `cli_`). |
56
+ | `FEISHU_APP_SECRET` | Yes | — | App secret for authentication. |
57
+ | `FEISHU_DOMAIN` | No | `feishu` | `feishu` (China, `open.feishu.cn`) or `lark` (global, `open.larksuite.com`). |
58
+ | `FEISHU_ALLOWED_CHATS` | No | `[]` | JSON array of chat IDs the bot may interact with. Empty = all chats. |
59
+ | `FEISHU_IGNORE_BOT_MESSAGES` | No | `true` | Set `"false"` to process messages from other bots. |
60
+ | `FEISHU_RESPOND_ONLY_TO_MENTIONS` | No | `false` | Set `"true"` to respond only when @-mentioned. |
61
+ | `FEISHU_TEST_CHAT_ID` | No | — | Chat ID used by the test suite. |
93
62
 
94
- ## Event Types
63
+ ## Supported message types
95
64
 
96
- The plugin emits the following event types:
65
+ Text, rich text (`post`), interactive cards, images, and files. Outbound text is
66
+ chunked at `FEISHU_TEXT_CHUNK_LIMIT` (4000 chars) via `chunkFeishuText` in
67
+ `src/formatting.ts`.
97
68
 
98
- | Event | Description |
99
- | ----- | ----------- |
100
- | `FEISHU_WORLD_JOINED` | Bot joined a new chat/group |
101
- | `FEISHU_WORLD_CONNECTED` | Bot connected successfully |
102
- | `FEISHU_WORLD_LEFT` | Bot left a chat/group |
103
- | `FEISHU_MESSAGE_RECEIVED` | A message was received |
104
- | `FEISHU_MESSAGE_SENT` | A message was sent |
105
- | `FEISHU_ENTITY_JOINED` | A user joined a chat |
106
- | `FEISHU_ENTITY_LEFT` | A user left a chat |
69
+ ## Events emitted
107
70
 
108
- ## Security Best Practices
71
+ `FeishuEventTypes` (`src/types.ts`): `FEISHU_WORLD_CONNECTED`,
72
+ `FEISHU_WORLD_JOINED`, `FEISHU_WORLD_LEFT`, `FEISHU_ENTITY_JOINED`,
73
+ `FEISHU_ENTITY_LEFT`, `FEISHU_ENTITY_UPDATED`, `FEISHU_MESSAGE_RECEIVED`,
74
+ `FEISHU_MESSAGE_SENT`, `FEISHU_REACTION_RECEIVED`, `FEISHU_INTERACTION_RECEIVED`,
75
+ `FEISHU_SLASH_START`.
109
76
 
110
- - **Production**: Restrict bot access using `FEISHU_ALLOWED_CHATS` to specify authorized chat IDs.
111
- - **Token Management**: Keep your App Secret secure and never expose it in public repositories.
112
- - **Webhook Verification**: The plugin automatically verifies webhook signatures from Feishu/Lark.
77
+ ## Commands
113
78
 
114
- ## Feishu vs Lark
115
-
116
- | Feature | Feishu | Lark |
117
- | ------- | ------ | ---- |
118
- | Region | China | Global |
119
- | Domain | open.feishu.cn | open.larksuite.com |
120
- | Language | Chinese | English |
121
- | Data Residency | China | Global |
122
-
123
- Use `FEISHU_DOMAIN=lark` when deploying for international users.
79
+ ```bash
80
+ bun run --cwd plugins/plugin-feishu build # bun run build.ts → dist/
81
+ bun run --cwd plugins/plugin-feishu dev # bun --hot build.ts
82
+ bun run --cwd plugins/plugin-feishu test # vitest run
83
+ bun run --cwd plugins/plugin-feishu lint # biome check --write --unsafe
84
+ bun run --cwd plugins/plugin-feishu typecheck # tsgo --noEmit
85
+ ```
124
86
 
125
87
  ## Troubleshooting
126
88
 
127
- ### Connection Issues
128
-
129
- If you encounter connection issues:
130
-
131
- 1. Verify your App ID and App Secret are correct
132
- 2. Ensure the Bot capability is enabled in your app settings
133
- 3. Check that WebSocket event subscription is enabled
134
- 4. Verify your server can reach Feishu/Lark API endpoints
135
-
136
- ### Message Not Received
137
-
138
- If messages are not being received:
139
-
140
- 1. Ensure the bot is added to the chat/group
141
- 2. Check that `FEISHU_ALLOWED_CHATS` includes the chat ID (or is empty for all chats)
142
- 3. Verify event subscription is properly configured
89
+ - **Connection fails:** verify App ID / App Secret, confirm the Bot capability is
90
+ enabled, and confirm Event Subscription is in WebSocket (long connection) mode.
91
+ The service retries connection up to 5 times with exponential backoff.
92
+ - **Messages not received:** confirm the bot is added to the chat, and that the
93
+ chat ID is in `FEISHU_ALLOWED_CHATS` (or that the list is empty).
143
94
 
144
- ## License
95
+ Keep `FEISHU_APP_SECRET` out of source control. Restrict access in production
96
+ with `FEISHU_ALLOWED_CHATS`.
145
97
 
146
- MIT
98
+ For internals (services, providers, layout, gotchas), see `CLAUDE.md`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elizaos/plugin-feishu",
3
- "version": "2.0.0-beta.1",
3
+ "version": "2.0.3-beta.2",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -8,10 +8,26 @@
8
8
  "exports": {
9
9
  "./package.json": "./package.json",
10
10
  ".": {
11
+ "eliza-source": {
12
+ "types": "./src/index.ts",
13
+ "import": "./src/index.ts",
14
+ "default": "./src/index.ts"
15
+ },
11
16
  "import": {
12
17
  "types": "./dist/index.d.ts",
13
18
  "default": "./dist/index.js"
14
19
  }
20
+ },
21
+ "./*.css": "./dist/*.css",
22
+ "./*": {
23
+ "types": "./dist/*.d.ts",
24
+ "eliza-source": {
25
+ "types": "./src/*.ts",
26
+ "import": "./src/*.ts",
27
+ "default": "./src/*.ts"
28
+ },
29
+ "import": "./dist/*.js",
30
+ "default": "./dist/*.js"
15
31
  }
16
32
  },
17
33
  "files": [
@@ -27,7 +43,7 @@
27
43
  }
28
44
  },
29
45
  "dependencies": {
30
- "@elizaos/core": "2.0.0-beta.1",
46
+ "@elizaos/core": "2.0.3-beta.2",
31
47
  "@larksuiteoapi/node-sdk": "^1.40.0",
32
48
  "@types/node": "^25.0.3",
33
49
  "typescript": "^6.0.3"
@@ -47,7 +63,7 @@
47
63
  "format:check": "bunx @biomejs/biome format .",
48
64
  "lint:check": "bunx @biomejs/biome check .",
49
65
  "build:ts": "bun run build",
50
- "typecheck": "tsc --noEmit"
66
+ "typecheck": "tsgo --noEmit"
51
67
  },
52
68
  "publishConfig": {
53
69
  "access": "public"
@@ -99,5 +115,6 @@
99
115
  "platformDetails": {
100
116
  "node": "ESM build available via exports.import"
101
117
  }
102
- }
118
+ },
119
+ "gitHead": "82fe0f44215954c2417328203f5bd6510985c1fc"
103
120
  }
@@ -1,148 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../src/accounts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD;;GAEG;AACH,eAAO,MAAM,kBAAkB,YAAY,CAAC;AAE5C;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,KAAK,GAAG,WAAW,GAAG,MAAM,CAAC;AAExE;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC,gDAAgD;IAChD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,wCAAwC;IACxC,SAAS,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IACnC,qCAAqC;IACrC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,0CAA0C;IAC1C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oCAAoC;IACpC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC,6CAA6C;IAC7C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uBAAuB;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iDAAiD;IACjD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,oBAAoB;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wBAAwB;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yCAAy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a,EACtB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,GACb,iBAAiB,GAAG,SAAS,CAY/B;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE;IAC3C,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,mBAAmB,CAAC;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,iBAAiB,CAAC;CAChC,GAAG,OAAO,CAoDV;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE;IAC/C,aAAa,EAAE,mBAAmB,CAAC;IACnC,WAAW,CAAC,EAAE,iBAAiB,CAAC;CAChC,GAAG,OAAO,CAGV"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC"}
package/dist/config.d.ts DELETED
@@ -1,87 +0,0 @@
1
- /**
2
- * Feishu plugin configuration types.
3
- *
4
- * These types define the configuration schema for the Feishu plugin.
5
- * Shared base types are imported from @elizaos/core.
6
- */
7
- import type { BlockStreamingCoalesceConfig, ChannelHeartbeatVisibilityConfig, DmConfig, DmPolicy, GroupPolicy, GroupToolPolicyBySenderConfig, GroupToolPolicyConfig, MarkdownConfig, ProviderCommandsConfig } from "@elizaos/core";
8
- export type FeishuReactionNotificationMode = "off" | "own" | "all" | "allowlist";
9
- export type FeishuActionConfig = {
10
- reactions?: boolean;
11
- sendMessage?: boolean;
12
- };
13
- export type FeishuGroupConfig = {
14
- requireMention?: boolean;
15
- tools?: GroupToolPolicyConfig;
16
- toolsBySender?: GroupToolPolicyBySenderConfig;
17
- };
18
- export type FeishuAccountConfig = {
19
- /** Optional display name for this account (used in CLI/UI lists). */
20
- name?: string;
21
- /** Optional provider capability tags used for agent/runtime guidance. */
22
- capabilities?: string[];
23
- /** Markdown formatting overrides (tables). */
24
- markdown?: MarkdownConfig;
25
- /** Override native command registration for Feishu (bool or "auto"). */
26
- commands?: ProviderCommandsConfig;
27
- /** Allow channel-initiated config writes (default: true). */
28
- configWrites?: boolean;
29
- /** If false, do not start this Feishu account. Default: true. */
30
- enabled?: boolean;
31
- /** Feishu App ID (from developer console). */
32
- appId?: string;
33
- /** Feishu App Secret (from developer console). */
34
- appSecret?: string;
35
- /** Feishu Verification Token (for webhook validation). */
36
- verificationToken?: string;
37
- /** Feishu Encrypt Key (for decrypting message payloads). */
38
- encryptKey?: string;
39
- /** Webhook mode: event subscription callback. */
40
- webhookPath?: string;
41
- /** WebSocket mode: use Feishu WS push (default: false). */
42
- useWebSocket?: boolean;
43
- /** Direct message access policy (default: pairing). */
44
- dmPolicy?: DmPolicy;
45
- /** Optional allowlist for Feishu DM senders (open_id). */
46
- allowFrom?: Array<string | number>;
47
- /** Optional allowlist for Feishu group senders (open_id). */
48
- groupAllowFrom?: Array<string | number>;
49
- /**
50
- * Controls how group messages are handled:
51
- * - "open": groups bypass allowFrom, only @mention-gating applies
52
- * - "disabled": block all group messages
53
- * - "allowlist": only allow group messages from senders in groupAllowFrom/allowFrom
54
- */
55
- groupPolicy?: GroupPolicy;
56
- /** Max group messages to keep as history context (0 disables). */
57
- historyLimit?: number;
58
- /** Max DM turns to keep as history context. */
59
- dmHistoryLimit?: number;
60
- /** Per-DM config overrides keyed by user ID. */
61
- dms?: Record<string, DmConfig>;
62
- /** Outbound text chunk size (chars). Default: 4000. */
63
- textChunkLimit?: number;
64
- /** Chunking mode: "length" (default) splits by size; "newline" splits on every newline. */
65
- chunkMode?: "length" | "newline";
66
- /** Disable block streaming for this account. */
67
- blockStreaming?: boolean;
68
- /** Merge streamed block replies before sending. */
69
- blockStreamingCoalesce?: BlockStreamingCoalesceConfig;
70
- /** Maximum media file size in MB. Default: 100. */
71
- mediaMaxMb?: number;
72
- /** Per-action tool gating. */
73
- actions?: FeishuActionConfig;
74
- /** Reaction notification mode (off|own|all|allowlist). Default: off. */
75
- reactionNotifications?: FeishuReactionNotificationMode;
76
- /** Allowlist for reaction notifications when mode is allowlist. */
77
- reactionAllowlist?: Array<string | number>;
78
- /** Per-group config overrides keyed by chat_id. */
79
- groups?: Record<string, FeishuGroupConfig>;
80
- /** Heartbeat visibility settings for this channel. */
81
- heartbeat?: ChannelHeartbeatVisibilityConfig;
82
- };
83
- export type FeishuConfig = {
84
- /** Optional per-account Feishu configuration (multi-account). */
85
- accounts?: Record<string, FeishuAccountConfig>;
86
- } & FeishuAccountConfig;
87
- //# sourceMappingURL=config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACX,4BAA4B,EAC5B,gCAAgC,EAChC,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,6BAA6B,EAC7B,qBAAqB,EACrB,cAAc,EACd,sBAAsB,EACtB,MAAM,eAAe,CAAC;AAMvB,MAAM,MAAM,8BAA8B,GACvC,KAAK,GACL,KAAK,GACL,KAAK,GACL,WAAW,CAAC;AAMf,MAAM,MAAM,kBAAkB,GAAG;IAChC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAMF,MAAM,MAAM,iBAAiB,GAAG;IAC/B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,KAAK,CAAC,EAAE,qBAAqB,CAAC;IAC9B,aAAa,CAAC,EAAE,6BAA6B,CAAC;CAC9C,CAAC;AAMF,MAAM,MAAM,mBAAmB,GAAG;IACjC,qEAAqE;IACrE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yEAAyE;IACzE,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,wEAAwE;IACx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C7B,wEAAwE;IACxE,qBAAqB,CAAC,EAAE,8BAA8B,CAAC;IACvD,mEAAmE;IACnE,iBAAiB,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IAC3C,mDAAmD;IACnD,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAC3C,sDAAsD;IACtD,SAAS,CAAC,EAAE,gCAAgC,CAAC;CAC7C,CAAC;AAMF,MAAM,MAAM,YAAY,GAAG;IAC1B,iEAAiE;IACjE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;CAC/C,GAAG,mBAAmB,CAAC"}
@@ -1,16 +0,0 @@
1
- /**
2
- * Feishu ConnectorAccountManager provider.
3
- *
4
- * Adapts the multi-account scaffolding in `accounts.ts` to the
5
- * `ConnectorAccountProvider` contract from
6
- * `@elizaos/core/connectors/account-manager`.
7
- *
8
- * Source of truth for accounts is character settings (`character.settings.feishu`)
9
- * plus env-var fallbacks (FEISHU_APP_ID, FEISHU_APP_SECRET). `listAccounts`
10
- * enumerates all configured/enabled accounts; single-account env-only
11
- * deployments still surface as a `default` account. AccountKey is the appId.
12
- */
13
- import type { ConnectorAccountProvider, IAgentRuntime } from "@elizaos/core";
14
- export declare const FEISHU_PROVIDER_ID = "feishu";
15
- export declare function createFeishuConnectorAccountProvider(runtime: IAgentRuntime): ConnectorAccountProvider;
16
- //# sourceMappingURL=connector-account-provider.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"connector-account-provider.d.ts","sourceRoot":"","sources":["../src/connector-account-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAIX,wBAAwB,EACxB,aAAa,EACb,MAAM,eAAe,CAAC;AASvB,eAAO,MAAM,kBAAkB,WAAW,CAAC;AAmC3C,wBAAgB,oCAAoC,CACnD,OAAO,EAAE,aAAa,GACpB,wBAAwB,CA0C1B"}
@@ -1,20 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,38 +0,0 @@
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
@@ -1 +0,0 @@
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;IAC5B,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;CACrC;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,aAAa,GAAG,YAAY,GAAG,IAAI,CAyD3E;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,YAAY,GAAG;IACrD,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CACf,CAcA;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAK3E"}