@bgicli/bgicli 2.3.3 → 2.3.5

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 +29 -4
  2. package/package.json +1 -1
package/dist/bgi.js CHANGED
@@ -15941,7 +15941,7 @@ function clearCheckpoints(sessionId) {
15941
15941
 
15942
15942
  // src/index.ts
15943
15943
  var import_fs7 = require("fs");
15944
- var VERSION2 = "2.3.3";
15944
+ var VERSION2 = "2.3.5";
15945
15945
  var SKILLHUB_HUBS = {
15946
15946
  bgi: { label: "BGI\u5185\u7F51", apiBase: "https://clawhub.ai", backend: "clawhub" },
15947
15947
  clawhub: { label: "clawhub.ai", apiBase: "https://clawhub.ai", backend: "clawhub" },
@@ -17588,7 +17588,7 @@ async function main() {
17588
17588
  });
17589
17589
  let sigintHandling = false;
17590
17590
  rl.on("close", () => {
17591
- if (!sigintHandling) process.exit(0);
17591
+ if (!sigintHandling && !exiting) process.exit(0);
17592
17592
  });
17593
17593
  await firstRunIfNeeded(rl);
17594
17594
  const cfg = loadConfig();
@@ -17694,17 +17694,41 @@ async function main() {
17694
17694
  async function exitWithReport() {
17695
17695
  if (exiting) return;
17696
17696
  exiting = true;
17697
+ rl.removeAllListeners("SIGINT");
17698
+ process.removeAllListeners("SIGINT");
17697
17699
  const runtime = formatDuration(Date.now() - sessionStartTime);
17698
17700
  console.log("\n" + source_default.bold.cyan("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 \u4F1A\u8BDD\u62A5\u544A \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550"));
17699
17701
  console.log(` \u8FD0\u884C\u65F6\u95F4: ${source_default.white(runtime)}`);
17700
17702
  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))}`);
17701
17703
  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")}`);
17702
17704
  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.close();
17706
+ let ans = "n";
17703
17707
  try {
17704
- const ans = await question(rl, source_default.cyan("\n \u662F\u5426\u4FDD\u5B58\u672C\u6B21\u4F1A\u8BDD\u8BB0\u5FC6\uFF1F[y/N] "));
17705
- if (ans.trim().toLowerCase() === "y") saveSessionMemory();
17708
+ const exitRl = (0, import_readline.createInterface)({ input: process.stdin, output: process.stdout });
17709
+ exitRl.on("SIGINT", () => {
17710
+ exitRl.close();
17711
+ process.exit(0);
17712
+ });
17713
+ process.once("SIGINT", () => {
17714
+ exitRl.close();
17715
+ process.exit(0);
17716
+ });
17717
+ ans = await Promise.race([
17718
+ new Promise((res) => {
17719
+ exitRl.question(source_default.cyan("\n \u662F\u5426\u4FDD\u5B58\u672C\u6B21\u4F1A\u8BDD\u8BB0\u5FC6\uFF1F[y/N] "), (a2) => {
17720
+ exitRl.close();
17721
+ res(a2.trim().toLowerCase());
17722
+ });
17723
+ }),
17724
+ new Promise((res) => setTimeout(() => {
17725
+ exitRl.close();
17726
+ res("n");
17727
+ }, 15e3))
17728
+ ]);
17706
17729
  } catch {
17707
17730
  }
17731
+ if (ans === "y") saveSessionMemory();
17708
17732
  console.log(source_default.dim("\n\u518D\u89C1\uFF01"));
17709
17733
  process.exit(0);
17710
17734
  }
@@ -17738,6 +17762,7 @@ async function main() {
17738
17762
  } catch {
17739
17763
  break;
17740
17764
  }
17765
+ if (exiting) break;
17741
17766
  const trimmed = input.trim();
17742
17767
  if (!trimmed) continue;
17743
17768
  if (["exit", "quit", "q", "/exit", "/quit"].includes(trimmed.toLowerCase())) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bgicli/bgicli",
3
- "version": "2.3.3",
3
+ "version": "2.3.5",
4
4
  "description": "BGI CLI — Bioinformatics AI terminal for Chinese researchers (百炼/DeepSeek/Kimi/Qwen)",
5
5
  "bin": {
6
6
  "bgi": "dist/bgi.js"