SignatureRepair — LangChain.js middleware fixing Gemini 3.x thought_signature drops on streamed tool calls
Workaround for langchain-ai/langchainjs#9624.
Gemini 3.x (gemini-3-flash-preview, gemini-3.1-flash-lite, gemini-3.5-flash, …) requires that
every replayed functionCall part carries back the thoughtSignature it was issued with. When you
stream the turn that emits a tool call, @langchain/google-common's chunk merging concatenates the
per-chunk signature arrays out of alignment with the re-serialized parts — you end up with e.g.