{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://mosaicstack.dev/schemas/fleet/roster-v2.schema.json",
  "title": "Mosaic local tmux fleet roster v2",
  "type": "object",
  "additionalProperties": false,
  "required": ["version", "generation", "transport", "tmux", "defaults", "runtimes", "agents"],
  "properties": {
    "version": {
      "const": 2
    },
    "generation": {
      "type": "integer",
      "minimum": 1,
      "maximum": 9007199254740991
    },
    "transport": {
      "const": "tmux"
    },
    "tmux": {
      "type": "object",
      "additionalProperties": false,
      "required": ["socket_name", "holder_session"],
      "properties": {
        "socket_name": {
          "type": "string",
          "pattern": "^[A-Za-z0-9_.-]*$"
        },
        "holder_session": {
          "type": "string",
          "pattern": "^[A-Za-z0-9_.-]+$"
        }
      }
    },
    "defaults": {
      "type": "object",
      "additionalProperties": false,
      "required": ["working_directory", "runtime"],
      "properties": {
        "working_directory": {
          "type": "string",
          "minLength": 1
        },
        "runtime": {
          "enum": ["claude", "codex", "opencode", "pi"]
        }
      }
    },
    "runtimes": {
      "type": "object",
      "minProperties": 1,
      "propertyNames": {
        "enum": ["claude", "codex", "opencode", "pi"]
      },
      "additionalProperties": {
        "type": "object",
        "additionalProperties": false,
        "required": ["reset_command"],
        "properties": {
          "reset_command": {
            "type": "string",
            "minLength": 1
          }
        }
      }
    },
    "agents": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "alias",
          "class",
          "runtime",
          "provider",
          "model",
          "reasoning",
          "tool_policy",
          "working_directory",
          "persistent_persona",
          "reset_between_tasks",
          "lifecycle",
          "launch"
        ],
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[A-Za-z0-9][A-Za-z0-9_.-]*$"
          },
          "alias": {
            "type": "string",
            "minLength": 1
          },
          "class": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "runtime": {
            "enum": ["claude", "codex", "opencode", "pi"]
          },
          "provider": {
            "type": "string",
            "minLength": 1
          },
          "model": {
            "type": "string",
            "minLength": 1
          },
          "reasoning": {
            "enum": ["low", "medium", "high"]
          },
          "tool_policy": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "working_directory": {
            "type": "string",
            "minLength": 1
          },
          "persistent_persona": {
            "type": "boolean"
          },
          "reset_between_tasks": {
            "type": "boolean"
          },
          "lifecycle": {
            "type": "object",
            "additionalProperties": false,
            "required": ["enabled", "desired_state"],
            "properties": {
              "enabled": {
                "type": "boolean"
              },
              "desired_state": {
                "enum": ["running", "stopped"]
              }
            }
          },
          "launch": {
            "type": "object",
            "additionalProperties": false,
            "required": ["yolo"],
            "properties": {
              "yolo": {
                "type": "boolean"
              }
            }
          }
        }
      }
    }
  }
}
