{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "RawResponseItemCompletedNotification",
  "type": "object",
  "required": [
    "item",
    "threadId",
    "turnId"
  ],
  "properties": {
    "item": {
      "$ref": "#/definitions/ResponseItem"
    },
    "threadId": {
      "type": "string"
    },
    "turnId": {
      "type": "string"
    }
  },
  "definitions": {
    "ContentItem": {
      "oneOf": [
        {
          "type": "object",
          "required": [
            "text",
            "type"
          ],
          "properties": {
            "text": {
              "type": "string"
            },
            "type": {
              "type": "string",
              "enum": [
                "input_text"
              ],
              "title": "InputTextContentItemType"
            }
          },
          "title": "InputTextContentItem"
        },
        {
          "type": "object",
          "required": [
            "image_url",
            "type"
          ],
          "properties": {
            "detail": {
              "anyOf": [
                {
                  "$ref": "#/definitions/ImageDetail"
                },
                {
                  "type": "null"
                }
              ]
            },
            "image_url": {
              "type": "string"
            },
            "type": {
              "type": "string",
              "enum": [
                "input_image"
              ],
              "title": "InputImageContentItemType"
            }
          },
          "title": "InputImageContentItem"
        },
        {
          "type": "object",
          "required": [
            "text",
            "type"
          ],
          "properties": {
            "text": {
              "type": "string"
            },
            "type": {
              "type": "string",
              "enum": [
                "output_text"
              ],
              "title": "OutputTextContentItemType"
            }
          },
          "title": "OutputTextContentItem"
        }
      ]
    },
    "FunctionCallOutputBody": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "array",
          "items": {
            "$ref": "#/definitions/FunctionCallOutputContentItem"
          }
        }
      ]
    },
    "FunctionCallOutputContentItem": {
      "description": "Responses API compatible content items that can be returned by a tool call. This is a subset of ContentItem with the types we support as function call outputs.",
      "oneOf": [
        {
          "type": "object",
          "required": [
            "text",
            "type"
          ],
          "properties": {
            "text": {
              "type": "string"
            },
            "type": {
              "type": "string",
              "enum": [
                "input_text"
              ],
              "title": "InputTextFunctionCallOutputContentItemType"
            }
          },
          "title": "InputTextFunctionCallOutputContentItem"
        },
        {
          "type": "object",
          "required": [
            "image_url",
            "type"
          ],
          "properties": {
            "detail": {
              "anyOf": [
                {
                  "$ref": "#/definitions/ImageDetail"
                },
                {
                  "type": "null"
                }
              ]
            },
            "image_url": {
              "type": "string"
            },
            "type": {
              "type": "string",
              "enum": [
                "input_image"
              ],
              "title": "InputImageFunctionCallOutputContentItemType"
            }
          },
          "title": "InputImageFunctionCallOutputContentItem"
        }
      ]
    },
    "GhostCommit": {
      "description": "Details of a ghost commit created from a repository state.",
      "type": "object",
      "required": [
        "id",
        "preexisting_untracked_dirs",
        "preexisting_untracked_files"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "parent": {
          "type": [
            "string",
            "null"
          ]
        },
        "preexisting_untracked_dirs": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "preexisting_untracked_files": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "ImageDetail": {
      "type": "string",
      "enum": [
        "auto",
        "low",
        "high",
        "original"
      ]
    },
    "LocalShellAction": {
      "oneOf": [
        {
          "type": "object",
          "required": [
            "command",
            "type"
          ],
          "properties": {
            "command": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "env": {
              "type": [
                "object",
                "null"
              ],
              "additionalProperties": {
                "type": "string"
              }
            },
            "timeout_ms": {
              "type": [
                "integer",
                "null"
              ],
              "format": "uint64",
              "minimum": 0.0
            },
            "type": {
              "type": "string",
              "enum": [
                "exec"
              ],
              "title": "ExecLocalShellActionType"
            },
            "user": {
              "type": [
                "string",
                "null"
              ]
            },
            "working_directory": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          "title": "ExecLocalShellAction"
        }
      ]
    },
    "LocalShellStatus": {
      "type": "string",
      "enum": [
        "completed",
        "in_progress",
        "incomplete"
      ]
    },
    "MessagePhase": {
      "description": "Classifies an assistant message as interim commentary or final answer text.\n\nProviders do not emit this consistently, so callers must treat `None` as \"phase unknown\" and keep compatibility behavior for legacy models.",
      "oneOf": [
        {
          "description": "Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.",
          "type": "string",
          "enum": [
            "commentary"
          ]
        },
        {
          "description": "The assistant's terminal answer text for the current turn.",
          "type": "string",
          "enum": [
            "final_answer"
          ]
        }
      ]
    },
    "ReasoningItemContent": {
      "oneOf": [
        {
          "type": "object",
          "required": [
            "text",
            "type"
          ],
          "properties": {
            "text": {
              "type": "string"
            },
            "type": {
              "type": "string",
              "enum": [
                "reasoning_text"
              ],
              "title": "ReasoningTextReasoningItemContentType"
            }
          },
          "title": "ReasoningTextReasoningItemContent"
        },
        {
          "type": "object",
          "required": [
            "text",
            "type"
          ],
          "properties": {
            "text": {
              "type": "string"
            },
            "type": {
              "type": "string",
              "enum": [
                "text"
              ],
              "title": "TextReasoningItemContentType"
            }
          },
          "title": "TextReasoningItemContent"
        }
      ]
    },
    "ReasoningItemReasoningSummary": {
      "oneOf": [
        {
          "type": "object",
          "required": [
            "text",
            "type"
          ],
          "properties": {
            "text": {
              "type": "string"
            },
            "type": {
              "type": "string",
              "enum": [
                "summary_text"
              ],
              "title": "SummaryTextReasoningItemReasoningSummaryType"
            }
          },
          "title": "SummaryTextReasoningItemReasoningSummary"
        }
      ]
    },
    "ResponseItem": {
      "oneOf": [
        {
          "type": "object",
          "required": [
            "content",
            "role",
            "type"
          ],
          "properties": {
            "content": {
              "type": "array",
              "items": {
                "$ref": "#/definitions/ContentItem"
              }
            },
            "end_turn": {
              "type": [
                "boolean",
                "null"
              ]
            },
            "id": {
              "writeOnly": true,
              "type": [
                "string",
                "null"
              ]
            },
            "phase": {
              "anyOf": [
                {
                  "$ref": "#/definitions/MessagePhase"
                },
                {
                  "type": "null"
                }
              ]
            },
            "role": {
              "type": "string"
            },
            "type": {
              "type": "string",
              "enum": [
                "message"
              ],
              "title": "MessageResponseItemType"
            }
          },
          "title": "MessageResponseItem"
        },
        {
          "type": "object",
          "required": [
            "summary",
            "type"
          ],
          "properties": {
            "content": {
              "default": null,
              "type": [
                "array",
                "null"
              ],
              "items": {
                "$ref": "#/definitions/ReasoningItemContent"
              }
            },
            "encrypted_content": {
              "type": [
                "string",
                "null"
              ]
            },
            "summary": {
              "type": "array",
              "items": {
                "$ref": "#/definitions/ReasoningItemReasoningSummary"
              }
            },
            "type": {
              "type": "string",
              "enum": [
                "reasoning"
              ],
              "title": "ReasoningResponseItemType"
            }
          },
          "title": "ReasoningResponseItem"
        },
        {
          "type": "object",
          "required": [
            "action",
            "status",
            "type"
          ],
          "properties": {
            "action": {
              "$ref": "#/definitions/LocalShellAction"
            },
            "call_id": {
              "description": "Set when using the Responses API.",
              "type": [
                "string",
                "null"
              ]
            },
            "id": {
              "description": "Legacy id field retained for compatibility with older payloads.",
              "writeOnly": true,
              "type": [
                "string",
                "null"
              ]
            },
            "status": {
              "$ref": "#/definitions/LocalShellStatus"
            },
            "type": {
              "type": "string",
              "enum": [
                "local_shell_call"
              ],
              "title": "LocalShellCallResponseItemType"
            }
          },
          "title": "LocalShellCallResponseItem"
        },
        {
          "type": "object",
          "required": [
            "arguments",
            "call_id",
            "name",
            "type"
          ],
          "properties": {
            "arguments": {
              "type": "string"
            },
            "call_id": {
              "type": "string"
            },
            "id": {
              "writeOnly": true,
              "type": [
                "string",
                "null"
              ]
            },
            "name": {
              "type": "string"
            },
            "namespace": {
              "type": [
                "string",
                "null"
              ]
            },
            "type": {
              "type": "string",
              "enum": [
                "function_call"
              ],
              "title": "FunctionCallResponseItemType"
            }
          },
          "title": "FunctionCallResponseItem"
        },
        {
          "type": "object",
          "required": [
            "arguments",
            "execution",
            "type"
          ],
          "properties": {
            "arguments": true,
            "call_id": {
              "type": [
                "string",
                "null"
              ]
            },
            "execution": {
              "type": "string"
            },
            "id": {
              "writeOnly": true,
              "type": [
                "string",
                "null"
              ]
            },
            "status": {
              "type": [
                "string",
                "null"
              ]
            },
            "type": {
              "type": "string",
              "enum": [
                "tool_search_call"
              ],
              "title": "ToolSearchCallResponseItemType"
            }
          },
          "title": "ToolSearchCallResponseItem"
        },
        {
          "type": "object",
          "required": [
            "call_id",
            "output",
            "type"
          ],
          "properties": {
            "call_id": {
              "type": "string"
            },
            "output": {
              "$ref": "#/definitions/FunctionCallOutputBody"
            },
            "type": {
              "type": "string",
              "enum": [
                "function_call_output"
              ],
              "title": "FunctionCallOutputResponseItemType"
            }
          },
          "title": "FunctionCallOutputResponseItem"
        },
        {
          "type": "object",
          "required": [
            "call_id",
            "input",
            "name",
            "type"
          ],
          "properties": {
            "call_id": {
              "type": "string"
            },
            "id": {
              "writeOnly": true,
              "type": [
                "string",
                "null"
              ]
            },
            "input": {
              "type": "string"
            },
            "name": {
              "type": "string"
            },
            "status": {
              "type": [
                "string",
                "null"
              ]
            },
            "type": {
              "type": "string",
              "enum": [
                "custom_tool_call"
              ],
              "title": "CustomToolCallResponseItemType"
            }
          },
          "title": "CustomToolCallResponseItem"
        },
        {
          "type": "object",
          "required": [
            "call_id",
            "output",
            "type"
          ],
          "properties": {
            "call_id": {
              "type": "string"
            },
            "name": {
              "type": [
                "string",
                "null"
              ]
            },
            "output": {
              "$ref": "#/definitions/FunctionCallOutputBody"
            },
            "type": {
              "type": "string",
              "enum": [
                "custom_tool_call_output"
              ],
              "title": "CustomToolCallOutputResponseItemType"
            }
          },
          "title": "CustomToolCallOutputResponseItem"
        },
        {
          "type": "object",
          "required": [
            "execution",
            "status",
            "tools",
            "type"
          ],
          "properties": {
            "call_id": {
              "type": [
                "string",
                "null"
              ]
            },
            "execution": {
              "type": "string"
            },
            "status": {
              "type": "string"
            },
            "tools": {
              "type": "array",
              "items": true
            },
            "type": {
              "type": "string",
              "enum": [
                "tool_search_output"
              ],
              "title": "ToolSearchOutputResponseItemType"
            }
          },
          "title": "ToolSearchOutputResponseItem"
        },
        {
          "type": "object",
          "required": [
            "type"
          ],
          "properties": {
            "action": {
              "anyOf": [
                {
                  "$ref": "#/definitions/ResponsesApiWebSearchAction"
                },
                {
                  "type": "null"
                }
              ]
            },
            "id": {
              "writeOnly": true,
              "type": [
                "string",
                "null"
              ]
            },
            "status": {
              "type": [
                "string",
                "null"
              ]
            },
            "type": {
              "type": "string",
              "enum": [
                "web_search_call"
              ],
              "title": "WebSearchCallResponseItemType"
            }
          },
          "title": "WebSearchCallResponseItem"
        },
        {
          "type": "object",
          "required": [
            "id",
            "result",
            "status",
            "type"
          ],
          "properties": {
            "id": {
              "type": "string"
            },
            "result": {
              "type": "string"
            },
            "revised_prompt": {
              "type": [
                "string",
                "null"
              ]
            },
            "status": {
              "type": "string"
            },
            "type": {
              "type": "string",
              "enum": [
                "image_generation_call"
              ],
              "title": "ImageGenerationCallResponseItemType"
            }
          },
          "title": "ImageGenerationCallResponseItem"
        },
        {
          "type": "object",
          "required": [
            "ghost_commit",
            "type"
          ],
          "properties": {
            "ghost_commit": {
              "$ref": "#/definitions/GhostCommit"
            },
            "type": {
              "type": "string",
              "enum": [
                "ghost_snapshot"
              ],
              "title": "GhostSnapshotResponseItemType"
            }
          },
          "title": "GhostSnapshotResponseItem"
        },
        {
          "type": "object",
          "required": [
            "encrypted_content",
            "type"
          ],
          "properties": {
            "encrypted_content": {
              "type": "string"
            },
            "type": {
              "type": "string",
              "enum": [
                "compaction"
              ],
              "title": "CompactionResponseItemType"
            }
          },
          "title": "CompactionResponseItem"
        },
        {
          "type": "object",
          "required": [
            "type"
          ],
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "other"
              ],
              "title": "OtherResponseItemType"
            }
          },
          "title": "OtherResponseItem"
        }
      ]
    },
    "ResponsesApiWebSearchAction": {
      "oneOf": [
        {
          "type": "object",
          "required": [
            "type"
          ],
          "properties": {
            "queries": {
              "type": [
                "array",
                "null"
              ],
              "items": {
                "type": "string"
              }
            },
            "query": {
              "type": [
                "string",
                "null"
              ]
            },
            "type": {
              "type": "string",
              "enum": [
                "search"
              ],
              "title": "SearchResponsesApiWebSearchActionType"
            }
          },
          "title": "SearchResponsesApiWebSearchAction"
        },
        {
          "type": "object",
          "required": [
            "type"
          ],
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "open_page"
              ],
              "title": "OpenPageResponsesApiWebSearchActionType"
            },
            "url": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          "title": "OpenPageResponsesApiWebSearchAction"
        },
        {
          "type": "object",
          "required": [
            "type"
          ],
          "properties": {
            "pattern": {
              "type": [
                "string",
                "null"
              ]
            },
            "type": {
              "type": "string",
              "enum": [
                "find_in_page"
              ],
              "title": "FindInPageResponsesApiWebSearchActionType"
            },
            "url": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          "title": "FindInPageResponsesApiWebSearchAction"
        },
        {
          "type": "object",
          "required": [
            "type"
          ],
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "other"
              ],
              "title": "OtherResponsesApiWebSearchActionType"
            }
          },
          "title": "OtherResponsesApiWebSearchAction"
        }
      ]
    }
  }
}