openclaw/extensions/feishu/src/runtime.ts
wangchuang 902f89840c feat(channels): add Feishu/Lark channel integration
Add complete Feishu (Lark) channel plugin with WebSocket support for real-time messaging.

Features:
- Send and receive text messages in direct chats and group chats
- WebSocket-based event subscription (im.message.receive_v1)
- Multi-account support
- Interactive CLI onboarding (pnpm clawdbot channels add feishu)
- Optional encryption and verification token support

Implementation:
- Client wrapper for @larksuiteoapi/node-sdk
- Event dispatcher for message handling
- Account management and configuration
- Comprehensive README with setup guide and troubleshooting

Files:
- package.json, clawdbot.plugin.json: Plugin metadata and dependencies
- index.ts: Plugin entry point
- src/accounts.ts: Account resolution and validation
- src/channel.ts: Channel plugin and dock definitions
- src/client.ts: Feishu API client wrapper
- src/monitor.ts: WebSocket event monitoring
- src/onboarding.ts: Interactive CLI setup wizard
- src/runtime.ts: Runtime context management
- src/types.ts: TypeScript type definitions
- README.md: Configuration guide and documentation
2026-01-27 21:59:41 +08:00

17 lines
401 B
TypeScript

import type { ClawdbotPluginRuntime } from "clawdbot/plugin-sdk";
type FeishuRuntime = ClawdbotPluginRuntime;
let _runtime: FeishuRuntime | undefined;
export function setFeishuRuntime(runtime: FeishuRuntime) {
_runtime = runtime;
}
export function getFeishuRuntime(): FeishuRuntime {
if (!_runtime) {
throw new Error("Feishu runtime not initialized");
}
return _runtime;
}