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

Closed
YB
4mo ago
+193-170

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