/** * Worker-thread halves of the auth bridge: an {@link AuthStorageBackend} whose * every namespace call runs on the main thread's `AuthStorage`, and proxies of * the main thread's Anthropic slow-mode lanes. * * Synchronous API methods block on the main thread (`callSync`), async ones * `call`, and fire-and-forget mutators `notify` (ordered before any later call * on the link). Sync callbacks the main thread would have to invoke are * evaluated here first and sent as data (see `./auth-protocol`). */ import type { AnthropicSlowModeFailure, AnthropicSlowModeRetry, AnthropicSlowModeSignal, AuthAccountPolicyConfig, AuthCredentialStore, AuthStorage, AuthStorageBackend, BlocksApi, CredentialsApi, HealthApi, KeysApi, LimitsApi, OAuthApi, ResetsApi, SessionsApi, UsageApi } from "@oh-my-pi/pi-ai"; import type { AnthropicSlowModeAvailability, AnthropicSlowModeEndReason, AnthropicSlowModeHookOptions, AnthropicSlowModeLane } from "../../session/anthropic-slow-mode.js"; import type { UsageLimitState } from "../../session/usage-limit.js"; import { type RemoteObject } from "../rpc.js"; import type { AuthStorageProtocol, SlowModeLaneProtocol, SlowModeLanesProtocol } from "./auth-protocol.js"; type AuthRemote = RemoteObject; /** * Backend of a worker thread's `AuthStorage`: every namespace runs on the main * thread's instance, so pins, restrictions, refresh single-flight, round-robin, * and block/usage caches have one owner. The store's lifetime belongs to the * main thread: {@link replaceStore} is refused and {@link close} is a no-op. */ export declare class RemoteAuthStorageBackend implements AuthStorageBackend { #private; readonly credentials: CredentialsApi; readonly keys: KeysApi; readonly oauth: OAuthApi; readonly sessions: SessionsApi; readonly usage: UsageApi; readonly health: HealthApi; readonly limits: LimitsApi; readonly resets: ResetsApi; readonly blocks: BlocksApi; constructor(remote: AuthRemote); setAccountPolicies(config: AuthAccountPolicyConfig): void; replaceStore(store: AuthCredentialStore): Promise; close(): void; } /** * Drop the worker-side auth availability table of `storage` (a worker `AuthStorage`; any other * is left alone), so its next `keys.source`/`keys.keyless` reads main's current state. */ export declare function invalidateRemoteAuthAvailability(storage: AuthStorage): void; /** Worker proxy of the main thread's lane registry. */ export declare class RemoteSlowModeLanes { #private; constructor(remote: RemoteObject); /** The main thread's lane for `key` (a {@link RemoteSlowModeLane}). */ lane(key: string): AnthropicSlowModeLane; } /** Worker proxy of one main-thread slow-mode lane controller. */ export declare class RemoteSlowModeLane implements AnthropicSlowModeLane { #private; constructor(remote: RemoteObject); isActive(now?: number): boolean; activeResetsAtSec(now?: number): number | undefined; allowanceLeftPercent(): number | undefined; wrapUpHintKey(lowPriority: boolean, now?: number): number | undefined; status(now?: number, lowPriority?: boolean): UsageLimitState | undefined; availability(now?: number): AnthropicSlowModeAvailability; accept(now?: number): AnthropicSlowModeAvailability; stop(reason: AnthropicSlowModeEndReason, now?: number): boolean; reset(): void; observe(signal: AnthropicSlowModeSignal, options: AnthropicSlowModeHookOptions): void; onFailure(failure: AnthropicSlowModeFailure, options: AnthropicSlowModeHookOptions): Promise; } export {};