import { type AgentProviderId } from "../../client/agent-provider-catalog.js"; import { type DefaultAgentEngineSource } from "../default-agent-engine.js"; export type ModelProviderKeyScope = "user" | "org"; export interface ModelProviderKey { scope: ModelProviderKeyScope; /** * Last four characters behind a mask, e.g. "••••x9a2". Absent on * organization keys for members, who only see that one exists. */ masked?: string; /** * Ollama's endpoint URL, or the OpenAI-compatible gateway saved with an * OpenAI key. Absent where `masked` is. */ endpoint?: string; updatedAt: number | null; /** When the provider last rejected this key (ms); chats that use it stop. */ rejectedAt?: number; /** The rejection markers couldn't be read, so nobody knows if it works. */ rejectionUnknown?: true; /** A saved key or endpoint exists but could not be decrypted. */ unreadable?: true; /** At least one stored API key name could not be decrypted. */ unreadableKey?: true; /** The stored OpenAI-compatible endpoint could not be decrypted. */ unreadableEndpoint?: true; /** * Stored in a legacy `workspace` row: the organization's (`workspace` / * orgId) for `scope: "org"`, the pre-organization solo row * (`workspace` / `solo:`) for `scope: "user"`. Chats resolve it like * a key at `scope`, and removing the provider at `scope` deletes it. */ legacyWorkspaceRow?: true; } export interface ModelProviderEntry { provider: AgentProviderId; label: string; /** A usable deployment fallback when no saved key at the default-model scope takes precedence. */ deploymentConfigured: boolean; /** The organization's key, or null when it has none. */ org: ModelProviderKey | null; /** The caller's own key, or null when they have none. */ personal: ModelProviderKey | null; } export interface ModelProvidersListing { providers: ModelProviderEntry[]; hasOrganization: boolean; /** Owner or admin of the active organization. */ canManageOrg: boolean; /** * The organization restricts personal API keys and the caller is a member, * so their personal keys are stored but not used, and they can't add more. */ personalKeysRestricted: boolean; /** The stored default model, or null when chats fall back to detection. */ defaultModel: { engine: string; model: string | null; } | null; defaultModelSource: DefaultAgentEngineSource; canUpdateDefault: boolean; } declare const _default: import("../../action.js").ActionDefinition, ModelProvidersListing>; export default _default;