mirror of
https://github.com/anomalyco/opencode.git
synced 2026-04-28 04:29:42 +00:00
fix: lazy session error schema
This commit is contained in:
parent
5cd178ba70
commit
d704110e52
2 changed files with 4 additions and 1 deletions
|
|
@ -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),
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue