/** * Predictive Prefetch — anticipatory attention. * * Helpers for warming a session's working-memory buffer before the agent * asks. Strategy is intentionally simple here so the consumer (a tool * handler, an IDE plugin) controls scheduling and the actual DB calls: * * 1. extractTopics(filePath, symbols) * Builds a topic phrase from a file path and (optionally) its symbol * definitions. The phrase is used as a search query for related * memories. * * 2. buildPrefetchPlan(input, config) * Decides what to fetch (chains, minImportance, maxResults). The * consumer executes the search and primes the buffer with whatever * is returned. * * Default `enabled: false` — experimental until we have telemetry on * which patterns actually win. */ export interface PrefetchConfig { enabled: boolean; /** Maximum number of memories to warm-load per file open. */ maxResults: number; /** Minimum importance of memories to consider for prefetch. */ minImportance: number; /** Memory chains (Memory.type values) to query. */ chains: string[]; } export interface PrefetchInput { filePath: string; symbols?: Array<{ name: string; }>; } export interface PrefetchPlan { enabled: boolean; query: string; chains: string[]; minImportance: number; maxResults: number; /** Hint to the buffer layer: how much TTL to apply (shorter than query TTL). */ ttlMs: number; } /** * Pull human-readable tokens out of a path + optional symbol names. * "src/auth/middleware.ts" + [{name: "verifyJwt"}] -> ["auth", "middleware", "verify", "jwt"] */ export declare function extractTopics(input: PrefetchInput): string[]; export declare function buildPrefetchPlan(input: PrefetchInput, config: PrefetchConfig): PrefetchPlan; /** * Result entries the caller provides for priming. Same shape as * `WorkingMemoryBuffer.prime` consumes, kept loose so the consumer doesn't * need to depend on SearchResult in its own code path. */ export interface PrefetchEntry { id: string; content: string; score?: number; metadata?: Record; } /** * Plan + execute: given a session and a function that knows how to fetch * related memories, build the plan and prime the session's buffer with the * returned entries. Returns a summary the caller can log or return as the * API response. Errors are swallowed (fire-and-forget semantics). */ export declare function executePrefetch(input: PrefetchInput, fetchEntries: (plan: PrefetchPlan) => Promise, primeFn: (entries: PrefetchEntry[]) => number, config?: PrefetchConfig): Promise<{ enabled: boolean; query: string; primed: number; skippedReason?: string; }>; export declare const DEFAULT_PREFETCH_CONFIG: PrefetchConfig; //# sourceMappingURL=prefetch.d.ts.map