/** * Anthropic accepts at most 4 `cache_control` breakpoints per request, counted * globally across `tools` + `system` + message content. A rich system prompt * (skills + mode + mode-skill hint + plan + autonomy contributors + the two * per-turn volatile blocks) can carry 5–7 ephemeral markers, which the API * rejects with `400 invalid_request`. This is the single chokepoint that caps * the count, keeping the markers that protect the most cache and dropping the * redundant middle ones. * * Dropping a middle breakpoint never worsens caching: Anthropic matches the * longest cached prefix, and a dropped shorter prefix is fully contained in the * next kept (longer) prefix — it was only a redundant fallback. The function * never *adds* a marker, so it can only ever preserve or improve validity. */ export declare const ANTHROPIC_MAX_BREAKPOINTS = 4; interface WireBody { tools?: unknown; system?: unknown; messages?: unknown; } /** * Ensure at most `limit` cache_control breakpoints reach the wire. When over * budget, keep: the first marker (anchors the fully-static tools+identity * prefix), the last marker (largest incremental prefix — the conversation * cache-hit each turn), every pinned/ttl marker (honors caller intent), the * second-newest marker inside `messages`, then fill remaining slots by the * largest prefix-token gap so the surviving breakpoints partition the request * as evenly as possible. `cache_control` is deleted from every dropped block in * place — so the wire objects must be fresh clones, never shared with * `ctx.systemPrompt`. * * The two newest message markers are kept together on purpose: they are this * request's prefix and the entry the PREVIOUS request wrote. Keeping only the * deepest one leaves the hit to Anthropic's bounded automatic look-back, which * a turn with many parallel tool calls can overrun. Gap-fill would rank the * pair poorly — they sit close together at the very end — so it is selected * before the generic fill. */ export declare function capAnthropicCacheBreakpoints(body: WireBody, limit?: number): void; export {}; //# sourceMappingURL=cache-breakpoint-cap.d.ts.map