Skip to content

Fix typecheck and lint errors for AI SDK v6 upgrade#214

Closed
sethconvex wants to merge 55 commits intomainfrom
seth/fix-typecheck-lint-for-v6
Closed

Fix typecheck and lint errors for AI SDK v6 upgrade#214
sethconvex wants to merge 55 commits intomainfrom
seth/fix-typecheck-lint-for-v6

Conversation

@sethconvex
Copy link
Contributor

Summary

Fixes typecheck and lint errors that block PR #208 (AI SDK v6 upgrade).

⚠️ Note: This PR is based on the upgrade-ai-sdk-v6 branch from #208.
These changes should be cherry-picked or merged into #208 before that PR is merged to main.

Changes

  • Upgrade @convex-dev/rag from 0.6.1 to 0.7.0

    • RAG 0.7.0 uses ai@^6.0.0 (AI SDK v6 compatible)
    • RAG 0.6.x used AI SDK v5 types (EmbeddingModelV2) causing type conflicts with EmbeddingModelV3
  • Fix unused type params in Output interface (src/client/types.ts)

    • Prefix with _ to indicate intentionally unused for type signature compatibility
  • Remove unused import vContent (src/mapping.ts)

Verification (on top of #208)

  • npm run typecheck passes
  • npm run lint passes (0 errors, 0 warnings)
  • npm test passes (210 tests)

🤖 Generated with Claude Code

zboyles and others added 30 commits December 24, 2025 12:27
Co-authored-by: zboyles <2215540+zboyles@users.noreply.github.com>
Co-authored-by: zboyles <2215540+zboyles@users.noreply.github.com>
Document version alignment strategy with AI SDK in CHANGELOG
Co-authored-by: zboyles <2215540+zboyles@users.noreply.github.com>
- Update LanguageModelV2 to LanguageModelV3 in mockModel.ts
- Update example type declarations to use LanguageModelV3
- Add embeddingModel to Config (deprecate textEmbeddingModel)
- Update Agent class to support both embeddingModel and textEmbeddingModel
- Remove mode field from generateObject call (deprecated in v6)
- Update search.ts and saveInputMessages.ts to support both embedding fields

Co-authored-by: zboyles <2215540+zboyles@users.noreply.github.com>
Remove @openrouter/ai-sdk-provider dependency and migrate to AI SDK v3
Trigger pkg pr new build for the AI SDK v6 update
Co-authored-by: zboyles <2215540+zboyles@users.noreply.github.com>
…referred key

Co-authored-by: zboyles <2215540+zboyles@users.noreply.github.com>
Update AI SDK packages to latest versions
Two fixes:

1. normalizeToolResult in mapping.ts was stripping the isError flag.
   Now preserves isError when transforming tool result parts.

2. createAssistantUIMessage in UIMessages.ts now checks contentPart.isError
   in addition to message.error when determining tool state.

This ensures tool results with isError: true show "output-error" state
instead of incorrectly showing "output-available".

Fixes #162

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…mpatibility

Co-authored-by: zboyles <2215540+zboyles@users.noreply.github.com>
Co-authored-by: zboyles <2215540+zboyles@users.noreply.github.com>
…and context handling

- Introduced new types for tool execution and approval functions.
- Added support for input examples, strict mode, and tool approval logic.
- Updated the function signature to accommodate new properties and ensure compatibility with existing functionality.
…se types, update existing type definitions, and deprecate certain fields in favor of new alternatives.
…validators, updating serialization logic and deprecating the 'args' field in favor of 'input'.
zboyles and others added 25 commits January 17, 2026 00:52
- Updated component schema to use optional mediaType and mimeType
- Updated files.ts addFile mutation to accept both mediaType and mimeType
- Updated client files.ts to use mediaType when calling component
- Updated getFile to support both mediaType and mimeType from database
- Updated mapping.ts to return mediaType instead of mimeType
- Maintained backwards compatibility throughout

Co-authored-by: zboyles <2215540+zboyles@users.noreply.github.com>
Co-authored-by: zboyles <2215540+zboyles@users.noreply.github.com>
- Updated all file part definitions in generated component.ts
- Changed mimeType from required to optional
- Added mediaType as optional field
- Resolved all TypeScript type errors related to mimeType/mediaType

Co-authored-by: zboyles <2215540+zboyles@users.noreply.github.com>
Co-authored-by: zboyles <2215540+zboyles@users.noreply.github.com>
…t types

Co-authored-by: zboyles <2215540+zboyles@users.noreply.github.com>
Co-authored-by: zboyles <2215540+zboyles@users.noreply.github.com>
…in generated types. Ran `convex codegen --component-dir ./src/component`.
Co-authored-by: zboyles <2215540+zboyles@users.noreply.github.com>
…esult output types

Co-authored-by: zboyles <2215540+zboyles@users.noreply.github.com>
…plan

Fix AI SDK v6 type errors: tool-call input/args union type and tool-result output types
[WIP] Update createTool to support AI SDK v5 and v6 features
- Implemented handling of `tool-approval-request` and `tool-approval-response` in `deltas.ts` to update tool state accordingly.
- Enhanced tests in `deltas.test.ts` and `toUIMessages.test.ts` to verify the approval workflow, including state transitions for approval requests and responses.
- Updated `UIMessages.ts` to manage tool approval states and responses, ensuring correct state updates for tool calls based on approval outcomes.
…tToolApprovals`. Without the fix, the tool call was being filtered out because it had no tool-result, even though it had an approval response - which caused the SDK to fail at line 91 in `ai/src/generate-text/collect-tool-approvals.ts`.
…result errors since stored messages have the complete data.
… tool approval, as stored messages contain complete context.
Tool approval flow is working to the point a call is approved, assuming the user sends the tool approval response (save message/start streaming), this will automatically execute the tool and save the results to messages and stops the response before sharing the results with the model.

Need to investigate continuing the stream as in multi-step tool calls.
- Upgrade @convex-dev/rag from 0.6.1 to 0.7.0
  RAG 0.7.0 uses ai@^6.0.0 (compatible with v6), while 0.6.x used
  AI SDK v5 types (EmbeddingModelV2) causing type conflicts

- Fix unused type params in Output interface (src/client/types.ts)
  Prefix with _ to indicate intentionally unused for type signature
  compatibility

- Remove unused vContent import (src/mapping.ts)

Co-Authored-By: Claude <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Jan 21, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sethconvex sethconvex closed this Jan 26, 2026
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.

3 participants