{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://weverlabs.com/schemas/agent-queue-heartbeat.schema.json",
  "title": "Agent Queue Heartbeat",
  "description": "Heartbeat record emitted by Wever Labs OS queue and scheduler runtime.",
  "type": "object",
  "required": [
    "object_type",
    "heartbeat_id",
    "scheduler_id",
    "queue_state",
    "last_run_at",
    "next_expected_run_at",
    "tasks_processed",
    "heartbeat_status"
  ],
  "additionalProperties": true,
  "properties": {
    "object_type": {
      "type": "string",
      "const": "agent_queue_heartbeat"
    },
    "heartbeat_id": {
      "type": "string"
    },
    "scheduler_id": {
      "type": "string"
    },
    "queue_state": {
      "type": "string",
      "enum": [
        "healthy",
        "moving",
        "attention_required",
        "paused",
        "degraded"
      ]
    },
    "last_run_at": {
      "type": "string",
      "format": "date-time"
    },
    "next_expected_run_at": {
      "type": "string",
      "format": "date-time"
    },
    "tasks_processed": {
      "type": "integer"
    },
    "tasks_advanced": {
      "type": "integer"
    },
    "errors": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": true
      }
    },
    "heartbeat_status": {
      "type": "string",
      "enum": [
        "on_time",
        "late",
        "missed",
        "manual_pause"
      ]
    }
  }
}
