chore(ai-sdk): widen optional peer to support AI SDK v7 - #378
Conversation
Declare compatibility with ai v7 (>=5.0.108 <8) and develop against ai@7 / @ai-sdk/openai@4. toAISDK() behavior is unchanged; only typing and docs/examples are updated for the v7 ToolExecutionOptions shape and isStepCount stop condition.
There was a problem hiding this comment.
🟢 Ready to approve
The changes are narrowly scoped to dependency range widening, AI SDK v7-compatible typing tweaks, and corresponding doc/test updates without altering tool conversion/execution behavior.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
Updates this package’s optional Vercel AI SDK integration to support AI SDK v7 while keeping compatibility with v5/v6, primarily through peer-range widening and small typing-oriented adjustments around tool execution and docs/examples.
Changes:
- Widen optional peer dependency range for
aito>=5.0.108 <8.0.0and bump dev/test catalogs toai@7.0.47+@ai-sdk/openai@4.0.27. - Adjust
toAISDK()toolexecutewrapper signature to accept AI SDK v7’s second options argument (ignored) and update tests to pass{ context: undefined }. - Refresh docs/examples to use
stopWhen: isStepCount(n)instead ofmaxSteps/stepCountIs.
File summaries
| File | Description |
|---|---|
| src/tool.ts | Updates AI SDK tool execute wrapper signature to accept v7 execution options arg. |
| src/tool.test.ts | Updates direct execute calls to include required v7-style context in options. |
| README.md | Documents AI SDK v5–v7 support and updates example to isStepCount. |
| pnpm-workspace.yaml | Bumps dev catalogs to AI SDK v7 and widens peer range for ai. |
| pnpm-lock.yaml | Lockfile updates for AI SDK v7 and associated transitive dependency versions. |
| examples/search-tools.ts | Updates AI SDK usage to isStepCount. |
| examples/README.md | Updates example docs to reference isStepCount and notes Node 22+ for AI SDK v7. |
| examples/ai-sdk-integration.ts | Updates AI SDK example to isStepCount and adds v5–v7 compatibility note. |
Review details
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
- Files reviewed: 7/8 changed files
- Comments generated: 0
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3cfb2b7e40
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
3 issues found across 8 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="examples/search-tools.ts">
<violation number="1" location="examples/search-tools.ts:125">
P2: This example claims AI SDK v5–v7 compatibility, but isStepCount was introduced in v7 (renamed from stepCountIs). Under ai@5.x/6.x the import { isStepCount } resolves to undefined, so stopWhen: isStepCount(5) throws at runtime, and the catch in main() only handles missing-module errors, not this. Recommend resolving the symbol across versions or noting the example now requires v7.</violation>
</file>
<file name="examples/README.md">
<violation number="1" location="examples/README.md:63">
P2: The example now uses `isStepCount(3)`, which the AI SDK 6→7 migration renamed from the v5/v6 `stepCountIs` export. So claiming "Compatible with AI SDK v5–v7" right next to a v7-only API is misleading: a v5/v6 user following this example would hit an `isStepCount` import error (the peer range here permits v5/v6/v7). Consider clarifying that the example targets AI SDK v7 (with `stepCountIs` for v5/v6), or noting the version-dependent helper.</violation>
</file>
<file name="README.md">
<violation number="1" location="README.md:214">
P2: The docs/examples now claim compatibility with AI SDK v5–v7 but use `isStepCount`, which only exists in AI SDK v7. The official AISDK 6.x → 7.0 migration guide documents that the stop-condition helper was renamed from `stepCountIs` to `isStepCount` in v7. Users on v5/v6 who follow this README (or the examples) and copy `stopWhen: isStepCount(3)` / `import { isStepCount } from 'ai'` will hit an undefined export, contradicting the stated v5-v7 support. Consider documenting that v5/v6 use `stepCountIs` while v7 uses `isStepCount`, or scoping the `isStepCount` example to v7 so the compatibility claim stays accurate.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
isStepCount is v7-only; stepCountIs works on v5/v6 and remains an alias in v7, matching the advertised ai peer range.
|
Addressed review feedback: examples and README now use |
There was a problem hiding this comment.
No issues found across 7 files
Auto-approved: Widens the optional ai peer range to v7, updates dev deps/tests to v7, and refreshes docs/examples; the tool-shape and execution behavior are unchanged, making this a bounded compatibility and typing-only change.
Re-trigger cubic
|
@glebedel would be amazing if someone could approve this mini-PR this weekend 🤗 I kept the dependency range compatible with previous versions, so it should really not be a problem! Thanks folks 🙌 |
|
@ybidois sorry i've already left stackone. do not ping me here please |
Summary
aipeer from>=5.0.108 <7.0.0to>=5.0.108 <8.0.0so consumers can use AI SDK v7 (still supports v5 and v6).ai@7.0.47and@ai-sdk/openai@4.0.27.toAISDK()still returns the same tool shape (inputSchemaviajsonSchema(),description, optionalexecute/execution).Code tweaks (typing only)
executeoptions argument (ignored) so tools type-check against v7ToolExecutionOptions(requiredcontext).context: undefinedwhen callingexecutedirectly.Docs / examples
maxStepswithstopWhen: stepCountIs(...)(works across v5–v7; v7 keepsstepCountIsas an alias ofisStepCount).enginesstays>=20.19.6becauseaiis optional).Test plan
pnpm buildpnpm vitest run src/tool.test.ts src/tool.test-d.ts src/tool-optional-ai.test.ts src/toolsets.test.tsOPENAI_API_KEY+STACKONE_API_KEYif desired