@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.
- package/bin/toothfairy.js +32 -10
- 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 = (
|
|
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 (
|
|
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(
|
|
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(
|
|
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 (
|
|
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(
|
|
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(
|
|
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(
|
|
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
|
}
|