@agjs/tsforge 0.1.13 → 0.1.14
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.ts +15 -0
package/package.json
CHANGED
package/src/cli.ts
CHANGED
|
@@ -442,12 +442,14 @@ function makeSpinner(): {
|
|
|
442
442
|
clear: () => void;
|
|
443
443
|
stop: () => void;
|
|
444
444
|
setLabel: (label: string) => void;
|
|
445
|
+
onTick: (cb: () => void) => void;
|
|
445
446
|
} {
|
|
446
447
|
let timer: ReturnType<typeof setInterval> | null = null;
|
|
447
448
|
let startedAt = 0;
|
|
448
449
|
let frame = 0;
|
|
449
450
|
let drawn = false;
|
|
450
451
|
let label = "thinking";
|
|
452
|
+
let onTickCb: (() => void) | null = null;
|
|
451
453
|
|
|
452
454
|
const clear = (): void => {
|
|
453
455
|
if (drawn) {
|
|
@@ -464,6 +466,7 @@ function makeSpinner(): {
|
|
|
464
466
|
`${ERASE_LINE} ${STYLE.dim}${SPINNER_FRAMES[frame] ?? ""} ${label} · ${secs}s${RESET}`
|
|
465
467
|
);
|
|
466
468
|
drawn = true;
|
|
469
|
+
onTickCb?.(); // repaint the pinned status bar with live tok/s / context
|
|
467
470
|
};
|
|
468
471
|
|
|
469
472
|
return {
|
|
@@ -488,6 +491,9 @@ function makeSpinner(): {
|
|
|
488
491
|
setLabel: (l: string): void => {
|
|
489
492
|
label = l;
|
|
490
493
|
},
|
|
494
|
+
onTick: (cb: () => void): void => {
|
|
495
|
+
onTickCb = cb;
|
|
496
|
+
},
|
|
491
497
|
};
|
|
492
498
|
}
|
|
493
499
|
|
|
@@ -964,6 +970,7 @@ async function repl(args: ICliArgs): Promise<number> {
|
|
|
964
970
|
active = new AbortController();
|
|
965
971
|
const started = performance.now();
|
|
966
972
|
|
|
973
|
+
lastStatus = "working"; // reflected live on the bar (● working) during the turn
|
|
967
974
|
spinner.start();
|
|
968
975
|
|
|
969
976
|
try {
|
|
@@ -1239,6 +1246,14 @@ async function repl(args: ICliArgs): Promise<number> {
|
|
|
1239
1246
|
// inactive and `prompt()` falls back to the inline status line (pipes, --log).
|
|
1240
1247
|
const statusBar = new StatusBar(process.stdout, true, true);
|
|
1241
1248
|
|
|
1249
|
+
// Repaint the bar on every spinner tick so tok/s and the context meter update
|
|
1250
|
+
// live mid-turn (both read live session state), not just at turn boundaries.
|
|
1251
|
+
spinner.onTick(() => {
|
|
1252
|
+
if (statusBar.active) {
|
|
1253
|
+
statusBar.update(statusInfo());
|
|
1254
|
+
}
|
|
1255
|
+
});
|
|
1256
|
+
|
|
1242
1257
|
process.stdout.on("resize", () => {
|
|
1243
1258
|
statusBar.resize(statusInfo());
|
|
1244
1259
|
});
|