---
docStatus: current
---

# Bundle Capability 方法参考

Bundle Capability 的版本化方法合同快照。

本页仅描述 Bundle Capability 的版本化 HTTP 合同，不是 Hosted Service 的能力目录。
查找 Hosted Service 的可用能力，先进入[Capability 列表](/development/backend-development/hosted-service-capabilities/)。

本页合同：[Bundle Capability OpenAPI 2.0.0](/contracts/bundle-capability/2.0.0/openapi.json)。

调用及凭据见[Hosted Service 使用 Bundle Capability](/development/bundle-development/hosted-service-capability/)。

## Workflow 返回字段与排错

`queryBundleWorkflows` 的成功结果是 `data: WorkflowDefinition[]`，编码字段为 `code`。
`getBundleWorkflowDefinition` 的成功结果是 `data: WorkflowDefinition`。两者都不是编译计划外壳；
读取其顶层 `definitionCode` 会得到缺失值。`definitionCode` 仍可能存在于执行实例对象，不能全局替换。
`resourceLocator` 与 `semanticVersion` 应从 `queryBundleResources` 的资源账本获得。
`startBundleWorkflowInstance` 要求请求顶层的 `requestId`；`metadata.requestId` 不能替代。
HTTP 2xx 不等于业务成功：先检查 `errorCode` 为 `0`，再按对应方法解析 `data`。

## 方法索引

| 方法 ID                                                           | 用途                 | Scope                       | 行为    |
| --------------------------------------------------------------- | ------------------ | --------------------------- | ----- |
| [queryBundleResources](#querybundleresources)                   | 查询当前 Bundle 的已验证资源 | `bundle.resources.read`     | 只读    |
| [queryBundleWorkflows](#querybundleworkflows)                   | 查询当前 Bundle 的工作流   | `workflow.definition.read`  | 只读    |
| [getBundleWorkflowDefinition](#getbundleworkflowdefinition)     | 读取工作流定义            | `workflow.definition.read`  | 只读    |
| [startBundleWorkflowInstance](#startbundleworkflowinstance)     | 启动工作流实例            | `workflow.execution.create` | 写入或执行 |
| [queryBundleWorkflowInstances](#querybundleworkflowinstances)   | 查询工作流实例            | `workflow.execution.read`   | 只读    |
| [getBundleWorkflowInstance](#getbundleworkflowinstance)         | 读取工作流实例详情          | `workflow.execution.read`   | 只读    |
| [queryBundleWorkflowExecutions](#querybundleworkflowexecutions) | 读取工作流实例执行详情        | `workflow.execution.read`   | 只读    |
| [queryBundleTimers](#querybundletimers)                         | 查询当前 Bundle 的定时任务  | `timer.definition.read`     | 只读    |
| [getBundleTimerDefinition](#getbundletimerdefinition)           | 读取定时任务定义           | `timer.definition.read`     | 只读    |
| [queryBundleTimerExecutions](#querybundletimerexecutions)       | 查询定时任务执行记录         | `timer.execution.read`      | 只读    |
| [triggerBundleTimerExecution](#triggerbundletimerexecution)     | 触发一次定时任务执行         | `timer.execution.create`    | 写入或执行 |

## queryBundleResources

查询当前 Bundle 的已验证资源

`POST /capability/bundle-runtime/bundle/resources/query`

权限：`bundle.resources.read`。

请求 Schema：

```json
{
  "$ref": "#/components/schemas/QueryBundleResourcesRequest"
}
```

成功时的 `data` Schema：

```json
{
  "$ref": "#/components/schemas/BundleResources"
}
```

完整响应 Schema（包含业务失败）：

```json
{
  "oneOf": [
    {
      "type": "object",
      "properties": {
        "errorCode": {
          "const": "0"
        },
        "data": {
          "$ref": "#/components/schemas/BundleResources"
        },
        "contractVersion": {
          "const": "1.0.0"
        }
      },
      "required": [
        "errorCode",
        "data"
      ],
      "additionalProperties": true
    },
    {
      "$ref": "#/components/schemas/CapabilityError"
    }
  ]
}
```

## queryBundleWorkflows

查询当前 Bundle 的工作流

`POST /capability/bundle-workflow/workflows/query`

权限：`workflow.definition.read`。返回 WorkflowDefinition，编码字段为 code。旧消费端读取 definitionCode 会失败。resourceLocator 必须从 queryBundleResources 返回的资源账本取得；定义列表没有 Locator。

请求 Schema：

```json
{
  "$ref": "#/components/schemas/ApplicationRuntimeRequest"
}
```

成功时的 `data` Schema：

```json
{
  "type": "array",
  "items": {
    "$ref": "#/components/schemas/WorkflowDefinition"
  }
}
```

完整响应 Schema（包含业务失败）：

```json
{
  "oneOf": [
    {
      "type": "object",
      "properties": {
        "errorCode": {
          "const": "0"
        },
        "data": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/WorkflowDefinition"
          }
        },
        "contractVersion": {
          "const": "1.0.0"
        }
      },
      "required": [
        "errorCode",
        "data"
      ],
      "additionalProperties": true
    },
    {
      "$ref": "#/components/schemas/CapabilityError"
    }
  ]
}
```

响应示例：定义使用 code 字段

```json
{
  "errorCode": "0",
  "data": [
    {
      "id": "workflow-example",
      "workspaceId": "workspace-example",
      "code": "exampleFlow",
      "name": "示例流程",
      "revision": 1,
      "recompilationRequired": false,
      "description": null,
      "status": "active",
      "startNodeId": "start",
      "inputSchema": [],
      "outputSchema": null,
      "nodes": [],
      "edges": [],
      "graphLayout": null,
      "tags": [],
      "createdAt": "2026-01-01T00:00:00Z",
      "updatedAt": "2026-01-01T00:00:00Z"
    }
  ],
  "contractVersion": "1.0.0"
}
```

响应示例：错误示例，按 data.message 与 data.retryable 处理

```json
{
  "contractVersion": "1.0.0",
  "errorCode": "WORKFLOW_ENGINE_INVALID_REQUEST",
  "data": {
    "message": "请求参数无效",
    "retryable": false
  }
}
```

## getBundleWorkflowDefinition

读取工作流定义

`POST /capability/bundle-workflow/workflows/definition`

权限：`workflow.definition.read`。返回 WorkflowDefinition，编码字段为 code。旧消费端读取 definitionCode 会失败。resourceLocator 必须从 queryBundleResources 返回的资源账本取得；定义列表没有 Locator。

请求 Schema：

```json
{
  "$ref": "#/components/schemas/ResourceRequest"
}
```

成功时的 `data` Schema：

```json
{
  "$ref": "#/components/schemas/WorkflowDefinition"
}
```

完整响应 Schema（包含业务失败）：

```json
{
  "oneOf": [
    {
      "type": "object",
      "properties": {
        "errorCode": {
          "const": "0"
        },
        "data": {
          "$ref": "#/components/schemas/WorkflowDefinition"
        },
        "contractVersion": {
          "const": "1.0.0"
        }
      },
      "required": [
        "errorCode",
        "data"
      ],
      "additionalProperties": true
    },
    {
      "$ref": "#/components/schemas/CapabilityError"
    }
  ]
}
```

响应示例：定义使用 code 字段

```json
{
  "errorCode": "0",
  "data": {
    "id": "workflow-example",
    "workspaceId": "workspace-example",
    "code": "exampleFlow",
    "name": "示例流程",
    "revision": 1,
    "recompilationRequired": false,
    "description": null,
    "status": "active",
    "startNodeId": "start",
    "inputSchema": [],
    "outputSchema": null,
    "nodes": [],
    "edges": [],
    "graphLayout": null,
    "tags": [],
    "createdAt": "2026-01-01T00:00:00Z",
    "updatedAt": "2026-01-01T00:00:00Z"
  },
  "contractVersion": "1.0.0"
}
```

响应示例：错误示例，按 data.message 与 data.retryable 处理

```json
{
  "contractVersion": "1.0.0",
  "errorCode": "WORKFLOW_ENGINE_INVALID_REQUEST",
  "data": {
    "message": "请求参数无效",
    "retryable": false
  }
}
```

## startBundleWorkflowInstance

启动工作流实例

`POST /capability/bundle-workflow/workflows/instances/start`

权限：`workflow.execution.create`。requestId 在请求顶层必填，用于启动幂等性；metadata.requestId 不能替代。执行权限仍由服务端独立校验。

请求 Schema：

```json
{
  "$ref": "#/components/schemas/StartWorkflowRequest"
}
```

成功时的 `data` Schema：

```json
{
  "$ref": "#/components/schemas/WorkflowInstance"
}
```

完整响应 Schema（包含业务失败）：

```json
{
  "oneOf": [
    {
      "type": "object",
      "properties": {
        "errorCode": {
          "const": "0"
        },
        "data": {
          "$ref": "#/components/schemas/WorkflowInstance"
        },
        "contractVersion": {
          "const": "1.0.0"
        }
      },
      "required": [
        "errorCode",
        "data"
      ],
      "additionalProperties": true
    },
    {
      "$ref": "#/components/schemas/CapabilityError"
    }
  ]
}
```

响应示例：错误示例，按 data.message 与 data.retryable 处理

```json
{
  "contractVersion": "1.0.0",
  "errorCode": "WORKFLOW_ENGINE_INVALID_REQUEST",
  "data": {
    "message": "请求参数无效",
    "retryable": false
  }
}
```

## queryBundleWorkflowInstances

查询工作流实例

`POST /capability/bundle-workflow/workflows/instances/query`

权限：`workflow.execution.read`。

请求 Schema：

```json
{
  "$ref": "#/components/schemas/QueryWorkflowInstancesRequest"
}
```

成功时的 `data` Schema：

```json
{
  "$ref": "#/components/schemas/WorkflowInstancePage"
}
```

完整响应 Schema（包含业务失败）：

```json
{
  "oneOf": [
    {
      "type": "object",
      "properties": {
        "errorCode": {
          "const": "0"
        },
        "data": {
          "$ref": "#/components/schemas/WorkflowInstancePage"
        },
        "contractVersion": {
          "const": "1.0.0"
        }
      },
      "required": [
        "errorCode",
        "data"
      ],
      "additionalProperties": true
    },
    {
      "$ref": "#/components/schemas/CapabilityError"
    }
  ]
}
```

响应示例：错误示例，按 data.message 与 data.retryable 处理

```json
{
  "contractVersion": "1.0.0",
  "errorCode": "WORKFLOW_ENGINE_INVALID_REQUEST",
  "data": {
    "message": "请求参数无效",
    "retryable": false
  }
}
```

## getBundleWorkflowInstance

读取工作流实例详情

`POST /capability/bundle-workflow/workflows/instances/detail`

权限：`workflow.execution.read`。

请求 Schema：

```json
{
  "$ref": "#/components/schemas/WorkflowInstanceRequest"
}
```

成功时的 `data` Schema：

```json
{
  "$ref": "#/components/schemas/WorkflowInstanceDetail"
}
```

完整响应 Schema（包含业务失败）：

```json
{
  "oneOf": [
    {
      "type": "object",
      "properties": {
        "errorCode": {
          "const": "0"
        },
        "data": {
          "$ref": "#/components/schemas/WorkflowInstanceDetail"
        },
        "contractVersion": {
          "const": "1.0.0"
        }
      },
      "required": [
        "errorCode",
        "data"
      ],
      "additionalProperties": true
    },
    {
      "$ref": "#/components/schemas/CapabilityError"
    }
  ]
}
```

响应示例：错误示例，按 data.message 与 data.retryable 处理

```json
{
  "contractVersion": "1.0.0",
  "errorCode": "WORKFLOW_ENGINE_INVALID_REQUEST",
  "data": {
    "message": "请求参数无效",
    "retryable": false
  }
}
```

## queryBundleWorkflowExecutions

读取工作流实例执行详情

`POST /capability/bundle-workflow/workflows/instances/executions/query`

权限：`workflow.execution.read`。

请求 Schema：

```json
{
  "$ref": "#/components/schemas/WorkflowInstanceRequest"
}
```

成功时的 `data` Schema：

```json
{
  "$ref": "#/components/schemas/WorkflowNodeHistory"
}
```

完整响应 Schema（包含业务失败）：

```json
{
  "oneOf": [
    {
      "type": "object",
      "properties": {
        "errorCode": {
          "const": "0"
        },
        "data": {
          "$ref": "#/components/schemas/WorkflowNodeHistory"
        },
        "contractVersion": {
          "const": "1.0.0"
        }
      },
      "required": [
        "errorCode",
        "data"
      ],
      "additionalProperties": true
    },
    {
      "$ref": "#/components/schemas/CapabilityError"
    }
  ]
}
```

响应示例：错误示例，按 data.message 与 data.retryable 处理

```json
{
  "contractVersion": "1.0.0",
  "errorCode": "WORKFLOW_ENGINE_INVALID_REQUEST",
  "data": {
    "message": "请求参数无效",
    "retryable": false
  }
}
```

## queryBundleTimers

查询当前 Bundle 的定时任务

`POST /capability/bundle-timer/timers/query`

权限：`timer.definition.read`。

请求 Schema：

```json
{
  "$ref": "#/components/schemas/ApplicationRuntimeRequest"
}
```

成功时的 `data` Schema：

```json
{
  "type": "array",
  "items": {
    "$ref": "#/components/schemas/TimerDefinition"
  }
}
```

完整响应 Schema（包含业务失败）：

```json
{
  "oneOf": [
    {
      "type": "object",
      "properties": {
        "errorCode": {
          "const": "0"
        },
        "data": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/TimerDefinition"
          }
        },
        "contractVersion": {
          "const": "1.0.0"
        }
      },
      "required": [
        "errorCode",
        "data"
      ],
      "additionalProperties": true
    },
    {
      "$ref": "#/components/schemas/CapabilityError"
    }
  ]
}
```

## getBundleTimerDefinition

读取定时任务定义

`POST /capability/bundle-timer/timers/definition`

权限：`timer.definition.read`。

请求 Schema：

```json
{
  "$ref": "#/components/schemas/ResourceRequest"
}
```

成功时的 `data` Schema：

```json
{
  "$ref": "#/components/schemas/TimerDefinition"
}
```

完整响应 Schema（包含业务失败）：

```json
{
  "oneOf": [
    {
      "type": "object",
      "properties": {
        "errorCode": {
          "const": "0"
        },
        "data": {
          "$ref": "#/components/schemas/TimerDefinition"
        },
        "contractVersion": {
          "const": "1.0.0"
        }
      },
      "required": [
        "errorCode",
        "data"
      ],
      "additionalProperties": true
    },
    {
      "$ref": "#/components/schemas/CapabilityError"
    }
  ]
}
```

## queryBundleTimerExecutions

查询定时任务执行记录

`POST /capability/bundle-timer/timers/executions/query`

权限：`timer.execution.read`。

请求 Schema：

```json
{
  "$ref": "#/components/schemas/QueryTimerExecutionsRequest"
}
```

成功时的 `data` Schema：

```json
{
  "type": "array",
  "items": {
    "$ref": "#/components/schemas/TimerExecution"
  }
}
```

完整响应 Schema（包含业务失败）：

```json
{
  "oneOf": [
    {
      "type": "object",
      "properties": {
        "errorCode": {
          "const": "0"
        },
        "data": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/TimerExecution"
          }
        },
        "contractVersion": {
          "const": "1.0.0"
        }
      },
      "required": [
        "errorCode",
        "data"
      ],
      "additionalProperties": true
    },
    {
      "$ref": "#/components/schemas/CapabilityError"
    }
  ]
}
```

## triggerBundleTimerExecution

触发一次定时任务执行

`POST /capability/bundle-timer/timers/executions/trigger`

权限：`timer.execution.create`。

请求 Schema：

```json
{
  "$ref": "#/components/schemas/ResourceRequest"
}
```

成功时的 `data` Schema：

```json
{
  "$ref": "#/components/schemas/TimerTriggerReceipt"
}
```

完整响应 Schema（包含业务失败）：

```json
{
  "oneOf": [
    {
      "type": "object",
      "properties": {
        "errorCode": {
          "const": "0"
        },
        "data": {
          "$ref": "#/components/schemas/TimerTriggerReceipt"
        },
        "contractVersion": {
          "const": "1.0.0"
        }
      },
      "required": [
        "errorCode",
        "data"
      ],
      "additionalProperties": true
    },
    {
      "$ref": "#/components/schemas/CapabilityError"
    }
  ]
}
```

## Schema 定义

上面所有 `$ref` 均引用下列同一份合同中的 Schema。
业务自定义的 JSON 值由对应资源合同约束。

### ApplicationRuntimeId

```json
{
  "type": "string",
  "minLength": 1,
  "maxLength": 128,
  "description": "目标 Application Runtime 的稳定 ID。"
}
```

### ResourceLocator

```json
{
  "type": "string",
  "minLength": 1,
  "description": "由资源查询返回的稳定 Locator；调用方不得自行构造。"
}
```

### ApplicationRuntimeRequest

```json
{
  "type": "object",
  "additionalProperties": false,
  "required": [
    "applicationRuntimeId"
  ],
  "properties": {
    "applicationRuntimeId": {
      "$ref": "#/components/schemas/ApplicationRuntimeId"
    }
  }
}
```

### ResourceRequest

```json
{
  "type": "object",
  "additionalProperties": false,
  "required": [
    "applicationRuntimeId",
    "resourceLocator"
  ],
  "properties": {
    "applicationRuntimeId": {
      "$ref": "#/components/schemas/ApplicationRuntimeId"
    },
    "resourceLocator": {
      "$ref": "#/components/schemas/ResourceLocator"
    }
  }
}
```

### WorkflowInstanceRequest

```json
{
  "type": "object",
  "additionalProperties": false,
  "required": [
    "applicationRuntimeId",
    "resourceLocator",
    "instanceId"
  ],
  "properties": {
    "applicationRuntimeId": {
      "$ref": "#/components/schemas/ApplicationRuntimeId"
    },
    "resourceLocator": {
      "$ref": "#/components/schemas/ResourceLocator"
    },
    "instanceId": {
      "type": "string",
      "minLength": 1
    }
  }
}
```

### QueryBundleResourcesRequest

```json
{
  "type": "object",
  "additionalProperties": false,
  "required": [
    "applicationRuntimeId"
  ],
  "properties": {
    "applicationRuntimeId": {
      "$ref": "#/components/schemas/ApplicationRuntimeId"
    },
    "resourceType": {
      "type": "string",
      "minLength": 1,
      "description": "资源类型来自当前环境目录；新增类型无需更新客户端。"
    }
  }
}
```

### StartWorkflowRequest

```json
{
  "type": "object",
  "additionalProperties": false,
  "required": [
    "applicationRuntimeId",
    "resourceLocator",
    "requestId"
  ],
  "properties": {
    "applicationRuntimeId": {
      "$ref": "#/components/schemas/ApplicationRuntimeId"
    },
    "resourceLocator": {
      "$ref": "#/components/schemas/ResourceLocator"
    },
    "input": {
      "type": "object",
      "additionalProperties": true
    },
    "metadata": {
      "type": "object",
      "additionalProperties": true
    },
    "requestId": {
      "type": "string",
      "minLength": 1,
      "description": "同一次启动请求的稳定幂等标识，必填；与 metadata.requestId 无关。"
    }
  }
}
```

### QueryWorkflowInstancesRequest

```json
{
  "type": "object",
  "additionalProperties": false,
  "required": [
    "applicationRuntimeId",
    "resourceLocator"
  ],
  "properties": {
    "applicationRuntimeId": {
      "$ref": "#/components/schemas/ApplicationRuntimeId"
    },
    "resourceLocator": {
      "$ref": "#/components/schemas/ResourceLocator"
    },
    "status": {
      "type": "string",
      "minLength": 1
    },
    "pageNum": {
      "type": "integer",
      "minimum": 1,
      "default": 1
    },
    "pageSize": {
      "type": "integer",
      "minimum": 1,
      "maximum": 100,
      "default": 20
    }
  }
}
```

### QueryTimerExecutionsRequest

```json
{
  "type": "object",
  "additionalProperties": false,
  "required": [
    "applicationRuntimeId",
    "resourceLocator"
  ],
  "properties": {
    "applicationRuntimeId": {
      "$ref": "#/components/schemas/ApplicationRuntimeId"
    },
    "resourceLocator": {
      "$ref": "#/components/schemas/ResourceLocator"
    },
    "status": {
      "type": "string",
      "minLength": 1
    },
    "limit": {
      "type": "integer",
      "minimum": 1,
      "maximum": 1000,
      "default": 50
    },
    "offset": {
      "type": "integer",
      "minimum": 0,
      "default": 0
    }
  }
}
```

### ResourceVersion

```json
{
  "type": "object",
  "properties": {
    "resourceLocator": {
      "$ref": "#/components/schemas/ResourceLocator"
    },
    "semanticVersion": {
      "type": "string"
    }
  },
  "required": [
    "resourceLocator",
    "semanticVersion"
  ],
  "additionalProperties": true
}
```

### BundleIdentity

```json
{
  "type": "object",
  "properties": {
    "environmentKey": {
      "type": "string"
    },
    "bundleId": {
      "type": "string"
    }
  },
  "required": [
    "environmentKey",
    "bundleId"
  ],
  "additionalProperties": true
}
```

### BundleResources

```json
{
  "type": "object",
  "properties": {
    "contractVersion": {
      "type": "string"
    },
    "workspaceId": {
      "type": "integer"
    },
    "applicationRuntimeId": {
      "$ref": "#/components/schemas/ApplicationRuntimeId"
    },
    "bundle": {
      "$ref": "#/components/schemas/BundleIdentity"
    },
    "resources": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/ResourceVersion"
      }
    }
  },
  "required": [
    "contractVersion",
    "workspaceId",
    "applicationRuntimeId",
    "bundle",
    "resources"
  ],
  "additionalProperties": true
}
```

### WorkflowDefinition

```json
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "workspaceId": {
      "type": "string"
    },
    "code": {
      "type": "string",
      "description": "工作流定义的稳定编码。查询定义时读取此字段；definitionCode 属于执行实例等其他对象。"
    },
    "name": {
      "type": "string"
    },
    "revision": {
      "type": "integer"
    },
    "currentPlanId": {
      "type": "string"
    },
    "recompilationRequired": {
      "type": "boolean"
    },
    "description": {
      "type": [
        "string",
        "null"
      ]
    },
    "status": {
      "type": "string",
      "enum": [
        "draft",
        "active",
        "disabled"
      ]
    },
    "startNodeId": {
      "type": "string"
    },
    "inputSchema": {
      "type": "array",
      "items": {
        "type": "object",
        "description": "平台低代码参数定义。"
      }
    },
    "outputSchema": {
      "description": "由工作流或业务对象自己的类型合同定义的 JSON 值。"
    },
    "nodes": {
      "type": "array",
      "items": {
        "type": "object",
        "description": "已安装资源版本的工作流节点定义。"
      }
    },
    "edges": {
      "type": "array",
      "items": {
        "type": "object"
      }
    },
    "graphLayout": {
      "description": "由工作流或业务对象自己的类型合同定义的 JSON 值。"
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    }
  },
  "required": [
    "id",
    "workspaceId",
    "code",
    "name",
    "revision",
    "status",
    "startNodeId",
    "nodes",
    "edges",
    "recompilationRequired",
    "description",
    "inputSchema",
    "outputSchema",
    "graphLayout",
    "tags",
    "createdAt",
    "updatedAt"
  ],
  "additionalProperties": true,
  "description": "已安装的 Workflow 定义，直接位于 data（单项）或 data[]（列表）。不包含编译计划外层 definitionCode/planId/definition；resourceLocator 与 semanticVersion 从 Bundle 资源账本取得。"
}
```

### WorkflowInstance

```json
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "workspaceId": {
      "type": [
        "string",
        "null"
      ]
    },
    "applicationRuntimeId": {
      "type": [
        "string",
        "null"
      ]
    },
    "executionSnapshotId": {
      "type": "string"
    },
    "definitionId": {
      "type": "string"
    },
    "definitionCode": {
      "type": "string"
    },
    "status": {
      "type": "string"
    },
    "resourceVersion": {
      "$ref": "#/components/schemas/ResourceVersion"
    },
    "input": {
      "description": "由工作流或业务对象自己的类型合同定义的 JSON 值。"
    },
    "output": {
      "description": "由工作流或业务对象自己的类型合同定义的 JSON 值。"
    },
    "context": {
      "description": "由工作流或业务对象自己的类型合同定义的 JSON 值。"
    },
    "metadata": {
      "type": "object"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    },
    "completedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "tenantId": {
      "type": "string"
    },
    "concurrencyGroupKey": {
      "type": "string"
    },
    "partitionKey": {
      "type": "string"
    },
    "runtimeProjectionId": {
      "type": "string"
    },
    "planId": {
      "type": [
        "string",
        "null"
      ]
    },
    "failedNodeId": {
      "type": [
        "string",
        "null"
      ]
    },
    "lastError": {
      "type": [
        "string",
        "null"
      ]
    },
    "currentNodeIds": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "waitingNodeIds": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "executionSubjectUserId": {
      "type": "integer"
    },
    "definitionSnapshot": {
      "$ref": "#/components/schemas/WorkflowDefinition"
    },
    "nodeStates": {
      "type": "object",
      "additionalProperties": {
        "type": "object"
      }
    }
  },
  "required": [
    "id",
    "tenantId",
    "concurrencyGroupKey",
    "executionSnapshotId",
    "definitionId",
    "definitionCode",
    "status",
    "input",
    "context",
    "output",
    "metadata",
    "currentNodeIds",
    "waitingNodeIds",
    "nodeStates",
    "createdAt",
    "updatedAt"
  ],
  "additionalProperties": true
}
```

### WorkflowInstanceDetail

```json
{
  "allOf": [
    {
      "$ref": "#/components/schemas/WorkflowInstance"
    },
    {
      "type": "object",
      "properties": {
        "plan": {
          "type": [
            "object",
            "null"
          ],
          "description": "该执行冻结的运行计划，可能为空。"
        },
        "synchronization": {
          "$ref": "#/components/schemas/ExecutionSynchronization"
        }
      },
      "required": [
        "plan",
        "synchronization"
      ],
      "additionalProperties": true
    }
  ]
}
```

### WorkflowInstancePage

```json
{
  "type": "object",
  "properties": {
    "list": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/WorkflowInstanceSummary"
      }
    },
    "total": {
      "type": "integer",
      "minimum": 0
    },
    "statusCounts": {
      "type": "object",
      "additionalProperties": {
        "type": "integer"
      }
    },
    "synchronization": {
      "$ref": "#/components/schemas/ExecutionSynchronization"
    }
  },
  "required": [
    "list",
    "total",
    "statusCounts",
    "synchronization"
  ],
  "additionalProperties": true
}
```

### NodeExecution

```json
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "instanceId": {
      "type": "string"
    },
    "nodeId": {
      "type": "string"
    },
    "nodeType": {
      "type": "string"
    },
    "status": {
      "type": "string"
    },
    "input": {
      "description": "由工作流或业务对象自己的类型合同定义的 JSON 值。"
    },
    "output": {
      "description": "由工作流或业务对象自己的类型合同定义的 JSON 值。"
    },
    "error": {
      "type": [
        "string",
        "null"
      ]
    },
    "metadata": {
      "description": "由工作流或业务对象自己的类型合同定义的 JSON 值。"
    },
    "startedAt": {
      "type": "string",
      "format": "date-time"
    },
    "finishedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "trigger": {
      "type": "string"
    }
  },
  "required": [
    "id",
    "instanceId",
    "nodeId",
    "nodeType",
    "status",
    "trigger",
    "startedAt"
  ],
  "additionalProperties": true
}
```

### WorkflowNodeHistory

```json
{
  "type": "object",
  "properties": {
    "list": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/NodeExecution"
      }
    },
    "synchronization": {
      "$ref": "#/components/schemas/ExecutionSynchronization"
    }
  },
  "required": [
    "list",
    "synchronization"
  ],
  "additionalProperties": true
}
```

### TimerDefinition

```json
{
  "type": "object",
  "properties": {
    "resourceVersion": {
      "$ref": "#/components/schemas/ResourceVersion"
    },
    "name": {
      "type": "string"
    },
    "description": {
      "type": [
        "string",
        "null"
      ]
    },
    "enabled": {
      "type": "boolean"
    },
    "schedule": {
      "type": "object",
      "description": "Timer 版本自己的调度合同。"
    },
    "target": {
      "type": "object",
      "description": "Timer 版本自己的执行目标合同。"
    },
    "nextFireAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    }
  },
  "required": [
    "resourceVersion",
    "name",
    "description",
    "enabled",
    "schedule",
    "target",
    "nextFireAt",
    "createdAt",
    "updatedAt"
  ],
  "additionalProperties": true
}
```

### TimerExecution

```json
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "executionId": {
      "type": "string"
    },
    "status": {
      "type": "string"
    },
    "attemptNumber": {
      "type": "integer"
    },
    "requestBody": {
      "type": [
        "string",
        "null"
      ]
    },
    "responseBody": {
      "type": [
        "string",
        "null"
      ]
    },
    "errorMessage": {
      "type": [
        "string",
        "null"
      ]
    },
    "errorType": {
      "type": [
        "string",
        "null"
      ]
    },
    "traceId": {
      "type": [
        "string",
        "null"
      ]
    },
    "responseStatusCode": {
      "type": [
        "integer",
        "null"
      ]
    },
    "responseSizeBytes": {
      "type": [
        "integer",
        "null"
      ]
    },
    "durationMs": {
      "type": [
        "integer",
        "null"
      ]
    },
    "scheduledAt": {
      "type": "string",
      "format": "date-time"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "startedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "completedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    }
  },
  "required": [
    "id",
    "executionId",
    "status",
    "attemptNumber",
    "requestBody",
    "responseBody",
    "errorMessage",
    "errorType",
    "traceId",
    "responseStatusCode",
    "responseSizeBytes",
    "durationMs",
    "scheduledAt",
    "createdAt",
    "startedAt",
    "completedAt"
  ],
  "additionalProperties": true
}
```

### TimerTriggerReceipt

```json
{
  "type": "object",
  "properties": {
    "applicationRuntimeId": {
      "type": "string"
    },
    "resourceLocator": {
      "$ref": "#/components/schemas/ResourceLocator"
    },
    "mode": {
      "const": "trigger"
    },
    "triggeredAt": {
      "type": "string",
      "format": "date-time"
    }
  },
  "required": [
    "applicationRuntimeId",
    "resourceLocator",
    "mode",
    "triggeredAt"
  ],
  "additionalProperties": true
}
```

### CapabilityError

```json
{
  "type": "object",
  "required": [
    "errorCode",
    "data"
  ],
  "properties": {
    "contractVersion": {
      "const": "1.0.0"
    },
    "errorCode": {
      "type": "string",
      "maxLength": 128,
      "pattern": "^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)*$"
    },
    "data": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/CapabilityFailureData"
        }
      ]
    }
  },
  "additionalProperties": true
}
```

### ExecutionSynchronization

```json
{
  "type": "object",
  "properties": {
    "generation": {
      "type": "integer",
      "minimum": 1
    },
    "rebuilding": {
      "type": "boolean"
    },
    "sourceObservedAt": {
      "type": "string",
      "format": "date-time"
    },
    "appliedAt": {
      "type": "string",
      "format": "date-time"
    },
    "caughtUpAt": {
      "type": "string",
      "format": "date-time"
    }
  },
  "required": [
    "generation",
    "rebuilding",
    "sourceObservedAt",
    "appliedAt",
    "caughtUpAt"
  ],
  "additionalProperties": true
}
```

### WorkflowInstanceSummary

```json
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "workspaceId": {
      "type": "string"
    },
    "runtimeProjectionId": {
      "type": [
        "string",
        "null"
      ]
    },
    "executionSnapshotId": {
      "type": "string"
    },
    "applicationRuntimeId": {
      "type": [
        "string",
        "null"
      ]
    },
    "resourceVersion": {
      "$ref": "#/components/schemas/ResourceVersion"
    },
    "planId": {
      "type": [
        "string",
        "null"
      ]
    },
    "definitionId": {
      "type": "string"
    },
    "definitionCode": {
      "type": "string"
    },
    "status": {
      "type": "string"
    },
    "currentNodeIds": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "waitingNodeIds": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "failedNodeId": {
      "type": [
        "string",
        "null"
      ]
    },
    "lastError": {
      "type": [
        "string",
        "null"
      ]
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    },
    "completedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "hasOutput": {
      "type": "boolean"
    }
  },
  "required": [
    "id",
    "workspaceId",
    "runtimeProjectionId",
    "executionSnapshotId",
    "applicationRuntimeId",
    "planId",
    "definitionId",
    "definitionCode",
    "status",
    "currentNodeIds",
    "waitingNodeIds",
    "failedNodeId",
    "lastError",
    "createdAt",
    "updatedAt",
    "completedAt",
    "hasOutput"
  ],
  "additionalProperties": true
}
```

### CapabilityFailureData

```json
{
  "type": "object",
  "required": [
    "message",
    "retryable"
  ],
  "properties": {
    "message": {
      "type": "string",
      "minLength": 1,
      "maxLength": 512
    },
    "retryable": {
      "type": "boolean"
    }
  },
  "additionalProperties": true
}
```
