@honor-claw/yoyo 1.1.2 → 1.1.4-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.
Files changed (66) hide show
  1. package/index.ts +25 -25
  2. package/package.json +5 -5
  3. package/src/apis/claw-cloud.ts +124 -124
  4. package/src/apis/helpers.ts +10 -10
  5. package/src/apis/honor-auth.ts +158 -158
  6. package/src/apis/http-client.ts +239 -239
  7. package/src/apis/index.ts +8 -8
  8. package/src/apis/types.ts +77 -73
  9. package/src/cloud-channel/channel.ts +117 -117
  10. package/src/cloud-channel/client.ts +3 -3
  11. package/src/cloud-channel/index.ts +4 -4
  12. package/src/cloud-channel/message-handler.ts +50 -42
  13. package/src/cloud-channel/session-manager.ts +14 -9
  14. package/src/cloud-channel/types.ts +115 -115
  15. package/src/commands/env/impl.ts +58 -58
  16. package/src/commands/env/index.ts +1 -1
  17. package/src/commands/index.ts +30 -30
  18. package/src/commands/login/impl.ts +30 -30
  19. package/src/commands/login/index.ts +1 -1
  20. package/src/commands/logout/index.ts +1 -1
  21. package/src/commands/status/index.ts +194 -194
  22. package/src/gateway-client/client.ts +90 -90
  23. package/src/gateway-client/device/auth.ts +57 -57
  24. package/src/gateway-client/device/builder.ts +105 -105
  25. package/src/gateway-client/device/helpers.ts +40 -40
  26. package/src/gateway-client/device/identity.ts +251 -251
  27. package/src/gateway-client/device/index.ts +40 -40
  28. package/src/gateway-client/device/types.ts +57 -57
  29. package/src/gateway-client/index.ts +5 -5
  30. package/src/gateway-client/protocol-client.ts +49 -34
  31. package/src/honor-auth/browser.ts +2 -2
  32. package/src/honor-auth/callback-server.ts +109 -109
  33. package/src/honor-auth/cloud.ts +57 -57
  34. package/src/honor-auth/config.ts +43 -43
  35. package/src/honor-auth/index.ts +3 -3
  36. package/src/honor-auth/token-manager.ts +90 -90
  37. package/src/honor-auth/types.ts +50 -50
  38. package/src/index.ts +10 -10
  39. package/src/modules/claw-configs/config-manager.ts +409 -409
  40. package/src/modules/claw-configs/hosts.ts +48 -48
  41. package/src/modules/claw-configs/index.ts +8 -8
  42. package/src/modules/claw-configs/provider.ts +394 -394
  43. package/src/modules/claw-configs/types.ts +34 -34
  44. package/src/modules/device/device-info.ts +1 -1
  45. package/src/modules/device/index.ts +3 -3
  46. package/src/modules/device/providers/base.ts +32 -32
  47. package/src/modules/device/providers/pad.ts +107 -107
  48. package/src/modules/device/providers/windows.ts +130 -130
  49. package/src/modules/device/registry.ts +48 -43
  50. package/src/modules/login/impl.ts +31 -26
  51. package/src/modules/login/index.ts +6 -6
  52. package/src/schemas.ts +23 -23
  53. package/src/services/connection/impl.ts +339 -339
  54. package/src/services/connection/status-tracker/events.ts +127 -127
  55. package/src/services/connection/status-tracker/index.ts +31 -31
  56. package/src/services/connection/status-tracker/storage.ts +133 -133
  57. package/src/services/connection/status-tracker/tracker.ts +370 -370
  58. package/src/services/connection/status-tracker/types.ts +131 -131
  59. package/src/services/connection/types.ts +20 -20
  60. package/src/types.ts +64 -64
  61. package/src/utils/id.ts +8 -8
  62. package/src/utils/jwt.ts +37 -37
  63. package/src/utils/logger.ts +20 -20
  64. package/src/utils/proxy.ts +58 -58
  65. package/src/utils/version.ts +29 -29
  66. package/src/utils/ws.ts +21 -21
@@ -1,29 +1,29 @@
1
- import { readFileSync } from "fs";
2
- import { fileURLToPath } from "url";
3
- import { dirname, join } from "path";
4
-
5
- let g_isBetaVersion: boolean | null = null;
6
-
7
- /**
8
- * 检查当前版本是否为 beta 版本
9
- */
10
- export function isBetaVersion(): boolean {
11
- if (g_isBetaVersion !== null) {
12
- return !!g_isBetaVersion;
13
- }
14
-
15
- try {
16
- const __filename = fileURLToPath(import.meta.url);
17
- const __dirname = dirname(__filename);
18
- const packagePath = join(__dirname, "../../package.json");
19
- const pkgContent = readFileSync(packagePath, "utf-8");
20
- const pkg = JSON.parse(pkgContent);
21
- const version = pkg.version || "";
22
-
23
- g_isBetaVersion = version.includes("beta");
24
- } catch (error) {
25
- console.error(`Failed to check version: ${error}`);
26
- }
27
-
28
- return !!g_isBetaVersion;
29
- }
1
+ import { readFileSync } from "fs";
2
+ import { fileURLToPath } from "url";
3
+ import { dirname, join } from "path";
4
+
5
+ let g_isBetaVersion: boolean | null = null;
6
+
7
+ /**
8
+ * 检查当前版本是否为 beta 版本
9
+ */
10
+ export function isBetaVersion(): boolean {
11
+ if (g_isBetaVersion !== null) {
12
+ return !!g_isBetaVersion;
13
+ }
14
+
15
+ try {
16
+ const __filename = fileURLToPath(import.meta.url);
17
+ const __dirname = dirname(__filename);
18
+ const packagePath = join(__dirname, "../../package.json");
19
+ const pkgContent = readFileSync(packagePath, "utf-8");
20
+ const pkg = JSON.parse(pkgContent);
21
+ const version = pkg.version || "";
22
+
23
+ g_isBetaVersion = version.includes("beta");
24
+ } catch (error) {
25
+ console.error(`Failed to check version: ${error}`);
26
+ }
27
+
28
+ return !!g_isBetaVersion;
29
+ }
package/src/utils/ws.ts CHANGED
@@ -1,21 +1,21 @@
1
- import { Buffer } from "node:buffer";
2
- import type WebSocket from "ws";
3
-
4
- export function rawDataToString(
5
- data: WebSocket.RawData,
6
- encoding: BufferEncoding = "utf8",
7
- ): string {
8
- if (typeof data === "string") {
9
- return data;
10
- }
11
- if (Buffer.isBuffer(data)) {
12
- return data.toString(encoding);
13
- }
14
- if (Array.isArray(data)) {
15
- return Buffer.concat(data).toString(encoding);
16
- }
17
- if (data instanceof ArrayBuffer) {
18
- return Buffer.from(data).toString(encoding);
19
- }
20
- return Buffer.from(String(data)).toString(encoding);
21
- }
1
+ import { Buffer } from "node:buffer";
2
+ import type WebSocket from "ws";
3
+
4
+ export function rawDataToString(
5
+ data: WebSocket.RawData,
6
+ encoding: BufferEncoding = "utf8",
7
+ ): string {
8
+ if (typeof data === "string") {
9
+ return data;
10
+ }
11
+ if (Buffer.isBuffer(data)) {
12
+ return data.toString(encoding);
13
+ }
14
+ if (Array.isArray(data)) {
15
+ return Buffer.concat(data).toString(encoding);
16
+ }
17
+ if (data instanceof ArrayBuffer) {
18
+ return Buffer.from(data).toString(encoding);
19
+ }
20
+ return Buffer.from(String(data)).toString(encoding);
21
+ }