import type { ChatMessage, NativeToolCall, ReasoningArtifact, ReasoningArtifactKind, ReasoningArtifactProvenance, ReasoningArtifactReplayDecision, ReasoningArtifactReplayObserver, ReasoningArtifactReplayTarget, ReasoningBlock } from "../types.js"; /** Input accepted by the canonical artifact factory before it is frozen. */ export interface CreateReasoningArtifactInput { readonly kind: ReasoningArtifactKind; /** Raw provider payload; never use this for display or telemetry. */ readonly raw: ReasoningArtifact["raw"]; /** Display-only projection, intentionally separate from the raw payload. */ readonly displaySummary?: string | undefined; readonly provenance: ReasoningArtifactProvenance; readonly replay: ReasoningArtifact["replay"]; readonly position?: ReasoningArtifact["position"] | undefined; } /** Metadata needed at a serializer boundary to decide whether replay is safe. */ export interface ReasoningArtifactReplayContext { readonly hasToolCalls?: boolean | undefined; readonly forceScope?: boolean | undefined; } /** * Builds privacy-safe route provenance. Endpoint identity is a one-way hash so * persisted artifacts and replay diagnostics never retain custom URL/query data. */ export declare function createReasoningArtifactProvenance(input: { provider: ReasoningArtifactProvenance["provider"]; model?: string | undefined; dialect: ReasoningArtifactProvenance["dialect"]; endpoint?: string | undefined; legacy?: true | undefined; }): ReasoningArtifactProvenance; /** Creates a safe serialization target without retaining the endpoint itself. */ export declare function createReasoningArtifactReplayTarget(input: { provider: ReasoningArtifactReplayTarget["provider"]; model: string; dialect: ReasoningArtifactReplayTarget["dialect"]; endpoint?: string | undefined; }): ReasoningArtifactReplayTarget; /** * Clones and freezes raw provider state before attaching byte/token accounting. * The factory is the only supported way to create artifacts from provider data. */ export declare function createReasoningArtifact(input: CreateReasoningArtifactInput): ReasoningArtifact; /** Returns the plaintext payload only for plaintext/signed artifact formats. */ export declare function reasoningArtifactText(artifact: ReasoningArtifact): string | undefined; /** Returns the opaque signature only for signed/thought-signature artifacts. */ export declare function reasoningArtifactSignature(artifact: ReasoningArtifact): string | undefined; /** Preserves encrypted items exactly as opaque JSON records for Meta replay. */ export declare function reasoningArtifactItems(artifact: ReasoningArtifact): Array>; /** * Returns canonical artifacts for a message. Legacy fields are converted only * when canonical data is absent, preventing duplicate replay after migration. */ export declare function reasoningArtifactsForMessage(message: ChatMessage): readonly ReasoningArtifact[]; /** Projects canonical artifacts back onto the existing legacy replay surface. */ export declare function legacyReasoningBlockFromArtifacts(artifacts: readonly ReasoningArtifact[]): ReasoningBlock | undefined; /** * Hydrates persisted legacy data into canonical artifacts while retaining the * original fields for older consumers and provider adapters. */ export declare function canonicalizeChatMessageReasoningArtifacts(message: ChatMessage): ChatMessage; /** Canonical artifact accounting for a message, including un-migrated history. */ export declare function reasoningArtifactTokensForMessage(message: ChatMessage): number; export declare function visibleReasoningDetailText(raw: ReasoningArtifact["raw"] | undefined): string | undefined; export declare function reasoningArtifactsObserved(artifacts: readonly ReasoningArtifact[] | undefined): boolean; export interface SignedThinkingArtifactInput { readonly sequence: number; readonly thinking: string; readonly signature?: string | undefined; readonly raw: ReasoningArtifact["raw"]; readonly toolCallIndex?: number | undefined; } /** Builds signed Anthropic-family artifacts without deriving replay state from display text. */ export declare function createSignedThinkingArtifacts(input: { blocks: readonly SignedThinkingArtifactInput[]; provenance: ReasoningArtifactProvenance; }): readonly ReasoningArtifact[]; /** * Rebinds artifact positions only after duplicate and empty tool-call ids have * been repaired. Raw artifact bytes stay immutable; only the history position * receives the durable call id. */ export declare function rebindReasoningArtifactsToToolCalls(input: { artifacts: readonly ReasoningArtifact[] | undefined; toolCalls: readonly NativeToolCall[]; }): readonly ReasoningArtifact[] | undefined; /** Retain active tool artifacts unconditionally; retain final turns only by policy. */ export declare function reasoningArtifactsForPersistence(input: { artifacts: readonly ReasoningArtifact[] | undefined; hasToolCalls: boolean; }): readonly ReasoningArtifact[] | undefined; /** * Conservative compatibility predicate used at final serialization only. It * never mutates stored history and never returns raw payloads in its decision. */ export declare function reasoningArtifactReplayDecision(artifact: ReasoningArtifact, target: ReasoningArtifactReplayTarget, context?: ReasoningArtifactReplayContext): ReasoningArtifactReplayDecision; /** * Filters only the wire projection. Omitted artifacts remain unchanged in the * message/persistence timeline, while callers can emit the metadata-only * decisions to their operation telemetry. */ export declare function selectReasoningArtifactsForReplay(input: { artifacts: readonly ReasoningArtifact[] | undefined; target: ReasoningArtifactReplayTarget; context?: ReasoningArtifactReplayContext | undefined; observe?: ReasoningArtifactReplayObserver | undefined; }): readonly ReasoningArtifact[];