@bgicli/bgicli 2.3.5 → 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.
Files changed (2) hide show
  1. package/dist/bgi.js +37 -17
  2. 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 >= MAX_STREAM_LINES) return;
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
- 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;
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
- 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;
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.5";
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" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bgicli/bgicli",
3
- "version": "2.3.5",
3
+ "version": "2.3.6",
4
4
  "description": "BGI CLI — Bioinformatics AI terminal for Chinese researchers (百炼/DeepSeek/Kimi/Qwen)",
5
5
  "bin": {
6
6
  "bgi": "dist/bgi.js"