Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:1ay1 Agentty Fused Model Picker Ranking

From Leeroopedia
Knowledge Sources
Domains UI, Model_Selection
Last Updated 2026-10-28 12:00 GMT

Overview

Pure ranking core that merges every authed provider's catalog into one ordered, sectioned FusedRow list for the unified cross-provider model picker.

Description

The build_fused_rows function is the pure, header-only ranking core of the unified model picker. Given every authed provider's catalog, optional sign-in offers for un-authed providers, the recents (MRU), the active (provider,model), and the live query, it produces the ORDERED, SECTIONED FusedRow list the reducer selects from and the view renders.

It is pure and header-only so it unit-tests without a Model/deps/network. The reducer assembles the inputs via the deps/registry seams; the ranking lives here so reducer and view agree by construction (the SSOT discipline the pickers hold).

Usage

Import this when you need to build the cross-provider model picker list — the fused view that shows every authed provider's models ranked by query relevance, with favorites and recents leading, and sign-in offers at the end.

Code Reference

Source Location

Signature

namespace agentty::ui {

struct FusedInputs {
    const std::vector<ProviderCatalog>* catalogs = nullptr;
    const std::vector<SigninOffer>*     offers   = nullptr;
    const std::vector<ModelRef>*        recents  = nullptr;
    const std::vector<ModelId>*         favorites = nullptr;
    ModelRef    active;
    std::string query;
    int         recent_cap = 6;
    std::string only_provider;
    std::string (*label_fn)(std::string_view id, std::string_view name);
};

// Build the ordered, sectioned fused row list.
// catalogs/offers/recents may be null (treated as empty).
[[nodiscard]] inline std::vector<FusedRow> build_fused_rows(
    const FusedInputs& in);
}

Import

#include "agentty/runtime/fused_models.hpp"

I/O Contract

Inputs

Name Type Required Description
catalogs const std::vector<ProviderCatalog>* No Authed providers' catalogs; null treated as empty
offers const std::vector<SigninOffer>* No Un-authed provider sign-in offers; null treated as empty
recents const std::vector<ModelRef>* No MRU list, newest first; null treated as empty
favorites const std::vector<ModelId>* No Starred model ids; null falls back to row flag
active ModelRef No Current provider+model; pinned at top of recents
query std::string Yes Live fuzzy query; empty = browse mode
only_provider std::string No Restrict to one provider (Smart Mode slot-assign); empty = cross-provider

Outputs

Name Type Description
return std::vector<FusedRow> Ordered, sectioned row list: FAVORITES → RECENT → all providers → sign-in offers
FusedRow.active bool True for the active model wherever it lands
FusedRow.match_positions std::vector<int> Byte offsets of query in the model label for fzf-style highlighting
FusedRow.tier uint8_t Model tier for badge coloring and browse ordering

Usage Examples

Basic Fused Picker

#include "agentty/runtime/fused_models.hpp"

agentty::ui::FusedInputs in;
in.catalogs  = &model.catalogs;      // authed providers
in.offers    = &model.signin_offers; // un-authed providers
in.recents   = &model.recents;       // MRU list
in.favorites = &settings.favorite_models;
in.active    = model.active_ref();
in.query     = picker.query();

auto rows = agentty::ui::build_fused_rows(in);
// rows[0..N] = FAVORITES section (starred models)
// rows[N..M] = RECENT section (active pinned first)
// rows[M..] = all providers, fuzzy-ranked
// trailing  = sign-in offers (only when query matches)

Single-Provider Mode (Smart Mode Slot-Assign)

agentty::ui::FusedInputs in;
in.catalogs     = &model.catalogs;
in.recents      = &model.recents;
in.active       = model.active_ref();
in.only_provider = "openai";  // only show openai rows
// Sign-in offers are suppressed — can't pin a model you aren't signed in to
auto rows = agentty::ui::build_fused_rows(in);

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment