gateThinkingLevel function

(String?, String?) gateThinkingLevel(
  1. String? level, {
  2. required bool reasoning,
})

The thinking gate: a pinned rung on a reasoning:false model is dropped WITH a loud note (E3 — the request proceeds without thinking fields; never silently sent). The level rides VERBATIM: the xhigh/max → high fold happens at the config parse boundary (normalizeConfigThinkingLevel), never at model build — the same pass-through contract ModelRef/FA_PROVIDER_CONFIG pins.

Implementation

(String?, String?) gateThinkingLevel(String? level, {required bool reasoning}) {
  if (level == null) return (null, null);
  if (!reasoning) {
    return (
      null,
      'thinking level "$level" pinned on a non-reasoning model — gated, '
          'the request proceeds without thinking fields',
    );
  }
  return (level, null);
}