mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 13:31:25 +00:00
Add mesh orchestration gateway methods with DAG execution and retry
This commit is contained in:
committed by
Peter Steinberger
parent
15fe87e6b7
commit
83990ed542
@@ -128,6 +128,16 @@ import {
|
||||
LogsTailParamsSchema,
|
||||
type LogsTailResult,
|
||||
LogsTailResultSchema,
|
||||
type MeshPlanParams,
|
||||
MeshPlanParamsSchema,
|
||||
type MeshRetryParams,
|
||||
MeshRetryParamsSchema,
|
||||
type MeshRunParams,
|
||||
MeshRunParamsSchema,
|
||||
type MeshStatusParams,
|
||||
MeshStatusParamsSchema,
|
||||
type MeshWorkflowPlan,
|
||||
MeshWorkflowPlanSchema,
|
||||
type ModelsListParams,
|
||||
ModelsListParamsSchema,
|
||||
type NodeDescribeParams,
|
||||
@@ -358,6 +368,10 @@ export const validateExecApprovalsNodeSetParams = ajv.compile<ExecApprovalsNodeS
|
||||
ExecApprovalsNodeSetParamsSchema,
|
||||
);
|
||||
export const validateLogsTailParams = ajv.compile<LogsTailParams>(LogsTailParamsSchema);
|
||||
export const validateMeshPlanParams = ajv.compile<MeshPlanParams>(MeshPlanParamsSchema);
|
||||
export const validateMeshRunParams = ajv.compile<MeshRunParams>(MeshRunParamsSchema);
|
||||
export const validateMeshStatusParams = ajv.compile<MeshStatusParams>(MeshStatusParamsSchema);
|
||||
export const validateMeshRetryParams = ajv.compile<MeshRetryParams>(MeshRetryParamsSchema);
|
||||
export const validateChatHistoryParams = ajv.compile(ChatHistoryParamsSchema);
|
||||
export const validateChatSendParams = ajv.compile(ChatSendParamsSchema);
|
||||
export const validateChatAbortParams = ajv.compile<ChatAbortParams>(ChatAbortParamsSchema);
|
||||
@@ -417,6 +431,11 @@ export {
|
||||
StateVersionSchema,
|
||||
AgentEventSchema,
|
||||
ChatEventSchema,
|
||||
MeshPlanParamsSchema,
|
||||
MeshWorkflowPlanSchema,
|
||||
MeshRunParamsSchema,
|
||||
MeshStatusParamsSchema,
|
||||
MeshRetryParamsSchema,
|
||||
SendParamsSchema,
|
||||
PollParamsSchema,
|
||||
AgentParamsSchema,
|
||||
@@ -516,6 +535,11 @@ export type {
|
||||
AgentIdentityResult,
|
||||
AgentWaitParams,
|
||||
ChatEvent,
|
||||
MeshPlanParams,
|
||||
MeshWorkflowPlan,
|
||||
MeshRunParams,
|
||||
MeshStatusParams,
|
||||
MeshRetryParams,
|
||||
TickEvent,
|
||||
ShutdownEvent,
|
||||
WakeParams,
|
||||
|
||||
@@ -8,6 +8,7 @@ export * from "./schema/exec-approvals.js";
|
||||
export * from "./schema/devices.js";
|
||||
export * from "./schema/frames.js";
|
||||
export * from "./schema/logs-chat.js";
|
||||
export * from "./schema/mesh.js";
|
||||
export * from "./schema/nodes.js";
|
||||
export * from "./schema/protocol-schemas.js";
|
||||
export * from "./schema/sessions.js";
|
||||
|
||||
83
src/gateway/protocol/schema/mesh.ts
Normal file
83
src/gateway/protocol/schema/mesh.ts
Normal file
@@ -0,0 +1,83 @@
|
||||
import { Type, type Static } from "@sinclair/typebox";
|
||||
import { NonEmptyString } from "./primitives.js";
|
||||
|
||||
export const MeshPlanStepSchema = Type.Object(
|
||||
{
|
||||
id: NonEmptyString,
|
||||
name: Type.Optional(NonEmptyString),
|
||||
prompt: NonEmptyString,
|
||||
dependsOn: Type.Optional(Type.Array(NonEmptyString, { maxItems: 64 })),
|
||||
agentId: Type.Optional(NonEmptyString),
|
||||
sessionKey: Type.Optional(NonEmptyString),
|
||||
thinking: Type.Optional(Type.String()),
|
||||
timeoutMs: Type.Optional(Type.Integer({ minimum: 1_000, maximum: 3_600_000 })),
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
|
||||
export const MeshWorkflowPlanSchema = Type.Object(
|
||||
{
|
||||
planId: NonEmptyString,
|
||||
goal: NonEmptyString,
|
||||
createdAt: Type.Integer({ minimum: 0 }),
|
||||
steps: Type.Array(MeshPlanStepSchema, { minItems: 1, maxItems: 128 }),
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
|
||||
export const MeshPlanParamsSchema = Type.Object(
|
||||
{
|
||||
goal: NonEmptyString,
|
||||
steps: Type.Optional(
|
||||
Type.Array(
|
||||
Type.Object(
|
||||
{
|
||||
id: Type.Optional(NonEmptyString),
|
||||
name: Type.Optional(NonEmptyString),
|
||||
prompt: NonEmptyString,
|
||||
dependsOn: Type.Optional(Type.Array(NonEmptyString, { maxItems: 64 })),
|
||||
agentId: Type.Optional(NonEmptyString),
|
||||
sessionKey: Type.Optional(NonEmptyString),
|
||||
thinking: Type.Optional(Type.String()),
|
||||
timeoutMs: Type.Optional(Type.Integer({ minimum: 1_000, maximum: 3_600_000 })),
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
),
|
||||
{ minItems: 1, maxItems: 128 },
|
||||
),
|
||||
),
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
|
||||
export const MeshRunParamsSchema = Type.Object(
|
||||
{
|
||||
plan: MeshWorkflowPlanSchema,
|
||||
continueOnError: Type.Optional(Type.Boolean()),
|
||||
maxParallel: Type.Optional(Type.Integer({ minimum: 1, maximum: 16 })),
|
||||
defaultStepTimeoutMs: Type.Optional(Type.Integer({ minimum: 1_000, maximum: 3_600_000 })),
|
||||
lane: Type.Optional(Type.String()),
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
|
||||
export const MeshStatusParamsSchema = Type.Object(
|
||||
{
|
||||
runId: NonEmptyString,
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
|
||||
export const MeshRetryParamsSchema = Type.Object(
|
||||
{
|
||||
runId: NonEmptyString,
|
||||
stepIds: Type.Optional(Type.Array(NonEmptyString, { minItems: 1, maxItems: 128 })),
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
|
||||
export type MeshPlanParams = Static<typeof MeshPlanParamsSchema>;
|
||||
export type MeshWorkflowPlan = Static<typeof MeshWorkflowPlanSchema>;
|
||||
export type MeshRunParams = Static<typeof MeshRunParamsSchema>;
|
||||
export type MeshStatusParams = Static<typeof MeshStatusParamsSchema>;
|
||||
export type MeshRetryParams = Static<typeof MeshRetryParamsSchema>;
|
||||
@@ -103,6 +103,13 @@ import {
|
||||
LogsTailParamsSchema,
|
||||
LogsTailResultSchema,
|
||||
} from "./logs-chat.js";
|
||||
import {
|
||||
MeshPlanParamsSchema,
|
||||
MeshRetryParamsSchema,
|
||||
MeshRunParamsSchema,
|
||||
MeshStatusParamsSchema,
|
||||
MeshWorkflowPlanSchema,
|
||||
} from "./mesh.js";
|
||||
import {
|
||||
NodeDescribeParamsSchema,
|
||||
NodeEventParamsSchema,
|
||||
@@ -254,6 +261,11 @@ export const ProtocolSchemas: Record<string, TSchema> = {
|
||||
ChatAbortParams: ChatAbortParamsSchema,
|
||||
ChatInjectParams: ChatInjectParamsSchema,
|
||||
ChatEvent: ChatEventSchema,
|
||||
MeshPlanParams: MeshPlanParamsSchema,
|
||||
MeshWorkflowPlan: MeshWorkflowPlanSchema,
|
||||
MeshRunParams: MeshRunParamsSchema,
|
||||
MeshStatusParams: MeshStatusParamsSchema,
|
||||
MeshRetryParams: MeshRetryParamsSchema,
|
||||
UpdateRunParams: UpdateRunParamsSchema,
|
||||
TickEvent: TickEventSchema,
|
||||
ShutdownEvent: ShutdownEventSchema,
|
||||
|
||||
Reference in New Issue
Block a user