@bolloon/bolloon-agent 0.3.18 → 0.3.19
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/cli/loading-tui.js +6 -3
- package/dist/index.js +9 -38
- package/dist/web/client.js +4321 -4826
- package/dist/web/components/p2p/P2PModal.js +188 -0
- package/dist/web/components/p2p/index.js +276 -234
- package/dist/web/components/p2p/p2p-modal.js +664 -0
- package/dist/web/components/p2p/p2p-tools.js +248 -0
- package/dist/web/ui/message-renderer.js +535 -396
- package/dist/web/ui/step-timeline.js +371 -272
- package/package.json +1 -1
package/dist/cli/loading-tui.js
CHANGED
|
@@ -205,14 +205,17 @@ export function renderDashboard(opts) {
|
|
|
205
205
|
return lines.join('\n');
|
|
206
206
|
}
|
|
207
207
|
export function renderDialog(opts) {
|
|
208
|
-
const
|
|
208
|
+
const showBrand = opts.brand !== false;
|
|
209
|
+
const art = showBrand ? brandArtLines() : [];
|
|
209
210
|
const maxArt = art.reduce((m, l) => Math.max(m, dispWidth(l)), 0);
|
|
210
211
|
const inner = Math.max(40, maxArt, dispWidth(opts.prompt) + 4, dispWidth(opts.title ?? 'Bolloon Agent') + 4);
|
|
211
212
|
const width = Math.min(termWidth() - 2, opts.width ?? inner + 4);
|
|
212
213
|
const lines = [];
|
|
213
214
|
lines.push(boxTop(opts.title ?? 'Bolloon Agent', width));
|
|
214
|
-
|
|
215
|
-
|
|
215
|
+
if (showBrand) {
|
|
216
|
+
for (const l of art)
|
|
217
|
+
lines.push(boxRow(l, width, 'center'));
|
|
218
|
+
}
|
|
216
219
|
lines.push(boxRow(opts.prompt, width));
|
|
217
220
|
lines.push(boxBottom(width));
|
|
218
221
|
return lines.join('\n');
|
package/dist/index.js
CHANGED
|
@@ -361,14 +361,7 @@ const pendingQueue = [];
|
|
|
361
361
|
let cliStartTime = 0;
|
|
362
362
|
let cliModelName = '…';
|
|
363
363
|
let cliAgentName = '…';
|
|
364
|
-
let cliContextPct = 0;
|
|
365
|
-
function getTermHeight() {
|
|
366
|
-
return process.stdout.rows || 24;
|
|
367
|
-
}
|
|
368
|
-
function moveCursorToBottom(lines = 1) {
|
|
369
|
-
const height = getTermHeight();
|
|
370
|
-
process.stdout.write(`\x1b[${height - lines + 1};1H`);
|
|
371
|
-
}
|
|
364
|
+
let cliContextPct = 0;
|
|
372
365
|
function fmtDuration(ms) {
|
|
373
366
|
const s = Math.floor(ms / 1000);
|
|
374
367
|
const m = Math.floor(s / 60);
|
|
@@ -384,41 +377,21 @@ function statusBarLine() {
|
|
|
384
377
|
const barLen = 12;
|
|
385
378
|
const filled = Math.round((cliContextPct / 100) * barLen);
|
|
386
379
|
const bar = C_OK + '█'.repeat(filled) + C_DIM + '░'.repeat(barLen - filled) + RESET;
|
|
387
|
-
return `${
|
|
380
|
+
return `${C_ACCENT}${cliModelName}${RESET}${C_DIM} │${RESET} ${cliAgentName} ${C_DIM}│${RESET} ⏱ ${C_ACCENT}${dur}${RESET} ${C_DIM}│${RESET} ${bar} ${C_DIM}${cliContextPct}%${RESET}`;
|
|
388
381
|
}
|
|
389
382
|
function showBottomPrompt() {
|
|
390
383
|
if (!isRunning)
|
|
391
384
|
return;
|
|
392
385
|
promptVisible = true;
|
|
393
|
-
process.stdout.
|
|
394
|
-
|
|
395
|
-
// 第 1 行: 状态栏 (从屏幕底上数第 2 行)
|
|
396
|
-
process.stdout.write(CLEAR_LINE + statusBarLine() + '\n');
|
|
397
|
-
// 第 2 行: 输入框
|
|
398
|
-
process.stdout.write(CLEAR_LINE);
|
|
386
|
+
const tw = process.stdout.columns || 80;
|
|
387
|
+
const sep = C_DIM + '─'.repeat(tw) + RESET;
|
|
399
388
|
const hint = currentInput.length === 0 && !queueMode
|
|
400
389
|
? ` ${C_DIM}!cmd${RESET} ${C_DIM}/queue${RESET} ${C_DIM}/help${RESET}`
|
|
401
390
|
: queueMode ? ` ${C_WARN}[队列${pendingQueue.length}]${RESET}` : '';
|
|
402
391
|
const prefix = queueMode ? `${C_WARN}▸${RESET}` : `${C_ACCENT}❯${RESET}`;
|
|
403
|
-
|
|
404
|
-
process.stdout.write(`${C_DIM}${'─'.repeat(tw)}${RESET}\n`);
|
|
405
|
-
process.stdout.write(`${prefix} ${currentInput}${hint}${HIDE_CURSOR_SEQ}`);
|
|
406
|
-
process.stdout.write(`\n${C_DIM}${'─'.repeat(tw)}${RESET}`);
|
|
407
|
-
process.stdout.write(RESTORE_CURSOR);
|
|
392
|
+
process.stdout.write(`\n${sep}\n${statusBarLine()}\n${sep}\n${C_DIM}${'─'.repeat(tw)}${RESET}\n${prefix} ${currentInput}${hint}`);
|
|
408
393
|
}
|
|
409
394
|
function clearPromptLine() {
|
|
410
|
-
if (!promptVisible)
|
|
411
|
-
return;
|
|
412
|
-
process.stdout.write(SAVE_CURSOR);
|
|
413
|
-
moveCursorToBottom(4);
|
|
414
|
-
process.stdout.write(CLEAR_LINE);
|
|
415
|
-
process.stdout.write('\n');
|
|
416
|
-
process.stdout.write(CLEAR_LINE);
|
|
417
|
-
process.stdout.write('\n');
|
|
418
|
-
process.stdout.write(CLEAR_LINE);
|
|
419
|
-
process.stdout.write('\n');
|
|
420
|
-
process.stdout.write(CLEAR_LINE);
|
|
421
|
-
process.stdout.write(RESTORE_CURSOR);
|
|
422
395
|
promptVisible = false;
|
|
423
396
|
}
|
|
424
397
|
function startCLI(comm) {
|
|
@@ -461,6 +434,7 @@ function startCLI(comm) {
|
|
|
461
434
|
: '未配置';
|
|
462
435
|
process.stdout.write(renderDashboard({
|
|
463
436
|
title: '系统状态',
|
|
437
|
+
brand: false,
|
|
464
438
|
rows: [
|
|
465
439
|
{ label: 'LLM Provider', status: llmName === '未配置' ? 'warn' : 'ok', detail: llmName },
|
|
466
440
|
{ label: 'P2P 节点', status: peerCount > 0 ? 'ok' : 'warn', detail: `${peerCount} 个` },
|
|
@@ -469,17 +443,15 @@ function startCLI(comm) {
|
|
|
469
443
|
}) + '\n');
|
|
470
444
|
process.stdout.write(renderDialog({
|
|
471
445
|
title: 'Bolloon Agent',
|
|
446
|
+
brand: false,
|
|
472
447
|
prompt: '输入消息开始对话 · 输入 help 查看命令',
|
|
473
448
|
}) + '\n');
|
|
474
449
|
showBottomPrompt();
|
|
475
|
-
const promptTimer = setInterval(() => {
|
|
476
|
-
if (isRunning && promptVisible) {
|
|
477
|
-
showBottomPrompt();
|
|
478
|
-
}
|
|
479
|
-
}, 500);
|
|
480
450
|
const handleInput = (chunk, key) => {
|
|
481
451
|
if (!isRunning)
|
|
482
452
|
return;
|
|
453
|
+
if (!key)
|
|
454
|
+
return;
|
|
483
455
|
if (key.ctrl && key.name === 'c') {
|
|
484
456
|
clearPromptLine();
|
|
485
457
|
process.stdout.write(`\n${CYAN}👋 再见!${RESET}\n`);
|
|
@@ -487,7 +459,6 @@ function startCLI(comm) {
|
|
|
487
459
|
process.stdin.setRawMode(false);
|
|
488
460
|
}
|
|
489
461
|
catch { }
|
|
490
|
-
clearInterval(promptTimer);
|
|
491
462
|
process.exit(0);
|
|
492
463
|
return;
|
|
493
464
|
}
|