easyrouter-config 1.0.8 → 1.0.9
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/index.js +14 -15
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
import {
|
|
5
5
|
intro,
|
|
6
6
|
outro,
|
|
7
|
-
text,
|
|
8
7
|
multiselect,
|
|
9
8
|
confirm,
|
|
10
9
|
spinner,
|
|
11
10
|
isCancel as isCancel2,
|
|
12
11
|
cancel,
|
|
13
12
|
log as log3,
|
|
14
|
-
note
|
|
13
|
+
note,
|
|
14
|
+
password
|
|
15
15
|
} from "@clack/prompts";
|
|
16
16
|
import pc6 from "picocolors";
|
|
17
17
|
|
|
@@ -20,7 +20,7 @@ import { parseArgs } from "util";
|
|
|
20
20
|
import pc from "picocolors";
|
|
21
21
|
|
|
22
22
|
// src/config/constants.ts
|
|
23
|
-
var VERSION = true ? "1.0.
|
|
23
|
+
var VERSION = true ? "1.0.9" : "0.0.0-dev";
|
|
24
24
|
var PRIMARY_HOST = "https://easyrouter.io";
|
|
25
25
|
var FALLBACK_HOSTS = ["https://ezr.sh"];
|
|
26
26
|
var HOST_PROBE_TIMEOUT_MS = 5e3;
|
|
@@ -250,21 +250,21 @@ async function runZcf(opts) {
|
|
|
250
250
|
windowsHide: true
|
|
251
251
|
});
|
|
252
252
|
const handleChunk = (chunk, target) => {
|
|
253
|
-
const
|
|
254
|
-
if (target === "out") capturedOut +=
|
|
255
|
-
else capturedErr +=
|
|
253
|
+
const text = typeof chunk === "string" ? chunk : chunk.toString("utf8");
|
|
254
|
+
if (target === "out") capturedOut += text;
|
|
255
|
+
else capturedErr += text;
|
|
256
256
|
lastDataAt = Date.now();
|
|
257
257
|
if (opts.onProgress) {
|
|
258
258
|
const now = Date.now();
|
|
259
259
|
if (now - lastProgressAt >= PROGRESS_THROTTLE_MS) {
|
|
260
260
|
lastProgressAt = now;
|
|
261
|
-
const lines =
|
|
261
|
+
const lines = text.replace(/\x1b\[[0-9;]*[a-zA-Z]/g, "").split(/\r?\n/).map((l) => l.trim()).filter(Boolean);
|
|
262
262
|
const last = lines[lines.length - 1];
|
|
263
263
|
if (last) opts.onProgress(last.slice(0, 60));
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
266
|
if (opts.verbose) {
|
|
267
|
-
process.stderr.write(
|
|
267
|
+
process.stderr.write(text);
|
|
268
268
|
}
|
|
269
269
|
};
|
|
270
270
|
child.stdout?.on("data", (c) => handleChunk(c, "out"));
|
|
@@ -741,20 +741,20 @@ async function runOpenClawSubprocess(args, ctx) {
|
|
|
741
741
|
windowsHide: true
|
|
742
742
|
});
|
|
743
743
|
const handleChunk = (chunk, target) => {
|
|
744
|
-
const
|
|
745
|
-
if (target === "out") capturedOut +=
|
|
746
|
-
else capturedErr +=
|
|
744
|
+
const text = typeof chunk === "string" ? chunk : chunk.toString("utf8");
|
|
745
|
+
if (target === "out") capturedOut += text;
|
|
746
|
+
else capturedErr += text;
|
|
747
747
|
lastDataAt = Date.now();
|
|
748
748
|
if (ctx.onProgress) {
|
|
749
749
|
const now = Date.now();
|
|
750
750
|
if (now - lastProgressAt >= PROGRESS_THROTTLE_MS) {
|
|
751
751
|
lastProgressAt = now;
|
|
752
|
-
const lines =
|
|
752
|
+
const lines = text.replace(/\x1b\[[0-9;]*[a-zA-Z]/g, "").split(/\r?\n/).map((l) => l.trim()).filter(Boolean);
|
|
753
753
|
const last = lines[lines.length - 1];
|
|
754
754
|
if (last) ctx.onProgress(last.slice(0, 60));
|
|
755
755
|
}
|
|
756
756
|
}
|
|
757
|
-
if (ctx.verbose) process.stderr.write(
|
|
757
|
+
if (ctx.verbose) process.stderr.write(text);
|
|
758
758
|
};
|
|
759
759
|
child.stdout?.on("data", (c) => handleChunk(c, "out"));
|
|
760
760
|
child.stderr?.on("data", (c) => handleChunk(c, "err"));
|
|
@@ -941,9 +941,8 @@ async function main() {
|
|
|
941
941
|
apiKey = normalizeApiKey(args.apiKey);
|
|
942
942
|
log3.info(`API Key: ${pc6.dim(maskKey(apiKey))}\uFF08\u6765\u81EA\u547D\u4EE4\u884C\u53C2\u6570\uFF09`);
|
|
943
943
|
} else {
|
|
944
|
-
const input = await
|
|
944
|
+
const input = await password({
|
|
945
945
|
message: "\u8BF7\u8F93\u5165\u4F60\u7684 EasyRouter API Key",
|
|
946
|
-
placeholder: "sk-xxxxxxxxxxxxxxxx",
|
|
947
946
|
validate(value) {
|
|
948
947
|
if (!value) return "\u4E0D\u80FD\u4E3A\u7A7A";
|
|
949
948
|
if (value.trim().length < 8) return "Key \u957F\u5EA6\u770B\u8D77\u6765\u4E0D\u5BF9";
|