Skip to content

Conversation

@threepointone
Copy link
Contributor

fixes #751

The 'ai' package is no longer marked as optional under peerDependenciesMeta in agents/package.json. This change ensures that 'ai' is treated as a required peer dependency.

fixes #751

The 'ai' package is no longer marked as optional under peerDependenciesMeta in agents/package.json. This change ensures that 'ai' is treated as a required peer dependency.
@changeset-bot
Copy link

changeset-bot bot commented Dec 29, 2025

🦋 Changeset detected

Latest commit: f197523

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
agents Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@claude
Copy link

claude bot commented Dec 29, 2025

Claude Code Review

Summary: LGTM - This fix correctly addresses the bundle error.

Analysis:
The PR correctly removes ai from peerDependenciesMeta, making it a required peer dependency. This is the right fix because:

  1. Bundle errors confirmed: The code dynamically imports ai in production paths:

    • src/mcp/client.ts:906 - import("ai") for jsonSchema
    • src/ai-chat-agent.ts:1278 - import("ai") for streaming utilities
  2. Not truly optional: These are core functionality paths, not optional features. Without ai installed, the bundle fails as reported in Deploy to Cloudflare buttons are failing on demos using v0.3 #751.

  3. Changeset included: Proper patch-level changeset added.

Note: While this fixes the immediate issue, there's a broader architectural question about whether dynamic imports of required dependencies is the right pattern (creates confusing DX when bundlers can't resolve them). But that's out of scope for this fix.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 29, 2025

Open in StackBlitz

npm i https://pkg.pr.new/cloudflare/agents@754

commit: f197523

@threepointone threepointone merged commit e21051d into main Dec 29, 2025
5 checks passed
@threepointone threepointone deleted the fix-ai-optional branch December 29, 2025 10:32
@github-actions github-actions bot mentioned this pull request Dec 29, 2025
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.

Deploy to Cloudflare buttons are failing on demos using v0.3

1 participant