Files
AgentsMeeting/gateway/docs/通用架构-WeChat opencode 桥接.md
hmo 1b2b935832 Initial: multi-agent XMPP communication system with dashboard
- Platform-based architecture (Windows/Linux/Mac)
- Agent instance registry (agents.yaml)
- Management dashboard with cross-platform monitoring
- xmpp_bot with HTTP bridge + health endpoints
- wechat_agent with WeChat-Hermes bridging
- Platform services: ProcessGuardian, HealthProbe, APIRouter, ChannelBridge
- Deployment: systemd (Linux) + PowerShell (Windows)
- Monitoring: SSH+ejabberdctl for cross-platform presence
2026-06-12 21:51:36 +08:00

120 lines
8.2 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 𡁶鍂嚗阳eChat ?opencode 獢交𦻖
> 2026-05-20
> 亦氖 Hermes AI 靘肽遣蝡?opencode serve 銝𤾸凝靽∟揭𡁶鍂𡁻
---
##
敺桐縑箏膥鈭箸𧋦韐冽糓銝憟烾𡁶鍂航楝梁頂蝏
```
敺桐縑 wxhelper 獢交𦻖隞 隞颱 AI / 蝔见
```
**銝滚霂交糓"怨㭘銝枏"**齿沲 Hermes API 蝖祉銁獢交𦻖銝哨𣂼𡁶鍂?
---
## 撖寞
### 敶枏峕㦤嚗?
```
雿惩凝靽??wxhelper TCP ?wechat_agent ?Hermes API (:8642, Linux) ?怨㭘𧼮
? 瘨頝舐眏蝖祉𢆡 agent
```
### 𡁶鍂嚗𣬚滲 Windows嚗?
```
雿惩凝靽??wxhelper TCP ?Bridge Agent opencode serve session (撠誩?
? HTTP API (:5801) 靘𥕢遙雿閧摨𤩺韐? ? serve 𣬚 AI / 憭㚚蝔见 POST 𧼮
```
**喲睸**嚗𡁏‘乩誨??AI 𡁜摰?嚗諹峕糓**銝剔𡁻**嚗?
| | 啁𠶖 (wechat_agent.py) | (Bridge Agent) |
|------|----------------------|-------------------|
| 敺桐縑瘨 | 湔𦻖 POST Hermes API | ** serve session + 𣂷 HTTP 瘨亙藁** |
| 瘨頝舐眏 | 蝖祉?(call_hermes) | 蘨韐蠘提頧砍 |
| AI | 航緒?(Hermes) | 臭誑?serve 𣬚隞颱鈭綽Sisyphus?..嚗?|
| 憭㚚鍂 | :5801 蝞𧢲𤣰瘨 | http API ?|
---
## 𡁶鍂?
```
𢞖?? Windows 192.168.1.16 ?? ?? 𢞖? ?? ?敺桐縑 3.9.10.19 箏膥鈭?? ?? ?(wxid_xxxxxxxxx) ? ?? ? ?? ?wxhelper TCP (:19099) ?? ?? ?wxhelper HTTP (:19088) ?? ?? ? ?? 𢞖? ?? ? Bridge Agent (bridge.py v3) ? ?? ? ? ?? ? 𢞖? ? ?? ? ?瘨?(TCP thread) ? ? ?? ? ?敺桐縑瘨 ? serve session ? ? opencode ?? ? ? ?閫血 webhook(? ?serve :4096 ?? ? ? ? ?? ? ? ?? ? 𢞖? ? ?? ? ?HTTP API 滚𦛚 (:5801) ? ? ?? ? ?POST /send ?穃凝靽? ? ? ?? ? ?POST /history ?? ? ? ?? ? ?POST /inject ??serve 隡朞 ? ? ?? ? ? ? ?? ? ?? ? ? ?? ? serve session 𣬚 AI ?HTTP POST /send ?? ? ? ?? 𢞖? ? ?? ? opencode serve TUI ? ? ?? ? (Sisyphus / 隞颱 Agent) ? ?? ? ? ?? ? 緒嚗帋憭拙𨧀 隞?session ? ?? ? 憭㵪[xxm] 𨧀 POST :5801 ? ?? ? ??```
---
## 唳旿瘚?
### 敺桐縑瘨 ?AI嚗銵䕘
```
1. 穃凝靽∠箏膥鈭箏噡
2. wxhelper DLL TCP (:19099) Bridge Agent
3. Bridge Agent ?serve session:
subprocess.run(["opencode", "run", "--attach",
"--message", "[緒] 瘨捆"])
4. 峕𧒄嚗峕臬虾 :5801 HTTP API 鋡思遙雿閗恥韐?5. serve session 𣬚 AI ?TUI session_search
```
### AI 𧼮 ?敺桐縑嚗銵䕘
```
1. AI 𧼮 ?POST http://localhost:5801/send
{"to": "wxid_xxx", "message": "𧼮捆"}
2. Bridge Agent ?wxpost /api/sendTextMsg
3. wxhelper DLL ??𧢲㦤
```
---
## Bridge Agent 亙藁閫
### HTTP API (:5801)
| | 頝臬 | ?| Body |
|------|------|------|------|
| POST | `/send` | 穃凝靽⊥?| `{"to":"wxid","message":"text"}` |
| POST | `/history` | 憭抵扇敶?| `{"wxid":"...","count":20}` |
| POST | `/recent` | 餈𤏸蝟颱犖 | ?|
| POST | `/inject` | ?serve session | `{"message":"[xxm] 捆"}` |
| GET | `/health` | 亙熒璉?| ?|
### 颲枏枂?serve session 聢撘?
```
[緒] 瘨?亥䌊敺桐縑𡁏?[緒|萇妍] 瘨?撣行猐蝘?[蝟餌] 蝟颱犖 xxx ?蝟餌鈭衤辣
[session:<id>] 臬𢆡蝑曉 ?Agent 銝羓瑪𡁶䰻
```
---
## 銝?Hermes AI 蝟?
Hermes 銝滚舀沲辣嚗諹峕糓嚗?
```
𢞖?opencode serve session ?Sisyphus (撠誩?
緒敺桐縑 ?Bridge ? ?瘨晶 HTTP API 摨? ? 𢞖? ? ? Hermes AI AI
(怨㭘) (芣䔉)
```
**餈停蝑𣇉裦**嚗?1. 蝚砌嗆挾嚗鋳ridge Agent 峕𧒄?serve session + POST Hermes API嚗
2. 蝚砌嗆挾嚗鋳ridge Agent serve session嚗峵ermes serve session
3. 蝚砌嗆挾嚗𡁜𡁶鍂Hermes 芣糓 serve session 𣬚銝?AI 閫坿𠧧
---
## 摰墧鴌
1. **銝滨聦讐緵厰曎頝?* ?Bridge Agent Hermes 瘨頝舐眏銝滚
2. **憓鮋宏** ?鞉郊踵揢
3. **session 銝箔蜓** ?臭誑 serve session 銝箔葉敹HTTP API 銝箄?4. **雿𦒘韏?* ?蝥?Windows 銵䕘銝漤閬?Linux 蝡?Hermes
---
## 撘暸䔮憸?
1. **session ID 蝞∠**嚗鋳ridge Agent 憒仿敶枏?session ID嚗?2. **session write **嚗窃ubprocess (`opencode run --attach --message`) 臬炏㗇凒頧駁𤜯隞
3. **瘨**嚗𡁜 session + POST Hermes 撖潸稲嚗?4. **serve 滚鍳**嚗鋳ridge Agent 憒?serve 滚鍳舘䌊餈痹
5. **蟮瘨**嚗鋫I 銝羓瑪?session 銝剖歇蟮嚗?
---
*projects/wechat-hermes-gateway/docs/緒瘨頝舐眏霈曇恣.md*