@workclaw/cli 1.0.330 → 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/index.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 +6 -0
- package/dist/box/types/index.d.ts.map +1 -1
- package/dist/{index-DV-DJElg.js → index-BEgrVqZz.js} +121 -106
- 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/index.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 +6 -0
- package/dist/local/types/index.d.ts.map +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"}
|
package/dist/box/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/box/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAIxC,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/box/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAIxC,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAcvD"}
|
|
@@ -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"}
|
|
@@ -10,6 +10,7 @@ export interface BoxOptions {
|
|
|
10
10
|
openclawPath?: string;
|
|
11
11
|
debug?: boolean;
|
|
12
12
|
model?: ModelType;
|
|
13
|
+
mergeMode?: 'merge' | 'replace' | 'reset-keys';
|
|
13
14
|
}
|
|
14
15
|
/**
|
|
15
16
|
* BoxInstaller 配置验证 schema
|
|
@@ -33,6 +34,11 @@ export declare const BoxInstallerConfigSchema: z.ZodObject<{
|
|
|
33
34
|
"gpt-5-chat": "gpt-5-chat";
|
|
34
35
|
"gpt-5-mini": "gpt-5-mini";
|
|
35
36
|
}>>>;
|
|
37
|
+
mergeMode: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
38
|
+
replace: "replace";
|
|
39
|
+
merge: "merge";
|
|
40
|
+
"reset-keys": "reset-keys";
|
|
41
|
+
}>>>;
|
|
36
42
|
}, z.core.$strip>;
|
|
37
43
|
export type BoxInstallerConfig = z.infer<typeof BoxInstallerConfigSchema>;
|
|
38
44
|
export interface InstallResult {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/box/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAWvB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE7C,MAAM,WAAW,UAAU;IACzB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,KAAK,CAAC,EAAE,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/box/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAWvB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE7C,MAAM,WAAW,UAAU;IACzB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,YAAY,CAAA;CAC/C;AAED;;;GAGG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;iBAqBpC,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAA;AAEzE,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;CACb"}
|
|
@@ -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 {
|
|
@@ -480,8 +480,25 @@ class BoxInstaller {
|
|
|
480
480
|
} catch {
|
|
481
481
|
debug.log("[更新配置] 无原有配置");
|
|
482
482
|
}
|
|
483
|
+
const mergeMode = this.config.mergeMode || "merge";
|
|
484
|
+
const resetKeys = ["models", "agents", "bindings", "channels", "plugins"];
|
|
485
|
+
if (mergeMode === "replace") {
|
|
486
|
+
debug.log("[更新配置] 合并模式: replace(完全重置,忽略原有配置)");
|
|
487
|
+
originalConfig = {};
|
|
488
|
+
} else if (mergeMode === "reset-keys") {
|
|
489
|
+
debug.log("[更新配置] 合并模式: reset-keys(清除关键字段后合并)");
|
|
490
|
+
for (const key of resetKeys) {
|
|
491
|
+
if (originalConfig[key]) {
|
|
492
|
+
delete originalConfig[key];
|
|
493
|
+
debug.log(`[更新配置] 清除原有 ${key} 配置`);
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
} else {
|
|
497
|
+
debug.log("[更新配置] 合并模式: merge(完整保留原有配置后合并)");
|
|
498
|
+
}
|
|
483
499
|
const config = getConfig(this.config.env || "test", this.config.customIp);
|
|
484
|
-
const
|
|
500
|
+
const model = this.config.model ?? DEFAULT_MODEL;
|
|
501
|
+
const modelInfo = MODEL_ID_MAP[model];
|
|
485
502
|
const newConfig = {
|
|
486
503
|
// diagnostics: 诊断配置
|
|
487
504
|
diagnostics: {
|
|
@@ -702,9 +719,9 @@ class BoxInstaller {
|
|
|
702
719
|
}
|
|
703
720
|
}
|
|
704
721
|
};
|
|
705
|
-
const finalConfig = deepMerge
|
|
722
|
+
const finalConfig = deepMerge(originalConfig, newConfig);
|
|
706
723
|
this.updateSpinner("正在写入配置...");
|
|
707
|
-
debug.log("[更新配置]
|
|
724
|
+
debug.log("[更新配置] 合并配置并写入文件(保留其他初始化数据)...");
|
|
708
725
|
await fs.writeFile(paths.config, JSON.stringify(finalConfig, null, 2), "utf-8");
|
|
709
726
|
this.prefixText += chalk.green(` ✓ 配置文件更新成功
|
|
710
727
|
`);
|
|
@@ -822,7 +839,11 @@ async function createBoxCommand(options) {
|
|
|
822
839
|
} else if (env === "custom" && customIp) {
|
|
823
840
|
debug.log(`[盒子安装] 使用命令行参数: customIp=${customIp}`);
|
|
824
841
|
}
|
|
825
|
-
|
|
842
|
+
const mergeMode = options.mergeMode || "merge";
|
|
843
|
+
if (!appKey || !appSecret) {
|
|
844
|
+
throw new Error("AppKey 和 AppSecret 不能为空");
|
|
845
|
+
}
|
|
846
|
+
debug.log(`[盒子安装] 最终参数: env=${env}, customIp=${customIp}, openclawPath=${options.openclawPath}, model=${model}, mergeMode=${mergeMode}`);
|
|
826
847
|
debug.log("[盒子安装] 创建 BoxInstaller 实例...");
|
|
827
848
|
const installer = new BoxInstaller({
|
|
828
849
|
appKey,
|
|
@@ -832,7 +853,8 @@ async function createBoxCommand(options) {
|
|
|
832
853
|
wsUrl: options.wsUrl,
|
|
833
854
|
pluginVersion: options.pluginVersion,
|
|
834
855
|
openclawPath: options.openclawPath,
|
|
835
|
-
model
|
|
856
|
+
model,
|
|
857
|
+
mergeMode
|
|
836
858
|
});
|
|
837
859
|
debug.log("[盒子安装] 开始安装...");
|
|
838
860
|
await installer.install();
|
|
@@ -867,7 +889,7 @@ async function createBoxCommand(options) {
|
|
|
867
889
|
}
|
|
868
890
|
}
|
|
869
891
|
function registerCommands$1(program2) {
|
|
870
|
-
program2.command("box").description("盒子设备安装(无需登录)").option("-e, --env <env>", "环境 (test/prod/custom)").option("--app-key <appKey>", "App Key").option("--app-secret <appSecret>", "App Secret").option("--customIp <ip>", "自定义后端 IP(仅 custom 环境生效)").option("--ws-url <url>", "自定义 WebSocket URL(仅 custom 环境生效,默认自动生成)").option("--plugin-version <plugin-version>", "插件版本号(默认最新版)").option("--openclaw-path <path>", "OpenClaw 安装目录路径(默认 ~/.openclaw)").option("--model <model>", `选择模型 (${SUPPORTED_MODELS.join("/")}),默认 ${DEFAULT_MODEL}`).option("--debug", "开启调试日志").action(createBoxCommand);
|
|
892
|
+
program2.command("box").description("盒子设备安装(无需登录)").option("-e, --env <env>", "环境 (test/prod/custom)").option("--app-key <appKey>", "App Key").option("--app-secret <appSecret>", "App Secret").option("--customIp <ip>", "自定义后端 IP(仅 custom 环境生效)").option("--ws-url <url>", "自定义 WebSocket URL(仅 custom 环境生效,默认自动生成)").option("--plugin-version <plugin-version>", "插件版本号(默认最新版)").option("--openclaw-path <path>", "OpenClaw 安装目录路径(默认 ~/.openclaw)").option("--model <model>", `选择模型 (${SUPPORTED_MODELS.join("/")}),默认 ${DEFAULT_MODEL}`).option("--merge-mode <mode>", "配置合并模式 (merge: 保留旧配置合并 / replace: 完全重置 / reset-keys: 清除关键字段后合并),默认 reset-keys").option("--debug", "开启调试日志").action(createBoxCommand);
|
|
871
893
|
}
|
|
872
894
|
function createHttpClient(baseURL) {
|
|
873
895
|
return axios.create({
|
|
@@ -892,28 +914,32 @@ async function httpPost(url, data, config) {
|
|
|
892
914
|
data: response.data
|
|
893
915
|
};
|
|
894
916
|
} catch (error) {
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
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}`);
|
|
905
934
|
} else {
|
|
906
|
-
|
|
935
|
+
debug.log(`[HTTP POST] 请求配置错误`);
|
|
936
|
+
debug.log(`[HTTP POST] 错误信息: ${error.message}`);
|
|
937
|
+
throw new AppError$1(ERROR_CODES$1.HTTP_ERROR, `请求配置错误: ${error.message}`);
|
|
907
938
|
}
|
|
908
|
-
} else if (axiosError.request) {
|
|
909
|
-
debug.log(`[HTTP POST] 未收到响应`);
|
|
910
|
-
debug.log(`[HTTP POST] 错误信息: ${axiosError.message}`);
|
|
911
|
-
throw new AppError$1(ERROR_CODES$1.NETWORK_ERROR, `网络错误: ${axiosError.message}`);
|
|
912
|
-
} else {
|
|
913
|
-
debug.log(`[HTTP POST] 请求配置错误`);
|
|
914
|
-
debug.log(`[HTTP POST] 错误信息: ${axiosError.message}`);
|
|
915
|
-
throw new AppError$1(ERROR_CODES$1.HTTP_ERROR, `请求配置错误: ${axiosError.message}`);
|
|
916
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}`);
|
|
917
943
|
}
|
|
918
944
|
}
|
|
919
945
|
async function login(phone, password, config) {
|
|
@@ -961,10 +987,10 @@ async function fetchBoundConfig(token, phone, localCode, config) {
|
|
|
961
987
|
debug.log(`[获取绑定配置] 响应数据: ${JSON.stringify(data)}`);
|
|
962
988
|
if (data.code === 200 && data.data) {
|
|
963
989
|
const boundConfig = {
|
|
964
|
-
appKey: data.data.app_key,
|
|
965
|
-
appSecret: data.data.app_secret,
|
|
990
|
+
appKey: data.data.app_key ?? "",
|
|
991
|
+
appSecret: data.data.app_secret ?? "",
|
|
966
992
|
userId: data.data.user_id,
|
|
967
|
-
agentId: data.data.agent_id
|
|
993
|
+
agentId: data.data.agent_id ?? data.data.agents?.[0]?.id ?? "",
|
|
968
994
|
modelApiKey: data.data.model_api_key,
|
|
969
995
|
modelApiBaseUrl: data.data.model_api_base_url
|
|
970
996
|
};
|
|
@@ -998,7 +1024,8 @@ const LocalInstallerConfigSchema = z$1.object({
|
|
|
998
1024
|
phone: phoneSchema,
|
|
999
1025
|
userPass: userPassSchema,
|
|
1000
1026
|
pluginVersion: pluginVersionSchema,
|
|
1001
|
-
openclawPath: openclawPathSchema.optional()
|
|
1027
|
+
openclawPath: openclawPathSchema.optional(),
|
|
1028
|
+
mergeMode: z$1.enum(["merge", "replace", "reset-keys"]).optional().default("merge")
|
|
1002
1029
|
}).refine(
|
|
1003
1030
|
(data) => {
|
|
1004
1031
|
if (data.env === "custom") {
|
|
@@ -4932,10 +4959,7 @@ function generateMachineId() {
|
|
|
4932
4959
|
function buildLocalCode(phone, machineId) {
|
|
4933
4960
|
return `${phone}-${machineId}`;
|
|
4934
4961
|
}
|
|
4935
|
-
|
|
4936
|
-
return process$1.env.HOME || process$1.env.USERPROFILE || "";
|
|
4937
|
-
}
|
|
4938
|
-
const DEFAULT_PROVIDER = "siliconflow-minimax";
|
|
4962
|
+
const DEFAULT_PROVIDER = "mingto";
|
|
4939
4963
|
const DEFAULT_MODEL_ID = "MiniMax-M2.5";
|
|
4940
4964
|
const DEFAULT_MODEL_NAME = "MiniMax-M2.5";
|
|
4941
4965
|
const MODEL_GENERAL_CONFIG = {
|
|
@@ -4957,36 +4981,6 @@ function execAsync(command, options) {
|
|
|
4957
4981
|
});
|
|
4958
4982
|
});
|
|
4959
4983
|
}
|
|
4960
|
-
function getObjectHash(obj) {
|
|
4961
|
-
return JSON.stringify(obj, Object.keys(obj).sort());
|
|
4962
|
-
}
|
|
4963
|
-
function deepMerge(target, source) {
|
|
4964
|
-
const result = { ...target };
|
|
4965
|
-
for (const key in source) {
|
|
4966
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
4967
|
-
const sourceValue = source[key];
|
|
4968
|
-
const targetValue = target[key];
|
|
4969
|
-
if (Array.isArray(sourceValue) && Array.isArray(targetValue)) {
|
|
4970
|
-
if (targetValue.length > 0 && typeof targetValue[0] === "object" && targetValue[0] !== null) {
|
|
4971
|
-
const existingHashes = new Set(targetValue.map((item) => getObjectHash(item)));
|
|
4972
|
-
const newItems = sourceValue.filter((item) => !existingHashes.has(getObjectHash(item)));
|
|
4973
|
-
result[key] = [...targetValue, ...newItems];
|
|
4974
|
-
} else {
|
|
4975
|
-
const mergedArray = [.../* @__PURE__ */ new Set([...targetValue, ...sourceValue])];
|
|
4976
|
-
result[key] = mergedArray;
|
|
4977
|
-
}
|
|
4978
|
-
} else if (sourceValue !== void 0 && sourceValue !== null && typeof sourceValue === "object" && !Array.isArray(sourceValue) && typeof targetValue === "object" && targetValue !== null && !Array.isArray(targetValue)) {
|
|
4979
|
-
result[key] = deepMerge(
|
|
4980
|
-
targetValue,
|
|
4981
|
-
sourceValue
|
|
4982
|
-
);
|
|
4983
|
-
} else if (sourceValue !== void 0) {
|
|
4984
|
-
result[key] = sourceValue;
|
|
4985
|
-
}
|
|
4986
|
-
}
|
|
4987
|
-
}
|
|
4988
|
-
return result;
|
|
4989
|
-
}
|
|
4990
4984
|
class LocalInstaller {
|
|
4991
4985
|
spinner;
|
|
4992
4986
|
prefixText = "";
|
|
@@ -5184,7 +5178,7 @@ class LocalInstaller {
|
|
|
5184
5178
|
debug.log(`[下载插件] tarball 下载成功: ${tarballPath}`);
|
|
5185
5179
|
break;
|
|
5186
5180
|
} catch (error) {
|
|
5187
|
-
lastError = error.message
|
|
5181
|
+
lastError = error instanceof Error ? error.message : "未知错误";
|
|
5188
5182
|
debug.log(`[下载插件] 第 ${i} 次尝试失败: ${lastError}`);
|
|
5189
5183
|
if (i < maxRetries) {
|
|
5190
5184
|
this.spinner.text = chalk.cyan(`下载失败,3秒后重试...`);
|
|
@@ -5263,6 +5257,22 @@ class LocalInstaller {
|
|
|
5263
5257
|
} catch {
|
|
5264
5258
|
debug.log("[更新配置] 无原有配置");
|
|
5265
5259
|
}
|
|
5260
|
+
const mergeMode = this.config.mergeMode || "merge";
|
|
5261
|
+
const resetKeys = ["models", "agents", "bindings", "channels", "plugins"];
|
|
5262
|
+
if (mergeMode === "replace") {
|
|
5263
|
+
debug.log("[更新配置] 合并模式: replace(完全重置,忽略原有配置)");
|
|
5264
|
+
originalConfig = {};
|
|
5265
|
+
} else if (mergeMode === "reset-keys") {
|
|
5266
|
+
debug.log("[更新配置] 合并模式: reset-keys(清除关键字段后合并)");
|
|
5267
|
+
for (const key of resetKeys) {
|
|
5268
|
+
if (originalConfig[key]) {
|
|
5269
|
+
delete originalConfig[key];
|
|
5270
|
+
debug.log(`[更新配置] 清除原有 ${key} 配置`);
|
|
5271
|
+
}
|
|
5272
|
+
}
|
|
5273
|
+
} else {
|
|
5274
|
+
debug.log("[更新配置] 合并模式: merge(完整保留原有配置后合并)");
|
|
5275
|
+
}
|
|
5266
5276
|
const config = this.envConfig;
|
|
5267
5277
|
const newConfig = {
|
|
5268
5278
|
// diagnostics: 诊断配置
|
|
@@ -5421,7 +5431,7 @@ class LocalInstaller {
|
|
|
5421
5431
|
const finalConfig = deepMerge(originalConfig, newConfig);
|
|
5422
5432
|
this.spinner.prefixText = this.prefixText;
|
|
5423
5433
|
this.spinner.text = chalk.cyan("正在写入配置...");
|
|
5424
|
-
debug.log("[更新配置]
|
|
5434
|
+
debug.log("[更新配置] 合并配置并写入文件(保留其他初始化数据)...");
|
|
5425
5435
|
await fs.writeFile(paths.config, JSON.stringify(finalConfig, null, 2), "utf-8");
|
|
5426
5436
|
this.prefixText += chalk.green(` ✓ 配置更新完成
|
|
5427
5437
|
`);
|
|
@@ -5524,7 +5534,11 @@ async function createLocalCommand(options) {
|
|
|
5524
5534
|
} else if (env === "custom" && customIp) {
|
|
5525
5535
|
debug.log(`[初始化] 使用命令行参数: customIp=${customIp}`);
|
|
5526
5536
|
}
|
|
5527
|
-
|
|
5537
|
+
const mergeMode = options.mergeMode || "merge";
|
|
5538
|
+
if (!phone || !userPass) {
|
|
5539
|
+
throw new Error("手机号和密码不能为空");
|
|
5540
|
+
}
|
|
5541
|
+
debug.log(`[初始化] 最终参数: env=${env}, phone=${phone}, customIp=${customIp}, pluginVersion=${options.pluginVersion}, openclawPath=${options.openclawPath}, mergeMode=${mergeMode}`);
|
|
5528
5542
|
debug.log("[初始化] 创建 LocalInstaller 实例...");
|
|
5529
5543
|
const installer = new LocalInstaller({
|
|
5530
5544
|
phone,
|
|
@@ -5533,7 +5547,8 @@ async function createLocalCommand(options) {
|
|
|
5533
5547
|
customIp,
|
|
5534
5548
|
wsUrl: options.wsUrl,
|
|
5535
5549
|
pluginVersion: options.pluginVersion,
|
|
5536
|
-
openclawPath: options.openclawPath
|
|
5550
|
+
openclawPath: options.openclawPath,
|
|
5551
|
+
mergeMode
|
|
5537
5552
|
});
|
|
5538
5553
|
debug.log("[初始化] 开始安装...");
|
|
5539
5554
|
await installer.install();
|
|
@@ -5573,7 +5588,7 @@ ${chalk.cyan("Token: ")}${token}`);
|
|
|
5573
5588
|
}
|
|
5574
5589
|
}
|
|
5575
5590
|
function registerCommands(program2) {
|
|
5576
|
-
program2.command("local").description("本地账户安装(需要登录)").option("-e, --env <env>", "环境 (test/prod/custom)").option("--phone <phone>", "手机号码").option("--user-pass <userPass>", "用户密码").option("--custom-ip <ip>", "自定义后端 IP(仅 custom 环境生效)").option("--ws-url <url>", "自定义 WebSocket URL(仅 custom 环境生效,默认自动生成)").option("--plugin-version <plugin-version>", "插件版本号(默认最新版)").option("--openclaw-path <path>", "OpenClaw 安装目录路径(默认 ~/.openclaw)").option("--debug", "开启调试日志").action(createLocalCommand);
|
|
5591
|
+
program2.command("local").description("本地账户安装(需要登录)").option("-e, --env <env>", "环境 (test/prod/custom)").option("--phone <phone>", "手机号码").option("--user-pass <userPass>", "用户密码").option("--custom-ip <ip>", "自定义后端 IP(仅 custom 环境生效)").option("--ws-url <url>", "自定义 WebSocket URL(仅 custom 环境生效,默认自动生成)").option("--plugin-version <plugin-version>", "插件版本号(默认最新版)").option("--openclaw-path <path>", "OpenClaw 安装目录路径(默认 ~/.openclaw)").option("--merge-mode <mode>", "配置合并模式 (merge: 保留旧配置合并 / replace: 完全重置 / reset-keys: 清除关键字段后合并),默认 reset-keys").option("--debug", "开启调试日志").action(createLocalCommand);
|
|
5577
5592
|
}
|
|
5578
5593
|
const __filename$1 = fileURLToPath(import.meta.url);
|
|
5579
5594
|
const __dirname$1 = dirname(__filename$1);
|
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":"index.d.ts","sourceRoot":"","sources":["../../src/local/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAGxC,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/local/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAGxC,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAavD"}
|
|
@@ -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"}
|
|
@@ -9,6 +9,7 @@ export interface LocalOptions {
|
|
|
9
9
|
openclawPath?: string;
|
|
10
10
|
debug?: boolean;
|
|
11
11
|
printToken?: boolean;
|
|
12
|
+
mergeMode?: 'merge' | 'replace' | 'reset-keys';
|
|
12
13
|
}
|
|
13
14
|
/**
|
|
14
15
|
* LocalInstaller 配置验证 schema
|
|
@@ -26,6 +27,11 @@ export declare const LocalInstallerConfigSchema: z.ZodObject<{
|
|
|
26
27
|
userPass: z.ZodString;
|
|
27
28
|
pluginVersion: z.ZodOptional<z.ZodString>;
|
|
28
29
|
openclawPath: z.ZodOptional<z.ZodIntersection<z.ZodString, z.ZodString>>;
|
|
30
|
+
mergeMode: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
31
|
+
replace: "replace";
|
|
32
|
+
merge: "merge";
|
|
33
|
+
"reset-keys": "reset-keys";
|
|
34
|
+
}>>>;
|
|
29
35
|
}, z.core.$strip>;
|
|
30
36
|
export type LocalInstallerConfig = z.infer<typeof LocalInstallerConfigSchema>;
|
|
31
37
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/local/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAWvB,MAAM,WAAW,YAAY;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,UAAU,CAAC,EAAE,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/local/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAWvB,MAAM,WAAW,YAAY;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,YAAY,CAAA;CAC/C;AAED;;;GAGG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;iBAoBtC,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAA;AAE7E;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;iBAO5B,CAAA;AAEF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAE3D,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;CACb"}
|
|
@@ -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
|