create-claude-workspace 2.1.3 → 2.1.5
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/scheduler/ui/tui.mjs +18 -23
- package/package.json +1 -1
|
@@ -31,7 +31,8 @@ const ICONS = {
|
|
|
31
31
|
};
|
|
32
32
|
// ─── Helpers ───
|
|
33
33
|
function ts() { return new Date().toLocaleTimeString('en-GB', { hour12: false }); }
|
|
34
|
-
|
|
34
|
+
/** Truncate for fixed-width UI elements (status bar). Not used for log output. */
|
|
35
|
+
function statusTrunc(s, n) { return s.length > n ? s.slice(0, n) + '…' : s; }
|
|
35
36
|
function fmtTok(n) { return n < 1e3 ? `${n}` : n < 1e6 ? `${(n / 1e3).toFixed(1)}K` : `${(n / 1e6).toFixed(2)}M`; }
|
|
36
37
|
function fmtDur(ms) { return ms < 1e3 ? `${ms}ms` : ms < 6e4 ? `${(ms / 1e3).toFixed(1)}s` : `${(ms / 6e4).toFixed(1)}m`; }
|
|
37
38
|
// ─── TUI class ───
|
|
@@ -156,13 +157,13 @@ export class TUI {
|
|
|
156
157
|
isPaused() { return this.state.paused; }
|
|
157
158
|
addPendingInput(text) {
|
|
158
159
|
this.state.pendingInputs.push(text);
|
|
159
|
-
this.log(` ${ANSI_COLORS.gray}${ts()}${RESET} ${ANSI_COLORS.magenta}▲${RESET} ${ANSI_COLORS.white}Queued:${RESET} ${
|
|
160
|
+
this.log(` ${ANSI_COLORS.gray}${ts()}${RESET} ${ANSI_COLORS.magenta}▲${RESET} ${ANSI_COLORS.white}Queued:${RESET} ${text}`);
|
|
160
161
|
this.renderStatusBar();
|
|
161
162
|
}
|
|
162
163
|
consumePendingInput() {
|
|
163
164
|
const item = this.state.pendingInputs.shift();
|
|
164
165
|
if (item) {
|
|
165
|
-
this.log(` ${ANSI_COLORS.gray}${ts()}${RESET} ${ANSI_COLORS.green}▼${RESET} ${ANSI_COLORS.white}Processing:${RESET} ${
|
|
166
|
+
this.log(` ${ANSI_COLORS.gray}${ts()}${RESET} ${ANSI_COLORS.green}▼${RESET} ${ANSI_COLORS.white}Processing:${RESET} ${item}`);
|
|
166
167
|
this.renderStatusBar();
|
|
167
168
|
}
|
|
168
169
|
return item;
|
|
@@ -181,7 +182,7 @@ export class TUI {
|
|
|
181
182
|
// Line 1: Pending input queue (only if non-empty)
|
|
182
183
|
if (s.pendingInputs.length > 0) {
|
|
183
184
|
const nums = ['①', '②', '③', '④', '⑤', '⑥', '⑦', '⑧', '⑨'];
|
|
184
|
-
const items = s.pendingInputs.slice(0, 5).map((t, i) => `${nums[i] || '•'} ${
|
|
185
|
+
const items = s.pendingInputs.slice(0, 5).map((t, i) => `${nums[i] || '•'} ${statusTrunc(t, 25)}`).join(' ');
|
|
185
186
|
const more = s.pendingInputs.length > 5 ? ` +${s.pendingInputs.length - 5}` : '';
|
|
186
187
|
lines.push(` ${ANSI_COLORS.magenta}[${s.pendingInputs.length} queued]${RESET} ${ANSI_COLORS.gray}${items}${more}${RESET}`);
|
|
187
188
|
}
|
|
@@ -206,7 +207,7 @@ export class TUI {
|
|
|
206
207
|
stats += ` | ${col}${BOLD}${cur}${RESET}\x1b[7m`;
|
|
207
208
|
}
|
|
208
209
|
if (s.taskName)
|
|
209
|
-
stats += ` | ${ANSI_COLORS.cyan}${
|
|
210
|
+
stats += ` | ${ANSI_COLORS.cyan}${statusTrunc(s.taskName, 30)}${RESET}\x1b[7m`;
|
|
210
211
|
if (s.paused)
|
|
211
212
|
stats += ` | ${ANSI_COLORS.yellow}⏸ PAUSED${RESET}\x1b[7m`;
|
|
212
213
|
stats += ` ${RESET}`;
|
|
@@ -218,7 +219,7 @@ export class TUI {
|
|
|
218
219
|
const s = this.state;
|
|
219
220
|
const lines = [];
|
|
220
221
|
if (s.pendingInputs.length > 0) {
|
|
221
|
-
const items = s.pendingInputs.slice(0, 5).map((t, i) => `${i + 1}. ${
|
|
222
|
+
const items = s.pendingInputs.slice(0, 5).map((t, i) => `${i + 1}. ${statusTrunc(t, 25)}`).join(' ');
|
|
222
223
|
const more = s.pendingInputs.length > 5 ? ` +${s.pendingInputs.length - 5}` : '';
|
|
223
224
|
lines.push(` [${s.pendingInputs.length} queued] ${items}${more}`);
|
|
224
225
|
}
|
|
@@ -234,7 +235,7 @@ export class TUI {
|
|
|
234
235
|
if (cur)
|
|
235
236
|
stats += ` | ${cur}`;
|
|
236
237
|
if (s.taskName)
|
|
237
|
-
stats += ` | ${
|
|
238
|
+
stats += ` | ${statusTrunc(s.taskName, 30)}`;
|
|
238
239
|
if (s.paused)
|
|
239
240
|
stats += ' | PAUSED';
|
|
240
241
|
lines.push(stats);
|
|
@@ -362,7 +363,7 @@ export class TUI {
|
|
|
362
363
|
}
|
|
363
364
|
for (const block of content) {
|
|
364
365
|
if (block.type === 'text' && block.text?.trim()) {
|
|
365
|
-
this.log(` ${this.prefix()}${
|
|
366
|
+
this.log(` ${this.prefix()}${block.text}`, `TEXT: ${block.text}`);
|
|
366
367
|
}
|
|
367
368
|
if (block.type === 'tool_use')
|
|
368
369
|
this.onToolUse(block);
|
|
@@ -378,7 +379,7 @@ export class TUI {
|
|
|
378
379
|
if (name === 'Agent') {
|
|
379
380
|
const type = input.subagent_type || input.type || 'agent';
|
|
380
381
|
const model = input.model || '';
|
|
381
|
-
const desc =
|
|
382
|
+
const desc = input.description || input.prompt || '';
|
|
382
383
|
const col = ANSI_COLORS[agentColor(type)] || '';
|
|
383
384
|
this.state.agents.push(type);
|
|
384
385
|
this.log(` ${pre}${time} ${icon} ${col}${BOLD}${type}${RESET}${model ? ` ${ANSI_COLORS.gray}(${model})${RESET}` : ''} ${ANSI_COLORS.gray}${desc}${RESET}`, `AGENT: ${type} ${model} — ${desc}`);
|
|
@@ -387,7 +388,7 @@ export class TUI {
|
|
|
387
388
|
let detail;
|
|
388
389
|
switch (name) {
|
|
389
390
|
case 'Bash':
|
|
390
|
-
detail = `${ANSI_COLORS.yellow}${
|
|
391
|
+
detail = `${ANSI_COLORS.yellow}${input.command || ''}${RESET}`;
|
|
391
392
|
break;
|
|
392
393
|
case 'Read':
|
|
393
394
|
detail = `${ANSI_COLORS.cyan}${(input.file_path || '').replace(/^\/project\//, '')}${RESET}`;
|
|
@@ -402,9 +403,9 @@ export class TUI {
|
|
|
402
403
|
case 'Grep':
|
|
403
404
|
detail = `${ANSI_COLORS.cyan}/${input.pattern || ''}/${RESET}${input.path ? ` ${ANSI_COLORS.gray}in ${input.path}${RESET}` : ''}`;
|
|
404
405
|
break;
|
|
405
|
-
default: detail = `${ANSI_COLORS.gray}${
|
|
406
|
+
default: detail = `${ANSI_COLORS.gray}${JSON.stringify(input)}${RESET}`;
|
|
406
407
|
}
|
|
407
|
-
this.log(` ${pre}${time} ${icon} ${BOLD}${name}${RESET} ${detail}`, `TOOL: ${name} ${JSON.stringify(input)
|
|
408
|
+
this.log(` ${pre}${time} ${icon} ${BOLD}${name}${RESET} ${detail}`, `TOOL: ${name} ${JSON.stringify(input)}`);
|
|
408
409
|
}
|
|
409
410
|
onToolResult(msg) {
|
|
410
411
|
const content = msg.message?.content;
|
|
@@ -418,14 +419,10 @@ export class TUI {
|
|
|
418
419
|
continue;
|
|
419
420
|
const pre = this.prefix();
|
|
420
421
|
if (block.is_error) {
|
|
421
|
-
this.log(` ${pre} ${ANSI_COLORS.red}✗ ${
|
|
422
|
-
}
|
|
423
|
-
else if (output.length < 150) {
|
|
424
|
-
this.log(` ${pre} ${ANSI_COLORS.green}✓${RESET} ${DIM}${trunc(output, 100)}${RESET}`, `OK: ${trunc(output, 100)}`);
|
|
422
|
+
this.log(` ${pre} ${ANSI_COLORS.red}✗ ${output}${RESET}`, `ERROR: ${output}`);
|
|
425
423
|
}
|
|
426
424
|
else {
|
|
427
|
-
|
|
428
|
-
this.log(` ${pre} ${ANSI_COLORS.green}✓${RESET} ${DIM}${n} lines${RESET}`, `OK: (${n} lines)`);
|
|
425
|
+
this.log(` ${pre} ${ANSI_COLORS.green}✓${RESET} ${DIM}${output}${RESET}`, `OK: ${output}`);
|
|
429
426
|
}
|
|
430
427
|
}
|
|
431
428
|
}
|
|
@@ -435,12 +432,10 @@ export class TUI {
|
|
|
435
432
|
return;
|
|
436
433
|
}
|
|
437
434
|
if (msg.subtype === 'task_started') {
|
|
438
|
-
// Agent name was already pushed by the Agent tool_use handler — don't push again.
|
|
439
|
-
// Use agent name from stack; description is secondary context.
|
|
440
435
|
const agent = this.state.agents.length > 0 ? this.state.agents[this.state.agents.length - 1] : (msg.description || 'agent');
|
|
441
436
|
const desc = msg.description || '';
|
|
442
437
|
const col = ANSI_COLORS[agentColor(agent)] || '';
|
|
443
|
-
const detail = desc && desc !== agent ? ` ${ANSI_COLORS.gray}${
|
|
438
|
+
const detail = desc && desc !== agent ? ` ${ANSI_COLORS.gray}${desc}${RESET}` : '';
|
|
444
439
|
this.log(` ${ANSI_COLORS.gray}${ts()}${RESET} 🤖 ${col}${BOLD}${agent}${RESET}${detail}`, `AGENT_START: ${agent} — ${desc}`);
|
|
445
440
|
return;
|
|
446
441
|
}
|
|
@@ -449,12 +444,12 @@ export class TUI {
|
|
|
449
444
|
const name = this.state.agents.length > 0 ? this.state.agents.pop() : 'agent';
|
|
450
445
|
const col = ANSI_COLORS[agentColor(name)] || '';
|
|
451
446
|
const icon = status === 'completed' ? `${ANSI_COLORS.green}✓` : `${ANSI_COLORS.red}✗`;
|
|
452
|
-
const detail = msg.summary ? ` ${ANSI_COLORS.gray}${
|
|
447
|
+
const detail = msg.summary ? ` ${ANSI_COLORS.gray}${msg.summary}${RESET}` : '';
|
|
453
448
|
this.log(` ${ANSI_COLORS.gray}${ts()}${RESET} ${icon}${RESET} ${col}${name}${RESET} ${status}${detail}`, `AGENT_END: ${name} ${status}`);
|
|
454
449
|
return;
|
|
455
450
|
}
|
|
456
451
|
if (msg.subtype === 'task_progress' && msg.description) {
|
|
457
|
-
this.log(` ${this.prefix()} ${DIM}${
|
|
452
|
+
this.log(` ${this.prefix()} ${DIM}${msg.description}${RESET}`, `PROGRESS: ${msg.description}`);
|
|
458
453
|
return;
|
|
459
454
|
}
|
|
460
455
|
if (msg.subtype === 'api_retry') {
|