{
  "openapi": "3.1.0",
  "info": {
    "title": "hc110-1-recover",
    "version": "1.0.0",
    "description": "Deterministic retry decisions and signed, caller-isolated workflow checkpoints."
  },
  "servers": [{"url": "https://hc110-1-recover.fullyagentnativeapps.com"}],
  "paths": {
    "/api/health": {
      "get": {"summary": "Liveness", "responses": {"200": {"description": "Healthy"}}}
    },
    "/api/price": {
      "get": {"summary": "Current and proposed pricing", "responses": {"200": {"description": "Pricing"}}}
    },
    "/api/buy": {
      "get": {"summary": "Whether purchase is available", "responses": {"200": {"description": "Free validation-stage purchase status"}}}
    },
    "/api/retry-plan": {
      "post": {
        "summary": "Classify a failed operation as retry, reconcile, stop, or succeed",
        "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/RetryInput"}}}},
        "responses": {"200": {"description": "Deterministic plan"}, "400": {"description": "Invalid input"}}
      }
    },
    "/api/checkpoints": {
      "post": {
        "summary": "Create or advance a durable checkpoint",
        "security": [{"ag3ntRequest": []}],
        "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/CheckpointWrite"}}}},
        "responses": {"200": {"description": "Advanced or replayed"}, "201": {"description": "Created"}, "409": {"description": "Revision, operation, step, terminal-state, or concurrent-write conflict"}}
      }
    },
    "/api/checkpoint": {
      "get": {"summary": "Read the caller's checkpoint", "security": [{"ag3ntRequest": []}], "parameters": [{"name": "run_id", "in": "query", "required": true, "schema": {"type": "string"}}], "responses": {"200": {"description": "Checkpoint"}, "404": {"description": "Not found"}}},
      "delete": {"summary": "Delete the caller's checkpoint and free its record", "security": [{"ag3ntRequest": []}], "parameters": [{"name": "run_id", "in": "query", "required": true, "schema": {"type": "string"}}], "responses": {"200": {"description": "Idempotent deletion result"}}}
    },
    "/api/feedback": {
      "post": {"summary": "Send signed product feedback", "security": [{"ag3ntRequest": []}], "responses": {"201": {"description": "Feedback stored"}}}
    }
  },
  "components": {
    "securitySchemes": {
      "ag3ntRequest": {"type": "apiKey", "in": "header", "name": "x-agent-sig", "description": "ag3nt-req:v1 also requires x-agent-pub and x-agent-nonce; see the FANA platform discovery document."}
    },
    "schemas": {
      "RetryInput": {
        "type": "object",
        "required": ["method", "attempt"],
        "properties": {
          "method": {"type": "string"},
          "status_code": {"type": ["integer", "null"], "minimum": 100, "maximum": 599},
          "failure": {"enum": ["network_error", "timeout", "http_error"]},
          "attempt": {"type": "integer", "minimum": 0},
          "max_attempts": {"type": "integer", "minimum": 1, "maximum": 10, "default": 6},
          "idempotency_key": {"type": "string"},
          "retry_after_seconds": {"type": "number", "minimum": 0},
          "side_effect": {"enum": ["none", "payment"]},
          "authorization_valid_until": {"type": "string", "format": "date-time"}
        }
      },
      "CheckpointWrite": {
        "type": "object",
        "required": ["run_id", "operation_id", "step", "status"],
        "properties": {
          "run_id": {"type": "string", "maxLength": 96},
          "operation_id": {"type": "string", "maxLength": 96},
          "step": {"type": "integer", "minimum": 0},
          "status": {"enum": ["running", "blocked", "failed", "completed"]},
          "checkpoint": {},
          "expected_revision": {"type": "integer", "minimum": 0}
        }
      }
    }
  }
}
