@toothfairyai/cli 1.0.11 → 1.0.12

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/bin/toothfairy.js +32 -10
  2. package/package.json +1 -1
package/bin/toothfairy.js CHANGED
@@ -322,7 +322,11 @@ program
322
322
  let currentSpinner = null;
323
323
 
324
324
  // Function to update display with status filtering
325
- const updateDisplay = (text, agentStatus, messageId, type = 'response') => {
325
+ const updateDisplay = (
326
+ text,
327
+ agentStatus,
328
+ type = 'response'
329
+ ) => {
326
330
  if (currentSpinner) {
327
331
  currentSpinner.stop();
328
332
  currentSpinner = null;
@@ -332,10 +336,14 @@ program
332
336
  if (text && type === 'response' && agentStatus === 'replying') {
333
337
  const trimmedText = text.trim();
334
338
  const now = Date.now();
335
-
339
+
336
340
  // Only update if the text is actually different and enough time has passed
337
341
  // This prevents rapid duplicate updates
338
- if (trimmedText !== currentText && (now - lastUpdateTime > 50)) {
342
+ if (
343
+ trimmedText !== currentText &&
344
+ trimmedText?.length > currentText?.length &&
345
+ now - lastUpdateTime > 50
346
+ ) {
339
347
  // For real-time streaming, we overwrite the current line
340
348
  process.stdout.write('\r\x1b[K'); // Clear current line
341
349
  process.stdout.write(chalk.green('🧚 Response: ') + trimmedText);
@@ -377,7 +385,9 @@ program
377
385
 
378
386
  if (eventData.status === 'complete') {
379
387
  if (options.showProgress) {
380
- console.log(chalk.green('\nšŸŽ‰ Stream completed successfully!'));
388
+ console.log(
389
+ chalk.green('\nšŸŽ‰ Stream completed successfully!')
390
+ );
381
391
  }
382
392
  return;
383
393
  }
@@ -414,7 +424,6 @@ program
414
424
  updateDisplay(
415
425
  eventData.text,
416
426
  agentStatus,
417
- eventData.message_id,
418
427
  'response'
419
428
  );
420
429
  }
@@ -429,12 +438,17 @@ program
429
438
  currentSpinner = null;
430
439
  }
431
440
  process.stdout.write('\r\x1b[K'); // Clear current line
432
- process.stdout.write(chalk.blue('šŸŖ„ ') + currentText.trim());
441
+ process.stdout.write(
442
+ chalk.blue('šŸŖ„ ') + currentText.trim()
443
+ );
433
444
  }
434
445
  }
435
446
 
436
447
  // Handle additional metadata events (images, files, callback metadata)
437
- if (eventData.images !== undefined || eventData.files !== undefined) {
448
+ if (
449
+ eventData.images !== undefined ||
450
+ eventData.files !== undefined
451
+ ) {
438
452
  // These are attachment events - could show notification if needed
439
453
  if (options.verbose) {
440
454
  console.log(chalk.dim('\nšŸ“Ž Attachments processed'));
@@ -444,7 +458,9 @@ program
444
458
  if (eventData.callbackMetadata) {
445
459
  // Function execution metadata
446
460
  if (options.verbose) {
447
- console.log(chalk.dim('\nāš™ļø Function execution metadata received'));
461
+ console.log(
462
+ chalk.dim('\nāš™ļø Function execution metadata received')
463
+ );
448
464
  }
449
465
  }
450
466
  }
@@ -481,9 +497,15 @@ program
481
497
  if (key === 'agent_processing_status') {
482
498
  console.log(chalk.cyan(`${key}:`), chalk.green(value));
483
499
  } else if (key === 'duration') {
484
- console.log(chalk.cyan(`${key}:`), chalk.yellow(`${value}s`));
500
+ console.log(
501
+ chalk.cyan(`${key}:`),
502
+ chalk.yellow(`${value}s`)
503
+ );
485
504
  } else if (key === 'sources' && Array.isArray(value)) {
486
- console.log(chalk.cyan(`${key}:`), value.length > 0 ? value.join(', ') : 'None');
505
+ console.log(
506
+ chalk.cyan(`${key}:`),
507
+ value.length > 0 ? value.join(', ') : 'None'
508
+ );
487
509
  } else {
488
510
  console.log(chalk.cyan(`${key}:`), String(value));
489
511
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toothfairyai/cli",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "Command-line interface for ToothFairy AI API",
5
5
  "main": "index.js",
6
6
  "bin": {