[Feature] Support stateful key actions in extension selectors #2113
mulatta
started this conversation in
Feature requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Area
Coding agent and CLI, TUI
Problem
Daemon-backed extensions can use
ctx.ui.select(), but the selector only supports up/down navigation, Enter to confirm, and Escape to cancel.This limits extensions that build stateful or multi-step selection flows. For example, an extension may need to:
Extensions cannot implement these behaviors directly. Daemon workers do not receive raw terminal input, and executable UI callbacks cannot cross the daemon/client boundary.
An extension can emulate these flows with repeated one-shot selectors and visible action rows, but every action requires Enter and every redraw resets the highlighted row.
Proposed direction
Extend the existing serializable
selectoptions with optional state and key actions.For example:
Proposed behavior:
space: "select"returns the currently highlighted option through the normalselect response.
initialIndexsets the highlighted row when the selector opens.{ value: string }.This keeps application state in the extension. Core only maps a small, declarative set of keys to existing selector results. It does not transport raw key events or executable callbacks across the daemon boundary.
All fields are optional and additive. Older clients can ignore them. Extensions can retain visible action rows as a compatible fallback.
Alternatives considered
Extensions can include Back, Next, Apply, or Done rows and require Enter to activate them. This works with existing clients but provides no direct keyboard actions and resets the cursor after every redraw.
Binding Space globally would affect unrelated selectors and text-entry flows. It also would not provide per-dialog navigation actions or cursor restoration.
Dedicated methods for multi-select lists, paginated pickers, wizards, and other flows would duplicate protocol and client logic. Generic selector options cover these cases with a smaller API.
This creates a much broader protocol, ownership, and security surface. A fixed allowlist of declarative key actions is narrower and easier to validate.
This could support fully custom interactive components, as discussed in #1462, but it is substantially larger than extending the existing serializable selector.
Additional context
Related discussions:
Current
ExtensionSelectorComponent.handleInput()onmainhandles only up/down, confirm, and cancel. I did not find an existing Discussion, Issue, or pull request covering per-selector key actions or initial selection state.If this direction fits the project roadmap, I can prepare a focused pull request with tests for:
All reactions