/** * @license * Copyright 2026 Steven Roussey * SPDX-License-Identifier: Apache-2.0 */ import type { AiProviderRunFn, AiSessionContext, CacheCheckpointTaskInput, CacheCheckpointTaskOutput, CheckpointPrefix, ToolDefinition } from "@workglow/ai"; import type { AnthropicModelConfig } from "./Anthropic_ModelSchema"; /** * Maps workglow tool definitions onto Anthropic `tools` entries. The warm-up * and every consumer must encode tools through this one mapping — a divergent * encoding changes the serialized tool segment and breaks prompt-cache parity. */ export declare function toAnthropicTools(tools: readonly ToolDefinition[]): Record[]; /** Replaces the last tool entry with a copy carrying a cache_control breakpoint. */ export declare function annotateLastTool(tools: Array>): void; /** Wraps a plain system prompt string into the annotated block form Anthropic caches. */ export declare function wrapSystemWithCacheControl(system: string): Array>; /** * Places a cache_control breakpoint at the end of a message. Block-array * content annotates its last block; non-empty string content (the prompt-path * tail shape) is lifted into an annotated text block array. Empty content is * left alone — there is nothing cacheable to mark. */ export declare function annotateLastBlock(message: { content: unknown; }): void; /** * Builds the minimal messages.create params that write the given prefix into * Anthropic's server-side prompt cache: `max_tokens: 1`, cache_control on the * system block, the last tool, and the last prefix message block. A prefix * with no messages gets a throwaway user message (not annotated — the * system/tools breakpoints cover the cached content). */ export declare function buildAnthropicCheckpointParams(prefix: CheckpointPrefix, modelName: string): Record; /** * Mutates consuming-call params to replay a checkpoint prefix: prepends the * prefix messages, applies the prefix system prompt (when the call has none), * replays the prefix tools (when the call declares none), and places * cache_control at the checkpoint boundary. When the call emits a chained * checkpoint, the final message block is annotated too so the next chained * call reads this turn from cache. */ export declare function applyAnthropicPrefixReplay(params: Record, session: AiSessionContext): void; export declare const Anthropic_CacheCheckpoint_Stream: AiProviderRunFn;