Skip to content
Closed
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
2ccfac9
feat(cli): /model opens a cross-provider model picker
jlmalone Jun 6, 2026
3a28adf
fix(cli): require a real credential, not a default, to offer a provider
jlmalone Jun 13, 2026
6be91f4
feat(cli): probe model before switching + quiet unavailable-provider …
jlmalone Jun 14, 2026
3025873
style(cli): rustfmt the model-picker probe block
jlmalone Jun 16, 2026
f7eaa6a
fix(cli): install a fresh provider after the model-picker probe
jlmalone Jun 16, 2026
5e857b3
Merge remote-tracking branch 'origin/main' into feat/model-cross-prov…
jlmalone Jun 17, 2026
ab9e2ae
fix(cli): guard /model picker for context-managed providers
jlmalone Jun 17, 2026
08ac2ff
Merge remote-tracking branch 'origin/main' into feat/model-cross-prov…
jlmalone Jun 22, 2026
966cb54
refactor(model-picker): share the canonical provider-configured check
jlmalone Jun 22, 2026
13b18cf
fix(providers): treat a set optional secret as a configuration signal
jlmalone Jun 22, 2026
fafb968
Merge remote-tracking branch 'origin/main' into feat/model-cross-prov…
jlmalone Jun 23, 2026
395a8ff
fix(providers): count a set secret as config with a defaulted require…
jlmalone Jun 23, 2026
e5eef0e
fix(cli): bound model-picker provider construction under the listing …
jlmalone Jun 23, 2026
544ad3b
fix(cli): show the model menu immediately with inline filter and scroll
jlmalone Jun 25, 2026
02ddfe5
fix(cli): let Esc cancel the /model picker instead of ending the session
jlmalone Jun 25, 2026
0c94765
fix(cli): make /model picker target switching unambiguous and history…
jlmalone Jun 25, 2026
3d817fc
fix(cli): use a reliable scrollable model menu instead of cliclack fi…
jlmalone Jun 25, 2026
a0d37b5
Merge origin/main and migrate the model picker to the decoupled model…
jlmalone Jun 28, 2026
d975b3e
fix(cli): let the /model picker switch to ACP targets mid-session
jlmalone Jun 28, 2026
0bc763e
fix(cli): collapse option-less ACP providers to one picker row
jlmalone Jun 28, 2026
78ab68c
fix(cli): keep option-backed ACP providers in the /model picker
jlmalone Jul 1, 2026
9c94804
Merge remote-tracking branch 'origin/main' into feat/model-cross-prov…
jlmalone Jul 1, 2026
6536ab7
fix(cli): adapt model-picker probe to Provider::complete signature
jlmalone Jul 1, 2026
d9d2493
fix(cli): improve bare /model listing and install-time construction
jlmalone Jul 1, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
166 changes: 92 additions & 74 deletions crates/goose-cli/src/commands/configure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,109 +366,127 @@ async fn handle_oauth_configuration(provider_name: &str, key_name: &str) -> anyh

const UNLISTED_MODEL_KEY: &str = "__unlisted__";

fn interactive_model_search(
const SEARCH_KEY: &str = "__search__";
const CLEAR_FILTER_KEY: &str = "__clear_filter__";

/// Searchable model menu. Shows the list immediately (arrow-navigable and
/// selectable without typing) in a scrolling viewport, plus an explicit "Search"
/// item that opens a filter prompt. Deliberately avoids cliclack's `filter_mode`,
/// whose scroll offset is shared with the filtered list and is not reset when the
/// list shrinks, which can render an empty window while Enter still selects an
/// off-screen row. Shared by the per-provider configure flow and the
/// cross-provider bare-`/model` picker (`provider_meta: None` means no "unlisted"
/// entry). Esc cancels via `io::ErrorKind::Interrupted`, which callers catch.
pub(crate) fn interactive_model_search(
models: &[String],
provider_meta: &goose::providers::base::ProviderMetadata,
provider_meta: Option<&goose::providers::base::ProviderMetadata>,
) -> anyhow::Result<String> {
const MAX_VISIBLE: usize = 30;
let mut query = String::new();

loop {
let _ = cliclack::clear_screen();
const MAX_VISIBLE: usize = 15;

let _ = cliclack::log::info(format!(
"🔍 {} models available. Type to filter.",
models.len()
));

let input: String = cliclack::input("Filtering models, press Enter to search")
.placeholder("e.g., gpt, sonnet, llama, qwen")
.default_input(&query)
.interact::<String>()?;
query = input.trim().to_string();
if models.is_empty() && provider_meta.is_none() {
anyhow::bail!("No models to choose from");
}

let filtered: Vec<String> = if query.is_empty() {
models.to_vec()
let mut query = String::new();
loop {
let filtered: Vec<&String> = if query.is_empty() {
models.iter().collect()
} else {
let q = query.to_lowercase();
models
.iter()
.filter(|m| m.to_lowercase().contains(&q))
.cloned()
.collect()
};

if filtered.is_empty() {
let selection = cliclack::select("No matching models. What would you like to do?")
.item(
"__new_search__",
"Start a new search...",
"Enter a different search term",
)
.item(UNLISTED_MODEL_KEY, "Enter a model not listed...", "")
let _ = cliclack::log::warning(format!("No models match \"{query}\"."));
let mut items: Vec<(String, String, &str)> =
vec![(SEARCH_KEY.to_string(), "🔍 Search again…".to_string(), "")];
if provider_meta.is_some() {
items.push((
UNLISTED_MODEL_KEY.to_string(),
"Enter a model not listed…".to_string(),
"",
));
}
let selection = cliclack::select("No matching models:")
.items(&items)
.interact()?;

if selection == UNLISTED_MODEL_KEY {
return prompt_unlisted_model(provider_meta);
if let Some(meta) = provider_meta {
return prompt_unlisted_model(meta);
}
}

query.clear();
query = prompt_model_filter(&query)?;
continue;
}

let mut items: Vec<(String, String, &str)> = filtered
.iter()
.take(MAX_VISIBLE)
.map(|m| (m.clone(), m.clone(), ""))
.collect();

if filtered.len() > MAX_VISIBLE {
items.insert(
0,
(
"__refine__".to_string(),
format!(
"Refine search to see more (showing {} of {} results)",
MAX_VISIBLE,
filtered.len()
),
"Too many matches",
),
);
let prompt = if query.is_empty() {
format!("Select a model ({} available):", models.len())
} else {
items.insert(
0,
(
"__new_search__".to_string(),
"Start a new search...".to_string(),
"Enter a different search term",
),
);
}
format!(
"Select a model ({}/{} match \"{}\"):",
filtered.len(),
models.len(),
query
)
};

let mut items: Vec<(String, String, &str)> = Vec::with_capacity(filtered.len() + 3);
items.push((
UNLISTED_MODEL_KEY.to_string(),
"Enter a model not listed...".to_string(),
"",
SEARCH_KEY.to_string(),
if query.is_empty() {
"🔍 Search by name…".to_string()
} else {
format!("🔍 Search (current: \"{query}\")")
},
"filter the list",
));
if !query.is_empty() {
items.push((
CLEAR_FILTER_KEY.to_string(),
"↺ Clear filter".to_string(),
"",
));
}
for m in &filtered {
items.push(((*m).clone(), (*m).clone(), ""));
}
if provider_meta.is_some() {
items.push((
UNLISTED_MODEL_KEY.to_string(),
"Enter a model not listed…".to_string(),
"",
));
}

let selection = cliclack::select("Select a model:")
let selection = cliclack::select(prompt)
.items(&items)
.max_rows(MAX_VISIBLE)
.interact()?;

if selection == "__refine__" {
continue;
} else if selection == "__new_search__" {
query.clear();
continue;
} else if selection == UNLISTED_MODEL_KEY {
return prompt_unlisted_model(provider_meta);
} else {
return Ok(selection);
match selection.as_str() {
SEARCH_KEY => query = prompt_model_filter(&query)?,
CLEAR_FILTER_KEY => query.clear(),
UNLISTED_MODEL_KEY => {
if let Some(meta) = provider_meta {
return prompt_unlisted_model(meta);
}
}
_ => return Ok(selection),
}
}
}

fn prompt_model_filter(current: &str) -> anyhow::Result<String> {
let input: String = cliclack::input("Filter by name (Enter to apply, Esc to cancel)")
.placeholder("e.g. kimi, gpt, sonnet, llama")
.default_input(current)
.interact()?;
Ok(input.trim().to_string())
}

fn select_model_from_list(
models: &[String],
provider_meta: &goose::providers::base::ProviderMetadata,
Expand Down Expand Up @@ -512,14 +530,14 @@ fn select_model_from_list(
.interact()?;

if selection == "search_all" {
interactive_model_search(models, provider_meta)
interactive_model_search(models, Some(provider_meta))
} else if selection == UNLISTED_MODEL_KEY {
prompt_unlisted_model(provider_meta)
} else {
Ok(selection)
}
} else {
interactive_model_search(models, provider_meta)
interactive_model_search(models, Some(provider_meta))
}
} else {
let mut model_items: Vec<(String, String, &str)> =
Expand Down
Loading
Loading