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:
14
auth/utils.ts
Normal file
14
auth/utils.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* @file utils.ts
|
||||
* @description 认证模块共享工具函数
|
||||
*/
|
||||
|
||||
/** 安全嵌套取值 */
|
||||
export const nested = (obj: unknown, ...keys: string[]): unknown => {
|
||||
let current = obj;
|
||||
for (const key of keys) {
|
||||
if (current == null || typeof current !== "object") return undefined;
|
||||
current = (current as Record<string, unknown>)[key];
|
||||
}
|
||||
return current;
|
||||
};
|
||||
Reference in New Issue
Block a user