@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.
Files changed (2) hide show
  1. package/dist/bgi.js +46 -25
  2. 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, max 1800000 / 30 min for long jobs like STAR alignment)"
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
- return await toolBash(
13964
- args["command"],
13965
- args["workdir"],
13966
- args["timeout_ms"] ?? 3e5,
13967
- onStream
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 >= MAX_STREAM_LINES) return;
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
- const lines = chunk.split("\n");
14333
- for (let i2 = 0; i2 < lines.length; i2++) {
14334
- const line = lines[i2];
14335
- if (line.trim() === "") {
14336
- if (lastLineWasEmpty) continue;
14337
- lastLineWasEmpty = true;
14338
- } else {
14339
- lastLineWasEmpty = false;
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
- if (i2 < lines.length - 1 || line.length > 0) {
14342
- process.stdout.write(source_default.dim(" \u2502 ") + line + (i2 < lines.length - 1 ? "\n" : ""));
14343
- streamedLines++;
14344
- if (streamedLines >= MAX_STREAM_LINES) {
14345
- process.stdout.write(source_default.dim("\n \u2502 ... (\u8F93\u51FA\u8FC7\u957F\uFF0C\u5DF2\u622A\u65AD)\n"));
14346
- break;
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.5";
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" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bgicli/bgicli",
3
- "version": "2.3.5",
3
+ "version": "2.3.7",
4
4
  "description": "BGI CLI — Bioinformatics AI terminal for Chinese researchers (百炼/DeepSeek/Kimi/Qwen)",
5
5
  "bin": {
6
6
  "bgi": "dist/bgi.js"