import { type Api, type Model, type TranscriptContext } from "@bastani/pi-ai"; import type { SimpleStreamOptions } from "@bastani/pi-ai/compat"; import type { ModelRuntime } from "./model-runtime.js"; import type { ModelRuntimeSimpleStreamOptions } from "./model-runtime-streaming.ts"; import type { SessionManager, UsageEntry } from "./session-manager.ts"; import type { CacheWarmingMode } from "./settings-manager.ts"; export declare function getCacheWarmingDelayMs(ttlMs: number): number | undefined; export declare function getPromptCacheTtlMs(model: Model, options: SimpleStreamOptions | undefined): number | undefined; /** Budget-based Anthropic thinking changes the cache key when max_tokens changes. */ export declare function isReplayable(model: Model, options: SimpleStreamOptions | undefined): boolean; export type CacheWarmingAction = "warm" | "stop"; export interface CacheWarmingDecision { phase: "streaming" | "idle"; warmCost: number; missCost: number; continuationProbability: number; expectedSavings: number; economicsAvailable: boolean; action: CacheWarmingAction; } export interface CacheWarmingDecisionEvent extends Pick { type: "cache_warming_decision"; } export interface CacheWarmingDecisionEventResult { action?: CacheWarmingAction; } export interface CacheWarmingStatus { state: "inactive" | "scheduled" | "refreshing"; reason?: string; nextWarmAt?: number; decision?: CacheWarmingDecision; extensionOverride?: boolean; } export interface CacheWarmRequest { model: Model; context: TranscriptContext; options: ModelRuntimeSimpleStreamOptions; } /** One replayable prompt, bounded by its original start time rather than refresh activity. */ export declare class CacheWarmer { private run?; private inactive; onWarmed?: (entry: UsageEntry) => void; private readonly models; private readonly sessionManager; private readonly getMode; private readonly decide; private readonly runRefresh; constructor(models: Pick, sessionManager: Pick, getMode: () => CacheWarmingMode, decide?: (event: CacheWarmingDecisionEvent) => Promise, runRefresh?: (refresh: () => Promise) => Promise); get status(): CacheWarmingStatus; start(request: CacheWarmRequest, isCurrent: () => boolean): void; onAgentSettled(): void; onModeChanged(): void; cancel(): void; private clearRun; private stop; private schedule; private refresh; private refreshDeadlineMissed; private validateRun; private getModeStopReason; private evaluate; } export declare function formatCacheWarmingStatus(status: CacheWarmingStatus, now?: number): string; export declare function formatCacheWarmingUsage(entry: UsageEntry): string; //# sourceMappingURL=cache-warmer.d.ts.map