{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/hyperresearch-ai/json-schema/hyperresearch-ai-operator-run-detail-schema.json",
  "title": "OperatorRunDetail",
  "x-generated": "2026-11-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/hyperresearch-ai-openapi.json#/components/schemas/OperatorRunDetail",
  "type": "object",
  "properties": {
    "run": {
      "$ref": "#/$defs/OperatorRunRow"
    },
    "manifest": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "status": {
          "type": "string"
        },
        "profile": {
          "type": "string"
        },
        "started_at": {
          "type": [
            "string",
            "null"
          ]
        },
        "updated_at": {
          "type": [
            "string",
            "null"
          ]
        },
        "blocked_on": {
          "type": [
            "string",
            "null"
          ]
        },
        "steps_total": {
          "type": "integer"
        },
        "steps_done": {
          "type": "integer"
        },
        "steps_unfinished": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "step": {
                "type": "string"
              },
              "status": {
                "type": "string"
              }
            },
            "required": [
              "step",
              "status"
            ]
          }
        },
        "chapters": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "status": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "title": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "id",
              "status",
              "title"
            ]
          }
        },
        "spend": {
          "type": [
            "object",
            "null"
          ],
          "additionalProperties": {}
        },
        "internal": {
          "description": "`x_cloud.internal`, which the customer manifest strips. Operator only."
        }
      },
      "required": [
        "status",
        "profile",
        "started_at",
        "updated_at",
        "blocked_on",
        "steps_total",
        "steps_done",
        "steps_unfinished",
        "chapters",
        "spend"
      ],
      "description": "Null for a run that never reached `init`: queued, or launched and gone."
    },
    "instance": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "The Workflow instance that was asked: the run id, or `<run id>-finish<n>` for a run whose `finish` was re-entered (0039)."
        },
        "status": {
          "type": "string",
          "description": "The Workflow engine's own state: `queued`, `running`, `paused`, `waiting`, `waitingForPause`, `errored`, `terminated`, `complete`, `unknown`. `errored`/`terminated`/`complete` against an active `run.status` is a run whose worker is gone — what the instance watchdog settles."
        },
        "error": {
          "type": [
            "string",
            "null"
          ],
          "description": "The engine's error text on an `errored` instance, e.g. \"Too many API requests by single Worker invocation\". Operator only; it never reaches a customer sentence."
        }
      },
      "required": [
        "id",
        "status",
        "error"
      ],
      "description": "What the Workflow engine says about this run. The one record not written BY the run — when a run dies without executing any more of our code, the row and the manifest both still say it is fine and this is the only witness (fault 71). Null when there is no instance to ask, which is the normal answer for a queued run."
    },
    "counts": {
      "type": "object",
      "properties": {
        "counted": {
          "type": "integer"
        },
        "truncated": {
          "type": "boolean",
          "description": "True when the log is longer than the bounded walk; the counts are then a floor, not a total."
        },
        "last_seq": {
          "type": "integer"
        },
        "provider_rejected": {
          "type": "integer"
        },
        "fanout": {
          "type": "integer",
          "description": "`fanout` plus `wave-fanout`."
        },
        "error": {
          "type": "integer"
        },
        "warning": {
          "type": "integer"
        },
        "by_kind": {
          "type": "object",
          "additionalProperties": {
            "type": "integer"
          }
        }
      },
      "required": [
        "counted",
        "truncated",
        "last_seq",
        "provider_rejected",
        "fanout",
        "error",
        "warning",
        "by_kind"
      ],
      "description": "Every kind that appears in the run log, with how often."
    },
    "clarification": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "status": {
          "type": [
            "string",
            "null"
          ]
        },
        "resolution": {
          "type": [
            "string",
            "null"
          ]
        },
        "skip_reason": {
          "type": [
            "string",
            "null"
          ],
          "description": "Why the ambiguity assessment was skipped, from `runs.clarifications_json`. This is the durable trace of the `clarify_assessment_skipped` log line, which is otherwise only a `console.warn`."
        },
        "round": {
          "type": [
            "integer",
            "null"
          ]
        },
        "questions": {
          "type": "integer"
        },
        "answers": {
          "type": "integer"
        }
      },
      "required": [
        "status",
        "resolution",
        "skip_reason",
        "round",
        "questions",
        "answers"
      ]
    }
  },
  "required": [
    "run",
    "manifest",
    "instance",
    "counts",
    "clarification"
  ],
  "$defs": {
    "OperatorRunRow": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "workspace_id": {
          "type": "string"
        },
        "status": {
          "type": "string"
        },
        "tier": {
          "type": "string"
        },
        "profile": {
          "type": "string"
        },
        "channel": {
          "type": "string"
        },
        "created_at": {
          "type": "string"
        },
        "started_at": {
          "type": [
            "string",
            "null"
          ]
        },
        "finished_at": {
          "type": [
            "string",
            "null"
          ]
        },
        "progress_at": {
          "type": [
            "string",
            "null"
          ]
        },
        "duration_ms": {
          "type": [
            "integer",
            "null"
          ]
        },
        "step_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "step_name": {
          "type": [
            "string",
            "null"
          ]
        },
        "steps_done": {
          "type": [
            "integer",
            "null"
          ]
        },
        "steps_total": {
          "type": [
            "integer",
            "null"
          ]
        },
        "chapters_total": {
          "type": [
            "integer",
            "null"
          ]
        },
        "blocked_on": {
          "type": [
            "string",
            "null"
          ]
        },
        "failure_reason": {
          "type": [
            "string",
            "null"
          ]
        },
        "failure_detail": {
          "type": [
            "string",
            "null"
          ],
          "description": "The raw platform/vendor text behind the failure. Operator surface: this is exactly the field the customer-facing run view replaces with a sentence from the failure-reason table."
        },
        "failure_request_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "sources_fetched": {
          "type": [
            "integer",
            "null"
          ]
        },
        "notes_written": {
          "type": [
            "integer",
            "null"
          ]
        },
        "candidates_seen": {
          "type": [
            "integer",
            "null"
          ]
        },
        "fetch_attempts": {
          "type": [
            "integer",
            "null"
          ]
        },
        "report_words": {
          "type": [
            "integer",
            "null"
          ]
        },
        "price_cents": {
          "type": [
            "integer",
            "null"
          ]
        },
        "billed": {
          "type": [
            "integer",
            "null"
          ]
        },
        "launch_state": {
          "type": [
            "string",
            "null"
          ]
        },
        "launch_attempts": {
          "type": [
            "integer",
            "null"
          ]
        },
        "project_id": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "id",
        "workspace_id",
        "status",
        "tier",
        "profile",
        "channel",
        "created_at",
        "started_at",
        "finished_at",
        "progress_at",
        "duration_ms",
        "step_id",
        "step_name",
        "steps_done",
        "steps_total",
        "chapters_total",
        "blocked_on",
        "failure_reason",
        "failure_detail",
        "failure_request_id",
        "sources_fetched",
        "notes_written",
        "candidates_seen",
        "fetch_attempts",
        "report_words",
        "price_cents",
        "billed",
        "launch_state",
        "launch_attempts",
        "project_id"
      ]
    }
  }
}