diff --git a/packages/opencode/src/command/index.ts b/packages/opencode/src/command/index.ts index 5d46a08e8d..927660fa7d 100644 --- a/packages/opencode/src/command/index.ts +++ b/packages/opencode/src/command/index.ts @@ -38,6 +38,8 @@ export namespace Command { agent: z.string().optional(), model: z.string().optional(), source: z.enum(["command", "mcp", "skill"]).optional(), + // workaround for zod not supporting async functions natively so we use getters + // https://zod.dev/v4/changelog?id=zfunction template: z.promise(z.string()).or(z.string()), subtask: z.boolean().optional(), hints: z.array(z.string()), @@ -46,6 +48,7 @@ export namespace Command { ref: "Command", }) + // for some reason zod is inferring `string` for z.promise(z.string()).or(z.string()) so we have to manually override it export type Info = Omit, "template"> & { template: Promise | string } export function hints(template: string) {