{
  "$id": "https://oaslananka.github.io/a2amesh/schemas/registry-task-event.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "description": "Task event payloads emitted by the A2A Mesh registry.",
  "properties": {
    "agentId": { "type": "string" },
    "agentName": { "type": "string" },
    "agentUrl": { "format": "uri", "type": "string" },
    "artifactCount": { "maximum": 9007199254740991, "minimum": 0, "type": "integer" },
    "contextId": { "type": "string" },
    "historyCount": { "maximum": 9007199254740991, "minimum": 0, "type": "integer" },
    "status": {
      "enum": [
        "SUBMITTED",
        "QUEUED",
        "WORKING",
        "INPUT_REQUIRED",
        "AUTH_REQUIRED",
        "WAITING_ON_EXTERNAL",
        "COMPLETED",
        "FAILED",
        "CANCELED",
        "REJECTED"
      ],
      "type": "string"
    },
    "summary": { "type": "string" },
    "task": {
      "additionalProperties": false,
      "properties": {
        "artifacts": {
          "items": {
            "additionalProperties": false,
            "properties": {
              "artifactId": { "type": "string" },
              "description": { "type": "string" },
              "extensions": { "items": { "type": "string" }, "type": "array" },
              "index": { "maximum": 9007199254740991, "minimum": 0, "type": "integer" },
              "lastChunk": { "type": "boolean" },
              "metadata": {
                "additionalProperties": {},
                "propertyNames": { "type": "string" },
                "type": "object"
              },
              "name": { "type": "string" },
              "parts": {
                "items": {
                  "oneOf": [
                    {
                      "additionalProperties": false,
                      "properties": {
                        "text": { "type": "string" },
                        "type": { "const": "text", "type": "string" }
                      },
                      "required": ["type", "text"],
                      "type": "object"
                    },
                    {
                      "additionalProperties": false,
                      "properties": {
                        "file": {
                          "additionalProperties": false,
                          "properties": {
                            "bytes": { "type": "string" },
                            "mimeType": { "type": "string" },
                            "name": { "type": "string" },
                            "uri": { "type": "string" }
                          },
                          "required": ["mimeType"],
                          "type": "object"
                        },
                        "type": { "const": "file", "type": "string" }
                      },
                      "required": ["type", "file"],
                      "type": "object"
                    },
                    {
                      "additionalProperties": false,
                      "properties": {
                        "data": {
                          "additionalProperties": {},
                          "propertyNames": { "type": "string" },
                          "type": "object"
                        },
                        "type": { "const": "data", "type": "string" }
                      },
                      "required": ["type", "data"],
                      "type": "object"
                    }
                  ]
                },
                "type": "array"
              },
              "principalId": { "type": "string" },
              "tenantId": { "type": "string" }
            },
            "required": ["artifactId", "parts", "index"],
            "type": "object"
          },
          "type": "array"
        },
        "contextId": { "type": "string" },
        "extensions": { "items": { "type": "string" }, "type": "array" },
        "history": {
          "items": {
            "additionalProperties": false,
            "properties": {
              "contextId": { "type": "string" },
              "kind": { "const": "message", "type": "string" },
              "messageId": { "type": "string" },
              "parts": {
                "items": {
                  "oneOf": [
                    {
                      "additionalProperties": false,
                      "properties": {
                        "text": { "type": "string" },
                        "type": { "const": "text", "type": "string" }
                      },
                      "required": ["type", "text"],
                      "type": "object"
                    },
                    {
                      "additionalProperties": false,
                      "properties": {
                        "file": {
                          "additionalProperties": false,
                          "properties": {
                            "bytes": { "type": "string" },
                            "mimeType": { "type": "string" },
                            "name": { "type": "string" },
                            "uri": { "type": "string" }
                          },
                          "required": ["mimeType"],
                          "type": "object"
                        },
                        "type": { "const": "file", "type": "string" }
                      },
                      "required": ["type", "file"],
                      "type": "object"
                    },
                    {
                      "additionalProperties": false,
                      "properties": {
                        "data": {
                          "additionalProperties": {},
                          "propertyNames": { "type": "string" },
                          "type": "object"
                        },
                        "type": { "const": "data", "type": "string" }
                      },
                      "required": ["type", "data"],
                      "type": "object"
                    }
                  ]
                },
                "type": "array"
              },
              "role": { "enum": ["ROLE_USER", "ROLE_AGENT"], "type": "string" },
              "timestamp": {
                "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)))$",
                "type": "string"
              }
            },
            "required": ["role", "parts", "messageId", "timestamp"],
            "type": "object"
          },
          "type": "array"
        },
        "id": { "type": "string" },
        "kind": { "const": "task", "type": "string" },
        "metadata": {
          "additionalProperties": {},
          "propertyNames": { "type": "string" },
          "type": "object"
        },
        "principalId": { "type": "string" },
        "sessionId": { "type": "string" },
        "status": {
          "additionalProperties": false,
          "properties": {
            "message": { "type": "string" },
            "state": {
              "enum": [
                "SUBMITTED",
                "QUEUED",
                "WORKING",
                "INPUT_REQUIRED",
                "AUTH_REQUIRED",
                "WAITING_ON_EXTERNAL",
                "COMPLETED",
                "FAILED",
                "CANCELED",
                "REJECTED"
              ],
              "type": "string"
            },
            "timestamp": {
              "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)))$",
              "type": "string"
            }
          },
          "required": ["state", "timestamp"],
          "type": "object"
        },
        "tenantId": { "type": "string" }
      },
      "required": ["id", "status", "history"],
      "type": "object"
    },
    "taskId": { "type": "string" },
    "updatedAt": {
      "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)))$",
      "type": "string"
    }
  },
  "required": [
    "taskId",
    "agentId",
    "agentName",
    "agentUrl",
    "status",
    "updatedAt",
    "historyCount",
    "artifactCount",
    "task"
  ],
  "title": "A2A Mesh Registry Task Event",
  "type": "object",
  "x-a2a-source": {
    "schemaSymbol": "RegistryTaskEventSchema",
    "sourceFile": "packages/registry/src/server/types.ts",
    "typeSymbol": "RegistryTaskEvent"
  }
}
