@bgicli/bgicli 2.3.0 → 2.3.2

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 +24 -11
  2. package/package.json +1 -1
package/dist/bgi.js CHANGED
@@ -15910,7 +15910,7 @@ function clearCheckpoints(sessionId) {
15910
15910
 
15911
15911
  // src/index.ts
15912
15912
  var import_fs7 = require("fs");
15913
- var VERSION2 = "2.3.0";
15913
+ var VERSION2 = "2.3.2";
15914
15914
  var SKILLHUB_HUBS = {
15915
15915
  bgi: { label: "BGI\u5185\u7F51", apiBase: "https://clawhub.ai", backend: "clawhub" },
15916
15916
  clawhub: { label: "clawhub.ai", apiBase: "https://clawhub.ai", backend: "clawhub" },
@@ -16051,6 +16051,8 @@ var SESSION_CTX = {
16051
16051
  createdAt: "",
16052
16052
  wdirSnapshot: null
16053
16053
  };
16054
+ var dbRegistry = { version: 1, lastScan: null, databases: {} };
16055
+ var systemPrompt = "";
16054
16056
  function installBundledData() {
16055
16057
  const bundledData = (0, import_path6.join)(__dirname, "..", "data");
16056
16058
  if (!(0, import_fs6.existsSync)(bundledData)) return;
@@ -17553,8 +17555,9 @@ async function main() {
17553
17555
  terminal: true,
17554
17556
  historySize: 100
17555
17557
  });
17558
+ let sigintHandling = false;
17556
17559
  rl.on("close", () => {
17557
- process.exit(0);
17560
+ if (!sigintHandling) process.exit(0);
17558
17561
  });
17559
17562
  await firstRunIfNeeded(rl);
17560
17563
  const cfg = loadConfig();
@@ -17579,14 +17582,14 @@ async function main() {
17579
17582
  }
17580
17583
  console.log(source_default.dim(" \u8F93\u5165\u95EE\u9898\u5F00\u59CB\u5BF9\u8BDD /help \u67E5\u770B\u547D\u4EE4 /cat \u6280\u80FD\u5206\u7C7B @\u6587\u4EF6\u8DEF\u5F84 \u5185\u5D4C\u6587\u4EF6"));
17581
17584
  console.log();
17582
- let dbRegistry2 = loadDbRegistry();
17583
- if (Object.keys(dbRegistry2.databases).length === 0) {
17585
+ dbRegistry = loadDbRegistry();
17586
+ if (Object.keys(dbRegistry.databases).length === 0) {
17584
17587
  process.stdout.write(source_default.dim(" \u6B63\u5728\u81EA\u52A8\u626B\u63CF\u53C2\u8003\u6570\u636E\u5E93...\n"));
17585
17588
  const report = scanForDatabases([]);
17586
17589
  if (report.found.length > 0) {
17587
- for (const entry of report.found) dbRegistry2.databases[entry.id] = entry;
17588
- dbRegistry2.lastScan = (/* @__PURE__ */ new Date()).toISOString();
17589
- saveDbRegistry(dbRegistry2);
17590
+ for (const entry of report.found) dbRegistry.databases[entry.id] = entry;
17591
+ dbRegistry.lastScan = (/* @__PURE__ */ new Date()).toISOString();
17592
+ saveDbRegistry(dbRegistry);
17590
17593
  process.stdout.write(source_default.green(` \u2713 \u53D1\u73B0 ${report.found.length} \u4E2A\u6570\u636E\u5E93\uFF0C\u5DF2\u81EA\u52A8\u6CE8\u518C (/db list \u67E5\u770B)
17591
17594
  `));
17592
17595
  } else {
@@ -17594,7 +17597,7 @@ async function main() {
17594
17597
  }
17595
17598
  console.log();
17596
17599
  }
17597
- let systemPrompt2 = buildSystemPrompt(buildDbPromptSection(dbRegistry2));
17600
+ systemPrompt = buildSystemPrompt(buildDbPromptSection(dbRegistry));
17598
17601
  let history = [];
17599
17602
  let thinkMode = false;
17600
17603
  const injectedSkills = /* @__PURE__ */ new Map();
@@ -17674,18 +17677,28 @@ async function main() {
17674
17677
  console.log(source_default.dim("\n\u518D\u89C1\uFF01"));
17675
17678
  process.exit(0);
17676
17679
  }
17677
- process.on("SIGINT", () => {
17680
+ let lastSigintCall = 0;
17681
+ function handleSigint() {
17678
17682
  const now = Date.now();
17683
+ if (now - lastSigintCall < 200) return;
17684
+ lastSigintCall = now;
17679
17685
  if (now - lastSigintTime < 2e3) {
17686
+ sigintHandling = false;
17680
17687
  exitWithReport().catch(() => process.exit(0));
17681
17688
  } else {
17682
17689
  lastSigintTime = now;
17690
+ sigintHandling = true;
17683
17691
  if (currentAbortController) {
17684
17692
  currentAbortController.abort();
17685
17693
  }
17686
17694
  process.stdout.write(source_default.yellow("\n\n [\u4EFB\u52A1\u5DF2\u4E2D\u65AD] \u518D\u6309\u4E00\u6B21 Ctrl+C \u9000\u51FA\n\n"));
17695
+ setTimeout(() => {
17696
+ sigintHandling = false;
17697
+ }, 500);
17687
17698
  }
17688
- });
17699
+ }
17700
+ rl.on("SIGINT", handleSigint);
17701
+ process.on("SIGINT", handleSigint);
17689
17702
  while (true) {
17690
17703
  let input;
17691
17704
  const thinkIndicator = thinkMode ? source_default.yellow("[\u601D\u8003]") + " " : "";
@@ -17755,7 +17768,7 @@ ${expanded}` : expanded;
17755
17768
  try {
17756
17769
  const currentCfg = loadConfig();
17757
17770
  currentAbortController = new AbortController();
17758
- const reply = await chat(history, currentCfg, systemPrompt2, sessionStats, currentAbortController.signal);
17771
+ const reply = await chat(history, currentCfg, systemPrompt, sessionStats, currentAbortController.signal);
17759
17772
  currentAbortController = null;
17760
17773
  if (!reply && history[history.length - 1]?.role === "user") {
17761
17774
  history.pop();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bgicli/bgicli",
3
- "version": "2.3.0",
3
+ "version": "2.3.2",
4
4
  "description": "BGI CLI — Bioinformatics AI terminal for Chinese researchers (百炼/DeepSeek/Kimi/Qwen)",
5
5
  "bin": {
6
6
  "bgi": "dist/bgi.js"