- 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)
30 lines
1009 B
TypeScript
30 lines
1009 B
TypeScript
/**
|
|
* @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;
|
|
};
|