{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://buy-before-sleep.kawaii-girl.com/public/data/agent-run-schema-v1.json",
  "title": "Agent Run Manifest (agent-run-1)",
  "type": "object",
  "required": [
    "schemaVersion", "runId", "agentId", "agentVersion",
    "benchmarkVersion", "taskSet", "taskCount", "environmentHashes", "attestation"
  ],
  "additionalProperties": false,
  "properties": {
    "schemaVersion": { "const": "agent-run-1" },
    "runId": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]{2,63}$" },
    "agentId": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]{2,63}$" },
    "agentVersion": { "type": "string", "minLength": 1, "maxLength": 64 },
    "benchmarkVersion": { "type": "string", "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$" },
    "benchmarkCommit": { "type": "string", "pattern": "^[0-9a-f]{7,40}$" },
    "taskSet": { "type": "string", "minLength": 1, "maxLength": 80 },
    "taskCount": { "type": "integer", "minimum": 1, "maximum": 100000 },
    "seed": { "type": "integer", "minimum": 0 },
    "repetitions": { "type": "integer", "minimum": 1, "maximum": 1000, "default": 1 },
    "browser": { "type": "string", "maxLength": 80 },
    "browserVersion": { "type": "string", "maxLength": 80 },
    "viewport": { "type": "string", "maxLength": 40 },
    "locale": { "type": "string", "maxLength": 40 },
    "timezone": { "type": "string", "maxLength": 40 },
    "operatingSystem": { "type": "string", "maxLength": 80 },
    "nodeVersion": { "type": "string", "maxLength": 40 },
    "networkAccess": { "type": "string", "enum": ["none", "localhost-only", "open-web"] },
    "searchAccess": { "type": "string", "enum": ["none", "benchmark-only", "open-web"] },
    "startedAt": { "type": "string", "format": "date-time" },
    "finishedAt": { "type": "string", "format": "date-time" },
    "traceFiles": { "type": "array", "items": { "type": "string", "maxLength": 256 }, "maxItems": 100000 },
    "resultFile": { "type": "string", "maxLength": 256 },
    "environmentHashes": {
      "type": "object",
      "additionalProperties": { "type": "string", "pattern": "^[a-f0-9]{16,64}$" }
    },
    "codeCommit": { "type": ["string", "null"], "pattern": "^[0-9a-f]{7,40}$" },
    "containerDigest": { "type": ["string", "null"], "maxLength": 120 },
    "cost": { "type": ["number", "null"], "minimum": 0 },
    "notes": { "type": "string", "maxLength": 4000 },
    "attestation": {
      "type": "object",
      "required": ["selfReported"],
      "properties": {
        "selfReported": { "type": "boolean" },
        "maintainerReproduced": { "type": "boolean" },
        "reproductionLevel": {
          "type": ["string", "null"],
          "enum": ["static-only", "trace-rescored", "local-maintainer-rerun", "github-clean-rerun", "exact-match", "approximate-match", "failed", "blocked-security", null]
        },
        "reproducedBy": { "type": ["string", "null"], "maxLength": 160 },
        "reproducedAt": { "type": ["string", "null"], "format": "date-time" },
        "reproductionNotes": { "type": "string", "maxLength": 2000 }
      }
    }
  }
}
