@bgicli/bgicli 2.3.2 → 2.3.3

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 +34 -3
  2. package/package.json +1 -1
package/dist/bgi.js CHANGED
@@ -14006,6 +14006,15 @@ function decodeBuffer(buf) {
14006
14006
  }
14007
14007
  }
14008
14008
  }
14009
+ function injectProgressFlags(cmd) {
14010
+ if (/\bwget\b/.test(cmd) && !/-q\b|--quiet|--show-progress|--progress/.test(cmd)) {
14011
+ cmd = cmd.replace(/\bwget\b/, "wget --show-progress");
14012
+ }
14013
+ if (/\bcurl\b/.test(cmd) && !/-s\b|--silent|-S\b|-#|--progress-bar|--no-progress-meter/.test(cmd)) {
14014
+ cmd = cmd.replace(/\bcurl\b/, "curl --progress-bar");
14015
+ }
14016
+ return cmd;
14017
+ }
14009
14018
  async function toolBash(command, workdir, timeoutMs = 3e5, onStream) {
14010
14019
  const scan = scanCommand(command);
14011
14020
  const criticals = scan.matches.filter((m2) => m2.pattern.level === "CRITICAL");
@@ -14023,11 +14032,19 @@ async function toolBash(command, workdir, timeoutMs = 3e5, onStream) {
14023
14032
  if (onStream) onStream(`\u26A0 \u5B89\u5168\u8B66\u544A [HIGH]: ${reasons}
14024
14033
  `);
14025
14034
  }
14035
+ const processedCommand = injectProgressFlags(command);
14026
14036
  return new Promise((resolve4) => {
14027
14037
  const isWin = process.platform === "win32";
14028
- const child = (0, import_child_process.spawn)(isWin ? "cmd" : "/bin/sh", isWin ? ["/c", command] : ["-c", command], {
14038
+ const child = (0, import_child_process.spawn)(isWin ? "cmd" : "/bin/sh", isWin ? ["/c", processedCommand] : ["-c", processedCommand], {
14029
14039
  cwd: workdir ?? process.cwd(),
14030
- env: { ...process.env, PYTHONIOENCODING: "utf-8" },
14040
+ env: {
14041
+ ...process.env,
14042
+ PYTHONIOENCODING: "utf-8",
14043
+ PYTHONUNBUFFERED: "1",
14044
+ // prevent Python stdout buffering
14045
+ FORCE_COLOR: "1"
14046
+ // hint color support to tools that check
14047
+ },
14031
14048
  stdio: ["pipe", "pipe", "pipe"]
14032
14049
  });
14033
14050
  const outChunks = [];
@@ -14295,12 +14312,22 @@ ${label} `);
14295
14312
  clearInterval(spin);
14296
14313
  process.stdout.write("\r\x1B[2K");
14297
14314
  };
14315
+ let lastChunkTime = t0;
14316
+ let heartbeat = null;
14298
14317
  const onStream = isBash ? (chunk) => {
14318
+ lastChunkTime = Date.now();
14299
14319
  if (streamedLines >= MAX_STREAM_LINES) return;
14300
14320
  if (streamedLines === 0) {
14301
14321
  clearSpinner();
14302
14322
  process.stdout.write(`${label}
14303
14323
  `);
14324
+ heartbeat = setInterval(() => {
14325
+ if (Date.now() - lastChunkTime >= 5e3) {
14326
+ const totalSecs = ((Date.now() - t0) / 1e3).toFixed(0);
14327
+ process.stdout.write(source_default.dim(`
14328
+ \u2502 \u23F1 \u8FD0\u884C\u4E2D... ${totalSecs}s`));
14329
+ }
14330
+ }, 5e3);
14304
14331
  }
14305
14332
  const lines = chunk.split("\n");
14306
14333
  for (let i2 = 0; i2 < lines.length; i2++) {
@@ -14322,6 +14349,10 @@ ${label} `);
14322
14349
  }
14323
14350
  } : void 0;
14324
14351
  const result = await executeTool(tc.name, args, onStream);
14352
+ if (heartbeat) {
14353
+ clearInterval(heartbeat);
14354
+ heartbeat = null;
14355
+ }
14325
14356
  if (stats) {
14326
14357
  if (result.error) stats.failCmds++;
14327
14358
  else stats.successCmds++;
@@ -15910,7 +15941,7 @@ function clearCheckpoints(sessionId) {
15910
15941
 
15911
15942
  // src/index.ts
15912
15943
  var import_fs7 = require("fs");
15913
- var VERSION2 = "2.3.2";
15944
+ var VERSION2 = "2.3.3";
15914
15945
  var SKILLHUB_HUBS = {
15915
15946
  bgi: { label: "BGI\u5185\u7F51", apiBase: "https://clawhub.ai", backend: "clawhub" },
15916
15947
  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.2",
3
+ "version": "2.3.3",
4
4
  "description": "BGI CLI — Bioinformatics AI terminal for Chinese researchers (百炼/DeepSeek/Kimi/Qwen)",
5
5
  "bin": {
6
6
  "bgi": "dist/bgi.js"