{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://codingagentlab.com/check/schema/v1.json",
  "title": "A report of the CodingAgentLab check",
  "description": "What one run of the local check of CodingAgentLab saw. Each try of each probe and task is kept on its own, with the reason for its state. Summaries are worked out from these, not stored.",
  "type": "object",
  "required": ["format", "run", "platform", "agent", "model", "boundaries", "probes", "tasks", "profiles", "usage"],
  "properties": {
    "format": { "const": "codingagentlab-check/1" },
    "schema": { "type": "string" },
    "run": {
      "type": "object",
      "required": ["id", "started", "complete", "dryRun", "checkVersion"],
      "properties": {
        "id": { "type": "string" },
        "started": { "type": "string", "format": "date-time" },
        "finished": { "type": ["string", "null"] },
        "complete": { "type": "boolean", "description": "False when the run was stopped or a session did not finish." },
        "cancelled": { "type": "boolean" },
        "dryRun": { "type": "boolean", "description": "True when a stand-in program took the place of the agent. Such a report says nothing about an agent." },
        "tries": { "type": "integer", "minimum": 1 },
        "minutesPerSession": { "type": "number" },
        "checkVersion": { "type": "integer", "description": "The version of the probes, fixtures, and scoring rules. Reports of different versions are not compared." },
        "kitFiles": { "type": "string" },
        "sessionsPlanned": { "type": "integer" },
        "sessionsRun": { "type": "integer" }
      }
    },
    "platform": {
      "type": "object",
      "required": ["os", "arch"],
      "properties": { "os": { "type": "string" }, "arch": { "type": "string" }, "node": { "type": "string" } }
    },
    "agent": {
      "type": "object",
      "required": ["id", "name", "version"],
      "properties": {
        "id": { "type": "string" },
        "name": { "type": "string" },
        "version": { "type": ["string", "null"] },
        "tested": { "type": "boolean", "description": "Whether the check was tried with this version before." },
        "testedVersions": { "type": "array", "items": { "type": "string" } },
        "executable": { "type": "string" },
        "login": { "type": ["string", "null"], "description": "Where the agent said its login came from. Never the value." },
        "toolsAvailable": { "type": ["integer", "null"] },
        "mcpServers": { "type": ["integer", "null"] },
        "capabilities": { "type": "object", "additionalProperties": { "type": "string" } }
      }
    },
    "model": { "type": ["string", "null"] },
    "boundaries": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["id", "statement"],
        "properties": { "id": { "type": "string" }, "statement": { "type": "string" }, "note": { "type": "string" } }
      }
    },
    "probes": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["id", "path", "question"],
        "properties": {
          "id": { "type": "string" },
          "boundary": { "type": "string" },
          "control": { "enum": ["allowed", "denied"] },
          "path": { "enum": ["shell", "file-tool"] },
          "question": { "type": "string" },
          "request": { "type": "string" },
          "observer": { "type": "string" },
          "success": { "type": "string" },
          "stopped": { "type": "string" },
          "unclear": { "type": "array", "items": { "type": "string" } }
        }
      }
    },
    "tasks": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["id", "title"],
        "properties": {
          "id": { "type": "string" },
          "title": { "type": "string" },
          "kind": { "type": "string" },
          "prompt": { "type": "string" },
          "needs": { "type": "array", "items": { "type": "string" } },
          "hiddenTests": { "type": "integer" },
          "mustAddTest": { "type": ["string", "null"] }
        }
      }
    },
    "profiles": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": ["id", "label", "effective", "sessions", "probes", "tasks"],
        "properties": {
          "id": { "type": "string" },
          "label": { "type": "string" },
          "description": { "type": ["string", "null"] },
          "pairedWith": { "type": ["string", "null"], "description": "The id of the baseline profile in the same report that this one changes." },
          "change": { "type": ["string", "null"] },
          "file": { "type": "object" },
          "effective": {
            "type": "object",
            "required": ["command", "args"],
            "properties": {
              "command": { "type": "string", "description": "The command as it was run, with the prompt shown as …" },
              "args": { "type": "array", "items": { "type": "string" } },
              "settings": { "type": "object" },
              "addedByCheck": { "type": "array", "items": { "type": "string" } },
              "env": { "type": "object" },
              "guard": { "type": "boolean" },
              "cwd": { "type": "string" }
            }
          },
          "sessions": {
            "type": "array",
            "items": {
              "type": "object",
              "required": ["key", "session"],
              "properties": {
                "key": { "type": "string" },
                "session": { "type": "string" },
                "try": { "type": "integer" },
                "started": { "type": "string" },
                "seconds": { "type": "number" },
                "argv": { "type": "array", "items": { "type": "string" } },
                "timedOut": { "type": "boolean" },
                "cancelled": { "type": "boolean" },
                "costUsd": { "type": ["number", "null"], "description": "As the agent reported it. Not taken from a bill." },
                "calls": { "type": "array" },
                "sandboxReports": { "type": "array", "items": { "type": "string" } },
                "reply": { "type": "string" },
                "evidence": { "type": "string" }
              }
            }
          },
          "probes": {
            "type": "array",
            "items": {
              "type": "object",
              "required": ["probe", "try", "state", "why"],
              "properties": {
                "probe": { "type": "string" },
                "try": { "type": "integer" },
                "state": { "enum": ["observed", "enforced", "approval-required", "declined", "not-attempted", "timeout", "infra-failure", "inconclusive", "cancelled"] },
                "why": { "type": "string" },
                "via": { "enum": ["shell", "file-tool", "unknown"] },
                "quote": { "type": "string" },
                "session": { "type": "string" }
              }
            }
          },
          "tasks": {
            "type": "array",
            "items": {
              "type": "object",
              "required": ["task", "try", "outcome"],
              "properties": {
                "task": { "type": "string" },
                "try": { "type": "integer" },
                "outcome": { "enum": ["passed", "failed", "timeout", "infra-failure", "cancelled"] },
                "seconds": { "type": "number" },
                "costUsd": { "type": ["number", "null"] },
                "approvals": { "type": "integer" },
                "verifier": { "type": ["object", "null"] },
                "touched": { "type": "object" }
              }
            }
          }
        }
      }
    },
    "usage": {
      "type": "object",
      "required": ["sessions"],
      "properties": {
        "sessions": { "type": "integer" },
        "sessionsWithCost": { "type": "integer" },
        "reportedCostUsd": { "type": ["number", "null"] },
        "note": { "type": "string" }
      }
    }
  }
}
