/** * CredentialStore implementation backed by auth.json. * Provider auth orchestration belongs to ModelRuntime and pi-ai Models. */ import type { AuthOperationOptions, Credential, CredentialInfo, CredentialStore } from "@earendil-works/pi-ai"; type AuthStorageData = Record; type LockResult = { result: T; next?: string; }; export interface AuthStorageBackend { withLock(fn: (current: string | undefined) => LockResult): T; withLockAsync(fn: (current: string | undefined) => Promise>, options?: AuthOperationOptions): Promise; } export declare class FileAuthStorageBackend implements AuthStorageBackend { private authPath; constructor(authPath?: string); private ensureParentDir; private ensureFileExists; private acquireLockSyncWithRetry; withLock(fn: (current: string | undefined) => LockResult): T; private acquireLockAsync; withLockAsync(fn: (current: string | undefined) => Promise>, options?: AuthOperationOptions): Promise; } export declare class ReadOnlyAuthStorage implements CredentialStore { private readonly authPath; private data; constructor(authPath?: string); private load; read(providerId: string, options?: AuthOperationOptions): Promise; list(options?: AuthOperationOptions): Promise; modify(_providerId: string, _fn: (current: Credential | undefined) => Promise, _options?: AuthOperationOptions): Promise; delete(_providerId: string, _options?: AuthOperationOptions): Promise; } export declare class InMemoryAuthStorageBackend implements AuthStorageBackend { private value; private asyncChain; withLock(fn: (current: string | undefined) => LockResult): T; withLockAsync(fn: (current: string | undefined) => Promise>, options?: AuthOperationOptions): Promise; } /** * Credential storage backed by a JSON file. */ export declare class AuthStorage implements CredentialStore { private storage; private authPath; private readState; private constructor(); static create(authPath?: string): AuthStorage; static fromStorage(storage: AuthStorageBackend): AuthStorage; static inMemory(data?: AuthStorageData): AuthStorage; private parseStorageData; private updateReadState; /** * Reload credentials from storage. */ reload(): void; private reloadFromStorageAsync; private readLatestData; read(provider: string, options?: AuthOperationOptions): Promise; modify(provider: string, fn: (current: Credential | undefined) => Promise, options?: AuthOperationOptions): Promise; delete(provider: string, options?: AuthOperationOptions): Promise; /** List credential metadata without resolving configured key values. */ list(options?: AuthOperationOptions): Promise; } /** * One-off synchronous read of a stored credential from an auth.json file, * without instantiating a store or resolving configured key values. */ export declare function readStoredCredential(providerId: string, authPath?: string): Credential | undefined; export {}; //# sourceMappingURL=auth-storage.d.ts.map