Skip to content

JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.

Python

fix:优化频道结构

xiaoxiawangfc6ef277e605
diff --git a/docs/en/Channels.md b/docs/en/Channels.md
index d7e2f2a384..f50671e38b 100644
--- a/docs/en/Channels.md
+++ b/docs/en/Channels.md
@@ -77,5 +77,16 @@ For detailed configuration instructions, see: [China Channels](ChinaChannels.md)
|---------|-------------|
| [Telegram](InternationalChannels.md#telegram) | International messaging tool, supports private and group chat |
| [Discord](InternationalChannels.md#discord) | Gaming community platform, supports private and group chat |
+| [WhatsApp](InternationalChannels.md#whatsapp) | Personal messaging tool, supports private chat |
-For detailed configuration instructions, see: [International Channels](InternationalChannels.md)
\ No newline at end of file
+For detailed configuration instructions, see: [International Channels](InternationalChannels.md)
+
+---
+
+## Developer Channels
+
+In addition to the end-user chat platforms above, JiuwenSwarm also provides integration methods for developers:
+
+| Integration | Description |
+|-------------|-------------|
+| [ACP Plugin Usage](ACP_Client_Config.md) | Integrate with JiuwenSwarm via the ACP protocol, suitable for custom integrations |
\ No newline at end of file
diff --git a/docs/en/Discord.md b/docs/en/Discord.md
deleted file mode 100644
index c1999900c0..0000000000
--- a/docs/en/Discord.md
+++ /dev/null
@@ -1,186 +0,0 @@
-# Discord Channel Setup
-
-This guide walks through creating a Discord application and bot in the [Discord Developer Portal](https://discord.com/developers/applications), enabling the intents and install options JiuwenSwarm needs, and wiring the bot into **Channel Management** in JiuwenSwarm.
-
-## What This Repo Uses
-
-- Python channel: `jiuwenswarm/channel/discord_channel.py` (discord.py)
-- Runtime config: `channels/discord` in your `config.yaml` (or the web UI **Channel Management** → Discord)
-
-The bot connects with your **Bot Token**, receives messages in configured guild channels and/or DMs (unless you turn off DMs), and can add a 👀 reaction while processing, similar to other channels.
-
-## Prerequisites
-
-- A Discord account
-- Permission to add bots to a server (or users can install the app for DMs, depending on your install settings)
-
----
-
-## 1. Create an application
-
-1. Open [https://discord.com/developers/applications](https://discord.com/developers/applications).
-2. Click **New Application**, choose a name, and create it.
-
-![Create a new Discord application](../assets/images/discord/1_create_new_app.png)
-
-You will use this application for both **OAuth2 / installation** and the **Bot** user.
-
----
-
-## 2. Get the Bot Token (reset and copy)
-
-1. In the left sidebar, open **Bot**.
-2. Under **Token**, use **Reset Token** and confirm.
-3. **Copy the token immediately** and store it somewhere safe. Discord shows it only once after a reset.
-
-![Reset and copy Bot Token](../assets/images/discord/2_reset_bot_token.png)
-
-**Security**
-
-- Treat the token like a password. Anyone with it can control your bot.
-- Paste it into JiuwenSwarm’s Discord settings or `config.yaml`; do not commit it to git.
-- If it leaks, reset the token again in the same place.
-
-You will map this value to **`bot_token`** in JiuwenSwarm.
-
----
-
-## 3. Enable Message Content Intent
-
-JiuwenSwarm reads the text of messages your bot receives. Discord requires an explicit privileged intent for that.
-
-1. Stay on the **Bot** page.
-2. Under **Privileged Gateway Intents**, turn on **MESSAGE CONTENT INTENT**.
-3. Save changes if the portal prompts you.
-
-![Enable Message Content Intent](../assets/images/discord/3_set_required_intent.png)
-
-Without this, the bot may connect but will not see normal message text content.
-
----
-
-## 4. Guild install: scopes and bot permissions
-
-Configure how the bot is installed into servers and what it can do there. Typical needs for JiuwenSwarm:
-
-- **Read** messages in the channels you care about
-- **Send** messages (replies)
-- **Read message history** (context)
-- **Add reactions** (e.g. 👀 while processing)
-- **Use slash commands** (optional, if you use them elsewhere)
-
-In the Developer Portal, use the installation / OAuth2 tools (e.g. **Installation** or **OAuth2 → URL Generator**, depending on the current UI) to select:
-
-- Scopes such as **`bot`** (and **`applications.commands`** if you use application commands).
-- Bot permissions that match the list above.
-- Screenshot attached below shows the recommended permissions, the mandatory ones are marked.
-
-![Guild install scopes and bot permissions](../assets/images/discord/4_set_guild_install_scope_and_permissions.png)
-
-Exact labels may move between **Installation**, **OAuth2**, and **Bot** sections as Discord updates the portal; align your choices with the screenshot and the capabilities above.
-
----
-
-## 5. Install methods and setup / invite link
-
-Choose how users or admins can add the app:
-
-- **Guild install** — add the bot to a server (you need a shareable install or invite URL).
-- **User install** — allows users to add the app for **direct messages** (useful if you want DM-only usage without a fixed guild channel).
-
-Copy the **generated URL** or **Install link** from the portal and open it in a browser to complete authorization.
-
-![Install methods and copy setup link](../assets/images/discord/5_select_install_methods_and_copy_setup_link.png)
-
-After installation:
-
-- For **server** use: place the bot in a channel JiuwenSwarm will listen to (see `guild_id` / `channel_id` below).
-- For **DM** use: users can open a private message with the bot (if not blocked by **`block_dm`** in JiuwenSwarm).
-
----
-
-## 6. IDs you need for JiuwenSwarm
-
-| Value | Where to find it |
-|--------|------------------|
-| **Application ID** | **General Information** → **APPLICATION ID** (copy). Maps to **`application_id`** (optional but recommended). |
-| **Guild ID** | Discord: enable **Developer Mode** (Settings → App Settings → Advanced). Right‑click the **server icon** → **Copy Server ID**. Maps to **`guild_id`**. Leave empty if you only use DMs and do not restrict to one server. |
-| **Channel ID** | Right‑click the **text channel** → **Copy Channel ID**. Maps to **`channel_id`**. Leave empty to rely on DM-only or broader routing per your deployment. |
-
-If both **`guild_id`** and **`channel_id`** are set, the bot handles messages **only in that channel** on that server, while **DMs can still work** unless **`block_dm`** is enabled.
-
-A trick to get `guild_id` and `channel_id` easily is to check the url to a channel, since the format would be:
-```
-https://discord.com/channels/<guild_id>/<channel_id>
-```
-
----
-
-## 7. Configure Discord in JiuwenSwarm (Channel Management)
-
-Open the JiuwenSwarm web UI → **Channel Management** → **Discord**, or edit:
-
-`~/.jiuwenswarm/config/config.yaml` (path may differ on your machine)
-
-Example:
-
-```yaml
-channels:
- discord:
- bot_token: "YOUR_BOT_TOKEN"
- application_id: "YOUR_APPLICATION_ID"
- guild_id: "YOUR_GUILD_ID" # optional if DM-only
- channel_id: "YOUR_CHANNEL_ID" # optional if DM-only
- block_dm: false # set true to ignore DMs
- allow_from: [] # empty = all users; else list Discord user IDs
- enabled: true
-```
-
-| Field | Purpose |
-|--------|---------|
-| `bot_token` | **Required.** From step 2. |
-| `application_id` | Application ID from **General Information**. |
-| `guild_id` | Restrict handling to one server; optional for DM-focused setups. |
-| `channel_id` | Restrict handling to one channel in that server; optional with DMs. |
-| `block_dm` | If `true`, ignore direct messages. |
-| `allow_from` | Allow-list of Discord user IDs; empty allows everyone who can message the bot. |
-| `enabled` | Turn the Discord channel on. |
-
----
-
-## 8. Verify
-
-1. Ensure the bot is online in the server or available in DMs.
-2. Send a short message in the configured channel or in DM.
-3. You should see a 👀 reaction on the user message (if the bot has **Add Reactions** in that context), then a reply from your agent pipeline when the model and tools are configured correctly.
-
----
-
-## Troubleshooting
-
-### Bot online but no replies
-
-- Confirm **MESSAGE CONTENT INTENT** is enabled.
-- Confirm **`enabled: true`** and **`bot_token`** are correct.
-- Check **`guild_id` / `channel_id`**: messages outside the configured channel are ignored when those are set.
-- If using **`allow_from`**, your Discord user ID must be listed (or leave the list empty).
-
-### Cannot add 👀 reaction
-
-- Grant the bot **Add Reactions** in the channel (channel overrides or role permissions).
-
-### DMs not working
-
-- Perform **User install** in Discord.
-- In JiuwenSwarm, ensure **`block_dm`** is `false`.
-- Users may need to open the bot’s profile and **Message** after installing.
-
-### LLM or downstream errors
-
-Discord delivery is separate from model configuration. If you see HTTP errors from the model API, fix `.env` / model settings and restart the app (same idea as other channels).
-
----
-
-## Related
-
-- Short overview and field table: [Channels.md](Channels.md) (Discord section)
diff --git a/docs/en/InternationalChannels.md b/docs/en/InternationalChannels.md
index 21ecdfee48..e4b2ddc3ed 100644
--- a/docs/en/InternationalChannels.md
+++ b/docs/en/InternationalChannels.md
@@ -107,8 +107,6 @@ channels:
Discord channel integration is supported in the current version. Configure and enable the Discord Bot in **Channel Management**, or manually edit `config.yaml`.
-For step-by-step instructions (Developer Portal bot creation, intents, install link, channel management), see [Discord.md](Discord.md).
-
### Configuration fields
- `bot_token`
@@ -150,4 +148,402 @@ channels:
| `channel_id` | Listen/reply only to the specified channel | empty |
| `block_dm` | When `true`, DMs are not processed | `false` |
| `allow_from` | Allowed Discord user ID list | `[]` |
-| `enabled` | Enable Discord channel | `false` |
\ No newline at end of file
+| `enabled` | Enable Discord channel | `false` |
+
+### Detailed Setup Steps
+
+#### What This Repo Uses
+
+- Python channel: `jiuwenswarm/channel/discord_channel.py` (discord.py)
+- Runtime config: `channels/discord` in your `config.yaml` (or the web UI **Channel Management** → Discord)
+
+The bot connects with your **Bot Token**, receives messages in configured guild channels and/or DMs (unless you turn off DMs), and can add a 👀 reaction while processing, similar to other channels.
+
+#### Prerequisites
+
+- A Discord account
+- Permission to add bots to a server (or users can install the app for DMs, depending on your install settings)
+
+#### 1. Create an application
+
+1. Open [https://discord.com/developers/applications](https://discord.com/developers/applications).
+2. Click **New Application**, choose a name, and create it.
+
+![Create a new Discord application](../assets/images/discord/1_create_new_app.png)
+
+You will use this application for both **OAuth2 / installation** and the **Bot** user.
+
+#### 2. Get the Bot Token (reset and copy)
+
+1. In the left sidebar, open **Bot**.
+2. Under **Token**, use **Reset Token** and confirm.
+3. **Copy the token immediately** and store it somewhere safe. Discord shows it only once after a reset.
+
+![Reset and copy Bot Token](../assets/images/discord/2_reset_bot_token.png)
+
+**Security**
+
+- Treat the token like a password. Anyone with it can control your bot.
+- Paste it into JiuwenSwarm’s Discord settings or `config.yaml`; do not commit it to git.
+- If it leaks, reset the token again in the same place.
+
+You will map this value to **`bot_token`** in JiuwenSwarm.
+
+#### 3. Enable Message Content Intent
+
+JiuwenSwarm reads the text of messages your bot receives. Discord requires an explicit privileged intent for that.
+
+1. Stay on the **Bot** page.
+2. Under **Privileged Gateway Intents**, turn on **MESSAGE CONTENT INTENT**.
+3. Save changes if the portal prompts you.
+
+![Enable Message Content Intent](../assets/images/discord/3_set_required_intent.png)
+
+Without this, the bot may connect but will not see normal message text content.
+
+#### 4. Guild install: scopes and bot permissions
+
+Configure how the bot is installed into servers and what it can do there. Typical needs for JiuwenSwarm:
+
+- **Read** messages in the channels you care about
+- **Send** messages (replies)
+- **Read message history** (context)
+- **Add reactions** (e.g. 👀 while processing)
+- **Use slash commands** (optional, if you use them elsewhere)
+
+In the Developer Portal, use the installation / OAuth2 tools (e.g. **Installation** or **OAuth2 → URL Generator**, depending on the current UI) to select:
+
+- Scopes such as **`bot`** (and **`applications.commands`** if you use application commands).
+- Bot permissions that match the list above.
+- Screenshot attached below shows the recommended permissions, the mandatory ones are marked.
+
+![Guild install scopes and bot permissions](../assets/images/discord/4_set_guild_install_scope_and_permissions.png)
+
+Exact labels may move between **Installation**, **OAuth2**, and **Bot** sections as Discord updates the portal; align your choices with the screenshot and the capabilities above.
+
+#### 5. Install methods and setup / invite link
+
+Choose how users or admins can add the app:
+
+- **Guild install** — add the bot to a server (you need a shareable install or invite URL).
+- **User install** — allows users to add the app for **direct messages** (useful if you want DM-only usage without a fixed guild channel).
+
+Copy the **generated URL** or **Install link** from the portal and open it in a browser to complete authorization.
+
+![Install methods and copy setup link](../assets/images/discord/5_select_install_methods_and_copy_setup_link.png)
+
+After installation:
+
+- For **server** use: place the bot in a channel JiuwenSwarm will listen to (see `guild_id` / `channel_id` below).
+- For **DM** use: users can open a private message with the bot (if not blocked by **`block_dm`** in JiuwenSwarm).
+
+#### 6. IDs you need for JiuwenSwarm
+
+| Value | Where to find it |
+|--------|------------------|
+| **Application ID** | **General Information** → **APPLICATION ID** (copy). Maps to **`application_id`** (optional but recommended). |
+| **Guild ID** | Discord: enable **Developer Mode** (Settings → App Settings → Advanced). Right‑click the **server icon** → **Copy Server ID**. Maps to **`guild_id`**. Leave empty if you only use DMs and do not restrict to one server. |
+| **Channel ID** | Right‑click the **text channel** → **Copy Channel ID**. Maps to **`channel_id`**. Leave empty to rely on DM-only or broader routing per your deployment. |
+
+If both **`guild_id`** and **`channel_id`** are set, the bot handles messages **only in that channel** on that server, while **DMs can still work** unless **`block_dm`** is enabled.
+
+A trick to get `guild_id` and `channel_id` easily is to check the url to a channel, since the format would be:
+```
+https://discord.com/channels/<guild_id>/<channel_id>
+```
+
+#### 7. Configure Discord in JiuwenSwarm (Channel Management)
+
+Open the JiuwenSwarm web UI → **Channel Management** → **Discord**, or edit:
+
+`~/.jiuwenswarm/config/config.yaml` (path may differ on your machine)
+
+Example:
+
+```yaml
+channels:
+ discord:
+ bot_token: "YOUR_BOT_TOKEN"
+ application_id: "YOUR_APPLICATION_ID"
+ guild_id: "YOUR_GUILD_ID" # optional if DM-only
+ channel_id: "YOUR_CHANNEL_ID" # optional if DM-only
+ block_dm: false # set true to ignore DMs
+ allow_from: [] # empty = all users; else list Discord user IDs
+ enabled: true
+```
+
+| Field | Purpose |
+|--------|---------|
+| `bot_token` | **Required.** From step 2. |
+| `application_id` | Application ID from **General Information**. |
+| `guild_id` | Restrict handling to one server; optional for DM-focused setups. |
+| `channel_id` | Restrict handling to one channel in that server; optional with DMs. |
+| `block_dm` | If `true`, ignore direct messages. |
+| `allow_from` | Allow-list of Discord user IDs; empty allows everyone who can message the bot. |
+| `enabled` | Turn the Discord channel on. |
+
+#### 8. Verify
+
+1. Ensure the bot is online in the server or available in DMs.
+2. Send a short message in the configured channel or in DM.
+3. You should see a 👀 reaction on the user message (if the bot has **Add Reactions** in that context), then a reply from your agent pipeline when the model and tools are configured correctly.
+
+#### Troubleshooting
+
+**Bot online but no replies**
+
+- Confirm **MESSAGE CONTENT INTENT** is enabled.
+- Confirm **`enabled: true`** and **`bot_token`** are correct.
+- Check **`guild_id` / `channel_id`**: messages outside the configured channel are ignored when those are set.
+- If using **`allow_from`**, your Discord user ID must be listed (or leave the list empty).
+
+**Cannot add 👀 reaction**
+
+- Grant the bot **Add Reactions** in the channel (channel overrides or role permissions).
+
+**DMs not working**
+
+- Perform **User install** in Discord.
+- In JiuwenSwarm, ensure **`block_dm`** is `false`.
+- Users may need to open the bot’s profile and **Message** after installing.
+
+**LLM or downstream errors**
+
+Discord delivery is separate from model configuration. If you see HTTP errors from the model API, fix `.env` / model settings and restart the app (same idea as other channels).
+
+---
+
+## WhatsApp
+
+This guide describes the WhatsApp integration currently implemented in this repo.
+
+### Architecture
+
+JiuwenSwarm does not talk to WhatsApp directly from Python.
+
+`WhatsApp app` <-> `Baileys bridge (Node.js)` <-> `WhatsAppChannel (Python)`
+
+- Bridge WebSocket default: `ws://127.0.0.1:19600/ws`
+- Bridge script: `jiuwenswarm/scripts/whatsapp-bridge.js`
+- Python channel: `jiuwenswarm/channel/whatsapp_channel.py`
+- Runtime config: `channels.whatsapp` in `config.yaml`
+
+### What This Repo Implements
+
+- The Node bridge uses Baileys to log in to WhatsApp Web and send/receive messages.
+- The Python channel connects to the local bridge over WebSocket and exchanges JSON frames.
+- The Python side now tracks connection state from bridge events and only sends messages when WhatsApp is actually connected.
+- `allow_from` filters inbound WhatsApp senders by JID or by the number part.
+
+### What This Repo Does Not Implement
+
+- There is no Python-to-bridge auth handshake or shared-secret token.
+- The bridge is local-only by default because it binds to `127.0.0.1`.
+- Media download and attachment forwarding are not implemented.
+- Voice-message transcription is not implemented.
+- Python-side inbound message deduplication is not implemented.
+
+### WebSocket Protocol
+
+Python sends:
+
+```json
+{
+ "type": "send",
+ "jid": "[email protected]",
+ "text": "hello",
+ "request_id": "msg-123"
+}
+```
+
+Bridge sends:
+
+- `status`: bridge / WhatsApp connection state updates
+- `qr`: QR code is available for linking
+- `inbound`: inbound text message from WhatsApp
+- `send_result`: acknowledgement or error for a `send`
+- `pong`: reply to bridge ping
+
+### Connection States
+
+The Python channel tracks these states from bridge events:
+
+- `stopped`: channel is stopped
+- `bridge_connected`: Python is connected to the local bridge WebSocket, but WhatsApp may still be connecting
+- `connecting`: bridge is trying to connect Baileys to WhatsApp
+- `qr_pending`: a QR code is waiting to be scanned
+- `open`: WhatsApp is connected and sending is allowed
+- `close`: WhatsApp connection closed
+- `logged_out`: WhatsApp session was logged out and needs relinking
+- `bridge_disconnected`: Python lost the local bridge WebSocket connection
+
+The distinction matters:
+
+- `bridge_connected` only means Python can reach the local bridge.
+- `open` means the bridge is actually logged in to WhatsApp and can send messages.
+
+### Channel Metadata
+
+`WhatsAppChannel.get_metadata()` now exposes runtime state in `extra`:
+
+- `bridge_state`
+- `bridge_ws_connected`
+- `whatsapp_connected`
+- `qr_pending`
+- `last_status_ts_ms`
+- `last_status_code`
+
+### Prerequisites
+
+- Python environment that can run `python -m jiuwenswarm.app`
+- Node.js 20+ and npm
+- A WhatsApp account with Linked Devices enabled
+
+### 1. Install Bridge Dependencies
+
+Run inside the inner project folder that contains `jiuwenswarm/package.json`:
+
+```powershell
+cd <project-root>/jiuwenswarm
+npm install
+```
+
+If you only want the bridge dependencies:
+
+```powershell
+npm install @whiskeysockets/baileys ws pino qrcode-terminal
+```
+
+### 2. Configure WhatsApp
+
+Edit your runtime config file:
+
+`~/.jiuwenswarm/config/config.yaml`
+
+Under `channels:` use:
+
+```yaml
+ whatsapp:
+ bridge_ws_url: ws://127.0.0.1:19600/ws
+ default_jid:
+ allow_from: []
+ enable_streaming: true
+ auto_start_bridge: false
+ bridge_command: node scripts/whatsapp-bridge.js
+ bridge_workdir: <project-root>/jiuwenswarm
+ enabled: true
+```
+
+Notes:
+
+- `enable_streaming: true` forwards intermediate events such as token deltas and tool progress.
+- `enable_streaming: false` suppresses `chat.delta` events and keeps output more final-only.
+- `default_jid` is used as a fallback target for outbound sends.
+- `allow_from` accepts either a full sender JID or the number part before `@`.
+- `auto_start_bridge: true` lets Python start the Node bridge process automatically.
+
+### 3. Start the Services
+
+Open two terminals unless you use `auto_start_bridge: true`.
+
+Terminal A, bridge:
+
+```powershell
+cd <project-root>/jiuwenswarm
+npm run whatsapp:bridge
+```
+
+Expected line:
+
+`[whatsapp-bridge] ws://127.0.0.1:19600/ws`
+
+Terminal B, app:
+
+```powershell
+cd <project-root>
+python -m jiuwenswarm.app
+```
+
+Expected behavior:
+
+- The app logs that `WhatsAppChannel` was registered.
+- The channel first reaches `bridge_connected`.
+- It then moves to `connecting`, `qr_pending`, or `open` depending on login state.
+
+### 4. Link WhatsApp
+
+When the bridge has no valid auth state, it prints a QR code in the bridge terminal.
+
+In WhatsApp:
+
+`Settings` -> `Linked devices` -> `Link a device`
+
+Then scan the QR code from Terminal A.
+
+Auth state is stored at:
+
+`jiuwenswarm/jiuwenswarm/workspace/.whatsapp-auth`
+
+If the account is already linked, QR may not appear.
+
+### 5. Sending and Receiving
+
+- Inbound text messages are forwarded from the bridge to the Python channel as `inbound`.
+- Outbound messages are sent from Python as `send`.
+- Python now blocks sends unless channel state is `open`.
+- If the bridge replies with `send_result.ok=false`, the Python channel logs the failure.
+
+### 6. Security Notes
+
+- The bridge listens on `127.0.0.1` by default, which limits access to the local machine.
+- This repo currently does not implement bridge token auth.
+- Do not expose the bridge port directly to other hosts without adding authentication or a trusted tunnel boundary.
+
+### 7. LLM Config Still Matters
+
+If inbound WhatsApp messages fail downstream with errors such as `405 Not Allowed`, the model config is probably placeholder or invalid.
+
+Example `.env` values:
+
+```env
+MODEL_PROVIDER=OpenAI
+MODEL_NAME=your-real-model
+API_BASE=https://your-real-openai-compatible-endpoint/v1
+API_KEY=your-real-key
+```
+
+Restart `python -m jiuwenswarm.app` after updating `.env`.
+
+### Troubleshooting
+
+**`Missing script: "whatsapp:bridge"`**
+
+You ran `npm` in the wrong folder. Use:
+
+`<project-root>/jiuwenswarm`
+
+**Bridge starts but no QR**
+
+1. Stop any old bridge processes that may still be holding the port or auth session.
+2. Delete auth state to force relinking:
+ `jiuwenswarm/jiuwenswarm/workspace/.whatsapp-auth`
+3. Start the bridge again and wait for `QR received`.
+
+**App connects to bridge but cannot send**
+
+Check the connection state in logs:
+
+- If state is `bridge_connected` or `connecting`, the local bridge is reachable but WhatsApp is not ready yet.
+- If state is `qr_pending`, scan the QR code.
+- If state is `logged_out`, delete the auth directory and relink.
+- Only state `open` allows sends.
+
+**App says WhatsApp channel not configured**
+
+- Make sure the YAML key is `channels.whatsapp`.
+- Make sure `enabled: true` is set.
+- Make sure `bridge_ws_url` is not empty.
+
+**Bluestacks or emulator linking issues**
+
+Scanning from a physical phone is usually more reliable than emulator camera passthrough.
\ No newline at end of file
diff --git a/docs/en/SUMMARY.md b/docs/en/SUMMARY.md
index 41c2da642c..71444fe1f4 100644
--- a/docs/en/SUMMARY.md
+++ b/docs/en/SUMMARY.md
@@ -15,8 +15,7 @@
- [User guide](README.md)
- [Conversation](Conversation.md)
- [Channels](Channels.md)
- - [Discord](Discord.md)
- - [WhatsApp](WhatsApp.md)
+ - [International Channels](InternationalChannels.md)
- [Modes](Modes.md)
- [CLI commands](CLI.md)
- [Slash Commands Reference](SlashCommands.md)
diff --git a/docs/en/WhatsApp.md b/docs/en/WhatsApp.md
deleted file mode 100644
index 643356b826..0000000000
--- a/docs/en/WhatsApp.md
+++ /dev/null
@@ -1,234 +0,0 @@
-# WhatsApp Channel Setup
-
-This guide describes the WhatsApp integration currently implemented in this repo.
-
-## Architecture
-
-JiuwenSwarm does not talk to WhatsApp directly from Python.
-
-`WhatsApp app` <-> `Baileys bridge (Node.js)` <-> `WhatsAppChannel (Python)`
-
-- Bridge WebSocket default: `ws://127.0.0.1:19600/ws`
-- Bridge script: `jiuwenswarm/scripts/whatsapp-bridge.js`
-- Python channel: `jiuwenswarm/channel/whatsapp_channel.py`
-- Runtime config: `channels.whatsapp` in `config.yaml`
-
-## What This Repo Implements
-
-- The Node bridge uses Baileys to log in to WhatsApp Web and send/receive messages.
-- The Python channel connects to the local bridge over WebSocket and exchanges JSON frames.
-- The Python side now tracks connection state from bridge events and only sends messages when WhatsApp is actually connected.
-- `allow_from` filters inbound WhatsApp senders by JID or by the number part.
-
-## What This Repo Does Not Implement
-
-- There is no Python-to-bridge auth handshake or shared-secret token.
-- The bridge is local-only by default because it binds to `127.0.0.1`.
-- Media download and attachment forwarding are not implemented.
-- Voice-message transcription is not implemented.
-- Python-side inbound message deduplication is not implemented.
-
-## WebSocket Protocol
-
-Python sends:
-
-```json
-{
- "type": "send",
- "jid": "[email protected]",
- "text": "hello",
- "request_id": "msg-123"
-}
-```
-
-Bridge sends:
-
-- `status`: bridge / WhatsApp connection state updates
-- `qr`: QR code is available for linking
-- `inbound`: inbound text message from WhatsApp
-- `send_result`: acknowledgement or error for a `send`
-- `pong`: reply to bridge ping
-
-## Connection States
-
-The Python channel tracks these states from bridge events:
-
-- `stopped`: channel is stopped
-- `bridge_connected`: Python is connected to the local bridge WebSocket, but WhatsApp may still be connecting
-- `connecting`: bridge is trying to connect Baileys to WhatsApp
-- `qr_pending`: a QR code is waiting to be scanned
-- `open`: WhatsApp is connected and sending is allowed
-- `close`: WhatsApp connection closed
-- `logged_out`: WhatsApp session was logged out and needs relinking
-- `bridge_disconnected`: Python lost the local bridge WebSocket connection
-
-The distinction matters:
-
-- `bridge_connected` only means Python can reach the local bridge.
-- `open` means the bridge is actually logged in to WhatsApp and can send messages.
-
-## Channel Metadata
-
-`WhatsAppChannel.get_metadata()` now exposes runtime state in `extra`:
-
-- `bridge_state`
-- `bridge_ws_connected`
-- `whatsapp_connected`
-- `qr_pending`
-- `last_status_ts_ms`
-- `last_status_code`
-
-## Prerequisites
-
-- Python environment that can run `python -m jiuwenswarm.app`
-- Node.js 20+ and npm
-- A WhatsApp account with Linked Devices enabled
-
-## 1. Install Bridge Dependencies
-
-Run inside the inner project folder that contains `jiuwenswarm/package.json`:
-
-```powershell
-cd C:\Users\chiak\OneDrive\Desktop\jiuwenswarm\jiuwenswarm
-npm install
-```
-
-If you only want the bridge dependencies:
-
-```powershell
-npm install @whiskeysockets/baileys ws pino qrcode-terminal
-```
-
-## 2. Configure WhatsApp
-
-Edit your runtime config file:
-
-`C:\Users\chiak\.jiuwenswarm\config\config.yaml`
-
-Under `channels:` use:
-
-```yaml
- whatsapp:
- bridge_ws_url: ws://127.0.0.1:19600/ws
- default_jid:
- allow_from: []
- enable_streaming: true
- auto_start_bridge: false
- bridge_command: node scripts/whatsapp-bridge.js
- bridge_workdir: C:/Users/chiak/OneDrive/Desktop/jiuwenswarm/jiuwenswarm
- enabled: true
-```
-
-Notes:
-
-- `enable_streaming: true` forwards intermediate events such as token deltas and tool progress.
-- `enable_streaming: false` suppresses `chat.delta` events and keeps output more final-only.
-- `default_jid` is used as a fallback target for outbound sends.
-- `allow_from` accepts either a full sender JID or the number part before `@`.
-- `auto_start_bridge: true` lets Python start the Node bridge process automatically.
-
-## 3. Start the Services
-
-Open two terminals unless you use `auto_start_bridge: true`.
-
-Terminal A, bridge:
-
-```powershell
-cd C:\Users\chiak\OneDrive\Desktop\jiuwenswarm\jiuwenswarm
-npm run whatsapp:bridge
-```
-
-Expected line:
-
-`[whatsapp-bridge] ws://127.0.0.1:19600/ws`
-
-Terminal B, app:
-
-```powershell
-cd C:\Users\chiak\OneDrive\Desktop\jiuwenswarm
-python -m jiuwenswarm.app
-```
-
-Expected behavior:
-
-- The app logs that `WhatsAppChannel` was registered.
-- The channel first reaches `bridge_connected`.
-- It then moves to `connecting`, `qr_pending`, or `open` depending on login state.
-
-## 4. Link WhatsApp
-
-When the bridge has no valid auth state, it prints a QR code in the bridge terminal.
-
-In WhatsApp:
-
-`Settings` -> `Linked devices` -> `Link a device`
-
-Then scan the QR code from Terminal A.
-
-Auth state is stored at:
-
-`jiuwenswarm/jiuwenswarm/workspace/.whatsapp-auth`
-
-If the account is already linked, QR may not appear.
-
-## 5. Sending and Receiving
-
-- Inbound text messages are forwarded from the bridge to the Python channel as `inbound`.
-- Outbound messages are sent from Python as `send`.
-- Python now blocks sends unless channel state is `open`.
-- If the bridge replies with `send_result.ok=false`, the Python channel logs the failure.
-
-## 6. Security Notes
-
-- The bridge listens on `127.0.0.1` by default, which limits access to the local machine.
-- This repo currently does not implement bridge token auth.
-- Do not expose the bridge port directly to other hosts without adding authentication or a trusted tunnel boundary.
-
-## 7. LLM Config Still Matters
-
-If inbound WhatsApp messages fail downstream with errors such as `405 Not Allowed`, the model config is probably placeholder or invalid.
-
-Example `.env` values:
-
-```env
-MODEL_PROVIDER=OpenAI
-MODEL_NAME=your-real-model
-API_BASE=https://your-real-openai-compatible-endpoint/v1
-API_KEY=your-real-key
-```
-
-Restart `python -m jiuwenswarm.app` after updating `.env`.
-
-## Troubleshooting
-
-### `Missing script: "whatsapp:bridge"`
-
-You ran `npm` in the wrong folder. Use:
-
-`C:\Users\chiak\OneDrive\Desktop\jiuwenswarm\jiuwenswarm`
-
-### Bridge starts but no QR
-
-1. Stop any old bridge processes that may still be holding the port or auth session.
-2. Delete auth state to force relinking:
- `jiuwenswarm/jiuwenswarm/workspace/.whatsapp-auth`
-3. Start the bridge again and wait for `QR received`.
-
-### App connects to bridge but cannot send
-
-Check the connection state in logs:
-
-- If state is `bridge_connected` or `connecting`, the local bridge is reachable but WhatsApp is not ready yet.
-- If state is `qr_pending`, scan the QR code.
-- If state is `logged_out`, delete the auth directory and relink.
-- Only state `open` allows sends.
-
-### App says WhatsApp channel not configured
-
-- Make sure the YAML key is `channels.whatsapp`.
-- Make sure `enabled: true` is set.
-- Make sure `bridge_ws_url` is not empty.
-
-### Bluestacks or emulator linking issues
-
-Scanning from a physical phone is usually more reliable than emulator camera passthrough.
diff --git a/docs/zh/Discord.md b/docs/zh/Discord.md
deleted file mode 100644
index 5a6ba7bab0..0000000000
--- a/docs/zh/Discord.md
+++ /dev/null
@@ -1,186 +0,0 @@
-# Discord 频道接入说明
-
-本文说明如何在 [Discord 开发者平台](https://discord.com/developers/applications) 创建应用与 Bot、开启所需 Intent 与安装方式,并在 JiuwenSwarm 的**频道管理**中完成配置。
-
-## 本仓库中的实现
-
-- Python 频道:`jiuwenswarm/channel/discord_channel.py`(基于 discord.py)
-- 运行时配置:`config.yaml` 中的 `channels/discord`,或通过 Web 端 **频道管理** → Discord 保存
-
-Bot 使用 **Bot Token** 登录,可在配置的服务器频道与/或私信(DM)中收发消息(也可通过 `block_dm` 关闭私信)。处理过程中会对用户消息尝试添加 👀 反应,与其它频道行为一致。
-
-## 前置条件
-
-- 已注册 Discord 账号
-- 具备将 Bot 拉入服务器的权限;若启用用户安装,用户也可通过安装链接使用私信(取决于你在后台的安装设置)
-
----
-
-## 1. 创建应用
-
-1. 打开 [https://discord.com/developers/applications](https://discord.com/developers/applications)。
-2. 点击 **New Application**,填写名称并创建。
-
-![创建 Discord 应用](../assets/images/discord/1_create_new_app.png)
-
-后续 **OAuth2 / 安装** 与 **Bot** 用户均在此应用下配置。
-
----
-
-## 2. 获取 Bot Token(重置并复制)
-
-1. 左侧进入 **Bot**。
-2. 在 **Token** 区域点击 **Reset Token** 并确认。
-3. **立即复制 Token** 并妥善保存;重置后 Discord 通常只完整展示一次。
-
-![重置并复制 Bot Token](../assets/images/discord/2_reset_bot_token.png)
-
-**安全提示**
-
-- Token 等同于密码,泄露后他人可操控你的 Bot。
-- 仅填入 JiuwenSwarm 的 Discord 配置或 `config.yaml`,勿提交到代码仓。
-- 若怀疑泄露,在同一位置再次 **Reset Token**。
-
-该值对应 JiuwenSwarm 中的 **`bot_token`**。
-
----
-
-## 3. 开启 Message Content Intent
-
-JiuwenSwarm 需要读取用户消息的**文本内容**。Discord 要求通过「特权网关 Intent」显式开启。
-
-1. 仍在 **Bot** 页面。
-2. 在 **Privileged Gateway Intents** 中打开 **MESSAGE CONTENT INTENT**。
-3. 若页面有保存提示,请保存。
-
-![开启 Message Content Intent](../assets/images/discord/3_set_required_intent.png)
-
-未开启时,Bot 可能在线但无法读取普通消息的文本内容。
-
----
-
-## 4. 服务器安装:权限范围与 Bot 权限
-
-配置 Bot 被安装进服务器后的能力。JiuwenSwarm 典型需要:
-
-- 在目标频道**读取**消息
-- **发送**消息(回复用户)
-- **读取消息历史**(上下文)
-- **添加反应**(例如处理中的 👀)
-- **使用应用程序命令**(若你另行使用斜杠命令,可按需勾选)
-
-在开发者后台的 **Installation** 或 **OAuth2 → URL Generator** 等入口(界面可能随 Discord 更新调整)中:
-
-- 勾选 **`bot`** 等所需 **Scopes**(若使用应用命令可勾选 **`applications.commands`**)。
-- 勾选与上表一致的 **Bot Permissions**。
-- 下方截图中显示了推荐的权限配置,必选内容已标出。
-
-![服务器安装范围与 Bot 权限](../assets/images/discord/4_set_guild_install_scope_and_permissions.png)
-
-请以截图与上述能力为准;若菜单名称与截图略有差异,选择等效项即可。
-
----
-
-## 5. 安装方式与安装 / 设置链接
-
-选择用户或管理员如何安装应用:
-
-- **Guild install(服务器安装)** — 将 Bot 加入指定服务器,需要可分享的安装或邀请链接。
-- **User install(用户安装)** — 允许用户为**私信(DM)**安装应用(适合主要走私聊、不固定某个频道)。
-
-在门户中复制生成的 **URL** 或 **Install link**,在浏览器中打开完成授权。
-
-![选择安装方式并复制设置链接](../assets/images/discord/5_select_install_methods_and_copy_setup_link.png)
-
-安装完成后:
-
-- **服务器场景**:将 Bot 放入 JiuwenSwarm 要监听的频道(见下文 `guild_id` / `channel_id`)。
-- **私信场景**:用户可与 Bot 打开私聊(除非在 JiuwenSwarm 中开启 **`block_dm`**)。
-
----
-
-## 6. JiuwenSwarm 需要的 ID
-
-| 配置项 | 获取方式 |
-|--------|----------|
-| **Application ID** | **General Information** → **APPLICATION ID**,复制。对应 **`application_id`**(建议填写)。 |
-| **Guild ID(服务器 ID)** | Discord 用户设置中开启 **开发者模式**(高级)。**右键服务器图标** → **复制服务器 ID**。对应 **`guild_id`**。若仅私信、不限制服务器可留空。 |
-| **Channel ID(频道 ID)** | **右键文字频道** → **复制频道 ID**。对应 **`channel_id`**。若仅私信等场景可按需留空。 |
-
-当 **`guild_id`** 与 **`channel_id`** 均填写时,只处理**该服务器下该频道**内的消息;**私信仍可收发**,除非将 **`block_dm`** 设为 `true`。
-
-有一个快速取得 `guild_id` 与 `channel_id` 的小技巧。在 Discord 网页版中打开目标文字频道,并查看浏览器地址栏,URL 格式一般为:
-```
-https://discord.com/channels/<guild_id>/<channel_id>
-```
-
----
-
-## 7. 在 JiuwenSwarm 频道管理中配置
-
-在 Web 端打开 **频道管理** → **Discord** 填写并保存,或直接编辑:
-
-`~/.jiuwenswarm/config/config.yaml`(路径因环境可能不同)
-
-示例:
-
-```yaml
-channels:
- discord:
- bot_token: "你的Bot_Token"
- application_id: "你的Application_ID"
- guild_id: "你的服务器ID" # 仅私信场景可留空
- channel_id: "你的频道ID" # 按需留空
- block_dm: false # true 表示不处理私信
- allow_from: [] # 空为不限制;否则填 Discord 用户 ID 列表
- enabled: true
-```
-
-| 字段 | 说明 |
-|------|------|
-| `bot_token` | **必填**,来自第 2 步。 |
-| `application_id` | **General Information** 中的应用 ID。 |
-| `guild_id` | 限定服务器;仅 DM 时可不填。 |
-| `channel_id` | 限定频道;可与 DM 并存时按需填写。 |
-| `block_dm` | `true` 时忽略所有私信。 |
-| `allow_from` | 用户白名单;空表示不限制(仍需能向 Bot 发消息)。 |
-| `enabled` | 是否启用 Discord 频道。 |
-
----
-
-## 8. 验证
-
-1. 确认 Bot 在服务器中在线,或用户侧可与 Bot 私信。
-2. 在已配置频道或私信中发送一条短消息。
-3. 若 Bot 在该场景下有 **添加反应** 权限,用户消息上应出现 👀;模型与下游配置正确时,应收到智能体回复。
-
----
-
-## 故障排查
-
-### Bot 在线但没有回复
-
-- 确认已开启 **MESSAGE CONTENT INTENT**。
-- 确认 **`enabled: true`** 且 **`bot_token`** 正确。
-- 检查 **`guild_id` / `channel_id`**:二者都填时,仅监听该频道内消息。
-- 若配置了 **`allow_from`**,当前用户的 Discord 用户 ID 须在列表中(或改为空列表)。
-
-### 无法添加 👀 反应
-
-- 在该频道为 Bot 所在角色勾选 **添加反应(Add Reactions)** 权限(或通过频道权限覆盖)。
-
-### 私信不可用
-
-- 若需用户私信使用,需要在Discord进行 **User install**。
-- JiuwenSwarm 中确认 **`block_dm`** 为 `false`。
-- 用户安装后通常需在 Bot 资料页选择 **发消息** 打开 DM。
-
-### 模型或下游 API 报错
-
-Discord 连通与模型配置相互独立。若出现模型 HTTP 错误,请检查 `.env` 与模型相关配置并重启应用(与其它频道文档说明一致)。
-
----
-
-## 相关文档
-
-- 简要字段说明:[频道.md](频道.md) 中的 Discord 小节
diff --git a/docs/zh/SUMMARY.md b/docs/zh/SUMMARY.md
index d17bf9a1ca..444b1de8d1 100644
--- a/docs/zh/SUMMARY.md
+++ b/docs/zh/SUMMARY.md
@@ -17,9 +17,7 @@
- [使用指南](README.md)
- [对话](对话.md)
- [频道](频道.md)
- - [Discord](Discord.md)
- - [WhatsApp(中文)](whatsapp.md)
- - [WhatsApp(English)](../en/WhatsApp.md)
+ - [海外频道](海外频道.md)
- [模式系统](模式系统.md)
- [命令行指令](命令行指令.md)
- [Slash 命令速查表](Slash命令表.md)
diff --git a/docs/zh/whatsapp.md b/docs/zh/whatsapp.md
deleted file mode 100644
index 3776d5fdce..0000000000
--- a/docs/zh/whatsapp.md
+++ /dev/null
@@ -1,234 +0,0 @@
-# WhatsApp 频道接入说明
-
-本文档说明当前仓库里已经实现的 WhatsApp 接入方式。
-
-## 架构
-
-JiuwenSwarm 的 Python 代码不会直接连接 WhatsApp。
-
-`WhatsApp 客户端` <-> `Baileys bridge(Node.js)` <-> `WhatsAppChannel(Python)`
-
-- Bridge WebSocket 默认地址:`ws://127.0.0.1:19600/ws`
-- Bridge 脚本:`jiuwenswarm/scripts/whatsapp-bridge.js`
-- Python 频道实现:`jiuwenswarm/channel/whatsapp_channel.py`
-- 运行时配置位置:`config.yaml` 里的 `channels.whatsapp`
-
-## 当前仓库已经实现的能力
-
-- Node bridge 使用 Baileys 登录 WhatsApp Web,并负责收发消息。
-- Python 侧通过 WebSocket 连接本地 bridge,交换 JSON 消息。
-- Python 侧会根据 bridge 发来的状态事件维护连接状态,只有在 WhatsApp 真正连通时才允许发送消息。
-- `allow_from` 可以按完整 JID 或手机号部分过滤入站发送者。
-
-## 当前仓库还没有实现的能力
-
-- 没有 Python 到 bridge 的鉴权握手,也没有共享密钥 token。
-- 目前默认仅依赖 bridge 绑定到 `127.0.0.1` 来限制访问范围。
-- 没有实现媒体文件下载和附件转发。
-- 没有实现语音消息转写。
-- 没有实现 Python 侧入站消息去重。
-
-## WebSocket 协议
-
-Python 发给 bridge 的消息:
-
-```json
-{
- "type": "send",
- "jid": "[email protected]",
- "text": "hello",
- "request_id": "msg-123"
-}
-```
-
-Bridge 发给 Python 的消息类型:
-
-- `status`:bridge / WhatsApp 连接状态更新
-- `qr`:当前有二维码可供扫码登录
-- `inbound`:来自 WhatsApp 的入站文本消息
-- `send_result`:对 `send` 的确认或错误返回
-- `pong`:对 ping 的响应
-
-## 连接状态语义
-
-Python 侧当前会追踪这些状态:
-
-- `stopped`:频道已停止
-- `bridge_connected`:Python 已连上本地 bridge WebSocket,但 WhatsApp 可能仍在连接中
-- `connecting`:bridge 正在尝试把 Baileys 连到 WhatsApp
-- `qr_pending`:已经生成二维码,等待扫码
-- `open`:WhatsApp 已连接,可正常发送消息
-- `close`:WhatsApp 连接已关闭
-- `logged_out`:WhatsApp 会话已登出,需要重新扫码
-- `bridge_disconnected`:Python 到本地 bridge 的 WebSocket 断开
-
-这几个状态需要区分清楚:
-
-- `bridge_connected` 只表示 Python 能连到本地 bridge。
-- `open` 才表示 bridge 已经真正登录到 WhatsApp,可以发消息。
-
-## 频道元数据
-
-`WhatsAppChannel.get_metadata()` 现在会在 `extra` 中暴露这些运行态字段:
-
-- `bridge_state`
-- `bridge_ws_connected`
-- `whatsapp_connected`
-- `qr_pending`
-- `last_status_ts_ms`
-- `last_status_code`
-
-## 前置要求
-
-- 可运行 `python -m jiuwenswarm.app` 的 Python 环境
-- Node.js 20+ 和 npm
-- 已开通 Linked Devices 的 WhatsApp 账号
-
-## 1. 安装 Bridge 依赖
-
-在内层项目目录执行,也就是包含 `jiuwenswarm/package.json` 的目录:
-
-```powershell
-cd C:\Users\chiak\OneDrive\Desktop\jiuwenswarm\jiuwenswarm
-npm install
-```
-
-如果只想安装 bridge 依赖:
-
-```powershell
-npm install @whiskeysockets/baileys ws pino qrcode-terminal
-```
-
-## 2. 配置 WhatsApp
-
-编辑运行时配置文件:
-
-`C:\Users\chiak\.jiuwenswarm\config\config.yaml`
-
-在 `channels:` 下添加或确认如下配置:
-
-```yaml
- whatsapp:
- bridge_ws_url: ws://127.0.0.1:19600/ws
- default_jid:
- allow_from: []
- enable_streaming: true
- auto_start_bridge: false
- bridge_command: node scripts/whatsapp-bridge.js
- bridge_workdir: C:/Users/chiak/OneDrive/Desktop/jiuwenswarm/jiuwenswarm
- enabled: true
-```
-
-说明:
-
-- `enable_streaming: true` 会转发中间事件,例如 token 流式输出和工具执行进度。
-- `enable_streaming: false` 会抑制 `chat.delta`,更接近只发最终结果。
-- `default_jid` 是出站消息缺少目标时的兜底发送对象。
-- `allow_from` 支持完整发送者 JID,也支持 `@` 前面的号码部分。
-- `auto_start_bridge: true` 表示由 Python 自动拉起 Node bridge。
-
-## 3. 启动服务
-
-如果没有开启 `auto_start_bridge: true`,请开两个终端。
-
-终端 A,启动 bridge:
-
-```powershell
-cd C:\Users\chiak\OneDrive\Desktop\jiuwenswarm\jiuwenswarm
-npm run whatsapp:bridge
-```
-
-预期日志:
-
-`[whatsapp-bridge] ws://127.0.0.1:19600/ws`
-
-终端 B,启动应用:
-
-```powershell
-cd C:\Users\chiak\OneDrive\Desktop\jiuwenswarm
-python -m jiuwenswarm.app
-```
-
-预期行为:
-
-- 应用日志会显示 `WhatsAppChannel` 已注册。
-- 频道先进入 `bridge_connected`。
-- 后续根据登录状态进入 `connecting`、`qr_pending` 或 `open`。
-
-## 4. 扫码绑定 WhatsApp
-
-如果 bridge 没有可用的认证状态,它会在 bridge 终端打印二维码。
-
-在 WhatsApp 中:
-
-`设置` -> `已关联设备` -> `关联设备`
-
-扫描终端 A 中的二维码即可。
-
-认证状态会保存在:
-
-`jiuwenswarm/jiuwenswarm/workspace/.whatsapp-auth`
-
-如果账号已经绑定,可能不会再次出现二维码,这是正常现象。
-
-## 5. 收发消息说明
-
-- 入站文本消息会由 bridge 以 `inbound` 发给 Python。
-- 出站消息由 Python 以 `send` 发给 bridge。
-- Python 现在只会在状态为 `open` 时尝试发送。
-- 如果 bridge 返回 `send_result.ok=false`,Python 会记录失败日志。
-
-## 6. 安全说明
-
-- bridge 默认只监听 `127.0.0.1`,因此默认只允许本机访问。
-- 当前仓库还没有实现 bridge token 鉴权。
-- 如果你要把 bridge 端口暴露到其他机器,请先补上鉴权,或者放到可信的隧道/反向代理之后。
-
-## 7. LLM 配置仍然会影响最终效果
-
-如果 WhatsApp 入站消息进入应用后出现 `405 Not Allowed` 之类的下游错误,通常不是 WhatsApp 本身的问题,而是模型配置仍然是占位值或无效。
-
-示例 `.env`:
-
-```env
-MODEL_PROVIDER=OpenAI
-MODEL_NAME=your-real-model
-API_BASE=https://your-real-openai-compatible-endpoint/v1
-API_KEY=your-real-key
-```
-
-更新 `.env` 后重启 `python -m jiuwenswarm.app`。
-
-## 故障排查
-
-### `Missing script: "whatsapp:bridge"`
-
-说明你在错误目录执行了 `npm`。请使用:
-
-`C:\Users\chiak\OneDrive\Desktop\jiuwenswarm\jiuwenswarm`
-
-### Bridge 启动了但没有二维码
-
-1. 先停止旧的 bridge 进程,避免端口或旧会话冲突。
-2. 删除认证目录,强制重新绑定:
- `jiuwenswarm/jiuwenswarm/workspace/.whatsapp-auth`
-3. 重新启动 bridge,等待出现 `QR received`。
-
-### App 能连上 bridge,但发不出消息
-
-先看日志里的状态:
-
-- 如果是 `bridge_connected` 或 `connecting`,说明本地 bridge 可达,但 WhatsApp 还没准备好。
-- 如果是 `qr_pending`,先扫码。
-- 如果是 `logged_out`,删除认证目录后重新扫码。
-- 只有 `open` 才允许真正发送。
-
-### App 提示 WhatsApp 未配置
-
-- 确认 YAML 路径是 `channels.whatsapp`
-- 确认设置了 `enabled: true`
-- 确认 `bridge_ws_url` 不为空
-
-### 模拟器扫码问题
-
-和模拟器相机透传相比,直接用实体手机扫码通常更稳定。
diff --git "a/docs/zh/\345\233\275\345\244\226\351\242\221\351\201\223.md" "b/docs/zh/\345\233\275\345\244\226\351\242\221\351\201\223.md"
deleted file mode 100644
index fc6c4e14bf..0000000000
--- "a/docs/zh/\345\233\275\345\244\226\351\242\221\351\201\223.md"
+++ /dev/null
@@ -1,153 +0,0 @@
-# 国外频道
-
-JiuwenSwarm 支持接入多个国外聊天平台,以下是各频道的详细配置说明。
-
-## Telegram
-
-### 1. 创建 Telegram Bot
-
-通过 Telegram 内置的 [@BotFather](https://t.me/BotFather) 创建机器人并获取 Bot Token。
-
-**第一步:** 在 Telegram 中搜索 `@BotFather` 并打开对话
-
-![BotFather 搜索与对话界面](../assets/images/TelegramBotFather.png)
-
-**第二步:** 发送 `/newbot` 命令,按提示输入机器人名称和用户名
-
-BotFather 会依次要求你输入:
-- **机器人显示名称**(如 `JiuwenSwarm Bot`)
-- **机器人用户名**(必须以 `bot` 结尾,如 `jiuwenswarm_bot`)
-
-![BotFather 返回 Bot Token 的消息](../assets/images/Telegram获取BotToken.png)
-
-**第三步:** 保存 Bot Token
-
-创建成功后,BotFather 会返回一个格式如 `123456789:ABCDefGhIJKlmN...` 的 Token,请妥善保存,后续配置需要使用。
-
-> ⚠️ **注意**:Bot Token 等同于机器人的密码,请勿泄露。如果 Token 泄露,可在 BotFather 中使用 `/revoke` 重新生成。
-
-### 2. 绑定频道
-
-#### 方式一:网页配置(推荐)
-
-在 JiuwenSwarm 前端页面,点击 **`智能体` / `频道`** 卡片,在 Telegram 频道模块中填入 Bot Token,开启使用,点击保存即可。
-
-![Telegram 频道配置界面](../assets/images/Telegram频道配置.png)
-
-#### 方式二:修改 `config.yaml`
-
-编辑 `~/.jiuwenswarm/config/config.yaml`:
-
-``````yaml
-channels:
- telegram:
- bot_token: "你的Bot Token"
- allow_from: []
- parse_mode: Markdown
- group_chat_mode: mention
- enabled: true
-``````
-
-保存后若服务已运行会自动重载,未运行可以执行 `jiuwenswarm-start` 启动服务。
-
-### 3. 配置说明
-
-| 配置项 | 说明 | 默认值 |
-|:------|:-----|:------|
-| `bot_token` | 从 @BotFather 获取的 Bot Token,**必填** | 空 |
-| `allow_from` | 允许使用的 Telegram user_id 白名单列表,为空则允许所有用户 | `[]` |
-| `parse_mode` | 消息解析模式:`Markdown`、`HTML` 或 `None`(纯文本) | `Markdown` |
-| `group_chat_mode` | 群聊响应模式(见下方详细说明) | `mention` |
-| `enabled` | 是否启用 Telegram 频道 | `false` |
-
-### 群聊模式说明
-
-当机器人被添加到 Telegram 群组时,`group_chat_mode` 控制机器人如何响应群内消息:
-
-| 模式 | 说明 |
-|:-----|:-----|
-| `mention` | **仅响应 @提及**:只有在群内 @机器人 时才会处理消息(推荐) |
-| `reply` | **仅响应回复**:只有回复机器人消息时才会处理 |
-| `all` | **响应所有消息**:群内所有文本消息都会被处理 |
-| `off` | **禁用群聊**:在群组中不响应任何消息 |
-
-### 4. 开始对话
-
-**方式 1:** 在 Telegram 中搜索你创建的机器人用户名,发送 `你好` 即可开始对话
-
-![Telegram 中与 Bot 对话界面](../assets/images/Telegram对话界面.png)
-
-**方式 2:** 将机器人添加到群组中,根据 `group_chat_mode` 配置与机器人交互
-
-![Telegram 中与 Bot 对话群组界面](../assets/images/Telegram群组对话界面.png)
-
-### 5. 获取 user_id(配置白名单)
-
-如需配置 `allow_from` 白名单,需要先获取用户的 Telegram user_id。可以通过以下方式获取:
-
-1. 在 Telegram 中搜索 `@userinfobot`,发送任意消息即可获取你的 user_id
-
-2. 将获取到的 user_id 填入 `allow_from` 列表中
-
-``````yaml
-channels:
- telegram:
- bot_token: "你的Bot Token"
- allow_from:
- - "123456789"
- - "987654321"
- enabled: true
-``````
-
-> 💡 **提示**:`allow_from` 为空列表时,所有用户均可使用机器人。设置白名单后,只有列表中的用户才能与机器人对话。
-
----
-
-## Discord
-
-当前版本已经支持 Discord 频道接入。在「频道管理」中配置并启用 Discord Bot,也可以手动编辑 `config.yaml`。
-
-分步图文(开发者后台创建 Bot、Intent、安装链接、频道管理)见 [Discord.md](Discord.md)。
-
-### 配置项
-
-- `bot_token`
-- `application_id`
-- `guild_id`
-- `channel_id`
-- `block_dm`
-- `allow_from`
-- `enabled`
-
-可在 `~/.jiuwenswarm/config/config.yaml` 中按如下方式配置:
-
-``````yaml
-channels:
- discord:
- bot_token: "Discord Bot Token"
- application_id: "Application ID"
- guild_id: "目标服务器 Guild ID"
- channel_id: "目标频道 Channel ID"
- block_dm: false
- allow_from: []
- enabled: true
-``````
-
-### 简略使用说明
-
-1. 在 Discord Developer Portal 创建 Bot,获取 `bot_token`
-2. 在 Bot 页签开启 **Message Content Intent**
-3. 将机器人邀请进目标服务器并赋予读写频道权限
-4. 在 JiuwenSwarm 里填入配置并启用 `enabled: true`
-
-### 字段说明
-
-| 配置项 | 说明 | 默认值 |
-|:------|:-----|:------|
-| `bot_token` | Discord Bot Token(必填) | 空 |
-| `application_id` | 应用 ID(可选,建议填写) | 空 |
-| `guild_id` | 仅监听指定服务器(可选,留空表示不限制) | 空 |
-| `channel_id` | 仅监听/回复指定频道(可选,留空按消息上下文回复) | 空 |
-| `block_dm` | 为 `true` 时不处理私信(DM) | `false` |
-| `allow_from` | 允许访问的 Discord 用户 ID 列表,空列表表示允许所有 | `[]` |
-| `enabled` | 是否启用 Discord 频道 | `false` |
\ No newline at end of file
diff --git "a/docs/zh/\346\265\267\345\244\226\351\242\221\351\201\223.md" "b/docs/zh/\346\265\267\345\244\226\351\242\221\351\201\223.md"
new file mode 100644
index 0000000000..31ce35fd53
--- /dev/null
+++ "b/docs/zh/\346\265\267\345\244\226\351\242\221\351\201\223.md"
@@ -0,0 +1,549 @@
+# 国外频道
+
+JiuwenSwarm 支持接入多个国外聊天平台,以下是各频道的详细配置说明。
+
+## Telegram
+
+### 1. 创建 Telegram Bot
+
+通过 Telegram 内置的 [@BotFather](https://t.me/BotFather) 创建机器人并获取 Bot Token。
+
+**第一步:** 在 Telegram 中搜索 `@BotFather` 并打开对话
+
+![BotFather 搜索与对话界面](../assets/images/TelegramBotFather.png)
+
+**第二步:** 发送 `/newbot` 命令,按提示输入机器人名称和用户名
+
+BotFather 会依次要求你输入:
+- **机器人显示名称**(如 `JiuwenSwarm Bot`)
+- **机器人用户名**(必须以 `bot` 结尾,如 `jiuwenswarm_bot`)
+
+![BotFather 返回 Bot Token 的消息](../assets/images/Telegram获取BotToken.png)
+
+**第三步:** 保存 Bot Token
+
+创建成功后,BotFather 会返回一个格式如 `123456789:ABCDefGhIJKlmN...` 的 Token,请妥善保存,后续配置需要使用。
+
+> ⚠️ **注意**:Bot Token 等同于机器人的密码,请勿泄露。如果 Token 泄露,可在 BotFather 中使用 `/revoke` 重新生成。
+
+### 2. 绑定频道
+
+#### 方式一:网页配置(推荐)
+
+在 JiuwenSwarm 前端页面,点击 **`智能体` / `频道`** 卡片,在 Telegram 频道模块中填入 Bot Token,开启使用,点击保存即可。
+
+![Telegram 频道配置界面](../assets/images/Telegram频道配置.png)
+
+#### 方式二:修改 `config.yaml`
+
+编辑 `~/.jiuwenswarm/config/config.yaml`:
+
+``````yaml
+channels:
+ telegram:
+ bot_token: "你的Bot Token"
+ allow_from: []
+ parse_mode: Markdown
+ group_chat_mode: mention
+ enabled: true
+``````
+
+保存后若服务已运行会自动重载,未运行可以执行 `jiuwenswarm-start` 启动服务。
+
+### 3. 配置说明
+
+| 配置项 | 说明 | 默认值 |
+|:------|:-----|:------|
+| `bot_token` | 从 @BotFather 获取的 Bot Token,**必填** | 空 |
+| `allow_from` | 允许使用的 Telegram user_id 白名单列表,为空则允许所有用户 | `[]` |
+| `parse_mode` | 消息解析模式:`Markdown`、`HTML` 或 `None`(纯文本) | `Markdown` |
+| `group_chat_mode` | 群聊响应模式(见下方详细说明) | `mention` |
+| `enabled` | 是否启用 Telegram 频道 | `false` |
+
+### 群聊模式说明
+
+当机器人被添加到 Telegram 群组时,`group_chat_mode` 控制机器人如何响应群内消息:
+
+| 模式 | 说明 |
+|:-----|:-----|
+| `mention` | **仅响应 @提及**:只有在群内 @机器人 时才会处理消息(推荐) |
+| `reply` | **仅响应回复**:只有回复机器人消息时才会处理 |
+| `all` | **响应所有消息**:群内所有文本消息都会被处理 |
+| `off` | **禁用群聊**:在群组中不响应任何消息 |
+
+### 4. 开始对话
+
+**方式 1:** 在 Telegram 中搜索你创建的机器人用户名,发送 `你好` 即可开始对话
+
+![Telegram 中与 Bot 对话界面](../assets/images/Telegram对话界面.png)
+
+**方式 2:** 将机器人添加到群组中,根据 `group_chat_mode` 配置与机器人交互
+
+![Telegram 中与 Bot 对话群组界面](../assets/images/Telegram群组对话界面.png)
+
+### 5. 获取 user_id(配置白名单)
+
+如需配置 `allow_from` 白名单,需要先获取用户的 Telegram user_id。可以通过以下方式获取:
+
+1. 在 Telegram 中搜索 `@userinfobot`,发送任意消息即可获取你的 user_id
+
+2. 将获取到的 user_id 填入 `allow_from` 列表中
+
+``````yaml
+channels:
+ telegram:
+ bot_token: "你的Bot Token"
+ allow_from:
+ - "123456789"
+ - "987654321"
+ enabled: true
+``````
+
+> 💡 **提示**:`allow_from` 为空列表时,所有用户均可使用机器人。设置白名单后,只有列表中的用户才能与机器人对话。
+
+---
+
+## Discord
+
+当前版本已经支持 Discord 频道接入。在「频道管理」中配置并启用 Discord Bot,也可以手动编辑 `config.yaml`。
+
+### 配置项
+
+- `bot_token`
+- `application_id`
+- `guild_id`
+- `channel_id`
+- `block_dm`
+- `allow_from`
+- `enabled`
+
+可在 `~/.jiuwenswarm/config/config.yaml` 中按如下方式配置:
+
+``````yaml
+channels:
+ discord:
+ bot_token: "Discord Bot Token"
+ application_id: "Application ID"
+ guild_id: "目标服务器 Guild ID"
+ channel_id: "目标频道 Channel ID"
+ block_dm: false
+ allow_from: []
+ enabled: true
+``````
+
+### 简略使用说明
+
+1. 在 Discord Developer Portal 创建 Bot,获取 `bot_token`
+2. 在 Bot 页签开启 **Message Content Intent**
+3. 将机器人邀请进目标服务器并赋予读写频道权限
+4. 在 JiuwenSwarm 里填入配置并启用 `enabled: true`
+
+### 字段说明
+
+| 配置项 | 说明 | 默认值 |
+|:------|:-----|:------|
+| `bot_token` | Discord Bot Token(必填) | 空 |
+| `application_id` | 应用 ID(可选,建议填写) | 空 |
+| `guild_id` | 仅监听指定服务器(可选,留空表示不限制) | 空 |
+| `channel_id` | 仅监听/回复指定频道(可选,留空按消息上下文回复) | 空 |
+| `block_dm` | 为 `true` 时不处理私信(DM) | `false` |
+| `allow_from` | 允许访问的 Discord 用户 ID 列表,空列表表示允许所有 | `[]` |
+| `enabled` | 是否启用 Discord 频道 | `false` |
+
+### 详细接入步骤
+
+#### 本仓库中的实现
+
+- Python 频道:`jiuwenswarm/channel/discord_channel.py`(基于 discord.py)
+- 运行时配置:`config.yaml` 中的 `channels/discord`,或通过 Web 端 **频道管理** → Discord 保存
+
+Bot 使用 **Bot Token** 登录,可在配置的服务器频道与/或私信(DM)中收发消息(也可通过 `block_dm` 关闭私信)。处理过程中会对用户消息尝试添加 👀 反应,与其它频道行为一致。
+
+#### 前置条件
+
+- 已注册 Discord 账号
+- 具备将 Bot 拉入服务器的权限;若启用用户安装,用户也可通过安装链接使用私信(取决于你在后台的安装设置)
+
+#### 1. 创建应用
+
+1. 打开 [https://discord.com/developers/applications](https://discord.com/developers/applications)。
+2. 点击 **New Application**,填写名称并创建。
+
+![创建 Discord 应用](../assets/images/discord/1_create_new_app.png)
+
+后续 **OAuth2 / 安装** 与 **Bot** 用户均在此应用下配置。
+
+#### 2. 获取 Bot Token(重置并复制)
+
+1. 左侧进入 **Bot**。
+2. 在 **Token** 区域点击 **Reset Token** 并确认。
+3. **立即复制 Token** 并妥善保存;重置后 Discord 通常只完整展示一次。
+
+![重置并复制 Bot Token](../assets/images/discord/2_reset_bot_token.png)
+
+**安全提示**
+
+- Token 等同于密码,泄露后他人可操控你的 Bot。
+- 仅填入 JiuwenSwarm 的 Discord 配置或 `config.yaml`,勿提交到代码仓。
+- 若怀疑泄露,在同一位置再次 **Reset Token**。
+
+该值对应 JiuwenSwarm 中的 **`bot_token`**。
+
+#### 3. 开启 Message Content Intent
+
+JiuwenSwarm 需要读取用户消息的**文本内容**。Discord 要求通过「特权网关 Intent」显式开启。
+
+1. 仍在 **Bot** 页面。
+2. 在 **Privileged Gateway Intents** 中打开 **MESSAGE CONTENT INTENT**。
+3. 若页面有保存提示,请保存。
+
+![开启 Message Content Intent](../assets/images/discord/3_set_required_intent.png)
+
+未开启时,Bot 可能在线但无法读取普通消息的文本内容。
+
+#### 4. 服务器安装:权限范围与 Bot 权限
+
+配置 Bot 被安装进服务器后的能力。JiuwenSwarm 典型需要:
+
+- 在目标频道**读取**消息
+- **发送**消息(回复用户)
+- **读取消息历史**(上下文)
+- **添加反应**(例如处理中的 👀)
+- **使用应用程序命令**(若你另行使用斜杠命令,可按需勾选)
+
+在开发者后台的 **Installation** 或 **OAuth2 → URL Generator** 等入口(界面可能随 Discord 更新调整)中:
+
+- 勾选 **`bot`** 等所需 **Scopes**(若使用应用命令可勾选 **`applications.commands`**)。
+- 勾选与上表一致的 **Bot Permissions**。
+- 下方截图中显示了推荐的权限配置,必选内容已标出。
+
+![服务器安装范围与 Bot 权限](../assets/images/discord/4_set_guild_install_scope_and_permissions.png)
+
+请以截图与上述能力为准;若菜单名称与截图略有差异,选择等效项即可。
+
+#### 5. 安装方式与安装 / 设置链接
+
+选择用户或管理员如何安装应用:
+
+- **Guild install(服务器安装)** — 将 Bot 加入指定服务器,需要可分享的安装或邀请链接。
+- **User install(用户安装)** — 允许用户为**私信(DM)**安装应用(适合主要走私聊、不固定某个频道)。
+
+在门户中复制生成的 **URL** 或 **Install link**,在浏览器中打开完成授权。
+
+![选择安装方式并复制设置链接](../assets/images/discord/5_select_install_methods_and_copy_setup_link.png)
+
+安装完成后:
+
+- **服务器场景**:将 Bot 放入 JiuwenSwarm 要监听的频道(见下文 `guild_id` / `channel_id`)。
+- **私信场景**:用户可与 Bot 打开私聊(除非在 JiuwenSwarm 中开启 **`block_dm`**)。
+
+#### 6. JiuwenSwarm 需要的 ID
+
+| 配置项 | 获取方式 |
+|--------|----------|
+| **Application ID** | **General Information** → **APPLICATION ID**,复制。对应 **`application_id`**(建议填写)。 |
+| **Guild ID(服务器 ID)** | Discord 用户设置中开启 **开发者模式**(高级)。**右键服务器图标** → **复制服务器 ID**。对应 **`guild_id`**。若仅私信、不限制服务器可留空。 |
+| **Channel ID(频道 ID)** | **右键文字频道** → **复制频道 ID**。对应 **`channel_id`**。若仅私信等场景可按需留空。 |
+
+当 **`guild_id`** 与 **`channel_id`** 均填写时,只处理**该服务器下该频道**内的消息;**私信仍可收发**,除非将 **`block_dm`** 设为 `true`。
+
+有一个快速取得 `guild_id` 与 `channel_id` 的小技巧。在 Discord 网页版中打开目标文字频道,并查看浏览器地址栏,URL 格式一般为:
+```
+https://discord.com/channels/<guild_id>/<channel_id>
+```
+
+#### 7. 在 JiuwenSwarm 频道管理中配置
+
+在 Web 端打开 **频道管理** → **Discord** 填写并保存,或直接编辑:
+
+`~/.jiuwenswarm/config/config.yaml`(路径因环境可能不同)
+
+示例:
+
+```yaml
+channels:
+ discord:
+ bot_token: "你的Bot_Token"
+ application_id: "你的Application_ID"
+ guild_id: "你的服务器ID" # 仅私信场景可留空
+ channel_id: "你的频道ID" # 按需留空
+ block_dm: false # true 表示不处理私信
+ allow_from: [] # 空为不限制;否则填 Discord 用户 ID 列表
+ enabled: true
+```
+
+| 字段 | 说明 |
+|------|------|
+| `bot_token` | **必填**,来自第 2 步。 |
+| `application_id` | **General Information** 中的应用 ID。 |
+| `guild_id` | 限定服务器;仅 DM 时可不填。 |
+| `channel_id` | 限定频道;可与 DM 并存时按需填写。 |
+| `block_dm` | `true` 时忽略所有私信。 |
+| `allow_from` | 用户白名单;空表示不限制(仍需能向 Bot 发消息)。 |
+| `enabled` | 是否启用 Discord 频道。 |
+
+#### 8. 验证
+
+1. 确认 Bot 在服务器中在线,或用户侧可与 Bot 私信。
+2. 在已配置频道或私信中发送一条短消息。
+3. 若 Bot 在该场景下有 **添加反应** 权限,用户消息上应出现 👀;模型与下游配置正确时,应收到智能体回复。
+
+#### 故障排查
+
+**Bot 在线但没有回复**
+
+- 确认已开启 **MESSAGE CONTENT INTENT**。
+- 确认 **`enabled: true`** 且 **`bot_token`** 正确。
+- 检查 **`guild_id` / `channel_id`**:二者都填时,仅监听该频道内消息。
+- 若配置了 **`allow_from`**,当前用户的 Discord 用户 ID 须在列表中(或改为空列表)。
+
+**无法添加 👀 反应**
+
+- 在该频道为 Bot 所在角色勾选 **添加反应(Add Reactions)** 权限(或通过频道权限覆盖)。
+
+**私信不可用**
+
+- 若需用户私信使用,需要在Discord进行 **User install**。
+- JiuwenSwarm 中确认 **`block_dm`** 为 `false`。
+- 用户安装后通常需在 Bot 资料页选择 **发消息** 打开 DM。
+
+**模型或下游 API 报错**
+
+Discord 连通与模型配置相互独立。若出现模型 HTTP 错误,请检查 `.env` 与模型相关配置并重启应用(与其它频道文档说明一致)。
+
+---
+
+## WhatsApp
+
+本文档说明当前仓库里已经实现的 WhatsApp 接入方式。
+
+### 架构
+
+JiuwenSwarm 的 Python 代码不会直接连接 WhatsApp。
+
+`WhatsApp 客户端` <-> `Baileys bridge(Node.js)` <-> `WhatsAppChannel(Python)`
+
+- Bridge WebSocket 默认地址:`ws://127.0.0.1:19600/ws`
+- Bridge 脚本:`jiuwenswarm/scripts/whatsapp-bridge.js`
+- Python 频道实现:`jiuwenswarm/channel/whatsapp_channel.py`
+- 运行时配置位置:`config.yaml` 里的 `channels.whatsapp`
+
+### 当前仓库已经实现的能力
+
+- Node bridge 使用 Baileys 登录 WhatsApp Web,并负责收发消息。
+- Python 侧通过 WebSocket 连接本地 bridge,交换 JSON 消息。
+- Python 侧会根据 bridge 发来的状态事件维护连接状态,只有在 WhatsApp 真正连通时才允许发送消息。
+- `allow_from` 可以按完整 JID 或手机号部分过滤入站发送者。
+
+### 当前仓库还没有实现的能力
+
+- 没有 Python 到 bridge 的鉴权握手,也没有共享密钥 token。
+- 目前默认仅依赖 bridge 绑定到 `127.0.0.1` 来限制访问范围。
+- 没有实现媒体文件下载和附件转发。
+- 没有实现语音消息转写。
+- 没有实现 Python 侧入站消息去重。
+
+### WebSocket 协议
+
+Python 发给 bridge 的消息:
+
+```json
+{
+ "type": "send",
+ "jid": "[email protected]",
+ "text": "hello",
+ "request_id": "msg-123"
+}
+```
+
+Bridge 发给 Python 的消息类型:
+
+- `status`:bridge / WhatsApp 连接状态更新
+- `qr`:当前有二维码可供扫码登录
+- `inbound`:来自 WhatsApp 的入站文本消息
+- `send_result`:对 `send` 的确认或错误返回
+- `pong`:对 ping 的响应
+
+### 连接状态语义
+
+Python 侧当前会追踪这些状态:
+
+- `stopped`:频道已停止
+- `bridge_connected`:Python 已连上本地 bridge WebSocket,但 WhatsApp 可能仍在连接中
+- `connecting`:bridge 正在尝试把 Baileys 连到 WhatsApp
+- `qr_pending`:已经生成二维码,等待扫码
+- `open`:WhatsApp 已连接,可正常发送消息
+- `close`:WhatsApp 连接已关闭
+- `logged_out`:WhatsApp 会话已登出,需要重新扫码
+- `bridge_disconnected`:Python 到本地 bridge 的 WebSocket 断开
+
+这几个状态需要区分清楚:
+
+- `bridge_connected` 只表示 Python 能连到本地 bridge。
+- `open` 才表示 bridge 已经真正登录到 WhatsApp,可以发消息。
+
+### 频道元数据
+
+`WhatsAppChannel.get_metadata()` 现在会在 `extra` 中暴露这些运行态字段:
+
+- `bridge_state`
+- `bridge_ws_connected`
+- `whatsapp_connected`
+- `qr_pending`
+- `last_status_ts_ms`
+- `last_status_code`
+
+### 前置要求
+
+- 可运行 `python -m jiuwenswarm.app` 的 Python 环境
+- Node.js 20+ 和 npm
+- 已开通 Linked Devices 的 WhatsApp 账号
+
+### 1. 安装 Bridge 依赖
+
+在内层项目目录执行,也就是包含 `jiuwenswarm/package.json` 的目录:
+
+```powershell
+cd <项目根目录>/jiuwenswarm
+npm install
+```
+
+如果只想安装 bridge 依赖:
+
+```powershell
+npm install @whiskeysockets/baileys ws pino qrcode-terminal
+```
+
+### 2. 配置 WhatsApp
+
+编辑运行时配置文件:
+
+`~/.jiuwenswarm/config/config.yaml`
+
+在 `channels:` 下添加或确认如下配置:
+
+```yaml
+ whatsapp:
+ bridge_ws_url: ws://127.0.0.1:19600/ws
+ default_jid:
+ allow_from: []
+ enable_streaming: true
+ auto_start_bridge: false
+ bridge_command: node scripts/whatsapp-bridge.js
+ bridge_workdir: <项目根目录>/jiuwenswarm
+ enabled: true
+```
+
+说明:
+
+- `enable_streaming: true` 会转发中间事件,例如 token 流式输出和工具执行进度。
+- `enable_streaming: false` 会抑制 `chat.delta`,更接近只发最终结果。
+- `default_jid` 是出站消息缺少目标时的兜底发送对象。
+- `allow_from` 支持完整发送者 JID,也支持 `@` 前面的号码部分。
+- `auto_start_bridge: true` 表示由 Python 自动拉起 Node bridge。
+
+### 3. 启动服务
+
+如果没有开启 `auto_start_bridge: true`,请开两个终端。
+
+终端 A,启动 bridge:
+
+```powershell
+cd <项目根目录>/jiuwenswarm
+npm run whatsapp:bridge
+```
+
+预期日志:
+
+`[whatsapp-bridge] ws://127.0.0.1:19600/ws`
+
+终端 B,启动应用:
+
+```powershell
+cd <项目根目录>
+python -m jiuwenswarm.app
+```
+
+预期行为:
+
+- 应用日志会显示 `WhatsAppChannel` 已注册。
+- 频道先进入 `bridge_connected`。
+- 后续根据登录状态进入 `connecting`、`qr_pending` 或 `open`。
+
+### 4. 扫码绑定 WhatsApp
+
+如果 bridge 没有可用的认证状态,它会在 bridge 终端打印二维码。
+
+在 WhatsApp 中:
+
+`设置` -> `已关联设备` -> `关联设备`
+
+扫描终端 A 中的二维码即可。
+
+认证状态会保存在:
+
+`jiuwenswarm/jiuwenswarm/workspace/.whatsapp-auth`
+
+如果账号已经绑定,可能不会再次出现二维码,这是正常现象。
+
+### 5. 收发消息说明
+
+- 入站文本消息会由 bridge 以 `inbound` 发给 Python。
+- 出站消息由 Python 以 `send` 发给 bridge。
+- Python 现在只会在状态为 `open` 时尝试发送。
+- 如果 bridge 返回 `send_result.ok=false`,Python 会记录失败日志。
+
+### 6. 安全说明
+
+- bridge 默认只监听 `127.0.0.1`,因此默认只允许本机访问。
+- 当前仓库还没有实现 bridge token 鉴权。
+- 如果你要把 bridge 端口暴露到其他机器,请先补上鉴权,或者放到可信的隧道/反向代理之后。
+
+### 7. LLM 配置仍然会影响最终效果
+
+如果 WhatsApp 入站消息进入应用后出现 `405 Not Allowed` 之类的下游错误,通常不是 WhatsApp 本身的问题,而是模型配置仍然是占位值或无效。
+
+示例 `.env`:
+
+```env
+MODEL_PROVIDER=OpenAI
+MODEL_NAME=your-real-model
+API_BASE=https://your-real-openai-compatible-endpoint/v1
+API_KEY=your-real-key
+```
+
+更新 `.env` 后重启 `python -m jiuwenswarm.app`。
+
+### 故障排查
+
+**`Missing script: "whatsapp:bridge"`**
+
+说明你在错误目录执行了 `npm`。请使用:
+
+`<项目根目录>/jiuwenswarm`
+
+**Bridge 启动了但没有二维码**
+
+1. 先停止旧的 bridge 进程,避免端口或旧会话冲突。
+2. 删除认证目录,强制重新绑定:
+ `jiuwenswarm/jiuwenswarm/workspace/.whatsapp-auth`
+3. 重新启动 bridge,等待出现 `QR received`。
+
+**App 能连上 bridge,但发不出消息**
+
+先看日志里的状态:
+
+- 如果是 `bridge_connected` 或 `connecting`,说明本地 bridge 可达,但 WhatsApp 还没准备好。
+- 如果是 `qr_pending`,先扫码。
+- 如果是 `logged_out`,删除认证目录后重新扫码。
+- 只有 `open` 才允许真正发送。
+
+**App 提示 WhatsApp 未配置**
+
+- 确认 YAML 路径是 `channels.whatsapp`
+- 确认设置了 `enabled: true`
+- 确认 `bridge_ws_url` 不为空
+
+**模拟器扫码问题**
+
+和模拟器相机透传相比,直接用实体手机扫码通常更稳定。
\ No newline at end of file
diff --git "a/docs/zh/\351\242\221\351\201\223.md" "b/docs/zh/\351\242\221\351\201\223.md"
index 63e4e6c423..1477471f34 100644
--- "a/docs/zh/\351\242\221\351\201\223.md"
+++ "b/docs/zh/\351\242\221\351\201\223.md"
@@ -72,7 +72,19 @@ JiuwenSwarm 支持多种聊天平台频道接入,根据地域分为以下两
| 频道 | 说明 |
|------|------|
-| [Telegram](国外频道.md#telegram) | 国外即时通讯工具,支持私聊和群聊 |
-| [Discord](国外频道.md#discord) | 游戏社区平台,支持私聊和群聊 |
+| [Telegram](海外频道.md#telegram) | 国外即时通讯工具,支持私聊和群聊 |
+| [Discord](海外频道.md#discord) | 游戏社区平台,支持私聊和群聊 |
+| [WhatsApp](海外频道.md#whatsapp) | 个人即时通讯工具,支持私聊 |
-详细配置说明请参考:[国外频道](国外频道.md)
\ No newline at end of file
+详细配置说明请参考:[海外频道](海外频道.md)
+
+---
+
+## Coding 接入方式
+
+除了上述面向终端用户的聊天平台频道外,JiuwenSwarm 还提供面向开发者的接入方式:
+
+| 接入方式 | 说明 |
+|----------|------|
+| [ACP 插件使用](ACP插件使用.md) | 通过 ACP 协议接入 JiuwenSwarm,适合自定义集成 |
+| [TUI 使用指南](TUI使用指南.md) | 在终端中使用 JiuwenSwarm 的命令行交互界面 |
\ No newline at end of file