summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorKit Langton <[email protected]>2026-04-21 17:49:24 -0400
committerGitHub <[email protected]>2026-04-21 17:49:24 -0400
commit2da6d860e0e2c5309a0030a5591c8218fffd6a99 (patch)
treeb453954f20ccec7a9a1e377f2a91851f487d1128
parentdf0c1f649c306bd1c125c0b532bd17b76bf888c0 (diff)
downloadopencode-2da6d860e0e2c5309a0030a5591c8218fffd6a99.tar.gz
opencode-2da6d860e0e2c5309a0030a5591c8218fffd6a99.zip
refactor(core): derive provider schema .zod via effect-zod walker (#23753)
-rw-r--r--packages/opencode/specs/effect/schema.md2
-rw-r--r--packages/opencode/src/provider/schema.ts8
2 files changed, 5 insertions, 5 deletions
diff --git a/packages/opencode/specs/effect/schema.md b/packages/opencode/specs/effect/schema.md
index df3cc0881..3ed0b825d 100644
--- a/packages/opencode/specs/effect/schema.md
+++ b/packages/opencode/specs/effect/schema.md
@@ -162,7 +162,7 @@ schema module with a clear domain.
- [ ] `src/control-plane/schema.ts`
- [ ] `src/permission/schema.ts`
- [ ] `src/project/schema.ts`
-- [ ] `src/provider/schema.ts`
+- [x] `src/provider/schema.ts`
- [ ] `src/pty/schema.ts`
- [ ] `src/question/schema.ts`
- [ ] `src/session/schema.ts`
diff --git a/packages/opencode/src/provider/schema.ts b/packages/opencode/src/provider/schema.ts
index 702616018..ea3cac342 100644
--- a/packages/opencode/src/provider/schema.ts
+++ b/packages/opencode/src/provider/schema.ts
@@ -1,6 +1,6 @@
import { Schema } from "effect"
-import z from "zod"
+import { zod } from "@/util/effect-zod"
import { withStatics } from "@/util/schema"
const providerIdSchema = Schema.String.pipe(Schema.brand("ProviderID"))
@@ -9,7 +9,7 @@ export type ProviderID = typeof providerIdSchema.Type
export const ProviderID = providerIdSchema.pipe(
withStatics((schema: typeof providerIdSchema) => ({
- zod: z.string().pipe(z.custom<ProviderID>()),
+ zod: zod(schema),
// Well-known providers
opencode: schema.make("opencode"),
anthropic: schema.make("anthropic"),
@@ -30,7 +30,7 @@ const modelIdSchema = Schema.String.pipe(Schema.brand("ModelID"))
export type ModelID = typeof modelIdSchema.Type
export const ModelID = modelIdSchema.pipe(
- withStatics((_schema: typeof modelIdSchema) => ({
- zod: z.string().pipe(z.custom<ModelID>()),
+ withStatics((schema: typeof modelIdSchema) => ({
+ zod: zod(schema),
})),
)