/** * Cache Strategy Planner, uses the helper model (or main model) to optimize * cache breakpoint placement for explicit-caching providers. * * Two modes: * 1. Heuristic (default): Uses getDefaultStrategy() from cache-strategy.ts * 2. LLM-assisted: Sends context to the helper model for optimized strategy * * The planner runs: * - Once at session start (first turn) * - Every N turns (configurable, default 10) * - When cache hit rate drops below threshold */ import type { CacheStrategy, CacheContext, CacheHitTracker } from './cache-strategy.js'; import type { ConfigManager } from '../config/manager.js'; import type { HelperModel } from '../config/helper-model.js'; /** Result of a strategy planning run. */ export interface PlanResult { strategy: CacheStrategy; source: 'heuristic' | 'helper' | 'cached'; planTimeMs: number; } /** * CachePlanner, manages cache strategy lifecycle. * * Caches the current strategy and refreshes it based on * turn count and hit rate thresholds. */ export declare class CachePlanner { private readonly configManager; private readonly helperModel; private currentStrategy; private lastPlanTurn; private turnsSinceLastPlan; private readonly cacheHitTracker; constructor(configManager: Pick, helperModel: Pick, cacheHitTracker: Pick); /** * Get the current cache strategy, planning a new one if needed. * * Triggers re-planning when: * - No strategy exists yet (first call) * - refreshAfterTurns threshold reached * - Cache hit rate dropped below warning threshold */ getStrategy(context: CacheContext): Promise; /** Check if strategy needs refresh. */ private shouldRefresh; /** * Use the helper model to plan an optimized cache strategy. * Returns null if the helper can't produce a valid strategy. */ private planWithHelper; /** Build the prompt for the helper model. */ private buildHelperPrompt; /** Force a strategy refresh on the next getStrategy() call. */ invalidate(): void; } //# sourceMappingURL=cache-planner.d.ts.map