{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "key": {
      "type": "string",
      "pattern": "^[a-z][a-z0-9_-]{0,63}$"
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 64
    },
    "description": {
      "type": "string",
      "minLength": 1,
      "maxLength": 1024
    },
    "harness": {
      "type": "string",
      "pattern": "^[a-z][a-z0-9_-]{0,63}$"
    },
    "sandbox": {
      "type": "string",
      "pattern": "^[a-z][a-z0-9_-]{0,63}$"
    },
    "agentId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 64,
      "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
    },
    "initialPrompt": {
      "type": "string",
      "minLength": 1,
      "maxLength": 65536
    },
    "enabled": {
      "default": true,
      "type": "boolean"
    },
    "provider": {
      "type": "string",
      "const": "linear"
    },
    "concurrency": {
      "type": "object",
      "properties": {
        "scope": {
          "type": "string",
          "enum": [
            "repository",
            "subject"
          ]
        },
        "limit": {
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 100
        }
      },
      "required": [
        "scope",
        "limit"
      ],
      "additionalProperties": false
    },
    "linear": {
      "type": "object",
      "properties": {
        "connection": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9-]{0,63}$"
        },
        "event": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "const": "Issue"
                },
                "actions": {
                  "type": "array",
                  "prefixItems": [
                    {
                      "type": "string",
                      "enum": [
                        "create",
                        "update"
                      ]
                    }
                  ],
                  "items": false,
                  "minItems": 1,
                  "maxItems": 1
                }
              },
              "required": [
                "type",
                "actions"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "const": "Comment"
                },
                "actions": {
                  "type": "array",
                  "prefixItems": [
                    {
                      "type": "string",
                      "const": "create"
                    }
                  ],
                  "items": false,
                  "minItems": 1,
                  "maxItems": 1
                }
              },
              "required": [
                "type",
                "actions"
              ],
              "additionalProperties": false
            }
          ]
        },
        "teamIds": {
          "default": [],
          "maxItems": 50,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          }
        },
        "projectIds": {
          "default": [],
          "maxItems": 50,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          }
        },
        "stateIds": {
          "default": [],
          "maxItems": 50,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          }
        },
        "assigneeIds": {
          "default": [],
          "maxItems": 50,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          }
        },
        "creatorIds": {
          "default": [],
          "maxItems": 50,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          }
        },
        "issueIds": {
          "default": [],
          "maxItems": 50,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          }
        },
        "mentionedUserIds": {
          "default": [],
          "maxItems": 50,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          }
        },
        "issues": {
          "default": [],
          "maxItems": 50,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          }
        },
        "projects": {
          "default": [],
          "maxItems": 50,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          }
        },
        "states": {
          "default": [],
          "maxItems": 50,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          }
        },
        "teams": {
          "default": [],
          "maxItems": 50,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          }
        },
        "labels": {
          "default": [],
          "maxItems": 50,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          }
        },
        "keywords": {
          "default": [],
          "maxItems": 50,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          }
        },
        "assignee_ids": {
          "maxItems": 50,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          }
        },
        "creator_ids": {
          "maxItems": 50,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          }
        },
        "issue_ids": {
          "maxItems": 50,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          }
        },
        "project_ids": {
          "maxItems": 50,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          }
        },
        "state_ids": {
          "maxItems": 50,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          }
        },
        "team_ids": {
          "maxItems": 50,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          }
        },
        "mentioned_user_ids": {
          "maxItems": 50,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          }
        },
        "labelIds": {
          "default": [],
          "maxItems": 50,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          }
        },
        "labelOperator": {
          "default": "has_any",
          "type": "string",
          "enum": [
            "has_any",
            "has_all",
            "has_none"
          ]
        },
        "addedLabelIds": {
          "default": [],
          "maxItems": 50,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          }
        },
        "changedFields": {
          "default": [],
          "maxItems": 7,
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "stateId",
              "assigneeId",
              "labelIds",
              "projectId",
              "priority",
              "title",
              "description"
            ]
          }
        },
        "commands": {
          "default": [],
          "maxItems": 50,
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^\\/[a-zA-Z0-9_-]+$"
          }
        },
        "humanActorsOnly": {
          "default": false,
          "type": "boolean"
        },
        "actorIds": {
          "default": [],
          "maxItems": 50,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          }
        }
      },
      "required": [
        "connection",
        "event"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "key",
    "name",
    "harness",
    "sandbox",
    "agentId",
    "initialPrompt",
    "provider",
    "linear"
  ],
  "additionalProperties": false
}
