Q79: reasoning, encrypted reasoning and signatures survive tool turns

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-10-08 13:24:59 -04:00
1 parent 5d5bc802e9
commit d96967cfb9
13 files changed
+211 -46

No files matched your search

+16 -1
View File
@@ -22,14 +22,29 @@ export interface ToolCall {
arguments: JsonRecord;
}
/** The provider's own assistant output, sent back unchanged so reasoning, encrypted reasoning and signatures survive tool turns. */
export type AssistantReplay =
| { format: "responses" | "anthropic" | "bedrock" | "gemini"; content: unknown[] }
| { format: "chat"; content: JsonRecord };
export type AssistantTurnMessage = { role: "assistant"; text: string; toolCalls: ToolCall[]; replay?: AssistantReplay };
export type AgentTurnMessage =
| { role: "user"; text: string }
| { role: "assistant"; text: string; toolCalls: ToolCall[] }
| AssistantTurnMessage
| { role: "tool"; results: Array<{ toolCallId: string; toolName: string; output: string }>; followUp?: string };
/** The message's replay when it came from this wire format; a replay from another format is a bug, not something to drop. */
export function replayIn(message: AssistantTurnMessage, format: AssistantReplay["format"]): AssistantReplay | null {
if (!message.replay) return null;
if (message.replay.format !== format) throw new Error(`An assistant turn in ${message.replay.format} format cannot be sent to a ${format} provider.`);
return message.replay;
}
export interface AgentTurnResult {
text: string;
toolCalls: ToolCall[];
replay?: AssistantReplay;
rawResponseJson: string;
/** Rate-limit headers of the response, when the provider sent any. */
rateLimitState?: ProviderObservedRateLimitState | null;