{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://stateofai/statebench/eval_result_v1.schema.json",
  "title": "EvalResultV1",
  "description": "One normalized enterprise eval attempt emitted by a repo-local runner.",
  "type": "object",
  "required": [
    "schema_version",
    "result_id",
    "run_id",
    "team_id",
    "repo_path",
    "commit_sha",
    "pack_id",
    "pack_version",
    "task_id",
    "attempt_id",
    "workflow_family",
    "risk_tier",
    "harness",
    "model",
    "runtime_context",
    "attached_tools",
    "scores",
    "failures",
    "artifact_refs",
    "created_at_utc"
  ],
  "additionalProperties": false,
  "properties": {
    "schema_version": {"const": "eval_result_v1"},
    "result_id": {"type": "string"},
    "run_id": {"type": "string"},
    "team_id": {"type": "string"},
    "repo_path": {"type": "string"},
    "commit_sha": {"type": "string"},
    "pipeline_id": {"type": ["string", "null"]},
    "job_id": {"type": ["string", "null"]},
    "pack_id": {"type": "string"},
    "pack_version": {"type": "string"},
    "task_id": {"type": "string"},
    "attempt_id": {"type": "string"},
    "persona": {"type": ["string", "null"]},
    "workflow_family": {"type": "string"},
    "risk_tier": {
      "type": "string",
      "enum": ["low", "medium", "high", "critical"]
    },
    "harness": {
      "type": "object",
      "required": ["name", "version", "runner_kind"],
      "additionalProperties": false,
      "properties": {
        "name": {"type": "string"},
        "version": {"type": "string"},
        "runner_kind": {
          "type": "string",
          "enum": ["framework_cli", "framework_sdk", "pytest_plugin", "custom_runner", "provider_api", "notebook", "manual_review"]
        },
        "native_export_ref": {"type": ["string", "null"]},
        "native_export_hash": {"type": ["string", "null"]}
      }
    },
    "model": {
      "type": "object",
      "required": ["provider", "name", "version"],
      "additionalProperties": false,
      "properties": {
        "provider": {"type": "string"},
        "name": {"type": "string"},
        "version": {"type": "string"},
        "weights_revision": {"type": ["string", "null"]},
        "adapter_id": {"type": ["string", "null"]},
        "serving_stack": {"type": ["string", "null"]},
        "tokenizer": {"type": ["string", "null"]},
        "chat_template": {"type": ["string", "null"]}
      }
    },
    "runtime_context": {
      "type": "object",
      "required": [
        "prompt_template_version",
        "retrieval_index_version",
        "tool_catalog_version",
        "judge_model_version",
        "execution_environment"
      ],
      "additionalProperties": {"type": ["string", "number", "boolean", "null"]},
      "properties": {
        "prompt_template_version": {"type": ["string", "null"]},
        "retrieval_index_version": {"type": ["string", "null"]},
        "tool_catalog_version": {"type": ["string", "null"]},
        "judge_model_version": {"type": ["string", "null"]},
        "execution_environment": {"type": ["string", "null"]},
        "dependency_lock_ref": {"type": ["string", "null"]},
        "dependency_lock_hash": {"type": ["string", "null"]},
        "container_image_ref": {"type": ["string", "null"]},
        "container_image_digest": {"type": ["string", "null"]}
      }
    },
    "attached_tools": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["tool_id", "tool_type", "name", "version", "source"],
        "additionalProperties": false,
        "properties": {
          "tool_id": {"type": "string"},
          "tool_type": {
            "type": "string",
            "enum": ["retriever", "mcp_server", "function", "code_interpreter", "browser", "database", "file_system", "shell", "agent", "other"]
          },
          "name": {"type": "string"},
          "version": {"type": ["string", "null"]},
          "source": {"type": "string"},
          "schema_ref": {"type": ["string", "null"]},
          "schema_hash": {"type": ["string", "null"]},
          "permission_profile": {"type": ["string", "null"]},
          "network_access": {"type": ["string", "null"], "enum": ["none", "allowlist", "workspace", "internet", null]},
          "data_scope": {"type": ["string", "null"]}
        }
      }
    },
    "trace_ref": {"type": ["string", "null"]},
    "source_bundle_id": {"type": ["string", "null"]},
    "scores": {
      "type": "object",
      "additionalProperties": {
        "type": "object",
        "required": ["score", "passed"],
        "additionalProperties": false,
        "properties": {
          "score": {"type": ["number", "string", "boolean", "null"]},
          "threshold": {"type": ["number", "string", "boolean", "null"]},
          "passed": {"type": "boolean"},
          "metric_type": {"type": ["string", "null"]},
          "judge_model": {"type": ["string", "null"]},
          "rubric_version": {"type": ["string", "null"]},
          "reason_ref": {"type": ["string", "null"]}
        }
      }
    },
    "failures": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["code", "domain", "severity", "owner_role"],
        "additionalProperties": false,
        "properties": {
          "code": {"type": "string"},
          "domain": {"type": "string"},
          "severity": {
            "type": "string",
            "enum": ["info", "warning", "merge_blocking", "release_blocking", "incident"]
          },
          "owner_role": {"type": "string"},
          "evidence_ref": {"type": ["string", "null"]},
          "remediation_status": {
            "type": "string",
            "enum": ["open", "accepted_risk", "fixed", "false_positive", "deferred"]
          }
        }
      }
    },
    "artifact_refs": {
      "type": "object",
      "additionalProperties": {"type": "string"}
    },
    "created_at_utc": {"type": "string", "format": "date-time"}
  }
}
