{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/thread-page/json-schema/thread-page-executor-request-schema.json",
  "title": "ExecutorRequest",
  "x-generated": "2026-11-07",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/thread-page-openapi.json#/components/schemas/ExecutorRequest",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "state": {
      "$ref": "#/$defs/RequestStateEnum"
    },
    "test": {
      "type": "boolean",
      "description": "A Test request from the owner: no note, nothing is written."
    },
    "handle": {
      "type": "string",
      "description": "The name the note was sent to, as sent."
    },
    "addressed_to": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Every name the note was sent to, as sent, yours included, in the order named: others may work on the same note, each answering on its own. Empty for a Test request."
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "expires_at": {
      "type": "string",
      "format": "date-time"
    },
    "thread": {
      "oneOf": [
        {
          "$ref": "#/$defs/ThreadRef"
        },
        {
          "type": "null"
        }
      ],
      "description": "Null for a Test request."
    },
    "note": {
      "oneOf": [
        {
          "$ref": "#/$defs/RequestNote"
        },
        {
          "type": "null"
        }
      ],
      "description": "The note as it was sent, whoever edited it since; null for a Test request, once the note left (Trash, Delete permanently) and when its sent version is no longer kept."
    },
    "claim_id": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid",
      "description": "The claim_id it was claimed with; null until it is claimed, and null for a claim the server minted (over MCP), which only the call that made it sees."
    },
    "claimed_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "When a run claimed it; null until it is claimed."
    },
    "reply": {
      "$ref": "#/$defs/RequestReply"
    },
    "answers": {
      "oneOf": [
        {
          "$ref": "#/$defs/RequestAnswers"
        },
        {
          "type": "null"
        }
      ],
      "description": "Set when the owner chose Answer on a question you asked (needs_input): this note answers that request, which ends (state cancelled, code answered) once you claim this one."
    }
  },
  "required": [
    "addressed_to",
    "answers",
    "claim_id",
    "claimed_at",
    "created_at",
    "expires_at",
    "handle",
    "id",
    "note",
    "reply",
    "state",
    "test",
    "thread"
  ],
  "$defs": {
    "RequestAnswers": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "description": "The earlier request that asked a question."
        },
        "question_note_id": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid"
        }
      },
      "required": [
        "id",
        "question_note_id"
      ]
    },
    "RequestNote": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "content_revision": {
          "type": "integer",
          "description": "The note now; higher than sent_content_revision when it was edited since."
        },
        "sent_content_revision": {
          "type": "integer",
          "description": "The note as it was sent."
        },
        "text": {
          "type": "string",
          "description": "The note as it was sent."
        },
        "markdown": {
          "type": "string",
          "description": "The note as it was sent."
        }
      },
      "required": [
        "content_revision",
        "id",
        "markdown",
        "sent_content_revision",
        "text",
        "url"
      ]
    },
    "RequestReply": {
      "type": "object",
      "properties": {
        "status_url": {
          "type": "string",
          "format": "uri"
        },
        "result_url": {
          "type": "string",
          "format": "uri"
        }
      },
      "required": [
        "result_url",
        "status_url"
      ]
    },
    "RequestStateEnum": {
      "enum": [
        "queued",
        "delivered",
        "running",
        "needs_input",
        "completed",
        "failed",
        "cancellation_requested",
        "cancelled",
        "expired",
        "outcome_unknown"
      ],
      "type": "string",
      "description": "* `queued` - queued\n* `delivered` - delivered\n* `running` - running\n* `needs_input` - needs_input\n* `completed` - completed\n* `failed` - failed\n* `cancellation_requested` - cancellation_requested\n* `cancelled` - cancelled\n* `expired` - expired\n* `outcome_unknown` - outcome_unknown"
    },
    "ThreadRef": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "title": {
          "type": "string",
          "description": "The thread's name as the app shows it: its own, or for a thread still called New thread, the first line of words of its first note, without the @name it was sent to."
        },
        "url": {
          "type": "string",
          "format": "uri"
        }
      },
      "required": [
        "id",
        "title",
        "url"
      ]
    }
  }
}