{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/pho-chat/json-schema/pho-chat-run-detail-schema.json",
  "title": "RunDetail",
  "x-generated": "2026-11-21",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/pho-chat-openapi.json#/components/schemas/RunDetail",
  "allOf": [
    {
      "$ref": "#/$defs/Run"
    },
    {
      "type": "object",
      "properties": {
        "artifacts": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Artifact"
          }
        },
        "pending_approvals": {
          "type": "integer"
        }
      }
    }
  ],
  "$defs": {
    "Artifact": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "object": {
          "const": "artifact"
        },
        "run_id": {
          "type": "string",
          "format": "uuid"
        },
        "type": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "status": {
          "type": "string"
        },
        "created_at": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "Run": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "object": {
          "const": "run"
        },
        "agent": {
          "type": [
            "string",
            "null"
          ]
        },
        "status": {
          "type": "string",
          "enum": [
            "queued",
            "planning",
            "awaiting_plan_approval",
            "running",
            "awaiting_approval",
            "paused",
            "needs_user_input",
            "completed",
            "failed",
            "cancelled"
          ]
        },
        "mode": {
          "type": "string"
        },
        "model": {
          "type": [
            "string",
            "null"
          ]
        },
        "credential_source": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "byok",
            "platform",
            null
          ]
        },
        "goal": {
          "type": [
            "string",
            "null"
          ]
        },
        "usage": {},
        "result": {},
        "error": {
          "type": [
            "string",
            "null"
          ]
        },
        "last_seq": {
          "type": "integer"
        },
        "webhook_url": {
          "type": [
            "string",
            "null"
          ]
        },
        "created_at": {
          "type": "string",
          "format": "date-time"
        },
        "started_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "finished_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        }
      }
    }
  }
}