Commit Graph
8 Commits
Author SHA1 Message Date
openbot e22dc9c1ee fix(wecom-ws): EOF raises ConnectionError to trigger reconnect; close() hardened
- recv(): connection EOF now raises instead of returning None — the channel
  outer loop treats it as disconnect and runs backoff reconnect
- close(): best-effort with timeouts, no hang when loop already dead
- tests: fake aibot gateway (subscribe/reply/heartbeat), auth-failure path
  45 passed
2026-10-06 16:15:54 +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 86642e07c9 test(channels): IM three-channel e2e wiring tests + final-text accumulation
- test_channels_e2e.py: full loop per channel
  (inbound -> SessionManager.prompt -> mock ACP agent -> events -> outbound):
  * wecom aibot: text dispatch -> delta frames -> replyStream final;
    image base64 inbound
  * wecom-app: real local HTTP callback server + real WXBizMsgCrypt
    (GET echo verify + POST encrypted XML) -> stubbed qyapi send
  * weixin: QR login -> long-poll inbound -> sendmessage outbound
- session.py fix: accumulate delta text per turn; 'final' event now carries
  full text so no-edit-API channels (wecom-app/weixin) deliver whole message
- wecom.py: buffer outbound frames when not connected (testability)
- tests: 43 passed
2026-10-06 11:51:04 +08:00
openbot 3598358293 feat(session): M1 session manager — binding table, /switch, reaper, sqlite
- (channel, chat_id) -> {agent, acp_session_id} binding table
- prompt(): auto-create binding, per-chat turn serialization, image blocks
- switch(): /switch semantics; --continue migrates hub-side text ONLY
  (tool state does not migrate, documented)
- update relay: ACP session/update -> delta/thinking/tool_start/tool_end/
  plan/final events via per-binding event sink
- cwd whitelist per agent (fnmatch, ~ expanded, realpath)
- idle reaper: expire bindings after idle_ttl_s, close unbound processes;
  max_sessions cap with LRU eviction
- sqlite persistence (bindings + session_records) — DB is fact source,
  config.json only bootstrap
- process death: client+binding dropped, SessionError surfaced
- tests: 39 passed (mock ACP agent subprocess)
2026-10-06 11:45:19 +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
openbot 33d8ac3046 test: fix ndjson partial-tail truncation point 2026-10-06 11:07:14 +08:00
openbot 82c3763e5c M0: framing (ndjson + lsp-frame), ACPClient, mock agent fixture, probe script; real claude-code-acp handshake verified 2026-10-06 11:05:40 +08:00
openbot 951fada34b init: project skeleton + design docs (ACP bridge) 2026-10-06 09:59:08 +08:00