openqa icon indicating copy to clipboard operation
openqa copied to clipboard

fix: move AI provider SDKs from optional peer deps to regular dependencies

Open gurvinder-dhillon opened this issue 7 months ago • 0 comments

Problem

@anthropic-ai/claude-agent-sdk and @opencode-ai/sdk are currently marked as optional peer dependencies. This causes a runtime crash when a user installs openqa directly:

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@opencode-ai/sdk'

This happens even if the user only imports claudeCode — static top-level imports in both provider files mean Node resolves all SDKs at module load time, regardless of which provider is actually used.

Root cause

Optional peer deps are not installed automatically. They're appropriate when the host project already owns the dependency (e.g. @playwright/test). Neither AI SDK falls into that category — only openqa uses them.

Fix

Move @anthropic-ai/claude-agent-sdk and @opencode-ai/sdk from peerDependencies (optional) to regular dependencies. They get installed automatically on npm install openqa, zero friction, zero crashes.

Keep @playwright/test, playwright-bdd, and @cucumber/cucumber as peer deps — those are owned by the user's project.

Decision rationale

  • If only openqa uses a package → regular dependency
  • If the user's project already has it and controls the version → peer dependency

gurvinder-dhillon avatar May 06 '26 04:05 gurvinder-dhillon