• Will Chen's avatar
    Upgrade to AI SDK v6 (#2102) · 54b7a22d
    Will Chen 提交于
    <!-- CURSOR_SUMMARY -->
    > [!NOTE]
    > Modernizes AI integration across the app.
    > 
    > - Upgrade `ai` to v6 and all `@ai-sdk/*` providers to v3/v4; add
    `@ai-sdk/mcp`, remove `@openrouter/ai-sdk-provider`
    > - Migrate from `LanguageModelV2` to `LanguageModel`/`LanguageModelV3`;
    refactor fallback model to v3 streaming API
    > - Switch OpenRouter to `createOpenAICompatible`
    (`https://openrouter.ai/api/v1`)
    > - Replace experimental MCP with `@ai-sdk/mcp` (`createMCPClient`);
    update tool execution to `ToolExecutionOptions` and sanitize tool keys
    > - Update AI message envelope to `ai@v6` and types
    (`AiMessagesJsonV6`); adjust DB schema and parsing utilities
    > - Update chat/local-agent handlers to v6 stream parts (reasoning/tool
    parts), persist `aiMessagesJson`, and wire MCP tools into `ToolSet`
    > 
    > <sup>Written by [Cursor
    Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
    fc966595cbd9c6ff7d261497f00bfe79d0fff9e3. This will update automatically
    on new commits. Configure
    [here](https://cursor.com/dashboard?tab=bugbot).</sup>
    <!-- /CURSOR_SUMMARY -->
    
    <!-- This is an auto-generated description by cubic. -->
    ---
    ## Summary by cubic
    Upgrade the app to AI SDK v6 to modernize model integrations, MCP
    tooling, and streaming. This improves stability, unifies types on v3,
    and removes the OpenRouter provider in favor of an OpenAI-compatible
    setup.
    
    - **Dependencies**
      - Upgraded ai to 6.0.14 and all @ai-sdk providers to v3/v4.
      - Added @ai-sdk/mcp; removed @openrouter/ai-sdk-provider.
      - Pinned @ai-sdk/provider to 3.0.2.
    - Updated transitive deps (e.g., google-auth-library, gaxios) for Node
    >=18.
    
    - **Refactors**
    - Moved from LanguageModelV2 to v3 and standardized on ai’s
    LanguageModel.
      - Rebuilt fallback model to v3 spec with safer stream retries.
    - Switched MCP client to createMCPClient and updated tool execution to
    ToolExecutionOptions.
    - Replaced OpenRouter integration with createOpenAICompatible (baseURL
    https://openrouter.ai/api/v1).
    - Updated AI messages envelope to "ai@v6"; older "ai@v5" envelopes are
    ignored.
    
    <sup>Written for commit fc966595cbd9c6ff7d261497f00bfe79d0fff9e3.
    Summary will update on new commits.</sup>
    
    <!-- End of auto-generated description by cubic. -->
    54b7a22d
正在分析文件…
package.json 6.4 KB