import { Option, Result, Schema } from "effect"; import { Turn } from "@effect-uai/core/Turn"; import { JsonParseError } from "@effect-uai/core/JSONL"; import * as Items from "@effect-uai/core/Items"; declare namespace codec_d_exports { export { Accumulator, CacheControl, CacheTtl, RequestBody, ThinkingConfig, WireContentBlock, WireUsage, accumulatorToTurn, appendInputJsonDelta, appendSignatureDelta, appendTextDelta, appendThinkingDelta, buildRequestBody, emptyAccumulator, mergeUsage, setStopReason, startBlock }; } declare const WireContentBlock: Schema.Union; readonly text: Schema.String; }>, Schema.Struct<{ readonly type: Schema.Literal<"tool_use">; readonly id: Schema.String; readonly name: Schema.String; readonly input: Schema.Unknown; }>, Schema.Struct<{ readonly type: Schema.Literal<"thinking">; readonly thinking: Schema.String; readonly signature: Schema.optional; }>, Schema.Struct<{ readonly type: Schema.Literal<"redacted_thinking">; readonly data: Schema.String; }>]>; type WireContentBlock = typeof WireContentBlock.Type; declare const WireUsage: Schema.Struct<{ readonly input_tokens: Schema.optional; readonly output_tokens: Schema.optional; readonly cache_creation_input_tokens: Schema.optional>; readonly cache_read_input_tokens: Schema.optional>; }>; type WireUsage = typeof WireUsage.Type; type RequestTextContent = { readonly type: "text"; readonly text: string; }; type RequestToolResultContent = { readonly type: "tool_result"; readonly tool_use_id: string; readonly content: string | ReadonlyArray; readonly is_error?: boolean; }; type RequestDocumentContent = { readonly type: "document"; readonly source: { readonly type: "url"; readonly url: string; } | { readonly type: "base64"; readonly media_type: string; readonly data: string; }; readonly title?: string; }; type RequestToolResultBlock = RequestTextContent | RequestImageContent | RequestDocumentContent; type RequestToolUseContent = { readonly type: "tool_use"; readonly id: string; readonly name: string; readonly input: unknown; }; type RequestThinkingContent = { readonly type: "thinking"; readonly thinking: string; readonly signature?: string; }; type RequestRedactedThinkingContent = { readonly type: "redacted_thinking"; readonly data: string; }; type RequestImageContent = { readonly type: "image"; readonly source: { readonly type: "url"; readonly url: string; } | { readonly type: "base64"; readonly media_type: string; readonly data: string; }; }; type RequestUserContentBlock = RequestTextContent | RequestToolResultContent | RequestImageContent; type RequestAssistantContentBlock = RequestTextContent | RequestToolUseContent | RequestThinkingContent | RequestRedactedThinkingContent; type RequestUserMessage = { readonly role: "user"; readonly content: ReadonlyArray; }; type RequestAssistantMessage = { readonly role: "assistant"; readonly content: ReadonlyArray; }; type RequestMessage = RequestUserMessage | RequestAssistantMessage; type ThinkingConfig = { readonly type: "enabled"; readonly budget_tokens: number; }; /** Cache lifetime. `1h` writes cost 2x base input; `5m` costs 1.25x. */ type CacheTtl = "5m" | "1h"; /** * Request-level cache breakpoint. Anthropic applies it to the last cacheable * block and moves it forward as the conversation grows, so the cached prefix * (`tools` → `system` → `messages`) follows the conversation without the * caller re-placing anything. */ type CacheControl = { readonly type: "ephemeral"; readonly ttl?: CacheTtl; }; type RequestBody = { readonly model: string; readonly messages: ReadonlyArray; readonly max_tokens: number; readonly system?: string; readonly temperature?: number; readonly top_p?: number; readonly top_k?: number; readonly stop_sequences?: ReadonlyArray; readonly thinking?: ThinkingConfig; readonly tools?: ReadonlyArray>; readonly tool_choice?: Record; readonly metadata?: { readonly user_id: string; }; readonly output_config?: Record; readonly cache_control?: CacheControl; readonly stream: true; }; declare const buildRequestBody: (params: { readonly model: string; readonly history: ReadonlyArray; readonly maxTokens: number; readonly temperature: Option.Option; readonly topP: Option.Option; readonly topK: Option.Option; readonly stopSequences: Option.Option>; readonly thinking: Option.Option; readonly tools: Option.Option>>; readonly toolChoice: Option.Option>; readonly userId: Option.Option; readonly outputConfig: Option.Option>; readonly cacheControl: Option.Option; }) => Result.Result; type BlockBuffer = { readonly type: WireContentBlock["type"]; readonly text: string; readonly inputJson: string; readonly thinking: string; readonly signature: string; readonly id: Option.Option; readonly name: Option.Option; readonly redactedData: Option.Option; }; type Accumulator = { readonly blocks: Readonly>; readonly stopReason: Option.Option; readonly usage: Items.Usage; }; declare const emptyAccumulator: Accumulator; declare const startBlock: (acc: Accumulator, index: number, block: WireContentBlock) => Accumulator; declare const appendTextDelta: (acc: Accumulator, index: number, text: string) => Accumulator; declare const appendInputJsonDelta: (acc: Accumulator, index: number, partial: string) => Accumulator; declare const appendThinkingDelta: (acc: Accumulator, index: number, thinking: string) => Accumulator; declare const appendSignatureDelta: (acc: Accumulator, index: number, signature: string) => Accumulator; declare const setStopReason: (acc: Accumulator, reason: string) => Accumulator; declare const mergeUsage: (acc: Accumulator, wire: WireUsage) => Accumulator; declare const accumulatorToTurn: (acc: Accumulator) => Turn; //#endregion export { Accumulator, CacheControl, CacheTtl, RequestBody, ThinkingConfig, WireContentBlock, WireUsage, accumulatorToTurn, appendInputJsonDelta, appendSignatureDelta, appendTextDelta, appendThinkingDelta, buildRequestBody, emptyAccumulator, mergeUsage, setStopReason, startBlock, codec_d_exports as t }; //# sourceMappingURL=codec.d.mts.map