{
  "openapi": "3.1.0",
  "info": {
    "title": "CodeLock Runtime API",
    "version": "0.1.0",
    "summary": "Gate-tethered cognitive rendering of source text. Alters perception, not meaning. Not encryption.",
    "description": "This tool alters perception, not meaning. Source is never mutated. CodeLock mode requires the exact gate phrase."
  },
  "servers": [
    {
      "url": "https://codelock-download-tracker.vibelock.workers.dev"
    }
  ],
  "paths": {
    "/v1/health": {
      "get": {
        "operationId": "codelockHealth",
        "summary": "Liveness",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/gate-status": {
      "post": {
        "operationId": "codelockGateStatus",
        "summary": "Report gate open/closed for this request",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "ack": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Gate status"
          }
        }
      }
    },
    "/v1/render": {
      "post": {
        "operationId": "codelockRender",
        "summary": "Render Normalize or CodeLock HTML. Source is not mutated.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "source",
                  "mode"
                ],
                "properties": {
                  "source": {
                    "type": "string"
                  },
                  "mode": {
                    "type": "string",
                    "enum": [
                      "normalize",
                      "codelock"
                    ]
                  },
                  "ack": {
                    "type": "string"
                  },
                  "seed": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "integer"
                      }
                    ]
                  },
                  "hue": {
                    "type": "boolean",
                    "default": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "HTML view plus metadata (source unchanged)"
          },
          "400": {
            "description": "Bad acknowledgment or arguments"
          },
          "403": {
            "description": "CodeLock mode refused; gate closed"
          }
        }
      }
    }
  }
}