f59996362e
Closes audit gap #3. The bridge now extracts the encrypted reasoning blob from `MessageV2.ReasoningPart.metadata` and surfaces it on `LLM.ReasoningPart.encrypted`, where the Anthropic and Bedrock adapters lower it to the wire — Anthropic emits `thinking.signature`, Bedrock emits `reasoningContent.reasoningText.signature`. Without this, multi-turn sessions with reasoning models would lose the encrypted state on every step and break the chain. The encrypted blob originates in three different places depending on how the session was started: 1. AI-SDK Anthropic sessions store it as `metadata.anthropic.signature` (per AI SDK provider-keyed convention). 2. AI-SDK OpenAI sessions store it as `metadata.openai.reasoningEncryptedContent`. 3. Future LLM-native sessions will store it as a top-level `metadata.encrypted` string (cleanest shape — provider-agnostic, matches the LLM IR field name). The new `encryptedReasoning` helper probes all three locations in order, so existing OpenCode sessions can be served by the LLM-native path without re-recording reasoning content. The full `metadata` record continues to flow through to `LLM.ReasoningPart.metadata` unchanged, preserving any provider-specific fields adapters might read in the future. OpenAI Responses encrypted reasoning round-trip is intentionally out of scope: the LLM-package adapter doesn't yet model reasoning items in the request body. That's a separate adapter feature requiring new input-item schema variants and is deferred until needed. Tests (5 new in llm-native.test.ts): - AI-SDK Anthropic signature extracted into LLM.ReasoningPart.encrypted. - End-to-end Anthropic lowering: bridge \u2192 client.prepare \u2192 target with `thinking.signature` populated correctly. - AI-SDK OpenAI reasoningEncryptedContent extracted (forward compatibility — useful when the OpenAI Responses adapter gains reasoning-item lowering). - Top-level metadata.encrypted extracted (LLM-native session shape). - No known key in metadata leaves `encrypted` undefined. Verified: 33/0/0 across native + bridge tests (was 28; +5 from the new reasoning extraction tests).