/** * `thinkingSignature` markers that record where a thinking block's text * arrived instead of carrying a provider signature: an OpenAI-compatible * reasoning field, or Mistral typed content parts. The openai-completions * encoder reads them to echo reasoning back in the field it came from, so * they are replay state, not opaque provider material. * * A chat-completions turn that streamed `reasoning_details` stores a JSON * envelope instead: the entries as received, which replay verbatim, plus the * reasoning field marker the block would otherwise carry. The entries cover * the whole turn (every thinking block's text and each tool call's encrypted * signature), so a pass that rewrites any of that drops the envelope with * {@link dropReasoningDetailsEnvelopes}. */ import type { OpenAICompat } from "@oh-my-pi/pi-catalog/types"; import type { AssistantMessage } from "../types.js"; /** `thinkingSignature` marking thinking decoded from Mistral typed content parts. */ export declare const MISTRAL_CONTENT_PARTS_SIGNATURE = "mistral-content-parts"; /** OpenAI-compatible delta fields that stream plain reasoning text. */ export type ReasoningField = NonNullable; /** `thinkingSignature` envelope of a chat-completions turn that streamed `reasoning_details`. */ export interface ReasoningDetailsSignature { /** The `reasoning_details` entries as received, replayed verbatim. */ reasoningDetails: Record[]; /** The reasoning field the block's text arrived in, when one streamed. */ field?: ReasoningField; } export declare function isReasoningField(value: unknown): value is ReasoningField; /** Whether `signature` names the thinking text's source rather than signing it. */ export declare function isReasoningSourceSignature(signature: string): boolean; /** The `reasoning_details` envelope `signature` holds, if it is one. */ export declare function parseReasoningDetailsSignature(signature: string | undefined): ReasoningDetailsSignature | undefined; /** The reasoning field a thinking block's text arrived in, read from its bare marker or `reasoning_details` envelope. */ export declare function signatureReasoningField(signature: string | undefined): ReasoningField | undefined; /** The entries a request that drops the model's own thinking still replays: encrypted ones and signed text, which must stay intact. */ export declare function reasoningDetailsWithoutThinkingText(details: readonly T[]): T[]; /** Whether `signature` is an envelope whose thinking text replays even where the model's own thinking is dropped. */ export declare function replaysSignedReasoningText(signature: string | undefined): boolean; /** * `content` with every `reasoning_details` envelope reduced to its field * marker. A pass that rewrote any thinking text or tool call arguments of the * turn calls this: the entries still hold the original bytes, so replaying * them would resend what the pass removed. Encrypted entries stay on the tool * calls whose arguments were left unchanged and replay from there. */ export declare function dropReasoningDetailsEnvelopes(content: AssistantMessage["content"]): AssistantMessage["content"];