Skip to content

Conversation

@Tarquinen
Copy link
Collaborator

Summary

  • Refactor monolithic index.ts into focused, maintainable modules while preserving all functionality
  • Add Google/Gemini and OpenAI Responses API format support for context pruning (from unpushed commits)

Changes

Architecture Improvements

  • Split fetch wrapper into lib/fetch-wrapper/ with format-specific handlers:
    • openai-chat.ts: OpenAI Chat Completions & Anthropic format
    • openai-responses.ts: OpenAI Responses API format (GPT-5)
    • gemini.ts: Google/Gemini format with position-based correlation
    • types.ts: Shared types and utility functions
  • Create lib/state.ts for centralized plugin state management
  • Create lib/hooks.ts for event and chat.params handlers
  • Create lib/pruning-tool.ts for context_pruning tool definition
  • Create lib/tool-cache.ts for tool parameter caching utilities
  • Reduce index.ts from 500+ lines to ~80 lines of initialization code

Bug Fix

  • Simplify Gemini response structure for API compatibility (already in commit history)

Version

0.3.21

…ontext pruning

- Add position-based tool call correlation for Google/Gemini format (body.contents with functionResponse)
- Add OpenAI Responses API support (body.input with function_call_output and call_id)
- Extract getAllPrunedIds helper for reuse across all format handlers
- Build position mapping in chat.params hook for google/google-vertex providers
- Remove incomplete strip-reasoning strategy from default config
- Use string instead of nested object for functionResponse.response
- Preserves thoughtSignature via spread operator (required for Gemini 3 Pro)
- Aligns with Google's flexible response format
…rate modules

- Split monolithic index.ts into focused modules for better maintainability
- Extract fetch wrapper into lib/fetch-wrapper/ with format-specific handlers:
  - openai-chat.ts: OpenAI Chat Completions & Anthropic format
  - openai-responses.ts: OpenAI Responses API format (GPT-5)
  - gemini.ts: Google/Gemini format with position-based correlation
  - types.ts: Shared types and utility functions
- Create lib/state.ts for centralized plugin state management
- Create lib/hooks.ts for event and chat.params handlers
- Create lib/pruning-tool.ts for context_pruning tool definition
- Create lib/tool-cache.ts for tool parameter caching utilities
- Reduce index.ts from 500+ lines to ~80 lines of initialization code
@Tarquinen Tarquinen merged commit edc6932 into master Nov 29, 2025
1 check passed
@Tarquinen Tarquinen deleted the refactor/modularize-fetch-wrapper branch November 29, 2025 02:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants