Skip to content

feat(tui): open agent, model and variant pickers from the prompt footer - #55661

Open
gaojunran wants to merge 2 commits into
anomalyco:devfrom
gaojunran:tui-prompt-footer-pickers
Open

gaojunran wants to merge 2 commits into
anomalyco:devfrom
gaojunran:tui-prompt-footer-pickers

Conversation

@gaojunran

@gaojunran gaojunran commented Oct 15, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #48563

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The prompt footer shows agent · model · variant as plain text (#48563). This wires each label to the picker its keyboard shortcut already opens, by dispatching the existing keymap commands on click: agent → agent.list, model and provider → model.list, variant → variant.list.

Clicks are detected by the same check clickedLink has always used for Markdown links, now shared as isPlainClick in ui/click.ts: only a release ending a fresh cell selection (isDragging + no ctrl/alt/shift) is a click, so drag-to-select over the footer keeps working. This redo of the closed v1 attempt #53871 follows the v2 codebase's own conventions.

(Supersedes #55660, which was auto-closed for targeting the now-obsolete v2 base.)

How did you verify your code works?

  • bun test test/component/prompt-metadata-click.test.tsx — 4 tests: clicking each label picks the matching target (agent, model, variant); releasing a transcript drag over the labels, dragging from one label onto another, and shift-clicking a label do not pick anything.
  • bun test test/ui/link.test.tsx — regression for clickedLink, which now delegates to the shared isPlainClick.
  • bun run typecheck and bunx oxlint on the touched files.
  • Full bun test in packages/tui: 1485 pass. The only 2 failures (dialog-shell-output timeouts) reproduce identically on the unmodified base commit, so they are pre-existing environment flakes, not from this change.

Screenshots / recordings

Interaction-only change — the footer renders exactly as before, no visual diff.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

@gaojunran
gaojunran force-pushed the tui-prompt-footer-pickers branch from 20170c2 to 1fa0b7f Compare October 15, 2026 08:31

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I ran OpenCode from source with the simulated model on the base and on this branch. On the base, clicking Build or the model name in the prompt footer does nothing. With this PR they open "Select agent" and "Select model". Dragging across the footer still selects and copies the text without opening a picker. I couldn't click the variant label live because the simulated model has no variants, but your unit test covers it. The new test file passes (3/3) and typecheck in packages/tui is clean.

The public API is unchanged; the change is internal to the TUI.

No blocking concerns. One small note: ui/link.tsx already handles clicks in its own way (clickedLink, which checks isDragging and the cell selection), so the TUI now has two ways of telling a click from a selection. Your helper is small and is reused across all three labels, so that's fine as it is. Also, #48563 suggested that a single click on the variant should cycle it; opening the picker on click, as here, seems a reasonable choice.

Before

After

@gaojunran

Copy link
Copy Markdown
Author

Addressed the duplication note: the click-vs-selection check now lives in one place. ui/click.ts exports isPlainClick (the exact discrimination clickedLink used — isDragging release + fresh cell selection, no ctrl/alt/shift), clickedLink delegates to it, and the footer labels' onClick uses it instead of hand-tracking press positions. onClick additionally rejects non-left buttons.

Adopting the shared check also fixed a subtle gap in my original version: it now rejects a press-dragged-round-trip back to its cell the same way link clicks always have, instead of relying on my own bookkeeping.

Tests now cover the drag cases with real motion sequences (mockMouse.drag), plus shift-click: 4/4 in the new file, link.test.tsx regression green, full packages/tui suite 1485 pass (only the pre-existing dialog-shell-output local flakes fail).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Make the model and variant labels in the TUI prompt footer clickable

1 participant