{
  "$id": "https://comitiva.dev/schema/RunnerRequest.json",
  "title": "RunnerRequest",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "oneOf": [
    {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1
        },
        "type": {
          "type": "string",
          "const": "ping"
        }
      },
      "required": [
        "id",
        "type"
      ]
    },
    {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1
        },
        "type": {
          "type": "string",
          "const": "connection.test"
        },
        "connection": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1
                },
                "name": {
                  "type": "string",
                  "minLength": 1
                },
                "secretRef": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "enabled": {
                  "type": "boolean"
                },
                "createdAt": {
                  "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)))$"
                },
                "updatedAt": {
                  "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": "api"
                },
                "provider": {
                  "type": "string",
                  "const": "anthropic"
                },
                "config": {
                  "type": "object",
                  "properties": {
                    "baseUrl": {
                      "type": "string",
                      "format": "uri"
                    },
                    "defaultModel": {
                      "type": "string"
                    }
                  }
                }
              },
              "required": [
                "id",
                "name",
                "secretRef",
                "enabled",
                "createdAt",
                "updatedAt",
                "kind",
                "provider",
                "config"
              ]
            },
            {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1
                },
                "name": {
                  "type": "string",
                  "minLength": 1
                },
                "secretRef": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "enabled": {
                  "type": "boolean"
                },
                "createdAt": {
                  "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)))$"
                },
                "updatedAt": {
                  "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": "api"
                },
                "provider": {
                  "type": "string",
                  "const": "openai-compatible"
                },
                "config": {
                  "type": "object",
                  "properties": {
                    "baseUrl": {
                      "type": "string",
                      "format": "uri"
                    },
                    "preset": {
                      "type": "string",
                      "enum": [
                        "openai",
                        "openrouter",
                        "groq",
                        "lmstudio",
                        "custom"
                      ]
                    },
                    "defaultModel": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "baseUrl"
                  ]
                }
              },
              "required": [
                "id",
                "name",
                "secretRef",
                "enabled",
                "createdAt",
                "updatedAt",
                "kind",
                "provider",
                "config"
              ]
            },
            {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1
                },
                "name": {
                  "type": "string",
                  "minLength": 1
                },
                "secretRef": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "enabled": {
                  "type": "boolean"
                },
                "createdAt": {
                  "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)))$"
                },
                "updatedAt": {
                  "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": "api"
                },
                "provider": {
                  "type": "string",
                  "const": "google"
                },
                "config": {
                  "type": "object",
                  "properties": {
                    "baseUrl": {
                      "type": "string",
                      "format": "uri"
                    },
                    "defaultModel": {
                      "type": "string"
                    }
                  }
                }
              },
              "required": [
                "id",
                "name",
                "secretRef",
                "enabled",
                "createdAt",
                "updatedAt",
                "kind",
                "provider",
                "config"
              ]
            },
            {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1
                },
                "name": {
                  "type": "string",
                  "minLength": 1
                },
                "secretRef": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "enabled": {
                  "type": "boolean"
                },
                "createdAt": {
                  "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)))$"
                },
                "updatedAt": {
                  "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": "api"
                },
                "provider": {
                  "type": "string",
                  "const": "ollama"
                },
                "config": {
                  "type": "object",
                  "properties": {
                    "baseUrl": {
                      "default": "http://localhost:11434",
                      "type": "string",
                      "format": "uri"
                    },
                    "defaultModel": {
                      "type": "string"
                    }
                  }
                }
              },
              "required": [
                "id",
                "name",
                "secretRef",
                "enabled",
                "createdAt",
                "updatedAt",
                "kind",
                "provider",
                "config"
              ]
            },
            {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1
                },
                "name": {
                  "type": "string",
                  "minLength": 1
                },
                "secretRef": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "enabled": {
                  "type": "boolean"
                },
                "createdAt": {
                  "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)))$"
                },
                "updatedAt": {
                  "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": "cli"
                },
                "provider": {
                  "type": "string",
                  "const": "claude-code"
                },
                "config": {
                  "type": "object",
                  "properties": {
                    "binaryPath": {
                      "type": "string"
                    },
                    "extraArgs": {
                      "default": [],
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "defaultModel": {
                      "type": "string"
                    },
                    "workingDirectory": {
                      "type": "string"
                    }
                  }
                }
              },
              "required": [
                "id",
                "name",
                "secretRef",
                "enabled",
                "createdAt",
                "updatedAt",
                "kind",
                "provider",
                "config"
              ]
            },
            {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1
                },
                "name": {
                  "type": "string",
                  "minLength": 1
                },
                "secretRef": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "enabled": {
                  "type": "boolean"
                },
                "createdAt": {
                  "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)))$"
                },
                "updatedAt": {
                  "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": "cli"
                },
                "provider": {
                  "type": "string",
                  "const": "codex"
                },
                "config": {
                  "type": "object",
                  "properties": {
                    "binaryPath": {
                      "type": "string"
                    },
                    "extraArgs": {
                      "default": [],
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "defaultModel": {
                      "type": "string"
                    },
                    "workingDirectory": {
                      "type": "string"
                    },
                    "sandbox": {
                      "default": "workspace-write",
                      "type": "string",
                      "enum": [
                        "read-only",
                        "workspace-write",
                        "danger-full-access"
                      ]
                    }
                  }
                }
              },
              "required": [
                "id",
                "name",
                "secretRef",
                "enabled",
                "createdAt",
                "updatedAt",
                "kind",
                "provider",
                "config"
              ]
            },
            {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1
                },
                "name": {
                  "type": "string",
                  "minLength": 1
                },
                "secretRef": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "enabled": {
                  "type": "boolean"
                },
                "createdAt": {
                  "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)))$"
                },
                "updatedAt": {
                  "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": "cli"
                },
                "provider": {
                  "type": "string",
                  "const": "gemini-cli"
                },
                "config": {
                  "type": "object",
                  "properties": {
                    "binaryPath": {
                      "type": "string"
                    },
                    "extraArgs": {
                      "default": [],
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "defaultModel": {
                      "type": "string"
                    },
                    "workingDirectory": {
                      "type": "string"
                    }
                  }
                }
              },
              "required": [
                "id",
                "name",
                "secretRef",
                "enabled",
                "createdAt",
                "updatedAt",
                "kind",
                "provider",
                "config"
              ]
            }
          ]
        },
        "secret": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "type",
        "connection"
      ]
    },
    {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1
        },
        "type": {
          "type": "string",
          "const": "connection.listModels"
        },
        "connection": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1
                },
                "name": {
                  "type": "string",
                  "minLength": 1
                },
                "secretRef": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "enabled": {
                  "type": "boolean"
                },
                "createdAt": {
                  "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)))$"
                },
                "updatedAt": {
                  "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": "api"
                },
                "provider": {
                  "type": "string",
                  "const": "anthropic"
                },
                "config": {
                  "type": "object",
                  "properties": {
                    "baseUrl": {
                      "type": "string",
                      "format": "uri"
                    },
                    "defaultModel": {
                      "type": "string"
                    }
                  }
                }
              },
              "required": [
                "id",
                "name",
                "secretRef",
                "enabled",
                "createdAt",
                "updatedAt",
                "kind",
                "provider",
                "config"
              ]
            },
            {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1
                },
                "name": {
                  "type": "string",
                  "minLength": 1
                },
                "secretRef": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "enabled": {
                  "type": "boolean"
                },
                "createdAt": {
                  "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)))$"
                },
                "updatedAt": {
                  "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": "api"
                },
                "provider": {
                  "type": "string",
                  "const": "openai-compatible"
                },
                "config": {
                  "type": "object",
                  "properties": {
                    "baseUrl": {
                      "type": "string",
                      "format": "uri"
                    },
                    "preset": {
                      "type": "string",
                      "enum": [
                        "openai",
                        "openrouter",
                        "groq",
                        "lmstudio",
                        "custom"
                      ]
                    },
                    "defaultModel": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "baseUrl"
                  ]
                }
              },
              "required": [
                "id",
                "name",
                "secretRef",
                "enabled",
                "createdAt",
                "updatedAt",
                "kind",
                "provider",
                "config"
              ]
            },
            {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1
                },
                "name": {
                  "type": "string",
                  "minLength": 1
                },
                "secretRef": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "enabled": {
                  "type": "boolean"
                },
                "createdAt": {
                  "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)))$"
                },
                "updatedAt": {
                  "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": "api"
                },
                "provider": {
                  "type": "string",
                  "const": "google"
                },
                "config": {
                  "type": "object",
                  "properties": {
                    "baseUrl": {
                      "type": "string",
                      "format": "uri"
                    },
                    "defaultModel": {
                      "type": "string"
                    }
                  }
                }
              },
              "required": [
                "id",
                "name",
                "secretRef",
                "enabled",
                "createdAt",
                "updatedAt",
                "kind",
                "provider",
                "config"
              ]
            },
            {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1
                },
                "name": {
                  "type": "string",
                  "minLength": 1
                },
                "secretRef": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "enabled": {
                  "type": "boolean"
                },
                "createdAt": {
                  "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)))$"
                },
                "updatedAt": {
                  "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": "api"
                },
                "provider": {
                  "type": "string",
                  "const": "ollama"
                },
                "config": {
                  "type": "object",
                  "properties": {
                    "baseUrl": {
                      "default": "http://localhost:11434",
                      "type": "string",
                      "format": "uri"
                    },
                    "defaultModel": {
                      "type": "string"
                    }
                  }
                }
              },
              "required": [
                "id",
                "name",
                "secretRef",
                "enabled",
                "createdAt",
                "updatedAt",
                "kind",
                "provider",
                "config"
              ]
            },
            {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1
                },
                "name": {
                  "type": "string",
                  "minLength": 1
                },
                "secretRef": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "enabled": {
                  "type": "boolean"
                },
                "createdAt": {
                  "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)))$"
                },
                "updatedAt": {
                  "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": "cli"
                },
                "provider": {
                  "type": "string",
                  "const": "claude-code"
                },
                "config": {
                  "type": "object",
                  "properties": {
                    "binaryPath": {
                      "type": "string"
                    },
                    "extraArgs": {
                      "default": [],
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "defaultModel": {
                      "type": "string"
                    },
                    "workingDirectory": {
                      "type": "string"
                    }
                  }
                }
              },
              "required": [
                "id",
                "name",
                "secretRef",
                "enabled",
                "createdAt",
                "updatedAt",
                "kind",
                "provider",
                "config"
              ]
            },
            {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1
                },
                "name": {
                  "type": "string",
                  "minLength": 1
                },
                "secretRef": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "enabled": {
                  "type": "boolean"
                },
                "createdAt": {
                  "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)))$"
                },
                "updatedAt": {
                  "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": "cli"
                },
                "provider": {
                  "type": "string",
                  "const": "codex"
                },
                "config": {
                  "type": "object",
                  "properties": {
                    "binaryPath": {
                      "type": "string"
                    },
                    "extraArgs": {
                      "default": [],
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "defaultModel": {
                      "type": "string"
                    },
                    "workingDirectory": {
                      "type": "string"
                    },
                    "sandbox": {
                      "default": "workspace-write",
                      "type": "string",
                      "enum": [
                        "read-only",
                        "workspace-write",
                        "danger-full-access"
                      ]
                    }
                  }
                }
              },
              "required": [
                "id",
                "name",
                "secretRef",
                "enabled",
                "createdAt",
                "updatedAt",
                "kind",
                "provider",
                "config"
              ]
            },
            {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1
                },
                "name": {
                  "type": "string",
                  "minLength": 1
                },
                "secretRef": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "enabled": {
                  "type": "boolean"
                },
                "createdAt": {
                  "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)))$"
                },
                "updatedAt": {
                  "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": "cli"
                },
                "provider": {
                  "type": "string",
                  "const": "gemini-cli"
                },
                "config": {
                  "type": "object",
                  "properties": {
                    "binaryPath": {
                      "type": "string"
                    },
                    "extraArgs": {
                      "default": [],
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "defaultModel": {
                      "type": "string"
                    },
                    "workingDirectory": {
                      "type": "string"
                    }
                  }
                }
              },
              "required": [
                "id",
                "name",
                "secretRef",
                "enabled",
                "createdAt",
                "updatedAt",
                "kind",
                "provider",
                "config"
              ]
            }
          ]
        },
        "secret": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "type",
        "connection"
      ]
    },
    {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1
        },
        "type": {
          "type": "string",
          "const": "cli.detect"
        },
        "provider": {
          "type": "string",
          "enum": [
            "anthropic",
            "openai-compatible",
            "google",
            "ollama",
            "claude-code",
            "codex",
            "gemini-cli"
          ]
        },
        "binaryPath": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "type",
        "provider"
      ]
    },
    {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1
        },
        "type": {
          "type": "string",
          "const": "toolServer.start"
        },
        "toolServer": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1
                },
                "name": {
                  "type": "string",
                  "minLength": 1
                },
                "transport": {
                  "type": "string",
                  "const": "stdio"
                },
                "command": {
                  "type": "string",
                  "minLength": 1
                },
                "args": {
                  "default": [],
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "env": {
                  "default": {},
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "type": "string"
                  }
                },
                "builtin": {
                  "type": "string",
                  "enum": [
                    "filesystem",
                    "google-drive"
                  ]
                }
              },
              "required": [
                "id",
                "name",
                "transport",
                "command"
              ]
            },
            {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1
                },
                "name": {
                  "type": "string",
                  "minLength": 1
                },
                "transport": {
                  "type": "string",
                  "const": "http"
                },
                "url": {
                  "type": "string",
                  "format": "uri"
                },
                "headers": {
                  "default": {},
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "type": "string"
                  }
                }
              },
              "required": [
                "id",
                "name",
                "transport",
                "url"
              ]
            }
          ]
        },
        "roots": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "path": {
                "type": "string",
                "minLength": 1
              },
              "mode": {
                "type": "string",
                "enum": [
                  "read",
                  "readwrite"
                ]
              }
            },
            "required": [
              "path",
              "mode"
            ]
          }
        }
      },
      "required": [
        "id",
        "type",
        "toolServer"
      ]
    },
    {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1
        },
        "type": {
          "type": "string",
          "const": "toolServer.stop"
        },
        "toolServerId": {
          "type": "string",
          "minLength": 1
        }
      },
      "required": [
        "id",
        "type",
        "toolServerId"
      ]
    },
    {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1
        },
        "type": {
          "type": "string",
          "const": "run.start"
        },
        "runId": {
          "type": "string",
          "minLength": 1
        },
        "conversationId": {
          "type": "string",
          "minLength": 1
        },
        "agent": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "minLength": 1
            },
            "name": {
              "type": "string",
              "minLength": 1
            },
            "avatar": {
              "type": "object",
              "properties": {
                "color": {
                  "type": "string",
                  "enum": [
                    "indigo",
                    "violet",
                    "pink",
                    "rose",
                    "orange",
                    "amber",
                    "emerald",
                    "teal",
                    "sky",
                    "slate"
                  ]
                },
                "emoji": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 16
                }
              },
              "required": [
                "color"
              ]
            },
            "connectionId": {
              "type": "string",
              "minLength": 1
            },
            "model": {
              "type": [
                "string",
                "null"
              ]
            },
            "role": {
              "type": "string"
            },
            "params": {
              "type": "object",
              "properties": {
                "temperature": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 2
                },
                "maxTokens": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991
                },
                "topP": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 1
                },
                "maxToolIterations": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 200
                }
              }
            },
            "toolServerIds": {
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              }
            },
            "roots": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "path": {
                    "type": "string",
                    "minLength": 1
                  },
                  "mode": {
                    "type": "string",
                    "enum": [
                      "read",
                      "readwrite"
                    ]
                  }
                },
                "required": [
                  "path",
                  "mode"
                ]
              }
            },
            "permissionPolicy": {
              "type": "string",
              "enum": [
                "ask",
                "allow-writes",
                "read-only"
              ]
            },
            "fallbackConnectionIds": {
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              }
            },
            "tags": {
              "maxItems": 20,
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1,
                "maxLength": 32
              }
            },
            "createdAt": {
              "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)))$"
            },
            "updatedAt": {
              "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": [
            "id",
            "name",
            "avatar",
            "connectionId",
            "model",
            "role",
            "params",
            "toolServerIds",
            "roots",
            "permissionPolicy",
            "fallbackConnectionIds",
            "tags",
            "createdAt",
            "updatedAt"
          ]
        },
        "connection": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1
                },
                "name": {
                  "type": "string",
                  "minLength": 1
                },
                "secretRef": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "enabled": {
                  "type": "boolean"
                },
                "createdAt": {
                  "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)))$"
                },
                "updatedAt": {
                  "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": "api"
                },
                "provider": {
                  "type": "string",
                  "const": "anthropic"
                },
                "config": {
                  "type": "object",
                  "properties": {
                    "baseUrl": {
                      "type": "string",
                      "format": "uri"
                    },
                    "defaultModel": {
                      "type": "string"
                    }
                  }
                }
              },
              "required": [
                "id",
                "name",
                "secretRef",
                "enabled",
                "createdAt",
                "updatedAt",
                "kind",
                "provider",
                "config"
              ]
            },
            {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1
                },
                "name": {
                  "type": "string",
                  "minLength": 1
                },
                "secretRef": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "enabled": {
                  "type": "boolean"
                },
                "createdAt": {
                  "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)))$"
                },
                "updatedAt": {
                  "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": "api"
                },
                "provider": {
                  "type": "string",
                  "const": "openai-compatible"
                },
                "config": {
                  "type": "object",
                  "properties": {
                    "baseUrl": {
                      "type": "string",
                      "format": "uri"
                    },
                    "preset": {
                      "type": "string",
                      "enum": [
                        "openai",
                        "openrouter",
                        "groq",
                        "lmstudio",
                        "custom"
                      ]
                    },
                    "defaultModel": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "baseUrl"
                  ]
                }
              },
              "required": [
                "id",
                "name",
                "secretRef",
                "enabled",
                "createdAt",
                "updatedAt",
                "kind",
                "provider",
                "config"
              ]
            },
            {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1
                },
                "name": {
                  "type": "string",
                  "minLength": 1
                },
                "secretRef": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "enabled": {
                  "type": "boolean"
                },
                "createdAt": {
                  "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)))$"
                },
                "updatedAt": {
                  "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": "api"
                },
                "provider": {
                  "type": "string",
                  "const": "google"
                },
                "config": {
                  "type": "object",
                  "properties": {
                    "baseUrl": {
                      "type": "string",
                      "format": "uri"
                    },
                    "defaultModel": {
                      "type": "string"
                    }
                  }
                }
              },
              "required": [
                "id",
                "name",
                "secretRef",
                "enabled",
                "createdAt",
                "updatedAt",
                "kind",
                "provider",
                "config"
              ]
            },
            {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1
                },
                "name": {
                  "type": "string",
                  "minLength": 1
                },
                "secretRef": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "enabled": {
                  "type": "boolean"
                },
                "createdAt": {
                  "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)))$"
                },
                "updatedAt": {
                  "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": "api"
                },
                "provider": {
                  "type": "string",
                  "const": "ollama"
                },
                "config": {
                  "type": "object",
                  "properties": {
                    "baseUrl": {
                      "default": "http://localhost:11434",
                      "type": "string",
                      "format": "uri"
                    },
                    "defaultModel": {
                      "type": "string"
                    }
                  }
                }
              },
              "required": [
                "id",
                "name",
                "secretRef",
                "enabled",
                "createdAt",
                "updatedAt",
                "kind",
                "provider",
                "config"
              ]
            },
            {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1
                },
                "name": {
                  "type": "string",
                  "minLength": 1
                },
                "secretRef": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "enabled": {
                  "type": "boolean"
                },
                "createdAt": {
                  "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)))$"
                },
                "updatedAt": {
                  "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": "cli"
                },
                "provider": {
                  "type": "string",
                  "const": "claude-code"
                },
                "config": {
                  "type": "object",
                  "properties": {
                    "binaryPath": {
                      "type": "string"
                    },
                    "extraArgs": {
                      "default": [],
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "defaultModel": {
                      "type": "string"
                    },
                    "workingDirectory": {
                      "type": "string"
                    }
                  }
                }
              },
              "required": [
                "id",
                "name",
                "secretRef",
                "enabled",
                "createdAt",
                "updatedAt",
                "kind",
                "provider",
                "config"
              ]
            },
            {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1
                },
                "name": {
                  "type": "string",
                  "minLength": 1
                },
                "secretRef": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "enabled": {
                  "type": "boolean"
                },
                "createdAt": {
                  "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)))$"
                },
                "updatedAt": {
                  "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": "cli"
                },
                "provider": {
                  "type": "string",
                  "const": "codex"
                },
                "config": {
                  "type": "object",
                  "properties": {
                    "binaryPath": {
                      "type": "string"
                    },
                    "extraArgs": {
                      "default": [],
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "defaultModel": {
                      "type": "string"
                    },
                    "workingDirectory": {
                      "type": "string"
                    },
                    "sandbox": {
                      "default": "workspace-write",
                      "type": "string",
                      "enum": [
                        "read-only",
                        "workspace-write",
                        "danger-full-access"
                      ]
                    }
                  }
                }
              },
              "required": [
                "id",
                "name",
                "secretRef",
                "enabled",
                "createdAt",
                "updatedAt",
                "kind",
                "provider",
                "config"
              ]
            },
            {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1
                },
                "name": {
                  "type": "string",
                  "minLength": 1
                },
                "secretRef": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "enabled": {
                  "type": "boolean"
                },
                "createdAt": {
                  "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)))$"
                },
                "updatedAt": {
                  "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": "cli"
                },
                "provider": {
                  "type": "string",
                  "const": "gemini-cli"
                },
                "config": {
                  "type": "object",
                  "properties": {
                    "binaryPath": {
                      "type": "string"
                    },
                    "extraArgs": {
                      "default": [],
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "defaultModel": {
                      "type": "string"
                    },
                    "workingDirectory": {
                      "type": "string"
                    }
                  }
                }
              },
              "required": [
                "id",
                "name",
                "secretRef",
                "enabled",
                "createdAt",
                "updatedAt",
                "kind",
                "provider",
                "config"
              ]
            }
          ]
        },
        "secret": {
          "type": "string"
        },
        "messages": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1
              },
              "conversationId": {
                "type": "string",
                "minLength": 1
              },
              "role": {
                "type": "string",
                "enum": [
                  "user",
                  "assistant",
                  "tool"
                ]
              },
              "content": {
                "type": "array",
                "items": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "text"
                        },
                        "text": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "type",
                        "text"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "image"
                        },
                        "source": {
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "base64"
                                },
                                "mediaType": {
                                  "type": "string"
                                },
                                "data": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "kind",
                                "mediaType",
                                "data"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "file"
                                },
                                "path": {
                                  "type": "string"
                                },
                                "mediaType": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "kind",
                                "path"
                              ]
                            }
                          ]
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "type",
                        "source"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "document"
                        },
                        "name": {
                          "type": "string"
                        },
                        "mediaType": {
                          "type": "string"
                        },
                        "source": {
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "base64"
                                },
                                "mediaType": {
                                  "type": "string"
                                },
                                "data": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "kind",
                                "mediaType",
                                "data"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "file"
                                },
                                "path": {
                                  "type": "string"
                                },
                                "mediaType": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "kind",
                                "path"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "type",
                        "name",
                        "mediaType",
                        "source"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "tool_use"
                        },
                        "id": {
                          "type": "string"
                        },
                        "toolServerId": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "input": {},
                        "signature": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "type",
                        "id",
                        "toolServerId",
                        "name",
                        "input"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "tool_result"
                        },
                        "toolUseId": {
                          "type": "string"
                        },
                        "content": {
                          "type": "array",
                          "items": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "text"
                                  },
                                  "text": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "type",
                                  "text"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "image"
                                  },
                                  "source": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "base64"
                                          },
                                          "mediaType": {
                                            "type": "string"
                                          },
                                          "data": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "mediaType",
                                          "data"
                                        ]
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "file"
                                          },
                                          "path": {
                                            "type": "string"
                                          },
                                          "mediaType": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "path"
                                        ]
                                      }
                                    ]
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "type",
                                  "source"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "document"
                                  },
                                  "name": {
                                    "type": "string"
                                  },
                                  "mediaType": {
                                    "type": "string"
                                  },
                                  "source": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "base64"
                                          },
                                          "mediaType": {
                                            "type": "string"
                                          },
                                          "data": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "mediaType",
                                          "data"
                                        ]
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "file"
                                          },
                                          "path": {
                                            "type": "string"
                                          },
                                          "mediaType": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "path"
                                        ]
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "type",
                                  "name",
                                  "mediaType",
                                  "source"
                                ]
                              }
                            ]
                          }
                        },
                        "isError": {
                          "type": "boolean"
                        },
                        "durationMs": {
                          "type": "number",
                          "minimum": 0
                        }
                      },
                      "required": [
                        "type",
                        "toolUseId",
                        "content",
                        "isError"
                      ]
                    }
                  ]
                }
              },
              "status": {
                "type": "string",
                "enum": [
                  "streaming",
                  "complete",
                  "cancelled",
                  "error"
                ]
              },
              "seq": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "createdAt": {
                "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)))$"
              },
              "error": {
                "default": null,
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "code": {
                        "type": "string",
                        "enum": [
                          "auth_failed",
                          "rate_limited",
                          "provider_unavailable",
                          "provider_error",
                          "binary_not_found",
                          "not_logged_in",
                          "sandbox_unavailable",
                          "outside_roots",
                          "read_only_root",
                          "approval_denied",
                          "tool_failed",
                          "tool_server_failed",
                          "invalid_request",
                          "not_implemented",
                          "unknown_provider",
                          "not_found",
                          "unsupported_content",
                          "attachment_too_large",
                          "unsupported_attachment",
                          "attachment_too_many",
                          "update_failed",
                          "connection_in_use",
                          "connection_disabled",
                          "model_required",
                          "secret_missing",
                          "secret_store_unavailable",
                          "oauth_not_configured",
                          "oauth_failed",
                          "oauth_cancelled",
                          "google_not_connected",
                          "google_reconnect_required",
                          "runner_crashed",
                          "runner_unavailable",
                          "conversation_busy",
                          "interrupted",
                          "timeout",
                          "internal"
                        ]
                      },
                      "message": {
                        "type": "string"
                      },
                      "retryable": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "code",
                      "message",
                      "retryable"
                    ]
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "id",
              "conversationId",
              "role",
              "content",
              "status",
              "seq",
              "createdAt"
            ]
          }
        },
        "harnessSessionId": {
          "type": "string"
        },
        "workingDirectory": {
          "type": "string"
        },
        "alwaysAllowed": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "toolServers": {
          "type": "array",
          "items": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1
                  },
                  "transport": {
                    "type": "string",
                    "const": "stdio"
                  },
                  "command": {
                    "type": "string",
                    "minLength": 1
                  },
                  "args": {
                    "default": [],
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "env": {
                    "default": {},
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "type": "string"
                    }
                  },
                  "builtin": {
                    "type": "string",
                    "enum": [
                      "filesystem",
                      "google-drive"
                    ]
                  }
                },
                "required": [
                  "id",
                  "name",
                  "transport",
                  "command"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1
                  },
                  "transport": {
                    "type": "string",
                    "const": "http"
                  },
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "headers": {
                    "default": {},
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "id",
                  "name",
                  "transport",
                  "url"
                ]
              }
            ]
          }
        }
      },
      "required": [
        "id",
        "type",
        "runId",
        "conversationId",
        "agent",
        "connection",
        "messages"
      ]
    },
    {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1
        },
        "type": {
          "type": "string",
          "const": "run.cancel"
        },
        "runId": {
          "type": "string",
          "minLength": 1
        }
      },
      "required": [
        "id",
        "type",
        "runId"
      ]
    },
    {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1
        },
        "type": {
          "type": "string",
          "const": "run.approval"
        },
        "runId": {
          "type": "string",
          "minLength": 1
        },
        "toolUseId": {
          "type": "string"
        },
        "decision": {
          "type": "string",
          "enum": [
            "allow",
            "deny",
            "allow-always"
          ]
        }
      },
      "required": [
        "id",
        "type",
        "runId",
        "toolUseId",
        "decision"
      ]
    },
    {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1
        },
        "type": {
          "type": "string",
          "const": "shutdown"
        }
      },
      "required": [
        "id",
        "type"
      ]
    }
  ]
}
