Skip to content

Commit e01d39b

Browse files
authored
feat: feishu bot remote (#1390)
* feat(remote): add feishu support * fix(yobrowser): wait for interactive-ready * fix: update browser and feishu runtime * feat(remote): refine feishu binding flow * fix(remote): harden browser and runtime flows * fix(feishu): sanitize runtime error replies
1 parent aa375cd commit e01d39b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+6594
-684
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Remote Multi-Channel Plan
2+
3+
## Main Process
4+
5+
- Expand `remoteControl` config normalization to include `telegram` and `feishu`.
6+
- Keep the existing Telegram runtime, but add Feishu runtime management beside it.
7+
- Reuse `RemoteConversationRunner` for both channels by passing endpoint binding metadata.
8+
- Add a Feishu WebSocket runtime with:
9+
- bot identity probe
10+
- inbound message parsing
11+
- endpoint-scoped serial queue
12+
- text command routing
13+
- final-text response delivery
14+
15+
## Shared Contracts
16+
17+
- Add `RemoteChannel = 'telegram' | 'feishu'`.
18+
- Add channel-aware presenter methods:
19+
- `getChannelSettings`
20+
- `saveChannelSettings`
21+
- `getChannelStatus`
22+
- `getChannelBindings`
23+
- `removeChannelBinding`
24+
- `getChannelPairingSnapshot`
25+
- `createChannelPairCode`
26+
- `clearChannelPairCode`
27+
- `clearChannelBindings`
28+
- `getRemoteOverview`
29+
- Keep Telegram hook test API separate.
30+
31+
## Renderer
32+
33+
- Rebuild `RemoteSettings.vue` into:
34+
- shared overview header
35+
- Telegram tab
36+
- Feishu tab
37+
- Telegram tab keeps hooks UI.
38+
- Feishu tab only shows remote-control related sections.
39+
- Binding rows display endpoint badges (`DM`, `Group`, `Topic`) instead of raw endpoint keys only.
40+
41+
## Telegram Fix
42+
43+
- Restrict draft-stream text extraction to stable visible content blocks.
44+
- When no visible draft-safe text exists, do not send draft updates; keep typing/final-message behavior only.
45+
46+
## Testing
47+
48+
- Extend config normalization tests for legacy Telegram-only data plus new Feishu config.
49+
- Add presenter/runtime tests for Feishu settings, bindings, pairing, and runtime enable/disable.
50+
- Add Telegram regression tests proving reasoning/tool-call/pending-action states do not call `sendMessageDraft`.
51+
- Update renderer tests for tab layout, overview, and per-channel dialogs.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Remote Multi-Channel
2+
3+
## Summary
4+
5+
Extend the existing Remote settings and runtime from Telegram-only to a fixed two-channel model: Telegram and Feishu. Telegram keeps hook notifications, while Feishu adds remote control only. Both channels continue to bind one remote endpoint to one DeepChat session and reuse the existing detached-session flow in Electron main.
6+
7+
This iteration also fixes the Telegram "deleted message" draft issue by preventing draft streaming from using reasoning-only, tool-call-only, or permission/question-request blocks as visible text.
8+
9+
## User Stories
10+
11+
- As a desktop user, I can configure Telegram and Feishu remote control from one Remote page without mixing their credentials and rules together.
12+
- As a Telegram user, I can continue using the existing private-chat pairing flow and hook notifications.
13+
- As a Feishu user, I can pair in a bot DM, then continue the same DeepChat session from DM, group chat, or topic thread.
14+
- As an admin of the desktop app, I can see per-channel runtime health and binding counts from a shared overview area.
15+
- As a paired Feishu user, I can trigger a remote session in group/topic only when I explicitly `@bot`.
16+
- As a Telegram user, I no longer see bot replies visually attached to a deleted draft/reference while the assistant is only reasoning or issuing tool calls.
17+
18+
## Acceptance Criteria
19+
20+
- The Remote page renders a shared overview plus separate Telegram and Feishu tabs.
21+
- Telegram settings continue to support bot token, remote pairing, allowlist, default agent, hook settings, and hook test actions.
22+
- Feishu settings support app credentials, pairing, paired user management, default agent selection, and binding management.
23+
- Feishu runtime runs in Electron main via WebSocket event subscription and does not require a renderer window.
24+
- Feishu endpoints are keyed by `chatId + optional threadId`, with topic/thread replies isolated from the group root conversation.
25+
- Feishu authorization requires DM pairing first; in groups/topics, only paired users who `@bot` may send commands or plain text to the bound session.
26+
- `/pair`, `/new`, `/sessions`, `/use`, `/stop`, `/status`, `/open`, and `/model` work for Feishu remote control.
27+
- Telegram `/model` continues to use inline keyboard menus; Feishu `/model` uses text commands only.
28+
- Telegram draft streaming only uses stable visible content blocks. Reasoning-only, tool-call-only, and pending action-only assistant states never call `sendMessageDraft`.
29+
- Existing local desktop chat behavior remains unchanged.
30+
31+
## Constraints
32+
33+
- Keep a fixed two-channel architecture. Do not introduce a generic plugin registry for remote channels.
34+
- Telegram hook notifications remain under the shared Remote page; Feishu hook notifications are out of scope.
35+
- Remote sessions continue to use the existing `RemoteConversationRunner` and detached session creation path.
36+
- Feishu v1 supports DM, group, and topic/thread input; media upload, cards, approvals, and user-OAuth automation remain out of scope.
37+
38+
## Non-Goals
39+
40+
- A general remote channel SDK or third-party channel plugin system.
41+
- Feishu user-OAuth flows, approval cards, or hook notifications.
42+
- Rich Feishu card-based model switching.
43+
- Telegram group chat support.
44+
45+
## Compatibility
46+
47+
- Existing `remoteControl.telegram` store data stays valid and is normalized into the new dual-channel config.
48+
- Existing Telegram hook settings remain valid and continue to be saved through the Remote page.
49+
- New Feishu-specific state is additive under `remoteControl.feishu`.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Remote Multi-Channel Tasks
2+
3+
1. Expand shared remote-control presenter types for channel-aware APIs and overview snapshots.
4+
2. Extend `remoteControl` config normalization for Telegram + Feishu runtime state.
5+
3. Update `RemoteBindingStore` to read/write both channels and persist endpoint metadata.
6+
4. Add Feishu client/runtime/parser/auth/router files under `src/main/presenter/remoteControlPresenter/feishu/`.
7+
5. Update `RemoteControlPresenter` to manage both runtimes and expose channel-aware IPC methods.
8+
6. Update Telegram runtime draft gating so reasoning/tool-call/pending-action states never stream drafts.
9+
7. Rebuild `RemoteSettings.vue` into overview + tabs and refresh the sidebar remote indicator.
10+
8. Update main/renderer tests and add Feishu runtime coverage.
11+
9. Run `pnpm run format`, `pnpm run i18n`, `pnpm run lint`, and targeted Vitest suites.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
"@electron-toolkit/utils": "^4.0.0",
7272
"@google/genai": "^1.34.0",
7373
"@jxa/run": "^1.4.0",
74+
"@larksuiteoapi/node-sdk": "^1.59.0",
7475
"@modelcontextprotocol/sdk": "^1.25.1",
7576
"axios": "^1.13.2",
7677
"better-sqlite3-multiple-ciphers": "12.4.1",

0 commit comments

Comments
 (0)