Skip to content

Add PantheonClaw integration#41

Merged
Nanguage merged 3 commits intomainfrom
claw
Mar 23, 2026
Merged

Add PantheonClaw integration#41
Nanguage merged 3 commits intomainfrom
claw

Conversation

@Starlitnightly
Copy link
Collaborator

feat: PantheonClaw gateway integration

Introduces PantheonClaw, a multi-channel mobile gateway layer that routes
messages from Slack, Telegram, Discord, WeChat, Feishu, QQ, and iMessage
into Pantheon's existing chatroom and agent runtime.

New module: pantheon/claw/

  • bridge.pyChatRoomGatewayBridge maps incoming gateway sessions to
    Pantheon chat rooms and streams agent responses back to the originating channel
  • manager.pyGatewayChannelManager starts/stops each channel in its own
    daemon thread, maintains per-channel log buffers, and exposes state for the UI
  • registry.pyClawRouteRegistry tracks active ConversationRoute mappings
  • runtime.py — shared ChannelRuntime base with queuing, dedup, and
    chunk/step callback helpers
  • config.pyClawConfigStore with masked-value serialization for secrets
  • channels/ — full implementations for Slack, Telegram, Discord, WeChat,
    Feishu, QQ, and iMessage

WeChat QR login

  • manager.py exposes wechat_get_login_qr() and wechat_poll_login_status()
  • room.py adds @tool methods wechat_login_qr and wechat_login_status
    using asyncio.to_thread() to avoid blocking the agent event loop

Feishu WebSocket fix

  • lark_oapi/ws/client.py captures asyncio.get_event_loop() at module-import
    time as a module-level global. When the module is first imported inside
    asyncio.run(), that variable holds the already-running loop, causing every
    subsequent loop.run_until_complete() call to raise
    "This event loop is already running"
  • Fix: ws_client creation (including EventDispatcherHandler.builder and
    lark.ws.Client) is moved inside run_ws(), a plain daemon thread with no
    running event loop. Before calling start(), the module-level loop variable
    is overwritten with asyncio.new_event_loop() so lark_oapi gets a fresh loop
    it can call run_until_complete() on
  • Stop path calls asyncio.run(ws_client._disconnect()) for clean teardown,
    matching the reference implementation in OmicClaw

Other

  • Added optional dependency group claw in pyproject.toml
  • Updated Dockerfile and docs to reference the new group
  • Added tests/test_claw_gateway.py

Starlitnightly and others added 3 commits March 23, 2026 03:02
- Introduced a new optional dependency group 'claw' for PantheonClaw mobile gateway channels.
- Updated installation instructions in README and documentation to reflect the new 'claw' group.
- Modified Dockerfile and development environment to use 'claw' instead of 'slack'.
- Added gateway channel management functionality in ChatRoom class, including methods for configuration, session management, and logging.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
…ndling

- Moved WebSocket client creation to a separate thread to avoid asyncio event loop issues.
- Enhanced error handling during WebSocket connection and logging integration.
- Updated the way configuration parameters are retrieved for better readability.
- Ensured proper cleanup of resources when stopping the WebSocket client.
- Eliminated the custom logging handler for Lark SDK to streamline logging.
- Adjusted WebSocket client cleanup process by removing the handler during shutdown.
- Improved code readability by reducing unnecessary complexity in logging setup.
@Nanguage Nanguage merged commit 902b696 into main Mar 23, 2026
7 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants