{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/omnara-com/json-schema/omnara-com-create-user-session-request-schema.json",
  "title": "CreateUserSessionRequest",
  "description": "Payload for creating or reusing a user session container.",
  "x-generated": "2026-11-19",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/omnara-com-openapi.json#/components/schemas/CreateUserSessionRequest",
  "properties": {
    "worktree_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Worktree Id",
      "description": "Worktree identifier linked to this session (preferred)"
    },
    "workspace_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Workspace Id",
      "description": "Deprecated: Use worktree_id instead. If worktree_id is not provided, the main worktree for this workspace will be used."
    },
    "user_session_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "User Session Id",
      "description": "Optional explicit user session id to reuse or create"
    },
    "name": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 255
        },
        {
          "type": "null"
        }
      ],
      "title": "Name",
      "description": "Optional human-readable session name"
    },
    "metadata": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Metadata",
      "description": "Arbitrary key-value metadata for the session"
    },
    "start_sandbox": {
      "type": "boolean",
      "title": "Start Sandbox",
      "description": "If True and worktree is REMOTE, start the sandbox session immediately",
      "default": false
    },
    "session_settings": {
      "anyOf": [
        {
          "$ref": "#/$defs/SessionSettings-Input"
        },
        {
          "type": "null"
        }
      ],
      "description": "Initial session settings for this user session"
    },
    "initial_message": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Initial Message",
      "description": "Initial message to queue for the agent. This message will be delivered as soon as the agent connects, eliminating the frontend waterfall delay."
    }
  },
  "type": "object",
  "$defs": {
    "ClaudeCodeSettings": {
      "properties": {
        "model": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "haiku",
                "sonnet",
                "opus",
                "opus[1m]"
              ]
            },
            {
              "type": "null"
            }
          ],
          "title": "Model"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "title": "ClaudeCodeSettings",
      "description": "Claude-specific settings for the code agent."
    },
    "CodeAgentProviders": {
      "properties": {
        "claude_code": {
          "anyOf": [
            {
              "$ref": "#/$defs/ClaudeCodeSettings"
            },
            {
              "type": "null"
            }
          ]
        },
        "codex": {
          "anyOf": [
            {
              "$ref": "#/$defs/CodexSettings"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "additionalProperties": true,
      "type": "object",
      "title": "CodeAgentProviders",
      "description": "Provider-specific code agent settings keyed by provider name."
    },
    "CodeAgentSettings-Input": {
      "properties": {
        "mode": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "agent",
                "orchestrator"
              ]
            },
            {
              "type": "null"
            }
          ],
          "title": "Mode"
        },
        "default_provider": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Default Provider"
        },
        "providers": {
          "$ref": "#/$defs/CodeAgentProviders"
        }
      },
      "additionalProperties": true,
      "type": "object",
      "title": "CodeAgentSettings",
      "description": "Settings for the code agent across providers."
    },
    "CodexSettings": {
      "properties": {
        "model": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "gpt-5.1-codex-max",
                "gpt-5.1-codex-mini",
                "gpt-5.1-codex",
                "gpt-5.2",
                "gpt-5.2-codex",
                "gpt-5.3-codex-spark",
                "gpt-5.3-codex"
              ]
            },
            {
              "type": "null"
            }
          ],
          "title": "Model"
        },
        "thinking": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "low",
                "medium",
                "high",
                "xhigh"
              ]
            },
            {
              "type": "null"
            }
          ],
          "title": "Thinking"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "title": "CodexSettings",
      "description": "Codex-specific settings for the code agent."
    },
    "SessionSettings-Input": {
      "properties": {
        "code": {
          "anyOf": [
            {
              "$ref": "#/$defs/CodeAgentSettings-Input"
            },
            {
              "type": "null"
            }
          ]
        },
        "voice": {
          "anyOf": [
            {
              "$ref": "#/$defs/VoiceAgentSettings"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "additionalProperties": true,
      "type": "object",
      "title": "SessionSettings",
      "description": "Per-session settings for a user session."
    },
    "VoiceAgentSettings": {
      "properties": {
        "language": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Language"
        }
      },
      "additionalProperties": true,
      "type": "object",
      "title": "VoiceAgentSettings",
      "description": "Settings for the voice agent."
    }
  }
}