// This file is auto-generated by @hey-api/openapi-ts

export type ClientOptions = {
  baseUrl: `${string}://${string}` | (string & {})
}

export type Event =
  | EventServerInstanceDisposed
  | EventFileEdited
  | EventFileWatcherUpdated
  | EventLspClientDiagnostics
  | EventLspUpdated
  | EventMessagePartDelta
  | EventPermissionAsked
  | EventPermissionReplied
  | EventSessionDiff
  | EventSessionError
  | EventInstallationUpdated
  | EventInstallationUpdateAvailable
  | EventQuestionAsked
  | EventQuestionReplied
  | EventQuestionRejected
  | EventTodoUpdated
  | EventSessionStatus
  | EventSessionIdle
  | EventSessionCompacted
  | EventTuiPromptAppend
  | EventTuiCommandExecute
  | EventTuiToastShow1
  | EventTuiSessionSelect
  | EventMcpToolsChanged
  | EventMcpBrowserOpenFailed
  | EventCommandExecuted
  | EventProjectUpdated
  | EventVcsBranchUpdated
  | EventWorkspaceReady
  | EventWorkspaceFailed
  | EventWorkspaceStatus
  | EventWorktreeReady
  | EventWorktreeFailed
  | EventPtyCreated
  | EventPtyUpdated
  | EventPtyExited
  | EventPtyDeleted
  | EventMessageUpdated
  | EventMessageRemoved
  | EventMessagePartUpdated
  | EventMessagePartRemoved
  | EventSessionCreated
  | EventSessionUpdated
  | EventSessionDeleted
  | EventSessionNextAgentSwitched
  | EventSessionNextModelSwitched
  | EventSessionNextPrompted
  | EventSessionNextSynthetic
  | EventSessionNextShellStarted
  | EventSessionNextShellEnded
  | EventSessionNextStepStarted
  | EventSessionNextStepEnded
  | EventSessionNextStepFailed
  | EventSessionNextTextStarted
  | EventSessionNextTextDelta
  | EventSessionNextTextEnded
  | EventSessionNextReasoningStarted
  | EventSessionNextReasoningDelta
  | EventSessionNextReasoningEnded
  | EventSessionNextToolInputStarted
  | EventSessionNextToolInputDelta
  | EventSessionNextToolInputEnded
  | EventSessionNextToolCalled
  | EventSessionNextToolProgress
  | EventSessionNextToolSuccess
  | EventSessionNextToolFailed
  | EventSessionNextRetried
  | EventSessionNextCompactionStarted
  | EventSessionNextCompactionDelta
  | EventSessionNextCompactionEnded
  | EventServerConnected
  | EventGlobalDisposed

export type OAuth = {
  type: "oauth"
  refresh: string
  access: string
  expires: number
  accountId?: string
  enterpriseUrl?: string
}

export type ApiAuth = {
  type: "api"
  key: string
  metadata?: {
    [key: string]: string
  }
}

export type WellKnownAuth = {
  type: "wellknown"
  key: string
  token: string
}

export type Auth = OAuth | ApiAuth | WellKnownAuth

export type PermissionRequest = {
  id: string
  sessionID: string
  permission: string
  patterns: Array<string>
  metadata: {
    [key: string]: unknown
  }
  always: Array<string>
  tool?: {
    messageID: string
    callID: string
  }
}

export type SnapshotFileDiff = {
  file?: string
  patch?: string
  additions: number
  deletions: number
  status?: "added" | "deleted" | "modified"
}

export type ProviderAuthError = {
  name: "ProviderAuthError"
  data: {
    providerID: string
    message: string
  }
}

export type UnknownError = {
  name: "UnknownError"
  data: {
    message: string
  }
}

export type MessageOutputLengthError = {
  name: "MessageOutputLengthError"
  data: {
    [key: string]: unknown
  }
}

export type MessageAbortedError = {
  name: "MessageAbortedError"
  data: {
    message: string
  }
}

export type StructuredOutputError = {
  name: "StructuredOutputError"
  data: {
    message: string
    retries: number
  }
}

export type ContextOverflowError = {
  name: "ContextOverflowError"
  data: {
    message: string
    responseBody?: string
  }
}

export type ApiError = {
  name: "APIError"
  data: {
    message: string
    statusCode?: number
    isRetryable: boolean
    responseHeaders?: {
      [key: string]: string
    }
    responseBody?: string
    metadata?: {
      [key: string]: string
    }
  }
}

export type QuestionOption = {
  /**
   * Display text (1-5 words, concise)
   */
  label: string
  /**
   * Explanation of choice
   */
  description: string
}

export type QuestionInfo = {
  /**
   * Complete question
   */
  question: string
  /**
   * Very short label (max 30 chars)
   */
  header: string
  /**
   * Available choices
   */
  options: Array<QuestionOption>
  multiple?: boolean
  custom?: boolean
}

export type QuestionTool = {
  messageID: string
  callID: string
}

export type QuestionRequest = {
  id: string
  sessionID: string
  /**
   * Questions to ask
   */
  questions: Array<QuestionInfo>
  tool?: QuestionTool
}

export type QuestionAnswer = Array<string>

export type QuestionReplied = {
  sessionID: string
  requestID: string
  answers: Array<QuestionAnswer>
}

export type QuestionRejected = {
  sessionID: string
  requestID: string
}

export type Todo = {
  /**
   * Brief description of the task
   */
  content: string
  /**
   * Current status of the task: pending, in_progress, completed, cancelled
   */
  status: string
  /**
   * Priority level of the task: high, medium, low
   */
  priority: string
}

export type SessionStatus =
  | {
      type: "idle"
    }
  | {
      type: "retry"
      attempt: number
      message: string
      action?: {
        reason: string
        provider: string
        title: string
        message: string
        label: string
        link?: string
      }
      next: number
    }
  | {
      type: "busy"
    }

export type EventTuiPromptAppend = {
  id: string
  type: "tui.prompt.append"
  properties: {
    text: string
  }
}

export type EventTuiCommandExecute = {
  id: string
  type: "tui.command.execute"
  properties: {
    command:
      | "session.list"
      | "session.new"
      | "session.share"
      | "session.interrupt"
      | "session.compact"
      | "session.page.up"
      | "session.page.down"
      | "session.line.up"
      | "session.line.down"
      | "session.half.page.up"
      | "session.half.page.down"
      | "session.first"
      | "session.last"
      | "prompt.clear"
      | "prompt.submit"
      | "agent.cycle"
      | string
  }
}

export type EventTuiToastShow = {
  id: string
  type: "tui.toast.show"
  properties: {
    title?: string
    message: string
    variant: "info" | "success" | "warning" | "error"
    duration?: number
  }
}

export type EventTuiSessionSelect = {
  id: string
  type: "tui.session.select"
  properties: {
    /**
     * Session ID to navigate to
     */
    sessionID: string
  }
}

export type Project = {
  id: string
  worktree: string
  vcs?: "git"
  name?: string
  icon?: {
    url?: string
    override?: string
    color?: string
  }
  commands?: {
    /**
     * Startup script to run when creating a new workspace (worktree)
     */
    start?: string
  }
  time: {
    created: number
    updated: number
    initialized?: number
  }
  sandboxes: Array<string>
}

export type Pty = {
  id: string
  title: string
  command: string
  args: Array<string>
  cwd: string
  status: "running" | "exited"
  pid: number
}

export type OutputFormatText = {
  type: "text"
}

export type JsonSchema = {
  [key: string]: unknown
}

export type OutputFormatJsonSchema = {
  type: "json_schema"
  schema: JsonSchema
  retryCount?: number
}

export type OutputFormat = OutputFormatText | OutputFormatJsonSchema

export type UserMessage = {
  id: string
  sessionID: string
  role: "user"
  time: {
    created: number
  }
  format?: OutputFormat
  summary?: {
    title?: string
    body?: string
    diffs: Array<SnapshotFileDiff>
  }
  agent: string
  model: {
    providerID: string
    modelID: string
    variant?: string
  }
  system?: string
  tools?: {
    [key: string]: boolean
  }
}

export type AssistantMessage = {
  id: string
  sessionID: string
  role: "assistant"
  time: {
    created: number
    completed?: number
  }
  error?:
    | ProviderAuthError
    | UnknownError
    | MessageOutputLengthError
    | MessageAbortedError
    | StructuredOutputError
    | ContextOverflowError
    | ApiError
  parentID: string
  modelID: string
  providerID: string
  mode: string
  agent: string
  path: {
    cwd: string
    root: string
  }
  summary?: boolean
  cost: number
  tokens: {
    total?: number
    input: number
    output: number
    reasoning: number
    cache: {
      read: number
      write: number
    }
  }
  structured?: unknown
  variant?: string
  finish?: string
}

export type Message = UserMessage | AssistantMessage

export type TextPart = {
  id: string
  sessionID: string
  messageID: string
  type: "text"
  text: string
  synthetic?: boolean
  ignored?: boolean
  time?: {
    start: number
    end?: number
  }
  metadata?: {
    [key: string]: unknown
  }
}

export type SubtaskPart = {
  id: string
  sessionID: string
  messageID: string
  type: "subtask"
  prompt: string
  description: string
  agent: string
  model?: {
    providerID: string
    modelID: string
  }
  command?: string
}

export type ReasoningPart = {
  id: string
  sessionID: string
  messageID: string
  type: "reasoning"
  text: string
  metadata?: {
    [key: string]: unknown
  }
  time: {
    start: number
    end?: number
  }
}

export type FilePartSourceText = {
  value: string
  start: number
  end: number
}

export type FileSource = {
  text: FilePartSourceText
  type: "file"
  path: string
}

export type Range = {
  start: {
    line: number
    character: number
  }
  end: {
    line: number
    character: number
  }
}

export type SymbolSource = {
  text: FilePartSourceText
  type: "symbol"
  path: string
  range: Range
  name: string
  kind: number
}

export type ResourceSource = {
  text: FilePartSourceText
  type: "resource"
  clientName: string
  uri: string
}

export type FilePartSource = FileSource | SymbolSource | ResourceSource

export type FilePart = {
  id: string
  sessionID: string
  messageID: string
  type: "file"
  mime: string
  filename?: string
  url: string
  source?: FilePartSource
}

export type ToolStatePending = {
  status: "pending"
  input: {
    [key: string]: unknown
  }
  raw: string
}

export type ToolStateRunning = {
  status: "running"
  input: {
    [key: string]: unknown
  }
  title?: string
  metadata?: {
    [key: string]: unknown
  }
  time: {
    start: number
  }
}

export type ToolStateCompleted = {
  status: "completed"
  input: {
    [key: string]: unknown
  }
  output: string
  title: string
  metadata: {
    [key: string]: unknown
  }
  time: {
    start: number
    end: number
    compacted?: number
  }
  attachments?: Array<FilePart>
}

export type ToolStateError = {
  status: "error"
  input: {
    [key: string]: unknown
  }
  error: string
  metadata?: {
    [key: string]: unknown
  }
  time: {
    start: number
    end: number
  }
}

export type ToolState = ToolStatePending | ToolStateRunning | ToolStateCompleted | ToolStateError

export type ToolPart = {
  id: string
  sessionID: string
  messageID: string
  type: "tool"
  callID: string
  tool: string
  state: ToolState
  metadata?: {
    [key: string]: unknown
  }
}

export type StepStartPart = {
  id: string
  sessionID: string
  messageID: string
  type: "step-start"
  snapshot?: string
}

export type StepFinishPart = {
  id: string
  sessionID: string
  messageID: string
  type: "step-finish"
  reason: string
  snapshot?: string
  cost: number
  tokens: {
    total?: number
    input: number
    output: number
    reasoning: number
    cache: {
      read: number
      write: number
    }
  }
}

export type SnapshotPart = {
  id: string
  sessionID: string
  messageID: string
  type: "snapshot"
  snapshot: string
}

export type PatchPart = {
  id: string
  sessionID: string
  messageID: string
  type: "patch"
  hash: string
  files: Array<string>
}

export type AgentPart = {
  id: string
  sessionID: string
  messageID: string
  type: "agent"
  name: string
  source?: {
    value: string
    start: number
    end: number
  }
}

export type RetryPart = {
  id: string
  sessionID: string
  messageID: string
  type: "retry"
  attempt: number
  error: ApiError
  time: {
    created: number
  }
}

export type CompactionPart = {
  id: string
  sessionID: string
  messageID: string
  type: "compaction"
  auto: boolean
  overflow?: boolean
  tail_start_id?: string
}

export type Part =
  | TextPart
  | SubtaskPart
  | ReasoningPart
  | FilePart
  | ToolPart
  | StepStartPart
  | StepFinishPart
  | SnapshotPart
  | PatchPart
  | AgentPart
  | RetryPart
  | CompactionPart

export type PermissionAction = "allow" | "deny" | "ask"

export type PermissionRule = {
  permission: string
  pattern: string
  action: PermissionAction
}

export type PermissionRuleset = Array<PermissionRule>

export type Session = {
  id: string
  slug: string
  projectID: string
  workspaceID?: string
  directory: string
  path?: string
  parentID?: string
  summary?: {
    additions: number
    deletions: number
    files: number
    diffs?: Array<SnapshotFileDiff>
  }
  share?: {
    url: string
  }
  title: string
  agent?: string
  model?: {
    id: string
    providerID: string
    variant?: string
  }
  version: string
  time: {
    created: number
    updated: number
    compacting?: number
    archived?: number
  }
  permission?: PermissionRuleset
  revert?: {
    messageID: string
    partID?: string
    snapshot?: string
    diff?: string
  }
}

export type Prompt = {
  text: string
  files?: Array<PromptFileAttachment>
  agents?: Array<PromptAgentAttachment>
  references?: Array<PromptReferenceAttachment>
}

export type GlobalEvent = {
  directory: string
  project?: string
  workspace?: string
  payload:
    | EventServerInstanceDisposed
    | EventFileEdited
    | EventFileWatcherUpdated
    | EventLspClientDiagnostics
    | EventLspUpdated
    | EventMessagePartDelta
    | EventPermissionAsked
    | EventPermissionReplied
    | EventSessionDiff
    | EventSessionError
    | EventInstallationUpdated
    | EventInstallationUpdateAvailable
    | EventQuestionAsked
    | EventQuestionReplied
    | EventQuestionRejected
    | EventTodoUpdated
    | EventSessionStatus
    | EventSessionIdle
    | EventSessionCompacted
    | EventTuiPromptAppend
    | EventTuiCommandExecute
    | EventTuiToastShow
    | EventTuiSessionSelect
    | EventMcpToolsChanged
    | EventMcpBrowserOpenFailed
    | EventCommandExecuted
    | EventProjectUpdated
    | EventVcsBranchUpdated
    | EventWorkspaceReady
    | EventWorkspaceFailed
    | EventWorkspaceStatus
    | EventWorktreeReady
    | EventWorktreeFailed
    | EventPtyCreated
    | EventPtyUpdated
    | EventPtyExited
    | EventPtyDeleted
    | EventMessageUpdated
    | EventMessageRemoved
    | EventMessagePartUpdated
    | EventMessagePartRemoved
    | EventSessionCreated
    | EventSessionUpdated
    | EventSessionDeleted
    | EventSessionNextAgentSwitched
    | EventSessionNextModelSwitched
    | EventSessionNextPrompted
    | EventSessionNextSynthetic
    | EventSessionNextShellStarted
    | EventSessionNextShellEnded
    | EventSessionNextStepStarted
    | EventSessionNextStepEnded
    | EventSessionNextStepFailed
    | EventSessionNextTextStarted
    | EventSessionNextTextDelta
    | EventSessionNextTextEnded
    | EventSessionNextReasoningStarted
    | EventSessionNextReasoningDelta
    | EventSessionNextReasoningEnded
    | EventSessionNextToolInputStarted
    | EventSessionNextToolInputDelta
    | EventSessionNextToolInputEnded
    | EventSessionNextToolCalled
    | EventSessionNextToolProgress
    | EventSessionNextToolSuccess
    | EventSessionNextToolFailed
    | EventSessionNextRetried
    | EventSessionNextCompactionStarted
    | EventSessionNextCompactionDelta
    | EventSessionNextCompactionEnded
    | EventServerConnected
    | EventGlobalDisposed
    | SyncEventMessageUpdated
    | SyncEventMessageRemoved
    | SyncEventMessagePartUpdated
    | SyncEventMessagePartRemoved
    | SyncEventSessionCreated
    | SyncEventSessionUpdated
    | SyncEventSessionDeleted
    | SyncEventSessionNextAgentSwitched
    | SyncEventSessionNextModelSwitched
    | SyncEventSessionNextPrompted
    | SyncEventSessionNextSynthetic
    | SyncEventSessionNextShellStarted
    | SyncEventSessionNextShellEnded
    | SyncEventSessionNextStepStarted
    | SyncEventSessionNextStepEnded
    | SyncEventSessionNextStepFailed
    | SyncEventSessionNextTextStarted
    | SyncEventSessionNextTextDelta
    | SyncEventSessionNextTextEnded
    | SyncEventSessionNextReasoningStarted
    | SyncEventSessionNextReasoningDelta
    | SyncEventSessionNextReasoningEnded
    | SyncEventSessionNextToolInputStarted
    | SyncEventSessionNextToolInputDelta
    | SyncEventSessionNextToolInputEnded
    | SyncEventSessionNextToolCalled
    | SyncEventSessionNextToolProgress
    | SyncEventSessionNextToolSuccess
    | SyncEventSessionNextToolFailed
    | SyncEventSessionNextRetried
    | SyncEventSessionNextCompactionStarted
    | SyncEventSessionNextCompactionDelta
    | SyncEventSessionNextCompactionEnded
}

/**
 * Log level
 */
export type LogLevel = "DEBUG" | "INFO" | "WARN" | "ERROR"

/**
 * Server configuration for opencode serve and web commands
 */
export type ServerConfig = {
  port?: number
  hostname?: string
  mdns?: boolean
  mdnsDomain?: string
  cors?: Array<string>
}

export type ReferenceConfigEntry =
  | string
  | {
      /**
       * Git repository URL, host/path reference, or GitHub owner/repo shorthand
       */
      repository: string
      branch?: string
    }
  | {
      /**
       * Absolute path, ~/ path, or workspace-relative path to a local reference directory
       */
      path: string
    }

export type ReferenceConfig = {
  [key: string]: ReferenceConfigEntry
}

export type PermissionActionConfig = "ask" | "allow" | "deny"

export type PermissionObjectConfig = {
  [key: string]: PermissionActionConfig
}

export type PermissionRuleConfig = PermissionActionConfig | PermissionObjectConfig

export type PermissionConfig =
  | PermissionActionConfig
  | {
      read?: PermissionRuleConfig
      edit?: PermissionRuleConfig
      glob?: PermissionRuleConfig
      grep?: PermissionRuleConfig
      list?: PermissionRuleConfig
      bash?: PermissionRuleConfig
      task?: PermissionRuleConfig
      external_directory?: PermissionRuleConfig
      todowrite?: PermissionActionConfig
      question?: PermissionActionConfig
      webfetch?: PermissionActionConfig
      websearch?: PermissionActionConfig
      codesearch?: PermissionActionConfig
      repo_clone?: PermissionRuleConfig
      repo_overview?: PermissionRuleConfig
      lsp?: PermissionRuleConfig
      doom_loop?: PermissionActionConfig
      skill?: PermissionRuleConfig
      [key: string]: PermissionRuleConfig | PermissionActionConfig | undefined
    }

export type AgentConfig = {
  model?: string
  variant?: string
  temperature?: number
  top_p?: number
  prompt?: string
  tools?: {
    [key: string]: boolean
  }
  disable?: boolean
  description?: string
  mode?: "subagent" | "primary" | "all"
  hidden?: boolean
  options?: {
    [key: string]: unknown
  }
  /**
   * Hex color code (e.g., #FF5733) or theme color (e.g., primary)
   */
  color?: string | "primary" | "secondary" | "accent" | "success" | "warning" | "error" | "info"
  steps?: number
  maxSteps?: number
  permission?: PermissionConfig
  [key: string]:
    | unknown
    | string
    | number
    | {
        [key: string]: boolean
      }
    | boolean
    | "subagent"
    | "primary"
    | "all"
    | {
        [key: string]: unknown
      }
    | string
    | "primary"
    | "secondary"
    | "accent"
    | "success"
    | "warning"
    | "error"
    | "info"
    | number
    | PermissionConfig
    | undefined
}

export type ProviderConfig = {
  api?: string
  name?: string
  env?: Array<string>
  id?: string
  npm?: string
  whitelist?: Array<string>
  blacklist?: Array<string>
  options?: {
    apiKey?: string
    baseURL?: string
    enterpriseUrl?: string
    setCacheKey?: boolean
    /**
     * Timeout in milliseconds for requests to this provider. Default is 300000 (5 minutes). Set to false to disable timeout.
     */
    timeout?: number | false
    chunkTimeout?: number
    [key: string]: unknown | string | boolean | number | false | number | undefined
  }
  models?: {
    [key: string]: {
      id?: string
      name?: string
      family?: string
      release_date?: string
      attachment?: boolean
      reasoning?: boolean
      temperature?: boolean
      tool_call?: boolean
      interleaved?:
        | true
        | {
            field: "reasoning_content" | "reasoning_details"
          }
      cost?: {
        input: number
        output: number
        cache_read?: number
        cache_write?: number
        context_over_200k?: {
          input: number
          output: number
          cache_read?: number
          cache_write?: number
        }
      }
      limit?: {
        context: number
        input?: number
        output: number
      }
      modalities?: {
        input: Array<"text" | "audio" | "image" | "video" | "pdf">
        output: Array<"text" | "audio" | "image" | "video" | "pdf">
      }
      experimental?: boolean
      status?: "alpha" | "beta" | "deprecated" | "active"
      provider?: {
        npm?: string
        api?: string
      }
      options?: {
        [key: string]: unknown
      }
      headers?: {
        [key: string]: string
      }
      /**
       * Variant-specific configuration
       */
      variants?: {
        [key: string]: {
          disabled?: boolean
          [key: string]: unknown | boolean | undefined
        }
      }
    }
  }
}

export type McpLocalConfig = {
  /**
   * Type of MCP server connection
   */
  type: "local"
  /**
   * Command and arguments to run the MCP server
   */
  command: Array<string>
  environment?: {
    [key: string]: string
  }
  enabled?: boolean
  timeout?: number
}

export type McpOAuthConfig = {
  clientId?: string
  clientSecret?: string
  scope?: string
  redirectUri?: string
}

export type McpRemoteConfig = {
  /**
   * Type of MCP server connection
   */
  type: "remote"
  /**
   * URL of the remote MCP server
   */
  url: string
  enabled?: boolean
  headers?: {
    [key: string]: string
  }
  /**
   * OAuth authentication configuration for the MCP server. Set to false to disable OAuth auto-detection.
   */
  oauth?: McpOAuthConfig | false
  timeout?: number
}

/**
 * @deprecated Always uses stretch layout.
 */
export type LayoutConfig = "auto" | "stretch"

export type ImageAttachmentConfig = {
  auto_resize?: boolean
  max_width?: number
  max_height?: number
  max_base64_bytes?: number
}

export type AttachmentConfig = {
  image?: ImageAttachmentConfig
}

export type Config = {
  $schema?: string
  shell?: string
  logLevel?: LogLevel
  server?: ServerConfig
  command?: {
    [key: string]: {
      template: string
      description?: string
      agent?: string
      model?: string
      subtask?: boolean
    }
  }
  skills?: {
    paths?: Array<string>
    urls?: Array<string>
  }
  reference?: ReferenceConfig
  watcher?: {
    ignore?: Array<string>
  }
  snapshot?: boolean
  plugin?: Array<
    | string
    | [
        string,
        {
          [key: string]: unknown
        },
      ]
  >
  share?: "manual" | "auto" | "disabled"
  autoshare?: boolean
  /**
   * Automatically update to the latest version. Set to true to auto-update, false to disable, or 'notify' to show update notifications
   */
  autoupdate?: boolean | "notify"
  disabled_providers?: Array<string>
  enabled_providers?: Array<string>
  model?: string
  small_model?: string
  default_agent?: string
  username?: string
  mode?: {
    build?: AgentConfig
    plan?: AgentConfig
    [key: string]: AgentConfig | undefined
  }
  agent?: {
    plan?: AgentConfig
    build?: AgentConfig
    general?: AgentConfig
    explore?: AgentConfig
    scout?: AgentConfig
    title?: AgentConfig
    summary?: AgentConfig
    compaction?: AgentConfig
    [key: string]: AgentConfig | undefined
  }
  provider?: {
    [key: string]: ProviderConfig
  }
  mcp?: {
    [key: string]:
      | McpLocalConfig
      | McpRemoteConfig
      | {
          enabled: boolean
        }
  }
  /**
   * Enable or configure formatters. Omit or set to false to disable, true to enable built-ins, or an object to enable built-ins with overrides.
   */
  formatter?:
    | boolean
    | {
        [key: string]: {
          disabled?: boolean
          command?: Array<string>
          environment?: {
            [key: string]: string
          }
          extensions?: Array<string>
        }
      }
  /**
   * Enable or configure LSP servers. Omit or set to false to disable, true to enable built-ins, or an object to enable built-ins with overrides.
   */
  lsp?:
    | boolean
    | {
        [key: string]:
          | {
              disabled: true
            }
          | {
              command: Array<string>
              extensions?: Array<string>
              disabled?: boolean
              env?: {
                [key: string]: string
              }
              initialization?: {
                [key: string]: unknown
              }
            }
      }
  instructions?: Array<string>
  layout?: LayoutConfig
  permission?: PermissionConfig
  tools?: {
    [key: string]: boolean
  }
  attachment?: AttachmentConfig
  enterprise?: {
    url?: string
  }
  tool_output?: {
    max_lines?: number
    max_bytes?: number
  }
  compaction?: {
    auto?: boolean
    prune?: boolean
    tail_turns?: number
    preserve_recent_tokens?: number
    reserved?: number
  }
  experimental?: {
    disable_paste_summary?: boolean
    batch_tool?: boolean
    openTelemetry?: boolean
    primary_tools?: Array<string>
    continue_loop_on_deny?: boolean
    mcp_timeout?: number
  }
}

export type Model = {
  id: string
  providerID: string
  api: {
    id: string
    url: string
    npm: string
  }
  name: string
  family?: string
  capabilities: {
    temperature: boolean
    reasoning: boolean
    attachment: boolean
    toolcall: boolean
    input: {
      text: boolean
      audio: boolean
      image: boolean
      video: boolean
      pdf: boolean
    }
    output: {
      text: boolean
      audio: boolean
      image: boolean
      video: boolean
      pdf: boolean
    }
    interleaved:
      | boolean
      | {
          field: "reasoning_content" | "reasoning_details"
        }
  }
  cost: {
    input: number
    output: number
    cache: {
      read: number
      write: number
    }
    experimentalOver200K?: {
      input: number
      output: number
      cache: {
        read: number
        write: number
      }
    }
  }
  limit: {
    context: number
    input?: number
    output: number
  }
  status: "alpha" | "beta" | "deprecated" | "active"
  options: {
    [key: string]: unknown
  }
  headers: {
    [key: string]: string
  }
  release_date: string
  variants?: {
    [key: string]: {
      [key: string]: unknown
    }
  }
}

export type Provider = {
  id: string
  name: string
  source: "env" | "config" | "custom" | "api"
  env: Array<string>
  key?: string
  options: {
    [key: string]: unknown
  }
  models: {
    [key: string]: Model
  }
}

export type ConsoleState = {
  consoleManagedProviders: Array<string>
  activeOrgName?: string
  switchableOrgCount: number
}

export type EffectHttpApiErrorInternalServerError = {
  _tag: "InternalServerError"
}

export type ToolListItem = {
  id: string
  description: string
  parameters: unknown
}

export type ToolList = Array<ToolListItem>

export type ToolIds = Array<string>

export type WorktreeCreateInput = {
  name?: string
  /**
   * Additional startup script to run after the project's start command
   */
  startCommand?: string
}

export type Worktree = {
  name: string
  branch?: string
  directory: string
}

export type WorktreeRemoveInput = {
  directory: string
}

export type WorktreeResetInput = {
  directory: string
}

export type ProjectSummary = {
  id: string
  name?: string
  worktree: string
}

export type GlobalSession = {
  id: string
  slug: string
  projectID: string
  workspaceID?: string
  directory: string
  path?: string
  parentID?: string
  summary?: {
    additions: number
    deletions: number
    files: number
    diffs?: Array<SnapshotFileDiff>
  }
  share?: {
    url: string
  }
  title: string
  agent?: string
  model?: {
    id: string
    providerID: string
    variant?: string
  }
  version: string
  time: {
    created: number
    updated: number
    compacting?: number
    archived?: number
  }
  permission?: PermissionRuleset
  revert?: {
    messageID: string
    partID?: string
    snapshot?: string
    diff?: string
  }
  project: ProjectSummary | null
}

export type McpResource = {
  name: string
  uri: string
  description?: string
  mimeType?: string
  client: string
}

export type Symbol = {
  name: string
  kind: number
  location: {
    uri: string
    range: Range
  }
}

export type FileNode = {
  name: string
  path: string
  absolute: string
  type: "file" | "directory"
  ignored: boolean
}

export type FileContent = {
  type: "text" | "binary"
  content: string
  diff?: string
  patch?: {
    oldFileName: string
    newFileName: string
    oldHeader?: string
    newHeader?: string
    hunks: Array<{
      oldStart: number
      oldLines: number
      newStart: number
      newLines: number
      lines: Array<string>
    }>
    index?: string
  }
  encoding?: "base64"
  mimeType?: string
}

export type File = {
  path: string
  added: number
  removed: number
  status: "added" | "deleted" | "modified"
}

export type Path = {
  home: string
  state: string
  config: string
  worktree: string
  directory: string
}

export type VcsInfo = {
  branch?: string
  default_branch?: string
}

export type VcsFileStatus = {
  file: string
  additions: number
  deletions: number
  status: "added" | "deleted" | "modified"
}

export type VcsFileDiff = {
  file: string
  patch?: string
  additions: number
  deletions: number
  status?: "added" | "deleted" | "modified"
}

export type VcsApplyError = {
  name: "VcsApplyError"
  data: {
    message: string
    reason: "non-git" | "not-clean"
  }
}

export type Command = {
  name: string
  description?: string
  agent?: string
  model?: string
  source?: "command" | "mcp" | "skill"
  template: string
  subtask?: boolean
  hints: Array<string>
}

export type Agent = {
  name: string
  description?: string
  mode: "subagent" | "primary" | "all"
  native?: boolean
  hidden?: boolean
  topP?: number
  temperature?: number
  color?: string
  permission: PermissionRuleset
  model?: {
    modelID: string
    providerID: string
  }
  variant?: string
  prompt?: string
  options: {
    [key: string]: unknown
  }
  steps?: number
}

export type LspStatus = {
  id: string
  name: string
  root: string
  status: "connected" | "error"
}

export type FormatterStatus = {
  name: string
  extensions: Array<string>
  enabled: boolean
}

export type McpStatusConnected = {
  status: "connected"
}

export type McpStatusDisabled = {
  status: "disabled"
}

export type McpStatusFailed = {
  status: "failed"
  error: string
}

export type McpStatusNeedsAuth = {
  status: "needs_auth"
}

export type McpStatusNeedsClientRegistration = {
  status: "needs_client_registration"
  error: string
}

export type McpStatus =
  | McpStatusConnected
  | McpStatusDisabled
  | McpStatusFailed
  | McpStatusNeedsAuth
  | McpStatusNeedsClientRegistration

export type McpUnsupportedOAuthError = {
  error: string
}

export type NotFoundError = {
  name: "NotFoundError"
  data: {
    message: string
  }
}

export type EffectHttpApiErrorForbidden = {
  _tag: "Forbidden"
}

export type ProviderAuthMethod = {
  type: "oauth" | "api"
  label: string
  prompts?: Array<
    | {
        type: "text"
        key: string
        message: string
        placeholder?: string
        when?: {
          key: string
          op: "eq" | "neq"
          value: string
        }
      }
    | {
        type: "select"
        key: string
        message: string
        options: Array<{
          label: string
          value: string
          hint?: string
        }>
        when?: {
          key: string
          op: "eq" | "neq"
          value: string
        }
      }
  >
}

export type ProviderAuthAuthorization = {
  url: string
  method: "auto" | "code"
  instructions: string
}

export type TextPartInput = {
  id?: string
  type: "text"
  text: string
  synthetic?: boolean
  ignored?: boolean
  time?: {
    start: number
    end?: number
  }
  metadata?: {
    [key: string]: unknown
  }
}

export type FilePartInput = {
  id?: string
  type: "file"
  mime: string
  filename?: string
  url: string
  source?: FilePartSource
}

export type AgentPartInput = {
  id?: string
  type: "agent"
  name: string
  source?: {
    value: string
    start: number
    end: number
  }
}

export type SubtaskPartInput = {
  id?: string
  type: "subtask"
  prompt: string
  description: string
  agent: string
  model?: {
    providerID: string
    modelID: string
  }
  command?: string
}

export type V2SessionsResponse = {
  items: Array<SessionInfo>
  cursor: {
    previous?: string
    next?: string
  }
}

export type V2SessionMessagesResponse = {
  items: Array<SessionMessage>
  cursor: {
    previous?: string
    next?: string
  }
}

export type EventTuiPromptAppend2 = {
  type: "tui.prompt.append"
  properties: {
    text: string
  }
}

export type EventTuiCommandExecute2 = {
  type: "tui.command.execute"
  properties: {
    command:
      | "session.list"
      | "session.new"
      | "session.share"
      | "session.interrupt"
      | "session.compact"
      | "session.page.up"
      | "session.page.down"
      | "session.line.up"
      | "session.line.down"
      | "session.half.page.up"
      | "session.half.page.down"
      | "session.first"
      | "session.last"
      | "prompt.clear"
      | "prompt.submit"
      | "agent.cycle"
      | string
  }
}

export type EventTuiToastShow2 = {
  type: "tui.toast.show"
  properties: {
    title?: string
    message: string
    variant: "info" | "success" | "warning" | "error"
    duration?: number
  }
}

export type EventTuiSessionSelect2 = {
  type: "tui.session.select"
  properties: {
    /**
     * Session ID to navigate to
     */
    sessionID: string
  }
}

export type Workspace = {
  id: string
  type: string
  name: string
  branch?: string | null
  directory?: string | null
  extra?: unknown | null
  projectID: string
  timeUsed: number | "NaN" | "Infinity" | "-Infinity" | "Infinity" | "-Infinity" | "NaN"
}

export type WorkspaceWarpError = {
  name: "WorkspaceWarpError"
  data: {
    message: string
  }
}

export type SyncEventMessageUpdated = {
  type: "sync"
  name: "message.updated.1"
  id: string
  seq: number
  aggregateID: "sessionID"
  data: {
    sessionID: string
    info: Message
  }
}

export type SyncEventMessageRemoved = {
  type: "sync"
  name: "message.removed.1"
  id: string
  seq: number
  aggregateID: "sessionID"
  data: {
    sessionID: string
    messageID: string
  }
}

export type SyncEventMessagePartUpdated = {
  type: "sync"
  name: "message.part.updated.1"
  id: string
  seq: number
  aggregateID: "sessionID"
  data: {
    sessionID: string
    part: Part
    time: number
  }
}

export type SyncEventMessagePartRemoved = {
  type: "sync"
  name: "message.part.removed.1"
  id: string
  seq: number
  aggregateID: "sessionID"
  data: {
    sessionID: string
    messageID: string
    partID: string
  }
}

export type SyncEventSessionCreated = {
  type: "sync"
  name: "session.created.1"
  id: string
  seq: number
  aggregateID: "sessionID"
  data: {
    sessionID: string
    info: Session
  }
}

export type SyncEventSessionUpdated = {
  type: "sync"
  name: "session.updated.1"
  id: string
  seq: number
  aggregateID: "sessionID"
  data: {
    sessionID: string
    info: {
      id?: string | null
      slug?: string | null
      projectID?: string | null
      workspaceID?: string | null
      directory?: string | null
      path?: string | null
      parentID?: string | null
      summary?: {
        additions: number
        deletions: number
        files: number
        diffs?: Array<SnapshotFileDiff>
      } | null
      share?: {
        url?: string | null
      }
      title?: string | null
      agent?: string | null
      model?: {
        id: string
        providerID: string
        variant?: string
      } | null
      version?: string | null
      time?: {
        created?: number | null
        updated?: number | null
        compacting?: number | null
        archived?: number | null
      }
      permission?: PermissionRuleset | null
      revert?: {
        messageID: string
        partID?: string
        snapshot?: string
        diff?: string
      } | null
    }
  }
}

export type SyncEventSessionDeleted = {
  type: "sync"
  name: "session.deleted.1"
  id: string
  seq: number
  aggregateID: "sessionID"
  data: {
    sessionID: string
    info: Session
  }
}

export type SyncEventSessionNextAgentSwitched = {
  type: "sync"
  name: "session.next.agent.switched.1"
  id: string
  seq: number
  aggregateID: "sessionID"
  data: {
    timestamp: number
    sessionID: string
    agent: string
  }
}

export type SyncEventSessionNextModelSwitched = {
  type: "sync"
  name: "session.next.model.switched.1"
  id: string
  seq: number
  aggregateID: "sessionID"
  data: {
    timestamp: number
    sessionID: string
    model: {
      id: string
      providerID: string
      variant: string
    }
  }
}

export type SyncEventSessionNextPrompted = {
  type: "sync"
  name: "session.next.prompted.1"
  id: string
  seq: number
  aggregateID: "sessionID"
  data: {
    timestamp: number
    sessionID: string
    prompt: Prompt
  }
}

export type SyncEventSessionNextSynthetic = {
  type: "sync"
  name: "session.next.synthetic.1"
  id: string
  seq: number
  aggregateID: "sessionID"
  data: {
    timestamp: number
    sessionID: string
    text: string
  }
}

export type SyncEventSessionNextShellStarted = {
  type: "sync"
  name: "session.next.shell.started.1"
  id: string
  seq: number
  aggregateID: "sessionID"
  data: {
    timestamp: number
    sessionID: string
    callID: string
    command: string
  }
}

export type SyncEventSessionNextShellEnded = {
  type: "sync"
  name: "session.next.shell.ended.1"
  id: string
  seq: number
  aggregateID: "sessionID"
  data: {
    timestamp: number
    sessionID: string
    callID: string
    output: string
  }
}

export type SyncEventSessionNextStepStarted = {
  type: "sync"
  name: "session.next.step.started.1"
  id: string
  seq: number
  aggregateID: "sessionID"
  data: {
    timestamp: number
    sessionID: string
    agent: string
    model: {
      id: string
      providerID: string
      variant: string
    }
    snapshot?: string
  }
}

export type SyncEventSessionNextStepEnded = {
  type: "sync"
  name: "session.next.step.ended.1"
  id: string
  seq: number
  aggregateID: "sessionID"
  data: {
    timestamp: number
    sessionID: string
    finish: string
    cost: number
    tokens: {
      input: number
      output: number
      reasoning: number
      cache: {
        read: number
        write: number
      }
    }
    snapshot?: string
  }
}

export type SyncEventSessionNextStepFailed = {
  type: "sync"
  name: "session.next.step.failed.1"
  id: string
  seq: number
  aggregateID: "sessionID"
  data: {
    timestamp: number
    sessionID: string
    error: SessionErrorUnknown
  }
}

export type SyncEventSessionNextTextStarted = {
  type: "sync"
  name: "session.next.text.started.1"
  id: string
  seq: number
  aggregateID: "sessionID"
  data: {
    timestamp: number
    sessionID: string
  }
}

export type SyncEventSessionNextTextDelta = {
  type: "sync"
  name: "session.next.text.delta.1"
  id: string
  seq: number
  aggregateID: "sessionID"
  data: {
    timestamp: number
    sessionID: string
    delta: string
  }
}

export type SyncEventSessionNextTextEnded = {
  type: "sync"
  name: "session.next.text.ended.1"
  id: string
  seq: number
  aggregateID: "sessionID"
  data: {
    timestamp: number
    sessionID: string
    text: string
  }
}

export type SyncEventSessionNextReasoningStarted = {
  type: "sync"
  name: "session.next.reasoning.started.1"
  id: string
  seq: number
  aggregateID: "sessionID"
  data: {
    timestamp: number
    sessionID: string
    reasoningID: string
  }
}

export type SyncEventSessionNextReasoningDelta = {
  type: "sync"
  name: "session.next.reasoning.delta.1"
  id: string
  seq: number
  aggregateID: "sessionID"
  data: {
    timestamp: number
    sessionID: string
    reasoningID: string
    delta: string
  }
}

export type SyncEventSessionNextReasoningEnded = {
  type: "sync"
  name: "session.next.reasoning.ended.1"
  id: string
  seq: number
  aggregateID: "sessionID"
  data: {
    timestamp: number
    sessionID: string
    reasoningID: string
    text: string
  }
}

export type SyncEventSessionNextToolInputStarted = {
  type: "sync"
  name: "session.next.tool.input.started.1"
  id: string
  seq: number
  aggregateID: "sessionID"
  data: {
    timestamp: number
    sessionID: string
    callID: string
    name: string
  }
}

export type SyncEventSessionNextToolInputDelta = {
  type: "sync"
  name: "session.next.tool.input.delta.1"
  id: string
  seq: number
  aggregateID: "sessionID"
  data: {
    timestamp: number
    sessionID: string
    callID: string
    delta: string
  }
}

export type SyncEventSessionNextToolInputEnded = {
  type: "sync"
  name: "session.next.tool.input.ended.1"
  id: string
  seq: number
  aggregateID: "sessionID"
  data: {
    timestamp: number
    sessionID: string
    callID: string
    text: string
  }
}

export type SyncEventSessionNextToolCalled = {
  type: "sync"
  name: "session.next.tool.called.1"
  id: string
  seq: number
  aggregateID: "sessionID"
  data: {
    timestamp: number
    sessionID: string
    callID: string
    tool: string
    input: {
      [key: string]: unknown
    }
    provider: {
      executed: boolean
      metadata?: {
        [key: string]: unknown
      }
    }
  }
}

export type SyncEventSessionNextToolProgress = {
  type: "sync"
  name: "session.next.tool.progress.1"
  id: string
  seq: number
  aggregateID: "sessionID"
  data: {
    timestamp: number
    sessionID: string
    callID: string
    structured: {
      [key: string]: unknown
    }
    content: Array<ToolTextContent | ToolFileContent>
  }
}

export type SyncEventSessionNextToolSuccess = {
  type: "sync"
  name: "session.next.tool.success.1"
  id: string
  seq: number
  aggregateID: "sessionID"
  data: {
    timestamp: number
    sessionID: string
    callID: string
    structured: {
      [key: string]: unknown
    }
    content: Array<ToolTextContent | ToolFileContent>
    provider: {
      executed: boolean
      metadata?: {
        [key: string]: unknown
      }
    }
  }
}

export type SyncEventSessionNextToolFailed = {
  type: "sync"
  name: "session.next.tool.failed.1"
  id: string
  seq: number
  aggregateID: "sessionID"
  data: {
    timestamp: number
    sessionID: string
    callID: string
    error: SessionErrorUnknown
    provider: {
      executed: boolean
      metadata?: {
        [key: string]: unknown
      }
    }
  }
}

export type SyncEventSessionNextRetried = {
  type: "sync"
  name: "session.next.retried.1"
  id: string
  seq: number
  aggregateID: "sessionID"
  data: {
    timestamp: number
    sessionID: string
    attempt: number
    error: SessionNextRetryError
  }
}

export type SyncEventSessionNextCompactionStarted = {
  type: "sync"
  name: "session.next.compaction.started.1"
  id: string
  seq: number
  aggregateID: "sessionID"
  data: {
    timestamp: number
    sessionID: string
    reason: "auto" | "manual"
  }
}

export type SyncEventSessionNextCompactionDelta = {
  type: "sync"
  name: "session.next.compaction.delta.1"
  id: string
  seq: number
  aggregateID: "sessionID"
  data: {
    timestamp: number
    sessionID: string
    text: string
  }
}

export type SyncEventSessionNextCompactionEnded = {
  type: "sync"
  name: "session.next.compaction.ended.1"
  id: string
  seq: number
  aggregateID: "sessionID"
  data: {
    timestamp: number
    sessionID: string
    text: string
    include?: string
  }
}

export type EventServerInstanceDisposed = {
  id: string
  type: "server.instance.disposed"
  properties: {
    directory: string
  }
}

export type EventFileEdited = {
  id: string
  type: "file.edited"
  properties: {
    file: string
  }
}

export type EventFileWatcherUpdated = {
  id: string
  type: "file.watcher.updated"
  properties: {
    file: string
    event: "add" | "change" | "unlink"
  }
}

export type EventLspClientDiagnostics = {
  id: string
  type: "lsp.client.diagnostics"
  properties: {
    serverID: string
    path: string
  }
}

export type EventLspUpdated = {
  id: string
  type: "lsp.updated"
  properties: {
    [key: string]: unknown
  }
}

export type EventMessagePartDelta = {
  id: string
  type: "message.part.delta"
  properties: {
    sessionID: string
    messageID: string
    partID: string
    field: string
    delta: string
  }
}

export type EventPermissionAsked = {
  id: string
  type: "permission.asked"
  properties: PermissionRequest
}

export type EventPermissionReplied = {
  id: string
  type: "permission.replied"
  properties: {
    sessionID: string
    requestID: string
    reply: "once" | "always" | "reject"
  }
}

export type EventSessionDiff = {
  id: string
  type: "session.diff"
  properties: {
    sessionID: string
    diff: Array<SnapshotFileDiff>
  }
}

export type EventSessionError = {
  id: string
  type: "session.error"
  properties: {
    sessionID?: string
    error?:
      | ProviderAuthError
      | UnknownError
      | MessageOutputLengthError
      | MessageAbortedError
      | StructuredOutputError
      | ContextOverflowError
      | ApiError
  }
}

export type EventInstallationUpdated = {
  id: string
  type: "installation.updated"
  properties: {
    version: string
  }
}

export type EventInstallationUpdateAvailable = {
  id: string
  type: "installation.update-available"
  properties: {
    version: string
  }
}

export type EventQuestionAsked = {
  id: string
  type: "question.asked"
  properties: QuestionRequest
}

export type EventQuestionReplied = {
  id: string
  type: "question.replied"
  properties: QuestionReplied
}

export type EventQuestionRejected = {
  id: string
  type: "question.rejected"
  properties: QuestionRejected
}

export type EventTodoUpdated = {
  id: string
  type: "todo.updated"
  properties: {
    sessionID: string
    todos: Array<Todo>
  }
}

export type EventSessionStatus = {
  id: string
  type: "session.status"
  properties: {
    sessionID: string
    status: SessionStatus
  }
}

export type EventSessionIdle = {
  id: string
  type: "session.idle"
  properties: {
    sessionID: string
  }
}

export type EventSessionCompacted = {
  id: string
  type: "session.compacted"
  properties: {
    sessionID: string
  }
}

export type EventMcpToolsChanged = {
  id: string
  type: "mcp.tools.changed"
  properties: {
    server: string
  }
}

export type EventMcpBrowserOpenFailed = {
  id: string
  type: "mcp.browser.open.failed"
  properties: {
    mcpName: string
    url: string
  }
}

export type EventCommandExecuted = {
  id: string
  type: "command.executed"
  properties: {
    name: string
    sessionID: string
    arguments: string
    messageID: string
  }
}

export type EventProjectUpdated = {
  id: string
  type: "project.updated"
  properties: Project
}

export type EventVcsBranchUpdated = {
  id: string
  type: "vcs.branch.updated"
  properties: {
    branch?: string
  }
}

export type EventWorkspaceReady = {
  id: string
  type: "workspace.ready"
  properties: {
    name: string
  }
}

export type EventWorkspaceFailed = {
  id: string
  type: "workspace.failed"
  properties: {
    message: string
  }
}

export type EventWorkspaceStatus = {
  id: string
  type: "workspace.status"
  properties: {
    workspaceID: string
    status: "connected" | "connecting" | "disconnected" | "error"
  }
}

export type EventWorktreeReady = {
  id: string
  type: "worktree.ready"
  properties: {
    name: string
    branch?: string
  }
}

export type EventWorktreeFailed = {
  id: string
  type: "worktree.failed"
  properties: {
    message: string
  }
}

export type EventPtyCreated = {
  id: string
  type: "pty.created"
  properties: {
    info: Pty
  }
}

export type EventPtyUpdated = {
  id: string
  type: "pty.updated"
  properties: {
    info: Pty
  }
}

export type EventPtyExited = {
  id: string
  type: "pty.exited"
  properties: {
    id: string
    exitCode: number
  }
}

export type EventPtyDeleted = {
  id: string
  type: "pty.deleted"
  properties: {
    id: string
  }
}

export type EventMessageUpdated = {
  id: string
  type: "message.updated"
  properties: {
    sessionID: string
    info: Message
  }
}

export type EventMessageRemoved = {
  id: string
  type: "message.removed"
  properties: {
    sessionID: string
    messageID: string
  }
}

export type EventMessagePartUpdated = {
  id: string
  type: "message.part.updated"
  properties: {
    sessionID: string
    part: Part
    time: number
  }
}

export type EventMessagePartRemoved = {
  id: string
  type: "message.part.removed"
  properties: {
    sessionID: string
    messageID: string
    partID: string
  }
}

export type EventSessionCreated = {
  id: string
  type: "session.created"
  properties: {
    sessionID: string
    info: Session
  }
}

export type EventSessionUpdated = {
  id: string
  type: "session.updated"
  properties: {
    sessionID: string
    info: Session
  }
}

export type EventSessionDeleted = {
  id: string
  type: "session.deleted"
  properties: {
    sessionID: string
    info: Session
  }
}

export type EventSessionNextAgentSwitched = {
  id: string
  type: "session.next.agent.switched"
  properties: {
    timestamp: number
    sessionID: string
    agent: string
  }
}

export type EventSessionNextModelSwitched = {
  id: string
  type: "session.next.model.switched"
  properties: {
    timestamp: number
    sessionID: string
    model: {
      id: string
      providerID: string
      variant: string
    }
  }
}

export type PromptSource = {
  start: number
  end: number
  text: string
}

export type PromptFileAttachment = {
  uri: string
  mime: string
  name?: string
  description?: string
  source?: PromptSource
}

export type PromptAgentAttachment = {
  name: string
  source?: PromptSource
}

export type PromptReferenceAttachment = {
  name: string
  kind: "local" | "git" | "invalid"
  uri?: string
  repository?: string
  branch?: string
  target?: string
  targetUri?: string
  problem?: string
  source?: PromptSource
}

export type EventSessionNextPrompted = {
  id: string
  type: "session.next.prompted"
  properties: {
    timestamp: number
    sessionID: string
    prompt: Prompt
  }
}

export type EventSessionNextSynthetic = {
  id: string
  type: "session.next.synthetic"
  properties: {
    timestamp: number
    sessionID: string
    text: string
  }
}

export type EventSessionNextShellStarted = {
  id: string
  type: "session.next.shell.started"
  properties: {
    timestamp: number
    sessionID: string
    callID: string
    command: string
  }
}

export type EventSessionNextShellEnded = {
  id: string
  type: "session.next.shell.ended"
  properties: {
    timestamp: number
    sessionID: string
    callID: string
    output: string
  }
}

export type EventSessionNextStepStarted = {
  id: string
  type: "session.next.step.started"
  properties: {
    timestamp: number
    sessionID: string
    agent: string
    model: {
      id: string
      providerID: string
      variant: string
    }
    snapshot?: string
  }
}

export type EventSessionNextStepEnded = {
  id: string
  type: "session.next.step.ended"
  properties: {
    timestamp: number
    sessionID: string
    finish: string
    cost: number
    tokens: {
      input: number
      output: number
      reasoning: number
      cache: {
        read: number
        write: number
      }
    }
    snapshot?: string
  }
}

export type SessionErrorUnknown = {
  type: "unknown"
  message: string
}

export type EventSessionNextStepFailed = {
  id: string
  type: "session.next.step.failed"
  properties: {
    timestamp: number
    sessionID: string
    error: SessionErrorUnknown
  }
}

export type EventSessionNextTextStarted = {
  id: string
  type: "session.next.text.started"
  properties: {
    timestamp: number
    sessionID: string
  }
}

export type EventSessionNextTextDelta = {
  id: string
  type: "session.next.text.delta"
  properties: {
    timestamp: number
    sessionID: string
    delta: string
  }
}

export type EventSessionNextTextEnded = {
  id: string
  type: "session.next.text.ended"
  properties: {
    timestamp: number
    sessionID: string
    text: string
  }
}

export type EventSessionNextReasoningStarted = {
  id: string
  type: "session.next.reasoning.started"
  properties: {
    timestamp: number
    sessionID: string
    reasoningID: string
  }
}

export type EventSessionNextReasoningDelta = {
  id: string
  type: "session.next.reasoning.delta"
  properties: {
    timestamp: number
    sessionID: string
    reasoningID: string
    delta: string
  }
}

export type EventSessionNextReasoningEnded = {
  id: string
  type: "session.next.reasoning.ended"
  properties: {
    timestamp: number
    sessionID: string
    reasoningID: string
    text: string
  }
}

export type EventSessionNextToolInputStarted = {
  id: string
  type: "session.next.tool.input.started"
  properties: {
    timestamp: number
    sessionID: string
    callID: string
    name: string
  }
}

export type EventSessionNextToolInputDelta = {
  id: string
  type: "session.next.tool.input.delta"
  properties: {
    timestamp: number
    sessionID: string
    callID: string
    delta: string
  }
}

export type EventSessionNextToolInputEnded = {
  id: string
  type: "session.next.tool.input.ended"
  properties: {
    timestamp: number
    sessionID: string
    callID: string
    text: string
  }
}

export type EventSessionNextToolCalled = {
  id: string
  type: "session.next.tool.called"
  properties: {
    timestamp: number
    sessionID: string
    callID: string
    tool: string
    input: {
      [key: string]: unknown
    }
    provider: {
      executed: boolean
      metadata?: {
        [key: string]: unknown
      }
    }
  }
}

export type ToolTextContent = {
  type: "text"
  text: string
}

export type ToolFileContent = {
  type: "file"
  uri: string
  mime: string
  name?: string
}

export type EventSessionNextToolProgress = {
  id: string
  type: "session.next.tool.progress"
  properties: {
    timestamp: number
    sessionID: string
    callID: string
    structured: {
      [key: string]: unknown
    }
    content: Array<ToolTextContent | ToolFileContent>
  }
}

export type EventSessionNextToolSuccess = {
  id: string
  type: "session.next.tool.success"
  properties: {
    timestamp: number
    sessionID: string
    callID: string
    structured: {
      [key: string]: unknown
    }
    content: Array<ToolTextContent | ToolFileContent>
    provider: {
      executed: boolean
      metadata?: {
        [key: string]: unknown
      }
    }
  }
}

export type EventSessionNextToolFailed = {
  id: string
  type: "session.next.tool.failed"
  properties: {
    timestamp: number
    sessionID: string
    callID: string
    error: SessionErrorUnknown
    provider: {
      executed: boolean
      metadata?: {
        [key: string]: unknown
      }
    }
  }
}

export type SessionNextRetryError = {
  message: string
  statusCode?: number
  isRetryable: boolean
  responseHeaders?: {
    [key: string]: string
  }
  responseBody?: string
  metadata?: {
    [key: string]: string
  }
}

export type EventSessionNextRetried = {
  id: string
  type: "session.next.retried"
  properties: {
    timestamp: number
    sessionID: string
    attempt: number
    error: SessionNextRetryError
  }
}

export type EventSessionNextCompactionStarted = {
  id: string
  type: "session.next.compaction.started"
  properties: {
    timestamp: number
    sessionID: string
    reason: "auto" | "manual"
  }
}

export type EventSessionNextCompactionDelta = {
  id: string
  type: "session.next.compaction.delta"
  properties: {
    timestamp: number
    sessionID: string
    text: string
  }
}

export type EventSessionNextCompactionEnded = {
  id: string
  type: "session.next.compaction.ended"
  properties: {
    timestamp: number
    sessionID: string
    text: string
    include?: string
  }
}

export type EventServerConnected = {
  id: string
  type: "server.connected"
  properties: {
    [key: string]: unknown
  }
}

export type EventGlobalDisposed = {
  id: string
  type: "global.disposed"
  properties: {
    [key: string]: unknown
  }
}

export type SessionInfo = {
  id: string
  parentID?: string
  projectID: string
  workspaceID?: string
  path?: string
  agent?: string
  model?: {
    id: string
    providerID: string
    variant: string
  }
  time: {
    created: number
    updated: number
    archived?: number
  }
  title: string
}

export type SessionDelivery = "immediate" | "deferred"

export type SessionMessageAgentSwitched = {
  id: string
  metadata?: {
    [key: string]: unknown
  }
  time: {
    created: number
  }
  type: "agent-switched"
  agent: string
}

export type SessionMessageModelSwitched = {
  id: string
  metadata?: {
    [key: string]: unknown
  }
  time: {
    created: number
  }
  type: "model-switched"
  model: {
    id: string
    providerID: string
    variant: string
  }
}

export type SessionMessageUser = {
  id: string
  metadata?: {
    [key: string]: unknown
  }
  time: {
    created: number
  }
  text: string
  files?: Array<PromptFileAttachment>
  agents?: Array<PromptAgentAttachment>
  references?: Array<PromptReferenceAttachment>
  type: "user"
}

export type SessionMessageSynthetic = {
  id: string
  metadata?: {
    [key: string]: unknown
  }
  time: {
    created: number
  }
  sessionID: string
  text: string
  type: "synthetic"
}

export type SessionMessageShell = {
  id: string
  metadata?: {
    [key: string]: unknown
  }
  time: {
    created: number
    completed?: number
  }
  type: "shell"
  callID: string
  command: string
  output: string
}

export type SessionMessageAssistantText = {
  type: "text"
  text: string
}

export type SessionMessageAssistantReasoning = {
  type: "reasoning"
  id: string
  text: string
}

export type SessionMessageToolStatePending = {
  status: "pending"
  input: string
}

export type SessionMessageToolStateRunning = {
  status: "running"
  input: {
    [key: string]: unknown
  }
  structured: {
    [key: string]: unknown
  }
  content: Array<ToolTextContent | ToolFileContent>
}

export type SessionMessageToolStateCompleted = {
  status: "completed"
  input: {
    [key: string]: unknown
  }
  attachments?: Array<PromptFileAttachment>
  content: Array<ToolTextContent | ToolFileContent>
  structured: {
    [key: string]: unknown
  }
}

export type SessionMessageToolStateError = {
  status: "error"
  input: {
    [key: string]: unknown
  }
  content: Array<ToolTextContent | ToolFileContent>
  structured: {
    [key: string]: unknown
  }
  error: SessionErrorUnknown
}

export type SessionMessageAssistantTool = {
  type: "tool"
  id: string
  name: string
  provider?: {
    executed: boolean
    metadata?: {
      [key: string]: unknown
    }
  }
  state:
    | SessionMessageToolStatePending
    | SessionMessageToolStateRunning
    | SessionMessageToolStateCompleted
    | SessionMessageToolStateError
  time: {
    created: number
    ran?: number
    completed?: number
    pruned?: number
  }
}

export type SessionMessageAssistant = {
  id: string
  metadata?: {
    [key: string]: unknown
  }
  time: {
    created: number
    completed?: number
  }
  type: "assistant"
  agent: string
  model: {
    id: string
    providerID: string
    variant: string
  }
  content: Array<SessionMessageAssistantText | SessionMessageAssistantReasoning | SessionMessageAssistantTool>
  snapshot?: {
    start?: string
    end?: string
  }
  finish?: string
  cost?: number
  tokens?: {
    input: number
    output: number
    reasoning: number
    cache: {
      read: number
      write: number
    }
  }
  error?: SessionErrorUnknown
}

export type SessionMessageCompaction = {
  type: "compaction"
  reason: "auto" | "manual"
  summary: string
  include?: string
  id: string
  metadata?: {
    [key: string]: unknown
  }
  time: {
    created: number
  }
}

export type SessionMessage =
  | SessionMessageAgentSwitched
  | SessionMessageModelSwitched
  | SessionMessageUser
  | SessionMessageSynthetic
  | SessionMessageShell
  | SessionMessageAssistant
  | SessionMessageCompaction

export type EventTuiToastShow1 = {
  id: string
  type: "tui.toast.show"
  properties: {
    title?: string
    message: string
    variant: "info" | "success" | "warning" | "error"
    duration?: number
  }
}

export type BadRequestError = {
  name: "BadRequest"
  data: {
    message: string
    kind?: "Params" | "Headers" | "Query" | "Body" | "Payload"
  }
}

export type AuthRemoveData = {
  body?: never
  path: {
    providerID: string
  }
  query?: never
  url: "/auth/{providerID}"
}

export type AuthRemoveErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
}

export type AuthRemoveError = AuthRemoveErrors[keyof AuthRemoveErrors]

export type AuthRemoveResponses = {
  /**
   * Successfully removed authentication credentials
   */
  200: boolean
}

export type AuthRemoveResponse = AuthRemoveResponses[keyof AuthRemoveResponses]

export type AuthSetData = {
  body?: Auth
  path: {
    providerID: string
  }
  query?: never
  url: "/auth/{providerID}"
}

export type AuthSetErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
}

export type AuthSetError = AuthSetErrors[keyof AuthSetErrors]

export type AuthSetResponses = {
  /**
   * Successfully set authentication credentials
   */
  200: boolean
}

export type AuthSetResponse = AuthSetResponses[keyof AuthSetResponses]

export type AppLogData = {
  body?: {
    /**
     * Service name for the log entry
     */
    service: string
    /**
     * Log level
     */
    level: "debug" | "info" | "error" | "warn"
    /**
     * Log message
     */
    message: string
    extra?: {
      [key: string]: unknown
    }
  }
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/log"
}

export type AppLogErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
}

export type AppLogError = AppLogErrors[keyof AppLogErrors]

export type AppLogResponses = {
  /**
   * Log entry written successfully
   */
  200: boolean
}

export type AppLogResponse = AppLogResponses[keyof AppLogResponses]

export type GlobalHealthData = {
  body?: never
  path?: never
  query?: never
  url: "/global/health"
}

export type GlobalHealthResponses = {
  /**
   * Health information
   */
  200: {
    healthy: true
    version: string
  }
}

export type GlobalHealthResponse = GlobalHealthResponses[keyof GlobalHealthResponses]

export type GlobalEventData = {
  body?: never
  path?: never
  query?: never
  url: "/global/event"
}

export type GlobalEventResponses = {
  /**
   * Event stream
   */
  200: GlobalEvent
}

export type GlobalEventResponse = GlobalEventResponses[keyof GlobalEventResponses]

export type GlobalConfigGetData = {
  body?: never
  path?: never
  query?: never
  url: "/global/config"
}

export type GlobalConfigGetResponses = {
  /**
   * Get global config info
   */
  200: Config
}

export type GlobalConfigGetResponse = GlobalConfigGetResponses[keyof GlobalConfigGetResponses]

export type GlobalConfigUpdateData = {
  body?: Config
  path?: never
  query?: never
  url: "/global/config"
}

export type GlobalConfigUpdateErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
}

export type GlobalConfigUpdateError = GlobalConfigUpdateErrors[keyof GlobalConfigUpdateErrors]

export type GlobalConfigUpdateResponses = {
  /**
   * Successfully updated global config
   */
  200: Config
}

export type GlobalConfigUpdateResponse = GlobalConfigUpdateResponses[keyof GlobalConfigUpdateResponses]

export type GlobalDisposeData = {
  body?: never
  path?: never
  query?: never
  url: "/global/dispose"
}

export type GlobalDisposeResponses = {
  /**
   * Global disposed
   */
  200: boolean
}

export type GlobalDisposeResponse = GlobalDisposeResponses[keyof GlobalDisposeResponses]

export type GlobalUpgradeData = {
  body?: {
    target?: string
  }
  path?: never
  query?: never
  url: "/global/upgrade"
}

export type GlobalUpgradeErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
}

export type GlobalUpgradeError = GlobalUpgradeErrors[keyof GlobalUpgradeErrors]

export type GlobalUpgradeResponses = {
  /**
   * Upgrade result
   */
  200:
    | {
        success: true
        version: string
      }
    | {
        success: false
        error: string
      }
}

export type GlobalUpgradeResponse = GlobalUpgradeResponses[keyof GlobalUpgradeResponses]

export type EventSubscribeData = {
  body?: never
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/event"
}

export type EventSubscribeResponses = {
  /**
   * Event stream
   */
  200: Event
}

export type EventSubscribeResponse = EventSubscribeResponses[keyof EventSubscribeResponses]

export type ConfigGetData = {
  body?: never
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/config"
}

export type ConfigGetResponses = {
  /**
   * Get config info
   */
  200: Config
}

export type ConfigGetResponse = ConfigGetResponses[keyof ConfigGetResponses]

export type ConfigUpdateData = {
  body?: Config
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/config"
}

export type ConfigUpdateErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
}

export type ConfigUpdateError = ConfigUpdateErrors[keyof ConfigUpdateErrors]

export type ConfigUpdateResponses = {
  /**
   * Successfully updated config
   */
  200: Config
}

export type ConfigUpdateResponse = ConfigUpdateResponses[keyof ConfigUpdateResponses]

export type ConfigProvidersData = {
  body?: never
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/config/providers"
}

export type ConfigProvidersResponses = {
  /**
   * List of providers
   */
  200: {
    providers: Array<Provider>
    default: {
      [key: string]: string
    }
  }
}

export type ConfigProvidersResponse = ConfigProvidersResponses[keyof ConfigProvidersResponses]

export type ExperimentalConsoleGetData = {
  body?: never
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/experimental/console"
}

export type ExperimentalConsoleGetErrors = {
  /**
   * InternalServerError
   */
  500: EffectHttpApiErrorInternalServerError
}

export type ExperimentalConsoleGetError = ExperimentalConsoleGetErrors[keyof ExperimentalConsoleGetErrors]

export type ExperimentalConsoleGetResponses = {
  /**
   * Active Console provider metadata
   */
  200: ConsoleState
}

export type ExperimentalConsoleGetResponse = ExperimentalConsoleGetResponses[keyof ExperimentalConsoleGetResponses]

export type ExperimentalConsoleListOrgsData = {
  body?: never
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/experimental/console/orgs"
}

export type ExperimentalConsoleListOrgsErrors = {
  /**
   * InternalServerError
   */
  500: EffectHttpApiErrorInternalServerError
}

export type ExperimentalConsoleListOrgsError =
  ExperimentalConsoleListOrgsErrors[keyof ExperimentalConsoleListOrgsErrors]

export type ExperimentalConsoleListOrgsResponses = {
  /**
   * Switchable Console orgs
   */
  200: {
    orgs: Array<{
      accountID: string
      accountEmail: string
      accountUrl: string
      orgID: string
      orgName: string
      active: boolean
    }>
  }
}

export type ExperimentalConsoleListOrgsResponse =
  ExperimentalConsoleListOrgsResponses[keyof ExperimentalConsoleListOrgsResponses]

export type ExperimentalConsoleSwitchOrgData = {
  body?: {
    accountID: string
    orgID: string
  }
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/experimental/console/switch"
}

export type ExperimentalConsoleSwitchOrgResponses = {
  /**
   * Switch success
   */
  200: boolean
}

export type ExperimentalConsoleSwitchOrgResponse =
  ExperimentalConsoleSwitchOrgResponses[keyof ExperimentalConsoleSwitchOrgResponses]

export type ToolListData = {
  body?: never
  path?: never
  query: {
    directory?: string
    workspace?: string
    provider: string
    model: string
  }
  url: "/experimental/tool"
}

export type ToolListErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
}

export type ToolListError = ToolListErrors[keyof ToolListErrors]

export type ToolListResponses = {
  /**
   * Tools
   */
  200: ToolList
}

export type ToolListResponse = ToolListResponses[keyof ToolListResponses]

export type ToolIdsData = {
  body?: never
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/experimental/tool/ids"
}

export type ToolIdsErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
}

export type ToolIdsError = ToolIdsErrors[keyof ToolIdsErrors]

export type ToolIdsResponses = {
  /**
   * Tool IDs
   */
  200: ToolIds
}

export type ToolIdsResponse = ToolIdsResponses[keyof ToolIdsResponses]

export type WorktreeRemoveData = {
  body?: WorktreeRemoveInput
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/experimental/worktree"
}

export type WorktreeRemoveErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
}

export type WorktreeRemoveError = WorktreeRemoveErrors[keyof WorktreeRemoveErrors]

export type WorktreeRemoveResponses = {
  /**
   * Worktree removed
   */
  200: boolean
}

export type WorktreeRemoveResponse = WorktreeRemoveResponses[keyof WorktreeRemoveResponses]

export type WorktreeListData = {
  body?: never
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/experimental/worktree"
}

export type WorktreeListResponses = {
  /**
   * List of worktree directories
   */
  200: Array<string>
}

export type WorktreeListResponse = WorktreeListResponses[keyof WorktreeListResponses]

export type WorktreeCreateData = {
  body?: WorktreeCreateInput
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/experimental/worktree"
}

export type WorktreeCreateErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
}

export type WorktreeCreateError = WorktreeCreateErrors[keyof WorktreeCreateErrors]

export type WorktreeCreateResponses = {
  /**
   * Worktree created
   */
  200: Worktree
}

export type WorktreeCreateResponse = WorktreeCreateResponses[keyof WorktreeCreateResponses]

export type WorktreeResetData = {
  body?: WorktreeResetInput
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/experimental/worktree/reset"
}

export type WorktreeResetErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
}

export type WorktreeResetError = WorktreeResetErrors[keyof WorktreeResetErrors]

export type WorktreeResetResponses = {
  /**
   * Worktree reset
   */
  200: boolean
}

export type WorktreeResetResponse = WorktreeResetResponses[keyof WorktreeResetResponses]

export type ExperimentalSessionListData = {
  body?: never
  path?: never
  query?: {
    directory?: string
    workspace?: string
    roots?: boolean | "true" | "false"
    start?: number
    cursor?: number
    search?: string
    limit?: number
    archived?: boolean | "true" | "false"
  }
  url: "/experimental/session"
}

export type ExperimentalSessionListResponses = {
  /**
   * List of sessions
   */
  200: Array<GlobalSession>
}

export type ExperimentalSessionListResponse = ExperimentalSessionListResponses[keyof ExperimentalSessionListResponses]

export type ExperimentalResourceListData = {
  body?: never
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/experimental/resource"
}

export type ExperimentalResourceListResponses = {
  /**
   * MCP resources
   */
  200: {
    [key: string]: McpResource
  }
}

export type ExperimentalResourceListResponse =
  ExperimentalResourceListResponses[keyof ExperimentalResourceListResponses]

export type FindTextData = {
  body?: never
  path?: never
  query: {
    directory?: string
    workspace?: string
    pattern: string
  }
  url: "/find"
}

export type FindTextResponses = {
  /**
   * Matches
   */
  200: Array<{
    path: {
      text: string
    }
    lines: {
      text: string
    }
    line_number: number
    absolute_offset: number
    submatches: Array<{
      match: {
        text: string
      }
      start: number
      end: number
    }>
  }>
}

export type FindTextResponse = FindTextResponses[keyof FindTextResponses]

export type FindFilesData = {
  body?: never
  path?: never
  query: {
    directory?: string
    workspace?: string
    query: string
    dirs?: "true" | "false"
    type?: "file" | "directory"
    limit?: number
  }
  url: "/find/file"
}

export type FindFilesResponses = {
  /**
   * File paths
   */
  200: Array<string>
}

export type FindFilesResponse = FindFilesResponses[keyof FindFilesResponses]

export type FindSymbolsData = {
  body?: never
  path?: never
  query: {
    directory?: string
    workspace?: string
    query: string
  }
  url: "/find/symbol"
}

export type FindSymbolsResponses = {
  /**
   * Symbols
   */
  200: Array<Symbol>
}

export type FindSymbolsResponse = FindSymbolsResponses[keyof FindSymbolsResponses]

export type FileListData = {
  body?: never
  path?: never
  query: {
    directory?: string
    workspace?: string
    path: string
  }
  url: "/file"
}

export type FileListResponses = {
  /**
   * Files and directories
   */
  200: Array<FileNode>
}

export type FileListResponse = FileListResponses[keyof FileListResponses]

export type FileReadData = {
  body?: never
  path?: never
  query: {
    directory?: string
    workspace?: string
    path: string
  }
  url: "/file/content"
}

export type FileReadResponses = {
  /**
   * File content
   */
  200: FileContent
}

export type FileReadResponse = FileReadResponses[keyof FileReadResponses]

export type FileStatusData = {
  body?: never
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/file/status"
}

export type FileStatusResponses = {
  /**
   * File status
   */
  200: Array<File>
}

export type FileStatusResponse = FileStatusResponses[keyof FileStatusResponses]

export type InstanceDisposeData = {
  body?: never
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/instance/dispose"
}

export type InstanceDisposeResponses = {
  /**
   * Instance disposed
   */
  200: boolean
}

export type InstanceDisposeResponse = InstanceDisposeResponses[keyof InstanceDisposeResponses]

export type PathGetData = {
  body?: never
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/path"
}

export type PathGetResponses = {
  /**
   * Path
   */
  200: Path
}

export type PathGetResponse = PathGetResponses[keyof PathGetResponses]

export type VcsGetData = {
  body?: never
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/vcs"
}

export type VcsGetResponses = {
  /**
   * VCS info
   */
  200: VcsInfo
}

export type VcsGetResponse = VcsGetResponses[keyof VcsGetResponses]

export type VcsStatusData = {
  body?: never
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/vcs/status"
}

export type VcsStatusResponses = {
  /**
   * VCS status
   */
  200: Array<VcsFileStatus>
}

export type VcsStatusResponse = VcsStatusResponses[keyof VcsStatusResponses]

export type VcsDiffData = {
  body?: never
  path?: never
  query: {
    directory?: string
    workspace?: string
    mode: "git" | "branch"
  }
  url: "/vcs/diff"
}

export type VcsDiffResponses = {
  /**
   * VCS diff
   */
  200: Array<VcsFileDiff>
}

export type VcsDiffResponse = VcsDiffResponses[keyof VcsDiffResponses]

export type VcsDiffRawData = {
  body?: never
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/vcs/diff/raw"
}

export type VcsDiffRawResponses = {
  /**
   * Raw VCS diff
   */
  200: string
}

export type VcsDiffRawResponse = VcsDiffRawResponses[keyof VcsDiffRawResponses]

export type VcsApplyData = {
  body?: {
    patch: string
  }
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/vcs/apply"
}

export type VcsApplyErrors = {
  /**
   * VcsApplyError
   */
  400: VcsApplyError
}

export type VcsApplyError2 = VcsApplyErrors[keyof VcsApplyErrors]

export type VcsApplyResponses = {
  /**
   * VCS patch applied
   */
  200: {
    applied: boolean
  }
}

export type VcsApplyResponse = VcsApplyResponses[keyof VcsApplyResponses]

export type CommandListData = {
  body?: never
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/command"
}

export type CommandListResponses = {
  /**
   * List of commands
   */
  200: Array<Command>
}

export type CommandListResponse = CommandListResponses[keyof CommandListResponses]

export type AppAgentsData = {
  body?: never
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/agent"
}

export type AppAgentsResponses = {
  /**
   * List of agents
   */
  200: Array<Agent>
}

export type AppAgentsResponse = AppAgentsResponses[keyof AppAgentsResponses]

export type AppSkillsData = {
  body?: never
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/skill"
}

export type AppSkillsResponses = {
  /**
   * List of skills
   */
  200: Array<{
    name: string
    description?: string
    location: string
    content: string
  }>
}

export type AppSkillsResponse = AppSkillsResponses[keyof AppSkillsResponses]

export type LspStatusData = {
  body?: never
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/lsp"
}

export type LspStatusResponses = {
  /**
   * LSP server status
   */
  200: Array<LspStatus>
}

export type LspStatusResponse = LspStatusResponses[keyof LspStatusResponses]

export type FormatterStatusData = {
  body?: never
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/formatter"
}

export type FormatterStatusResponses = {
  /**
   * Formatter status
   */
  200: Array<FormatterStatus>
}

export type FormatterStatusResponse = FormatterStatusResponses[keyof FormatterStatusResponses]

export type McpStatusData = {
  body?: never
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/mcp"
}

export type McpStatusResponses = {
  /**
   * MCP server status
   */
  200: {
    [key: string]: McpStatus
  }
}

export type McpStatusResponse = McpStatusResponses[keyof McpStatusResponses]

export type McpAddData = {
  body?: {
    name: string
    config: McpLocalConfig | McpRemoteConfig
  }
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/mcp"
}

export type McpAddErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
}

export type McpAddError = McpAddErrors[keyof McpAddErrors]

export type McpAddResponses = {
  /**
   * MCP server added successfully
   */
  200: {
    [key: string]: McpStatus
  }
}

export type McpAddResponse = McpAddResponses[keyof McpAddResponses]

export type McpAuthRemoveData = {
  body?: never
  path: {
    name: string
  }
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/mcp/{name}/auth"
}

export type McpAuthRemoveErrors = {
  /**
   * Not found
   */
  404: NotFoundError
}

export type McpAuthRemoveError = McpAuthRemoveErrors[keyof McpAuthRemoveErrors]

export type McpAuthRemoveResponses = {
  /**
   * OAuth credentials removed
   */
  200: {
    success: true
  }
}

export type McpAuthRemoveResponse = McpAuthRemoveResponses[keyof McpAuthRemoveResponses]

export type McpAuthStartData = {
  body?: never
  path: {
    name: string
  }
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/mcp/{name}/auth"
}

export type McpAuthStartErrors = {
  /**
   * McpUnsupportedOAuthError
   */
  400: McpUnsupportedOAuthError
  /**
   * Not found
   */
  404: NotFoundError
}

export type McpAuthStartError = McpAuthStartErrors[keyof McpAuthStartErrors]

export type McpAuthStartResponses = {
  /**
   * OAuth flow started
   */
  200: {
    authorizationUrl: string
    oauthState: string
  }
}

export type McpAuthStartResponse = McpAuthStartResponses[keyof McpAuthStartResponses]

export type McpAuthCallbackData = {
  body?: {
    code: string
  }
  path: {
    name: string
  }
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/mcp/{name}/auth/callback"
}

export type McpAuthCallbackErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
  /**
   * Not found
   */
  404: NotFoundError
}

export type McpAuthCallbackError = McpAuthCallbackErrors[keyof McpAuthCallbackErrors]

export type McpAuthCallbackResponses = {
  /**
   * OAuth authentication completed
   */
  200: McpStatus
}

export type McpAuthCallbackResponse = McpAuthCallbackResponses[keyof McpAuthCallbackResponses]

export type McpAuthAuthenticateData = {
  body?: never
  path: {
    name: string
  }
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/mcp/{name}/auth/authenticate"
}

export type McpAuthAuthenticateErrors = {
  /**
   * McpUnsupportedOAuthError
   */
  400: McpUnsupportedOAuthError
  /**
   * Not found
   */
  404: NotFoundError
}

export type McpAuthAuthenticateError = McpAuthAuthenticateErrors[keyof McpAuthAuthenticateErrors]

export type McpAuthAuthenticateResponses = {
  /**
   * OAuth authentication completed
   */
  200: McpStatus
}

export type McpAuthAuthenticateResponse = McpAuthAuthenticateResponses[keyof McpAuthAuthenticateResponses]

export type McpConnectData = {
  body?: never
  path: {
    name: string
  }
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/mcp/{name}/connect"
}

export type McpConnectResponses = {
  /**
   * MCP server connected successfully
   */
  200: boolean
}

export type McpConnectResponse = McpConnectResponses[keyof McpConnectResponses]

export type McpDisconnectData = {
  body?: never
  path: {
    name: string
  }
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/mcp/{name}/disconnect"
}

export type McpDisconnectResponses = {
  /**
   * MCP server disconnected successfully
   */
  200: boolean
}

export type McpDisconnectResponse = McpDisconnectResponses[keyof McpDisconnectResponses]

export type ProjectListData = {
  body?: never
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/project"
}

export type ProjectListResponses = {
  /**
   * List of projects
   */
  200: Array<Project>
}

export type ProjectListResponse = ProjectListResponses[keyof ProjectListResponses]

export type ProjectCurrentData = {
  body?: never
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/project/current"
}

export type ProjectCurrentResponses = {
  /**
   * Current project information
   */
  200: Project
}

export type ProjectCurrentResponse = ProjectCurrentResponses[keyof ProjectCurrentResponses]

export type ProjectInitGitData = {
  body?: never
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/project/git/init"
}

export type ProjectInitGitResponses = {
  /**
   * Project information after git initialization
   */
  200: Project
}

export type ProjectInitGitResponse = ProjectInitGitResponses[keyof ProjectInitGitResponses]

export type ProjectUpdateData = {
  body?: {
    name?: string
    icon?: {
      url?: string
      override?: string
      color?: string
    }
    commands?: {
      /**
       * Startup script to run when creating a new workspace (worktree)
       */
      start?: string
    }
  }
  path: {
    projectID: string
  }
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/project/{projectID}"
}

export type ProjectUpdateErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
  /**
   * Not found
   */
  404: NotFoundError
}

export type ProjectUpdateError = ProjectUpdateErrors[keyof ProjectUpdateErrors]

export type ProjectUpdateResponses = {
  /**
   * Updated project information
   */
  200: Project
}

export type ProjectUpdateResponse = ProjectUpdateResponses[keyof ProjectUpdateResponses]

export type PtyShellsData = {
  body?: never
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/pty/shells"
}

export type PtyShellsResponses = {
  /**
   * List of shells
   */
  200: Array<{
    path: string
    name: string
    acceptable: boolean
  }>
}

export type PtyShellsResponse = PtyShellsResponses[keyof PtyShellsResponses]

export type PtyListData = {
  body?: never
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/pty"
}

export type PtyListResponses = {
  /**
   * List of sessions
   */
  200: Array<Pty>
}

export type PtyListResponse = PtyListResponses[keyof PtyListResponses]

export type PtyCreateData = {
  body?: {
    command?: string
    args?: Array<string>
    cwd?: string
    title?: string
    env?: {
      [key: string]: string
    }
  }
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/pty"
}

export type PtyCreateErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
}

export type PtyCreateError = PtyCreateErrors[keyof PtyCreateErrors]

export type PtyCreateResponses = {
  /**
   * Created session
   */
  200: Pty
}

export type PtyCreateResponse = PtyCreateResponses[keyof PtyCreateResponses]

export type PtyRemoveData = {
  body?: never
  path: {
    ptyID: string
  }
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/pty/{ptyID}"
}

export type PtyRemoveErrors = {
  /**
   * NotFoundError
   */
  404: NotFoundError
}

export type PtyRemoveError = PtyRemoveErrors[keyof PtyRemoveErrors]

export type PtyRemoveResponses = {
  /**
   * Session removed
   */
  200: boolean
}

export type PtyRemoveResponse = PtyRemoveResponses[keyof PtyRemoveResponses]

export type PtyGetData = {
  body?: never
  path: {
    ptyID: string
  }
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/pty/{ptyID}"
}

export type PtyGetErrors = {
  /**
   * NotFoundError
   */
  404: NotFoundError
}

export type PtyGetError = PtyGetErrors[keyof PtyGetErrors]

export type PtyGetResponses = {
  /**
   * Session info
   */
  200: Pty
}

export type PtyGetResponse = PtyGetResponses[keyof PtyGetResponses]

export type PtyUpdateData = {
  body?: {
    title?: string
    size?: {
      rows: number
      cols: number
    }
  }
  path: {
    ptyID: string
  }
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/pty/{ptyID}"
}

export type PtyUpdateErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
}

export type PtyUpdateError = PtyUpdateErrors[keyof PtyUpdateErrors]

export type PtyUpdateResponses = {
  /**
   * Updated session
   */
  200: Pty
}

export type PtyUpdateResponse = PtyUpdateResponses[keyof PtyUpdateResponses]

export type PtyConnectTokenData = {
  body?: never
  path: {
    ptyID: string
  }
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/pty/{ptyID}/connect-token"
}

export type PtyConnectTokenErrors = {
  /**
   * Forbidden
   */
  403: EffectHttpApiErrorForbidden
  /**
   * NotFoundError
   */
  404: NotFoundError
}

export type PtyConnectTokenError = PtyConnectTokenErrors[keyof PtyConnectTokenErrors]

export type PtyConnectTokenResponses = {
  /**
   * WebSocket connect token
   */
  200: {
    ticket: string
    expires_in: number
  }
}

export type PtyConnectTokenResponse = PtyConnectTokenResponses[keyof PtyConnectTokenResponses]

export type QuestionListData = {
  body?: never
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/question"
}

export type QuestionListResponses = {
  /**
   * List of pending questions
   */
  200: Array<QuestionRequest>
}

export type QuestionListResponse = QuestionListResponses[keyof QuestionListResponses]

export type QuestionReplyData = {
  body?: {
    /**
     * User answers in order of questions (each answer is an array of selected labels)
     */
    answers: Array<QuestionAnswer>
  }
  path: {
    requestID: string
  }
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/question/{requestID}/reply"
}

export type QuestionReplyErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
  /**
   * Not found
   */
  404: NotFoundError
}

export type QuestionReplyError = QuestionReplyErrors[keyof QuestionReplyErrors]

export type QuestionReplyResponses = {
  /**
   * Question answered successfully
   */
  200: boolean
}

export type QuestionReplyResponse = QuestionReplyResponses[keyof QuestionReplyResponses]

export type QuestionRejectData = {
  body?: never
  path: {
    requestID: string
  }
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/question/{requestID}/reject"
}

export type QuestionRejectErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
  /**
   * Not found
   */
  404: NotFoundError
}

export type QuestionRejectError = QuestionRejectErrors[keyof QuestionRejectErrors]

export type QuestionRejectResponses = {
  /**
   * Question rejected successfully
   */
  200: boolean
}

export type QuestionRejectResponse = QuestionRejectResponses[keyof QuestionRejectResponses]

export type PermissionListData = {
  body?: never
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/permission"
}

export type PermissionListResponses = {
  /**
   * List of pending permissions
   */
  200: Array<PermissionRequest>
}

export type PermissionListResponse = PermissionListResponses[keyof PermissionListResponses]

export type PermissionReplyData = {
  body?: {
    reply: "once" | "always" | "reject"
    message?: string
  }
  path: {
    requestID: string
  }
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/permission/{requestID}/reply"
}

export type PermissionReplyErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
  /**
   * Not found
   */
  404: NotFoundError
}

export type PermissionReplyError = PermissionReplyErrors[keyof PermissionReplyErrors]

export type PermissionReplyResponses = {
  /**
   * Permission processed successfully
   */
  200: boolean
}

export type PermissionReplyResponse = PermissionReplyResponses[keyof PermissionReplyResponses]

export type ProviderListData = {
  body?: never
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/provider"
}

export type ProviderListResponses = {
  /**
   * List of providers
   */
  200: {
    all: Array<Provider>
    default: {
      [key: string]: string
    }
    connected: Array<string>
  }
}

export type ProviderListResponse = ProviderListResponses[keyof ProviderListResponses]

export type ProviderAuthData = {
  body?: never
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/provider/auth"
}

export type ProviderAuthResponses = {
  /**
   * Provider auth methods
   */
  200: {
    [key: string]: Array<ProviderAuthMethod>
  }
}

export type ProviderAuthResponse = ProviderAuthResponses[keyof ProviderAuthResponses]

export type ProviderOauthAuthorizeData = {
  body?: {
    /**
     * Auth method index
     */
    method: number
    inputs?: {
      [key: string]: string
    }
  }
  path: {
    providerID: string
  }
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/provider/{providerID}/oauth/authorize"
}

export type ProviderOauthAuthorizeErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
}

export type ProviderOauthAuthorizeError = ProviderOauthAuthorizeErrors[keyof ProviderOauthAuthorizeErrors]

export type ProviderOauthAuthorizeResponses = {
  /**
   * Authorization URL and method
   */
  200: ProviderAuthAuthorization
}

export type ProviderOauthAuthorizeResponse = ProviderOauthAuthorizeResponses[keyof ProviderOauthAuthorizeResponses]

export type ProviderOauthCallbackData = {
  body?: {
    /**
     * Auth method index
     */
    method: number
    code?: string
  }
  path: {
    providerID: string
  }
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/provider/{providerID}/oauth/callback"
}

export type ProviderOauthCallbackErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
}

export type ProviderOauthCallbackError = ProviderOauthCallbackErrors[keyof ProviderOauthCallbackErrors]

export type ProviderOauthCallbackResponses = {
  /**
   * OAuth callback processed successfully
   */
  200: boolean
}

export type ProviderOauthCallbackResponse = ProviderOauthCallbackResponses[keyof ProviderOauthCallbackResponses]

export type SessionListData = {
  body?: never
  path?: never
  query?: {
    directory?: string
    workspace?: string
    scope?: "project"
    path?: string
    roots?: boolean | "true" | "false"
    start?: number
    search?: string
    limit?: number
  }
  url: "/session"
}

export type SessionListResponses = {
  /**
   * List of sessions
   */
  200: Array<Session>
}

export type SessionListResponse = SessionListResponses[keyof SessionListResponses]

export type SessionCreateData = {
  body?: {
    parentID?: string
    title?: string
    agent?: string
    model?: {
      id: string
      providerID: string
      variant?: string
    }
    permission?: PermissionRuleset
    workspaceID?: string
  }
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/session"
}

export type SessionCreateErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
}

export type SessionCreateError = SessionCreateErrors[keyof SessionCreateErrors]

export type SessionCreateResponses = {
  /**
   * Successfully created session
   */
  200: Session
}

export type SessionCreateResponse = SessionCreateResponses[keyof SessionCreateResponses]

export type SessionStatusData = {
  body?: never
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/session/status"
}

export type SessionStatusErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
}

export type SessionStatusError = SessionStatusErrors[keyof SessionStatusErrors]

export type SessionStatusResponses = {
  /**
   * Get session status
   */
  200: {
    [key: string]: SessionStatus
  }
}

export type SessionStatusResponse = SessionStatusResponses[keyof SessionStatusResponses]

export type SessionDeleteData = {
  body?: never
  path: {
    sessionID: string
  }
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/session/{sessionID}"
}

export type SessionDeleteErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
  /**
   * NotFoundError
   */
  404: NotFoundError
}

export type SessionDeleteError = SessionDeleteErrors[keyof SessionDeleteErrors]

export type SessionDeleteResponses = {
  /**
   * Successfully deleted session
   */
  200: boolean
}

export type SessionDeleteResponse = SessionDeleteResponses[keyof SessionDeleteResponses]

export type SessionGetData = {
  body?: never
  path: {
    sessionID: string
  }
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/session/{sessionID}"
}

export type SessionGetErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
  /**
   * NotFoundError
   */
  404: NotFoundError
}

export type SessionGetError = SessionGetErrors[keyof SessionGetErrors]

export type SessionGetResponses = {
  /**
   * Get session
   */
  200: Session
}

export type SessionGetResponse = SessionGetResponses[keyof SessionGetResponses]

export type SessionUpdateData = {
  body?: {
    title?: string
    permission?: PermissionRuleset
    time?: {
      archived?: number
    }
  }
  path: {
    sessionID: string
  }
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/session/{sessionID}"
}

export type SessionUpdateErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
  /**
   * NotFoundError
   */
  404: NotFoundError
}

export type SessionUpdateError = SessionUpdateErrors[keyof SessionUpdateErrors]

export type SessionUpdateResponses = {
  /**
   * Successfully updated session
   */
  200: Session
}

export type SessionUpdateResponse = SessionUpdateResponses[keyof SessionUpdateResponses]

export type SessionChildrenData = {
  body?: never
  path: {
    sessionID: string
  }
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/session/{sessionID}/children"
}

export type SessionChildrenErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
  /**
   * Not found
   */
  404: NotFoundError
}

export type SessionChildrenError = SessionChildrenErrors[keyof SessionChildrenErrors]

export type SessionChildrenResponses = {
  /**
   * List of children
   */
  200: Array<Session>
}

export type SessionChildrenResponse = SessionChildrenResponses[keyof SessionChildrenResponses]

export type SessionTodoData = {
  body?: never
  path: {
    sessionID: string
  }
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/session/{sessionID}/todo"
}

export type SessionTodoErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
  /**
   * Not found
   */
  404: NotFoundError
}

export type SessionTodoError = SessionTodoErrors[keyof SessionTodoErrors]

export type SessionTodoResponses = {
  /**
   * Todo list
   */
  200: Array<Todo>
}

export type SessionTodoResponse = SessionTodoResponses[keyof SessionTodoResponses]

export type SessionDiffData = {
  body?: never
  path: {
    sessionID: string
  }
  query?: {
    directory?: string
    workspace?: string
    messageID?: string
  }
  url: "/session/{sessionID}/diff"
}

export type SessionDiffResponses = {
  /**
   * Successfully retrieved diff
   */
  200: Array<SnapshotFileDiff>
}

export type SessionDiffResponse = SessionDiffResponses[keyof SessionDiffResponses]

export type SessionMessagesData = {
  body?: never
  path: {
    sessionID: string
  }
  query?: {
    directory?: string
    workspace?: string
    limit?: number
    before?: string
  }
  url: "/session/{sessionID}/message"
}

export type SessionMessagesErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
  /**
   * NotFoundError
   */
  404: NotFoundError
}

export type SessionMessagesError = SessionMessagesErrors[keyof SessionMessagesErrors]

export type SessionMessagesResponses = {
  /**
   * List of messages
   */
  200: Array<{
    info: Message
    parts: Array<Part>
  }>
}

export type SessionMessagesResponse = SessionMessagesResponses[keyof SessionMessagesResponses]

export type SessionPromptData = {
  body?: {
    messageID?: string
    model?: {
      providerID: string
      modelID: string
    }
    agent?: string
    noReply?: boolean
    tools?: {
      [key: string]: boolean
    }
    format?: OutputFormat
    system?: string
    variant?: string
    parts: Array<TextPartInput | FilePartInput | AgentPartInput | SubtaskPartInput>
  }
  path: {
    sessionID: string
  }
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/session/{sessionID}/message"
}

export type SessionPromptErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
  /**
   * Not found
   */
  404: NotFoundError
}

export type SessionPromptError = SessionPromptErrors[keyof SessionPromptErrors]

export type SessionPromptResponses = {
  /**
   * Created message
   */
  200: {
    info: AssistantMessage
    parts: Array<Part>
  }
}

export type SessionPromptResponse = SessionPromptResponses[keyof SessionPromptResponses]

export type SessionDeleteMessageData = {
  body?: never
  path: {
    sessionID: string
    messageID: string
  }
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/session/{sessionID}/message/{messageID}"
}

export type SessionDeleteMessageErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
  /**
   * Not found
   */
  404: NotFoundError
}

export type SessionDeleteMessageError = SessionDeleteMessageErrors[keyof SessionDeleteMessageErrors]

export type SessionDeleteMessageResponses = {
  /**
   * Successfully deleted message
   */
  200: boolean
}

export type SessionDeleteMessageResponse = SessionDeleteMessageResponses[keyof SessionDeleteMessageResponses]

export type SessionMessageData = {
  body?: never
  path: {
    sessionID: string
    messageID: string
  }
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/session/{sessionID}/message/{messageID}"
}

export type SessionMessageErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
  /**
   * NotFoundError
   */
  404: NotFoundError
}

export type SessionMessageError = SessionMessageErrors[keyof SessionMessageErrors]

export type SessionMessageResponses = {
  /**
   * Message
   */
  200: {
    info: Message
    parts: Array<Part>
  }
}

export type SessionMessageResponse = SessionMessageResponses[keyof SessionMessageResponses]

export type SessionForkData = {
  body?: {
    messageID?: string
  }
  path: {
    sessionID: string
  }
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/session/{sessionID}/fork"
}

export type SessionForkErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
  /**
   * NotFoundError
   */
  404: NotFoundError
}

export type SessionForkError = SessionForkErrors[keyof SessionForkErrors]

export type SessionForkResponses = {
  /**
   * 200
   */
  200: Session
}

export type SessionForkResponse = SessionForkResponses[keyof SessionForkResponses]

export type SessionAbortData = {
  body?: never
  path: {
    sessionID: string
  }
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/session/{sessionID}/abort"
}

export type SessionAbortErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
  /**
   * Not found
   */
  404: NotFoundError
}

export type SessionAbortError = SessionAbortErrors[keyof SessionAbortErrors]

export type SessionAbortResponses = {
  /**
   * Aborted session
   */
  200: boolean
}

export type SessionAbortResponse = SessionAbortResponses[keyof SessionAbortResponses]

export type SessionInitData = {
  body?: {
    modelID: string
    providerID: string
    messageID: string
  }
  path: {
    sessionID: string
  }
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/session/{sessionID}/init"
}

export type SessionInitErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
  /**
   * Not found
   */
  404: NotFoundError
}

export type SessionInitError = SessionInitErrors[keyof SessionInitErrors]

export type SessionInitResponses = {
  /**
   * 200
   */
  200: boolean
}

export type SessionInitResponse = SessionInitResponses[keyof SessionInitResponses]

export type SessionUnshareData = {
  body?: never
  path: {
    sessionID: string
  }
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/session/{sessionID}/share"
}

export type SessionUnshareErrors = {
  /**
   * NotFoundError
   */
  404: NotFoundError
  /**
   * InternalServerError
   */
  500: EffectHttpApiErrorInternalServerError
}

export type SessionUnshareError = SessionUnshareErrors[keyof SessionUnshareErrors]

export type SessionUnshareResponses = {
  /**
   * Successfully unshared session
   */
  200: Session
}

export type SessionUnshareResponse = SessionUnshareResponses[keyof SessionUnshareResponses]

export type SessionShareData = {
  body?: never
  path: {
    sessionID: string
  }
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/session/{sessionID}/share"
}

export type SessionShareErrors = {
  /**
   * NotFoundError
   */
  404: NotFoundError
  /**
   * InternalServerError
   */
  500: EffectHttpApiErrorInternalServerError
}

export type SessionShareError = SessionShareErrors[keyof SessionShareErrors]

export type SessionShareResponses = {
  /**
   * Successfully shared session
   */
  200: Session
}

export type SessionShareResponse = SessionShareResponses[keyof SessionShareResponses]

export type SessionSummarizeData = {
  body?: {
    providerID: string
    modelID: string
    auto?: boolean
  }
  path: {
    sessionID: string
  }
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/session/{sessionID}/summarize"
}

export type SessionSummarizeErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
  /**
   * NotFoundError
   */
  404: NotFoundError
}

export type SessionSummarizeError = SessionSummarizeErrors[keyof SessionSummarizeErrors]

export type SessionSummarizeResponses = {
  /**
   * Summarized session
   */
  200: boolean
}

export type SessionSummarizeResponse = SessionSummarizeResponses[keyof SessionSummarizeResponses]

export type SessionPromptAsyncData = {
  body?: {
    messageID?: string
    model?: {
      providerID: string
      modelID: string
    }
    agent?: string
    noReply?: boolean
    tools?: {
      [key: string]: boolean
    }
    format?: OutputFormat
    system?: string
    variant?: string
    parts: Array<TextPartInput | FilePartInput | AgentPartInput | SubtaskPartInput>
  }
  path: {
    sessionID: string
  }
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/session/{sessionID}/prompt_async"
}

export type SessionPromptAsyncErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
  /**
   * Not found
   */
  404: NotFoundError
}

export type SessionPromptAsyncError = SessionPromptAsyncErrors[keyof SessionPromptAsyncErrors]

export type SessionPromptAsyncResponses = {
  /**
   * Prompt accepted
   */
  204: void
}

export type SessionPromptAsyncResponse = SessionPromptAsyncResponses[keyof SessionPromptAsyncResponses]

export type SessionCommandData = {
  body?: {
    messageID?: string
    agent?: string
    model?: string
    arguments: string
    command: string
    variant?: string
    parts?: Array<{
      id?: string
      type: "file"
      mime: string
      filename?: string
      url: string
      source?: FilePartSource
    }>
  }
  path: {
    sessionID: string
  }
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/session/{sessionID}/command"
}

export type SessionCommandErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
  /**
   * Not found
   */
  404: NotFoundError
}

export type SessionCommandError = SessionCommandErrors[keyof SessionCommandErrors]

export type SessionCommandResponses = {
  /**
   * Created message
   */
  200: {
    info: AssistantMessage
    parts: Array<Part>
  }
}

export type SessionCommandResponse = SessionCommandResponses[keyof SessionCommandResponses]

export type SessionShellData = {
  body?: {
    messageID?: string
    agent: string
    model?: {
      providerID: string
      modelID: string
    }
    command: string
  }
  path: {
    sessionID: string
  }
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/session/{sessionID}/shell"
}

export type SessionShellErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
  /**
   * Not found
   */
  404: NotFoundError
}

export type SessionShellError = SessionShellErrors[keyof SessionShellErrors]

export type SessionShellResponses = {
  /**
   * Created message
   */
  200: {
    info: Message
    parts: Array<Part>
  }
}

export type SessionShellResponse = SessionShellResponses[keyof SessionShellResponses]

export type SessionRevertData = {
  body?: {
    messageID: string
    partID?: string
  }
  path: {
    sessionID: string
  }
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/session/{sessionID}/revert"
}

export type SessionRevertErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
  /**
   * Not found
   */
  404: NotFoundError
}

export type SessionRevertError = SessionRevertErrors[keyof SessionRevertErrors]

export type SessionRevertResponses = {
  /**
   * Updated session
   */
  200: Session
}

export type SessionRevertResponse = SessionRevertResponses[keyof SessionRevertResponses]

export type SessionUnrevertData = {
  body?: never
  path: {
    sessionID: string
  }
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/session/{sessionID}/unrevert"
}

export type SessionUnrevertErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
  /**
   * Not found
   */
  404: NotFoundError
}

export type SessionUnrevertError = SessionUnrevertErrors[keyof SessionUnrevertErrors]

export type SessionUnrevertResponses = {
  /**
   * Updated session
   */
  200: Session
}

export type SessionUnrevertResponse = SessionUnrevertResponses[keyof SessionUnrevertResponses]

export type PermissionRespondData = {
  body?: {
    response: "once" | "always" | "reject"
  }
  path: {
    sessionID: string
    permissionID: string
  }
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/session/{sessionID}/permissions/{permissionID}"
}

export type PermissionRespondErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
  /**
   * Not found
   */
  404: NotFoundError
}

export type PermissionRespondError = PermissionRespondErrors[keyof PermissionRespondErrors]

export type PermissionRespondResponses = {
  /**
   * Permission processed successfully
   */
  200: boolean
}

export type PermissionRespondResponse = PermissionRespondResponses[keyof PermissionRespondResponses]

export type PartDeleteData = {
  body?: never
  path: {
    sessionID: string
    messageID: string
    partID: string
  }
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/session/{sessionID}/message/{messageID}/part/{partID}"
}

export type PartDeleteErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
  /**
   * Not found
   */
  404: NotFoundError
}

export type PartDeleteError = PartDeleteErrors[keyof PartDeleteErrors]

export type PartDeleteResponses = {
  /**
   * Successfully deleted part
   */
  200: boolean
}

export type PartDeleteResponse = PartDeleteResponses[keyof PartDeleteResponses]

export type PartUpdateData = {
  body?: Part
  path: {
    sessionID: string
    messageID: string
    partID: string
  }
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/session/{sessionID}/message/{messageID}/part/{partID}"
}

export type PartUpdateErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
  /**
   * Not found
   */
  404: NotFoundError
}

export type PartUpdateError = PartUpdateErrors[keyof PartUpdateErrors]

export type PartUpdateResponses = {
  /**
   * Successfully updated part
   */
  200: Part
}

export type PartUpdateResponse = PartUpdateResponses[keyof PartUpdateResponses]

export type SyncStartData = {
  body?: never
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/sync/start"
}

export type SyncStartResponses = {
  /**
   * Workspace sync started
   */
  200: boolean
}

export type SyncStartResponse = SyncStartResponses[keyof SyncStartResponses]

export type SyncReplayData = {
  body?: {
    directory: string
    events: Array<{
      id: string
      aggregateID: string
      seq: number
      type: string
      data: {
        [key: string]: unknown
      }
    }>
  }
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/sync/replay"
}

export type SyncReplayErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
}

export type SyncReplayError = SyncReplayErrors[keyof SyncReplayErrors]

export type SyncReplayResponses = {
  /**
   * Replayed sync events
   */
  200: {
    sessionID: string
  }
}

export type SyncReplayResponse = SyncReplayResponses[keyof SyncReplayResponses]

export type SyncStealData = {
  body?: {
    sessionID: string
  }
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/sync/steal"
}

export type SyncStealErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
}

export type SyncStealError = SyncStealErrors[keyof SyncStealErrors]

export type SyncStealResponses = {
  /**
   * Session stolen into workspace
   */
  200: {
    sessionID: string
  }
}

export type SyncStealResponse = SyncStealResponses[keyof SyncStealResponses]

export type SyncHistoryListData = {
  body?: {
    [key: string]: number
  }
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/sync/history"
}

export type SyncHistoryListErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
}

export type SyncHistoryListError = SyncHistoryListErrors[keyof SyncHistoryListErrors]

export type SyncHistoryListResponses = {
  /**
   * Sync events
   */
  200: Array<{
    id: string
    aggregate_id: string
    seq: number
    type: string
    data: {
      [key: string]: unknown
    }
  }>
}

export type SyncHistoryListResponse = SyncHistoryListResponses[keyof SyncHistoryListResponses]

export type V2SessionListData = {
  body?: never
  path?: never
  query?: {
    directory?: string
    workspace?: string
    limit?: number
    order?: "asc" | "desc"
    path?: string
    roots?: boolean | "true" | "false"
    start?: number
    search?: string
    /**
     * Opaque pagination cursor returned as cursor.previous or cursor.next in the previous response. Do not combine with order or filters.
     */
    cursor?: string
  }
  url: "/api/session"
}

export type V2SessionListErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
}

export type V2SessionListError = V2SessionListErrors[keyof V2SessionListErrors]

export type V2SessionListResponses = {
  /**
   * V2SessionsResponse
   */
  200: V2SessionsResponse
}

export type V2SessionListResponse = V2SessionListResponses[keyof V2SessionListResponses]

export type V2SessionPromptData = {
  body?: {
    prompt: Prompt
    delivery?: SessionDelivery
  }
  path: {
    sessionID: string
  }
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/api/session/{sessionID}/prompt"
}

export type V2SessionPromptResponses = {
  /**
   * Session.Message
   */
  200: SessionMessage
}

export type V2SessionPromptResponse = V2SessionPromptResponses[keyof V2SessionPromptResponses]

export type V2SessionCompactData = {
  body?: never
  path: {
    sessionID: string
  }
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/api/session/{sessionID}/compact"
}

export type V2SessionCompactResponses = {
  /**
   * <No Content>
   */
  204: void
}

export type V2SessionCompactResponse = V2SessionCompactResponses[keyof V2SessionCompactResponses]

export type V2SessionWaitData = {
  body?: never
  path: {
    sessionID: string
  }
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/api/session/{sessionID}/wait"
}

export type V2SessionWaitResponses = {
  /**
   * <No Content>
   */
  204: void
}

export type V2SessionWaitResponse = V2SessionWaitResponses[keyof V2SessionWaitResponses]

export type V2SessionContextData = {
  body?: never
  path: {
    sessionID: string
  }
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/api/session/{sessionID}/context"
}

export type V2SessionContextResponses = {
  /**
   * Success
   */
  200: Array<SessionMessage>
}

export type V2SessionContextResponse = V2SessionContextResponses[keyof V2SessionContextResponses]

export type V2SessionMessagesData = {
  body?: never
  path: {
    sessionID: string
  }
  query?: {
    directory?: string
    workspace?: string
    limit?: number
    order?: "asc" | "desc"
    /**
     * Opaque pagination cursor returned as cursor.previous or cursor.next in the previous response. Do not combine with order.
     */
    cursor?: string
  }
  url: "/api/session/{sessionID}/message"
}

export type V2SessionMessagesErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
}

export type V2SessionMessagesError = V2SessionMessagesErrors[keyof V2SessionMessagesErrors]

export type V2SessionMessagesResponses = {
  /**
   * V2SessionMessagesResponse
   */
  200: V2SessionMessagesResponse
}

export type V2SessionMessagesResponse2 = V2SessionMessagesResponses[keyof V2SessionMessagesResponses]

export type TuiAppendPromptData = {
  body?: {
    text: string
  }
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/tui/append-prompt"
}

export type TuiAppendPromptErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
}

export type TuiAppendPromptError = TuiAppendPromptErrors[keyof TuiAppendPromptErrors]

export type TuiAppendPromptResponses = {
  /**
   * Prompt processed successfully
   */
  200: boolean
}

export type TuiAppendPromptResponse = TuiAppendPromptResponses[keyof TuiAppendPromptResponses]

export type TuiOpenHelpData = {
  body?: never
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/tui/open-help"
}

export type TuiOpenHelpResponses = {
  /**
   * Help dialog opened successfully
   */
  200: boolean
}

export type TuiOpenHelpResponse = TuiOpenHelpResponses[keyof TuiOpenHelpResponses]

export type TuiOpenSessionsData = {
  body?: never
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/tui/open-sessions"
}

export type TuiOpenSessionsResponses = {
  /**
   * Session dialog opened successfully
   */
  200: boolean
}

export type TuiOpenSessionsResponse = TuiOpenSessionsResponses[keyof TuiOpenSessionsResponses]

export type TuiOpenThemesData = {
  body?: never
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/tui/open-themes"
}

export type TuiOpenThemesResponses = {
  /**
   * Theme dialog opened successfully
   */
  200: boolean
}

export type TuiOpenThemesResponse = TuiOpenThemesResponses[keyof TuiOpenThemesResponses]

export type TuiOpenModelsData = {
  body?: never
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/tui/open-models"
}

export type TuiOpenModelsResponses = {
  /**
   * Model dialog opened successfully
   */
  200: boolean
}

export type TuiOpenModelsResponse = TuiOpenModelsResponses[keyof TuiOpenModelsResponses]

export type TuiSubmitPromptData = {
  body?: never
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/tui/submit-prompt"
}

export type TuiSubmitPromptResponses = {
  /**
   * Prompt submitted successfully
   */
  200: boolean
}

export type TuiSubmitPromptResponse = TuiSubmitPromptResponses[keyof TuiSubmitPromptResponses]

export type TuiClearPromptData = {
  body?: never
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/tui/clear-prompt"
}

export type TuiClearPromptResponses = {
  /**
   * Prompt cleared successfully
   */
  200: boolean
}

export type TuiClearPromptResponse = TuiClearPromptResponses[keyof TuiClearPromptResponses]

export type TuiExecuteCommandData = {
  body?: {
    command: string
  }
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/tui/execute-command"
}

export type TuiExecuteCommandErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
}

export type TuiExecuteCommandError = TuiExecuteCommandErrors[keyof TuiExecuteCommandErrors]

export type TuiExecuteCommandResponses = {
  /**
   * Command executed successfully
   */
  200: boolean
}

export type TuiExecuteCommandResponse = TuiExecuteCommandResponses[keyof TuiExecuteCommandResponses]

export type TuiShowToastData = {
  body?: {
    title?: string
    message: string
    variant: "info" | "success" | "warning" | "error"
    duration?: number
  }
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/tui/show-toast"
}

export type TuiShowToastResponses = {
  /**
   * Toast notification shown successfully
   */
  200: boolean
}

export type TuiShowToastResponse = TuiShowToastResponses[keyof TuiShowToastResponses]

export type TuiPublishData = {
  body?: EventTuiPromptAppend2 | EventTuiCommandExecute2 | EventTuiToastShow2 | EventTuiSessionSelect2
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/tui/publish"
}

export type TuiPublishErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
}

export type TuiPublishError = TuiPublishErrors[keyof TuiPublishErrors]

export type TuiPublishResponses = {
  /**
   * Event published successfully
   */
  200: boolean
}

export type TuiPublishResponse = TuiPublishResponses[keyof TuiPublishResponses]

export type TuiSelectSessionData = {
  body?: {
    /**
     * Session ID to navigate to
     */
    sessionID: string
  }
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/tui/select-session"
}

export type TuiSelectSessionErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
  /**
   * NotFoundError
   */
  404: NotFoundError
}

export type TuiSelectSessionError = TuiSelectSessionErrors[keyof TuiSelectSessionErrors]

export type TuiSelectSessionResponses = {
  /**
   * Session selected successfully
   */
  200: boolean
}

export type TuiSelectSessionResponse = TuiSelectSessionResponses[keyof TuiSelectSessionResponses]

export type TuiControlNextData = {
  body?: never
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/tui/control/next"
}

export type TuiControlNextResponses = {
  /**
   * Next TUI request
   */
  200: {
    path: string
    body: unknown
  }
}

export type TuiControlNextResponse = TuiControlNextResponses[keyof TuiControlNextResponses]

export type TuiControlResponseData = {
  body?: unknown
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/tui/control/response"
}

export type TuiControlResponseResponses = {
  /**
   * Response submitted successfully
   */
  200: boolean
}

export type TuiControlResponseResponse = TuiControlResponseResponses[keyof TuiControlResponseResponses]

export type ExperimentalWorkspaceAdapterListData = {
  body?: never
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/experimental/workspace/adapter"
}

export type ExperimentalWorkspaceAdapterListResponses = {
  /**
   * Workspace adapters
   */
  200: Array<{
    type: string
    name: string
    description: string
  }>
}

export type ExperimentalWorkspaceAdapterListResponse =
  ExperimentalWorkspaceAdapterListResponses[keyof ExperimentalWorkspaceAdapterListResponses]

export type ExperimentalWorkspaceListData = {
  body?: never
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/experimental/workspace"
}

export type ExperimentalWorkspaceListResponses = {
  /**
   * Workspaces
   */
  200: Array<Workspace>
}

export type ExperimentalWorkspaceListResponse =
  ExperimentalWorkspaceListResponses[keyof ExperimentalWorkspaceListResponses]

export type ExperimentalWorkspaceCreateData = {
  body?: {
    id?: string
    type: string
    branch?: string | null
    extra?: unknown | null
  }
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/experimental/workspace"
}

export type ExperimentalWorkspaceCreateErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
}

export type ExperimentalWorkspaceCreateError =
  ExperimentalWorkspaceCreateErrors[keyof ExperimentalWorkspaceCreateErrors]

export type ExperimentalWorkspaceCreateResponses = {
  /**
   * Workspace created
   */
  200: Workspace
}

export type ExperimentalWorkspaceCreateResponse =
  ExperimentalWorkspaceCreateResponses[keyof ExperimentalWorkspaceCreateResponses]

export type ExperimentalWorkspaceSyncListData = {
  body?: never
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/experimental/workspace/sync-list"
}

export type ExperimentalWorkspaceSyncListResponses = {
  /**
   * Workspace list synced
   */
  204: void
}

export type ExperimentalWorkspaceSyncListResponse =
  ExperimentalWorkspaceSyncListResponses[keyof ExperimentalWorkspaceSyncListResponses]

export type ExperimentalWorkspaceStatusData = {
  body?: never
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/experimental/workspace/status"
}

export type ExperimentalWorkspaceStatusResponses = {
  /**
   * Workspace status
   */
  200: Array<{
    workspaceID: string
    status: "connected" | "connecting" | "disconnected" | "error"
  }>
}

export type ExperimentalWorkspaceStatusResponse =
  ExperimentalWorkspaceStatusResponses[keyof ExperimentalWorkspaceStatusResponses]

export type ExperimentalWorkspaceRemoveData = {
  body?: never
  path: {
    id: string
  }
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/experimental/workspace/{id}"
}

export type ExperimentalWorkspaceRemoveErrors = {
  /**
   * Bad request
   */
  400: BadRequestError
}

export type ExperimentalWorkspaceRemoveError =
  ExperimentalWorkspaceRemoveErrors[keyof ExperimentalWorkspaceRemoveErrors]

export type ExperimentalWorkspaceRemoveResponses = {
  /**
   * Workspace removed
   */
  200: Workspace
}

export type ExperimentalWorkspaceRemoveResponse =
  ExperimentalWorkspaceRemoveResponses[keyof ExperimentalWorkspaceRemoveResponses]

export type ExperimentalWorkspaceWarpData = {
  body?: {
    id: string | null
    sessionID: string
    copyChanges?: boolean
  }
  path?: never
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/experimental/workspace/warp"
}

export type ExperimentalWorkspaceWarpErrors = {
  /**
   * WorkspaceWarpError | VcsApplyError
   */
  400: WorkspaceWarpError | VcsApplyError
}

export type ExperimentalWorkspaceWarpError = ExperimentalWorkspaceWarpErrors[keyof ExperimentalWorkspaceWarpErrors]

export type ExperimentalWorkspaceWarpResponses = {
  /**
   * Session warped
   */
  204: void
}

export type ExperimentalWorkspaceWarpResponse =
  ExperimentalWorkspaceWarpResponses[keyof ExperimentalWorkspaceWarpResponses]

export type PtyConnectData = {
  body?: never
  path: {
    ptyID: string
  }
  query?: {
    directory?: string
    workspace?: string
  }
  url: "/pty/{ptyID}/connect"
}

export type PtyConnectErrors = {
  /**
   * Forbidden
   */
  403: EffectHttpApiErrorForbidden
  /**
   * Not found
   */
  404: NotFoundError
}

export type PtyConnectError = PtyConnectErrors[keyof PtyConnectErrors]

export type PtyConnectResponses = {
  /**
   * Connected session
   */
  200: boolean
}

export type PtyConnectResponse = PtyConnectResponses[keyof PtyConnectResponses]
