@workclaw/cli 1.0.331 → 1.0.332
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/dist/box/constants/model.d.ts +1 -1
- package/dist/box/constants/model.d.ts.map +1 -1
- package/dist/box/installer/installer.d.ts.map +1 -1
- package/dist/box/src/box.d.ts.map +1 -1
- package/dist/box/types/index.d.ts +1 -1
- package/dist/{index-b2rw2uLv.js → index-BEgrVqZz.js} +75 -97
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -1
- package/dist/local/apis/http.d.ts.map +1 -0
- package/dist/local/apis/index.d.ts +1 -1
- package/dist/local/apis/index.d.ts.map +1 -1
- package/dist/local/constants/model.d.ts +1 -1
- package/dist/local/constants/model.d.ts.map +1 -1
- package/dist/local/installer/installer.d.ts.map +1 -1
- package/dist/local/src/local.d.ts.map +1 -1
- package/dist/local/types/index.d.ts +1 -1
- package/dist/local/utils/index.d.ts +0 -1
- package/dist/local/utils/index.d.ts.map +1 -1
- package/dist/shared/utils/index.d.ts +2 -1
- package/dist/shared/utils/index.d.ts.map +1 -1
- package/dist/shared/utils/object.d.ts +18 -0
- package/dist/shared/utils/object.d.ts.map +1 -0
- package/dist/shared/utils/path.d.ts +5 -0
- package/dist/shared/utils/path.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/box/utils/index.d.ts +0 -2
- package/dist/box/utils/index.d.ts.map +0 -1
- package/dist/box/utils/path.d.ts +0 -2
- package/dist/box/utils/path.d.ts.map +0 -1
- package/dist/command/index.d.ts +0 -3
- package/dist/command/index.d.ts.map +0 -1
- package/dist/command/src/base-command.d.ts +0 -12
- package/dist/command/src/base-command.d.ts.map +0 -1
- package/dist/command/types/index.d.ts +0 -14
- package/dist/command/types/index.d.ts.map +0 -1
- package/dist/lib/command/base-command.d.ts +0 -16
- package/dist/lib/command/base-command.d.ts.map +0 -1
- package/dist/lib/index.d.ts +0 -2
- package/dist/lib/index.d.ts.map +0 -1
- package/dist/local/utils/path.d.ts +0 -2
- package/dist/local/utils/path.d.ts.map +0 -1
- package/dist/utils/config-default.d.ts +0 -28
- package/dist/utils/config-default.d.ts.map +0 -1
- package/dist/utils/config.d.ts +0 -28
- package/dist/utils/config.d.ts.map +0 -1
- package/dist/utils/crypto.d.ts +0 -13
- package/dist/utils/crypto.d.ts.map +0 -1
- package/dist/utils/error.d.ts +0 -36
- package/dist/utils/error.d.ts.map +0 -1
- package/dist/utils/http.d.ts.map +0 -1
- package/dist/utils/index.d.ts +0 -7
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/logger.d.ts +0 -16
- package/dist/utils/logger.d.ts.map +0 -1
- /package/dist/{utils → local/apis}/http.d.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/box/constants/model.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,sEAKnB,CAAA;AAEV,MAAM,MAAM,SAAS,GAAG,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAA;AAEvD,eAAO,MAAM,aAAa,EAAE,SAAwB,CAAA;AAEpD,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,SAAS,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAKxE,CAAA;AAED,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/box/constants/model.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,sEAKnB,CAAA;AAEV,MAAM,MAAM,SAAS,GAAG,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAA;AAEvD,eAAO,MAAM,aAAa,EAAE,SAAwB,CAAA;AAEpD,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,SAAS,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAKxE,CAAA;AAED,eAAO,MAAM,gBAAgB,WAAW,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installer.d.ts","sourceRoot":"","sources":["../../../src/box/installer/installer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAgB,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"installer.d.ts","sourceRoot":"","sources":["../../../src/box/installer/installer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAgB,MAAM,UAAU,CAAA;AA4BhE,qBAAa,YAAY;IAIX,OAAO,CAAC,MAAM;IAH1B,OAAO,CAAC,OAAO,CAAK;IACpB,OAAO,CAAC,UAAU,CAAa;gBAEX,MAAM,EAAE,kBAAkB;IAI9C,cAAc,IAAI,IAAI;IAyBtB,OAAO,CAAC,QAAQ;IAoChB,OAAO,CAAC,aAAa;IAMrB,aAAa,IAAI,MAAM;IAIvB,OAAO,CAAC,cAAc;IAOhB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;YA0BhB,eAAe;YA0Bf,iBAAiB;YAoHjB,cAAc;CA8R7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"box.d.ts","sourceRoot":"","sources":["../../../src/box/src/box.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAU1C;;;GAGG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"box.d.ts","sourceRoot":"","sources":["../../../src/box/src/box.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAU1C;;;GAGG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAoLzE"}
|
|
@@ -35,8 +35,8 @@ export declare const BoxInstallerConfigSchema: z.ZodObject<{
|
|
|
35
35
|
"gpt-5-mini": "gpt-5-mini";
|
|
36
36
|
}>>>;
|
|
37
37
|
mergeMode: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
38
|
-
merge: "merge";
|
|
39
38
|
replace: "replace";
|
|
39
|
+
merge: "merge";
|
|
40
40
|
"reset-keys": "reset-keys";
|
|
41
41
|
}>>>;
|
|
42
42
|
}, z.core.$strip>;
|
|
@@ -13,7 +13,7 @@ import { z as z$1 } from "zod";
|
|
|
13
13
|
import fs from "node:fs/promises";
|
|
14
14
|
import ora from "ora";
|
|
15
15
|
import tar from "tar";
|
|
16
|
-
import axios from "axios";
|
|
16
|
+
import axios, { AxiosError } from "axios";
|
|
17
17
|
import crypto from "node:crypto";
|
|
18
18
|
import os from "node:os";
|
|
19
19
|
const debug = new Debug();
|
|
@@ -59,6 +59,36 @@ function checkEnv() {
|
|
|
59
59
|
throw new AppError$1(ERROR_CODES$1.NPM_NOT_FOUND, "未检测到 npm,请先安装 Node.js 和 npm");
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
+
function getObjectHash(obj) {
|
|
63
|
+
return JSON.stringify(obj, Object.keys(obj).sort());
|
|
64
|
+
}
|
|
65
|
+
function deepMerge(target, source) {
|
|
66
|
+
const result = { ...target };
|
|
67
|
+
for (const key in source) {
|
|
68
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
69
|
+
const sourceValue = source[key];
|
|
70
|
+
const targetValue = target[key];
|
|
71
|
+
if (Array.isArray(sourceValue) && Array.isArray(targetValue)) {
|
|
72
|
+
if (targetValue.length > 0 && typeof targetValue[0] === "object" && targetValue[0] !== null) {
|
|
73
|
+
const existingHashes = new Set(targetValue.map((item) => getObjectHash(item)));
|
|
74
|
+
const newItems = sourceValue.filter((item) => !existingHashes.has(getObjectHash(item)));
|
|
75
|
+
result[key] = [...targetValue, ...newItems];
|
|
76
|
+
} else {
|
|
77
|
+
const mergedArray = [.../* @__PURE__ */ new Set([...targetValue, ...sourceValue])];
|
|
78
|
+
result[key] = mergedArray;
|
|
79
|
+
}
|
|
80
|
+
} else if (sourceValue !== void 0 && sourceValue !== null && typeof sourceValue === "object" && !Array.isArray(sourceValue) && typeof targetValue === "object" && targetValue !== null && !Array.isArray(targetValue)) {
|
|
81
|
+
result[key] = deepMerge(
|
|
82
|
+
targetValue,
|
|
83
|
+
sourceValue
|
|
84
|
+
);
|
|
85
|
+
} else if (sourceValue !== void 0) {
|
|
86
|
+
result[key] = sourceValue;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return result;
|
|
91
|
+
}
|
|
62
92
|
const EnvironmentSchema = z$1.enum(["test", "prod", "custom"], {
|
|
63
93
|
message: "环境类型必须是 test、prod 或 custom"
|
|
64
94
|
});
|
|
@@ -97,6 +127,9 @@ const wsUrlSchema = z$1.string().url({
|
|
|
97
127
|
message: "请输入有效的 WebSocket URL"
|
|
98
128
|
}).optional();
|
|
99
129
|
z$1.boolean();
|
|
130
|
+
function getHomeDir() {
|
|
131
|
+
return process$1.env.HOME || process$1.env.USERPROFILE || "";
|
|
132
|
+
}
|
|
100
133
|
function cleanWindowsLongPath(inputPath) {
|
|
101
134
|
return inputPath.replace(/^[\\?]+/, "");
|
|
102
135
|
}
|
|
@@ -190,9 +223,6 @@ class AppError2 extends Error {
|
|
|
190
223
|
this.name = "AppError";
|
|
191
224
|
}
|
|
192
225
|
}
|
|
193
|
-
function getHomeDir$1() {
|
|
194
|
-
return process$1.env.HOME || process$1.env.USERPROFILE || "";
|
|
195
|
-
}
|
|
196
226
|
const SUPPORTED_MODELS = [
|
|
197
227
|
"gpt-4.1-mini",
|
|
198
228
|
"gpt-4o-mini",
|
|
@@ -206,7 +236,7 @@ const MODEL_ID_MAP = {
|
|
|
206
236
|
"gpt-5-chat": { id: "gpt-5-chat", name: "GPT-5-Chat" },
|
|
207
237
|
"gpt-5-mini": { id: "gpt-5-mini", name: "GPT-5-Mini" }
|
|
208
238
|
};
|
|
209
|
-
const DEFAULT_PROVIDER$1 = "
|
|
239
|
+
const DEFAULT_PROVIDER$1 = "mingto";
|
|
210
240
|
const MODEL_GENERAL_CONFIG$1 = {
|
|
211
241
|
reasoning: false,
|
|
212
242
|
input: ["text"],
|
|
@@ -226,36 +256,6 @@ function execAsync$1(command, options) {
|
|
|
226
256
|
});
|
|
227
257
|
});
|
|
228
258
|
}
|
|
229
|
-
function getObjectHash$1(obj) {
|
|
230
|
-
return JSON.stringify(obj, Object.keys(obj).sort());
|
|
231
|
-
}
|
|
232
|
-
function deepMerge$1(target, source) {
|
|
233
|
-
const result = { ...target };
|
|
234
|
-
for (const key in source) {
|
|
235
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
236
|
-
const sourceValue = source[key];
|
|
237
|
-
const targetValue = target[key];
|
|
238
|
-
if (Array.isArray(sourceValue) && Array.isArray(targetValue)) {
|
|
239
|
-
if (targetValue.length > 0 && typeof targetValue[0] === "object" && targetValue[0] !== null) {
|
|
240
|
-
const existingHashes = new Set(targetValue.map((item) => getObjectHash$1(item)));
|
|
241
|
-
const newItems = sourceValue.filter((item) => !existingHashes.has(getObjectHash$1(item)));
|
|
242
|
-
result[key] = [...targetValue, ...newItems];
|
|
243
|
-
} else {
|
|
244
|
-
const mergedArray = [.../* @__PURE__ */ new Set([...targetValue, ...sourceValue])];
|
|
245
|
-
result[key] = mergedArray;
|
|
246
|
-
}
|
|
247
|
-
} else if (sourceValue !== void 0 && sourceValue !== null && typeof sourceValue === "object" && !Array.isArray(sourceValue) && typeof targetValue === "object" && targetValue !== null && !Array.isArray(targetValue)) {
|
|
248
|
-
result[key] = deepMerge$1(
|
|
249
|
-
targetValue,
|
|
250
|
-
sourceValue
|
|
251
|
-
);
|
|
252
|
-
} else if (sourceValue !== void 0) {
|
|
253
|
-
result[key] = sourceValue;
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
return result;
|
|
258
|
-
}
|
|
259
259
|
class BoxInstaller {
|
|
260
260
|
constructor(config) {
|
|
261
261
|
this.config = config;
|
|
@@ -299,7 +299,7 @@ class BoxInstaller {
|
|
|
299
299
|
}
|
|
300
300
|
baseDir = normalizePath(this.config.openclawPath);
|
|
301
301
|
} else {
|
|
302
|
-
const home = getHomeDir
|
|
302
|
+
const home = getHomeDir();
|
|
303
303
|
baseDir = path.join(home, config.DIRS.OPENCLAW);
|
|
304
304
|
}
|
|
305
305
|
const extensionsDir = path.join(baseDir, config.DIRS.EXTENSIONS);
|
|
@@ -408,7 +408,7 @@ class BoxInstaller {
|
|
|
408
408
|
debug.log(`[下载插件] tarball 下载成功: ${tarballPath}`);
|
|
409
409
|
break;
|
|
410
410
|
} catch (error) {
|
|
411
|
-
lastError = error.message
|
|
411
|
+
lastError = error instanceof Error ? error.message : "未知错误";
|
|
412
412
|
debug.log(`[下载插件] 第 ${i} 次尝试失败: ${lastError}`);
|
|
413
413
|
if (i < maxRetries) {
|
|
414
414
|
this.spinner.text = chalk.cyan(`下载失败,3秒后重试...`);
|
|
@@ -451,7 +451,7 @@ class BoxInstaller {
|
|
|
451
451
|
});
|
|
452
452
|
debug.log("[下载插件] npm install 执行成功");
|
|
453
453
|
} catch (error) {
|
|
454
|
-
const errorMsg = error.message
|
|
454
|
+
const errorMsg = error instanceof Error ? error.message : "";
|
|
455
455
|
if (errorMsg.includes("npm warn") || errorMsg.includes("deprecated")) {
|
|
456
456
|
debug.log("[下载插件] npm install 有警告但可能成功,继续流程");
|
|
457
457
|
} else {
|
|
@@ -497,7 +497,8 @@ class BoxInstaller {
|
|
|
497
497
|
debug.log("[更新配置] 合并模式: merge(完整保留原有配置后合并)");
|
|
498
498
|
}
|
|
499
499
|
const config = getConfig(this.config.env || "test", this.config.customIp);
|
|
500
|
-
const
|
|
500
|
+
const model = this.config.model ?? DEFAULT_MODEL;
|
|
501
|
+
const modelInfo = MODEL_ID_MAP[model];
|
|
501
502
|
const newConfig = {
|
|
502
503
|
// diagnostics: 诊断配置
|
|
503
504
|
diagnostics: {
|
|
@@ -718,7 +719,7 @@ class BoxInstaller {
|
|
|
718
719
|
}
|
|
719
720
|
}
|
|
720
721
|
};
|
|
721
|
-
const finalConfig = deepMerge
|
|
722
|
+
const finalConfig = deepMerge(originalConfig, newConfig);
|
|
722
723
|
this.updateSpinner("正在写入配置...");
|
|
723
724
|
debug.log("[更新配置] 合并配置并写入文件(保留其他初始化数据)...");
|
|
724
725
|
await fs.writeFile(paths.config, JSON.stringify(finalConfig, null, 2), "utf-8");
|
|
@@ -839,6 +840,9 @@ async function createBoxCommand(options) {
|
|
|
839
840
|
debug.log(`[盒子安装] 使用命令行参数: customIp=${customIp}`);
|
|
840
841
|
}
|
|
841
842
|
const mergeMode = options.mergeMode || "merge";
|
|
843
|
+
if (!appKey || !appSecret) {
|
|
844
|
+
throw new Error("AppKey 和 AppSecret 不能为空");
|
|
845
|
+
}
|
|
842
846
|
debug.log(`[盒子安装] 最终参数: env=${env}, customIp=${customIp}, openclawPath=${options.openclawPath}, model=${model}, mergeMode=${mergeMode}`);
|
|
843
847
|
debug.log("[盒子安装] 创建 BoxInstaller 实例...");
|
|
844
848
|
const installer = new BoxInstaller({
|
|
@@ -910,28 +914,32 @@ async function httpPost(url, data, config) {
|
|
|
910
914
|
data: response.data
|
|
911
915
|
};
|
|
912
916
|
} catch (error) {
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
917
|
+
if (error instanceof AxiosError) {
|
|
918
|
+
if (error.response) {
|
|
919
|
+
const responseData = error.response.data;
|
|
920
|
+
debug.log(`[HTTP POST] 响应状态: ${error.response.status}`);
|
|
921
|
+
debug.log(`[HTTP POST] 响应状态文本: ${error.response.statusText}`);
|
|
922
|
+
debug.log(`[HTTP POST] 响应数据: ${JSON.stringify(responseData)}`);
|
|
923
|
+
if (typeof responseData === "string") {
|
|
924
|
+
throw new AppError$1(ERROR_CODES$1.HTTP_ERROR, `请求失败 (${error.response.status}): ${responseData}`);
|
|
925
|
+
} else if (responseData && typeof responseData === "object" && "message" in responseData) {
|
|
926
|
+
throw new AppError$1(ERROR_CODES$1.HTTP_ERROR, `请求失败 (${error.response.status}): ${responseData.message}`);
|
|
927
|
+
} else {
|
|
928
|
+
throw new AppError$1(ERROR_CODES$1.HTTP_ERROR, `请求失败 (${error.response.status}): ${error.response.statusText}`);
|
|
929
|
+
}
|
|
930
|
+
} else if (error.request) {
|
|
931
|
+
debug.log(`[HTTP POST] 未收到响应`);
|
|
932
|
+
debug.log(`[HTTP POST] 错误信息: ${error.message}`);
|
|
933
|
+
throw new AppError$1(ERROR_CODES$1.NETWORK_ERROR, `网络错误: ${error.message}`);
|
|
923
934
|
} else {
|
|
924
|
-
|
|
935
|
+
debug.log(`[HTTP POST] 请求配置错误`);
|
|
936
|
+
debug.log(`[HTTP POST] 错误信息: ${error.message}`);
|
|
937
|
+
throw new AppError$1(ERROR_CODES$1.HTTP_ERROR, `请求配置错误: ${error.message}`);
|
|
925
938
|
}
|
|
926
|
-
} else if (axiosError.request) {
|
|
927
|
-
debug.log(`[HTTP POST] 未收到响应`);
|
|
928
|
-
debug.log(`[HTTP POST] 错误信息: ${axiosError.message}`);
|
|
929
|
-
throw new AppError$1(ERROR_CODES$1.NETWORK_ERROR, `网络错误: ${axiosError.message}`);
|
|
930
|
-
} else {
|
|
931
|
-
debug.log(`[HTTP POST] 请求配置错误`);
|
|
932
|
-
debug.log(`[HTTP POST] 错误信息: ${axiosError.message}`);
|
|
933
|
-
throw new AppError$1(ERROR_CODES$1.HTTP_ERROR, `请求配置错误: ${axiosError.message}`);
|
|
934
939
|
}
|
|
940
|
+
const errorMsg = error instanceof Error ? error.message : "未知错误";
|
|
941
|
+
debug.log(`[HTTP POST] 未知错误: ${errorMsg}`);
|
|
942
|
+
throw new AppError$1(ERROR_CODES$1.HTTP_ERROR, `请求失败: ${errorMsg}`);
|
|
935
943
|
}
|
|
936
944
|
}
|
|
937
945
|
async function login(phone, password, config) {
|
|
@@ -979,10 +987,10 @@ async function fetchBoundConfig(token, phone, localCode, config) {
|
|
|
979
987
|
debug.log(`[获取绑定配置] 响应数据: ${JSON.stringify(data)}`);
|
|
980
988
|
if (data.code === 200 && data.data) {
|
|
981
989
|
const boundConfig = {
|
|
982
|
-
appKey: data.data.app_key,
|
|
983
|
-
appSecret: data.data.app_secret,
|
|
990
|
+
appKey: data.data.app_key ?? "",
|
|
991
|
+
appSecret: data.data.app_secret ?? "",
|
|
984
992
|
userId: data.data.user_id,
|
|
985
|
-
agentId: data.data.agent_id
|
|
993
|
+
agentId: data.data.agent_id ?? data.data.agents?.[0]?.id ?? "",
|
|
986
994
|
modelApiKey: data.data.model_api_key,
|
|
987
995
|
modelApiBaseUrl: data.data.model_api_base_url
|
|
988
996
|
};
|
|
@@ -4951,10 +4959,7 @@ function generateMachineId() {
|
|
|
4951
4959
|
function buildLocalCode(phone, machineId) {
|
|
4952
4960
|
return `${phone}-${machineId}`;
|
|
4953
4961
|
}
|
|
4954
|
-
|
|
4955
|
-
return process$1.env.HOME || process$1.env.USERPROFILE || "";
|
|
4956
|
-
}
|
|
4957
|
-
const DEFAULT_PROVIDER = "siliconflow-minimax";
|
|
4962
|
+
const DEFAULT_PROVIDER = "mingto";
|
|
4958
4963
|
const DEFAULT_MODEL_ID = "MiniMax-M2.5";
|
|
4959
4964
|
const DEFAULT_MODEL_NAME = "MiniMax-M2.5";
|
|
4960
4965
|
const MODEL_GENERAL_CONFIG = {
|
|
@@ -4976,36 +4981,6 @@ function execAsync(command, options) {
|
|
|
4976
4981
|
});
|
|
4977
4982
|
});
|
|
4978
4983
|
}
|
|
4979
|
-
function getObjectHash(obj) {
|
|
4980
|
-
return JSON.stringify(obj, Object.keys(obj).sort());
|
|
4981
|
-
}
|
|
4982
|
-
function deepMerge(target, source) {
|
|
4983
|
-
const result = { ...target };
|
|
4984
|
-
for (const key in source) {
|
|
4985
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
4986
|
-
const sourceValue = source[key];
|
|
4987
|
-
const targetValue = target[key];
|
|
4988
|
-
if (Array.isArray(sourceValue) && Array.isArray(targetValue)) {
|
|
4989
|
-
if (targetValue.length > 0 && typeof targetValue[0] === "object" && targetValue[0] !== null) {
|
|
4990
|
-
const existingHashes = new Set(targetValue.map((item) => getObjectHash(item)));
|
|
4991
|
-
const newItems = sourceValue.filter((item) => !existingHashes.has(getObjectHash(item)));
|
|
4992
|
-
result[key] = [...targetValue, ...newItems];
|
|
4993
|
-
} else {
|
|
4994
|
-
const mergedArray = [.../* @__PURE__ */ new Set([...targetValue, ...sourceValue])];
|
|
4995
|
-
result[key] = mergedArray;
|
|
4996
|
-
}
|
|
4997
|
-
} else if (sourceValue !== void 0 && sourceValue !== null && typeof sourceValue === "object" && !Array.isArray(sourceValue) && typeof targetValue === "object" && targetValue !== null && !Array.isArray(targetValue)) {
|
|
4998
|
-
result[key] = deepMerge(
|
|
4999
|
-
targetValue,
|
|
5000
|
-
sourceValue
|
|
5001
|
-
);
|
|
5002
|
-
} else if (sourceValue !== void 0) {
|
|
5003
|
-
result[key] = sourceValue;
|
|
5004
|
-
}
|
|
5005
|
-
}
|
|
5006
|
-
}
|
|
5007
|
-
return result;
|
|
5008
|
-
}
|
|
5009
4984
|
class LocalInstaller {
|
|
5010
4985
|
spinner;
|
|
5011
4986
|
prefixText = "";
|
|
@@ -5203,7 +5178,7 @@ class LocalInstaller {
|
|
|
5203
5178
|
debug.log(`[下载插件] tarball 下载成功: ${tarballPath}`);
|
|
5204
5179
|
break;
|
|
5205
5180
|
} catch (error) {
|
|
5206
|
-
lastError = error.message
|
|
5181
|
+
lastError = error instanceof Error ? error.message : "未知错误";
|
|
5207
5182
|
debug.log(`[下载插件] 第 ${i} 次尝试失败: ${lastError}`);
|
|
5208
5183
|
if (i < maxRetries) {
|
|
5209
5184
|
this.spinner.text = chalk.cyan(`下载失败,3秒后重试...`);
|
|
@@ -5560,6 +5535,9 @@ async function createLocalCommand(options) {
|
|
|
5560
5535
|
debug.log(`[初始化] 使用命令行参数: customIp=${customIp}`);
|
|
5561
5536
|
}
|
|
5562
5537
|
const mergeMode = options.mergeMode || "merge";
|
|
5538
|
+
if (!phone || !userPass) {
|
|
5539
|
+
throw new Error("手机号和密码不能为空");
|
|
5540
|
+
}
|
|
5563
5541
|
debug.log(`[初始化] 最终参数: env=${env}, phone=${phone}, customIp=${customIp}, pluginVersion=${options.pluginVersion}, openclawPath=${options.openclawPath}, mergeMode=${mergeMode}`);
|
|
5564
5542
|
debug.log("[初始化] 创建 LocalInstaller 实例...");
|
|
5565
5543
|
const installer = new LocalInstaller({
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export default function (): void;
|
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,MAAM,CAAC,OAAO,cAAc,IAAI,CAU/B"}
|
package/dist/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/local/apis/http.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAA;AAK9D,MAAM,WAAW,YAAY,CAAC,CAAC,GAAG,OAAO;IACvC,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,CAAC,CAAA;CACR;AAMD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,aAAa,CAQhE;AAED;;GAEG;AACH,wBAAsB,QAAQ,CAAC,CAAC,GAAG,OAAO,EACxC,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,OAAO,EACd,MAAM,CAAC,EAAE,kBAAkB,GAC1B,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAmD1B;AAED;;GAEG;AACH,wBAAsB,OAAO,CAAC,CAAC,GAAG,OAAO,EACvC,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,kBAAkB,GAC1B,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAkD1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/local/apis/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAKtD,YAAY,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/local/apis/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAKtD,YAAY,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AAyB1C;;GAEG;AACH,wBAAsB,KAAK,CACzB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,eAAe,GACtB,OAAO,CAAC,MAAM,CAAC,CA+BjB;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,eAAe,GACtB,OAAO,CAAC,WAAW,CAAC,CAyDtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/local/constants/model.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/local/constants/model.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,WAAW,CAAA;AAExC,eAAO,MAAM,gBAAgB,iBAAiB,CAAA;AAE9C,eAAO,MAAM,kBAAkB,iBAAiB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installer.d.ts","sourceRoot":"","sources":["../../../src/local/installer/installer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAA6B,oBAAoB,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"installer.d.ts","sourceRoot":"","sources":["../../../src/local/installer/installer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAA6B,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAwC/E;;;GAGG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,OAAO,CAAK;IACpB,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsB;IAC7C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAiB;IAC3C,OAAO,CAAC,KAAK,CAAa;IAE1B;;OAEG;gBACS,MAAM,EAAE,oBAAoB;IAOxC;;OAEG;IACH,cAAc,IAAI,IAAI;IAUtB;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAgE9B;;OAEG;IACH,aAAa,IAAI,MAAM;IAIvB;;OAEG;IACH,QAAQ,IAAI,MAAM;IAIlB;;OAEG;IACH,OAAO,CAAC,cAAc;IAOtB;;OAEG;YACW,OAAO;IAoBrB;;OAEG;YACW,kBAAkB;IAchC;;OAEG;YACW,eAAe;IAmB7B;;OAEG;YACW,iBAAiB;IAoH/B;;OAEG;YACW,cAAc;CA+N7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local.d.ts","sourceRoot":"","sources":["../../../src/local/src/local.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAQ5C;;;GAGG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"local.d.ts","sourceRoot":"","sources":["../../../src/local/src/local.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAQ5C;;;GAGG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAsK7E"}
|
|
@@ -28,8 +28,8 @@ export declare const LocalInstallerConfigSchema: z.ZodObject<{
|
|
|
28
28
|
pluginVersion: z.ZodOptional<z.ZodString>;
|
|
29
29
|
openclawPath: z.ZodOptional<z.ZodIntersection<z.ZodString, z.ZodString>>;
|
|
30
30
|
mergeMode: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
31
|
-
merge: "merge";
|
|
32
31
|
replace: "replace";
|
|
32
|
+
merge: "merge";
|
|
33
33
|
"reset-keys": "reset-keys";
|
|
34
34
|
}>>>;
|
|
35
35
|
}, z.core.$strip>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/local/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AACrC,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/local/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AACrC,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA"}
|
|
@@ -2,6 +2,7 @@ export { debug, isDebugMode, setDebug } from './debug';
|
|
|
2
2
|
export { checkEnv } from './env';
|
|
3
3
|
export { createLogger, logger } from './logger';
|
|
4
4
|
export type { Logger } from './logger';
|
|
5
|
-
export {
|
|
5
|
+
export { deepMerge, getObjectHash } from './object';
|
|
6
|
+
export { getHomeDir, normalizePath, validateOpenclawPath } from './path';
|
|
6
7
|
export { absolutePathSchema, appKeySchema, appSecretSchema, booleanSchema, EnvironmentSchema, ipv4Schema, isValid, openclawPathSchema, phoneSchema, pluginVersionSchema, userPassSchema, validate, validateWithMessage, windowsPathSchema, withMessage, wsUrlSchema, } from './validate';
|
|
7
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAC/C,YAAY,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAC/C,YAAY,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACtC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACnD,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAA;AACxE,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,UAAU,EACV,OAAO,EACP,kBAAkB,EAClB,WAAW,EACX,mBAAmB,EACnB,cAAc,EACd,QAAQ,EACR,mBAAmB,EACnB,iBAAiB,EACjB,WAAW,EACX,WAAW,GACZ,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 计算对象的稳定哈希值,用于数组去重比较
|
|
3
|
+
* @param obj - 任意对象
|
|
4
|
+
* @returns 对象的字符串哈希
|
|
5
|
+
*/
|
|
6
|
+
export declare function getObjectHash(obj: unknown): string;
|
|
7
|
+
/**
|
|
8
|
+
* 深度合并两个对象
|
|
9
|
+
* - 对象数组:根据内容哈希去重后追加
|
|
10
|
+
* - 简单值数组:使用 Set 去重合并
|
|
11
|
+
* - 对象:递归深度合并
|
|
12
|
+
* - 其他类型:source 覆盖 target
|
|
13
|
+
* @param target - 目标对象
|
|
14
|
+
* @param source - 源对象
|
|
15
|
+
* @returns 合并后的新对象
|
|
16
|
+
*/
|
|
17
|
+
export declare function deepMerge<T extends Record<string, unknown>>(target: T, source: Partial<T>): T;
|
|
18
|
+
//# sourceMappingURL=object.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../../../src/shared/utils/object.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAElD;AAED;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CA2C7F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../../src/shared/utils/path.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../../src/shared/utils/path.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAYD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAIvD;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAU/D"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/box/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA"}
|
package/dist/box/utils/path.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../../src/box/utils/path.ts"],"names":[],"mappings":"AAEA,wBAAgB,UAAU,IAAI,MAAM,CAEnC"}
|
package/dist/command/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/command/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAChD,cAAc,SAAS,CAAA"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import { Option } from '../types';
|
|
3
|
-
export declare abstract class BaseCommand<T = Record<string, any>> {
|
|
4
|
-
protected program: Command;
|
|
5
|
-
constructor(program: Command);
|
|
6
|
-
protected options: Array<Option>;
|
|
7
|
-
protected init(): void;
|
|
8
|
-
abstract action(options: T): void | Promise<void>;
|
|
9
|
-
abstract command: string;
|
|
10
|
-
abstract description: string;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=base-command.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base-command.d.ts","sourceRoot":"","sources":["../../../src/command/src/base-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEtC,8BAAsB,WAAW,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAC3C,SAAS,CAAC,OAAO,EAAE,OAAO;gBAAhB,OAAO,EAAE,OAAO;IAItC,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAK;IAErC,SAAS,CAAC,IAAI,IAAI,IAAI;IAStB,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IACjD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAC7B"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export interface Option {
|
|
2
|
-
name: string;
|
|
3
|
-
description: string;
|
|
4
|
-
}
|
|
5
|
-
export interface InitOptions {
|
|
6
|
-
scenario?: string;
|
|
7
|
-
env?: string;
|
|
8
|
-
phone?: string;
|
|
9
|
-
userPass?: string;
|
|
10
|
-
appKey?: string;
|
|
11
|
-
appSecret?: string;
|
|
12
|
-
debug?: boolean;
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/command/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
export interface Option {
|
|
3
|
-
name: string;
|
|
4
|
-
description: string;
|
|
5
|
-
}
|
|
6
|
-
declare abstract class BaseCommand {
|
|
7
|
-
protected program: Command;
|
|
8
|
-
protected abstract command: string;
|
|
9
|
-
protected abstract description: string;
|
|
10
|
-
protected options: Array<Option>;
|
|
11
|
-
constructor(program: Command);
|
|
12
|
-
protected init(): void;
|
|
13
|
-
abstract action(...args: unknown[]): void | Promise<void>;
|
|
14
|
-
}
|
|
15
|
-
export default BaseCommand;
|
|
16
|
-
//# sourceMappingURL=base-command.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base-command.d.ts","sourceRoot":"","sources":["../../../src/lib/command/base-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAExC,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,uBAAe,WAAW;IACxB,SAAS,CAAC,OAAO,EAAE,OAAO,CAAA;IAC1B,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IAClC,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IACtC,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAK;gBAEzB,OAAO,EAAE,OAAO;IAI5B,SAAS,CAAC,IAAI,IAAI,IAAI;IAStB,QAAQ,CAAC,MAAM,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CAC1D;AAED,eAAe,WAAW,CAAA"}
|
package/dist/lib/index.d.ts
DELETED
package/dist/lib/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAeA,MAAM,CAAC,OAAO,cAAc,IAAI,CAU/B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../../src/local/utils/path.ts"],"names":[],"mappings":"AAEA,wBAAgB,UAAU,IAAI,MAAM,CAEnC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export interface DefaultConfig {
|
|
2
|
-
apiBaseUrl: {
|
|
3
|
-
test: string;
|
|
4
|
-
prod: string;
|
|
5
|
-
};
|
|
6
|
-
wsUrl: {
|
|
7
|
-
test: string;
|
|
8
|
-
prod: string;
|
|
9
|
-
};
|
|
10
|
-
modelUrl: {
|
|
11
|
-
test: string;
|
|
12
|
-
prod: string;
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
export declare const defaultConfig: DefaultConfig;
|
|
16
|
-
export declare const openApisUrl: {
|
|
17
|
-
test: string;
|
|
18
|
-
prod: string;
|
|
19
|
-
};
|
|
20
|
-
export declare const apiBaseUrl: {
|
|
21
|
-
test: string;
|
|
22
|
-
prod: string;
|
|
23
|
-
};
|
|
24
|
-
export declare function getApiBaseUrl(env: string): string;
|
|
25
|
-
export declare function getWsUrl(env: string): string;
|
|
26
|
-
export declare function getOpenApisUrl(env: string): string;
|
|
27
|
-
export declare function getModelUrl(env: string): string;
|
|
28
|
-
//# sourceMappingURL=config-default.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config-default.d.ts","sourceRoot":"","sources":["../../src/utils/config-default.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE;QACV,IAAI,EAAE,MAAM,CAAA;QACZ,IAAI,EAAE,MAAM,CAAA;KACb,CAAA;IACD,KAAK,EAAE;QACL,IAAI,EAAE,MAAM,CAAA;QACZ,IAAI,EAAE,MAAM,CAAA;KACb,CAAA;IACD,QAAQ,EAAE;QACR,IAAI,EAAE,MAAM,CAAA;QACZ,IAAI,EAAE,MAAM,CAAA;KACb,CAAA;CACF;AAED,eAAO,MAAM,aAAa,EAAE,aAa3B,CAAA;AAED,eAAO,MAAM,WAAW;;;CAGvB,CAAA;AAED,eAAO,MAAM,UAAU;;;CAGtB,CAAA;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE/C"}
|
package/dist/utils/config.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
/**
|
|
3
|
-
* 配置对象 schema
|
|
4
|
-
* 配置是一个对象,支持任意键值,channels 为可选的嵌套对象
|
|
5
|
-
*/
|
|
6
|
-
export declare const OpenClawConfigSchema: z.ZodObject<{
|
|
7
|
-
channels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
8
|
-
}, z.core.$catchall<z.ZodUnknown>>;
|
|
9
|
-
export type OpenClawConfig = z.infer<typeof OpenClawConfigSchema>;
|
|
10
|
-
/**
|
|
11
|
-
* 读取配置文件
|
|
12
|
-
*/
|
|
13
|
-
export declare function readConfig(configPath: string): Promise<OpenClawConfig | null>;
|
|
14
|
-
/**
|
|
15
|
-
* 写入配置文件
|
|
16
|
-
*/
|
|
17
|
-
export declare function writeConfig(configPath: string, config: OpenClawConfig): Promise<void>;
|
|
18
|
-
/**
|
|
19
|
-
* 合并配置
|
|
20
|
-
*/
|
|
21
|
-
export declare function mergeConfig(original: OpenClawConfig, overlay: Partial<OpenClawConfig>): OpenClawConfig;
|
|
22
|
-
/**
|
|
23
|
-
* 验证配置格式
|
|
24
|
-
* @param config - 待验证的配置
|
|
25
|
-
* @returns - 验证是否通过
|
|
26
|
-
*/
|
|
27
|
-
export declare function validateConfig(config: unknown): config is OpenClawConfig;
|
|
28
|
-
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/utils/config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB;;;GAGG;AACH,eAAO,MAAM,oBAAoB;;kCAET,CAAA;AAExB,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAEjE;;GAEG;AACH,wBAAsB,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAUnF;AAED;;GAEG;AACH,wBAAsB,WAAW,CAC/B,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,cAAc,GACrB,OAAO,CAAC,IAAI,CAAC,CAIf;AAED;;GAEG;AACH,wBAAgB,WAAW,CACzB,QAAQ,EAAE,cAAc,EACxB,OAAO,EAAE,OAAO,CAAC,cAAc,CAAC,GAC/B,cAAc,CA0BhB;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,cAAc,CAOxE"}
|
package/dist/utils/crypto.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* RSA 加密
|
|
3
|
-
* 使用公钥加密字符串
|
|
4
|
-
* @param txt 需要加密的字符串
|
|
5
|
-
* @returns 加密后的字符串,如果加密失败返回 null
|
|
6
|
-
*/
|
|
7
|
-
export declare function rsaEncrypt(txt: string): string | null;
|
|
8
|
-
/**
|
|
9
|
-
* 验证 RSA 加密功能是否可用
|
|
10
|
-
* @returns 如果可用返回 true
|
|
11
|
-
*/
|
|
12
|
-
export declare function isCryptoAvailable(): boolean;
|
|
13
|
-
//# sourceMappingURL=crypto.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../src/utils/crypto.ts"],"names":[],"mappings":"AAQA;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAgBrD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAQ3C"}
|
package/dist/utils/error.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
export declare const ERROR_CODES: {
|
|
2
|
-
readonly NODE_VERSION_LOW: 1001;
|
|
3
|
-
readonly NODE_NOT_FOUND: 1002;
|
|
4
|
-
readonly NPM_NOT_FOUND: 1003;
|
|
5
|
-
readonly PHONE_REQUIRED: 2001;
|
|
6
|
-
readonly USER_PASS_REQUIRED: 2002;
|
|
7
|
-
readonly MISSING_AGENT_ID: 2003;
|
|
8
|
-
readonly MISSING_APP_KEY: 2004;
|
|
9
|
-
readonly MISSING_APP_SECRET: 2005;
|
|
10
|
-
readonly INVALID_ARGUMENT: 2006;
|
|
11
|
-
readonly INVALID_OPENCLAW_PATH: 2007;
|
|
12
|
-
readonly LOGIN_FAILED: 3001;
|
|
13
|
-
readonly GET_BOUND_CONFIG_FAILED: 3002;
|
|
14
|
-
readonly FETCH_CONFIG_FAILED: 3003;
|
|
15
|
-
readonly CONFIG_WRITE_FAILED: 4001;
|
|
16
|
-
readonly FILE_COPY_FAILED: 4002;
|
|
17
|
-
readonly NPM_INSTALL_FAILED: 4003;
|
|
18
|
-
readonly PASSWORD_ENCRYPT_FAILED: 5001;
|
|
19
|
-
};
|
|
20
|
-
export type ErrorCode = typeof ERROR_CODES[keyof typeof ERROR_CODES];
|
|
21
|
-
export interface AppErrorData {
|
|
22
|
-
code: ErrorCode;
|
|
23
|
-
message: string;
|
|
24
|
-
details?: unknown;
|
|
25
|
-
}
|
|
26
|
-
export declare class AppError extends Error {
|
|
27
|
-
code: ErrorCode;
|
|
28
|
-
details?: unknown;
|
|
29
|
-
constructor(code: ErrorCode, message: string, details?: unknown);
|
|
30
|
-
toJSON(): AppErrorData;
|
|
31
|
-
toString(): string;
|
|
32
|
-
}
|
|
33
|
-
export declare function formatError(error: unknown): string;
|
|
34
|
-
export declare function isAppError(error: unknown): error is AppError;
|
|
35
|
-
export declare function createError(code: ErrorCode, message: string, details?: unknown): AppError;
|
|
36
|
-
//# sourceMappingURL=error.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/utils/error.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;CA2Bd,CAAA;AAEV,MAAM,MAAM,SAAS,GAAG,OAAO,WAAW,CAAC,MAAM,OAAO,WAAW,CAAC,CAAA;AAEpE,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,SAAS,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,qBAAa,QAAS,SAAQ,KAAK;IACjC,IAAI,EAAE,SAAS,CAAA;IACf,OAAO,CAAC,EAAE,OAAO,CAAA;gBAEL,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO;IAO/D,MAAM,IAAI,YAAY;IAQtB,QAAQ,IAAI,MAAM;CAGnB;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAUlD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAE5D;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,QAAQ,CAEzF"}
|
package/dist/utils/http.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/utils/http.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAA;AAK9D,MAAM,WAAW,YAAY,CAAC,CAAC,GAAG,OAAO;IACvC,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,CAAC,CAAA;CACR;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,aAAa,CAQhE;AAED;;GAEG;AACH,wBAAsB,QAAQ,CAAC,CAAC,GAAG,OAAO,EACxC,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,OAAO,EACd,MAAM,CAAC,EAAE,kBAAkB,GAC1B,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAgD1B;AAED;;GAEG;AACH,wBAAsB,OAAO,CAAC,CAAC,GAAG,OAAO,EACvC,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,kBAAkB,GAC1B,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CA+C1B"}
|
package/dist/utils/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,kBAAkB,CAAA;AAChC,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,QAAQ,CAAA;AACtB,cAAc,UAAU,CAAA"}
|
package/dist/utils/logger.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Ora } from 'ora';
|
|
2
|
-
export type LogLevel = 'info' | 'success' | 'warn' | 'error' | 'step';
|
|
3
|
-
export interface Logger {
|
|
4
|
-
info: (message: string) => void;
|
|
5
|
-
success: (message: string) => void;
|
|
6
|
-
warn: (message: string) => void;
|
|
7
|
-
error: (message: string) => void;
|
|
8
|
-
step: (message: string) => void;
|
|
9
|
-
start: (message: string) => Ora;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* 创建日志记录器
|
|
13
|
-
*/
|
|
14
|
-
export declare function createLogger(): Logger;
|
|
15
|
-
export declare const logger: Logger;
|
|
16
|
-
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAI9B,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAA;AAErE,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IAC/B,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IAClC,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IAC/B,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IAChC,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IAC/B,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,GAAG,CAAA;CAChC;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,MAAM,CA6BrC;AAED,eAAO,MAAM,MAAM,QAAiB,CAAA"}
|
|
File without changes
|