{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/darwin-so/json-schema/darwin-so-send-message-body-schema.json",
  "title": "SendMessageBody",
  "x-generated": "2026-11-05",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/darwin-so-openapi.json#/components/schemas/SendMessageBody",
  "type": "object",
  "oneOf": [
    {
      "type": "object",
      "properties": {
        "messageType": {
          "type": "string",
          "const": "input_response",
          "description": "The kind of message or exact confirmation to append."
        },
        "messageContent": {
          "type": "object",
          "properties": {
            "request": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200,
              "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$",
              "description": "Exact pending input request returned by get_thread."
            },
            "arguments": {
              "type": "object",
              "propertyNames": {
                "type": "string",
                "maxLength": 200
              },
              "additionalProperties": {},
              "description": "Requested information matching that request schema. This continues the same operation; it is not a new action."
            }
          },
          "required": [
            "request",
            "arguments"
          ],
          "additionalProperties": false,
          "description": "The text or typed payload for this message type."
        },
        "agent": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200,
          "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$",
          "description": "Optional agent in your account that owns this side of the thread."
        },
        "idempotencyKey": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200,
          "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$",
          "description": "Optional stable key for this message. Reuse it with unchanged inputs after a timeout."
        }
      },
      "required": [
        "messageType",
        "messageContent"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "messageType": {
          "type": "string",
          "const": "message",
          "description": "The kind of message or exact confirmation to append."
        },
        "messageContent": {
          "type": "string",
          "minLength": 1,
          "maxLength": 32000,
          "description": "The text or typed payload for this message type."
        },
        "agent": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200,
          "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$",
          "description": "Optional agent in your account that owns this side of the thread."
        },
        "attachments": {
          "maxItems": 19,
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "image",
                  "audio",
                  "video",
                  "file"
                ]
              },
              "asset": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200,
                "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$"
              }
            },
            "required": [
              "type",
              "asset"
            ],
            "additionalProperties": false
          },
          "description": "Optional validated assets to include with an ordinary message."
        },
        "idempotencyKey": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200,
          "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$",
          "description": "Optional stable key for this message. Reuse it with unchanged inputs after a timeout."
        }
      },
      "required": [
        "messageType",
        "messageContent"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "messageType": {
          "type": "string",
          "const": "action_request",
          "description": "The kind of message or exact confirmation to append."
        },
        "messageContent": {
          "type": "object",
          "properties": {
            "operationId": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200,
              "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$",
              "description": "Exact executable operation identifier returned by Search or get_thread."
            },
            "arguments": {
              "type": "object",
              "propertyNames": {
                "type": "string",
                "maxLength": 200
              },
              "additionalProperties": {},
              "description": "Arguments for that operation, matching its advertised input schema. Never include credentials or payment details."
            },
            "account": {
              "description": "Optional saved external-account reference. This is an opaque Darwin ID, never a token or secret.",
              "type": "string",
              "minLength": 1,
              "maxLength": 200,
              "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$"
            }
          },
          "required": [
            "operationId",
            "arguments"
          ],
          "additionalProperties": false,
          "description": "The text or typed payload for this message type."
        },
        "agent": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200,
          "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$",
          "description": "Optional agent in your account that owns this side of the thread."
        },
        "idempotencyKey": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200,
          "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$",
          "description": "Optional stable key for this message. Reuse it with unchanged inputs after a timeout."
        }
      },
      "required": [
        "messageType",
        "messageContent"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "messageType": {
          "type": "string",
          "const": "action_confirmation",
          "description": "The kind of message or exact confirmation to append."
        },
        "messageContent": {
          "type": "object",
          "properties": {
            "request": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200,
              "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$",
              "description": "Exact immutable request identifier returned by get_thread."
            }
          },
          "required": [
            "request"
          ],
          "additionalProperties": false,
          "description": "The text or typed payload for this message type."
        },
        "agent": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200,
          "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$",
          "description": "Optional agent in your account that owns this side of the thread."
        },
        "idempotencyKey": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200,
          "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$",
          "description": "Optional stable key for this message. Reuse it with unchanged inputs after a timeout."
        }
      },
      "required": [
        "messageType",
        "messageContent"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "messageType": {
          "type": "string",
          "const": "approval_confirmation",
          "description": "The kind of message or exact confirmation to append."
        },
        "messageContent": {
          "type": "object",
          "properties": {
            "request": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200,
              "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$",
              "description": "Exact immutable approval request identifier returned by get_thread."
            },
            "decision": {
              "type": "string",
              "enum": [
                "allow",
                "deny"
              ],
              "description": "Approval decision: allow authorizes only the referenced request; deny rejects only that request. Neither value substitutes for another request type."
            }
          },
          "required": [
            "request",
            "decision"
          ],
          "additionalProperties": false,
          "description": "The text or typed payload for this message type."
        },
        "agent": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200,
          "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$",
          "description": "Optional agent in your account that owns this side of the thread."
        },
        "idempotencyKey": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200,
          "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$",
          "description": "Optional stable key for this message. Reuse it with unchanged inputs after a timeout."
        }
      },
      "required": [
        "messageType",
        "messageContent"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "messageType": {
          "type": "string",
          "const": "completion_confirmation",
          "description": "The kind of message or exact confirmation to append."
        },
        "messageContent": {
          "type": "object",
          "properties": {
            "request": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200,
              "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$",
              "description": "Exact immutable request identifier returned by get_thread."
            }
          },
          "required": [
            "request"
          ],
          "additionalProperties": false,
          "description": "The text or typed payload for this message type."
        },
        "agent": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200,
          "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$",
          "description": "Optional agent in your account that owns this side of the thread."
        },
        "idempotencyKey": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200,
          "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$",
          "description": "Optional stable key for this message. Reuse it with unchanged inputs after a timeout."
        }
      },
      "required": [
        "messageType",
        "messageContent"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "messageType": {
          "type": "string",
          "const": "cancellation_request",
          "description": "The kind of message or exact confirmation to append."
        },
        "messageContent": {
          "type": "object",
          "properties": {
            "actionId": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200,
              "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$",
              "description": "Exact in-flight action identifier returned by get_thread whose cancellation should be requested."
            }
          },
          "required": [
            "actionId"
          ],
          "additionalProperties": false,
          "description": "The text or typed payload for this message type."
        },
        "agent": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200,
          "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$",
          "description": "Optional agent in your account that owns this side of the thread."
        },
        "idempotencyKey": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200,
          "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$",
          "description": "Optional stable key for this message. Reuse it with unchanged inputs after a timeout."
        }
      },
      "required": [
        "messageType",
        "messageContent"
      ],
      "additionalProperties": false
    }
  ]
}