{
  "openapi": "3.1.1",
  "jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
  "info": {
    "title": "Heddle Execution Host invocation contract",
    "version": "2.0.0",
    "description": "The language-neutral HTTP/SSE binding between an adopter backend and a Heddle-compatible Execution Host. Deployment authentication and runtime routing are binding concerns; credentials stay in headers and never enter the JSON request body."
  },
  "servers": [],
  "paths": {
    "/invocations": {
      "post": {
        "operationId": "streamExecutionHostInvocation",
        "summary": "Run one supported Execution Host workflow",
        "description": "Starts one conversation turn or heartbeat task and holds one SSE response open until a terminal event or an ambiguous interruption. A clean HTTP EOF is required before a terminal frame may be committed as final.",
        "parameters": [
          {
            "name": "x-amzn-bedrock-agentcore-runtime-session-id",
            "in": "header",
            "required": true,
            "description": "Logical runtimeSessionId. AgentCore supplies this exact header; another deployment adapter must preserve the same value.",
            "schema": {
              "type": "string",
              "minLength": 33,
              "maxLength": 256
            },
            "x-heddle-binding": "agentcore-runtime"
          },
          {
            "name": "x-heddle-execution-host-assertion",
            "in": "header",
            "required": true,
            "description": "Short-lived ES256 admission assertion issued by the adopter backend.",
            "schema": {
              "type": "string",
              "minLength": 32,
              "maxLength": 4096
            }
          },
          {
            "name": "x-heddle-execution-host-mcp-capability",
            "in": "header",
            "required": false,
            "description": "Optional invocation-bound capability forwarded only to the configured adopter MCP server.",
            "schema": {
              "type": "string",
              "minLength": 32,
              "maxLength": 4096
            }
          },
          {
            "name": "x-heddle-execution-host-model-credential",
            "in": "header",
            "required": true,
            "description": "JSON-encoded invocation-scoped model credential. OAuth refresh material is forbidden. The header must be scrubbed before parsing or logging.",
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 8192
            }
          },
          {
            "name": "x-heddle-execution-host-local-token",
            "in": "header",
            "required": false,
            "description": "Loopback-only direct-development ingress token; managed deployments use their provider ingress instead.",
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 4096
            },
            "x-heddle-binding": "direct-development"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/ConversationTurnRequest"
                  },
                  {
                    "$ref": "#/components/schemas/HeartbeatTaskRequest"
                  }
                ],
                "discriminator": {
                  "propertyName": "kind"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Ordered SSE stream. Each frame uses id=<sequence>, event=<kind>, and one JSON event in data. accepted is sequence zero; exactly one result, cancelled, or error terminal is last.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "X-Content-Type-Options": {
                "schema": {
                  "type": "string",
                  "const": "nosniff"
                }
              }
            },
            "content": {
              "text/event-stream": {
                "schema": {
                  "type": "string"
                },
                "example": "id: 0\nevent: accepted\ndata: {\"schemaVersion\":2,\"invocationId\":\"invocation-001\",\"runId\":\"run-001\",\"sequence\":0,\"timestamp\":\"2026-08-10T04:00:00.000Z\",\"kind\":\"accepted\"}\n\nid: 1\nevent: activity\ndata: {\"schemaVersion\":2,\"invocationId\":\"invocation-001\",\"runId\":\"run-001\",\"sequence\":1,\"timestamp\":\"2026-08-10T04:00:00.000Z\",\"kind\":\"activity\",\"activity\":{\"type\":\"assistant_text_delta\",\"text\":\"Working.\"}}\n\nid: 2\nevent: result\ndata: {\"schemaVersion\":2,\"invocationId\":\"invocation-001\",\"runId\":\"run-001\",\"sequence\":2,\"timestamp\":\"2026-08-10T04:00:00.000Z\",\"kind\":\"result\",\"result\":{\"outcome\":\"done\",\"summary\":\"Complete.\"}}\n\n: fixture-clean-eof\n"
              }
            }
          },
          "400": {
            "description": "Invalid request or duplicated sensitive header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid execution authority or credential.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "413": {
            "description": "Request body exceeded the deployment limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "415": {
            "description": "Request body was not application/json.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "The bound runtime session is busy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Execution Host failed safely.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "502": {
            "description": "An execution dependency could not be prepared.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "503": {
            "description": "Execution Host or verifier dependency unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ExecutionScope": {
        "type": "object",
        "properties": {
          "adopterId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
          },
          "tenantId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
          },
          "subjectId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
          },
          "productSessionId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
          }
        },
        "required": [
          "adopterId",
          "tenantId",
          "subjectId",
          "productSessionId"
        ],
        "additionalProperties": false
      },
      "RuntimeToolPolicy": {
        "type": "object",
        "properties": {
          "allow": {
            "maxItems": 32,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[A-Za-z][A-Za-z0-9_]*$"
            },
            "uniqueItems": true,
            "x-heddle-max-total-item-characters": 1024
          }
        },
        "required": [
          "allow"
        ],
        "additionalProperties": false
      },
      "ConversationTurnRequest": {
        "type": "object",
        "properties": {
          "schemaVersion": {
            "type": "number",
            "const": 2
          },
          "kind": {
            "type": "string",
            "const": "conversation-turn"
          },
          "invocationId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
          },
          "prompt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200000,
            "x-heddle-trimmed": true
          },
          "durability": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "workingSet": {
                    "type": "string",
                    "const": "required"
                  },
                  "memory": {
                    "type": "string",
                    "const": "required"
                  }
                },
                "required": [
                  "workingSet"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "workingSet": {
                    "type": "string",
                    "const": "required"
                  },
                  "memory": {
                    "type": "string",
                    "const": "required"
                  }
                },
                "required": [
                  "memory"
                ],
                "additionalProperties": false
              }
            ]
          },
          "deadlineAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          }
        },
        "required": [
          "schemaVersion",
          "kind",
          "invocationId",
          "prompt"
        ],
        "additionalProperties": false
      },
      "HeartbeatTaskRequest": {
        "type": "object",
        "properties": {
          "schemaVersion": {
            "type": "number",
            "const": 2
          },
          "kind": {
            "type": "string",
            "const": "heartbeat-task"
          },
          "invocationId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
          },
          "taskId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
          },
          "task": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200000,
            "x-heddle-trimmed": true
          },
          "runtimeToolPolicy": {
            "type": "object",
            "properties": {
              "allow": {
                "maxItems": 32,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "pattern": "^[A-Za-z][A-Za-z0-9_]*$"
                }
              }
            },
            "required": [
              "allow"
            ],
            "additionalProperties": false
          },
          "durability": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "workingSet": {
                    "type": "string",
                    "const": "required"
                  },
                  "memory": {
                    "type": "string",
                    "const": "required"
                  }
                },
                "required": [
                  "workingSet"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "workingSet": {
                    "type": "string",
                    "const": "required"
                  },
                  "memory": {
                    "type": "string",
                    "const": "required"
                  }
                },
                "required": [
                  "memory"
                ],
                "additionalProperties": false
              }
            ]
          },
          "checkpoint": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "$ref": "#/components/schemas/HeartbeatTaskRequest/$defs/__schema0"
            }
          },
          "runContext": {
            "type": "object",
            "properties": {
              "currentDateTime": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              "intervalMs": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "continuationMode": {
                "type": "string",
                "enum": [
                  "operator",
                  "agent"
                ]
              },
              "nextRunAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              "previousRunAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              "previousRunId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128,
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
              }
            },
            "required": [
              "currentDateTime",
              "intervalMs"
            ],
            "additionalProperties": false
          },
          "model": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          },
          "reasoningEffort": {
            "type": "string",
            "enum": [
              "none",
              "low",
              "medium",
              "high",
              "ultrahigh",
              "max"
            ]
          },
          "maxSteps": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 10000
          },
          "searchIgnoreDirs": {
            "maxItems": 1000,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1024
            }
          },
          "systemContext": {
            "type": "string",
            "maxLength": 200000
          },
          "deadlineAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          }
        },
        "required": [
          "schemaVersion",
          "kind",
          "invocationId",
          "taskId",
          "task",
          "runtimeToolPolicy",
          "runContext"
        ],
        "additionalProperties": false,
        "$defs": {
          "__schema0": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "number"
              },
              {
                "type": "boolean"
              },
              {
                "type": "null"
              },
              {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/HeartbeatTaskRequest/$defs/__schema0"
                }
              },
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "$ref": "#/components/schemas/HeartbeatTaskRequest/$defs/__schema0"
                }
              }
            ]
          }
        }
      },
      "ModelCredential": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "api-key"
              },
              "apiKey": {
                "type": "string",
                "minLength": 8,
                "maxLength": 4096
              }
            },
            "required": [
              "type",
              "apiKey"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "oauth-access-token"
              },
              "provider": {
                "type": "string",
                "const": "openai"
              },
              "accessToken": {
                "type": "string",
                "minLength": 8,
                "maxLength": 4096
              },
              "expiresAt": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "accountId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 512
              }
            },
            "required": [
              "type",
              "provider",
              "accessToken",
              "expiresAt"
            ],
            "additionalProperties": false
          }
        ]
      },
      "RuntimePublicResult": {
        "type": "object",
        "properties": {
          "outcome": {
            "type": "string",
            "enum": [
              "done",
              "max_steps",
              "error",
              "interrupted"
            ]
          },
          "summary": {
            "type": "string"
          },
          "failure": {
            "type": "object",
            "properties": {
              "source": {
                "type": "string",
                "const": "model"
              },
              "code": {
                "type": "string",
                "enum": [
                  "authentication",
                  "permission",
                  "quota",
                  "rate_limit",
                  "context_window",
                  "request",
                  "transport",
                  "empty_response",
                  "unknown"
                ]
              }
            },
            "required": [
              "source",
              "code"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "outcome"
        ],
        "additionalProperties": false
      },
      "StreamEvent": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "schemaVersion": {
                "type": "number",
                "const": 2
              },
              "invocationId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128,
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
              },
              "runId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128,
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
              },
              "sequence": {
                "type": "number",
                "const": 0
              },
              "timestamp": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              "kind": {
                "type": "string",
                "const": "accepted"
              }
            },
            "required": [
              "schemaVersion",
              "invocationId",
              "runId",
              "sequence",
              "timestamp",
              "kind"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "schemaVersion": {
                "type": "number",
                "const": 2
              },
              "invocationId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128,
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
              },
              "runId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128,
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
              },
              "sequence": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "timestamp": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              "kind": {
                "type": "string",
                "const": "activity"
              },
              "activity": {}
            },
            "required": [
              "schemaVersion",
              "invocationId",
              "runId",
              "sequence",
              "timestamp",
              "kind",
              "activity"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "schemaVersion": {
                "type": "number",
                "const": 2
              },
              "invocationId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128,
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
              },
              "runId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128,
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
              },
              "sequence": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "timestamp": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              "kind": {
                "type": "string",
                "const": "result"
              },
              "result": {
                "type": "object",
                "properties": {
                  "outcome": {
                    "type": "string",
                    "enum": [
                      "done",
                      "max_steps",
                      "error",
                      "interrupted"
                    ]
                  },
                  "summary": {
                    "type": "string"
                  },
                  "failure": {
                    "type": "object",
                    "properties": {
                      "source": {
                        "type": "string",
                        "const": "model"
                      },
                      "code": {
                        "type": "string",
                        "enum": [
                          "authentication",
                          "permission",
                          "quota",
                          "rate_limit",
                          "context_window",
                          "request",
                          "transport",
                          "empty_response",
                          "unknown"
                        ]
                      }
                    },
                    "required": [
                      "source",
                      "code"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "outcome"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "schemaVersion",
              "invocationId",
              "runId",
              "sequence",
              "timestamp",
              "kind",
              "result"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "schemaVersion": {
                "type": "number",
                "const": 2
              },
              "invocationId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128,
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
              },
              "runId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128,
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
              },
              "sequence": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "timestamp": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              "kind": {
                "type": "string",
                "const": "cancelled"
              },
              "reason": {
                "type": "string"
              }
            },
            "required": [
              "schemaVersion",
              "invocationId",
              "runId",
              "sequence",
              "timestamp",
              "kind",
              "reason"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "schemaVersion": {
                "type": "number",
                "const": 2
              },
              "invocationId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128,
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
              },
              "runId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128,
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
              },
              "sequence": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "timestamp": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              "kind": {
                "type": "string",
                "const": "error"
              },
              "error": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "pattern": "^[a-z0-9_]+$"
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1600
                  }
                },
                "required": [
                  "code",
                  "message"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "schemaVersion",
              "invocationId",
              "runId",
              "sequence",
              "timestamp",
              "kind",
              "error"
            ],
            "additionalProperties": false
          }
        ]
      },
      "HeartbeatStreamEvent": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "schemaVersion": {
                "type": "number",
                "const": 2
              },
              "invocationId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128,
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
              },
              "runId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128,
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
              },
              "sequence": {
                "type": "number",
                "const": 0
              },
              "timestamp": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              "kind": {
                "type": "string",
                "const": "accepted"
              }
            },
            "required": [
              "schemaVersion",
              "invocationId",
              "runId",
              "sequence",
              "timestamp",
              "kind"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "schemaVersion": {
                "type": "number",
                "const": 2
              },
              "invocationId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128,
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
              },
              "runId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128,
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
              },
              "sequence": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "timestamp": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              "kind": {
                "type": "string",
                "const": "activity"
              },
              "activity": {
                "$ref": "#/components/schemas/HeartbeatStreamEvent/$defs/__schema0"
              }
            },
            "required": [
              "schemaVersion",
              "invocationId",
              "runId",
              "sequence",
              "timestamp",
              "kind",
              "activity"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "schemaVersion": {
                "type": "number",
                "const": 2
              },
              "invocationId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128,
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
              },
              "runId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128,
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
              },
              "sequence": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "timestamp": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              "kind": {
                "type": "string",
                "const": "result"
              },
              "result": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "$ref": "#/components/schemas/HeartbeatStreamEvent/$defs/__schema1"
                }
              }
            },
            "required": [
              "schemaVersion",
              "invocationId",
              "runId",
              "sequence",
              "timestamp",
              "kind",
              "result"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "schemaVersion": {
                "type": "number",
                "const": 2
              },
              "invocationId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128,
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
              },
              "runId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128,
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
              },
              "sequence": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "timestamp": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              "kind": {
                "type": "string",
                "const": "cancelled"
              },
              "reason": {
                "type": "string"
              }
            },
            "required": [
              "schemaVersion",
              "invocationId",
              "runId",
              "sequence",
              "timestamp",
              "kind",
              "reason"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "schemaVersion": {
                "type": "number",
                "const": 2
              },
              "invocationId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128,
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
              },
              "runId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128,
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
              },
              "sequence": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "timestamp": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              "kind": {
                "type": "string",
                "const": "error"
              },
              "error": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "pattern": "^[a-z0-9_]+$"
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1600
                  }
                },
                "required": [
                  "code",
                  "message"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "schemaVersion",
              "invocationId",
              "runId",
              "sequence",
              "timestamp",
              "kind",
              "error"
            ],
            "additionalProperties": false
          }
        ],
        "$defs": {
          "__schema0": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "number"
              },
              {
                "type": "boolean"
              },
              {
                "type": "null"
              },
              {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/HeartbeatStreamEvent/$defs/__schema0"
                }
              },
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "$ref": "#/components/schemas/HeartbeatStreamEvent/$defs/__schema0"
                }
              }
            ]
          },
          "__schema1": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "number"
              },
              {
                "type": "boolean"
              },
              {
                "type": "null"
              },
              {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/HeartbeatStreamEvent/$defs/__schema1"
                }
              },
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "$ref": "#/components/schemas/HeartbeatStreamEvent/$defs/__schema1"
                }
              }
            ]
          }
        }
      },
      "ExecutionAssertionClaims": {
        "type": "object",
        "properties": {
          "iss": {
            "type": "string",
            "format": "uri"
          },
          "aud": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          },
          "contractVersion": {
            "type": "number",
            "const": 2
          },
          "adopterId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
          },
          "tenantId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
          },
          "productSessionId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
          },
          "runtimeSessionId": {
            "type": "string",
            "minLength": 33,
            "maxLength": 256,
            "x-heddle-trimmed": true
          },
          "workflow": {
            "type": "string",
            "enum": [
              "conversation-turn",
              "heartbeat-task"
            ]
          },
          "runtimeToolPolicy": {
            "type": "object",
            "properties": {
              "allow": {
                "maxItems": 32,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "pattern": "^[A-Za-z][A-Za-z0-9_]*$"
                }
              }
            },
            "required": [
              "allow"
            ],
            "additionalProperties": false
          },
          "durability": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "workingSet": {
                    "type": "string",
                    "const": "required"
                  },
                  "memory": {
                    "type": "string",
                    "const": "required"
                  }
                },
                "required": [
                  "workingSet"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "workingSet": {
                    "type": "string",
                    "const": "required"
                  },
                  "memory": {
                    "type": "string",
                    "const": "required"
                  }
                },
                "required": [
                  "memory"
                ],
                "additionalProperties": false
              }
            ]
          },
          "sub": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
          },
          "jti": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
          },
          "iat": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "exp": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "iss",
          "aud",
          "contractVersion",
          "adopterId",
          "tenantId",
          "productSessionId",
          "runtimeSessionId",
          "workflow",
          "sub",
          "jti",
          "iat",
          "exp"
        ],
        "additionalProperties": {},
        "x-heddle-runtime-tool-policy-binding": "required for heartbeat-task and forbidden for conversation-turn"
      },
      "McpCapabilityClaims": {
        "type": "object",
        "properties": {
          "allowedTools": {
            "minItems": 1,
            "maxItems": 16,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[A-Za-z][A-Za-z0-9_]*$"
            },
            "uniqueItems": true,
            "x-heddle-max-total-item-characters": 512
          },
          "returnDirectTools": {
            "minItems": 1,
            "maxItems": 16,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[A-Za-z][A-Za-z0-9_]*$"
            },
            "uniqueItems": true,
            "x-heddle-max-total-item-characters": 512
          },
          "iss": {
            "type": "string",
            "format": "uri"
          },
          "aud": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512
          },
          "contractVersion": {
            "type": "number",
            "const": 2
          },
          "adopterId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
          },
          "tenantId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
          },
          "productSessionId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
          },
          "runtimeSessionId": {
            "type": "string",
            "minLength": 33,
            "maxLength": 256,
            "x-heddle-trimmed": true
          },
          "invocationId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
          },
          "workflow": {
            "type": "string",
            "enum": [
              "conversation-turn",
              "heartbeat-task"
            ]
          },
          "serverId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[A-Za-z0-9_-]+$"
          },
          "sub": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
          },
          "jti": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
          },
          "iat": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "exp": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "allowedTools",
          "iss",
          "aud",
          "contractVersion",
          "adopterId",
          "tenantId",
          "productSessionId",
          "runtimeSessionId",
          "invocationId",
          "workflow",
          "serverId",
          "sub",
          "jti",
          "iat",
          "exp"
        ],
        "additionalProperties": {}
      },
      "ExecutionAssertionProtectedHeader": {
        "type": "object",
        "properties": {
          "alg": {
            "type": "string",
            "const": "ES256"
          },
          "kid": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
          },
          "typ": {
            "type": "string",
            "const": "heddle-execution+jwt"
          }
        },
        "required": [
          "alg",
          "kid",
          "typ"
        ],
        "additionalProperties": false
      },
      "McpCapabilityProtectedHeader": {
        "type": "object",
        "properties": {
          "alg": {
            "type": "string",
            "const": "ES256"
          },
          "kid": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
          },
          "typ": {
            "type": "string",
            "const": "heddle-mcp-capability+jwt"
          }
        },
        "required": [
          "alg",
          "kid",
          "typ"
        ],
        "additionalProperties": false
      },
      "ApiError": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128,
                "pattern": "^[a-z0-9_]+$"
              },
              "message": {
                "type": "string",
                "minLength": 1,
                "maxLength": 1600
              }
            },
            "required": [
              "code",
              "message"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": false
      }
    }
  }
}
