Skip to content

Conversation

@ryoppippi
Copy link
Member

@ryoppippi ryoppippi commented Jan 5, 2026

Summary

  • Move zod from dependencies to peerDependencies (>=3.25.0 <5)
  • Use zod/v4-mini subpath for smaller bundle size in schema/headers
  • Use zod/v4 subpath in feedback.ts (requires .transform/.refine)
  • Add zod to devDependencies and examples for development/testing

Why

This allows users to bring their own zod version (3.25+ or 4.x) while ensuring compatibility with AI SDK's zod peer dependency. The zod/v4-mini variant reduces bundle size for simple schemas.

Test plan

  • All tests pass
  • Lint passes

Copilot AI review requested due to automatic review settings January 5, 2026 16:38
@ryoppippi ryoppippi requested a review from a team as a code owner January 5, 2026 16:38
@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 5, 2026

Open in StackBlitz

npm i https://pkg.pr.new/StackOneHQ/stackone-ai-node/@stackone/ai@278

commit: 11108bc

Copy link
Contributor

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

Choose a reason for hiding this comment

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

No issues found across 9 files

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR attempts to refactor Zod dependency management by moving it from dependencies to peerDependencies and updating all imports to use a zod/v4 subpath. However, the implementation contains a critical issue: the zod/v4 import path does not exist in Zod's package exports.

Key changes attempted:

  • Move zod from dependencies to peerDependencies with version range >=3.25.0 <5
  • Add zod to devDependencies (^4.1.13) for development
  • Replace all zod imports with zod/v4 subpath (from zod/mini and zod)

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/schema.ts Updates import from zod/mini to invalid zod/v4 subpath
src/headers.ts Updates import from zod/mini to invalid zod/v4 subpath
src/feedback.ts Updates import from zod to invalid zod/v4 subpath
pnpm-workspace.yaml Moves zod from prod catalog to dev catalog, adds peer catalog entry
pnpm-lock.yaml Updates lock file to reflect catalog changes
package.json Moves zod from dependencies to peerDependencies and devDependencies
examples/tanstack-ai-integration.ts Updates import to invalid zod/v4 subpath
examples/claude-agent-sdk-integration.ts Updates import to invalid zod/v4 subpath
examples/claude-agent-sdk-integration.test.ts Updates import to invalid zod/v4 subpath
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


import { tool, createSdkMcpServer } from '@anthropic-ai/claude-agent-sdk';
import { z } from 'zod';
import { z } from 'zod/v4';
Copy link

Copilot AI Jan 5, 2026

Choose a reason for hiding this comment

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

The import path zod/v4 does not appear to be a valid subpath export in Zod's package. Zod (up to version 4.1.13) exports zod (main), zod/mini, and zod/locales/*, but not zod/v4. This import will likely cause a "Module not found" error at runtime.

The standard import should be import { z } from 'zod' for the main Zod API. If version 4-specific APIs are needed, they are available through the standard zod import when using Zod 4.x.

Suggested change
import { z } from 'zod/v4';
import { z } from 'zod';

Copilot uses AI. Check for mistakes.
src/schema.ts Outdated
@@ -1,4 +1,4 @@
import { z } from 'zod/mini';
import { z } from 'zod/v4';
Copy link

Copilot AI Jan 5, 2026

Choose a reason for hiding this comment

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

The import path zod/v4 does not appear to be a valid subpath export in Zod's package. Zod (up to version 4.1.13) exports zod (main), zod/mini, and zod/locales/*, but not zod/v4. This import will likely cause a "Module not found" error at runtime.

The standard import should be import { z } from 'zod' for the main Zod API. If version 4-specific APIs are needed, they are available through the standard zod import when using Zod 4.x.

Suggested change
import { z } from 'zod/v4';
import { z } from 'zod';

Copilot uses AI. Check for mistakes.
src/headers.ts Outdated
@@ -1,4 +1,4 @@
import { z } from 'zod/mini';
import { z } from 'zod/v4';
Copy link

Copilot AI Jan 5, 2026

Choose a reason for hiding this comment

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

The import path zod/v4 does not appear to be a valid subpath export in Zod's package. Zod (up to version 4.1.13) exports zod (main), zod/mini, and zod/locales/*, but not zod/v4. This import will likely cause a "Module not found" error at runtime.

The standard import should be import { z } from 'zod' for the main Zod API. If version 4-specific APIs are needed, they are available through the standard zod import when using Zod 4.x.

Suggested change
import { z } from 'zod/v4';
import { z } from 'zod';

Copilot uses AI. Check for mistakes.
import { chat } from '@tanstack/ai';
import { openai } from '@tanstack/ai-openai';
import { z } from 'zod';
import { z } from 'zod/v4';
Copy link

Copilot AI Jan 5, 2026

Choose a reason for hiding this comment

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

The import path zod/v4 does not appear to be a valid subpath export in Zod's package. Zod (up to version 4.1.13) exports zod (main), zod/mini, and zod/locales/*, but not zod/v4. This import will likely cause a "Module not found" error at runtime.

The standard import should be import { z } from 'zod' for the main Zod API. If version 4-specific APIs are needed, they are available through the standard zod import when using Zod 4.x.

Suggested change
import { z } from 'zod/v4';
import { z } from 'zod';

Copilot uses AI. Check for mistakes.
import process from 'node:process';
import { query, tool, createSdkMcpServer } from '@anthropic-ai/claude-agent-sdk';
import { z } from 'zod';
import { z } from 'zod/v4';
Copy link

Copilot AI Jan 5, 2026

Choose a reason for hiding this comment

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

The import path zod/v4 does not appear to be a valid subpath export in Zod's package. Zod (up to version 4.1.13) exports zod (main), zod/mini, and zod/locales/*, but not zod/v4. This import will likely cause a "Module not found" error at runtime.

The standard import should be import { z } from 'zod' for the main Zod API. If version 4-specific APIs are needed, they are available through the standard zod import when using Zod 4.x.

Suggested change
import { z } from 'zod/v4';
import { z } from 'zod';

Copilot uses AI. Check for mistakes.
@ryoppippi ryoppippi force-pushed the refactor/zod-peer-dependency branch from 0560439 to e2e883f Compare January 5, 2026 16:47
@ryoppippi ryoppippi changed the title refactor(deps): move zod to peerDependencies with zod/v4 subpath import refactor(deps): move zod to peerDependencies with v4-mini Jan 5, 2026
- Move zod from dependencies to peerDependencies (>=3.25.0 <5)
- Use zod/v4-mini subpath for smaller bundle size in schema/headers
- Use zod/v4 subpath in feedback.ts (requires .transform/.refine)
- Add zod to devDependencies and examples for development/testing

This allows users to bring their own zod version (3.25+ or 4.x)
while ensuring compatibility with AI SDK's zod peer dependency.
The v4-mini variant reduces bundle size for simple schemas.
@ryoppippi ryoppippi force-pushed the refactor/zod-peer-dependency branch from e2e883f to 11108bc Compare January 5, 2026 16:52
@ryoppippi ryoppippi merged commit 6492f57 into main Jan 5, 2026
15 checks passed
@ryoppippi ryoppippi deleted the refactor/zod-peer-dependency branch January 5, 2026 18:01
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.

2 participants