Files
flynn/docs/plans/2026-02-16-feishu-channel-adapter-checklist.md
T
2026-02-16 13:07:45 -08:00

56 lines
1.8 KiB
Markdown

# Feishu Channel Adapter Checklist
**Date:** 2026-02-16
**Scope:** Implement Feishu/Lark adapter as the second item in the LINE/Feishu/Zalo channel gap set.
## Goal
Add a Feishu channel adapter with webhook ingress, outbound send path, mention/allowlist gating, and runtime wiring through daemon + gateway.
## Implemented
- Added Feishu adapter:
- `src/channels/feishu/adapter.ts`
- `src/channels/feishu/index.ts`
- Inbound webhook handling:
- endpoint: `POST /feishu/events`
- supports Feishu URL verification challenge flow.
- validates `header.token` when `webhook_token` is configured.
- Message normalization:
- handles `im.message.receive_v1` text messages.
- parses `message.content` JSON `{ "text": "..." }`.
- emits normalized `InboundMessage` with `metadata.replyPeerId`.
- Outbound messaging:
- obtains tenant access token via internal app credentials.
- sends text messages via Feishu IM v1 messages API.
- Gating:
- optional chat allowlist (`allowed_chat_ids`).
- mention policy (`require_mention`, `mention_name`) with DM bypass.
- Runtime integration:
- config schema + defaults for `feishu`.
- daemon registration and gateway handler binding.
- gateway route wiring + services discovery visibility.
## Tests
- `src/channels/feishu/adapter.test.ts`
- name/status
- outbound token + send path
- url verification handling
- inbound event normalization
- webhook token enforcement
- `src/daemon/channels.test.ts`
- adapter registration + gateway `setFeishuHandler` binding
- `src/config/schema.test.ts`
- feishu config parsing/defaults
- `src/gateway/handlers/services.test.ts`
- `feishu` service presence
## Validation Run
```bash
pnpm test:run src/channels/feishu/adapter.test.ts src/daemon/channels.test.ts src/config/schema.test.ts src/gateway/handlers/services.test.ts
pnpm typecheck
pnpm build
```