{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://raw.githubusercontent.com/Kanevry/session-orchestrator/main/.orchestrator/policy/ecosystem.schema.json",
  "title": "Session-Orchestrator Ecosystem Health Policy",
  "description": "Ecosystem health configuration: service endpoints, CI pipelines, and critical issue labels. Consumed by the ecosystem-health skill during session-start. Generated by /bootstrap --ecosystem-health. See issue #188.",
  "type": "object",
  "required": ["version"],
  "additionalProperties": false,
  "properties": {
    "version": { "const": 1 },
    "rationale": { "type": "string" },
    "endpoints": {
      "type": "array",
      "description": "Service health endpoints to probe during ecosystem-health checks.",
      "items": { "$ref": "#/$defs/endpoint" },
      "default": []
    },
    "pipelines": {
      "type": "array",
      "description": "CI pipeline identifiers to query for status.",
      "items": { "$ref": "#/$defs/pipeline" },
      "default": []
    },
    "criticalIssueLabels": {
      "type": "array",
      "description": "Issue labels that classify an issue as critical across cross-repos.",
      "items": { "type": "string", "minLength": 1 },
      "default": []
    }
  },
  "$defs": {
    "endpoint": {
      "type": "object",
      "required": ["name", "url"],
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1,
          "description": "Human-readable display name for the service."
        },
        "url": {
          "type": "string",
          "minLength": 1,
          "description": "URL to probe (curl -sf). Should return HTTP 2xx when healthy."
        }
      }
    },
    "pipeline": {
      "type": "object",
      "required": ["id"],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1,
          "description": "CI pipeline identifier. For GitLab: branch name or pipeline ID. For GitHub: workflow file name."
        },
        "label": {
          "type": "string",
          "description": "Optional display label shown in the health dashboard."
        }
      }
    }
  }
}
