Decouple 42 files from @google/genai via Delta type barrel - #14
Conversation
Native DeltaMessage/DeltaPart/DeltaResponse types with per-provider adapter layer. 67 files to migrate — gated behind branches 1 and 2.
Create packages/core/src/types/delta.ts as the single point of decoupling from @google/genai. All 42 non-provider files now import from the Delta barrel instead of directly from the SDK. Remaining direct @google/genai imports (11 files) are intentional: - types/delta.ts (the barrel itself) - contentGenerator.ts, config.ts (GoogleGenAI constructor) - openai/anthropic/qwen ContentGenerators (provider adapters) - loggingContentGenerator.ts (wraps Google SDK) - converter.ts, server.ts (Vertex AI / Code Assist) - mcp-client.ts (mcpToTool function) - deltaChat.ts (SendMessageParameters, createUserContent) When we replace @google/genai types with native Delta definitions, only types/delta.ts changes — the other 42 files are unaffected. All 1873 tests pass. Full workspace build clean.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (43)
📝 WalkthroughWalkthroughThis pull request introduces a centralized Delta type definitions module and migrates 40+ files to import types from it instead of directly from Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~28 minutes Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Creates
packages/core/src/types/delta.tsas the single decoupling point from@google/genai. 42 files migrated from direct SDK imports to the Delta barrel — pure import path changes, zero logic changes.What changed
types/delta.tsbarrel re-exports all shared types (Content,Part,GenerateContentResponse,FunctionDeclaration, etc.)../types/delta.jsinstead of@google/genai@google/genaiimports (provider adapters, factory, the barrel itself)Why this matters
When we replace
@google/genaitypes with native Delta definitions, onlytypes/delta.tschanges — the other 42 files are completely unaffected. This is the foundation for supporting provider-specific features (Anthropic citations, OpenAI structured outputs) without being constrained by Google's type system.Also includes
DeltaModelCapabilitiesandDeltaProviderTypetypes for features not representable in@google/genaiTest plan
Summary by CodeRabbit
New Features
DeltaModelCapabilitiesinterface defining model capability properties (tool calling, vision, streaming, context window, and think blocks)DeltaProviderTypeto enumerate supported AI provider identifiersRefactor
Documentation