From cd225c15bea354222a62da00e4b5652da2865338 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sun, 15 Feb 2026 16:03:10 +0000 Subject: [PATCH] refactor(gateway): dedupe wizard status schema --- src/gateway/protocol/schema/wizard.ts | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/src/gateway/protocol/schema/wizard.ts b/src/gateway/protocol/schema/wizard.ts index 2a5f75e2e1d..cd9e7c3425b 100644 --- a/src/gateway/protocol/schema/wizard.ts +++ b/src/gateway/protocol/schema/wizard.ts @@ -1,6 +1,13 @@ import { Type } from "@sinclair/typebox"; import { NonEmptyString } from "./primitives.js"; +const WizardRunStatusSchema = Type.Union([ + Type.Literal("running"), + Type.Literal("done"), + Type.Literal("cancelled"), + Type.Literal("error"), +]); + export const WizardStartParamsSchema = Type.Object( { mode: Type.Optional(Type.Union([Type.Literal("local"), Type.Literal("remote")])), @@ -75,14 +82,7 @@ export const WizardNextResultSchema = Type.Object( { done: Type.Boolean(), step: Type.Optional(WizardStepSchema), - status: Type.Optional( - Type.Union([ - Type.Literal("running"), - Type.Literal("done"), - Type.Literal("cancelled"), - Type.Literal("error"), - ]), - ), + status: Type.Optional(WizardRunStatusSchema), error: Type.Optional(Type.String()), }, { additionalProperties: false }, @@ -93,14 +93,7 @@ export const WizardStartResultSchema = Type.Object( sessionId: NonEmptyString, done: Type.Boolean(), step: Type.Optional(WizardStepSchema), - status: Type.Optional( - Type.Union([ - Type.Literal("running"), - Type.Literal("done"), - Type.Literal("cancelled"), - Type.Literal("error"), - ]), - ), + status: Type.Optional(WizardRunStatusSchema), error: Type.Optional(Type.String()), }, { additionalProperties: false },