Add Feishu channel adapter with webhook and send path

This commit is contained in:
William Valentin
2026-02-16 13:07:45 -08:00
parent 376f74550e
commit 891ccb696e
16 changed files with 644 additions and 6 deletions
@@ -0,0 +1,55 @@
# 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
```
+30 -3
View File
@@ -620,6 +620,33 @@
],
"test_status": "pnpm test:run src/channels/line/adapter.test.ts src/daemon/channels.test.ts src/config/schema.test.ts src/gateway/handlers/services.test.ts + pnpm typecheck + pnpm build passing"
},
"feishu-channel-adapter": {
"file": "2026-02-16-feishu-channel-adapter-checklist.md",
"status": "completed",
"date": "2026-02-16",
"updated": "2026-02-16",
"summary": "Implemented Feishu/Lark channel adapter with webhook ingress (`/feishu/events`), URL verification challenge handling, webhook token validation, mention/allowlist gating, outbound IM send path via tenant access token, daemon/gateway wiring, and services visibility.",
"files_created": [
"docs/plans/2026-02-16-feishu-channel-adapter-checklist.md",
"src/channels/feishu/adapter.ts",
"src/channels/feishu/adapter.test.ts",
"src/channels/feishu/index.ts"
],
"files_modified": [
"src/channels/index.ts",
"src/daemon/channels.ts",
"src/daemon/channels.test.ts",
"src/config/schema.ts",
"src/config/schema.test.ts",
"src/gateway/server.ts",
"src/gateway/handlers/services.ts",
"src/gateway/handlers/services.test.ts",
"README.md",
"config/default.yaml",
"docs/architecture/CONTRIBUTOR_MAP.md"
],
"test_status": "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 passing"
},
"qmd-backend": {
"file": "2026-02-16-qmd-backend-checklist.md",
"status": "completed",
@@ -3181,7 +3208,7 @@
}
},
"overall_progress": {
"total_test_count": 1802,
"total_test_count": 1808,
"all_tests_passing": true,
"p0_completion": "3/3 (100%)",
"p1_completion": "4/4 (100%)",
@@ -3196,12 +3223,12 @@
"tier2_completion": "4/4 (100%) — inbound webhooks, vector memory search, Dockerfile, heartbeat monitor",
"tier3_completion": "5/5 (100%) — lane queue, credential redaction, web UI token dashboard, xAI (Grok) provider, Voyage AI embeddings",
"tier4_completion": "4/4 (100%) — gateway lock, shell completion, Tailscale Serve/Funnel, DM pairing codes",
"feature_gap_scorecard": "124/128 match (97%), 0 partial (0%), 4 missing (3%)",
"feature_gap_scorecard": "125/128 match (98%), 0 partial (0%), 3 missing (2%)",
"operator_dx_milestone": "Phase 3 (Live Ops Dashboard): 2/2 plans complete — milestone done",
"gmail_auth_cli": "flynn gmail-auth command implemented with OAuth2 flow, doctor check, config routed to Telegram",
"native_audio_support": "completed — smart routing for native audio (Gemini/OpenAI/GitHub) vs Whisper transcription fallback",
"remaining_phases_completion": "Phase 1: 3/3 (100%) — context levels, command registry, memory structure. Phase 2: 3/3 (100%) — component registry, confidence routing, history index. Phase 3: 2/2 (100%) — adaptive memory/compaction, truthfulness/autonomy hardening",
"next_up": "OpenClaw gap: Feishu channel adapter (open next scoped implementation checklist)"
"next_up": "OpenClaw gap: Zalo channel adapter (open next scoped implementation checklist)"
},
"soul_md_and_cron_create": {
"date": "2026-02-11",