Skip to content

chore(ai-sdk): widen optional peer to support AI SDK v7 - #378

Open
ybidois wants to merge 2 commits into
StackOneHQ:mainfrom
ybidois:chore/ai-sdk-v7-peer-support
Open

chore(ai-sdk): widen optional peer to support AI SDK v7#378
ybidois wants to merge 2 commits into
StackOneHQ:mainfrom
ybidois:chore/ai-sdk-v7-peer-support

Conversation

@ybidois

@ybidois ybidois commented Aug 1, 2026

Copy link
Copy Markdown

Summary

  • Widen the optional ai peer from >=5.0.108 <7.0.0 to >=5.0.108 <8.0.0 so consumers can use AI SDK v7 (still supports v5 and v6).
  • Develop/test against ai@7.0.47 and @ai-sdk/openai@4.0.27.
  • No change to StackOne tool conversion or execution behavior. toAISDK() still returns the same tool shape (inputSchema via jsonSchema(), description, optional execute / execution).

Code tweaks (typing only)

  • Accept AI SDK’s second execute options argument (ignored) so tools type-check against v7 ToolExecutionOptions (required context).
  • Tests pass context: undefined when calling execute directly.

Docs / examples

  • Replace stale maxSteps with stopWhen: stepCountIs(...) (works across v5–v7; v7 keeps stepCountIs as an alias of isStepCount).
  • Note that AI SDK v7 requires Node.js 22+ (package engines stays >=20.19.6 because ai is optional).

Test plan

  • pnpm build
  • pnpm vitest run src/tool.test.ts src/tool.test-d.ts src/tool-optional-ai.test.ts src/toolsets.test.ts
  • CI green
  • Spot-check an example with OPENAI_API_KEY + STACKONE_API_KEY if desired

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.
@ybidois
ybidois marked this pull request as ready for review August 1, 2026 09:04
@ybidois
ybidois requested a review from a team as a code owner August 1, 2026 09:04
Copilot AI review requested due to automatic review settings August 1, 2026 09:04

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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 ai to >=5.0.108 <8.0.0 and bump dev/test catalogs to ai@7.0.47 + @ai-sdk/openai@4.0.27.
  • Adjust toAISDK() tool execute wrapper 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 of maxSteps / 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread examples/ai-sdk-integration.ts Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread examples/search-tools.ts Outdated
Comment thread examples/README.md Outdated
Comment thread README.md Outdated
isStepCount is v7-only; stepCountIs works on v5/v6 and remains an alias
in v7, matching the advertised ai peer range.
@ybidois

ybidois commented Aug 1, 2026

Copy link
Copy Markdown
Author

Addressed review feedback: examples and README now use stepCountIs instead of v7-only isStepCount, so snippets work across the advertised ai peer range (v5–v7). In v7, stepCountIs remains an alias of isStepCount.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@ybidois

ybidois commented Aug 1, 2026

Copy link
Copy Markdown
Author

@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 🙌

@ryoppippi

ryoppippi commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

@ybidois sorry i've already left stackone. do not ping me here please

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