{
  "openapi": "3.1.0",
  "info": {
    "title": "PostTrainLLM public API",
    "version": "1.1.0",
    "description": "PostTrainLLM is a Mac-local LLM specialist factory. The public web API exposes read-only agent surfaces: the agent catalog, sitemap, llms.txt, and per-page markdown alternates. Training, evaluation, and packaging run locally and do not expose a remote API.",
    "contact": {
      "name": "PostTrainLLM",
      "url": "https://posttrainllm.com"
    },
    "license": {
      "name": "MIT",
      "url": "https://github.com/PostTrainLLM/posttrainllm/blob/main/LICENSE"
    }
  },
  "servers": [
    {
      "url": "https://posttrainllm.com"
    }
  ],
  "tags": [
    {
      "name": "agent-surfaces",
      "description": "Machine-readable public surfaces"
    }
  ],
  "paths": {
    "/api/ai": {
      "get": {
        "operationId": "getAgentCatalog",
        "tags": [
          "agent-surfaces"
        ],
        "summary": "Agent catalog",
        "description": "JSON inventory of public agent surfaces: llms.txt, llms-full.txt, sitemap, robots, and per-page markdown alternates.",
        "responses": {
          "200": {
            "description": "Agent catalog",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentCatalog"
                }
              }
            }
          },
          "404": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/llms.txt": {
      "get": {
        "operationId": "getLlmsTxt",
        "tags": [
          "agent-surfaces"
        ],
        "summary": "llms.txt index",
        "description": "Compact agent index following the llms.txt convention.",
        "responses": {
          "200": {
            "description": "Markdown index",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/llms-full.txt": {
      "get": {
        "operationId": "getLlmsFullTxt",
        "tags": [
          "agent-surfaces"
        ],
        "summary": "Full agent brief",
        "description": "Full canonical agent brief with product, architecture, and surface inventory.",
        "responses": {
          "200": {
            "description": "Markdown brief",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/sitemap.xml": {
      "get": {
        "operationId": "getSitemap",
        "tags": [
          "agent-surfaces"
        ],
        "summary": "Sitemap",
        "description": "XML sitemap listing all public HTML routes.",
        "responses": {
          "200": {
            "description": "XML sitemap",
            "content": {
              "application/xml": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/openapi.json": {
      "get": {
        "operationId": "getOpenApiSpec",
        "tags": [
          "agent-surfaces"
        ],
        "summary": "OpenAPI specification",
        "description": "This document.",
        "responses": {
          "200": {
            "description": "OpenAPI 3.1 spec",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "404": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/releases/mac.json": {
      "get": {
        "operationId": "getMacRelease",
        "tags": [
          "agent-surfaces"
        ],
        "summary": "Verified Mac release record",
        "description": "Fail-closed release metadata. A Mac artifact is downloadable only when Developer ID signing, hardened runtime, notarization, stapling, Gatekeeper assessment, a GitHub DMG URL, and SHA-256 evidence are all present.",
        "responses": {
          "200": {
            "description": "Native Mac release state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MacRelease"
                }
              }
            }
          },
          "404": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AgentCatalog": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "version": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "llms": {
            "type": "string",
            "format": "uri"
          },
          "llmsFull": {
            "type": "string",
            "format": "uri"
          },
          "sitemap": {
            "type": "string",
            "format": "uri"
          },
          "robots": {
            "type": "string",
            "format": "uri"
          },
          "openapi": {
            "type": "string",
            "format": "uri"
          },
          "release": {
            "type": "string",
            "format": "uri"
          },
          "markdown": {
            "type": "object",
            "properties": {
              "suffix": {
                "type": "string"
              },
              "negotiation": {
                "type": "boolean"
              }
            }
          },
          "surfaces": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "url": {
                  "type": "string",
                  "format": "uri"
                },
                "md": {
                  "type": "string",
                  "format": "uri"
                },
                "kind": {
                  "type": "string"
                },
                "title": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                }
              }
            }
          },
          "capabilities": {
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/Capability"
              }
            }
          },
          "experimentSummary": {
            "$ref": "#/components/schemas/ExperimentSummary"
          },
          "learningSummary": {
            "$ref": "#/components/schemas/LearningSummary"
          }
        }
      },
      "Capability": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        },
        "required": [
          "name",
          "url"
        ]
      },
      "ExperimentSummary": {
        "type": "object",
        "properties": {
          "total": {
            "type": "integer"
          },
          "resolved": {
            "type": "integer"
          },
          "worked": {
            "type": "integer"
          },
          "workedWithCaveat": {
            "type": "integer"
          },
          "nonPositiveOrMixed": {
            "type": "integer"
          },
          "byStatus": {
            "type": "object",
            "additionalProperties": {
              "type": "integer"
            }
          },
          "interpretation": {
            "type": "string"
          }
        }
      },
      "LearningSummary": {
        "type": "object",
        "properties": {
          "paths": {
            "type": "integer"
          },
          "recipes": {
            "type": "integer"
          },
          "stages": {
            "type": "integer"
          },
          "buildableArtifacts": {
            "type": "integer"
          }
        }
      },
      "MacRelease": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string"
          },
          "build": {
            "type": "string"
          },
          "state": {
            "type": "string"
          },
          "downloadable": {
            "type": "boolean"
          },
          "artifactURL": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          },
          "sha256": {
            "type": [
              "string",
              "null"
            ]
          },
          "verification": {
            "$ref": "#/components/schemas/MacReleaseVerification"
          }
        }
      },
      "MacReleaseVerification": {
        "type": "object",
        "properties": {
          "developerIdSigned": {
            "type": "boolean"
          },
          "hardenedRuntime": {
            "type": "boolean"
          },
          "notarized": {
            "type": "boolean"
          },
          "stapled": {
            "type": "boolean"
          },
          "gatekeeperAccepted": {
            "type": "boolean"
          },
          "checksumVerified": {
            "type": "boolean"
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "path": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message",
              "path"
            ]
          }
        },
        "required": [
          "error"
        ]
      }
    }
  }
}