Commit Graph

9 Commits

  • feat(gemini-cli): add multi-project support and enhance credential handling
    Introduce support for multi-project Gemini CLI logins, including shared and virtual credential management. Enhance runtime, metadata handling, and token updates for better project granularity and consistency across virtual and shared credentials. Extend onboarding to allow activating all available projects.
  • feat(vertex): add usage source resolution for Vertex projects
    Extend `resolveUsageSource` to support Vertex projects by extracting and normalizing `project_id` or `project` from the metadata for accurate source resolution.
  • fix(executor): ensure usage reporting for upstream responses lacking usage data
    Add `ensurePublished` to guarantee request counting even when usage fields (e.g., tokens) are absent in OpenAI-compatible executor responses, particularly for streaming paths.
  • Refactor executor error handling and usage reporting
    - Updated the Execute methods in various executors (GeminiCLIExecutor, GeminiExecutor, IFlowExecutor, OpenAICompatExecutor, QwenExecutor) to return a response and error as named return values for improved clarity.
    - Enhanced error handling by deferring failure tracking in usage reporters, ensuring that failures are reported correctly.
    - Improved response body handling by ensuring proper closure and error logging for HTTP responses across all executors.
    - Added failure tracking and reporting in the usage reporter to capture unsuccessful requests.
    - Updated the usage logging structure to include a 'Failed' field for better tracking of request outcomes.
    - Adjusted the logic in the RequestStatistics and Record methods to accommodate the new failure tracking mechanism.
  • feat(usage): add support for tracking request source in usage records
    - Introduced `Source` field to usage-related structs for better origin tracking.
    - Updated `newUsageReporter` to resolve and populate the `Source` attribute.
    - Implemented `resolveUsageSource` to determine source from auth metadata or API key.
  • feat(usage): implement usage tracking infrastructure across executors
    - Added `LoggerPlugin` to log usage metrics for observability.
    - Introduced a new `Manager` to handle usage record queuing and plugin registration.
    - Integrated new usage reporter and detailed metrics parsing into executors, covering providers like OpenAI, Codex, Claude, and Gemini.
    - Improved token usage breakdown across streaming and non-streaming responses.