@bgicli/bgicli 2.2.15 → 2.2.16
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.
- package/dist/bgi.js +36 -16
- package/package.json +1 -1
package/dist/bgi.js
CHANGED
|
@@ -14261,15 +14261,32 @@ async function streamLoop(client, messages, model) {
|
|
|
14261
14261
|
const label = source_default.dim(`[\u5DE5\u5177: ${tc.name}(${summarizeArgs(args)})]`);
|
|
14262
14262
|
const t0 = Date.now();
|
|
14263
14263
|
process.stdout.write(`
|
|
14264
|
-
${label}
|
|
14265
|
-
`);
|
|
14264
|
+
${label} `);
|
|
14266
14265
|
let streamedLines = 0;
|
|
14267
14266
|
let lastLineWasEmpty = false;
|
|
14267
|
+
let spinnerCleared = false;
|
|
14268
14268
|
const MAX_STREAM_LINES = 200;
|
|
14269
|
-
let spin = null;
|
|
14270
14269
|
let frame = 0;
|
|
14270
|
+
const spin = setInterval(() => {
|
|
14271
|
+
if (spinnerCleared) return;
|
|
14272
|
+
const secs = ((Date.now() - t0) / 1e3).toFixed(1);
|
|
14273
|
+
process.stdout.write(
|
|
14274
|
+
`\r${label} ${source_default.cyan(SPIN_FRAMES[frame++ % SPIN_FRAMES.length])} ${source_default.dim(secs + "s")}`
|
|
14275
|
+
);
|
|
14276
|
+
}, 80);
|
|
14277
|
+
const clearSpinner = () => {
|
|
14278
|
+
if (spinnerCleared) return;
|
|
14279
|
+
spinnerCleared = true;
|
|
14280
|
+
clearInterval(spin);
|
|
14281
|
+
process.stdout.write("\r\x1B[2K");
|
|
14282
|
+
};
|
|
14271
14283
|
const onStream = isBash ? (chunk) => {
|
|
14272
14284
|
if (streamedLines >= MAX_STREAM_LINES) return;
|
|
14285
|
+
if (streamedLines === 0) {
|
|
14286
|
+
clearSpinner();
|
|
14287
|
+
process.stdout.write(`${label}
|
|
14288
|
+
`);
|
|
14289
|
+
}
|
|
14273
14290
|
const lines = chunk.split("\n");
|
|
14274
14291
|
for (let i2 = 0; i2 < lines.length; i2++) {
|
|
14275
14292
|
const line = lines[i2];
|
|
@@ -14289,19 +14306,8 @@ ${label}
|
|
|
14289
14306
|
}
|
|
14290
14307
|
}
|
|
14291
14308
|
} : void 0;
|
|
14292
|
-
if (!isBash) {
|
|
14293
|
-
spin = setInterval(() => {
|
|
14294
|
-
const secs = ((Date.now() - t0) / 1e3).toFixed(1);
|
|
14295
|
-
process.stdout.write(
|
|
14296
|
-
`\r ${source_default.cyan(SPIN_FRAMES[frame++ % SPIN_FRAMES.length])} ${source_default.dim(secs + "s")}`
|
|
14297
|
-
);
|
|
14298
|
-
}, 80);
|
|
14299
|
-
}
|
|
14300
14309
|
const result = await executeTool(tc.name, args, onStream);
|
|
14301
|
-
|
|
14302
|
-
clearInterval(spin);
|
|
14303
|
-
process.stdout.write("\r\x1B[2K");
|
|
14304
|
-
}
|
|
14310
|
+
clearSpinner();
|
|
14305
14311
|
const elapsed = ((Date.now() - t0) / 1e3).toFixed(1);
|
|
14306
14312
|
const doneIcon = result.error ? source_default.yellow("\u2717") : source_default.green("\u2713");
|
|
14307
14313
|
if (isBash && streamedLines > 0) {
|
|
@@ -15876,7 +15882,7 @@ function clearCheckpoints(sessionId) {
|
|
|
15876
15882
|
|
|
15877
15883
|
// src/index.ts
|
|
15878
15884
|
var import_fs7 = require("fs");
|
|
15879
|
-
var VERSION2 = "2.2.
|
|
15885
|
+
var VERSION2 = "2.2.16";
|
|
15880
15886
|
var SKILLHUB_HUBS = {
|
|
15881
15887
|
bgi: { label: "BGI\u5185\u7F51", apiBase: "https://clawhub.ai", backend: "clawhub" },
|
|
15882
15888
|
clawhub: { label: "clawhub.ai", apiBase: "https://clawhub.ai", backend: "clawhub" },
|
|
@@ -17548,6 +17554,20 @@ async function main() {
|
|
|
17548
17554
|
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"));
|
|
17549
17555
|
console.log();
|
|
17550
17556
|
let dbRegistry2 = loadDbRegistry();
|
|
17557
|
+
if (Object.keys(dbRegistry2.databases).length === 0) {
|
|
17558
|
+
process.stdout.write(source_default.dim(" \u6B63\u5728\u81EA\u52A8\u626B\u63CF\u53C2\u8003\u6570\u636E\u5E93...\n"));
|
|
17559
|
+
const report = scanForDatabases([]);
|
|
17560
|
+
if (report.found.length > 0) {
|
|
17561
|
+
for (const entry of report.found) dbRegistry2.databases[entry.id] = entry;
|
|
17562
|
+
dbRegistry2.lastScan = (/* @__PURE__ */ new Date()).toISOString();
|
|
17563
|
+
saveDbRegistry(dbRegistry2);
|
|
17564
|
+
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)
|
|
17565
|
+
`));
|
|
17566
|
+
} else {
|
|
17567
|
+
process.stdout.write(source_default.dim(" \u672A\u53D1\u73B0\u5DF2\u77E5\u6570\u636E\u5E93\uFF08\u53EF\u7528 /db add <\u8DEF\u5F84> \u624B\u52A8\u6DFB\u52A0\uFF09\n"));
|
|
17568
|
+
}
|
|
17569
|
+
console.log();
|
|
17570
|
+
}
|
|
17551
17571
|
let systemPrompt2 = buildSystemPrompt(buildDbPromptSection(dbRegistry2));
|
|
17552
17572
|
let history = [];
|
|
17553
17573
|
let thinkMode = false;
|