fix(agent-picker): hide a short name only on reported proof; keep hidden rows searchable

This commit is contained in:
Brennan Benson
2026-11-12 01:17:57 -08:00
parent be31ead684
commit 0dbc1e2610
8 changed files with 27 additions and 24 deletions
@@ -221,10 +221,11 @@ export function descriptorRowElements(
onPress={() => onSetOption(choice.value)}
/>
)
// No search here: search-only aliases follow a More models toggle, as compact pickers show them.
const more = moreChoices ? choices.filter((choice) => choice.legacy) : []
// No search here, so search-only rows stay out; folded ones follow a More models toggle.
const listed = choices.filter((choice) => !choice.hidden)
const more = moreChoices ? listed.filter((choice) => choice.legacy) : []
return [
...choices.filter((choice) => !choice.legacy).map(choiceRow),
...listed.filter((choice) => !choice.legacy).map(choiceRow),
...(more.length > 0 && moreChoices
? [
...(moreChoices.shown ? more.map(choiceRow) : []),
@@ -277,8 +277,8 @@ export function agentLaunchSetupModelRows(
modelInArguments: boolean
) {
type Row = { id: string; label: string; unlisted?: true }
// A hidden row stays listed while it is the current choice.
const listed = models.filter((model) => !model.hidden || model.id === currentModel)
// A hidden row is listed by a matching search, or while it is the current choice.
const listed = models.filter((model) => !model.hidden || query || model.id === currentModel)
// Membership ignores the selection, so picking a model never moves rows in the open list.
const folded = (model: AgentPickerModel) => !query && Boolean(model.isLegacy)
const rows: Row[] = listed.filter((model) => !folded(model))
@@ -55,7 +55,8 @@ export function NativeChatModelCombobox({
const searching = Boolean(query.trim())
// Membership ignores the selection, so picking a model never moves rows in the open list.
const folded = (choice: SessionOptionSelectChoice) => !searching && Boolean(choice.legacy)
const legacyChoices = choices.filter(folded)
const listed = searching ? choices : choices.filter((choice) => !choice.hidden)
const legacyChoices = listed.filter(folded)
const renderChoice = (choice: SessionOptionSelectChoice) => {
const label = nativeChatSessionChoiceLabel(choice, say)
const current = choice.value === currentValue
@@ -114,7 +115,7 @@ export function NativeChatModelCombobox({
<CommandGroup>
{/* One keyed array, so a row moving between sections keeps its highlight. */}
{[
...choices.filter((choice) => !folded(choice)).map(renderChoice),
...listed.filter((choice) => !folded(choice)).map(renderChoice),
...(legacyExpanded ? legacyChoices.map(renderChoice) : []),
<AgentPickerLegacyModelsToggle
key="legacy-toggle"
@@ -72,9 +72,6 @@ export function searchAgentPickerSetups(
continue
}
for (const model of agentPickerModels(entry)) {
if (model.hidden) {
continue
}
const modelWords = tokens([model.id, model.label].join(' '))
if (!words.some((word) => !score(word, agentWords) && score(word, modelWords))) {
continue
@@ -21,7 +21,11 @@ import type { CurrentActionSelection } from '../../source-control/ai/recipes/sou
export type AgentPickerSurface = 'chat' | 'terminal'
export type AgentPickerDraftOwner = object
export type AgentPickerModel = AgentSessionModelOption & { isLegacy?: true; hidden?: true }
export type AgentPickerModel = AgentSessionModelOption & {
isLegacy?: true
/** Listed only by a matching search, or while it is the current choice. */
hidden?: true
}
export type AgentPickerEntry = {
textGeneration?: TextActionPickerCatalog
agent: TuiAgent
+4 -4
View File
@@ -52,9 +52,9 @@ function supersededCodexModels(models: readonly ListedModel[]): (model: ListedMo
}
}
// Proven by the row naming the versioned model it runs, or, where a saved list or older host
// dropped that, by a versioned row of the same family (opus beside claude-opus-5-5). Only a
// family short name (opus, opus[1m]) is that model; other names (opusplan) only fold.
// Hidden only when the row names the versioned model it runs and is that family's short name
// (opus → claude-opus-5-5). Other covered names (opusplan) and rows a saved list or older host
// lists without that proof (opus beside claude-opus-5-5) only fold.
function coveredClaudeAliases(models: readonly ListedModel[]): (model: ListedModel) => ModelClass {
const selfResolved = new Set<string>()
const versionedFamilies = new Set<string>()
@@ -77,7 +77,7 @@ function coveredClaudeAliases(models: readonly ListedModel[]): (model: ListedMod
}
return family && claudeVersionedFamily(resolved) === family ? 'hidden' : 'legacy'
}
return family && versionedFamilies.has(family) ? 'hidden' : null
return family && versionedFamilies.has(family) ? 'legacy' : null
}
}
@@ -233,15 +233,13 @@ export function nativeChatSessionOptionDescriptors(args: {
// Callers reconcile tracked models into choices first; the trigger must never show an unlisted selection.
// Legacy rows fold away like the launch picker's; a picker opens the section when the chat is on one.
const { legacy, hidden } = classifyAgentModels(agent, args.legacyInventory ?? models)
// A hidden row stays listed while the chat is on it.
const modelChoices = models
.filter(({ id }) => !hidden.has(id) || id === model.currentId)
.map(({ id, label, description }) => ({
value: id,
label,
...(description ? { description } : {}),
...(legacy.has(id) ? { legacy: true as const } : {})
}))
const modelChoices = models.map(({ id, label, description }) => ({
value: id,
label,
...(description ? { description } : {}),
...(legacy.has(id) ? { legacy: true as const } : {}),
...(hidden.has(id) && id !== model.currentId ? { hidden: true as const } : {})
}))
const modelAction = actionForApply(catalog.modelApply, model.tracked, mode, liveTransport)
const snapshot: SessionOptionDescriptor[] = [
{
@@ -8,6 +8,8 @@ export type SessionOptionSelectChoice = {
description?: string
/** Folded under More models; a matching search still lists it. */
legacy?: true
/** Listed only by a matching search; never set on the current choice. */
hidden?: true
}
/** default describes catalog display, never running-agent evidence. dispatched is sent but unread and may be corrected by reports.