/** * DB-backed custom providers source for model resolution (factory mode). * * The SDK's `resolveModel` and gateway catalog ask the registered * `CustomProvidersSource` synchronously, so this module keeps a small per-org * **snapshot** of custom provider rows hydrated from the `custom-providers` * domain. Once registered the source is authoritative — the factory never * reads `settings.json` custom providers, in either auth mode: * * - tenant mode: rows are scoped per org (`tenantOrgId`); calls without an * authenticated tenant (boot-time catalog) resolve to an empty list. * - no-auth/local mode: rows live under the sentinel `local` org, matching the * custom provider routes. * * Snapshots are primed per request by `createCustomProvidersPrimer` (mounted * after the web auth gate) and invalidated on writes via * `invalidateCustomProvidersSnapshots` so changes are visible immediately. */ import type { MiddlewareHandler } from 'hono'; import type { CustomProvidersStorage } from '../storage/domains/custom-providers/base.js'; import type { RouteAuth } from './route.js'; /** * Register the DB-backed custom providers source with the SDK. Called by the * factory after storage init with the `custom-providers` domain handle; from * then on model resolution and the gateway catalog never read settings.json * custom providers. */ export declare function registerCustomProvidersSource({ storage, authEnabled, }: { storage: CustomProvidersStorage; authEnabled: boolean; }): void; /** * Drop the org's cached snapshot after a custom provider write so the change * is visible to the next model call immediately instead of after the TTL. */ export declare function invalidateCustomProvidersSnapshots(tenant: { orgId: string; }): void; /** Test hook: clear registration and cached org snapshots. */ export declare function resetCustomProvidersSourceForTests(): void; /** * Middleware mounted after the web auth gate: primes the caller's org snapshot * so the request's first model call sees their custom providers without an * async seam in model resolution. Cheap when fresh (TTL check), best-effort * when not — a failed hydrate serves the last snapshot, never blocks a request. */ export declare function createCustomProvidersPrimer({ auth, storage, authEnabled, }: { auth: RouteAuth; storage: CustomProvidersStorage; authEnabled: boolean; }): MiddlewareHandler; //# sourceMappingURL=custom-provider-source.d.ts.map