@honor-claw/yoyo 1.1.4-beta.8 → 1.1.4-beta.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@honor-claw/yoyo",
3
- "version": "1.1.4-beta.8",
3
+ "version": "1.1.4-beta.9",
4
4
  "description": "OpenClaw Honor Yoyo connection plugin",
5
5
  "keywords": [
6
6
  "ai",
@@ -14,7 +14,7 @@ export async function performLogout(): Promise<void> {
14
14
  const configManager = getConfigManager();
15
15
  const userConfig = configManager.getUserConfig();
16
16
 
17
- if (!userConfig || !userConfig.token) {
17
+ if (!userConfig?.token) {
18
18
  console.log("⚠️ Not logged in");
19
19
  return;
20
20
  }
@@ -26,7 +26,7 @@ export async function saveToken(
26
26
 
27
27
  // 如果没有 jwtToken 但有 userId,通过 exchangeToken 获取
28
28
  if (!jwtToken && params.userId) {
29
- const deviceInfo = await getDeviceInfo();
29
+ const deviceInfo = params.deviceInfo || (await getDeviceInfo());
30
30
  const client = createClawCloudClient();
31
31
  const tokenInfo = await client.exchangeToken(deviceInfo, { userId: params.userId });
32
32
  jwtToken = tokenInfo.jwtToken;
@@ -2,6 +2,8 @@
2
2
  * 荣耀OAuth2认证相关类型定义
3
3
  */
4
4
 
5
+ import { DeviceInfo } from "../types.js";
6
+
5
7
  /**
6
8
  * 荣耀认证配置
7
9
  */
@@ -29,4 +31,5 @@ export interface HonorAuthConfig {
29
31
  export interface SaveTokenParams {
30
32
  userId?: string;
31
33
  jwtToken?: string;
34
+ deviceInfo?: DeviceInfo;
32
35
  }
@@ -54,6 +54,7 @@ export async function performLogin(options: LoginOptions = {}) {
54
54
  // 保存 Token,内部会基于userId换token
55
55
  userInfo = await saveToken({
56
56
  userId,
57
+ deviceInfo,
57
58
  });
58
59
  logger.debug?.("Using provided user info");
59
60
  logger.debug?.(`User: ${userId}`);