mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 04:01:23 +00:00
refactor(core): extract shared runtime and wizard schemas
This commit is contained in:
@@ -32,19 +32,16 @@ export const WizardNextParamsSchema = Type.Object(
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
|
||||
export const WizardCancelParamsSchema = Type.Object(
|
||||
const WizardSessionIdParamsSchema = Type.Object(
|
||||
{
|
||||
sessionId: NonEmptyString,
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
|
||||
export const WizardStatusParamsSchema = Type.Object(
|
||||
{
|
||||
sessionId: NonEmptyString,
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
export const WizardCancelParamsSchema = WizardSessionIdParamsSchema;
|
||||
|
||||
export const WizardStatusParamsSchema = WizardSessionIdParamsSchema;
|
||||
|
||||
export const WizardStepOptionSchema = Type.Object(
|
||||
{
|
||||
@@ -78,35 +75,28 @@ export const WizardStepSchema = Type.Object(
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
|
||||
export const WizardNextResultSchema = Type.Object(
|
||||
{
|
||||
done: Type.Boolean(),
|
||||
step: Type.Optional(WizardStepSchema),
|
||||
status: Type.Optional(WizardRunStatusSchema),
|
||||
error: Type.Optional(Type.String()),
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
const WizardResultFields = {
|
||||
done: Type.Boolean(),
|
||||
step: Type.Optional(WizardStepSchema),
|
||||
status: Type.Optional(WizardRunStatusSchema),
|
||||
error: Type.Optional(Type.String()),
|
||||
};
|
||||
|
||||
export const WizardNextResultSchema = Type.Object(WizardResultFields, {
|
||||
additionalProperties: false,
|
||||
});
|
||||
|
||||
export const WizardStartResultSchema = Type.Object(
|
||||
{
|
||||
sessionId: NonEmptyString,
|
||||
done: Type.Boolean(),
|
||||
step: Type.Optional(WizardStepSchema),
|
||||
status: Type.Optional(WizardRunStatusSchema),
|
||||
error: Type.Optional(Type.String()),
|
||||
...WizardResultFields,
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
|
||||
export const WizardStatusResultSchema = Type.Object(
|
||||
{
|
||||
status: Type.Union([
|
||||
Type.Literal("running"),
|
||||
Type.Literal("done"),
|
||||
Type.Literal("cancelled"),
|
||||
Type.Literal("error"),
|
||||
]),
|
||||
status: WizardRunStatusSchema,
|
||||
error: Type.Optional(Type.String()),
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
|
||||
Reference in New Issue
Block a user