import type { OpenGeniBrowserClient } from "@opengeni/sdk/browser"; import type { ClientModel, DefaultModelSelection, ReasoningEffort, WorkspaceModelCatalogModel, WorkspaceModelCatalogResponse } from "@opengeni/sdk"; import { type PickerModelRow } from "../../model-policy.js"; /** * The service a person just connected (or paid for) during onboarding. The * next chat should use that service, never an unrelated free model that the * generic picker order happens to rank first. */ export type ConnectedModelFamily = "codex" | "supergrok" | "vercel_gateway" | "openrouter" | "opper" | "credits" | "openai" | "azure_openai"; /** * Model to preselect after a subscription/provider connect or credit purchase. * * With a `family`, only that family's selectable models qualify, in the * operator-configured catalog order; `null` means the connection is not usable * yet (the caller offers a retry instead of silently picking something else). * Without a family (the new-chat composer fallback when both the selected * model and the server-resolved default are unavailable), a selectable Codex, * SuperGrok, or workspace provider wins over the free deployment model; an * organization-paid provider ranks after the free model, and Opengeni-credit * models are never chosen implicitly here. The resolved default is what moves * a workspace with credits onto the credits model. */ export declare function preferredConnectedModelId(models: readonly WorkspaceModelCatalogModel[], family?: ConnectedModelFamily): string | null; /** * Replacement when the composer's model is no longer selectable. The * server-resolved default (saved workspace default, connected subscription, * credits model while the organization has credits, deployment default) wins * when it is selectable; otherwise the client ranking above applies. */ export declare function composerFallbackModel(input: { models: readonly WorkspaceModelCatalogModel[]; rows: readonly PickerModelRow[]; defaultSelection: DefaultModelSelection | null; }): { id: string; effort: ReasoningEffort; } | null; /** Select the connected model in the actor-private draft without workspace administration. */ export declare function applyConnectedModelToNewSessionDraft(client: OpenGeniBrowserClient, workspaceId: string, family?: ConnectedModelFamily, preferredModelId?: string): Promise<{ id: string; label: string; } | null>; /** * Stripe success return for an onboarding credit purchase. It reuses the * sessions composer launch contract (`?model=&effort=`), so the next chat uses * the purchased credits instead of the free default model even before the * payment webhook lands. `modelSource=default` marks that policy as the * resolved default rather than the person's choice, so the draft keeps * following the default and a later subscription connect still replaces it. */ export declare function creditCheckoutSuccessUrl(origin: string, workspaceId: string, model: { id: string; effort: string; } | null): string; /** Resolve the credits model for a checkout return; a catalog failure never blocks checkout. */ export declare function creditsModelForCheckout(client: OpenGeniBrowserClient, workspaceId: string): Promise<{ id: string; effort: string; } | null>; /** * The model a credit purchase should land on: the server's credits default * (the configured credits model at its configured reasoning, for example GPT-6 * Luna at extra high). Null when a connected subscription or saved workspace * default would still win after the purchase, so the composer keeps that * default instead. Older servers publish no resolved default; the first * selectable credits model is used there. */ export declare function creditsCheckoutModel(catalog: Pick): { id: string; effort: string; } | null; /** * The deployment default model a new person can use without connecting * anything: an explicitly free model, or (when this deployment does not bill * for credits) a model the deployment itself pays for. Read from client * config; never assume a particular model id. */ export declare function includedDefaultModel(config: { defaultModel: string; models: readonly ClientModel[]; billingMode?: "disabled" | "stripe" | undefined; }): { id: string; label: string; free: boolean; } | null; /** * Confirm a client-config included model against the new workspace's live * catalog. Client config carries no credential-readiness or workspace-policy * signal, so the included path is offered only when the Personal workspace can * actually select that model (and, for a free claim, the catalog agrees it is * free). Otherwise the caller shows the ordinary connect/credits choice. */ export declare function confirmIncludedModel(candidate: T, models: readonly WorkspaceModelCatalogModel[]): T | null;