import type * as plugins from './plugins.js'; import type { IAnthropicMessagesMessage, IAnthropicMessagesUsage, TAnthropicMessagesStreamEvent } from './interfaces.js'; import type { ToolNames } from './request.js'; import { type ThinkingSignatures } from './signature.js'; /** * Anthropic counts input tokens without the ones read from or written to the cache. A cache count the model did not * state is `null`, as Anthropic's own usage may give it, never 0: no cache use and an unknown one are not the same. * `input_tokens` then holds whatever of the unknown count the model's input total includes. */ export declare const toAnthropicUsage: (usageArg: plugins.LanguageModelV4Usage | undefined) => IAnthropicMessagesUsage; export interface IAnthropicMessagesStreamTranslatorOptions { messageId: string; modelId: string; thinking: false | { display: 'summarized' | 'omitted'; }; signatures: ThinkingSignatures; signatureScope: string; toolNames: ToolNames; } /** * Turns the stream of one model call into the event sequence of an Anthropic message: `message_start`, * content blocks that each open, change and close before the next one opens, then `message_delta` with the * stop reason and usage, and `message_stop`. A part it cannot state faithfully throws, and the caller ends * the stream with an error event. */ export declare class AnthropicMessagesStreamTranslator { private readonly options; private nextIndex; private open; private readonly skippedReasoning; private hasToolUse; private finished; usage: plugins.LanguageModelV4Usage | undefined; constructor(options: IAnthropicMessagesStreamTranslatorOptions); get isFinished(): boolean; start(): TAnthropicMessagesStreamEvent; push(partArg: plugins.LanguageModelV4StreamPart): Promise; private stopReason; private openBlock; private requireOpen; /** Closes an open text block before the next block; reasoning is closed only by its own end, with its signature. */ private close; } /** Builds the complete message a non-streaming request answers with from the events of its stream. */ export declare class AnthropicMessagesAccumulator { private message; apply(eventArg: TAnthropicMessagesStreamEvent): void; result(): IAnthropicMessagesMessage; private require; } export declare const encodeServerSentEvent: (eventArg: TAnthropicMessagesStreamEvent) => string;