{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/elicit/json-schema/elicit-routine-run-list-schema.json",
  "title": "RoutineRunList",
  "x-generated": "2026-11-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/elicit-openapi.json#/components/schemas/RoutineRunList",
  "type": "object",
  "properties": {
    "runs": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "taskId": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "running",
              "output_ready",
              "no_output",
              "failed",
              "cancelled"
            ]
          },
          "startedAt": {
            "type": "string"
          },
          "completedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "result": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "version": {
                "type": "number",
                "const": 1
              },
              "summary": {
                "type": "string",
                "maxLength": 1000
              },
              "effectRefs": {
                "type": "array",
                "items": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "message"
                        },
                        "toolCallId": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "type",
                        "toolCallId"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "artifact"
                        },
                        "artifactKey": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "type",
                        "artifactKey"
                      ]
                    }
                  ]
                },
                "maxItems": 50,
                "default": []
              },
              "startedBeforeLifecycleChange": {
                "type": "boolean"
              }
            },
            "required": [
              "version",
              "effectRefs"
            ]
          },
          "failure": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "version": {
                "type": "number",
                "const": 1
              },
              "code": {
                "type": "string",
                "enum": [
                  "dispatch_failed",
                  "timeout",
                  "prerequisite_task_owner_access",
                  "prerequisite_session_unavailable",
                  "prerequisite_session_owner_ineligible",
                  "agent_turn_failed",
                  "output_conflict",
                  "unknown"
                ]
              },
              "message": {
                "type": "string",
                "maxLength": 500
              }
            },
            "required": [
              "version",
              "code"
            ]
          }
        },
        "required": [
          "id",
          "taskId",
          "status",
          "startedAt",
          "completedAt",
          "result",
          "failure"
        ]
      }
    },
    "nextCursor": {
      "type": [
        "string",
        "null"
      ],
      "description": "Cursor for the next page, or null at the end."
    }
  },
  "required": [
    "runs",
    "nextCursor"
  ]
}