openbot
59c44e94ca
fix(wecom): degrade stream replies to proactive msg when callback req_id stale
...
Turns that outlive the WeCom callback req_id window (e.g. approval
round-trips >5min) had their delta/finish frames silently rejected by
the gateway, so the user saw 'clicked approve, nothing happened' while
the agent kept working. Track req_id recv time; past a 240s TTL, stream
updates fall back to proactive aibot_send_msg. Also log non-zero
errcode ack frames so future gateway rejections are visible.
2026-10-24 09:18:19 +08:00
openbot
bbe36be192
feat(wecom): official aibot long-connection protocol + real WS transport
...
- wecom_ws.py: AibotWSAdapter (asyncio websockets bridged to channel threads):
connect wss://openws.work.weixin.qq.com, aibot_subscribe auth, 30s ping
heartbeat, reader->queue, graceful shutdown
- wecom.py switched to official frames:
* inbound aibot_msg_callback / aibot_event_callback (enter_chat -> welcome)
* reply: aibot_respond_msg stream {id, finish, content} reusing the
callback's req_id; after finish, proactive aibot_send_msg markdown
* image inbound: {url, aeskey} fetch + AES-256-CBC (IV=key[:16], PKCS7)
* mixed (text+image) and voice (transcribed) message types
- tests updated to official frame shapes; 43 passed
2026-10-06 16:06:49 +08:00
openbot
d698ae8a60
feat(channels): add wecom / wecom-app / weixin IM channels (M1.5)
...
- base.py: IMChannel protocol + InboundMessage + shared helpers
(split_message_text utf-8 byte-safe, clean_control_chars ZWSP hygiene)
- editable_stream.py: create-edit-flush streaming fallback pattern
- wecom.py: aibot WebSocket long-connection (replyStream streaming,
allowlist, reconnect backoff, auth-failure terminal)
- wecom_app.py: self-built app HTTP callback (stdlib server, WXBizMsgCrypt
AES-CBC round-trip, access_token cache, media download; works in both
WeCom client and WeChat via WeChat-plugin, no streaming on this path)
- weixin.py: WeChat bot QR login + getupdates long-poll + sendmessage
- tests: 28 passed (mock transports, crypt roundtrip, stream coalesce)
Ported from dsh-im (xmanrui) protocol facts and resilience patterns.
2026-10-06 11:33:07 +08:00