@@ -287,9 +287,9 @@ const FULL_CATALOG_DRIVERS: ReadonlySet<string> = new Set(["codex", "claudeAgent
287287const LISTED_MODEL_LIMIT = 8 ;
288288
289289/**
290- * Picks the models orchestrator_capabilities shows for one provider. Hidden
291- * models never appear. With search terms, lists matches; otherwise lists pinned
292- * models (custom, favorite, the caller's own) plus the provider's non-legacy
290+ * Picks the models orchestrator_capabilities shows for one provider. Hidden models never
291+ * appear. Search words naming the provider are dropped; other words list matches. With no
292+ * words left, lists pinned models (custom, favorite, the caller's own) plus non-legacy
293293 * models, or only the first few in the user's model order for large catalogs.
294294 */
295295function listCapabilityModels ( input : {
@@ -304,10 +304,13 @@ function listCapabilityModels(input: {
304304 const visible = input . provider . models
305305 . filter ( ( model ) => model . isCustom || ! input . preferences ?. hiddenModels . includes ( model . slug ) )
306306 . toSorted ( ( a , b ) => ( rank . get ( a . slug ) ?? rank . size ) - ( rank . get ( b . slug ) ?? rank . size ) ) ;
307- if ( input . searchTerms . length > 0 ) {
307+ const { instanceId, driver, displayName } = input . provider ;
308+ const providerText = `${ instanceId } ${ driver } ${ displayName ?? "" } ` . toLowerCase ( ) ;
309+ const modelTerms = input . searchTerms . filter ( ( term ) => ! providerText . includes ( term ) ) ;
310+ if ( modelTerms . length > 0 ) {
308311 const matches = visible . filter ( ( model ) => {
309312 const text = `${ model . slug } ${ model . name } ${ model . subProvider ?? "" } ` . toLowerCase ( ) ;
310- return input . searchTerms . every ( ( term ) => text . includes ( term ) ) ;
313+ return modelTerms . every ( ( term ) => text . includes ( term ) ) ;
311314 } ) ;
312315 const listed = matches . slice ( 0 , LISTED_MODEL_LIMIT ) ;
313316 return { listed, omitted : matches . length - listed . length } ;
0 commit comments