/** * The bearer resolver of one chat turn on the shared subscription core, for * any provider: the shared resolver (`./credential-resolver`: proactive * staleness refresh by the adapter's policy, local single-flight) over the * provider's turn runtime, so every read and refresh is scoped to the exact * accepted turn and its live lease. The caller maps the leased credential * to its transport's token snapshot and names its relogin error. * * The first provider keeps its own M3 binding, which predates this helper * and carries test seams of its own. */ import type { Settings } from "@opengeni/config"; import type { Database } from "../database.js"; import type { SubscriptionCoreProvider } from "./provider.js"; import { type SubscriptionCoreCredential, type SubscriptionCoreLeaseRef, type SubscriptionCoreRefreshDeps, type SubscriptionCoreTurnIdentity } from "./turns.js"; export type SubscriptionCoreTurnTokenMapping = { /** The transport's token snapshot for a leased (or just rotated) credential. */ snapshot(credential: SubscriptionCoreCredential): Snapshot; /** The provider's revoked-sign-in error (null: the stored status says so). */ relogin(message: string | null): Error; }; export declare function buildSubscriptionCoreTurnTokenResolver(db: Database, settings: Settings, provider: SubscriptionCoreProvider, identity: SubscriptionCoreTurnIdentity, lease: SubscriptionCoreLeaseRef, mapping: SubscriptionCoreTurnTokenMapping, deps?: SubscriptionCoreRefreshDeps): { getToken: () => Promise; refresh: () => Promise; };