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

29
auth/environments.ts Normal file
View File

@@ -0,0 +1,29 @@
/**
* @file environments.ts
* @description QClaw 环境配置(生产/测试)
*/
import type { QClawEnvironment } from "./types.js";
const ENVIRONMENTS: Record<string, QClawEnvironment> = {
production: {
jprxGateway: "https://jprx.m.qq.com/",
qclawBaseUrl: "https://mmgrcalltoken.3g.qq.com/aizone/v1",
wxLoginRedirectUri: "https://security.guanjia.qq.com/login",
wechatWsUrl: "wss://mmgrcalltoken.3g.qq.com/agentwss",
wxAppId: "wx9d11056dd75b7240",
},
test: {
jprxGateway: "https://jprx.sparta.html5.qq.com/",
qclawBaseUrl: "https://jprx.sparta.html5.qq.com/aizone/v1",
wxLoginRedirectUri: "https://security-test.guanjia.qq.com/login",
wechatWsUrl: "wss://jprx.sparta.html5.qq.com/agentwss",
wxAppId: "wx3dd49afb7e2cf957",
},
};
export const getEnvironment = (name: string): QClawEnvironment => {
const env = ENVIRONMENTS[name];
if (!env) throw new Error(`未知环境: ${name},可选: ${Object.keys(ENVIRONMENTS).join(", ")}`);
return env;
};