Replace bytes.Replace with gjson.GetBytes+sjson.SetBytes in passthrough
mode to correctly handle JSON whitespace variations and avoid silently
sending empty body on read errors. Also add log search count limit to
prevent slow COUNT queries on large log tables.
Use adaptive thinking for Claude requests and rewrite passthrough bodies that still contain the legacy enabled type.
Co-Authored-By: Codex <noreply@anthropic.com>