@honor-claw/yoyo 1.2.0 → 1.2.1-beta.1
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/index.ts +2 -1
- package/package.json +2 -3
- package/skills/yoyo-control/SKILL.md +12 -2
- package/skills/yoyo-control/references/airplane-mode.md +197 -0
- package/skills/yoyo-control/references/capture-screenshot.md +28 -20
- package/skills/yoyo-control/references/clean-dirty.md +163 -0
- package/skills/yoyo-control/references/express-logistics-search.md +172 -0
- package/skills/yoyo-control/references/flashlight.md +183 -0
- package/skills/yoyo-control/references/flight-monitor-create.md +233 -0
- package/skills/yoyo-control/references/flight-monitor-search.md +229 -0
- package/skills/yoyo-control/references/scan-code.md +161 -0
- package/skills/yoyo-control/references/wlan.md +93 -24
- package/skills/yoyo-control/scripts/time_infer.py +99 -0
- package/src/commands/logout/impl.ts +0 -7
- package/src/honor-auth/callback-server.ts +30 -7
- package/src/honor-auth/token-manager.ts +3 -11
- package/src/modules/configs/identity-persist.ts +3 -43
- package/src/modules/device/device-info.ts +4 -14
- package/src/modules/device/identity.ts +6 -18
- package/src/modules/device/providers/base.ts +0 -5
- package/src/modules/device/providers/linux.ts +0 -55
- package/src/modules/device/providers/macos.ts +0 -66
- package/src/modules/device/providers/pad.ts +1 -20
- package/src/modules/device/providers/windows.ts +1 -25
- package/src/modules/login/impl.ts +1 -14
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import os from "os";
|
|
2
2
|
import * as Registry from "winreg";
|
|
3
3
|
import type { DeviceType } from "../../../types.js";
|
|
4
|
-
import { uuid } from "../../../utils/id.js";
|
|
5
4
|
import type { DeviceInfoProvider } from "./base.js";
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* 设备信息缓存
|
|
9
8
|
*/
|
|
10
9
|
interface DeviceInfoCache {
|
|
11
|
-
deviceId: string;
|
|
12
10
|
deviceBrand: string;
|
|
13
11
|
}
|
|
14
12
|
|
|
@@ -67,7 +65,6 @@ function registryKeyExistsAsync(hive: number, keyPath: string): Promise<boolean>
|
|
|
67
65
|
|
|
68
66
|
export class WindowsDeviceInfoProvider implements DeviceInfoProvider {
|
|
69
67
|
private cache: DeviceInfoCache = {
|
|
70
|
-
deviceId: "",
|
|
71
68
|
deviceBrand: "",
|
|
72
69
|
};
|
|
73
70
|
|
|
@@ -90,13 +87,8 @@ export class WindowsDeviceInfoProvider implements DeviceInfoProvider {
|
|
|
90
87
|
private async _initializeCache(): Promise<void> {
|
|
91
88
|
try {
|
|
92
89
|
// 并行获取所有注册表值
|
|
93
|
-
const [
|
|
90
|
+
const [systemManufacturer, biosVendor, biosVendor2, systemManufacturer2] =
|
|
94
91
|
await Promise.all([
|
|
95
|
-
getRegistryStringValueAsync(
|
|
96
|
-
Registry.HKLM,
|
|
97
|
-
"\\SOFTWARE\\Microsoft\\Cryptography",
|
|
98
|
-
"MachineGuid",
|
|
99
|
-
),
|
|
100
92
|
// 原有路径
|
|
101
93
|
getRegistryStringValueAsync(
|
|
102
94
|
Registry.HKLM,
|
|
@@ -121,13 +113,6 @@ export class WindowsDeviceInfoProvider implements DeviceInfoProvider {
|
|
|
121
113
|
),
|
|
122
114
|
]);
|
|
123
115
|
|
|
124
|
-
// 缓存 deviceId
|
|
125
|
-
if (machineGuid) {
|
|
126
|
-
this.cache.deviceId = machineGuid;
|
|
127
|
-
} else {
|
|
128
|
-
this.cache.deviceId = uuid();
|
|
129
|
-
}
|
|
130
|
-
|
|
131
116
|
// 缓存 deviceBrand(检查多个来源)
|
|
132
117
|
const manufacturerSources = [
|
|
133
118
|
systemManufacturer,
|
|
@@ -150,7 +135,6 @@ export class WindowsDeviceInfoProvider implements DeviceInfoProvider {
|
|
|
150
135
|
}
|
|
151
136
|
} catch {
|
|
152
137
|
// 初始化失败,使用默认值
|
|
153
|
-
this.cache.deviceId = uuid();
|
|
154
138
|
this.cache.deviceBrand = "";
|
|
155
139
|
}
|
|
156
140
|
}
|
|
@@ -172,14 +156,6 @@ export class WindowsDeviceInfoProvider implements DeviceInfoProvider {
|
|
|
172
156
|
return `${hostname} (${model})`;
|
|
173
157
|
}
|
|
174
158
|
|
|
175
|
-
/**
|
|
176
|
-
* 获取设备唯一 ID(异步)
|
|
177
|
-
*/
|
|
178
|
-
async getDeviceIdAsync(): Promise<string> {
|
|
179
|
-
await this.initPromise;
|
|
180
|
-
return this.cache.deviceId;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
159
|
/**
|
|
184
160
|
* 获取设备名称
|
|
185
161
|
*/
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
* 登录命令行的入口,提供登录流程的服务
|
|
3
3
|
*/
|
|
4
4
|
import { performOAuth2AuthWithBrowser } from "../../honor-auth/index.js";
|
|
5
|
-
import {
|
|
5
|
+
import { saveToken } from "../../honor-auth/token-manager.js";
|
|
6
6
|
import type { HonorUserInfo } from "../../types.js";
|
|
7
7
|
import { useClawLogger } from "../../utils/logger.js";
|
|
8
|
-
import { upgradeIdentityToV2 } from "../configs/identity-persist.js";
|
|
9
8
|
import { getDeviceInfo, registerDevice } from "../device/index.js";
|
|
10
9
|
|
|
11
10
|
/**
|
|
@@ -33,18 +32,6 @@ export async function performLogin(options: LoginOptions = {}) {
|
|
|
33
32
|
try {
|
|
34
33
|
logger.debug?.("Starting login process...");
|
|
35
34
|
|
|
36
|
-
// 检查是否是新的登录触发(没有 token)
|
|
37
|
-
const existingToken = await loadToken();
|
|
38
|
-
const isNewLogin = !existingToken?.token;
|
|
39
|
-
|
|
40
|
-
if (isNewLogin) {
|
|
41
|
-
logger.debug?.("New login detected, upgrading identity to v2...");
|
|
42
|
-
const upgraded = await upgradeIdentityToV2();
|
|
43
|
-
if (upgraded) {
|
|
44
|
-
logger.info("Identity upgraded from v1 to v2 during login");
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
35
|
// 步骤 1: 获取设备信息
|
|
49
36
|
const deviceInfo = await getDeviceInfo();
|
|
50
37
|
|