{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/bernstein-run/json-schema/bernstein-run-task-response-schema.json",
  "title": "TaskResponse",
  "description": "Serialised task returned by every task endpoint.",
  "x-generated": "2026-11-02",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/bernstein-run-openapi.yaml#/components/schemas/TaskResponse",
  "properties": {
    "id": {
      "type": "string",
      "title": "Id"
    },
    "title": {
      "type": "string",
      "title": "Title"
    },
    "description": {
      "type": "string",
      "title": "Description"
    },
    "role": {
      "type": "string",
      "title": "Role"
    },
    "tenant_id": {
      "type": "string",
      "title": "Tenant Id"
    },
    "priority": {
      "type": "integer",
      "title": "Priority"
    },
    "scope": {
      "type": "string",
      "title": "Scope"
    },
    "complexity": {
      "type": "string",
      "title": "Complexity"
    },
    "eu_ai_act_risk": {
      "type": "string",
      "title": "Eu Ai Act Risk"
    },
    "approval_required": {
      "type": "boolean",
      "title": "Approval Required"
    },
    "risk_level": {
      "type": "string",
      "title": "Risk Level"
    },
    "estimated_minutes": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Estimated Minutes"
    },
    "status": {
      "type": "string",
      "title": "Status"
    },
    "depends_on": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Depends On"
    },
    "parent_task_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Parent Task Id"
    },
    "depends_on_repo": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Depends On Repo"
    },
    "owned_files": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Owned Files"
    },
    "assigned_agent": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Assigned Agent"
    },
    "result_summary": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Result Summary"
    },
    "cell_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Cell Id"
    },
    "repo": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Repo"
    },
    "task_type": {
      "type": "string",
      "title": "Task Type"
    },
    "upgrade_details": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Upgrade Details"
    },
    "model": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Model"
    },
    "effort": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Effort"
    },
    "cli": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Cli"
    },
    "batch_eligible": {
      "type": "boolean",
      "title": "Batch Eligible",
      "default": false
    },
    "completion_signals": {
      "items": {
        "additionalProperties": {
          "type": "string"
        },
        "type": "object"
      },
      "type": "array",
      "title": "Completion Signals"
    },
    "slack_context": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Slack Context"
    },
    "metadata": {
      "additionalProperties": true,
      "type": "object",
      "title": "Metadata"
    },
    "created_at": {
      "type": "number",
      "title": "Created At"
    },
    "claimed_at": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Claimed At"
    },
    "completed_at": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Completed At"
    },
    "closed_at": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Closed At"
    },
    "deadline": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Deadline"
    },
    "progress_log": {
      "items": {
        "$ref": "#/$defs/ProgressEntry"
      },
      "type": "array",
      "title": "Progress Log"
    },
    "version": {
      "type": "integer",
      "title": "Version",
      "default": 1
    },
    "parent_session_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Parent Session Id"
    },
    "retry_count": {
      "type": "integer",
      "title": "Retry Count",
      "default": 0
    },
    "max_retries": {
      "type": "integer",
      "title": "Max Retries",
      "default": 3
    },
    "retry_delay_s": {
      "type": "number",
      "title": "Retry Delay S",
      "default": 0
    },
    "terminal_reason": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Terminal Reason"
    },
    "max_output_tokens": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Max Output Tokens"
    },
    "meta_messages": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Meta Messages"
    },
    "max_turns": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Max Turns"
    },
    "artifact_spec": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Artifact Spec"
    }
  },
  "type": "object",
  "required": [
    "id",
    "title",
    "description",
    "role",
    "tenant_id",
    "priority",
    "scope",
    "complexity",
    "eu_ai_act_risk",
    "approval_required",
    "risk_level",
    "estimated_minutes",
    "status",
    "depends_on",
    "parent_task_id",
    "depends_on_repo",
    "owned_files",
    "assigned_agent",
    "result_summary",
    "cell_id",
    "repo",
    "task_type",
    "upgrade_details",
    "model",
    "effort",
    "created_at"
  ],
  "$defs": {
    "ProgressEntry": {
      "properties": {
        "timestamp": {
          "type": "number",
          "title": "Timestamp"
        },
        "message": {
          "type": "string",
          "title": "Message"
        },
        "percent": {
          "type": "integer",
          "title": "Percent"
        }
      },
      "type": "object",
      "required": [
        "timestamp",
        "message",
        "percent"
      ],
      "title": "ProgressEntry",
      "description": "Single entry in a task's progress_log."
    }
  }
}