{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://workspai.dev/contracts/workspace-intelligence/agent-framework-conformance-report.v2.json",
  "title": "Workspai Agent Framework Conformance Report v2",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "protocolVersion",
    "generatedAt",
    "adapter",
    "frameworkVersion",
    "cliVersion",
    "environment",
    "checks",
    "summary",
    "verdict",
    "blockers",
    "limitations"
  ],
  "properties": {
    "schemaVersion": {
      "const": "workspai.agent-framework-conformance-report.v2"
    },
    "protocolVersion": {
      "const": "workspai.agent-framework-adapter-protocol.v1"
    },
    "generatedAt": {
      "type": "string",
      "format": "date-time"
    },
    "adapter": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "version",
        "manifestSha256",
        "implementationSha256"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?$"
        },
        "version": {
          "type": "string",
          "minLength": 1
        },
        "manifestSha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "implementationSha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        }
      }
    },
    "frameworkVersion": {
      "type": "string",
      "minLength": 1
    },
    "cliVersion": {
      "type": "string",
      "minLength": 1
    },
    "environment": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "platform",
        "architecture",
        "runtime",
        "runtimeVersion"
      ],
      "properties": {
        "platform": {
          "enum": [
            "linux",
            "darwin",
            "win32"
          ]
        },
        "architecture": {
          "type": "string",
          "minLength": 1
        },
        "runtime": {
          "type": "string",
          "minLength": 1
        },
        "runtimeVersion": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "checks": {
      "type": "array",
      "minItems": 18,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "status",
          "required",
          "summary",
          "evidencePaths",
          "durationMs"
        ],
        "properties": {
          "id": {
            "enum": [
              "manifest-schema",
              "protocol-version",
              "capability-truth",
              "detection-positive",
              "detection-negative",
              "scaffold-plan-safety",
              "attach-plan-safety",
              "managed-file-ownership",
              "user-file-preservation",
              "path-containment",
              "secret-non-persistence",
              "context-generation-binding",
              "mutation-gateway",
              "verification-binding",
              "failure-isolation",
              "idempotency",
              "offline-posture",
              "cross-platform-paths"
            ]
          },
          "status": {
            "enum": [
              "passed",
              "failed",
              "skipped"
            ]
          },
          "required": {
            "type": "boolean"
          },
          "summary": {
            "type": "string",
            "minLength": 1
          },
          "evidencePaths": {
            "type": "array",
            "minItems": 1,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "minLength": 1,
              "not": {
                "anyOf": [
                  {
                    "pattern": "^/"
                  },
                  {
                    "pattern": "^[A-Za-z]:[\\\\/]"
                  },
                  {
                    "pattern": "(^|[\\\\/])\\.\\.([\\\\/]|$)"
                  }
                ]
              }
            }
          },
          "durationMs": {
            "type": "number",
            "minimum": 0
          }
        }
      }
    },
    "summary": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "passed",
        "failed",
        "skipped",
        "required"
      ],
      "properties": {
        "passed": {
          "type": "integer",
          "minimum": 0
        },
        "failed": {
          "type": "integer",
          "minimum": 0
        },
        "skipped": {
          "type": "integer",
          "minimum": 0
        },
        "required": {
          "type": "integer",
          "minimum": 18
        }
      }
    },
    "verdict": {
      "enum": [
        "admitted",
        "blocked"
      ]
    },
    "blockers": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      },
      "minItems": 0,
      "uniqueItems": true
    },
    "limitations": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      },
      "minItems": 0,
      "uniqueItems": true
    }
  },
  "allOf": [
    {
      "if": {
        "properties": {
          "verdict": {
            "const": "blocked"
          }
        },
        "required": [
          "verdict"
        ]
      },
      "then": {
        "properties": {
          "blockers": {
            "type": "array",
            "minItems": 1
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "verdict": {
            "const": "admitted"
          }
        },
        "required": [
          "verdict"
        ]
      },
      "then": {
        "properties": {
          "blockers": {
            "type": "array",
            "maxItems": 0
          }
        }
      }
    }
  ]
}
