Skip to content

Commit f495c80

Browse files
committed
fix: address review feedback on TUI signature design
1 parent 9158ce9 commit f495c80

3 files changed

Lines changed: 31 additions & 17 deletions

File tree

apps/pythinker-code/src/tui/components/chrome/status-bar.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export type StatusBarStatus = Pick<
1717
| 'homeDir'
1818
| 'permissionMode'
1919
| 'planMode'
20+
| 'fastMode'
2021
| 'dynamicWorkflowMode'
2122
> & { readonly sessionKey: string };
2223

@@ -82,7 +83,8 @@ function renderModesChip(status: StatusBarStatus): string | undefined {
8283
if (status.planMode) modes.push(currentTheme.fg('modePlan', 'plan'));
8384
if (status.permissionMode === 'auto') modes.push(currentTheme.fg('modePermission', 'auto'));
8485
if (status.permissionMode === 'yolo') modes.push(currentTheme.fg('modeAutoAccept', 'yolo'));
85-
if (status.dynamicWorkflowMode) modes.push(currentTheme.fg('modeFast', 'workflow'));
86+
if (status.fastMode) modes.push(currentTheme.fg('modeFast', '↯ fast'));
87+
if (status.dynamicWorkflowMode) modes.push(currentTheme.fg('accent', 'workflow'));
8688
return modes.length === 0 ? undefined : chip(modes.join(' '));
8789
}
8890

apps/pythinker-code/test/tui/components/messages/tool-call.test.ts

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -63,26 +63,22 @@ describe('ToolCallComponent', () => {
6363

6464
try {
6565
const pending = component.render(40);
66+
const pendingBody = pending.slice(1);
6667
expect(pending[0]).not.toContain('\u001B[48;2;29;33;41m');
67-
expect(
68-
pending.slice(1).every((line) => line.includes('\u001B[48;2;29;33;41m')),
69-
).toBe(true);
68+
expect(pendingBody.length).toBeGreaterThan(0);
69+
expect(pendingBody.every((line) => line.includes('\u001B[48;2;29;33;41m'))).toBe(true);
7070

7171
component.setResult({ tool_call_id: 'call_tint', output: 'content', is_error: false });
72-
expect(
73-
component
74-
.render(40)
75-
.slice(1)
76-
.every((line) => line.includes('\u001B[48;2;20;23;27m')),
77-
).toBe(true);
72+
const success = component.render(40);
73+
const successBody = success.slice(1);
74+
expect(successBody.length).toBeGreaterThan(0);
75+
expect(successBody.every((line) => line.includes('\u001B[48;2;20;23;27m'))).toBe(true);
7876

7977
component.setResult({ tool_call_id: 'call_tint', output: 'failed', is_error: true });
80-
expect(
81-
component
82-
.render(40)
83-
.slice(1)
84-
.every((line) => line.includes('\u001B[48;2;41;29;29m')),
85-
).toBe(true);
78+
const error = component.render(40);
79+
const errorBody = error.slice(1);
80+
expect(errorBody.length).toBeGreaterThan(0);
81+
expect(errorBody.every((line) => line.includes('\u001B[48;2;41;29;29m'))).toBe(true);
8682
} finally {
8783
chalk.level = previousLevel;
8884
}

apps/pythinker-code/test/tui/components/status-bar.test.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ function status(overrides: Partial<StatusBarStatus> = {}): StatusBarStatus {
2020
homeDir: '/Users/test',
2121
permissionMode: 'auto',
2222
planMode: true,
23+
fastMode: false,
2324
dynamicWorkflowMode: true,
2425
sessionKey: 'session-alpha',
2526
...overrides,
@@ -61,7 +62,22 @@ describe('StatusBarComponent', () => {
6162
component.update(status());
6263

6364
for (const width of [0, 1, 10, 25, 45, 53, 80]) {
64-
expect(visibleWidth(component.render(width)[0] ?? '')).toBeLessThanOrEqual(width);
65+
const lines = component.render(width);
66+
expect(lines).toHaveLength(1);
67+
expect(visibleWidth(lines[0]!)).toBeLessThanOrEqual(width);
68+
}
69+
});
70+
71+
it('renders fast mode', () => {
72+
const previousLevel = chalk.level;
73+
chalk.level = 3;
74+
const component = new StatusBarComponent();
75+
component.update(status({ fastMode: true }));
76+
77+
try {
78+
expect(stripAnsi(component.render(80)[0] ?? '')).toContain('↯ fast');
79+
} finally {
80+
chalk.level = previousLevel;
6581
}
6682
});
6783
});

0 commit comments

Comments
 (0)