{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/wordis-bond-com/json-schema/wordis-bond-com-test-run-schema.json",
  "title": "TestRun",
  "x-generated": "2026-11-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/wordis-bond-com-openapi.json#/components/schemas/TestRun",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "accountId": {
      "type": "string",
      "format": "uuid"
    },
    "suiteId": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid"
    },
    "status": {
      "type": "string",
      "enum": [
        "queued",
        "running",
        "completed",
        "failed"
      ]
    },
    "transport": {
      "type": "string"
    },
    "language": {
      "type": "string"
    },
    "persona": {
      "type": [
        "object",
        "null"
      ]
    },
    "targetAgent": {
      "oneOf": [
        {
          "$ref": "#/$defs/TargetAgent"
        },
        {
          "type": "null"
        }
      ]
    },
    "score": {
      "type": [
        "integer",
        "null"
      ],
      "minimum": 0,
      "maximum": 100
    },
    "passed": {
      "type": [
        "boolean",
        "null"
      ]
    },
    "scorecard": {
      "oneOf": [
        {
          "$ref": "#/$defs/Scorecard"
        },
        {
          "type": "null"
        }
      ]
    },
    "metrics": {
      "oneOf": [
        {
          "$ref": "#/$defs/RunMetrics"
        },
        {
          "type": "null"
        }
      ]
    },
    "transcript": {
      "type": [
        "string",
        "null"
      ]
    },
    "recordingUrl": {
      "type": [
        "string",
        "null"
      ],
      "description": "BYOS recording pointer — a URL into YOUR OWN storage when the run recorded (never wordis-bond storage). Null unless the run opted in with `record: true`. See metrics.recording for the tee state (stored/truncated/failed)."
    },
    "mediaWebSocketUrl": {
      "type": "string",
      "description": "Only on a live `direct` run — the tokenized WS your agent-side harness dials."
    },
    "startedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "endedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    }
  },
  "required": [
    "id",
    "status"
  ],
  "$defs": {
    "RunMetrics": {
      "type": "object",
      "properties": {
        "latencyMs": {
          "type": "object",
          "properties": {
            "p50": {
              "type": "number"
            },
            "p95": {
              "type": "number"
            },
            "max": {
              "type": "number"
            }
          }
        },
        "wer": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "maximum": 1,
          "description": "Script-adherence error across pinned scenario wording, or null if nothing was pinned. This is not transcription word-error rate unless a caller supplies an STT reference transcript."
        },
        "bargeInCount": {
          "type": "integer"
        },
        "turnCount": {
          "type": "integer"
        },
        "taskCompletion": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        "sentiment": {
          "type": "number",
          "minimum": -1,
          "maximum": 1
        }
      }
    },
    "Scorecard": {
      "type": "object",
      "description": "The judged result. `score` is the 0–100 overall; `layers` carry per-dimension detail.",
      "properties": {
        "score": {
          "type": "number",
          "minimum": 0,
          "maximum": 100
        },
        "passed": {
          "type": "boolean"
        },
        "summary": {
          "type": "string"
        },
        "sentiment": {
          "type": "number",
          "minimum": -1,
          "maximum": 1
        },
        "taskCompletion": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        "layers": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "score": {
                "type": "number",
                "minimum": 0,
                "maximum": 100
              },
              "passed": {
                "type": "boolean"
              },
              "rationale": {
                "type": "string"
              },
              "assertions": {
                "type": "array",
                "items": {
                  "type": "object"
                }
              }
            }
          }
        }
      },
      "required": [
        "score",
        "passed"
      ]
    },
    "TargetAgent": {
      "type": "object",
      "description": "The voice agent under test (a system YOU control). `direct` = SIP/WebRTC (near-zero cost, all plans); `pstn` = a real carrier call (pro+). The hosted demo target is `{transport:\"direct\", peerId:\"wb-demo-dental\"}`.",
      "properties": {
        "transport": {
          "type": "string",
          "enum": [
            "pstn",
            "webrtc",
            "direct",
            "sip"
          ]
        },
        "toNumber": {
          "type": "string",
          "description": "E.164 number to dial (required for a pstn target)."
        },
        "peerId": {
          "type": "string",
          "description": "Hosted-agent id (e.g. \"wb-demo-dental\"), a direct peer label, or — for a `sip` target — the SIP URI."
        },
        "sipUri": {
          "type": "string",
          "description": "For a `sip` target: the agent SIP URI (`sip:` / `sips:`)."
        }
      },
      "required": [
        "transport"
      ]
    }
  }
}