@tritard/waterbrother 0.8.15 → 0.8.17
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/package.json +1 -1
- package/src/cli.js +23 -8
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -673,6 +673,13 @@ function createProgressSpinner(initialLabel = "thinking...") {
|
|
|
673
673
|
let label = initialLabel;
|
|
674
674
|
let frameIndex = 0;
|
|
675
675
|
let stopped = false;
|
|
676
|
+
const renderLabel = () => {
|
|
677
|
+
if (typeof label === "function") {
|
|
678
|
+
const next = label();
|
|
679
|
+
return String(next || "");
|
|
680
|
+
}
|
|
681
|
+
return String(label || "");
|
|
682
|
+
};
|
|
676
683
|
const clearLine = () => {
|
|
677
684
|
process.stdout.write("\r\x1b[2K");
|
|
678
685
|
};
|
|
@@ -686,7 +693,7 @@ function createProgressSpinner(initialLabel = "thinking...") {
|
|
|
686
693
|
const bar = renderFlowingBar(frameIndex, 14);
|
|
687
694
|
frameIndex += 1;
|
|
688
695
|
clearLine();
|
|
689
|
-
process.stdout.write(`${styleAssistantPrefix()} ${bar} ${
|
|
696
|
+
process.stdout.write(`${styleAssistantPrefix()} ${bar} ${renderLabel()}`);
|
|
690
697
|
}, 70);
|
|
691
698
|
|
|
692
699
|
let activeInterval = interval;
|
|
@@ -714,7 +721,7 @@ function createProgressSpinner(initialLabel = "thinking...") {
|
|
|
714
721
|
const bar = renderFlowingBar(frameIndex, 14);
|
|
715
722
|
frameIndex += 1;
|
|
716
723
|
clearLine();
|
|
717
|
-
process.stdout.write(`${styleAssistantPrefix()} ${bar} ${
|
|
724
|
+
process.stdout.write(`${styleAssistantPrefix()} ${bar} ${renderLabel()}`);
|
|
718
725
|
}, 70);
|
|
719
726
|
activeSpinnerController = controller;
|
|
720
727
|
}
|
|
@@ -724,6 +731,17 @@ function createProgressSpinner(initialLabel = "thinking...") {
|
|
|
724
731
|
return controller;
|
|
725
732
|
}
|
|
726
733
|
|
|
734
|
+
function formatElapsedShort(ms) {
|
|
735
|
+
const totalSeconds = Math.max(0, Math.floor(Number(ms || 0) / 1000));
|
|
736
|
+
if (totalSeconds < 60) return `${totalSeconds}s`;
|
|
737
|
+
const minutes = Math.floor(totalSeconds / 60);
|
|
738
|
+
const seconds = totalSeconds % 60;
|
|
739
|
+
if (minutes < 60) return seconds > 0 ? `${minutes}m ${seconds}s` : `${minutes}m`;
|
|
740
|
+
const hours = Math.floor(minutes / 60);
|
|
741
|
+
const remMinutes = minutes % 60;
|
|
742
|
+
return remMinutes > 0 ? `${hours}h ${remMinutes}m` : `${hours}h`;
|
|
743
|
+
}
|
|
744
|
+
|
|
727
745
|
function parseToolResultShape(resultText) {
|
|
728
746
|
try {
|
|
729
747
|
const parsed = JSON.parse(String(resultText || ""));
|
|
@@ -3409,14 +3427,12 @@ async function runTextTurnInteractive({
|
|
|
3409
3427
|
const idleMs = Date.now() - lastProgressAt;
|
|
3410
3428
|
if (!heartbeatFired && idleMs >= 2000) {
|
|
3411
3429
|
heartbeatFired = true;
|
|
3430
|
+
spinner.setLabel(() => `Working (${formatElapsedShort(Date.now() - turnSummary.startedAt)} • esc to interrupt)`);
|
|
3412
3431
|
printLiveTrace(`state=${currentState}...`, context.runtime.traceMode, { verboseOnly: true });
|
|
3413
3432
|
}
|
|
3414
3433
|
if (!stalledNotified && idleMs >= 8000) {
|
|
3415
3434
|
stalledNotified = true;
|
|
3416
|
-
|
|
3417
|
-
activeSpinnerController.clear();
|
|
3418
|
-
}
|
|
3419
|
-
console.log(`${styleSystemPrefix()} ${yellow(`still working (${currentState}) — press Ctrl+C to interrupt`)}`);
|
|
3435
|
+
spinner.setLabel(() => `Working (${formatElapsedShort(Date.now() - turnSummary.startedAt)} • esc to interrupt)`);
|
|
3420
3436
|
}
|
|
3421
3437
|
}, 500);
|
|
3422
3438
|
|
|
@@ -5272,8 +5288,7 @@ async function promptLoop(agent, session, context) {
|
|
|
5272
5288
|
const idleMs = Date.now() - lastProgressAt;
|
|
5273
5289
|
if (!stalledNotified && idleMs >= 8000) {
|
|
5274
5290
|
stalledNotified = true;
|
|
5275
|
-
|
|
5276
|
-
console.log(`${styleSystemPrefix()} ${yellow(`still working (${currentState}) — press Ctrl+C to interrupt`)}`);
|
|
5291
|
+
spinner.setLabel(() => `Working (${formatElapsedShort(Date.now() - turnSummary.startedAt)} • esc to interrupt)`);
|
|
5277
5292
|
}
|
|
5278
5293
|
}, 500);
|
|
5279
5294
|
|