{
  "openapi": "3.1.0",
  "info": {
    "title": "PlatPhorm AgentOps",
    "description": "Agent Operations Layer for the PlatPhorm News network. Discover agent-safe routes, capabilities, runbooks, examples, handoffs, policies, feeds, graphs, MCP tools, OpenAPI operations, and human-readable mirrors for every PlatPhorm service.",
    "version": "1.0.0",
    "contact": {
      "name": "PlatPhorm News",
      "url": "https://platphormnews.com"
    },
    "license": {
      "name": "MIT"
    }
  },
  "servers": [
    {
      "url": "https://agentops.platphormnews.com",
      "description": "Production server"
    }
  ],
  "tags": [
    {
      "name": "Health",
      "description": "Health and status endpoints"
    },
    {
      "name": "Services",
      "description": "Service registry operations"
    },
    {
      "name": "Routes",
      "description": "Route documentation operations"
    },
    {
      "name": "Web Status",
      "description": "Web Status endpoints"
    },
    {
      "name": "Discovery",
      "description": "Discovery and machine-readable files"
    }
  ],
  "paths": {
    "/api/health": {
      "get": {
        "operationId": "getHealth",
        "summary": "Health check",
        "description": "Returns service health status",
        "tags": [
          "Health"
        ],
        "responses": {
          "200": {
            "description": "Service is healthy",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "service": {
                      "type": "string"
                    },
                    "site": {
                      "type": "string"
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/storage/status": {
      "get": {
        "operationId": "getStorageStatus",
        "summary": "Storage status",
        "description": "Returns current storage adapter status - no database required",
        "tags": [
          "Health"
        ],
        "responses": {
          "200": {
            "description": "Storage status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StorageStatus"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/services": {
      "get": {
        "operationId": "listServices",
        "summary": "List services",
        "description": "Returns all discovered PlatPhorm services",
        "tags": [
          "Services"
        ],
        "parameters": [
          {
            "name": "category",
            "in": "query",
            "description": "Filter by category",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List of services",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/services/{slug}": {
      "get": {
        "operationId": "getService",
        "summary": "Get service",
        "description": "Returns a specific service by slug",
        "tags": [
          "Services"
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "Service slug",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Service details",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponse"
                }
              }
            }
          },
          "404": {
            "description": "Service not found"
          }
        }
      }
    },
    "/api/v1/routes": {
      "get": {
        "operationId": "listRoutes",
        "summary": "List routes",
        "description": "Returns all documented routes",
        "tags": [
          "Routes"
        ],
        "parameters": [
          {
            "name": "service",
            "in": "query",
            "description": "Filter by service slug",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "safetyClass",
            "in": "query",
            "description": "Filter by safety class",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List of routes",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/routes/agent-safe": {
      "get": {
        "operationId": "listAgentSafeRoutes",
        "summary": "List agent-safe routes",
        "description": "Returns routes safe for autonomous agent operation",
        "tags": [
          "Routes"
        ],
        "responses": {
          "200": {
            "description": "List of agent-safe routes",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/web/status": {
      "get": {
        "operationId": "getWebStatus",
        "summary": "Web Status",
        "description": "Returns operational readiness status",
        "tags": [
          "Web Status"
        ],
        "responses": {
          "200": {
            "description": "Web Status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebStatus"
                }
              }
            }
          }
        }
      }
    },
    "/api/mcp": {
      "post": {
        "operationId": "mcpEndpoint",
        "summary": "MCP endpoint",
        "description": "Model Context Protocol JSON-RPC 2.0 endpoint",
        "tags": [
          "Discovery"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "jsonrpc": {
                    "type": "string",
                    "enum": [
                      "2.0"
                    ]
                  },
                  "method": {
                    "type": "string"
                  },
                  "params": {
                    "type": "object"
                  },
                  "id": {
                    "type": [
                      "string",
                      "number"
                    ]
                  }
                },
                "required": [
                  "jsonrpc",
                  "method"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "MCP response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "jsonrpc": {
                      "type": "string"
                    },
                    "result": {
                      "type": "object"
                    },
                    "error": {
                      "type": "object"
                    },
                    "id": {
                      "type": [
                        "string",
                        "number"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ApiResponse": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "data": {
            "type": "object"
          },
          "meta": {
            "type": "object",
            "properties": {
              "generatedAt": {
                "type": "string",
                "format": "date-time"
              },
              "source": {
                "type": "string"
              },
              "traceId": {
                "type": "string",
                "nullable": true
              }
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "StorageStatus": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "data": {
            "type": "object",
            "properties": {
              "mode": {
                "type": "string"
              },
              "databaseRequired": {
                "type": "boolean"
              },
              "databaseConfigured": {
                "type": "boolean"
              },
              "degraded": {
                "type": "boolean"
              }
            }
          }
        }
      },
      "WebStatus": {
        "type": "object",
        "properties": {
          "schemaVersion": {
            "type": "string"
          },
          "site": {
            "type": "string"
          },
          "service": {
            "type": "string"
          },
          "generatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "storage": {
            "type": "object"
          },
          "readiness": {
            "type": "object"
          },
          "counts": {
            "type": "object"
          },
          "degraded": {
            "type": "boolean"
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "Service": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "displayName": {
            "type": "string"
          },
          "baseUrl": {
            "type": "string"
          },
          "purpose": {
            "type": "string"
          },
          "category": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "degraded",
              "unavailable",
              "planned"
            ]
          },
          "publicSafe": {
            "type": "boolean"
          },
          "protected": {
            "type": "boolean"
          }
        }
      },
      "Route": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "serviceSlug": {
            "type": "string"
          },
          "method": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "safetyClass": {
            "type": "string"
          },
          "publicSafe": {
            "type": "boolean"
          },
          "protected": {
            "type": "boolean"
          },
          "authRequired": {
            "type": "boolean"
          },
          "agentAllowed": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "agentDisallowed": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "PLATPHORM_API_KEY for protected actions"
      },
      "apiKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "X-PlatPhorm-API-Key",
        "description": "PLATPHORM_API_KEY for protected actions"
      }
    }
  }
}