{
  "openapi": "3.1.0",
  "info": {
    "title": "Workflow Worker Capability",
    "version": "3.0.0",
    "description": "直接调用 Workflow Worker 执行协议。使用绑定的 baseUrl 与 Capability Bearer Token；path 拼接在 baseUrl 后。不接受 X-Baijimu-Workflow-Tenant-Id。成功响应是原始执行对象，不包装 CModel。definitionCode 属于 WorkflowCapabilityExecution；执行包定义使用 definition.code。"
  },
  "x-baijimu-capability-type": "workflow",
  "x-baijimu-protocols": [
    "HTTP"
  ],
  "paths": {
    "/api/execution-packages/{snapshot_id}": {
      "put": {
        "operationId": "registerExecutionPackage",
        "summary": "登记不可变执行包",
        "description": "snapshot_id 必须等于 executionSnapshotId。合同 contractVersion 为 3.0.0。执行包只包含 Worker 执行节点。 包内含循环体最多 1000 个节点；公开 Capability 禁止 signal_wait 原语、子流程 resolver 和 platform_internal HTTP 目标。子流程使用已登记 snapshot。",
        "parameters": [
          {
            "name": "snapshot_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功响应",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowExecutionPackageReceipt"
                }
              }
            }
          },
          "default": {
            "description": "HTTP 4xx/5xx；原始错误对象，详见 CapabilityHttpError。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CapabilityError"
                }
              }
            }
          }
        },
        "security": [
          {
            "capabilityToken": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorkflowExecutionPackage"
              }
            }
          }
        }
      }
    },
    "/api/executions": {
      "post": {
        "operationId": "startExecution",
        "summary": "启动执行",
        "description": "生产者预先分配并持久化 requestId、executionId；重试复用同一请求身份。必须先登记 executionSnapshotId。",
        "parameters": [
          {
            "name": "X-Baijimu-Secret-Capability-Token",
            "in": "header",
            "required": false,
            "description": "执行包使用 secretRefs 时提供 Secret Capability 凭据。",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "成功响应",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowCapabilityExecution"
                }
              }
            }
          },
          "default": {
            "description": "HTTP 4xx/5xx；原始错误对象，详见 CapabilityHttpError。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CapabilityError"
                }
              }
            }
          }
        },
        "security": [
          {
            "capabilityToken": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorkflowExecutionStartRequest"
              }
            }
          }
        }
      }
    },
    "/api/execution-requests/{request_id}": {
      "get": {
        "operationId": "getExecutionRequest",
        "summary": "读取已受理请求",
        "description": "读取已受理请求",
        "parameters": [
          {
            "name": "request_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功响应",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowExecutionRequestReceipt"
                }
              }
            }
          },
          "default": {
            "description": "HTTP 4xx/5xx；原始错误对象，详见 CapabilityHttpError。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CapabilityError"
                }
              }
            }
          }
        },
        "security": [
          {
            "capabilityToken": []
          }
        ]
      }
    },
    "/api/executions/{execution_id}": {
      "get": {
        "operationId": "getExecution",
        "summary": "读取执行",
        "description": "读取执行",
        "parameters": [
          {
            "name": "execution_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功响应",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowCapabilityExecution"
                }
              }
            }
          },
          "default": {
            "description": "HTTP 4xx/5xx；原始错误对象，详见 CapabilityHttpError。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CapabilityError"
                }
              }
            }
          }
        },
        "security": [
          {
            "capabilityToken": []
          }
        ]
      },
      "delete": {
        "operationId": "cancelExecution",
        "summary": "取消执行",
        "description": "取消执行",
        "parameters": [
          {
            "name": "execution_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功响应",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowCapabilityExecution"
                }
              }
            }
          },
          "default": {
            "description": "HTTP 4xx/5xx；原始错误对象，详见 CapabilityHttpError。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CapabilityError"
                }
              }
            }
          }
        },
        "security": [
          {
            "capabilityToken": []
          }
        ]
      }
    },
    "/api/executions/{execution_id}/resume": {
      "post": {
        "operationId": "resumeExecution",
        "summary": "恢复执行",
        "description": "恢复执行",
        "parameters": [
          {
            "name": "execution_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "成功响应",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowCapabilityExecution"
                }
              }
            }
          },
          "default": {
            "description": "HTTP 4xx/5xx；原始错误对象，详见 CapabilityHttpError。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CapabilityError"
                }
              }
            }
          }
        },
        "security": [
          {
            "capabilityToken": []
          }
        ]
      }
    },
    "/api/executions/{execution_id}/retry": {
      "post": {
        "operationId": "retryExecution",
        "summary": "重试执行",
        "description": "重试执行",
        "parameters": [
          {
            "name": "execution_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "成功响应",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowCapabilityExecution"
                }
              }
            }
          },
          "default": {
            "description": "HTTP 4xx/5xx；原始错误对象，详见 CapabilityHttpError。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CapabilityError"
                }
              }
            }
          }
        },
        "security": [
          {
            "capabilityToken": []
          }
        ]
      }
    },
    "/api/executions/{execution_id}/signals": {
      "post": {
        "operationId": "signalExecution",
        "summary": "发送执行信号",
        "description": "contractVersion 为 3.0.0；使用 dedupeKey 防止重复信号。",
        "parameters": [
          {
            "name": "execution_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "成功响应",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowCapabilityExecution"
                }
              }
            }
          },
          "default": {
            "description": "HTTP 4xx/5xx；原始错误对象，详见 CapabilityHttpError。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CapabilityError"
                }
              }
            }
          }
        },
        "security": [
          {
            "capabilityToken": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorkflowCapabilitySignalRequest"
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "capabilityToken": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "schemas": {
      "WorkflowExecutionPackage": {
        "type": "object",
        "properties": {
          "contractVersion": {
            "const": "3.0.0"
          },
          "executionSnapshotId": {
            "type": "string"
          },
          "definitionId": {
            "type": "string"
          },
          "definition": {
            "$ref": "#/components/schemas/WorkflowExecutionDefinition"
          }
        },
        "required": [
          "contractVersion",
          "executionSnapshotId",
          "definitionId",
          "definition"
        ],
        "additionalProperties": false
      },
      "WorkflowExecutionDefinition": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "startNodeId": {
            "type": "string"
          },
          "inputSchema": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ParamDefinition"
            }
          },
          "outputSchema": {
            "anyOf": [
              {},
              {
                "type": "null"
              }
            ]
          },
          "nodes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExecutionNode"
            }
          },
          "edges": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkflowEdge"
            }
          },
          "graphLayout": {
            "anyOf": [
              {},
              {
                "type": "null"
              }
            ]
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "code",
          "name",
          "startNodeId",
          "inputSchema",
          "nodes",
          "edges",
          "tags"
        ],
        "additionalProperties": false
      },
      "ParamDefinition": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "type": {},
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "name",
          "type"
        ]
      },
      "ExecutionNode": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "description": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "outputPath": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "outgoingPolicy": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/OutgoingPolicy"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "type": {
                "const": "start"
              }
            },
            "required": [
              "type",
              "id"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "description": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "outputPath": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "outgoingPolicy": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/OutgoingPolicy"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "output": {
                "anyOf": [
                  {},
                  {
                    "type": "null"
                  }
                ]
              },
              "type": {
                "const": "end"
              }
            },
            "required": [
              "type",
              "id"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "description": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "outputPath": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "outgoingPolicy": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/OutgoingPolicy"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "request": {
                "$ref": "#/components/schemas/HttpRequestTemplate"
              },
              "response": {
                "$ref": "#/components/schemas/BackendResponseConfig"
              },
              "retryPolicy": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/RetryPolicy"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "type": {
                "const": "http"
              }
            },
            "required": [
              "type",
              "id",
              "request",
              "response"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "description": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "outputPath": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "outgoingPolicy": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/OutgoingPolicy"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "state": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/WaitStateSource"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "signal": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/WaitSignalConfig"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "until": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/WaitCondition"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "failWhen": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/WaitCondition"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "timeoutSecs": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "schedule": {
                "$ref": "#/components/schemas/WaitSchedule"
              },
              "output": {
                "anyOf": [
                  {},
                  {
                    "type": "null"
                  }
                ]
              },
              "type": {
                "const": "wait"
              }
            },
            "required": [
              "type",
              "id"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "description": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "outputPath": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "outgoingPolicy": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/OutgoingPolicy"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "joinPolicy": {
                "$ref": "#/components/schemas/JoinPolicy"
              },
              "output": {
                "anyOf": [
                  {},
                  {
                    "type": "null"
                  }
                ]
              },
              "type": {
                "const": "join"
              }
            },
            "required": [
              "type",
              "id",
              "joinPolicy"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "description": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "outputPath": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "outgoingPolicy": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/OutgoingPolicy"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "itemsPath": {
                "type": "string"
              },
              "itemName": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "indexName": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "mode": {
                "$ref": "#/components/schemas/ForEachMode"
              },
              "maxIterations": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "onItemError": {
                "$ref": "#/components/schemas/ForEachErrorPolicy"
              },
              "body": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ExecutionNode"
                }
              },
              "itemOutput": {
                "anyOf": [
                  {},
                  {
                    "type": "null"
                  }
                ]
              },
              "type": {
                "const": "for_each"
              }
            },
            "required": [
              "type",
              "id",
              "itemsPath"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "description": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "outputPath": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "outgoingPolicy": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/OutgoingPolicy"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "type": {
                "const": "human"
              }
            },
            "required": [
              "type",
              "id"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "description": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "outputPath": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "outgoingPolicy": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/OutgoingPolicy"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "target": {
                "$ref": "#/components/schemas/ChildExecutionTarget"
              },
              "input": {
                "anyOf": [
                  {},
                  {
                    "type": "null"
                  }
                ]
              },
              "metadata": {
                "anyOf": [
                  {
                    "type": "object",
                    "additionalProperties": {}
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "timeoutSecs": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "type": {
                "const": "subflow"
              }
            },
            "required": [
              "type",
              "id",
              "target"
            ],
            "additionalProperties": false
          }
        ]
      },
      "OutgoingPolicy": {
        "type": "object",
        "properties": {
          "mode": {
            "$ref": "#/components/schemas/OutgoingMode"
          },
          "onNoMatch": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/NoMatchBehavior"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "mode"
        ]
      },
      "OutgoingMode": {
        "oneOf": [
          {
            "const": "first_match"
          },
          {
            "const": "all_matched"
          },
          {
            "const": "all"
          }
        ]
      },
      "NoMatchBehavior": {
        "oneOf": [
          {
            "const": "error"
          },
          {
            "const": "complete"
          }
        ]
      },
      "HttpRequestTemplate": {
        "type": "object",
        "properties": {
          "method": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "destinationPolicy": {
            "$ref": "#/components/schemas/HttpDestinationPolicy"
          },
          "headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "body": {
            "anyOf": [
              {},
              {
                "type": "null"
              }
            ]
          },
          "secretRefs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SecretBinding"
            }
          },
          "timeoutSecs": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ]
          },
          "retryPolicy": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/RetryPolicy"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "method",
          "url"
        ]
      },
      "HttpDestinationPolicy": {
        "const": "external",
        "description": "公开 Capability 不允许 platform_internal 目标。"
      },
      "SecretBinding": {
        "type": "object",
        "properties": {
          "secretRef": {
            "type": "string"
          },
          "target": {
            "$ref": "#/components/schemas/SecretInjectionTarget"
          }
        },
        "required": [
          "secretRef",
          "target"
        ],
        "additionalProperties": false
      },
      "SecretInjectionTarget": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "type": {
                "const": "header"
              }
            },
            "required": [
              "type",
              "name"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "pointer": {
                "type": "string"
              },
              "type": {
                "const": "json_body"
              }
            },
            "required": [
              "type",
              "pointer"
            ],
            "additionalProperties": false
          }
        ]
      },
      "RetryPolicy": {
        "type": "object",
        "properties": {
          "maxAttempts": {
            "type": "integer",
            "minimum": 0
          },
          "initialDelayMs": {
            "type": "integer",
            "minimum": 0
          },
          "maxDelayMs": {
            "type": "integer",
            "minimum": 0
          },
          "backoffMultiplier": {
            "type": "number"
          }
        },
        "required": []
      },
      "BackendResponseConfig": {
        "type": "object",
        "properties": {
          "backend_response_format": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/BackendResponseFormat"
              },
              {
                "type": "null"
              }
            ]
          },
          "error_code_field": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "error_message_field": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "data_field": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "success_expression": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "error_code_expression": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "error_message_expression": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "data_expression": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "backendResponseFormat": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/BackendResponseFormat"
              },
              {
                "type": "null"
              }
            ]
          },
          "errorCodeField": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "errorMessageField": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "dataField": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "successExpression": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "errorCodeExpression": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "errorMessageExpression": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "dataExpression": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [],
        "additionalProperties": false,
        "allOf": [
          {
            "not": {
              "required": [
                "backend_response_format",
                "backendResponseFormat"
              ]
            }
          },
          {
            "not": {
              "required": [
                "error_code_field",
                "errorCodeField"
              ]
            }
          },
          {
            "not": {
              "required": [
                "error_message_field",
                "errorMessageField"
              ]
            }
          },
          {
            "not": {
              "required": [
                "data_field",
                "dataField"
              ]
            }
          },
          {
            "not": {
              "required": [
                "success_expression",
                "successExpression"
              ]
            }
          },
          {
            "not": {
              "required": [
                "error_code_expression",
                "errorCodeExpression"
              ]
            }
          },
          {
            "not": {
              "required": [
                "error_message_expression",
                "errorMessageExpression"
              ]
            }
          },
          {
            "not": {
              "required": [
                "data_expression",
                "dataExpression"
              ]
            }
          }
        ]
      },
      "BackendResponseFormat": {
        "oneOf": [
          {
            "const": "cmodel"
          },
          {
            "const": "plain"
          },
          {
            "const": "passthrough"
          }
        ]
      },
      "WaitStateSource": {
        "type": "object",
        "properties": {
          "type": {
            "$ref": "#/components/schemas/WaitStateSourceType"
          },
          "request": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/HttpRequestTemplate"
              },
              {
                "type": "null"
              }
            ]
          },
          "path": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "valuePath": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "type"
        ],
        "additionalProperties": false
      },
      "WaitStateSourceType": {
        "oneOf": [
          {
            "const": "http"
          },
          {
            "const": "runtime"
          }
        ]
      },
      "WaitSignalConfig": {
        "type": "object",
        "properties": {
          "successSignalNames": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "failureSignalNames": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "cancellationSignalNames": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [],
        "additionalProperties": false
      },
      "WaitCondition": {
        "type": "object",
        "properties": {
          "op": {
            "$ref": "#/components/schemas/WaitOperator"
          },
          "value": {
            "anyOf": [
              {},
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "op"
        ],
        "additionalProperties": false
      },
      "WaitOperator": {
        "oneOf": [
          {
            "const": "eq"
          },
          {
            "const": "ne"
          },
          {
            "const": "in"
          },
          {
            "const": "not_in"
          },
          {
            "const": "exists"
          },
          {
            "const": "not_exists"
          },
          {
            "const": "gt"
          },
          {
            "const": "gte"
          },
          {
            "const": "lt"
          },
          {
            "const": "lte"
          },
          {
            "const": "contains"
          }
        ]
      },
      "WaitSchedule": {
        "type": "object",
        "properties": {
          "intervalMillis": {
            "type": "integer",
            "minimum": 0
          },
          "maxIntervalMillis": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ]
          },
          "backoffMultiplier": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [],
        "additionalProperties": false
      },
      "JoinPolicy": {
        "type": "object",
        "properties": {
          "mode": {
            "$ref": "#/components/schemas/JoinMode"
          }
        },
        "required": [
          "mode"
        ]
      },
      "JoinMode": {
        "oneOf": [
          {
            "const": "all"
          },
          {
            "const": "any"
          }
        ]
      },
      "ForEachMode": {
        "oneOf": [
          {
            "const": "sequential"
          }
        ]
      },
      "ForEachErrorPolicy": {
        "oneOf": [
          {
            "const": "fail"
          },
          {
            "const": "continue"
          }
        ]
      },
      "ChildExecutionTarget": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "executionSnapshotId": {
                "type": "string"
              },
              "kind": {
                "const": "snapshot"
              }
            },
            "required": [
              "kind",
              "executionSnapshotId"
            ],
            "additionalProperties": false
          }
        ]
      },
      "WorkflowEdge": {
        "type": "object",
        "properties": {
          "from": {
            "type": "string"
          },
          "to": {
            "type": "string"
          },
          "label": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "guard": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/EdgeCondition"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "from",
          "to"
        ],
        "additionalProperties": false
      },
      "EdgeCondition": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "expression": {
                "type": "string"
              },
              "type": {
                "const": "expression"
              }
            },
            "required": [
              "type",
              "expression"
            ]
          }
        ]
      },
      "WorkflowExecutionPackageReceipt": {
        "type": "object",
        "properties": {
          "contractVersion": {
            "const": "3.0.0"
          },
          "executionSnapshotId": {
            "type": "string"
          }
        },
        "required": [
          "contractVersion",
          "executionSnapshotId"
        ],
        "additionalProperties": false
      },
      "WorkflowExecutionStartRequest": {
        "type": "object",
        "properties": {
          "requestId": {
            "type": "string"
          },
          "executionId": {
            "type": "string"
          },
          "contractVersion": {
            "const": "3.0.0"
          },
          "executionSnapshotId": {
            "type": "string"
          },
          "concurrencyGroupKey": {
            "type": "string"
          },
          "partitionKey": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "input": {
            "anyOf": [
              {},
              {
                "type": "null"
              }
            ]
          },
          "metadata": {
            "type": "object",
            "additionalProperties": {}
          },
          "intent": {
            "$ref": "#/components/schemas/WorkflowExecutionIntent"
          }
        },
        "required": [
          "requestId",
          "executionId",
          "contractVersion",
          "executionSnapshotId",
          "concurrencyGroupKey",
          "metadata",
          "intent"
        ],
        "additionalProperties": false
      },
      "WorkflowExecutionIntent": {
        "type": "object",
        "properties": {
          "schemaVersion": {
            "type": "string",
            "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(-[0-9A-Za-z.-]+)?(\\+[0-9A-Za-z.-]+)?$"
          },
          "payload": {}
        },
        "required": [
          "schemaVersion",
          "payload"
        ],
        "additionalProperties": false
      },
      "WorkflowCapabilityExecution": {
        "type": "object",
        "properties": {
          "contractVersion": {
            "const": "3.0.0"
          },
          "id": {
            "type": "string"
          },
          "concurrencyGroupKey": {
            "type": "string"
          },
          "partitionKey": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "definitionCode": {
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/InstanceStatus"
          },
          "output": {
            "anyOf": [
              {},
              {
                "type": "null"
              }
            ]
          },
          "error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "completedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "contractVersion",
          "id",
          "concurrencyGroupKey",
          "definitionCode",
          "status",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "InstanceStatus": {
        "oneOf": [
          {
            "const": "running"
          },
          {
            "const": "waiting"
          },
          {
            "const": "completed"
          },
          {
            "const": "failed"
          },
          {
            "const": "cancelled"
          }
        ]
      },
      "WorkflowExecutionRequestReceipt": {
        "type": "object",
        "properties": {
          "request": {
            "$ref": "#/components/schemas/WorkflowExecutionStartRequest"
          },
          "execution": {
            "$ref": "#/components/schemas/WorkflowCapabilityExecution"
          }
        },
        "required": [
          "request",
          "execution"
        ],
        "additionalProperties": false
      },
      "WorkflowCapabilitySignalRequest": {
        "type": "object",
        "properties": {
          "contractVersion": {
            "const": "3.0.0"
          },
          "nodeId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "signalName": {
            "type": "string"
          },
          "payload": {
            "anyOf": [
              {},
              {
                "type": "null"
              }
            ]
          },
          "dedupeKey": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "contractVersion",
          "signalName"
        ],
        "additionalProperties": false
      },
      "CapabilityError": {
        "type": "object",
        "required": [
          "contractVersion",
          "errorCode"
        ],
        "properties": {
          "contractVersion": {
            "const": "3.0.0"
          },
          "errorCode": {
            "type": "string",
            "enum": [
              "WORKFLOW_CAPABILITY_UNAUTHORIZED",
              "WORKFLOW_CAPABILITY_FORBIDDEN",
              "WORKFLOW_CAPABILITY_NOT_FOUND",
              "WORKFLOW_CAPABILITY_INVALID_REQUEST",
              "WORKFLOW_CAPABILITY_CONFLICT",
              "WORKFLOW_CAPABILITY_UPSTREAM_ERROR",
              "WORKFLOW_CAPABILITY_INTERNAL_ERROR"
            ]
          }
        },
        "additionalProperties": false
      }
    }
  },
  "x-source-contract-revision": "3ac3c9cfcfce650b4e8fe2b462d0cf87a455679b"
}
