feat(models): rolePins on GET /api/models — the background roles' resolved pins
Settings interlude (owner request, 2026-09-19): the route now also returns
rolePins: Record<BackgroundModelRole, {model: {provider, id},
thinkingLevel}> — the six background roles' RESOLVED models (the user's
agent-models override falling back to the config.ts MODELS pin), so the
settings UI shows each role row's 'Default: <actual pinned model>' instead
of a generic config caption. Same resolution the agent factories use
(effectiveSettings), so the caption can never drift from what runs.
Pure projection (rolePinsFor) + the fs wrapper (catalogRolePins); pins
tested against config defaults and model/thinkingLevel-only overrides.
BACKGROUND_MODEL_PINS exported from stores.ts for the test (was local).
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
* components never import from the server band).
|
||||
*/
|
||||
import type { ThinkingLevel } from "@earendil-works/pi-agent-core";
|
||||
import type { BackgroundModelRole } from "../settings.ts";
|
||||
|
||||
/** One picker row: everything the UI shows about a model, projected from
|
||||
* pi-ai's catalog. Costs are USD per 1M tokens (the same catalog, the same
|
||||
@@ -32,8 +33,20 @@ export interface CatalogDefaults {
|
||||
thinkingLevel: ThinkingLevel;
|
||||
}
|
||||
|
||||
/** One background role's RESOLVED pin (settings interlude, 2026-09-19):
|
||||
* the user's agent-models override falling back to the config.ts MODELS
|
||||
* pin — what that role actually runs today. The settings UI shows each
|
||||
* agent-role row's "Default: <this>" caption from it. */
|
||||
export type RolePins = Record<
|
||||
BackgroundModelRole,
|
||||
{ model: { provider: string; id: string }; thinkingLevel?: ThinkingLevel }
|
||||
>;
|
||||
|
||||
/** GET /api/models response. */
|
||||
export interface ModelCatalogResponse {
|
||||
models: ModelCatalogEntry[];
|
||||
defaults: CatalogDefaults;
|
||||
/** The six background roles' resolved pins (same resolution the agent
|
||||
* factories use — src/server/stores.ts effectiveSettings). */
|
||||
rolePins: RolePins;
|
||||
}
|
||||
Reference in New Issue
Block a user