-
Notifications
You must be signed in to change notification settings - Fork 2.9k
refactor: complete AI SDK migration — all 26 providers + neutral message model + cache unification #11329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Generated with ❤️ by ellipsis.dev |
Reviewed 434a0c9 (1 new commit since last review). Both previously flagged issues remain unresolved. No new issues found.
Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
bc67511 to
2ee82c1
Compare
0a7cf86 to
59c882e
Compare
… model + cache unification Migrate all 26 providers to AI SDK, replace Anthropic-shaped message types with AI SDK types, eliminate legacy transforms, and unify cache control. Provider Migrations: - 8 providers → OpenAICompatibleHandler (Archetype 1) - 6 providers → dedicated @ai-sdk/* packages (Archetype 2/3) - 3 OpenAI providers → @ai-sdk/openai (Chat Completions + Responses API) - 3 providers → @openrouter/ai-sdk-provider, @ai-sdk/anthropic, @ai-sdk/google-vertex/anthropic - 1 provider → custom LanguageModelV3 adapter (VS Code LM) Type System: - Replace Anthropic.MessageParam with AI SDK types (ToolCallPart, ToolResultPart, ReasoningPart, etc.) - tool_use → tool-call, tool_result → tool-result, thinking → reasoning - id/name/input → toolCallId/toolName/input, tool_use_id → toolCallId - Add migrateApiMessages() for backward-compatible api_conversation_history.json reading - Define RooContentBlock, RooMessageParam, RooMessageMetadata, RedactedReasoningPart Dead Code Removed: - Legacy base classes: BaseOpenAiCompatibleProvider, RouterProvider - Format transforms: r1-format, mistral-format, openai-format, minimax-format, vscode-lm-format - Per-provider caching: caching/anthropic, caching/gemini, caching/vertex, caching/vercel-ai-gateway - anthropic-filter.ts New Dependencies: @ai-sdk/openai, @ai-sdk/anthropic, @ai-sdk/provider New Shared Utility: src/api/transform/caching.ts (unified cache control)
59c882e to
434a0c9
Compare
Summary
Complete AI SDK migration across the entire provider layer, replacing raw SDK usage, legacy base classes, Anthropic-shaped message types, per-provider format transforms, and per-provider caching logic with a unified AI SDK architecture.
Builds on: PR #11297 (provider removals)
Changes
Provider Migrations (Sessions 1-5)
All 26 remaining providers now use AI SDK:
OpenAICompatibleHandler, ~60-150 lines each@ai-sdk/openai), openai-native, openai-codex, openrouter (@openrouter/ai-sdk-provider), anthropic (@ai-sdk/anthropic), anthropic-vertex (@ai-sdk/google-vertex/anthropic)streamText/generateTextLanguageModelV3adapter wrapping VS Code LM APINeutral Message Model (Session 6)
Replaced
Anthropic.Messages.MessageParamwith provider-agnostic types across 48 production files:NeutralMessageParam,NeutralContentBlock,RooMessageMetadatatypes inapiMessages.tsApiHandler.createMessage()acceptsNeutralMessageParam[](not Anthropic types)@anthropic-ai/sdkisolated to the Anthropic provider itselfTransformer & Cache Cleanup (Session 7)
anthropic-filter.tscaching.tswith sharedapplyCacheBreakpoints()/buildCachedSystemMessage()@anthropic-ai/sdktype importsDead Code Deleted
base-openai-compatible-provider.ts,router-provider.tsr1-format.ts,mistral-format.ts,openai-format.ts,minimax-format.ts,vscode-lm-format.tscaching/anthropic.ts,caching/gemini.ts,caching/vertex.ts,caching/vercel-ai-gateway.tsanthropic-filter.tsNew Dependencies
@ai-sdk/openai(^3.0.26)@ai-sdk/anthropic(^3.0.38)@ai-sdk/provider(^3.0.4)Verification
check-typesKnown Residuals
converters.tsretains@anthropic-ai/sdkimport for tool types (needs neutral tool type definitions)ai-sdk.ts(583 lines) could be further decomposed once storage shifts to AI SDKModelMessageformat@anthropic-ai/sdkfor structurally-compatible fixtures (zero breakage, cosmetic cleanup)