{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "/assets/schemas/inference-receipt.schema.json",
  "title": "Kernave Inference Receipt",
  "description": "The exact portable receipt produced and verified by the Kernave browser studio. It proves record integrity, not model execution or output truth.",
  "type": "object",
  "additionalProperties": false,
  "required": ["kind", "version", "createdAt", "model", "run", "digest"],
  "properties": {
    "kind": { "const": "kernave.inference-receipt" },
    "version": { "const": "1.0" },
    "createdAt": { "type": "string", "format": "date-time" },
    "model": {
      "type": "object",
      "additionalProperties": false,
      "required": ["provider", "name", "revision"],
      "properties": {
        "provider": { "type": "string", "maxLength": 160 },
        "name": { "type": "string", "minLength": 1, "maxLength": 160 },
        "revision": { "type": "string", "minLength": 1, "maxLength": 160 }
      }
    },
    "run": {
      "type": "object",
      "additionalProperties": false,
      "required": ["prompt", "output", "seed", "notes"],
      "properties": {
        "prompt": { "type": "string", "minLength": 1 },
        "output": { "type": "string", "minLength": 1 },
        "seed": { "type": ["string", "null"], "maxLength": 160 },
        "notes": { "type": ["string", "null"] }
      }
    },
    "digest": {
      "type": "string",
      "pattern": "^sha256:[a-f0-9]{64}$",
      "description": "SHA-256 of the deterministic JSON body after removing this digest field."
    }
  }
}
