Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions docs/specs/remote-multi-channel/plan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Remote Multi-Channel Plan

## Main Process

- Expand `remoteControl` config normalization to include `telegram` and `feishu`.
- Keep the existing Telegram runtime, but add Feishu runtime management beside it.
- Reuse `RemoteConversationRunner` for both channels by passing endpoint binding metadata.
- Add a Feishu WebSocket runtime with:
- bot identity probe
- inbound message parsing
- endpoint-scoped serial queue
- text command routing
- final-text response delivery

## Shared Contracts

- Add `RemoteChannel = 'telegram' | 'feishu'`.
- Add channel-aware presenter methods:
- `getChannelSettings`
- `saveChannelSettings`
- `getChannelStatus`
- `getChannelBindings`
- `removeChannelBinding`
- `getChannelPairingSnapshot`
- `createChannelPairCode`
- `clearChannelPairCode`
- `clearChannelBindings`
- `getRemoteOverview`
- Keep Telegram hook test API separate.

## Renderer

- Rebuild `RemoteSettings.vue` into:
- shared overview header
- Telegram tab
- Feishu tab
- Telegram tab keeps hooks UI.
- Feishu tab only shows remote-control related sections.
- Binding rows display endpoint badges (`DM`, `Group`, `Topic`) instead of raw endpoint keys only.

## Telegram Fix

- Restrict draft-stream text extraction to stable visible content blocks.
- When no visible draft-safe text exists, do not send draft updates; keep typing/final-message behavior only.

## Testing

- Extend config normalization tests for legacy Telegram-only data plus new Feishu config.
- Add presenter/runtime tests for Feishu settings, bindings, pairing, and runtime enable/disable.
- Add Telegram regression tests proving reasoning/tool-call/pending-action states do not call `sendMessageDraft`.
- Update renderer tests for tab layout, overview, and per-channel dialogs.
49 changes: 49 additions & 0 deletions docs/specs/remote-multi-channel/spec.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Remote Multi-Channel

## Summary

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.

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.

## User Stories

- As a desktop user, I can configure Telegram and Feishu remote control from one Remote page without mixing their credentials and rules together.
- As a Telegram user, I can continue using the existing private-chat pairing flow and hook notifications.
- As a Feishu user, I can pair in a bot DM, then continue the same DeepChat session from DM, group chat, or topic thread.
- As an admin of the desktop app, I can see per-channel runtime health and binding counts from a shared overview area.
- As a paired Feishu user, I can trigger a remote session in group/topic only when I explicitly `@bot`.
- 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.

## Acceptance Criteria

- The Remote page renders a shared overview plus separate Telegram and Feishu tabs.
- Telegram settings continue to support bot token, remote pairing, allowlist, default agent, hook settings, and hook test actions.
- Feishu settings support app credentials, pairing, paired user management, default agent selection, and binding management.
- Feishu runtime runs in Electron main via WebSocket event subscription and does not require a renderer window.
- Feishu endpoints are keyed by `chatId + optional threadId`, with topic/thread replies isolated from the group root conversation.
- Feishu authorization requires DM pairing first; in groups/topics, only paired users who `@bot` may send commands or plain text to the bound session.
- `/pair`, `/new`, `/sessions`, `/use`, `/stop`, `/status`, `/open`, and `/model` work for Feishu remote control.
- Telegram `/model` continues to use inline keyboard menus; Feishu `/model` uses text commands only.
- Telegram draft streaming only uses stable visible content blocks. Reasoning-only, tool-call-only, and pending action-only assistant states never call `sendMessageDraft`.
- Existing local desktop chat behavior remains unchanged.

## Constraints

- Keep a fixed two-channel architecture. Do not introduce a generic plugin registry for remote channels.
- Telegram hook notifications remain under the shared Remote page; Feishu hook notifications are out of scope.
- Remote sessions continue to use the existing `RemoteConversationRunner` and detached session creation path.
- Feishu v1 supports DM, group, and topic/thread input; media upload, cards, approvals, and user-OAuth automation remain out of scope.

## Non-Goals

- A general remote channel SDK or third-party channel plugin system.
- Feishu user-OAuth flows, approval cards, or hook notifications.
- Rich Feishu card-based model switching.
- Telegram group chat support.

## Compatibility

- Existing `remoteControl.telegram` store data stays valid and is normalized into the new dual-channel config.
- Existing Telegram hook settings remain valid and continue to be saved through the Remote page.
- New Feishu-specific state is additive under `remoteControl.feishu`.
11 changes: 11 additions & 0 deletions docs/specs/remote-multi-channel/tasks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Remote Multi-Channel Tasks

1. Expand shared remote-control presenter types for channel-aware APIs and overview snapshots.
2. Extend `remoteControl` config normalization for Telegram + Feishu runtime state.
3. Update `RemoteBindingStore` to read/write both channels and persist endpoint metadata.
4. Add Feishu client/runtime/parser/auth/router files under `src/main/presenter/remoteControlPresenter/feishu/`.
5. Update `RemoteControlPresenter` to manage both runtimes and expose channel-aware IPC methods.
6. Update Telegram runtime draft gating so reasoning/tool-call/pending-action states never stream drafts.
7. Rebuild `RemoteSettings.vue` into overview + tabs and refresh the sidebar remote indicator.
8. Update main/renderer tests and add Feishu runtime coverage.
9. Run `pnpm run format`, `pnpm run i18n`, `pnpm run lint`, and targeted Vitest suites.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
"@electron-toolkit/utils": "^4.0.0",
"@google/genai": "^1.34.0",
"@jxa/run": "^1.4.0",
"@larksuiteoapi/node-sdk": "^1.59.0",
"@modelcontextprotocol/sdk": "^1.25.1",
"axios": "^1.13.2",
"better-sqlite3-multiple-ciphers": "12.4.1",
Expand Down
Loading
Loading