Skip to content

feat: add Feishu/Lark platform integration#35

Open
veithly wants to merge 3 commits intomasterfrom
feat/feishu-integration
Open

feat: add Feishu/Lark platform integration#35
veithly wants to merge 3 commits intomasterfrom
feat/feishu-integration

Conversation

@veithly
Copy link
Contributor

@veithly veithly commented Mar 13, 2026

Summary

This PR recovers the Feishu/Lark platform integration (originally PR #28) that was merged into the dev branch on 2026-03-06 but was never synced to master.

The dev branch was synced to master via PR #18 on 2026-02-25, but PR #28 was merged into dev after that sync, so the Feishu code was left behind when subsequent features were merged directly to master (PRs #27, #29, #31-#33).

Changes recovered from PR #28

  • New module: spoon_bot/channels/feishu/ — full Feishu/Lark bot channel
    • WebSocket (long-connection) and Webhook modes
    • Markdown card rendering (Schema 2.0), multi-type message reception
    • Image/file upload/download via FeishuMedia helper
    • Emoji typing indicators, message dedup, bot open_id auto-fetch
    • Thread-safe sender name cache, WebSocket health monitoring
  • spoon_bot/channels/base.py: adds on_processing_start / on_processing_end lifecycle hooks to BaseChannel
  • spoon_bot/channels/manager.py: calls processing hooks in _handle_message; circuit breaker logic preserved
  • spoon_bot/channels/config.py: adds render_mode to get_feishu_configs
  • tests/test_feishu_channel.py: 22 unit tests

Conflict resolution

Two minor conflicts were resolved when cherry-picking onto current master:

  1. config.py: added render_mode parameter (new in PR feat: add Feishu/Lark platform integration #28, not yet in master)
  2. manager.py: kept existing circuit breaker logic AND added the new processing lifecycle hooks

Test plan

  • Unit tests: pytest tests/test_feishu_channel.py
  • Manual: Feishu bot receives and replies in DM
  • Manual: Feishu bot receives and replies in group (with @mention)
  • Manual: Typing indicator (emoji reaction) appears during processing

lalyeah and others added 3 commits March 13, 2026 16:52
Implement full Feishu bot channel with WebSocket and Webhook modes:

- Rich text / Markdown card rendering (auto-detect code blocks & tables)
- Multi-type message reception: text, post, image, file, audio, video, sticker
- Image/file upload and download via FeishuMedia helper
- Emoji reactions for typing indicators during agent processing
- Message editing via PatchMessage API
- Sender name resolution with thread-safe 10-min cache (max 1000 entries)
- Message deduplication to handle WebSocket reconnection replays
- Bot open_id auto-fetch on startup for accurate group mention filtering
- WebSocket thread health monitoring in health_check
- Processing hooks (on_processing_start/end) in base channel and manager
- Feishu config enhancements: WS/webhook mode, domain, access control, render_mode
- 22 unit tests covering config, access control, message parsing
ChannelManager._handle_message() passes session_key to the agent's
process() and process_with_thinking() methods for multi-user session
isolation, but these methods did not accept the parameter — causing a
TypeError that silently crashed every message processing attempt.

This broke all channel messaging (Telegram, Discord, etc.) since
the agent could never process any inbound message.

Adds optional session_key parameter to both methods with automatic
session switching when a different key is provided.

Made-with: Cursor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants