@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.
- package/index.ts +25 -25
- package/package.json +5 -5
- package/src/apis/claw-cloud.ts +124 -124
- package/src/apis/helpers.ts +10 -10
- package/src/apis/honor-auth.ts +158 -158
- package/src/apis/http-client.ts +239 -239
- package/src/apis/index.ts +8 -8
- package/src/apis/types.ts +77 -73
- package/src/cloud-channel/channel.ts +117 -117
- package/src/cloud-channel/client.ts +3 -3
- package/src/cloud-channel/index.ts +4 -4
- package/src/cloud-channel/message-handler.ts +50 -42
- package/src/cloud-channel/session-manager.ts +14 -9
- package/src/cloud-channel/types.ts +115 -115
- package/src/commands/env/impl.ts +58 -58
- package/src/commands/env/index.ts +1 -1
- package/src/commands/index.ts +30 -30
- package/src/commands/login/impl.ts +30 -30
- package/src/commands/login/index.ts +1 -1
- package/src/commands/logout/index.ts +1 -1
- package/src/commands/status/index.ts +194 -194
- package/src/gateway-client/client.ts +90 -90
- package/src/gateway-client/device/auth.ts +57 -57
- package/src/gateway-client/device/builder.ts +105 -105
- package/src/gateway-client/device/helpers.ts +40 -40
- package/src/gateway-client/device/identity.ts +251 -251
- package/src/gateway-client/device/index.ts +40 -40
- package/src/gateway-client/device/types.ts +57 -57
- package/src/gateway-client/index.ts +5 -5
- package/src/gateway-client/protocol-client.ts +49 -34
- package/src/honor-auth/browser.ts +2 -2
- package/src/honor-auth/callback-server.ts +109 -109
- package/src/honor-auth/cloud.ts +57 -57
- package/src/honor-auth/config.ts +43 -43
- package/src/honor-auth/index.ts +3 -3
- package/src/honor-auth/token-manager.ts +90 -90
- package/src/honor-auth/types.ts +50 -50
- package/src/index.ts +10 -10
- package/src/modules/claw-configs/config-manager.ts +409 -409
- package/src/modules/claw-configs/hosts.ts +48 -48
- package/src/modules/claw-configs/index.ts +8 -8
- package/src/modules/claw-configs/provider.ts +394 -394
- package/src/modules/claw-configs/types.ts +34 -34
- package/src/modules/device/device-info.ts +1 -1
- package/src/modules/device/index.ts +3 -3
- package/src/modules/device/providers/base.ts +32 -32
- package/src/modules/device/providers/pad.ts +107 -107
- package/src/modules/device/providers/windows.ts +130 -130
- package/src/modules/device/registry.ts +48 -43
- package/src/modules/login/impl.ts +31 -26
- package/src/modules/login/index.ts +6 -6
- package/src/schemas.ts +23 -23
- package/src/services/connection/impl.ts +339 -339
- package/src/services/connection/status-tracker/events.ts +127 -127
- package/src/services/connection/status-tracker/index.ts +31 -31
- package/src/services/connection/status-tracker/storage.ts +133 -133
- package/src/services/connection/status-tracker/tracker.ts +370 -370
- package/src/services/connection/status-tracker/types.ts +131 -131
- package/src/services/connection/types.ts +20 -20
- package/src/types.ts +64 -64
- package/src/utils/id.ts +8 -8
- package/src/utils/jwt.ts +37 -37
- package/src/utils/logger.ts +20 -20
- package/src/utils/proxy.ts +58 -58
- package/src/utils/version.ts +29 -29
- package/src/utils/ws.ts +21 -21
|
@@ -1,115 +1,115 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WebSocket 消息类型定义
|
|
3
|
-
*/
|
|
4
|
-
import {
|
|
5
|
-
ClawDeviceInfo,
|
|
6
|
-
DeviceInfo,
|
|
7
|
-
HonorUserInfo,
|
|
8
|
-
type DeviceRole,
|
|
9
|
-
} from "../types.js";
|
|
10
|
-
|
|
11
|
-
// 导入状态事件类型(可选导入,避免循环依赖)
|
|
12
|
-
export type { StatusEvent } from "../services/connection/status-tracker/events.js";
|
|
13
|
-
|
|
14
|
-
export interface YoyoClawMessage {
|
|
15
|
-
sourceRole?: DeviceRole;
|
|
16
|
-
sourceDeviceId: string;
|
|
17
|
-
sourceDeviceInfo?: ClawDeviceInfo;
|
|
18
|
-
targetRole?: DeviceRole;
|
|
19
|
-
targetDeviceId: string;
|
|
20
|
-
port: number | string;
|
|
21
|
-
data?: string;
|
|
22
|
-
msgType: "userMessage" | "devicePairMessage" | "fetchContexts" | "updateContexts";
|
|
23
|
-
/**
|
|
24
|
-
* 会话轮次等追加信息,只有配对消息有
|
|
25
|
-
*/
|
|
26
|
-
sessionInfo?: {
|
|
27
|
-
nodeConnectTimestamp: number;
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* 上下文信息
|
|
31
|
-
*/
|
|
32
|
-
contexts?: Array<{ header: { name: string, namespace: string }, payload: Record<string, any> }>
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* YOYO_CLAW_100000
|
|
37
|
-
成功
|
|
38
|
-
YOYO_CLAW_100001
|
|
39
|
-
设备未注册
|
|
40
|
-
YOYO_CLAW_100002
|
|
41
|
-
目标设备离线
|
|
42
|
-
YOYO_CLAW_100003
|
|
43
|
-
未配对
|
|
44
|
-
YOYO_CLAW_100004
|
|
45
|
-
参数不合法
|
|
46
|
-
YOYO_CLAW_100005
|
|
47
|
-
yoyoclaw内部错误
|
|
48
|
-
*/
|
|
49
|
-
export interface YoyoClawSocketWrapper<T> {
|
|
50
|
-
code: string;
|
|
51
|
-
cnMessage: string;
|
|
52
|
-
wsOutputEvent: T;
|
|
53
|
-
/**
|
|
54
|
-
* 对端未注册情况,需要带上离线id
|
|
55
|
-
*/
|
|
56
|
-
extData?: {
|
|
57
|
-
offlineSocketId?: string;
|
|
58
|
-
};
|
|
59
|
-
/**
|
|
60
|
-
* 会话轮次等追加信息,只有配对消息有
|
|
61
|
-
*/
|
|
62
|
-
sessionInfo?: {
|
|
63
|
-
nodeConnectTimestamp: number;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* 通道消息有一层wrapper
|
|
69
|
-
*/
|
|
70
|
-
export type YoyoClawSocketMessage = YoyoClawSocketWrapper<YoyoClawMessage>;
|
|
71
|
-
|
|
72
|
-
export interface ClawChannelConfig {
|
|
73
|
-
deviceInfo: DeviceInfo;
|
|
74
|
-
userInfo: HonorUserInfo;
|
|
75
|
-
onOpen?: () => void;
|
|
76
|
-
onClose?: () => void;
|
|
77
|
-
// 当前设备未注册回调
|
|
78
|
-
onDeviceNotRegistered?: () => void;
|
|
79
|
-
// 状态事件回调(用于状态跟踪)
|
|
80
|
-
onStatusEvent?: (event: any) => void;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export interface ClawSocketSourceInfo {
|
|
84
|
-
sourceRole: string;
|
|
85
|
-
sourceDeviceId: string;
|
|
86
|
-
sourceDeviceInfo?: ClawDeviceInfo;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export interface ClawSocketClientOptions {
|
|
90
|
-
serverUrl: string;
|
|
91
|
-
port?: number;
|
|
92
|
-
deviceInfo: DeviceInfo;
|
|
93
|
-
userInfo: HonorUserInfo;
|
|
94
|
-
onMessage?: (message: YoyoClawMessage) => void;
|
|
95
|
-
// 不关心实际参数和原因
|
|
96
|
-
onOpen?: () => void;
|
|
97
|
-
onClose?: () => void;
|
|
98
|
-
// 对向设备离线回调
|
|
99
|
-
onRemoteDeviceOffline?: (sourceDeviceId: string) => void;
|
|
100
|
-
// 当前设备未注册回调
|
|
101
|
-
onDeviceNotRegistered?: () => void;
|
|
102
|
-
// 额外的请求头
|
|
103
|
-
extraHeaders?: Record<string, string>;
|
|
104
|
-
// 状态事件回调(用于状态跟踪)
|
|
105
|
-
onStatusEvent?: (event: any) => void;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* 设备会话信息
|
|
110
|
-
*/
|
|
111
|
-
export interface DeviceSessionInfo {
|
|
112
|
-
sessionId: string;
|
|
113
|
-
timestamp: number;
|
|
114
|
-
sourceInfo: ClawSocketSourceInfo;
|
|
115
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* WebSocket 消息类型定义
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
ClawDeviceInfo,
|
|
6
|
+
DeviceInfo,
|
|
7
|
+
HonorUserInfo,
|
|
8
|
+
type DeviceRole,
|
|
9
|
+
} from "../types.js";
|
|
10
|
+
|
|
11
|
+
// 导入状态事件类型(可选导入,避免循环依赖)
|
|
12
|
+
export type { StatusEvent } from "../services/connection/status-tracker/events.js";
|
|
13
|
+
|
|
14
|
+
export interface YoyoClawMessage {
|
|
15
|
+
sourceRole?: DeviceRole;
|
|
16
|
+
sourceDeviceId: string;
|
|
17
|
+
sourceDeviceInfo?: ClawDeviceInfo;
|
|
18
|
+
targetRole?: DeviceRole;
|
|
19
|
+
targetDeviceId: string;
|
|
20
|
+
port: number | string;
|
|
21
|
+
data?: string;
|
|
22
|
+
msgType: "userMessage" | "devicePairMessage" | "fetchContexts" | "updateContexts";
|
|
23
|
+
/**
|
|
24
|
+
* 会话轮次等追加信息,只有配对消息有
|
|
25
|
+
*/
|
|
26
|
+
sessionInfo?: {
|
|
27
|
+
nodeConnectTimestamp: number;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* 上下文信息
|
|
31
|
+
*/
|
|
32
|
+
contexts?: Array<{ header: { name: string, namespace: string }, payload: Record<string, any> }>
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* YOYO_CLAW_100000
|
|
37
|
+
成功
|
|
38
|
+
YOYO_CLAW_100001
|
|
39
|
+
设备未注册
|
|
40
|
+
YOYO_CLAW_100002
|
|
41
|
+
目标设备离线
|
|
42
|
+
YOYO_CLAW_100003
|
|
43
|
+
未配对
|
|
44
|
+
YOYO_CLAW_100004
|
|
45
|
+
参数不合法
|
|
46
|
+
YOYO_CLAW_100005
|
|
47
|
+
yoyoclaw内部错误
|
|
48
|
+
*/
|
|
49
|
+
export interface YoyoClawSocketWrapper<T> {
|
|
50
|
+
code: string;
|
|
51
|
+
cnMessage: string;
|
|
52
|
+
wsOutputEvent: T;
|
|
53
|
+
/**
|
|
54
|
+
* 对端未注册情况,需要带上离线id
|
|
55
|
+
*/
|
|
56
|
+
extData?: {
|
|
57
|
+
offlineSocketId?: string;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* 会话轮次等追加信息,只有配对消息有
|
|
61
|
+
*/
|
|
62
|
+
sessionInfo?: {
|
|
63
|
+
nodeConnectTimestamp: number;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* 通道消息有一层wrapper
|
|
69
|
+
*/
|
|
70
|
+
export type YoyoClawSocketMessage = YoyoClawSocketWrapper<YoyoClawMessage>;
|
|
71
|
+
|
|
72
|
+
export interface ClawChannelConfig {
|
|
73
|
+
deviceInfo: DeviceInfo;
|
|
74
|
+
userInfo: HonorUserInfo;
|
|
75
|
+
onOpen?: () => void;
|
|
76
|
+
onClose?: () => void;
|
|
77
|
+
// 当前设备未注册回调
|
|
78
|
+
onDeviceNotRegistered?: () => void;
|
|
79
|
+
// 状态事件回调(用于状态跟踪)
|
|
80
|
+
onStatusEvent?: (event: any) => void;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface ClawSocketSourceInfo {
|
|
84
|
+
sourceRole: string;
|
|
85
|
+
sourceDeviceId: string;
|
|
86
|
+
sourceDeviceInfo?: ClawDeviceInfo;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export interface ClawSocketClientOptions {
|
|
90
|
+
serverUrl: string;
|
|
91
|
+
port?: number;
|
|
92
|
+
deviceInfo: DeviceInfo;
|
|
93
|
+
userInfo: HonorUserInfo;
|
|
94
|
+
onMessage?: (message: YoyoClawMessage) => void;
|
|
95
|
+
// 不关心实际参数和原因
|
|
96
|
+
onOpen?: () => void;
|
|
97
|
+
onClose?: () => void;
|
|
98
|
+
// 对向设备离线回调
|
|
99
|
+
onRemoteDeviceOffline?: (sourceDeviceId: string) => void;
|
|
100
|
+
// 当前设备未注册回调
|
|
101
|
+
onDeviceNotRegistered?: () => void;
|
|
102
|
+
// 额外的请求头
|
|
103
|
+
extraHeaders?: Record<string, string>;
|
|
104
|
+
// 状态事件回调(用于状态跟踪)
|
|
105
|
+
onStatusEvent?: (event: any) => void;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* 设备会话信息
|
|
110
|
+
*/
|
|
111
|
+
export interface DeviceSessionInfo {
|
|
112
|
+
sessionId: string;
|
|
113
|
+
timestamp: number;
|
|
114
|
+
sourceInfo: ClawSocketSourceInfo;
|
|
115
|
+
}
|
package/src/commands/env/impl.ts
CHANGED
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
import { getConfigManager } from "../../modules/claw-configs/config-manager.js";
|
|
2
|
-
import { useClawLogger } from "../../utils/logger.js";
|
|
3
|
-
import type { Command } from "commander";
|
|
4
|
-
|
|
5
|
-
export function registerEnvCommand(_: unknown, command: Command) {
|
|
6
|
-
const nextCommand = command
|
|
7
|
-
.command("env")
|
|
8
|
-
.description("Manage runtime environment (dev/test/production)")
|
|
9
|
-
.option("--set <env>", "Set environment: dev, test or production")
|
|
10
|
-
.option("--gray <tag>", "Set gray header")
|
|
11
|
-
.action(async (options) => {
|
|
12
|
-
const { set: setEnv, gray: grayTag } = options;
|
|
13
|
-
const logger = useClawLogger();
|
|
14
|
-
|
|
15
|
-
try {
|
|
16
|
-
const configManager = getConfigManager();
|
|
17
|
-
|
|
18
|
-
if (setEnv) {
|
|
19
|
-
// 设置环境
|
|
20
|
-
if (setEnv !== "test" && setEnv !== "dev" && setEnv !== "production") {
|
|
21
|
-
logger.error("❌ Invalid environment. Use 'test' or 'production'.");
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
await configManager.updateEnv(setEnv);
|
|
26
|
-
logger.info(`✅ Environment set to: ${setEnv}`);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
if (grayTag) {
|
|
30
|
-
// 设置灰度标签
|
|
31
|
-
await configManager.updateGrayTag(grayTag);
|
|
32
|
-
logger.info(`✅ Gray tag set to: ${grayTag}`);
|
|
33
|
-
} else if (grayTag === '') {
|
|
34
|
-
// 清除灰度标签
|
|
35
|
-
await configManager.updateGrayTag(undefined);
|
|
36
|
-
logger.info(`✅ Gray tag cleared`);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (!setEnv && grayTag === undefined) {
|
|
40
|
-
// 获取当前环境信息
|
|
41
|
-
const currentEnv = configManager.getEnv();
|
|
42
|
-
const currentGrayTag = configManager.getGrayTag();
|
|
43
|
-
|
|
44
|
-
logger.info(`📋 Current environment: ${currentEnv}`);
|
|
45
|
-
if (currentGrayTag) {
|
|
46
|
-
logger.info(`📋 Current gray tag: ${currentGrayTag}`);
|
|
47
|
-
} else {
|
|
48
|
-
logger.info(`📋 Gray tag: not set`);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
} catch (error) {
|
|
52
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
53
|
-
logger.error(`❌ Failed to manage environment: ${errorMessage}`);
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
return nextCommand;
|
|
58
|
-
}
|
|
1
|
+
import { getConfigManager } from "../../modules/claw-configs/config-manager.js";
|
|
2
|
+
import { useClawLogger } from "../../utils/logger.js";
|
|
3
|
+
import type { Command } from "commander";
|
|
4
|
+
|
|
5
|
+
export function registerEnvCommand(_: unknown, command: Command) {
|
|
6
|
+
const nextCommand = command
|
|
7
|
+
.command("env")
|
|
8
|
+
.description("Manage runtime environment (dev/test/production)")
|
|
9
|
+
.option("--set <env>", "Set environment: dev, test or production")
|
|
10
|
+
.option("--gray <tag>", "Set gray header")
|
|
11
|
+
.action(async (options) => {
|
|
12
|
+
const { set: setEnv, gray: grayTag } = options;
|
|
13
|
+
const logger = useClawLogger();
|
|
14
|
+
|
|
15
|
+
try {
|
|
16
|
+
const configManager = getConfigManager();
|
|
17
|
+
|
|
18
|
+
if (setEnv) {
|
|
19
|
+
// 设置环境
|
|
20
|
+
if (setEnv !== "test" && setEnv !== "dev" && setEnv !== "production") {
|
|
21
|
+
logger.error("❌ Invalid environment. Use 'test' or 'production'.");
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
await configManager.updateEnv(setEnv);
|
|
26
|
+
logger.info(`✅ Environment set to: ${setEnv}`);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (grayTag) {
|
|
30
|
+
// 设置灰度标签
|
|
31
|
+
await configManager.updateGrayTag(grayTag);
|
|
32
|
+
logger.info(`✅ Gray tag set to: ${grayTag}`);
|
|
33
|
+
} else if (grayTag === '') {
|
|
34
|
+
// 清除灰度标签
|
|
35
|
+
await configManager.updateGrayTag(undefined);
|
|
36
|
+
logger.info(`✅ Gray tag cleared`);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (!setEnv && grayTag === undefined) {
|
|
40
|
+
// 获取当前环境信息
|
|
41
|
+
const currentEnv = configManager.getEnv();
|
|
42
|
+
const currentGrayTag = configManager.getGrayTag();
|
|
43
|
+
|
|
44
|
+
logger.info(`📋 Current environment: ${currentEnv}`);
|
|
45
|
+
if (currentGrayTag) {
|
|
46
|
+
logger.info(`📋 Current gray tag: ${currentGrayTag}`);
|
|
47
|
+
} else {
|
|
48
|
+
logger.info(`📋 Gray tag: not set`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
} catch (error) {
|
|
52
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
53
|
+
logger.error(`❌ Failed to manage environment: ${errorMessage}`);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
return nextCommand;
|
|
58
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './impl.js';
|
|
1
|
+
export * from './impl.js';
|
package/src/commands/index.ts
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { type OpenClawPluginApi } from "openclaw/plugin-sdk";
|
|
2
|
-
import { registerLoginCommand } from "./login/index.js";
|
|
3
|
-
import { registerStatusCommand } from "./status/index.js";
|
|
4
|
-
import { registerLogoutCommand } from "./logout/index.js";
|
|
5
|
-
import { registerEnvCommand } from "./env/index.js";
|
|
6
|
-
import { isBetaVersion } from "../utils/version.js";
|
|
7
|
-
|
|
8
|
-
export function registerCommands(api: OpenClawPluginApi) {
|
|
9
|
-
api.registerCli(
|
|
10
|
-
(ctx) => {
|
|
11
|
-
const rootCommand = ctx.program
|
|
12
|
-
.command("honor")
|
|
13
|
-
.description("Commands for honor yoyoclaw");
|
|
14
|
-
|
|
15
|
-
// @ts-ignore
|
|
16
|
-
registerLoginCommand(api, rootCommand);
|
|
17
|
-
// @ts-ignore
|
|
18
|
-
registerStatusCommand(api, rootCommand);
|
|
19
|
-
// @ts-ignore
|
|
20
|
-
registerLogoutCommand(api, rootCommand);
|
|
21
|
-
|
|
22
|
-
// 只在 beta 版本时注册 env 命令
|
|
23
|
-
if (isBetaVersion()) {
|
|
24
|
-
// @ts-ignore
|
|
25
|
-
registerEnvCommand(api, rootCommand);
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
{ commands: ["honor"] }
|
|
29
|
-
);
|
|
30
|
-
}
|
|
1
|
+
import { type OpenClawPluginApi } from "openclaw/plugin-sdk";
|
|
2
|
+
import { registerLoginCommand } from "./login/index.js";
|
|
3
|
+
import { registerStatusCommand } from "./status/index.js";
|
|
4
|
+
import { registerLogoutCommand } from "./logout/index.js";
|
|
5
|
+
import { registerEnvCommand } from "./env/index.js";
|
|
6
|
+
import { isBetaVersion } from "../utils/version.js";
|
|
7
|
+
|
|
8
|
+
export function registerCommands(api: OpenClawPluginApi) {
|
|
9
|
+
api.registerCli(
|
|
10
|
+
(ctx) => {
|
|
11
|
+
const rootCommand = ctx.program
|
|
12
|
+
.command("honor")
|
|
13
|
+
.description("Commands for honor yoyoclaw");
|
|
14
|
+
|
|
15
|
+
// @ts-ignore
|
|
16
|
+
registerLoginCommand(api, rootCommand);
|
|
17
|
+
// @ts-ignore
|
|
18
|
+
registerStatusCommand(api, rootCommand);
|
|
19
|
+
// @ts-ignore
|
|
20
|
+
registerLogoutCommand(api, rootCommand);
|
|
21
|
+
|
|
22
|
+
// 只在 beta 版本时注册 env 命令
|
|
23
|
+
if (isBetaVersion()) {
|
|
24
|
+
// @ts-ignore
|
|
25
|
+
registerEnvCommand(api, rootCommand);
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
{ commands: ["honor"] }
|
|
29
|
+
);
|
|
30
|
+
}
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { type OpenClawPluginApi } from "openclaw/plugin-sdk";
|
|
2
|
-
import { performLogin } from "../../modules/login/impl.js";
|
|
3
|
-
import { type Command } from "commander";
|
|
4
|
-
import { isBetaVersion } from "../../utils/version.js";
|
|
5
|
-
|
|
6
|
-
export function registerLoginCommand(api: OpenClawPluginApi, command: Command) {
|
|
7
|
-
let nextCommand = command
|
|
8
|
-
.command("login")
|
|
9
|
-
.description("login to yoyoclaw and register devices");
|
|
10
|
-
|
|
11
|
-
if (isBetaVersion()) {
|
|
12
|
-
nextCommand = nextCommand.option(
|
|
13
|
-
"--skip-auth",
|
|
14
|
-
"debug mode, no auth required"
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
nextCommand = nextCommand
|
|
19
|
-
.option("-u, --
|
|
20
|
-
.option("--token <token>", "token for direct login")
|
|
21
|
-
.action(async (options) => {
|
|
22
|
-
const {
|
|
23
|
-
|
|
24
|
-
api.logger.debug?.('honor login CLI command called');
|
|
25
|
-
|
|
26
|
-
await performLogin({ noAuth: skipAuth
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
return nextCommand;
|
|
30
|
-
}
|
|
1
|
+
import { type OpenClawPluginApi } from "openclaw/plugin-sdk";
|
|
2
|
+
import { performLogin } from "../../modules/login/impl.js";
|
|
3
|
+
import { type Command } from "commander";
|
|
4
|
+
import { isBetaVersion } from "../../utils/version.js";
|
|
5
|
+
|
|
6
|
+
export function registerLoginCommand(api: OpenClawPluginApi, command: Command) {
|
|
7
|
+
let nextCommand = command
|
|
8
|
+
.command("login")
|
|
9
|
+
.description("login to yoyoclaw and register devices");
|
|
10
|
+
|
|
11
|
+
if (isBetaVersion()) {
|
|
12
|
+
nextCommand = nextCommand.option(
|
|
13
|
+
"--skip-auth",
|
|
14
|
+
"debug mode, no auth required"
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
nextCommand = nextCommand
|
|
19
|
+
.option("-u, --uid <userId>", "user ID for direct login")
|
|
20
|
+
.option("--token <token>", "token for direct login")
|
|
21
|
+
.action(async (options) => {
|
|
22
|
+
const { uid: userId, token, skipAuth } = options;
|
|
23
|
+
|
|
24
|
+
api.logger.debug?.('honor login CLI command called');
|
|
25
|
+
|
|
26
|
+
await performLogin({ userId, token, noAuth: skipAuth });
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
return nextCommand;
|
|
30
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./impl.js";
|
|
1
|
+
export * from "./impl.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./impl.js";
|
|
1
|
+
export * from "./impl.js";
|