{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:marketplace:source-release:v1",
  "title": "Tongyuan Agent Plugin source release index",
  "type": "object",
  "additionalProperties": false,
  "required": ["schema_version", "name", "version", "repository_url", "commit", "artifacts"],
  "properties": {
    "schema_version": {
      "const": "marketplace.source-release/v1"
    },
    "name": {
      "type": "string",
      "maxLength": 127,
      "pattern": "^[a-z][a-z0-9]*(-[a-z0-9]+)*/[a-z][a-z0-9]*(-[a-z0-9]+)*$"
    },
    "version": {
      "type": "string",
      "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(?:-[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?(?:\\+[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?$"
    },
    "repository_url": {
      "type": "string",
      "pattern": "^https://"
    },
    "commit": {
      "type": "string",
      "pattern": "^(?:[0-9a-f]{40}|[0-9a-f]{64})$"
    },
    "artifacts": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["platform", "url", "format", "sha256", "size"],
        "properties": {
          "platform": {
            "type": "object",
            "additionalProperties": false,
            "required": ["os", "arch"],
            "properties": {
              "os": {
                "type": "string",
                "pattern": "^(?!generic$)[a-z0-9][a-z0-9._]{0,31}$"
              },
              "arch": {
                "type": "string",
                "pattern": "^(?!generic$)[a-z0-9][a-z0-9._]{0,31}$"
              }
            }
          },
          "url": {
            "type": "string",
            "pattern": "^https://"
          },
          "format": {
            "const": "tar.gz"
          },
          "sha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "size": {
            "type": "integer",
            "minimum": 1,
            "maximum": 536870912
          }
        }
      }
    }
  }
}
