{
  "$id": "https://sessionpipe.org/schema/v1/control-pair.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "poll_key": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]{22,128}$"
    },
    "machine": {
      "type": "string",
      "pattern": "^m_[A-Za-z0-9_-]{16,40}$"
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 80
    },
    "harnesses": {
      "maxItems": 20,
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^[a-z][a-z0-9-]{0,39}$"
      }
    },
    "modes": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "sdk",
          "waiter",
          "turn",
          "inbox",
          "api",
          "resume",
          "fork"
        ]
      }
    },
    "version": {
      "type": "string",
      "maxLength": 40
    },
    "folders": {
      "maxItems": 50,
      "type": "array",
      "items": {
        "type": "string",
        "maxLength": 1024
      }
    },
    "mode": {
      "type": "string",
      "enum": [
        "safe",
        "auto",
        "inherit"
      ]
    },
    "accounts": {
      "maxItems": 20,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "harness": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,39}$"
          },
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "email": {
            "type": "string",
            "maxLength": 254
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "signed_in": {
            "type": "boolean"
          }
        },
        "required": [
          "harness",
          "id"
        ]
      }
    },
    "files": {
      "type": "boolean"
    },
    "key_types": {
      "minItems": 1,
      "maxItems": 2,
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "passkey",
          "device"
        ]
      }
    },
    "ask": {
      "type": "boolean"
    },
    "handoff": {
      "type": "boolean"
    }
  },
  "required": [
    "name",
    "harnesses",
    "modes",
    "version"
  ]
}
