@bolloon/bolloon-agent 0.3.18 → 0.3.20

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.
@@ -205,14 +205,17 @@ export function renderDashboard(opts) {
205
205
  return lines.join('\n');
206
206
  }
207
207
  export function renderDialog(opts) {
208
- const art = brandArtLines();
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
- for (const l of art)
215
- lines.push(boxRow(l, width, 'center'));
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
@@ -15,7 +15,7 @@ import { createSubAgentManager } from './agents/subagent-manager.js';
15
15
  import { getGlobalSharedContext } from './social/global-shared-context.js';
16
16
  import { createBollharnessIntegration } from './bollharness-integration/index.js';
17
17
  import * as readline from 'readline';
18
- import { printBanner, renderDashboard, renderDialog, renderUserMessage, renderAgentMessage, renderToolCall, flowConnector, termWidth } from './cli/loading-tui.js';
18
+ import { printBanner, renderDialog, renderUserMessage, renderAgentMessage, renderToolCall, flowConnector, termWidth } from './cli/loading-tui.js';
19
19
  // 启动自动检查更新:后台、节流、检测到新版本自动安装(可被 --no-update / BOLLOON_SKIP_UPDATE 关闭)
20
20
  import { createRequire } from 'module';
21
21
  const _require = createRequire(import.meta.url);
@@ -361,14 +361,7 @@ const pendingQueue = [];
361
361
  let cliStartTime = 0;
362
362
  let cliModelName = '…';
363
363
  let cliAgentName = '…';
364
- let cliContextPct = 0; // 0-100
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 `${C_DIM}${C_ACCENT}${cliModelName}${RESET}${C_DIM} │${RESET} ${cliAgentName} ${C_DIM}│${RESET} ⏱ ${C_ACCENT}${dur}${RESET} ${C_DIM}│${RESET} ${bar} ${C_DIM}${cliContextPct}%${RESET}`;
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.write(SAVE_CURSOR);
394
- moveCursorToBottom(2);
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
- const tw = process.stdout.columns || 80;
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) {
@@ -454,32 +427,13 @@ function startCLI(comm) {
454
427
  cliModelName = foundProvider ? foundProvider[1] : '未配置';
455
428
  cliAgentName = agentIdentity?.name || 'bolloon';
456
429
  cliStartTime = Date.now();
457
- const llmName = process.env.MINIMAX_API_KEY ? 'MiniMax'
458
- : process.env.OPENAI_API_KEY ? 'OpenAI'
459
- : process.env.ANTHROPIC_API_KEY ? 'Anthropic'
460
- : process.env.DEEPSEEK_API_KEY ? 'DeepSeek'
461
- : '未配置';
462
- process.stdout.write(renderDashboard({
463
- title: '系统状态',
464
- rows: [
465
- { label: 'LLM Provider', status: llmName === '未配置' ? 'warn' : 'ok', detail: llmName },
466
- { label: 'P2P 节点', status: peerCount > 0 ? 'ok' : 'warn', detail: `${peerCount} 个` },
467
- { label: '输入方式', status: 'info', detail: '底部对话框' },
468
- ],
469
- }) + '\n');
470
- process.stdout.write(renderDialog({
471
- title: 'Bolloon Agent',
472
- prompt: '输入消息开始对话 · 输入 help 查看命令',
473
- }) + '\n');
430
+ process.stdout.write(`${C_DIM}Bolloon CLI ready. 输入 !cmd /queue /help${RESET}\n\n`);
474
431
  showBottomPrompt();
475
- const promptTimer = setInterval(() => {
476
- if (isRunning && promptVisible) {
477
- showBottomPrompt();
478
- }
479
- }, 500);
480
432
  const handleInput = (chunk, key) => {
481
433
  if (!isRunning)
482
434
  return;
435
+ if (!key)
436
+ return;
483
437
  if (key.ctrl && key.name === 'c') {
484
438
  clearPromptLine();
485
439
  process.stdout.write(`\n${CYAN}👋 再见!${RESET}\n`);
@@ -487,7 +441,6 @@ function startCLI(comm) {
487
441
  process.stdin.setRawMode(false);
488
442
  }
489
443
  catch { }
490
- clearInterval(promptTimer);
491
444
  process.exit(0);
492
445
  return;
493
446
  }