{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/omnara-com/json-schema/omnara-com-user-session-descriptor-schema.json",
  "title": "UserSessionDescriptor",
  "description": "Representation of a user-owned conversation container.",
  "x-generated": "2026-11-19",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/omnara-com-openapi.json#/components/schemas/UserSessionDescriptor",
  "properties": {
    "kind": {
      "type": "string",
      "const": "user_session",
      "title": "Kind",
      "description": "Descriptor type discriminator",
      "default": "user_session"
    },
    "session_id": {
      "type": "string",
      "format": "uuid",
      "title": "Session Id",
      "description": "Unique session identifier"
    },
    "user_id": {
      "type": "string",
      "format": "uuid",
      "title": "User Id",
      "description": "Owner user identifier"
    },
    "status": {
      "$ref": "#/$defs/UserSessionStatus",
      "description": "Current session status"
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "title": "Created At",
      "description": "Timestamp when the session was created"
    },
    "name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Name",
      "description": "Optional user-defined session name"
    },
    "metadata": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Metadata",
      "description": "Arbitrary session metadata"
    },
    "settings": {
      "anyOf": [
        {
          "$ref": "#/$defs/SessionSettings-Output"
        },
        {
          "type": "null"
        }
      ],
      "description": "Session settings for code and voice agents"
    },
    "worktree_id": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid"
        },
        {
          "type": "null"
        }
      ],
      "title": "Worktree Id",
      "description": "Associated worktree identifier"
    },
    "worktree_name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Worktree Name",
      "description": "Name of the associated worktree"
    },
    "worktree_type": {
      "anyOf": [
        {
          "$ref": "#/$defs/WorktreeType"
        },
        {
          "type": "null"
        }
      ],
      "description": "Type of the associated worktree (LOCAL or REMOTE)"
    }
  },
  "additionalProperties": false,
  "type": "object",
  "required": [
    "session_id",
    "user_id",
    "status",
    "created_at"
  ],
  "$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-Output": {
      "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-Output": {
      "properties": {
        "code": {
          "anyOf": [
            {
              "$ref": "#/$defs/CodeAgentSettings-Output"
            },
            {
              "type": "null"
            }
          ]
        },
        "voice": {
          "anyOf": [
            {
              "$ref": "#/$defs/VoiceAgentSettings"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "additionalProperties": true,
      "type": "object",
      "title": "SessionSettings",
      "description": "Per-session settings for a user session."
    },
    "UserSessionStatus": {
      "type": "string",
      "enum": [
        "ACTIVE",
        "COMPLETED",
        "DELETED"
      ],
      "title": "UserSessionStatus"
    },
    "VoiceAgentSettings": {
      "properties": {
        "language": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Language"
        }
      },
      "additionalProperties": true,
      "type": "object",
      "title": "VoiceAgentSettings",
      "description": "Settings for the voice agent."
    },
    "WorktreeType": {
      "type": "string",
      "enum": [
        "LOCAL",
        "REMOTE"
      ],
      "title": "WorktreeType",
      "description": "Whether a worktree runs on a user's local machine or a managed remote machine."
    }
  }
}