From e7725ff575ca557d2a1a4da8ff6809d1e95076b0 Mon Sep 17 00:00:00 2001 From: Kit Langton Date: Tue, 14 Apr 2026 21:07:50 -0400 Subject: [PATCH] refactor(permission): use Schema.Literals --- packages/opencode/src/permission/index.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/opencode/src/permission/index.ts b/packages/opencode/src/permission/index.ts index 5bfe32c286..2acbc5dd77 100644 --- a/packages/opencode/src/permission/index.ts +++ b/packages/opencode/src/permission/index.ts @@ -19,7 +19,7 @@ import { PermissionID } from "./schema" export namespace Permission { const log = Log.create({ service: "permission" }) - export const Action = Schema.Union([Schema.Literal("allow"), Schema.Literal("deny"), Schema.Literal("ask")]) + export const Action = Schema.Literals(["allow", "deny", "ask"]) .annotate({ identifier: "PermissionAction" }) .pipe(withStatics((s) => ({ zod: zod(s) }))) export type Action = Schema.Schema.Type @@ -56,9 +56,7 @@ export namespace Permission { static readonly zod = zod(this) } - export const Reply = Schema.Union([Schema.Literal("once"), Schema.Literal("always"), Schema.Literal("reject")]).pipe( - withStatics((s) => ({ zod: zod(s) })), - ) + export const Reply = Schema.Literals(["once", "always", "reject"]).pipe(withStatics((s) => ({ zod: zod(s) }))) export type Reply = Schema.Schema.Type const reply = {