Repository navigation
feat(tui): model tags on the right of the footer, YOLO tag on the input line - #360
Conversation
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
… footer never touches the tags or YOLO
| const borderHighlight = createMemo(() => tint(theme.border, highlight(), agentMetaAlpha())) | ||
|
|
||
| // Cells inside the prompt box: terminal width minus the outer margin, left border and padding. | ||
| const innerWidth = createMemo(() => Math.max(10, dimensions().width - 9)) |
There was a problem hiding this comment.
CRITICAL: The width budget is derived from the terminal width, not from the prompt's own width
innerWidth assumes the prompt box spans the whole terminal minus 9 cells. That only holds for the session route with the sidebar hidden; everywhere else the prompt is narrower, so the computed room is far too large:
- Session route with the sidebar open: the prompt sits in the main column (
paddingLeft/Right={2}) next to a 42-column sidebar (packages/tui/src/routes/session/sidebar.tsx:36), so the real content width isterminal - 51, notterminal - 9. - Home route: the prompt is capped at
promptMaxWidth()(75 by default,packages/tui/src/routes/home.tsx:35-39), so on a 120-column terminal the real content width is 70 whileinnerWidth()reports 111.
Consequences: the model name is never truncated to the space that actually exists (the left box shrinks and overflow="hidden" hard-clips the name with no ellipsis), and placeholderRoom() allows a placeholder long enough to run underneath the YOLO badge — the exact overlap this PR is meant to prevent. showProvider() has the same problem: its 72-column threshold is a terminal-width threshold, not a prompt-width threshold.
Measure the prompt's own rendered width (e.g. the anchor box's layout width) and derive innerWidth/showProvider from that.
| models without thinking variants. Its hue (fast | ||
| green, medium orange, thorough red) is drawn | ||
| beside the always-visible level name. */} | ||
| <text> |
There was a problem hiding this comment.
CRITICAL: The · separator that preceded the effort tag was dropped, breaking two existing tests
The effort label moved into the right-hand group without its leading separator, so the footer row now reads ... model provider medium · high · vision instead of ... model provider · medium · high · vision. Two existing assertions depend on the old separator and will fail:
packages/tui/test/prompt/vision-tag.test.tsx:436—expect(highRow).toContain("· medium")packages/tui/test/cli/tui/dialog-agent-effort.test.tsx:805—expect(after).toContain("· fast")
Either keep a separator at the start of the new group, or update both tests in this PR.
| width="100%" | ||
| > | ||
| <Show when={store.mode === "normal" && local.permission.mode === "yolo"}> | ||
| <box position="absolute" top={1} right={2} paddingLeft={1} paddingRight={1} backgroundColor={theme.warning}> |
There was a problem hiding this comment.
WARNING: The YOLO badge overlays the editable first input row
The badge is absolutely positioned on the textarea's first row (the textarea is width="100%" of the same content box, and top={1} lands on the first content row). Only the placeholder is shortened to make room (placeholderRoom); typed text is not. The last ~6 columns of the first input line therefore sit under the badge, so the tail of what the user typed is hidden. If the textarea paints above the badge instead, the badge is covered by the textarea's own background (focusedBackgroundColor).
Reserve space for the badge inside the input row (e.g. reduce the textarea width or add right padding while the badge is visible) rather than overlaying the editable area.
| }) | ||
| const modelLabel = createMemo(() => Locale.truncate(local.model.parsed().model, modelRoom())) | ||
| // The placeholder shares its row with the YOLO tag. | ||
| const placeholderRoom = createMemo(() => innerWidth() - (local.permission.mode === "yolo" ? 8 : 0)) |
There was a problem hiding this comment.
SUGGESTION: Placeholder reserves room for the YOLO badge in shell mode as well
The badge is only rendered when store.mode === "normal" && local.permission.mode === "yolo" (line 1432), but this reservation is applied for any yolo permission mode. In shell mode no badge is drawn, yet the placeholder is still cut 8 columns short. Use the same condition as the badge's Show.
| const modelRoom = createMemo(() => { | ||
| const agentName = store.mode === "shell" ? "Shell".length : (local.agent.current()?.name.length ?? 0) | ||
| const provider = showProvider() ? currentProviderLabel().length + 1 : 0 | ||
| return Math.max(4, innerWidth() - tagsWidth() - 2 - agentName - 3 - provider) |
There was a problem hiding this comment.
SUGGESTION: modelRoom ignores the width of the right-hand slot
props.right (the session_prompt_right / home_prompt_right plugin slot) is rendered in the same right-hand box as the tags and is not accounted for here. When a plugin supplies right content, the left box shrinks and the model name is hard-clipped by overflow="hidden" with no ellipsis, which breaks the invariant this PR introduces. Subtract the right content's width as well.
| <box flexDirection="row" gap={1} alignItems="center" flexShrink={0}> | ||
| <Show when={store.mode === "normal"}> | ||
| <box flexDirection="row" gap={1} flexShrink={0}> | ||
| {/* Agent effort is its own dial and shows even for |
There was a problem hiding this comment.
SUGGESTION: Moved block kept the old indentation, and one line exceeds the print width
The children of the new tags box are still indented as if they were in the previous nesting level, and the badge line (1433) is 122 characters — over the repo's prettier printWidth of 120. Running prettier on the file normalizes both.
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (3 files)
Previous Review Summary (commit 9c861f6)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 9c861f6)Status: 6 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)CRITICAL
WARNING
SUGGESTION
Files Reviewed (1 file)
Reviewed by free · Input: 65.6K · Output: 11.8K · Cached: 177.8K |
Fixes #359.
Wide (110 columns):
60 columns:
50 columns: