{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://github.com/multi-agent-ecosystem/multi-agent-pipeline/pipeline/schemas/stack-change.schema.json",
  "title": "Stack change",
  "description": "What POST /v1/stack returns (`stack-toggle.mjs set`). Step one: preview {stacks, changed, enabledPlugins, dropped} with confirmToken and expiresAt, nothing written. Step two: the written enabledPlugins, the keys that changed and written.",
  "type": "object",
  "additionalProperties": false,
  "required": ["contractVersion"],
  "properties": {
    "contractVersion": {
      "type": "string",
      "pattern": "^1\\.[0-9]+\\.[0-9]+$",
      "x-sensitivity": "none"
    },
    "preview": {
      "type": "object",
      "additionalProperties": false,
      "required": ["stacks", "changed", "enabledPlugins", "dropped"],
      "properties": {
        "stacks": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "changed": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "enabledPlugins": {
          "type": "object",
          "additionalProperties": {
            "type": "boolean"
          }
        },
        "dropped": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "confirmToken": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]{16,128}$"
    },
    "expiresAt": {
      "type": "string",
      "format": "date-time"
    },
    "stacks": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "enabledPlugins": {
      "type": "object",
      "additionalProperties": {
        "type": "boolean"
      }
    },
    "changed": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "dropped": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "written": {
      "type": "boolean"
    }
  }
}
