import { type Database } from "./database.js"; import { type SubscriptionCoreWake } from "./subscription-core/administration.js"; import { type ModelConnectionAccess } from "./subscription-core/access-editor.js"; import { type SubscriptionCoreAccess } from "./subscription-core/access.js"; export { ModelConnectionAccessForbiddenError, ModelConnectionWorkspaceNotInOrganizationError, type ModelConnectionAccess, } from "./subscription-core/access-editor.js"; export type ModelConnectionKind = "codex" | "supergrok" | "vercel_gateway" | "openrouter" | "anthropic" | "claude_subscription" | "opper" | "openai" | "azure_openai" /** An organization's own OpenAI-compatible endpoint; always named by its connection id. */ | "openai_compatible"; export type ModelConnectionTarget = { accountId: string; workspaceId: string | null; subjectId: string; kind: ModelConnectionKind; connectionId: string; }; export declare function connectionModelAllowed(allowedModels: readonly string[] | null | undefined, modelId: string): boolean; /** * Replace a default only when it is outside the assigned pool. An assigned * paused/unhealthy default remains explicit intent: rotation-off must wait, * not silently change the billed subscription. Allocation checks health later. */ export declare function assignedConnectionDefault(preferred: string | null, accounts: readonly { id: string; status: string; allocatorEnabled: boolean; }[]): string | null; export declare function getModelConnectionAccess(db: Database, target: ModelConnectionTarget): Promise; /** * The core wake of an access change to a connection of this kind (a wider * scope or model list can make waiting work placeable), with the provider * and the display name the wake reports, all from the provider's binding; * null for a kind whose provider is not on the core. */ export declare function subscriptionCoreAccessChangeWake(kind: ModelConnectionKind, accountId: string): { provider: string; displayName: string; wake: SubscriptionCoreWake; } | null; /** * A shared subscription connection's access on the shared subscription core, * with the workspaces that use it as their own and its delegated manager, for * a kind whose provider is on the core (the caller checked its route is * `core`). */ export declare function readSubscriptionCoreProviderModelConnectionAccess(db: Database, target: ModelConnectionTarget): Promise; /** A shared subscription connection's access policy on the core (see the reader). */ export declare function getSubscriptionCoreProviderModelConnectionAccess(db: Database, target: ModelConnectionTarget): Promise; /** Save what a shared subscription connection serves on the core (see the reader). */ export declare function updateSubscriptionCoreProviderModelConnectionAccess(db: Database, target: ModelConnectionTarget, policy: ModelConnectionAccess): Promise; /** * Removes another workspace's own subscription connection from the workspace * in `target` (D-52), for a kind whose provider is on the core. True when * removed; null when no such connection serves the workspace. */ export declare function removeSubscriptionCoreProviderModelConnectionFromWorkspace(db: Database, target: ModelConnectionTarget & { workspaceId: string; }): Promise; /** * The workspaces the person in `target` administers, which a workspace's own * subscription connection can be given to from that workspace's route (D-52). */ export declare function listModelConnectionAdministeredWorkspaceIds(db: Database, target: { accountId: string; workspaceId: string; subjectId: string; }): Promise; /** * A shared Codex connection's access on the shared subscription core, with * the workspaces that use it as their own and its delegated manager. */ export declare function readSubscriptionCoreCodexModelConnectionAccess(db: Database, target: ModelConnectionTarget): Promise; /** A shared Codex connection's access policy on the shared subscription core. */ export declare function getSubscriptionCoreCodexModelConnectionAccess(db: Database, target: ModelConnectionTarget): Promise; /** Save what a shared Codex connection serves on the core. */ export declare function updateSubscriptionCoreCodexModelConnectionAccess(db: Database, target: ModelConnectionTarget, policy: ModelConnectionAccess): Promise; export declare function updateModelConnectionAccess(db: Database, target: ModelConnectionTarget, policy: ModelConnectionAccess): Promise;