import type { AuthStorage } from "@oh-my-pi/pi-ai/auth-storage"; import type { ModelRegistry } from "./model-registry.js"; /** * Provider id → OAuth identity keys one session may authenticate with; see * `AuthStorage.sessions.restrict`. A listed provider uses only those accounts * and never an API key; an empty list allows no account. */ export type OAuthAccountPools = Readonly>; /** * Validate the exact-agent `task.agentAccountPools` map (agent name → provider * id → identity keys). An absent or empty (`null`) mapping means no pools, and * a `null` agent entry clears one inherited from a lower-priority settings * layer. Any other malformed level fails settings load: dropping it would * silently widen a restricted agent to every account. Both levels are * null-prototype maps, so a name such as `__proto__` stays an own entry. */ export declare function validateAgentAccountPools(value: unknown): Record; /** * One agent session's OAuth account pools, enforced at its key lookups. * * The registry from {@link registry} restricts every provider session id that * resolves a pooled provider's key through it before resolving, so requests * the session sends under ids it mints on the side (title generation, skill * compression, advisors, nested subagents) stay in the pool without each call * site opting in. A lookup without a session id resolves under the primary id * instead of falling back to the provider's unrestricted credentials. * * The scope holds the lease of every id it restricted; {@link release} lifts * them once the session can no longer resolve keys. A lease lifts only the * restriction it installed, so a restriction another session has installed on * the same id since, such as a revived session's, stays. */ export declare class SessionAccountPoolScope { #private; constructor(authStorage: Pick, pools: OAuthAccountPools, primarySessionId: string); /** Restrict `sessionId` to the pools, once per id until {@link release}. */ restrict(sessionId: string): void; /** Make `sessionId` the session's primary id: restricted, and the id for lookups that carry none. */ adopt(sessionId: string): void; /** Lift every restriction this scope installed. */ release(): void; /** * `registry` with its key lookups (`getApiKey`, `getApiKeyForProvider`, * `getApiKeyWithCredentialForProvider`, `getApiKeyAndHeaders`, `resolver`) * routed through this scope. Every other member is the unscoped registry's, * so model state, discovery, and caches stay shared. A registry another * scope returned is unwrapped first: a nested agent with its own pools uses * them, not its parent's. */ registry(registry: ModelRegistry): ModelRegistry; }