OpenCode Bridge is an enterprise-grade AI programming collaboration bridge service that seamlessly integrates OpenCode (AI coding assistant) with mainstream instant messaging platforms, enabling cross-platform, cross-device intelligent programming collaboration.
| Platform | Status | Login Method |
|---|---|---|
| Feishu (Lark) | ✅ Full Support | Bot Application |
| Discord | ✅ Full Support | Bot Token |
| WeCom (Enterprise WeChat) | ✅ Full Support | Bot Application |
| Telegram | ✅ Full Support | Bot Token |
| QQ (OneBot) | ✅ Full Support | OneBot Protocol |
| ✅ Full Support | Phone Number Pairing | |
| WeChat (Personal) | ✅ Full Support | QR Code Login |
| DingTalk | ✅ Full Support | Bot Application |
| Feature | Feishu | Discord | WeCom | Telegram | DingTalk | |||
|---|---|---|---|---|---|---|---|---|
| Text Message | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Rich Media/Card | ✅ | ✅ | ❌ | ✅ | ❌ | ❌ | ❌ | ✅ |
| Streaming Output | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Permission Interaction | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| File Transfer | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ |
| Group Chat | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Private Chat | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Message Recall | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ |
- Independent Session Binding: Each group/private chat binds to an independent OpenCode session with isolated context
- Session Migration: Support session binding, migration, and renaming with context preserved across devices
- Multi-Project Support: Multiple project directory switching with alias configuration
- Auto Cleanup: Automatic cleanup of invalid sessions to prevent resource leaks
- Streaming Output: Real-time AI response display with thinking chain support
- Permission Interaction: AI permission requests confirmed within the chat platform
- Question Answering: AI questions answered within the chat platform
- File Transfer: AI can send files/screenshots to the chat platform
- Shell Passthrough: Whitelisted commands can be executed directly in chat
- Heartbeat Monitoring: Periodic OpenCode health probing
- Auto Rescue: Automatic restart and recovery when OpenCode crashes
- Cron Tasks: Runtime dynamic management of scheduled tasks
- Log Auditing: Complete operation logs and error tracking
- Visual Configuration: Real-time modification of all configuration parameters in browser
- Platform Management: View connection status of each platform
- Cron Management: Create, enable/disable, delete scheduled tasks
- Service Control: View service status and remote restart
git clone https://github.com/HNGM-HP/opencode-bridge.git
cd opencode-bridgeLinux/macOS:
chmod +x ./scripts/deploy.sh
./scripts/deploy.sh guideWindows PowerShell:
.\scripts\deploy.ps1 guideThis command will automatically:
- Detect and guide Node.js installation
- Detect and guide OpenCode installation
- Install project dependencies and compile
- Generate initial configuration file
Linux/macOS:
./scripts/start.shWindows PowerShell:
.\scripts\start.ps1Development Mode:
npm run devAfter service starts, access the Web configuration panel:
http://localhost:4098
You will be prompted to set an administrator password on first access.
The following commands are available on all platforms:
| Command | Description |
|---|---|
/help |
View help |
/status |
View current status |
/panel |
Display control panel |
/model |
View current model |
/model <name> |
Switch model |
/models |
List all available models |
/agent |
View current agent |
/agent <name> |
Switch agent |
/agents |
List all available agents |
/effort |
View current reasoning effort |
/effort <level> |
Set reasoning effort |
/session new |
Start new topic |
/sessions |
List sessions |
/undo |
Undo last interaction |
/stop |
Stop current response |
/compact |
Compress context |
/rename <name> |
Rename session |
/project list |
List available projects |
/clear |
Reset conversation context |
| Command | Description |
|---|---|
/send <path> |
Send file to group chat |
/cron ... |
Manage Cron tasks |
/commands |
Generate command list file |
/create_chat |
Show create group card in private chat |
!<shell-cmd> |
Passthrough Shell command (whitelist) |
//xxx |
Passthrough namespace command |
| Command | Description |
|---|---|
///session |
View bound session |
///new |
Create and bind new session |
///bind <sessionId> |
Bind existing session |
///undo |
Undo last round |
///compact |
Compress context |
///workdir |
Set working directory |
///cron ... |
Manage Cron tasks |
flowchart LR
%% Style definitions
classDef platform fill:#e1f5fe,stroke:#0288d1,stroke-width:2px,rx:8px
classDef core fill:#fff3e0,stroke:#f57c00,stroke-width:2px,rx:8px
classDef handler fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px,rx:8px
classDef opencode fill:#e8f5e9,stroke:#388e3c,stroke-width:2px,rx:8px
classDef external fill:#fce4ec,stroke:#c2185b,stroke-width:2px,rx:8px,stroke-dasharray:5 5
subgraph PlatformLayer["📱 Platform Adapter Layer"]
direction TB
feishu["✈️ Feishu"]:::platform
discord["🎮 Discord"]:::platform
wecom["💼 WeCom"]:::platform
telegram["📤 Telegram"]:::platform
qq["🐧 QQ"]:::platform
whatsapp["📞 WhatsApp"]:::platform
weixin["💬 WeChat"]:::platform
dingtalk["📌 DingTalk"]:::platform
end
subgraph CoreLayer["⚙️ Core Processing Layer"]
direction TB
router["🔀 Router Center<br/><b>RootRouter</b>"]:::core
subgraph Handlers["Handler Modules"]
direction LR
permission["🔐 Permission Handler"]:::handler
question["❓ Q&A Handler"]:::handler
output["📤 Output Buffer"]:::handler
end
end
subgraph IntegrationLayer["🔗 Integration Layer"]
sdk["🔌 OpenCode SDK<br/><b>OpencodeClient</b>"]:::opencode
end
subgraph External["🌐 External Services"]
opencode["🤖 OpenCode Service"]:::external
cli["💻 OpenCode CLI"]:::external
end
%% Connections
PlatformLayer --> router
router --> Handlers
Handlers --> sdk
sdk --> opencode
opencode -.-> cli
Architecture Description:
| Layer | Responsibility | Key Components |
|---|---|---|
| 📱 Platform Adapter Layer | Receive messages from each platform, unified format conversion | 8 Platform Adapters |
| ⚙️ Core Processing Layer | Message routing, permission validation, business processing | RootRouter, Permission, Question, Output |
| 🔗 Integration Layer | Communicate with OpenCode, send/receive requests | OpencodeClient SDK |
| 🌐 External Services | Actual AI service and CLI tools | OpenCode Service, CLI |
| Document | Description |
|---|---|
| Architecture | Project layered design and core module responsibilities |
| Configuration | Complete configuration parameter reference |
| Deployment | Deployment, upgrade and systemd configuration |
| Commands | Complete command list and usage |
| Reliability | Heartbeat, Cron and crash rescue configuration |
| Troubleshooting | Common issues and solutions |
| Document | Description |
|---|---|
| Feishu Config | Feishu event subscription and permission configuration |
| Discord Config | Discord bot configuration guide |
| WeCom Config | Enterprise WeChat bot configuration guide |
| Telegram Config | Telegram Bot configuration guide |
| QQ Config | QQ Official/OneBot protocol configuration guide |
| WhatsApp Config | WhatsApp Personal/Business configuration guide |
| WeChat Personal Config | WeChat personal account configuration guide |
| DingTalk Config | DingTalk bot Stream mode configuration guide |
| Document | Description |
|---|---|
| Agent Usage | Role configuration and custom Agent |
| Implementation | Key feature implementation details |
| SDK API | OpenCode SDK integration guide |
| Workspace Guide | Working directory strategy and project configuration |
| Rollout | Router mode rollout and rollback |
- Node.js: >= 18.0.0
- Operating System: Linux / macOS / Windows
- OpenCode: Must be installed and running
| Method | Description |
|---|---|
| Web Panel (Recommended) | Access http://localhost:4098 for visual configuration |
| SQLite Database | Configuration stored in data/config.db |
| .env File | Only stores Admin panel startup parameters |
| Option | Default | Description |
|---|---|---|
FEISHU_ENABLED |
false |
Enable Feishu adapter |
DISCORD_ENABLED |
false |
Enable Discord adapter |
OPENCODE_HOST |
localhost |
OpenCode host address |
OPENCODE_PORT |
4096 |
OpenCode port |
ADMIN_PORT |
4098 |
Web configuration panel port |
For complete configuration parameters, refer to the Configuration Center Documentation.
This project is licensed under GNU General Public License v3.0
GPL v3 means:
- ✅ Free to use, modify and distribute
- ✅ Can be used for commercial purposes
- ✅ Must open source modified versions
- ✅ Must retain original author copyright
- ✅ Derivative works must use GPL v3 license
If this project helps you, please give it a Star!
For issues or suggestions, feel free to submit an Issue or Pull Request.
- GitHub Issues: Report Issues
- Project Home: GitHub Repository