{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "schemaVersion": {
      "type": "string",
      "const": "hay.app/1"
    },
    "id": {
      "type": "string",
      "maxLength": 80,
      "pattern": "^[a-z][a-z0-9]*(?:[.-][a-z0-9]+)+$"
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 80
    },
    "version": {
      "type": "string",
      "pattern": "^\\d+\\.\\d+\\.\\d+$"
    },
    "description": {
      "type": "string",
      "minLength": 1,
      "maxLength": 500
    },
    "author": {
      "type": "string",
      "minLength": 1,
      "maxLength": 100
    },
    "entrypoint": {
      "type": "string",
      "const": "index.html"
    },
    "icon": {
      "type": "string",
      "maxLength": 40
    },
    "color": {
      "type": "string",
      "pattern": "^#[0-9a-fA-F]{6}$"
    },
    "capabilities": {
      "maxItems": 10,
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "storage",
          "files.read",
          "models.invoke",
          "browser.read",
          "github.read",
          "github.private.read",
          "coding.read",
          "coding.run",
          "coding.commit",
          "browser.control"
        ]
      }
    },
    "views": {
      "minItems": 1,
      "maxItems": 12,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 60,
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "description": {
            "type": "string",
            "maxLength": 250
          }
        },
        "required": [
          "id",
          "title",
          "description"
        ],
        "additionalProperties": false
      }
    },
    "intents": {
      "maxItems": 16,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 60,
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "prompt": {
            "type": "string",
            "maxLength": 2000
          },
          "viewId": {
            "type": "string",
            "maxLength": 60
          }
        },
        "required": [
          "id",
          "label",
          "prompt",
          "viewId"
        ],
        "additionalProperties": false
      }
    },
    "defaultTask": {
      "type": "object",
      "properties": {
        "title": {
          "type": "string",
          "minLength": 1,
          "maxLength": 150
        },
        "viewId": {
          "type": "string",
          "maxLength": 60
        }
      },
      "required": [
        "title"
      ],
      "additionalProperties": false
    },
    "agent": {
      "type": "object",
      "properties": {
        "instructions": {
          "type": "string",
          "minLength": 1,
          "maxLength": 6000
        }
      },
      "required": [
        "instructions"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "schemaVersion",
    "id",
    "name",
    "version",
    "description",
    "author",
    "entrypoint",
    "icon",
    "color",
    "capabilities",
    "views",
    "intents"
  ],
  "additionalProperties": false
}
