{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "additionalProperties": false,
  "$id": "https://miruntime.com/downloads/miruntime-context-package.schema.json",
  "title": "MiRuntime Context Package",
  "description": "Conceptual package of attributable, authorized, budgeted, and provenance-sealed context records.",
  "x-miruntime": {
    "artifactVersion": "2.8.1",
    "editorialStatus": "Conceptual reference",
    "reviewedAtUtc": "2026-06-24T00:00:00Z",
    "disclaimer": "Conceptual MiRuntime editorial reference. This is not a product SDK, certification profile, or industry standard.",
    "description": "Conceptual package of attributable, authorized, budgeted, and provenance-sealed context records."
  },
  "required": [
    "schemaVersion",
    "editorialStatus",
    "description",
    "reviewedAtUtc",
    "disclaimer",
    "packageId",
    "runId",
    "sealedAtUtc",
    "sources"
  ],
  "properties": {
    "schemaVersion": {
      "type": "string",
      "const": "1.0"
    },
    "editorialStatus": {
      "type": "string",
      "const": "Conceptual reference"
    },
    "description": {
      "type": "string",
      "minLength": 1
    },
    "reviewedAtUtc": {
      "type": "string",
      "format": "date-time",
      "pattern": "Z$"
    },
    "disclaimer": {
      "type": "string",
      "minLength": 1
    },
    "packageId": {
      "type": "string",
      "minLength": 1
    },
    "runId": {
      "type": "string",
      "minLength": 1
    },
    "sealedAtUtc": {
      "type": "string",
      "format": "date-time",
      "pattern": "Z$"
    },
    "sources": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/source"
      },
      "minItems": 1
    },
    "excludedSourceCount": {
      "type": "integer",
      "minimum": 0
    },
    "contentBudget": {
      "type": "integer",
      "minimum": 1
    }
  },
  "$defs": {
    "source": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "sourceId",
        "sourceType",
        "contentHash",
        "provenance",
        "capturedAtUtc",
        "permissionScope",
        "dataClassification",
        "status",
        "selectionReason"
      ],
      "properties": {
        "sourceId": {
          "type": "string",
          "minLength": 1
        },
        "sourceType": {
          "type": "string",
          "minLength": 1
        },
        "contentHash": {
          "type": "string",
          "pattern": "^[a-fA-F0-9]{64}$"
        },
        "provenance": {
          "type": "string",
          "minLength": 1
        },
        "capturedAtUtc": {
          "type": "string",
          "format": "date-time",
          "pattern": "Z$"
        },
        "validThroughUtc": {
          "oneOf": [
            {
              "type": "string",
              "format": "date-time",
              "pattern": "Z$"
            },
            {
              "type": "null"
            }
          ]
        },
        "permissionScope": {
          "type": "string",
          "minLength": 1
        },
        "dataClassification": {
          "type": "string",
          "minLength": 1
        },
        "status": {
          "type": "string",
          "minLength": 1
        },
        "citation": {
          "type": [
            "object",
            "null"
          ]
        },
        "selectionReason": {
          "type": "string",
          "minLength": 1
        },
        "exclusionReason": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    }
  }
}
