{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://oshun.dev/schemas/eve-sota-environment-capabilities.v1.json",
  "title": "Eve SOTA environment capability record",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "initiativeId",
    "taskId",
    "probeRun",
    "probeDefinitions",
    "capabilities",
    "summary",
    "limitations",
    "recordDigestSha256"
  ],
  "properties": {
    "schemaVersion": {
      "const": "eve-sota-environment-capabilities.v1"
    },
    "initiativeId": {
      "const": "eve-sota-gap-closure-2026-09-01"
    },
    "taskId": {
      "const": "0.7"
    },
    "probeRun": {
      "$ref": "#/$defs/probeRun"
    },
    "probeDefinitions": {
      "type": "array",
      "minItems": 11,
      "maxItems": 11,
      "items": {
        "$ref": "#/$defs/probeDefinition"
      }
    },
    "capabilities": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "blender",
        "unreal",
        "nativeDesktop",
        "localDatabase",
        "vectorStore",
        "browsers",
        "mobileHarness",
        "externalChannelCredentials"
      ],
      "properties": {
        "blender": {
          "$ref": "#/$defs/capability"
        },
        "unreal": {
          "$ref": "#/$defs/capability"
        },
        "nativeDesktop": {
          "$ref": "#/$defs/capability"
        },
        "localDatabase": {
          "$ref": "#/$defs/capability"
        },
        "vectorStore": {
          "$ref": "#/$defs/capability"
        },
        "browsers": {
          "$ref": "#/$defs/capability"
        },
        "mobileHarness": {
          "$ref": "#/$defs/capability"
        },
        "externalChannelCredentials": {
          "$ref": "#/$defs/capability"
        }
      }
    },
    "summary": {
      "type": "object",
      "additionalProperties": false,
      "required": ["ready", "degraded", "unavailable", "notApplicable"],
      "properties": {
        "ready": {
          "$ref": "#/$defs/capabilityIds"
        },
        "degraded": {
          "$ref": "#/$defs/capabilityIds"
        },
        "unavailable": {
          "$ref": "#/$defs/capabilityIds"
        },
        "notApplicable": {
          "$ref": "#/$defs/capabilityIds"
        }
      }
    },
    "limitations": {
      "type": "array",
      "minItems": 4,
      "items": {
        "$ref": "#/$defs/nonEmptyString"
      }
    },
    "recordDigestSha256": {
      "$ref": "#/$defs/sha256"
    }
  },
  "$defs": {
    "nonEmptyString": {
      "type": "string",
      "minLength": 1
    },
    "sha256": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
    },
    "timestamp": {
      "type": "string",
      "minLength": 20
    },
    "sourceRef": {
      "type": "object",
      "additionalProperties": false,
      "required": ["path", "sha256"],
      "properties": {
        "path": {
          "type": "string",
          "minLength": 1,
          "pattern": "^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).+$"
        },
        "sha256": {
          "$ref": "#/$defs/sha256"
        }
      }
    },
    "host": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "platform",
        "architecture",
        "kernelRelease",
        "osRelease",
        "probeUserUid",
        "bootIdSha256",
        "monotonicStartSeconds",
        "monotonicEndSeconds"
      ],
      "properties": {
        "platform": {
          "$ref": "#/$defs/nonEmptyString"
        },
        "architecture": {
          "$ref": "#/$defs/nonEmptyString"
        },
        "kernelRelease": {
          "$ref": "#/$defs/nonEmptyString"
        },
        "osRelease": {
          "type": "object",
          "additionalProperties": false,
          "required": ["id", "versionId"],
          "properties": {
            "id": {
              "$ref": "#/$defs/nonEmptyString"
            },
            "versionId": {
              "$ref": "#/$defs/nonEmptyString"
            }
          }
        },
        "probeUserUid": {
          "type": ["integer", "null"],
          "minimum": 0
        },
        "bootIdSha256": {
          "$ref": "#/$defs/sha256"
        },
        "monotonicStartSeconds": {
          "type": "number",
          "minimum": 0
        },
        "monotonicEndSeconds": {
          "type": "number",
          "minimum": 0
        }
      }
    },
    "probeRun": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "startedAt",
        "finishedAt",
        "expiresAt",
        "ttlSeconds",
        "sourceCommit",
        "probeImplementation",
        "sourceContracts",
        "host"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
        },
        "startedAt": {
          "$ref": "#/$defs/timestamp"
        },
        "finishedAt": {
          "$ref": "#/$defs/timestamp"
        },
        "expiresAt": {
          "$ref": "#/$defs/timestamp"
        },
        "ttlSeconds": {
          "const": 86400
        },
        "sourceCommit": {
          "type": "string",
          "pattern": "^[0-9a-f]{40}$"
        },
        "probeImplementation": {
          "$ref": "#/$defs/sourceRef"
        },
        "sourceContracts": {
          "type": "array",
          "minItems": 15,
          "maxItems": 15,
          "items": {
            "$ref": "#/$defs/sourceRef"
          }
        },
        "host": {
          "$ref": "#/$defs/host"
        }
      }
    },
    "probeDefinition": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "boundary", "observation", "successCriteria"],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9.-]+$"
        },
        "boundary": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9-]+$"
        },
        "observation": {
          "$ref": "#/$defs/nonEmptyString"
        },
        "successCriteria": {
          "$ref": "#/$defs/nonEmptyString"
        }
      }
    },
    "capability": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "status",
        "claim",
        "probeDefinitionRefs",
        "sourceRefs",
        "facts",
        "limitations",
        "observedAt",
        "expiresAt"
      ],
      "properties": {
        "status": {
          "enum": ["ready", "degraded", "unavailable", "not-applicable"]
        },
        "claim": {
          "$ref": "#/$defs/nonEmptyString"
        },
        "probeDefinitionRefs": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9.-]+$"
          }
        },
        "sourceRefs": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "facts": {
          "type": "object"
        },
        "limitations": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/nonEmptyString"
          }
        },
        "observedAt": {
          "$ref": "#/$defs/timestamp"
        },
        "expiresAt": {
          "$ref": "#/$defs/timestamp"
        }
      }
    },
    "capabilityIds": {
      "type": "array",
      "items": {
        "enum": [
          "blender",
          "unreal",
          "nativeDesktop",
          "localDatabase",
          "vectorStore",
          "browsers",
          "mobileHarness",
          "externalChannelCredentials"
        ]
      }
    }
  }
}
