feat: add WeChat QR code login and AGP WebSocket channel plugin

- Auth module: WeChat OAuth2 scan-to-login flow with terminal QR code
- Token persistence to ~/.openclaw/wechat-access-auth.json (chmod 600)
- Token resolution: config > saved state > interactive login
- Invite code verification (configurable bypass)
- Production/test environment support
- AGP WebSocket client with heartbeat, reconnect, wake detection
- Message handler: Agent dispatch with streaming text and tool calls
- Random device GUID generation (persisted, no real machine ID)
This commit is contained in:
HenryXiaoYang
2026-03-10 02:29:06 +08:00
commit ba754ccc31
33 changed files with 14992 additions and 0 deletions

40
websocket/index.ts Normal file
View File

@@ -0,0 +1,40 @@
// ============================================
// WebSocket 模块导出
// ============================================
// 类型定义
export type {
AGPEnvelope,
AGPMethod,
ContentBlock,
ToolCall,
ToolCallKind,
ToolCallStatus,
ToolLocation,
PromptPayload,
CancelPayload,
UpdatePayload,
UpdateType,
PromptResponsePayload,
StopReason,
PromptMessage,
CancelMessage,
UpdateMessage,
PromptResponseMessage,
WebSocketClientConfig,
ConnectionState,
WebSocketClientCallbacks,
} from "./types.js";
// WebSocket 客户端
export { WechatAccessWebSocketClient } from "./websocket-client.js";
// 消息处理器
export { handlePrompt, handleCancel } from "./message-handler.js";
// 消息适配器
export {
extractTextFromContent,
promptPayloadToFuwuhaoMessage,
buildWebSocketMessageContext,
} from "./message-adapter.js";