{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://weverlabs.com/schemas/agent-run-retry-command.schema.json",
  "title": "Agent Run Retry Command",
  "description": "Command object for retrying, replaying, or advancing an agent task from a known lifecycle state.",
  "type": "object",
  "required": [
    "object_type",
    "command_id",
    "task_token",
    "action",
    "requested_by",
    "allowed_from_states",
    "target_state",
    "created_at"
  ],
  "additionalProperties": true,
  "properties": {
    "object_type": {
      "type": "string",
      "const": "agent_run_retry_command"
    },
    "command_id": {
      "type": "string"
    },
    "task_token": {
      "type": "string"
    },
    "action": {
      "type": "string",
      "enum": [
        "retry_callback",
        "replay_from_checkpoint",
        "advance_queue",
        "request_evidence",
        "release_credit_allocation",
        "rerun_result_contract",
        "close_exception"
      ]
    },
    "requested_by": {
      "type": "string"
    },
    "allowed_from_states": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "target_state": {
      "type": "string"
    },
    "reason": {
      "type": "string"
    },
    "idempotency_key": {
      "type": "string"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
