Fix zod 4 incompatibility in loggerSchema (closes #17)#18
Merged
Conversation
`z.function().args().returns()` is zod 3 syntax and was removed in zod 4
(replaced by `z.function({ input, output })`). Because the package's peer
range declares `zod@^3 || ^4`, importing under zod 4 crashed at module-load:
TypeError: z.function(...).args is not a function
Replace with `z.custom<Fn>(v => typeof v === 'function')`, which is
identical across both major versions and captures the same intent for a
logger-like contract (runtime function guard).
4 tasks
bjcoombs
added a commit
to bjcoombs/claude-task-master
that referenced
this pull request
Apr 14, 2026
… hint - ben-vargas/ai-sdk-provider-opencode-sdk#18 released as v0.0.3 fixes the zod 4 incompat. Bump the dep so OpenCode selection actually works end-to-end - Add OPENCODE case to setModel's providerHint cascade in scripts/modules/task-manager/models.js so --opencode is accepted
bjcoombs
added a commit
to bjcoombs/claude-task-master
that referenced
this pull request
Apr 14, 2026
… hint - ben-vargas/ai-sdk-provider-opencode-sdk#18 released as v0.0.3 fixes the zod 4 incompat. Bump the dep so OpenCode selection actually works end-to-end - Add OPENCODE case to setModel's providerHint cascade in scripts/modules/task-manager/models.js so --opencode is accepted
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #17: `ai-sdk-v5` tag line (`v0.0.2`) crashes at module-load under zod 4 because `loggerSchema` uses zod 3's `z.function().args().returns()` API, which was removed in zod 4.
Changes
Why `z.custom` rather than `z.function({ input, output })`
`z.function({ input, output })` is zod 4 only and would break zod 3 consumers. `z.custom` is stable across both majors and captures exactly the runtime guarantee this schema needs — "this value is a function". The original `.args(z.string())` signature declaration was never actually validating call-sites anyway; it was documentation in type form, which the TypeScript `Logger` interface already provides.
Testing
```bash
npm install --no-save zod@^4.1.0 && node -e "require('./dist/index.cjs').createOpencode({})"
loaded OK
```Context
I hit this while integrating the provider into claude-task-master#1685. Task Master uses AI SDK v5 which pulls zod 4 through `@ai-sdk/*` packages, so any consumer in that ecosystem is affected.
Test plan