{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/huggingbay-xyz/json-schema/huggingbay-xyz-public-evidence-surface-schema.json",
  "title": "PublicEvidenceSurface",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/huggingbay-xyz-openapi.json#/components/schemas/PublicEvidenceSurface",
  "type": "object",
  "required": [
    "schema",
    "artifactId",
    "canonicalUrl",
    "apiUrl",
    "generatedAt",
    "selection",
    "readiness",
    "runCard",
    "proof",
    "rescue",
    "requests",
    "claims",
    "evidenceContext",
    "distribution",
    "snippets",
    "surfaceDigest"
  ],
  "properties": {
    "schema": {
      "const": "hugging-bay.public-evidence-surface.v1"
    },
    "artifactId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 240
    },
    "canonicalUrl": {
      "type": "string",
      "format": "uri"
    },
    "apiUrl": {
      "type": "string",
      "format": "uri"
    },
    "generatedAt": {
      "type": "string",
      "format": "date-time"
    },
    "selection": {
      "type": "object",
      "required": [
        "scope",
        "activeRigMatch",
        "selectedCardId",
        "state",
        "reason"
      ],
      "properties": {
        "scope": {
          "const": "artifact-only"
        },
        "activeRigMatch": {
          "const": false
        },
        "selectedCardId": {
          "type": [
            "string",
            "null"
          ],
          "pattern": "^hbrc_[a-f0-9]{32}([a-f0-9]{32})?$"
        },
        "state": {
          "enum": [
            "available",
            "unavailable"
          ]
        },
        "reason": {
          "type": "string"
        },
        "note": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "object",
              "required": [
                "summary"
              ],
              "properties": {
                "summary": {
                  "type": "string"
                },
                "downloadable": {
                  "type": "boolean"
                }
              },
              "additionalProperties": false
            }
          ]
        },
        "noteMessage": {
          "type": "string",
          "description": "Original route note, when a public qualification occupies note."
        }
      },
      "additionalProperties": false
    },
    "readiness": {
      "type": "object",
      "required": [
        "status",
        "reason",
        "runnable",
        "verified",
        "reasonCodes",
        "primaryAction"
      ],
      "properties": {
        "status": {
          "enum": [
            "verified",
            "runnable",
            "failed",
            "blocked",
            "unknown"
          ]
        },
        "reason": {
          "type": "string"
        },
        "runnable": {
          "type": "boolean"
        },
        "verified": {
          "type": "boolean"
        },
        "rescueStatus": {
          "type": [
            "string",
            "null"
          ]
        },
        "reasonCodes": {
          "type": "array",
          "maxItems": 64,
          "uniqueItems": true,
          "items": {
            "type": "string"
          }
        },
        "primaryAction": {
          "type": [
            "object",
            "null"
          ],
          "additionalProperties": true
        },
        "note": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "object",
              "required": [
                "summary"
              ],
              "properties": {
                "summary": {
                  "type": "string"
                },
                "downloadable": {
                  "type": "boolean"
                }
              },
              "additionalProperties": false
            }
          ]
        },
        "noteMessage": {
          "type": "string",
          "description": "Original route note, when a public qualification occupies note."
        }
      },
      "additionalProperties": false
    },
    "runCard": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": true
    },
    "proof": {
      "type": "object",
      "additionalProperties": true
    },
    "rescue": {
      "type": "object",
      "additionalProperties": true
    },
    "evidenceContext": {
      "type": "object",
      "required": [
        "uncertainty",
        "blockers",
        "freshness"
      ],
      "properties": {
        "uncertainty": {
          "type": "object",
          "additionalProperties": {
            "type": "array",
            "maxItems": 64,
            "items": {
              "type": "string"
            }
          }
        },
        "blockers": {
          "type": "object",
          "additionalProperties": {
            "type": "array",
            "maxItems": 64
          }
        },
        "freshness": {
          "type": "object",
          "additionalProperties": true
        },
        "note": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "object",
              "required": [
                "summary"
              ],
              "properties": {
                "summary": {
                  "type": "string"
                },
                "downloadable": {
                  "type": "boolean"
                }
              },
              "additionalProperties": false
            }
          ]
        },
        "noteMessage": {
          "type": "string",
          "description": "Original route note, when a public qualification occupies note."
        }
      },
      "additionalProperties": false
    },
    "requests": {
      "type": "object",
      "additionalProperties": true
    },
    "claims": {
      "type": "array",
      "minItems": 6,
      "maxItems": 256,
      "items": {
        "$ref": "#/$defs/PublicEvidenceClaim"
      }
    },
    "distribution": {
      "type": "object",
      "required": [
        "json",
        "jsonLd",
        "mcp",
        "citation",
        "share",
        "badge",
        "runCard",
        "acceptedRunProof"
      ],
      "properties": {
        "canonical": {
          "type": "string",
          "format": "uri"
        },
        "json": {
          "type": "string",
          "format": "uri"
        },
        "jsonLd": {
          "type": "string",
          "format": "uri"
        },
        "mcp": {
          "type": "string",
          "format": "uri"
        },
        "citation": {
          "type": "string",
          "format": "uri"
        },
        "share": {
          "type": "string",
          "format": "uri"
        },
        "badge": {
          "type": "string",
          "format": "uri"
        },
        "runCard": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri"
        },
        "acceptedRunProof": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri"
        },
        "note": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "object",
              "required": [
                "summary"
              ],
              "properties": {
                "summary": {
                  "type": "string"
                },
                "downloadable": {
                  "type": "boolean"
                }
              },
              "additionalProperties": false
            }
          ]
        },
        "noteMessage": {
          "type": "string",
          "description": "Original route note, when a public qualification occupies note."
        }
      },
      "additionalProperties": false
    },
    "snippets": {
      "type": "object",
      "required": [
        "cli",
        "cliSignedBase",
        "api",
        "mcp",
        "requestContract"
      ],
      "properties": {
        "cli": {
          "type": [
            "string",
            "null"
          ]
        },
        "cliSignedBase": {
          "type": [
            "string",
            "null"
          ]
        },
        "api": {
          "type": "string"
        },
        "mcp": {
          "type": "string"
        },
        "requestContract": {
          "type": "string"
        },
        "note": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "object",
              "required": [
                "summary"
              ],
              "properties": {
                "summary": {
                  "type": "string"
                },
                "downloadable": {
                  "type": "boolean"
                }
              },
              "additionalProperties": false
            }
          ]
        },
        "noteMessage": {
          "type": "string",
          "description": "Original route note, when a public qualification occupies note."
        }
      },
      "additionalProperties": false
    },
    "surfaceDigest": {
      "type": "string",
      "pattern": "^sha256:[a-f0-9]{64}$"
    },
    "note": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "object",
          "required": [
            "summary"
          ],
          "properties": {
            "summary": {
              "type": "string"
            },
            "downloadable": {
              "type": "boolean"
            }
          },
          "additionalProperties": false
        }
      ]
    },
    "noteMessage": {
      "type": "string",
      "description": "Original route note, when a public qualification occupies note."
    }
  },
  "additionalProperties": false,
  "$defs": {
    "PublicEvidenceClaim": {
      "type": "object",
      "required": [
        "id",
        "label",
        "value",
        "evidenceSource",
        "evidenceDigest",
        "timestamp",
        "canonicalVerificationUrl",
        "citationId",
        "digest"
      ],
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 160
        },
        "label": {
          "type": "string",
          "minLength": 1,
          "maxLength": 240
        },
        "value": {
          "type": "string",
          "maxLength": 2048
        },
        "evidenceSource": {
          "type": "string",
          "minLength": 1,
          "maxLength": 160
        },
        "evidenceDigest": {
          "type": [
            "string",
            "null"
          ],
          "pattern": "^sha256:[a-f0-9]{64}$"
        },
        "timestamp": {
          "type": "string",
          "format": "date-time"
        },
        "canonicalVerificationUrl": {
          "type": "string",
          "format": "uri"
        },
        "citationId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 160
        },
        "digest": {
          "type": "string",
          "pattern": "^sha256:[a-f0-9]{64}$"
        },
        "note": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "object",
              "required": [
                "summary"
              ],
              "properties": {
                "summary": {
                  "type": "string"
                },
                "downloadable": {
                  "type": "boolean"
                }
              },
              "additionalProperties": false
            }
          ]
        },
        "noteMessage": {
          "type": "string",
          "description": "Original route note, when a public qualification occupies note."
        }
      },
      "additionalProperties": false
    }
  }
}