import type { Api, Model } from "@earendil-works/pi-ai"; export type SelectedModelContext = { model: | { id: string; provider: string; } | undefined; modelRegistry: { find: (provider: string, modelId: string) => Model | undefined; }; }; export function selectedRegistryModel(ctx: SelectedModelContext): Model | undefined { const selected = ctx.model; return selected === undefined ? undefined : ctx.modelRegistry.find(selected.provider, selected.id); }