{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://agent-harness.local/discover/source-registry.schema.json",
  "type": "object",
  "additionalProperties": false,
  "required": ["schemaVersion", "sources"],
  "properties": {
    "$schema": {
      "type": "string"
    },
    "schemaVersion": {
      "type": "integer",
      "minimum": 1
    },
    "sources": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "name",
          "kind",
          "authorityTier",
          "hosts",
          "assetKinds",
          "discoveryMode",
          "priority",
          "enabled",
          "endpoints",
          "rules"
        ],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "name": {
            "type": "string",
            "minLength": 1
          },
          "kind": {
            "type": "string",
            "enum": [
              "repo",
              "docs",
              "marketplace",
              "registry",
              "package-registry",
              "local-manifest",
              "local-directory"
            ]
          },
          "authorityTier": {
            "type": "string",
            "enum": [
              "trusted-local",
              "official-first-party",
              "official-marketplace",
              "official-compatible",
              "trusted-community",
              "unverified-community"
            ]
          },
          "publisher": {
            "type": "object",
            "additionalProperties": false,
            "required": ["name"],
            "properties": {
              "name": {
                "type": "string"
              },
              "verified": {
                "type": "boolean"
              },
              "owner": {
                "type": "string"
              }
            }
          },
          "hosts": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string",
              "enum": [
                "copilot-vscode",
                "opencode",
                "shared",
                "cursor",
                "zed",
                "claude-code",
                "pi",
                "codex"
              ]
            }
          },
          "assetKinds": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string",
              "enum": [
                "skill",
                "plugin",
                "mcp-server",
                "agent",
                "instruction",
                "workflow",
                "hook",
                "extension",
                "prompt-pack",
                "reference-pack"
              ]
            }
          },
          "discoveryMode": {
            "type": "string",
            "enum": ["catalog", "seed"]
          },
          "priority": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "enabled": {
            "type": "boolean"
          },
          "endpoints": {
            "type": "object",
            "minProperties": 1,
            "additionalProperties": {
              "type": "string",
              "minLength": 1
            }
          },
          "includePaths": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "pattern": "\\S"
            }
          },
          "excludePaths": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "pattern": "\\S"
            }
          },
          "mcpServerPaths": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "pattern": "\\S"
            }
          },
          "rules": {
            "type": "object",
            "additionalProperties": false,
            "required": ["officialPreferred", "allowMirror", "allowInstall"],
            "properties": {
              "officialPreferred": {
                "type": "boolean"
              },
              "allowMirror": {
                "type": "boolean"
              },
              "allowInstall": {
                "type": "boolean"
              }
            }
          }
        }
      }
    }
  }
}
