create-claude-workspace 1.1.128 → 1.1.130
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/dist/scripts/lib/tui.mjs +32 -3
- package/package.json +1 -1
package/dist/scripts/lib/tui.mjs
CHANGED
|
@@ -59,11 +59,17 @@ export class TUI {
|
|
|
59
59
|
agents = [];
|
|
60
60
|
lastModel_ = '';
|
|
61
61
|
inputBuf = '';
|
|
62
|
+
ticker = null;
|
|
62
63
|
constructor(logFile, interactive = false) {
|
|
63
64
|
this.logFile = logFile;
|
|
64
65
|
this.interactive = interactive && process.stdin.isTTY === true;
|
|
65
|
-
if (this.interactive)
|
|
66
|
+
if (this.interactive) {
|
|
66
67
|
this.setupInput();
|
|
68
|
+
this.renderStatusBar();
|
|
69
|
+
this.printInputPrompt('');
|
|
70
|
+
// Tick every second to update elapsed time in status bar
|
|
71
|
+
this.ticker = setInterval(() => this.refreshStatusBar(), 1000);
|
|
72
|
+
}
|
|
67
73
|
}
|
|
68
74
|
// ─── Input handling (interactive only) ───
|
|
69
75
|
setupInput() {
|
|
@@ -110,20 +116,33 @@ export class TUI {
|
|
|
110
116
|
process.stdout.write(`\r\x1b[2K${prompt}`);
|
|
111
117
|
}
|
|
112
118
|
destroy() {
|
|
119
|
+
if (this.ticker) {
|
|
120
|
+
clearInterval(this.ticker);
|
|
121
|
+
this.ticker = null;
|
|
122
|
+
}
|
|
113
123
|
if (this.interactive && process.stdin.isTTY) {
|
|
114
124
|
process.stdin.setRawMode(false);
|
|
115
125
|
process.stdout.write('\n');
|
|
116
126
|
}
|
|
117
127
|
}
|
|
128
|
+
refreshStatusBar() {
|
|
129
|
+
// Overwrite status bar + input in place (no new log line)
|
|
130
|
+
process.stdout.write('\x1b[2K\r'); // clear input line
|
|
131
|
+
process.stdout.write('\x1b[A\x1b[2K\r'); // move up, clear status line
|
|
132
|
+
this.renderStatusBar();
|
|
133
|
+
this.printInputPrompt(this.inputBuf);
|
|
134
|
+
}
|
|
118
135
|
setInputHandler(handler) { this.onInput = handler; }
|
|
119
136
|
setHotkeyHandler(handler) { this.onHotkey = handler; }
|
|
120
137
|
isPaused() { return this.paused_; }
|
|
121
138
|
// ─── Output ───
|
|
122
139
|
out(formatted, raw) {
|
|
123
|
-
// Clear input line if interactive, then print, then restore prompt
|
|
124
140
|
if (this.interactive) {
|
|
125
|
-
|
|
141
|
+
// Move up 2 lines (status + input), clear them, print log, redraw
|
|
142
|
+
process.stdout.write('\x1b[2K\r'); // clear input line
|
|
143
|
+
process.stdout.write('\x1b[A\x1b[2K\r'); // move up, clear status line
|
|
126
144
|
console.log(formatted);
|
|
145
|
+
this.renderStatusBar();
|
|
127
146
|
this.printInputPrompt(this.inputBuf);
|
|
128
147
|
}
|
|
129
148
|
else {
|
|
@@ -137,6 +156,16 @@ export class TUI {
|
|
|
137
156
|
catch { /* */ }
|
|
138
157
|
}
|
|
139
158
|
}
|
|
159
|
+
renderStatusBar() {
|
|
160
|
+
const elapsed = this.loopStart ? fmtDur(Date.now() - this.loopStart) : '—';
|
|
161
|
+
const iterElapsed = this.iterStart_ ? fmtDur(Date.now() - this.iterStart_) : '—';
|
|
162
|
+
const pct = this.maxIter > 0 ? Math.round((this.iteration_ / this.maxIter) * 100) : 0;
|
|
163
|
+
const tok = fmtTok(this.tokens_.input + this.tokens_.output);
|
|
164
|
+
const taskInfo = this.taskName_ ? ` │ ${a.fg.cyan}${trunc(this.taskName_, 30)}${a.reset}` : '';
|
|
165
|
+
const pauseLabel = this.paused_ ? ` │ ${a.fg.yellow}⏸ PAUSED${a.reset}` : '';
|
|
166
|
+
const line = ` ${a.fg.gray}${elapsed}${a.reset} │ Iter ${this.iteration_}/${this.maxIter} ${bar(pct, 10)} │ ${iterElapsed} │ ${a.fg.cyan}${this.tools}${a.reset} tools │ ${a.fg.yellow}${tok}${a.reset} tok${taskInfo}${pauseLabel}`;
|
|
167
|
+
process.stdout.write(`${a.bg.gray}${line}${' '.repeat(Math.max(0, (process.stdout.columns || 80) - strip(line).length))}${a.reset}\n`);
|
|
168
|
+
}
|
|
140
169
|
fileOnly(msg) {
|
|
141
170
|
if (this.logFile) {
|
|
142
171
|
try {
|