Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
LukeParkerDev
d704110e52 fix: lazy session error schema 2026-04-25 10:04:49 +10:00
2 changed files with 4 additions and 1 deletions

View file

@ -284,7 +284,8 @@ export const Event = {
sessionID: Schema.optional(SessionID), sessionID: Schema.optional(SessionID),
// Reuses MessageV2.Assistant.fields.error (already Schema.optional) so // Reuses MessageV2.Assistant.fields.error (already Schema.optional) so
// the derived zod keeps the same discriminated-union shape on the bus. // the derived zod keeps the same discriminated-union shape on the bus.
error: MessageV2.Assistant.fields.error, // Schema.suspend defers access to break circular init in compiled binaries.
error: Schema.suspend(() => MessageV2.Assistant.fields.error),
}), }),
), ),
} }

View file

@ -256,6 +256,8 @@ function body(ast: SchemaAST.AST): z.ZodTypeAny {
return array(ast) return array(ast)
case "Declaration": case "Declaration":
return decl(ast) return decl(ast)
case "Suspend":
return z.lazy(() => walk(ast.thunk()))
default: default:
return fail(ast) return fail(ast)
} }