{
 "$schema":"https://json-schema.org/draft/2020-12/schema",
 "$id":"https://zeroexternal.ai/compute/schema.json",
 "title":"0EX bounded browser compute v1",
 "oneOf":[{"$ref":"#/$defs/session"},{"$ref":"#/$defs/claim"},{"$ref":"#/$defs/result"}],
 "$defs":{
  "session":{"type":"object","additionalProperties":false,"required":["consent","consentVersion","mode","maxDurationSeconds","maxBytes"],"properties":{"consent":{"const":true},"consentVersion":{"const":"0ex.compute.consent.2026-10-20"},"mode":{"const":"cpu"},"maxDurationSeconds":{"type":"integer","minimum":5,"maximum":3600},"maxBytes":{"type":"integer","minimum":4096,"maximum":10485760},"roles":{"type":"array","items":{"const":"browser.compute.wasm"},"minItems":1,"maxItems":1}}},
  "claim":{"type":"object","additionalProperties":false,"required":["sessionId","clientId"],"properties":{"sessionId":{"type":"string","minLength":1,"maxLength":80},"clientId":{"type":"string","minLength":1,"maxLength":80},"n":{"type":"integer","minimum":1,"maximum":20000}}},
  "result":{"type":"object","additionalProperties":false,"required":["jobId","leaseToken","fencingToken","output","outputSha256","kernelSha256","elapsedMs"],"properties":{"jobId":{"type":"string","maxLength":80},"leaseToken":{"type":"string","pattern":"^[a-f0-9]{64}$"},"fencingToken":{"type":"integer","minimum":1},"outputSha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"kernelSha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"elapsedMs":{"type":"number","minimum":0,"maximum":5000},"output":{"type":"object","additionalProperties":false,"required":["n","sumSquares","units"],"properties":{"n":{"type":"integer","minimum":1,"maximum":20000},"sumSquares":{"type":"integer","minimum":1},"units":{"const":"dimensionless"}}}}}
 }
}
