@bgicli/bgicli 2.3.5 → 2.3.7
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 +46 -25
- package/package.json +1 -1
package/dist/bgi.js
CHANGED
|
@@ -13855,7 +13855,7 @@ var TOOL_DEFINITIONS = [
|
|
|
13855
13855
|
},
|
|
13856
13856
|
timeout_ms: {
|
|
13857
13857
|
type: "number",
|
|
13858
|
-
description: "Timeout in milliseconds (default 300000 / 5 min
|
|
13858
|
+
description: "Timeout in milliseconds (default 300000 / 5 min). For downloads (wget/curl/aria2c) or long computations (STAR, HISAT2, etc.) ALWAYS use at least 3600000 (60 min). Never set a short timeout for downloads \u2014 slow networks are normal, be patient."
|
|
13859
13859
|
}
|
|
13860
13860
|
},
|
|
13861
13861
|
required: ["command"]
|
|
@@ -13959,13 +13959,14 @@ var TOOL_DEFINITIONS = [
|
|
|
13959
13959
|
async function executeTool(name, args, onStream) {
|
|
13960
13960
|
try {
|
|
13961
13961
|
switch (name) {
|
|
13962
|
-
case "bash":
|
|
13963
|
-
|
|
13964
|
-
|
|
13965
|
-
|
|
13966
|
-
|
|
13967
|
-
|
|
13968
|
-
);
|
|
13962
|
+
case "bash": {
|
|
13963
|
+
const cmd = args["command"];
|
|
13964
|
+
let timeoutMs = args["timeout_ms"] ?? 3e5;
|
|
13965
|
+
if (/\b(wget|curl|aria2c|axel|rsync)\b/.test(cmd) && timeoutMs < 36e5) {
|
|
13966
|
+
timeoutMs = 36e5;
|
|
13967
|
+
}
|
|
13968
|
+
return await toolBash(cmd, args["workdir"], timeoutMs, onStream);
|
|
13969
|
+
}
|
|
13969
13970
|
case "read_file":
|
|
13970
13971
|
return toolReadFile(
|
|
13971
13972
|
args["path"],
|
|
@@ -14297,6 +14298,7 @@ ${label} `);
|
|
|
14297
14298
|
let streamedLines = 0;
|
|
14298
14299
|
let lastLineWasEmpty = false;
|
|
14299
14300
|
let spinnerCleared = false;
|
|
14301
|
+
let partialLine = "";
|
|
14300
14302
|
const MAX_STREAM_LINES = 200;
|
|
14301
14303
|
let frame = 0;
|
|
14302
14304
|
const spin = setInterval(() => {
|
|
@@ -14316,8 +14318,7 @@ ${label} `);
|
|
|
14316
14318
|
let heartbeat = null;
|
|
14317
14319
|
const onStream = isBash ? (chunk) => {
|
|
14318
14320
|
lastChunkTime = Date.now();
|
|
14319
|
-
if (streamedLines
|
|
14320
|
-
if (streamedLines === 0) {
|
|
14321
|
+
if (streamedLines === 0 && partialLine.length === 0) {
|
|
14321
14322
|
clearSpinner();
|
|
14322
14323
|
process.stdout.write(`${label}
|
|
14323
14324
|
`);
|
|
@@ -14329,22 +14330,36 @@ ${label} `);
|
|
|
14329
14330
|
}
|
|
14330
14331
|
}, 5e3);
|
|
14331
14332
|
}
|
|
14332
|
-
|
|
14333
|
-
|
|
14334
|
-
const
|
|
14335
|
-
|
|
14336
|
-
|
|
14337
|
-
|
|
14338
|
-
|
|
14339
|
-
|
|
14333
|
+
let i2 = 0;
|
|
14334
|
+
while (i2 < chunk.length) {
|
|
14335
|
+
const crPos = chunk.indexOf("\r", i2);
|
|
14336
|
+
const nlPos = chunk.indexOf("\n", i2);
|
|
14337
|
+
if (crPos === -1 && nlPos === -1) {
|
|
14338
|
+
partialLine += chunk.slice(i2);
|
|
14339
|
+
process.stdout.write("\r" + source_default.dim(" \u2502 ") + partialLine + "\x1B[K");
|
|
14340
|
+
break;
|
|
14340
14341
|
}
|
|
14341
|
-
|
|
14342
|
-
|
|
14343
|
-
|
|
14344
|
-
|
|
14345
|
-
|
|
14346
|
-
|
|
14342
|
+
const nextPos = crPos === -1 ? nlPos : nlPos === -1 ? crPos : Math.min(crPos, nlPos);
|
|
14343
|
+
const isCR = chunk[nextPos] === "\r";
|
|
14344
|
+
partialLine += chunk.slice(i2, nextPos);
|
|
14345
|
+
if (isCR) {
|
|
14346
|
+
process.stdout.write("\r" + source_default.dim(" \u2502 ") + partialLine + "\x1B[K");
|
|
14347
|
+
partialLine = "";
|
|
14348
|
+
i2 = nextPos + 1;
|
|
14349
|
+
if (i2 < chunk.length && chunk[i2] === "\n") i2++;
|
|
14350
|
+
} else {
|
|
14351
|
+
if (partialLine.trim() !== "" || !lastLineWasEmpty) {
|
|
14352
|
+
if (streamedLines < MAX_STREAM_LINES) {
|
|
14353
|
+
process.stdout.write("\r" + source_default.dim(" \u2502 ") + partialLine + "\x1B[K\n");
|
|
14354
|
+
lastLineWasEmpty = partialLine.trim() === "";
|
|
14355
|
+
streamedLines++;
|
|
14356
|
+
if (streamedLines >= MAX_STREAM_LINES) {
|
|
14357
|
+
process.stdout.write(source_default.dim(" \u2502 ... (\u8F93\u51FA\u8FC7\u957F\uFF0C\u5DF2\u622A\u65AD)\n"));
|
|
14358
|
+
}
|
|
14359
|
+
}
|
|
14347
14360
|
}
|
|
14361
|
+
partialLine = "";
|
|
14362
|
+
i2 = nextPos + 1;
|
|
14348
14363
|
}
|
|
14349
14364
|
}
|
|
14350
14365
|
} : void 0;
|
|
@@ -14353,6 +14368,12 @@ ${label} `);
|
|
|
14353
14368
|
clearInterval(heartbeat);
|
|
14354
14369
|
heartbeat = null;
|
|
14355
14370
|
}
|
|
14371
|
+
if (partialLine) {
|
|
14372
|
+
if (streamedLines < MAX_STREAM_LINES) {
|
|
14373
|
+
process.stdout.write("\r" + source_default.dim(" \u2502 ") + partialLine + "\x1B[K\n");
|
|
14374
|
+
}
|
|
14375
|
+
partialLine = "";
|
|
14376
|
+
}
|
|
14356
14377
|
if (stats) {
|
|
14357
14378
|
if (result.error) stats.failCmds++;
|
|
14358
14379
|
else stats.successCmds++;
|
|
@@ -15941,7 +15962,7 @@ function clearCheckpoints(sessionId) {
|
|
|
15941
15962
|
|
|
15942
15963
|
// src/index.ts
|
|
15943
15964
|
var import_fs7 = require("fs");
|
|
15944
|
-
var VERSION2 = "2.3.
|
|
15965
|
+
var VERSION2 = "2.3.7";
|
|
15945
15966
|
var SKILLHUB_HUBS = {
|
|
15946
15967
|
bgi: { label: "BGI\u5185\u7F51", apiBase: "https://clawhub.ai", backend: "clawhub" },
|
|
15947
15968
|
clawhub: { label: "clawhub.ai", apiBase: "https://clawhub.ai", backend: "clawhub" },
|