Commit Graph

9 Commits

  • refactor(thinking): use bracket tags for thinking meta
    Align thinking suffix handling on a single bracket-style marker.
    
    NormalizeThinkingModel strips a terminal `[value]` segment from
    model identifiers and turns it into either a thinking budget (for
    numeric values) or a reasoning effort hint (for strings). Emission
    of `ThinkingIncludeThoughtsMetadataKey` is removed.
    
    Executor helpers and the example config are updated so their
    comments reference the new `[value]` suffix format instead of the
    legacy dash variants.
    
    BREAKING CHANGE: dash-based thinking suffixes (`-thinking`,
    `-thinking-N`, `-reasoning`, `-nothinking`) are no longer parsed
    for thinking metadata; only `[value]` annotations are recognized.
  • feat(util): implement dynamic thinking suffix normalization and refactor budget resolution logic
    - Added support for parsing and normalizing dynamic thinking model suffixes.
    - Centralized budget resolution across executors and payload helpers.
    - Retired legacy Gemini-specific thinking handlers in favor of unified logic.
    - Updated executors to use metadata-based thinking configuration.
    - Added `ResolveOriginalModel` utility for resolving normalized upstream models using request metadata.
    - Updated executors (Gemini, Codex, iFlow, OpenAI, Qwen) to incorporate upstream model resolution and substitute model values in payloads and request URLs.
    - Ensured fallbacks handle cases with missing or malformed metadata to derive models robustly.
    - Refactored upstream model resolution to dynamically incorporate metadata for selecting and normalizing models.
    - Improved handling of thinking configurations and model overrides in executors.
    - Removed hardcoded thinking model entries and migrated logic to metadata-based resolution.
    - Updated payload mutations to always include the resolved model.
  • refactor(executor): dedupe thinking metadata helpers across Gemini executors
    Extract applyThinkingMetadata and applyThinkingMetadataCLI helpers to
    payload_helpers.go and use them across all four Gemini-based executors:
    - gemini_executor.go (Execute, ExecuteStream, CountTokens)
    - gemini_cli_executor.go (Execute, ExecuteStream, CountTokens)
    - aistudio_executor.go (translateRequest)
    - antigravity_executor.go (Execute, ExecuteStream)
    
    This eliminates code duplication introduced in the -reasoning suffix PR
    and centralizes the thinking config application logic.
    
    Net reduction: 28 lines of code.
  • **feat(runtime): add payload configuration support for executors**
    Introduce `PayloadConfig` in the configuration to define default and override rules for modifying payload parameters. Implement `applyPayloadConfig` and `applyPayloadConfigWithRoot` to apply these rules across various executors, ensuring consistent parameter handling for different models and protocols. Update all relevant executors to utilize this functionality.