/** * Prompt caching — the static/dynamic system-prompt split. The TypeScript port * of the Rust reference `smooth-operator-core::conversation::PromptCache`. * * A system prompt has two halves with very different churn rates: role * instructions and tool schemas barely change, while project context * (AGENTS.md / CLAUDE.md, the working set) changes every turn. Anthropic's * prompt cache keys on a PREFIX, so putting the volatile half first invalidates * the whole thing. {@link PROMPT_CACHE_BOUNDARY} splits them: everything above * the marker is static and hashed once for cache-key dedup, everything below is * dynamic and can be swapped without busting the static prefix. * * Feed the result to the agent as its instructions: * * ```ts * const cache = new PromptCache(`${rules}${PROMPT_CACHE_BOUNDARY}${projectContext}`); * new SmoothAgent(provider, { instructions: cache.fullPrompt() }); * ``` */ /** * Marker that splits a system prompt into a cacheable static portion and a * frequently-changing dynamic portion. */ export declare const PROMPT_CACHE_BOUNDARY = "__PROMPT_CACHE_BOUNDARY__"; /** A system prompt split at {@link PROMPT_CACHE_BOUNDARY}. */ export declare class PromptCache { /** The cacheable half (above the marker). */ readonly staticPortion: string; /** The frequently-changing half (below the marker). */ dynamicPortion: string; private readonly _staticHash; private readonly _staticTokens; /** * Split a system prompt at the boundary marker. With no marker the entire * prompt is treated as dynamic — nothing is claimed cacheable that the * caller didn't mark. */ constructor(prompt: string); /** * Reassemble static + boundary + dynamic. With no static portion the dynamic * half is returned alone, so a prompt that was never split round-trips * unchanged rather than gaining a stray marker. */ fullPrompt(): string; /** * Swap the dynamic half, leaving the static half and its hash untouched — * the whole point of the split. */ updateDynamic(dynamic: string): void; /** * Identifies the static portion for cache-key deduplication. * * Process-local only: it is compared against other hashes from THIS engine, * never sent on the wire, so it deliberately does not match the Rust * reference's value (Rust uses `DefaultHasher`, which is not reproducible * across languages — or even across Rust releases). The ported contract is * the behavior: same static text hashes the same, different static text * hashes differently, and `updateDynamic` never changes it. */ staticHash(): string; /** Estimated tokens the static portion saves on a cache hit. */ cachedTokens(): number; } //# sourceMappingURL=promptCache.d.ts.map