@bgicli/bgicli 2.3.4 → 2.3.6
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/bgi.js +39 -19
- package/package.json +1 -1
package/dist/bgi.js
CHANGED
|
@@ -14297,6 +14297,7 @@ ${label} `);
|
|
|
14297
14297
|
let streamedLines = 0;
|
|
14298
14298
|
let lastLineWasEmpty = false;
|
|
14299
14299
|
let spinnerCleared = false;
|
|
14300
|
+
let partialLine = "";
|
|
14300
14301
|
const MAX_STREAM_LINES = 200;
|
|
14301
14302
|
let frame = 0;
|
|
14302
14303
|
const spin = setInterval(() => {
|
|
@@ -14316,8 +14317,7 @@ ${label} `);
|
|
|
14316
14317
|
let heartbeat = null;
|
|
14317
14318
|
const onStream = isBash ? (chunk) => {
|
|
14318
14319
|
lastChunkTime = Date.now();
|
|
14319
|
-
if (streamedLines
|
|
14320
|
-
if (streamedLines === 0) {
|
|
14320
|
+
if (streamedLines === 0 && partialLine.length === 0) {
|
|
14321
14321
|
clearSpinner();
|
|
14322
14322
|
process.stdout.write(`${label}
|
|
14323
14323
|
`);
|
|
@@ -14329,22 +14329,36 @@ ${label} `);
|
|
|
14329
14329
|
}
|
|
14330
14330
|
}, 5e3);
|
|
14331
14331
|
}
|
|
14332
|
-
|
|
14333
|
-
|
|
14334
|
-
const
|
|
14335
|
-
|
|
14336
|
-
|
|
14337
|
-
|
|
14338
|
-
|
|
14339
|
-
|
|
14332
|
+
let i2 = 0;
|
|
14333
|
+
while (i2 < chunk.length) {
|
|
14334
|
+
const crPos = chunk.indexOf("\r", i2);
|
|
14335
|
+
const nlPos = chunk.indexOf("\n", i2);
|
|
14336
|
+
if (crPos === -1 && nlPos === -1) {
|
|
14337
|
+
partialLine += chunk.slice(i2);
|
|
14338
|
+
process.stdout.write("\r" + source_default.dim(" \u2502 ") + partialLine + "\x1B[K");
|
|
14339
|
+
break;
|
|
14340
14340
|
}
|
|
14341
|
-
|
|
14342
|
-
|
|
14343
|
-
|
|
14344
|
-
|
|
14345
|
-
|
|
14346
|
-
|
|
14341
|
+
const nextPos = crPos === -1 ? nlPos : nlPos === -1 ? crPos : Math.min(crPos, nlPos);
|
|
14342
|
+
const isCR = chunk[nextPos] === "\r";
|
|
14343
|
+
partialLine += chunk.slice(i2, nextPos);
|
|
14344
|
+
if (isCR) {
|
|
14345
|
+
process.stdout.write("\r" + source_default.dim(" \u2502 ") + partialLine + "\x1B[K");
|
|
14346
|
+
partialLine = "";
|
|
14347
|
+
i2 = nextPos + 1;
|
|
14348
|
+
if (i2 < chunk.length && chunk[i2] === "\n") i2++;
|
|
14349
|
+
} else {
|
|
14350
|
+
if (partialLine.trim() !== "" || !lastLineWasEmpty) {
|
|
14351
|
+
if (streamedLines < MAX_STREAM_LINES) {
|
|
14352
|
+
process.stdout.write("\r" + source_default.dim(" \u2502 ") + partialLine + "\x1B[K\n");
|
|
14353
|
+
lastLineWasEmpty = partialLine.trim() === "";
|
|
14354
|
+
streamedLines++;
|
|
14355
|
+
if (streamedLines >= MAX_STREAM_LINES) {
|
|
14356
|
+
process.stdout.write(source_default.dim(" \u2502 ... (\u8F93\u51FA\u8FC7\u957F\uFF0C\u5DF2\u622A\u65AD)\n"));
|
|
14357
|
+
}
|
|
14358
|
+
}
|
|
14347
14359
|
}
|
|
14360
|
+
partialLine = "";
|
|
14361
|
+
i2 = nextPos + 1;
|
|
14348
14362
|
}
|
|
14349
14363
|
}
|
|
14350
14364
|
} : void 0;
|
|
@@ -14353,6 +14367,12 @@ ${label} `);
|
|
|
14353
14367
|
clearInterval(heartbeat);
|
|
14354
14368
|
heartbeat = null;
|
|
14355
14369
|
}
|
|
14370
|
+
if (partialLine) {
|
|
14371
|
+
if (streamedLines < MAX_STREAM_LINES) {
|
|
14372
|
+
process.stdout.write("\r" + source_default.dim(" \u2502 ") + partialLine + "\x1B[K\n");
|
|
14373
|
+
}
|
|
14374
|
+
partialLine = "";
|
|
14375
|
+
}
|
|
14356
14376
|
if (stats) {
|
|
14357
14377
|
if (result.error) stats.failCmds++;
|
|
14358
14378
|
else stats.successCmds++;
|
|
@@ -15941,7 +15961,7 @@ function clearCheckpoints(sessionId) {
|
|
|
15941
15961
|
|
|
15942
15962
|
// src/index.ts
|
|
15943
15963
|
var import_fs7 = require("fs");
|
|
15944
|
-
var VERSION2 = "2.3.
|
|
15964
|
+
var VERSION2 = "2.3.6";
|
|
15945
15965
|
var SKILLHUB_HUBS = {
|
|
15946
15966
|
bgi: { label: "BGI\u5185\u7F51", apiBase: "https://clawhub.ai", backend: "clawhub" },
|
|
15947
15967
|
clawhub: { label: "clawhub.ai", apiBase: "https://clawhub.ai", backend: "clawhub" },
|
|
@@ -17588,7 +17608,7 @@ async function main() {
|
|
|
17588
17608
|
});
|
|
17589
17609
|
let sigintHandling = false;
|
|
17590
17610
|
rl.on("close", () => {
|
|
17591
|
-
if (!sigintHandling) process.exit(0);
|
|
17611
|
+
if (!sigintHandling && !exiting) process.exit(0);
|
|
17592
17612
|
});
|
|
17593
17613
|
await firstRunIfNeeded(rl);
|
|
17594
17614
|
const cfg = loadConfig();
|
|
@@ -17702,7 +17722,6 @@ async function main() {
|
|
|
17702
17722
|
console.log(` \u6D88\u8017 Token: ${source_default.yellow("\u8F93\u5165")} ${source_default.bold(String(sessionStats.inputTokens))} | ${source_default.green("\u8F93\u51FA")} ${source_default.bold(String(sessionStats.outputTokens))}`);
|
|
17703
17723
|
console.log(` \u6267\u884C\u547D\u4EE4: ${source_default.green("\u2713 " + sessionStats.successCmds + " \u6210\u529F")} ${sessionStats.failCmds > 0 ? source_default.yellow("\u2717 " + sessionStats.failCmds + " \u5931\u8D25") : source_default.dim("\u2717 0 \u5931\u8D25")}`);
|
|
17704
17724
|
console.log(source_default.bold.cyan("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550"));
|
|
17705
|
-
rl.removeAllListeners("close");
|
|
17706
17725
|
rl.close();
|
|
17707
17726
|
let ans = "n";
|
|
17708
17727
|
try {
|
|
@@ -17763,6 +17782,7 @@ async function main() {
|
|
|
17763
17782
|
} catch {
|
|
17764
17783
|
break;
|
|
17765
17784
|
}
|
|
17785
|
+
if (exiting) break;
|
|
17766
17786
|
const trimmed = input.trim();
|
|
17767
17787
|
if (!trimmed) continue;
|
|
17768
17788
|
if (["exit", "quit", "q", "/exit", "/quit"].includes(trimmed.toLowerCase())) {
|