{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://heddleagent.com/spec/execution-host/v2/schema-bundle.json",
  "title": "Heddle Execution Host adopter contract v2",
  "description": "Language-neutral schemas for invoking an Execution Host, consuming its ordered event stream, and carrying adopter-issued execution authority.",
  "$comment": "JSON Schema validates individual values. Stream ordering, duplicated JWT claim binding, bounded token age, and total tool-name characters are semantic invariants described by README.md and executable fixtures.",
  "$defs": {
    "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": "#/$defs/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": "#/$defs/HeartbeatTaskRequest/$defs/__schema0"
              }
            },
            {
              "type": "object",
              "propertyNames": {
                "type": "string"
              },
              "additionalProperties": {
                "$ref": "#/$defs/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": "#/$defs/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": "#/$defs/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": "#/$defs/HeartbeatStreamEvent/$defs/__schema0"
              }
            },
            {
              "type": "object",
              "propertyNames": {
                "type": "string"
              },
              "additionalProperties": {
                "$ref": "#/$defs/HeartbeatStreamEvent/$defs/__schema0"
              }
            }
          ]
        },
        "__schema1": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "number"
            },
            {
              "type": "boolean"
            },
            {
              "type": "null"
            },
            {
              "type": "array",
              "items": {
                "$ref": "#/$defs/HeartbeatStreamEvent/$defs/__schema1"
              }
            },
            {
              "type": "object",
              "propertyNames": {
                "type": "string"
              },
              "additionalProperties": {
                "$ref": "#/$defs/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
    },
    "HostedConversationPersistenceScope": {
      "type": "object",
      "properties": {
        "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": [
        "tenantId",
        "subjectId",
        "productSessionId"
      ],
      "additionalProperties": false
    },
    "HostedConversationTurnIdentity": {
      "type": "object",
      "properties": {
        "invocationId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128,
          "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
        },
        "scope": {
          "type": "object",
          "properties": {
            "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": [
            "tenantId",
            "subjectId",
            "productSessionId"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "invocationId",
        "scope"
      ],
      "additionalProperties": false
    },
    "HostedConversationRequestedTurn": {
      "type": "object",
      "properties": {
        "invocationId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128,
          "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
        },
        "scope": {
          "type": "object",
          "properties": {
            "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": [
            "tenantId",
            "subjectId",
            "productSessionId"
          ],
          "additionalProperties": false
        },
        "prompt": {
          "type": "string",
          "minLength": 1,
          "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)))$"
        },
        "requestedAt": {
          "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": [
        "invocationId",
        "scope",
        "prompt",
        "requestedAt"
      ],
      "additionalProperties": false
    },
    "HostedConversationAcceptedTurn": {
      "type": "object",
      "properties": {
        "invocationId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128,
          "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
        },
        "scope": {
          "type": "object",
          "properties": {
            "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": [
            "tenantId",
            "subjectId",
            "productSessionId"
          ],
          "additionalProperties": false
        },
        "runId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128,
          "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
        },
        "acceptedAt": {
          "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": [
        "invocationId",
        "scope",
        "runId",
        "acceptedAt"
      ],
      "additionalProperties": false
    },
    "HostedConversationTurnSettlement": {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "invocationId": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
            },
            "scope": {
              "type": "object",
              "properties": {
                "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": [
                "tenantId",
                "subjectId",
                "productSessionId"
              ],
              "additionalProperties": false
            },
            "settledAt": {
              "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)))$"
            },
            "status": {
              "type": "string",
              "const": "completed"
            },
            "summary": {
              "type": "string",
              "maxLength": 1000000
            }
          },
          "required": [
            "invocationId",
            "scope",
            "settledAt",
            "status"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "invocationId": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
            },
            "scope": {
              "type": "object",
              "properties": {
                "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": [
                "tenantId",
                "subjectId",
                "productSessionId"
              ],
              "additionalProperties": false
            },
            "settledAt": {
              "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)))$"
            },
            "status": {
              "type": "string",
              "const": "max_steps"
            },
            "summary": {
              "type": "string",
              "maxLength": 1000000
            }
          },
          "required": [
            "invocationId",
            "scope",
            "settledAt",
            "status"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "invocationId": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
            },
            "scope": {
              "type": "object",
              "properties": {
                "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": [
                "tenantId",
                "subjectId",
                "productSessionId"
              ],
              "additionalProperties": false
            },
            "settledAt": {
              "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)))$"
            },
            "status": {
              "type": "string",
              "const": "failed"
            },
            "summary": {
              "type": "string",
              "maxLength": 1000000
            },
            "failureCode": {
              "type": "string",
              "enum": [
                "execution_error",
                "execution_failed",
                "execution_result_error",
                "host_protocol_error",
                "host_rejected",
                "model_authentication",
                "model_context_window",
                "model_empty_response",
                "model_permission",
                "model_quota",
                "model_rate_limit",
                "model_request",
                "model_transport",
                "model_unknown"
              ]
            }
          },
          "required": [
            "invocationId",
            "scope",
            "settledAt",
            "status",
            "failureCode"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "invocationId": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
            },
            "scope": {
              "type": "object",
              "properties": {
                "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": [
                "tenantId",
                "subjectId",
                "productSessionId"
              ],
              "additionalProperties": false
            },
            "settledAt": {
              "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)))$"
            },
            "status": {
              "type": "string",
              "const": "cancelled"
            },
            "failureCode": {
              "type": "string",
              "const": "invocation_cancelled"
            }
          },
          "required": [
            "invocationId",
            "scope",
            "settledAt",
            "status",
            "failureCode"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "invocationId": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._:@-]*$"
            },
            "scope": {
              "type": "object",
              "properties": {
                "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": [
                "tenantId",
                "subjectId",
                "productSessionId"
              ],
              "additionalProperties": false
            },
            "settledAt": {
              "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)))$"
            },
            "status": {
              "type": "string",
              "const": "interrupted"
            },
            "summary": {
              "type": "string",
              "maxLength": 1000000
            },
            "failureCode": {
              "type": "string",
              "enum": [
                "deadline_elapsed",
                "execution_interrupted",
                "invocation_aborted",
                "stream_ended_without_terminal",
                "stream_interrupted"
              ]
            }
          },
          "required": [
            "invocationId",
            "scope",
            "settledAt",
            "status",
            "failureCode"
          ],
          "additionalProperties": false
        }
      ]
    },
    "HostedConversationExpiredTurnReconciliation": {
      "type": "object",
      "properties": {
        "scope": {
          "type": "object",
          "properties": {
            "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": [
            "tenantId",
            "subjectId",
            "productSessionId"
          ],
          "additionalProperties": false
        },
        "expiredBefore": {
          "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)))$"
        },
        "settledAt": {
          "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": [
        "scope",
        "expiredBefore",
        "settledAt"
      ],
      "additionalProperties": false
    }
  }
}
