diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-angular/index.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-angular/index.ts index f08474c60..8b70601c1 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-angular/index.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-angular/index.ts @@ -1,4 +1,4 @@ // This file is auto-generated by @hey-api/openapi-ts export { eventSubscribe, type Options } from './sdk.gen'; -export type { AgentPart, AssistantMessage, ClientOptions, Event, EventFileEdited, EventFileWatcherUpdated, EventIdeInstalled, EventInstallationUpdated, EventLspClientDiagnostics, EventMessagePartRemoved, EventMessagePartUpdated, EventMessageRemoved, EventMessageUpdated, EventPermissionReplied, EventPermissionUpdated, EventServerConnected, EventSessionDeleted, EventSessionError, EventSessionIdle, EventSessionUpdated, EventStorageWrite, EventSubscribeData, EventSubscribeResponse, EventSubscribeResponses, FilePart, FilePartSource, FilePartSourceText, FileSource, Message, MessageAbortedError, MessageOutputLengthError, Part, PatchPart, Permission, ProviderAuthError, Range, ReasoningPart, Session, SnapshotPart, StepFinishPart, StepStartPart, SymbolSource, TextPart, ToolPart, ToolState, ToolStateCompleted, ToolStateError, ToolStatePending, ToolStateRunning, UnknownError, UserMessage } from './types.gen'; +export type { AgentPart, ApiError, AssistantMessage, ClientOptions, CompactionPart, Event, EventCommandExecuted, EventFileEdited, EventFileWatcherUpdated, EventGlobalDisposed, EventInstallationUpdateAvailable, EventInstallationUpdated, EventLspClientDiagnostics, EventLspUpdated, EventMcpToolsChanged, EventMessagePartRemoved, EventMessagePartUpdated, EventMessageRemoved, EventMessageUpdated, EventPermissionAsked, EventPermissionReplied, EventProjectUpdated, EventPtyCreated, EventPtyDeleted, EventPtyExited, EventPtyUpdated, EventServerConnected, EventServerInstanceDisposed, EventSessionCompacted, EventSessionCreated, EventSessionDeleted, EventSessionDiff, EventSessionError, EventSessionIdle, EventSessionStatus, EventSessionUpdated, EventSubscribeData, EventSubscribeResponse, EventSubscribeResponses, EventTodoUpdated, EventTuiCommandExecute, EventTuiPromptAppend, EventTuiToastShow, EventVcsBranchUpdated, FileDiff, FilePart, FilePartSource, FilePartSourceText, FileSource, Message, MessageAbortedError, MessageOutputLengthError, Part, PatchPart, PermissionAction, PermissionRequest, PermissionRule, PermissionRuleset, Project, ProviderAuthError, Pty, Range, ReasoningPart, RetryPart, Session, SessionStatus, SnapshotPart, StepFinishPart, StepStartPart, SymbolSource, TextPart, Todo, ToolPart, ToolState, ToolStateCompleted, ToolStateError, ToolStatePending, ToolStateRunning, UnknownError, UserMessage } from './types.gen'; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-angular/sdk.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-angular/sdk.gen.ts index 361b64c2e..9e54b1a5b 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-angular/sdk.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-angular/sdk.gen.ts @@ -19,6 +19,8 @@ export type Options(options?: Options) => (options?.client ?? client).sse.get({ url: '/event', ...options }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-angular/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-angular/types.gen.ts index d3fe8ca92..dd1e1efa2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-angular/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-angular/types.gen.ts @@ -4,6 +4,16 @@ export type ClientOptions = { baseUrl: `${string}://${string}` | (string & {}); }; +export type PermissionAction = 'allow' | 'deny' | 'ask'; + +export type PermissionRule = { + permission: string; + pattern: string; + action: PermissionAction; +}; + +export type PermissionRuleset = Array; + export type Range = { start: { line: number; @@ -36,31 +46,73 @@ export type FileSource = { path: string; }; -export type FilePartSource = ({ - type: 'file'; -} & FileSource) | ({ - type: 'symbol'; -} & SymbolSource); +export type FilePartSource = FileSource | SymbolSource; -export type EventIdeInstalled = { - type: 'ide.installed'; +export type EventGlobalDisposed = { + type: 'global.disposed'; properties: { - ide: string; + [key: string]: unknown; }; }; -export type EventFileWatcherUpdated = { - type: 'file.watcher.updated'; +export type EventServerConnected = { + type: 'server.connected'; properties: { - file: string; - event: 'rename' | 'change'; + [key: string]: unknown; }; }; -export type EventServerConnected = { - type: 'server.connected'; +export type EventPtyDeleted = { + type: 'pty.deleted'; properties: { - [key: string]: unknown; + id: string; + }; +}; + +export type EventPtyExited = { + type: 'pty.exited'; + properties: { + id: string; + exitCode: number; + }; +}; + +export type EventPtyUpdated = { + type: 'pty.updated'; + properties: { + info: Pty; + }; +}; + +export type Pty = { + id: string; + title: string; + command: string; + args: Array; + cwd: string; + status: 'running' | 'exited'; + pid: number; +}; + +export type EventPtyCreated = { + type: 'pty.created'; + properties: { + info: Pty; + }; +}; + +export type EventVcsBranchUpdated = { + type: 'vcs.branch.updated'; + properties: { + branch?: string; + }; +}; + +export type EventFileWatcherUpdated = { + type: 'file.watcher.updated'; + properties: { + file: string; + event: 'add' | 'change' | 'unlink'; }; }; @@ -68,22 +120,30 @@ export type EventSessionError = { type: 'session.error'; properties: { sessionID?: string; - error?: ({ - name: 'ProviderAuthError'; - } & ProviderAuthError) | ({ - name: 'UnknownError'; - } & UnknownError) | ({ - name: 'MessageOutputLengthError'; - } & MessageOutputLengthError) | ({ - name: 'MessageAbortedError'; - } & MessageAbortedError); + error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError | ApiError; + }; +}; + +export type ApiError = { + name: 'APIError'; + data: { + message: string; + statusCode?: number; + isRetryable: boolean; + responseHeaders?: { + [key: string]: string; + }; + responseBody?: string; + metadata?: { + [key: string]: string; + }; }; }; export type MessageAbortedError = { name: 'MessageAbortedError'; data: { - [key: string]: unknown; + message: string; }; }; @@ -109,13 +169,22 @@ export type ProviderAuthError = { }; }; -export type EventSessionIdle = { - type: 'session.idle'; +export type EventSessionDiff = { + type: 'session.diff'; properties: { sessionID: string; + diff: Array; }; }; +export type FileDiff = { + file: string; + before: string; + after: string; + additions: number; + deletions: number; +}; + export type EventSessionDeleted = { type: 'session.deleted'; properties: { @@ -125,7 +194,15 @@ export type EventSessionDeleted = { export type Session = { id: string; + projectID: string; + directory: string; parentID?: string; + summary?: { + additions: number; + deletions: number; + files: number; + diffs?: Array; + }; share?: { url: string; }; @@ -134,7 +211,10 @@ export type Session = { time: { created: number; updated: number; + compacting?: number; + archived?: number; }; + permission?: PermissionRuleset; revert?: { messageID: string; partID?: string; @@ -150,6 +230,84 @@ export type EventSessionUpdated = { }; }; +export type EventSessionCreated = { + type: 'session.created'; + properties: { + info: Session; + }; +}; + +export type EventCommandExecuted = { + type: 'command.executed'; + properties: { + name: string; + sessionID: string; + arguments: string; + messageID: string; + }; +}; + +export type EventMcpToolsChanged = { + type: 'mcp.tools.changed'; + properties: { + server: string; + }; +}; + +export type EventTuiToastShow = { + type: 'tui.toast.show'; + properties: { + title?: string; + message: string; + variant: 'info' | 'success' | 'warning' | 'error'; + /** + * Duration in milliseconds + */ + duration?: number; + }; +}; + +export type EventTuiCommandExecute = { + type: 'tui.command.execute'; + properties: { + command: 'session.list' | 'session.new' | 'session.share' | 'session.interrupt' | 'session.compact' | 'session.page.up' | 'session.page.down' | 'session.half.page.up' | 'session.half.page.down' | 'session.first' | 'session.last' | 'prompt.clear' | 'prompt.submit' | 'agent.cycle' | string; + }; +}; + +export type EventTuiPromptAppend = { + type: 'tui.prompt.append'; + properties: { + text: 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; + /** + * Unique identifier for the todo item + */ + id: string; +}; + +export type EventTodoUpdated = { + type: 'todo.updated'; + properties: { + sessionID: string; + todos: Array; + }; +}; + export type EventFileEdited = { type: 'file.edited'; properties: { @@ -157,42 +315,66 @@ export type EventFileEdited = { }; }; +export type EventSessionCompacted = { + type: 'session.compacted'; + properties: { + sessionID: string; + }; +}; + +export type EventSessionIdle = { + type: 'session.idle'; + properties: { + sessionID: string; + }; +}; + +export type SessionStatus = { + type: 'idle'; +} | { + type: 'retry'; + attempt: number; + message: string; + next: number; +} | { + type: 'busy'; +}; + +export type EventSessionStatus = { + type: 'session.status'; + properties: { + sessionID: string; + status: SessionStatus; + }; +}; + export type EventPermissionReplied = { type: 'permission.replied'; properties: { sessionID: string; - permissionID: string; - response: string; + requestID: string; + reply: 'once' | 'always' | 'reject'; }; }; -export type Permission = { +export type PermissionRequest = { id: string; - type: string; - pattern?: string; sessionID: string; - messageID: string; - callID?: string; - title: string; + permission: string; + patterns: Array; metadata: { [key: string]: unknown; }; - time: { - created: number; + always: Array; + tool?: { + messageID: string; + callID: string; }; }; -export type EventPermissionUpdated = { - type: 'permission.updated'; - properties: Permission; -}; - -export type EventStorageWrite = { - type: 'storage.write'; - properties: { - key: string; - content?: unknown; - }; +export type EventPermissionAsked = { + type: 'permission.asked'; + properties: PermissionRequest; }; export type EventMessagePartRemoved = { @@ -204,6 +386,26 @@ export type EventMessagePartRemoved = { }; }; +export type CompactionPart = { + id: string; + sessionID: string; + messageID: string; + type: 'compaction'; + auto: boolean; +}; + +export type RetryPart = { + id: string; + sessionID: string; + messageID: string; + type: 'retry'; + attempt: number; + error: ApiError; + time: { + created: number; + }; +}; + export type AgentPart = { id: string; sessionID: string; @@ -239,6 +441,8 @@ export type StepFinishPart = { sessionID: string; messageID: string; type: 'step-finish'; + reason: string; + snapshot?: string; cost: number; tokens: { input: number; @@ -256,6 +460,7 @@ export type StepStartPart = { sessionID: string; messageID: string; type: 'step-start'; + snapshot?: string; }; export type ToolStateError = { @@ -286,12 +491,27 @@ export type ToolStateCompleted = { time: { start: number; end: number; + compacted?: number; }; + attachments?: Array; +}; + +export type FilePart = { + id: string; + sessionID: string; + messageID: string; + type: 'file'; + mime: string; + filename?: string; + url: string; + source?: FilePartSource; }; export type ToolStateRunning = { status: 'running'; - input?: unknown; + input: { + [key: string]: unknown; + }; title?: string; metadata?: { [key: string]: unknown; @@ -303,17 +523,13 @@ export type ToolStateRunning = { export type ToolStatePending = { status: 'pending'; + input: { + [key: string]: unknown; + }; + raw: string; }; -export type ToolState = ({ - status: 'pending'; -} & ToolStatePending) | ({ - status: 'running'; -} & ToolStateRunning) | ({ - status: 'completed'; -} & ToolStateCompleted) | ({ - status: 'error'; -} & ToolStateError); +export type ToolState = ToolStatePending | ToolStateRunning | ToolStateCompleted | ToolStateError; export type ToolPart = { id: string; @@ -323,17 +539,9 @@ export type ToolPart = { callID: string; tool: string; state: ToolState; -}; - -export type FilePart = { - id: string; - sessionID: string; - messageID: string; - type: 'file'; - mime: string; - filename?: string; - url: string; - source?: FilePartSource; + metadata?: { + [key: string]: unknown; + }; }; export type ReasoningPart = { @@ -358,36 +566,32 @@ export type TextPart = { type: 'text'; text: string; synthetic?: boolean; + ignored?: boolean; time?: { start: number; end?: number; }; + metadata?: { + [key: string]: unknown; + }; }; -export type Part = ({ - type: 'text'; -} & TextPart) | ({ - type: 'reasoning'; -} & ReasoningPart) | ({ - type: 'file'; -} & FilePart) | ({ - type: 'tool'; -} & ToolPart) | ({ - type: 'step-start'; -} & StepStartPart) | ({ - type: 'step-finish'; -} & StepFinishPart) | ({ - type: 'snapshot'; -} & SnapshotPart) | ({ - type: 'patch'; -} & PatchPart) | ({ - type: 'agent'; -} & AgentPart); +export type Part = TextPart | { + id: string; + sessionID: string; + messageID: string; + type: 'subtask'; + prompt: string; + description: string; + agent: string; + command?: string; +} | ReasoningPart | FilePart | ToolPart | StepStartPart | StepFinishPart | SnapshotPart | PatchPart | AgentPart | RetryPart | CompactionPart; export type EventMessagePartUpdated = { type: 'message.part.updated'; properties: { part: Part; + delta?: string; }; }; @@ -407,19 +611,12 @@ export type AssistantMessage = { created: number; completed?: number; }; - error?: ({ - name: 'ProviderAuthError'; - } & ProviderAuthError) | ({ - name: 'UnknownError'; - } & UnknownError) | ({ - name: 'MessageOutputLengthError'; - } & MessageOutputLengthError) | ({ - name: 'MessageAbortedError'; - } & MessageAbortedError); - system: Array; + error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError | ApiError; + parentID: string; modelID: string; providerID: string; mode: string; + agent: string; path: { cwd: string; root: string; @@ -435,6 +632,7 @@ export type AssistantMessage = { write: number; }; }; + finish?: string; }; export type UserMessage = { @@ -444,13 +642,24 @@ export type UserMessage = { time: { created: number; }; + summary?: { + title?: string; + body?: string; + diffs: Array; + }; + agent: string; + model: { + providerID: string; + modelID: string; + }; + system?: string; + tools?: { + [key: string]: boolean; + }; + variant?: string; }; -export type Message = ({ - role: 'user'; -} & UserMessage) | ({ - role: 'assistant'; -} & AssistantMessage); +export type Message = UserMessage | AssistantMessage; export type EventMessageUpdated = { type: 'message.updated'; @@ -459,6 +668,13 @@ export type EventMessageUpdated = { }; }; +export type EventLspUpdated = { + type: 'lsp.updated'; + properties: { + [key: string]: unknown; + }; +}; + export type EventLspClientDiagnostics = { type: 'lsp.client.diagnostics'; properties: { @@ -467,6 +683,41 @@ export type EventLspClientDiagnostics = { }; }; +export type EventServerInstanceDisposed = { + type: 'server.instance.disposed'; + properties: { + directory: string; + }; +}; + +export type Project = { + id: string; + worktree: string; + vcs?: 'git'; + name?: string; + icon?: { + url?: string; + color?: string; + }; + time: { + created: number; + updated: number; + initialized?: number; + }; +}; + +export type EventProjectUpdated = { + type: 'project.updated'; + properties: Project; +}; + +export type EventInstallationUpdateAvailable = { + type: 'installation.update-available'; + properties: { + version: string; + }; +}; + export type EventInstallationUpdated = { type: 'installation.updated'; properties: { @@ -474,46 +725,14 @@ export type EventInstallationUpdated = { }; }; -export type Event = ({ - type: 'installation.updated'; -} & EventInstallationUpdated) | ({ - type: 'lsp.client.diagnostics'; -} & EventLspClientDiagnostics) | ({ - type: 'message.updated'; -} & EventMessageUpdated) | ({ - type: 'message.removed'; -} & EventMessageRemoved) | ({ - type: 'message.part.updated'; -} & EventMessagePartUpdated) | ({ - type: 'message.part.removed'; -} & EventMessagePartRemoved) | ({ - type: 'storage.write'; -} & EventStorageWrite) | ({ - type: 'permission.updated'; -} & EventPermissionUpdated) | ({ - type: 'permission.replied'; -} & EventPermissionReplied) | ({ - type: 'file.edited'; -} & EventFileEdited) | ({ - type: 'session.updated'; -} & EventSessionUpdated) | ({ - type: 'session.deleted'; -} & EventSessionDeleted) | ({ - type: 'session.idle'; -} & EventSessionIdle) | ({ - type: 'session.error'; -} & EventSessionError) | ({ - type: 'server.connected'; -} & EventServerConnected) | ({ - type: 'file.watcher.updated'; -} & EventFileWatcherUpdated) | ({ - type: 'ide.installed'; -} & EventIdeInstalled); +export type Event = EventInstallationUpdated | EventInstallationUpdateAvailable | EventProjectUpdated | EventServerInstanceDisposed | EventLspClientDiagnostics | EventLspUpdated | EventMessageUpdated | EventMessageRemoved | EventMessagePartUpdated | EventMessagePartRemoved | EventPermissionAsked | EventPermissionReplied | EventSessionStatus | EventSessionIdle | EventSessionCompacted | EventFileEdited | EventTodoUpdated | EventTuiPromptAppend | EventTuiCommandExecute | EventTuiToastShow | EventMcpToolsChanged | EventCommandExecuted | EventSessionCreated | EventSessionUpdated | EventSessionDeleted | EventSessionDiff | EventSessionError | EventFileWatcherUpdated | EventVcsBranchUpdated | EventPtyCreated | EventPtyUpdated | EventPtyExited | EventPtyDeleted | EventServerConnected | EventGlobalDisposed; export type EventSubscribeData = { body?: never; path?: never; - query?: never; + query?: { + directory?: string; + }; url: '/event'; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-axios/index.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-axios/index.ts index f08474c60..8b70601c1 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-axios/index.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-axios/index.ts @@ -1,4 +1,4 @@ // This file is auto-generated by @hey-api/openapi-ts export { eventSubscribe, type Options } from './sdk.gen'; -export type { AgentPart, AssistantMessage, ClientOptions, Event, EventFileEdited, EventFileWatcherUpdated, EventIdeInstalled, EventInstallationUpdated, EventLspClientDiagnostics, EventMessagePartRemoved, EventMessagePartUpdated, EventMessageRemoved, EventMessageUpdated, EventPermissionReplied, EventPermissionUpdated, EventServerConnected, EventSessionDeleted, EventSessionError, EventSessionIdle, EventSessionUpdated, EventStorageWrite, EventSubscribeData, EventSubscribeResponse, EventSubscribeResponses, FilePart, FilePartSource, FilePartSourceText, FileSource, Message, MessageAbortedError, MessageOutputLengthError, Part, PatchPart, Permission, ProviderAuthError, Range, ReasoningPart, Session, SnapshotPart, StepFinishPart, StepStartPart, SymbolSource, TextPart, ToolPart, ToolState, ToolStateCompleted, ToolStateError, ToolStatePending, ToolStateRunning, UnknownError, UserMessage } from './types.gen'; +export type { AgentPart, ApiError, AssistantMessage, ClientOptions, CompactionPart, Event, EventCommandExecuted, EventFileEdited, EventFileWatcherUpdated, EventGlobalDisposed, EventInstallationUpdateAvailable, EventInstallationUpdated, EventLspClientDiagnostics, EventLspUpdated, EventMcpToolsChanged, EventMessagePartRemoved, EventMessagePartUpdated, EventMessageRemoved, EventMessageUpdated, EventPermissionAsked, EventPermissionReplied, EventProjectUpdated, EventPtyCreated, EventPtyDeleted, EventPtyExited, EventPtyUpdated, EventServerConnected, EventServerInstanceDisposed, EventSessionCompacted, EventSessionCreated, EventSessionDeleted, EventSessionDiff, EventSessionError, EventSessionIdle, EventSessionStatus, EventSessionUpdated, EventSubscribeData, EventSubscribeResponse, EventSubscribeResponses, EventTodoUpdated, EventTuiCommandExecute, EventTuiPromptAppend, EventTuiToastShow, EventVcsBranchUpdated, FileDiff, FilePart, FilePartSource, FilePartSourceText, FileSource, Message, MessageAbortedError, MessageOutputLengthError, Part, PatchPart, PermissionAction, PermissionRequest, PermissionRule, PermissionRuleset, Project, ProviderAuthError, Pty, Range, ReasoningPart, RetryPart, Session, SessionStatus, SnapshotPart, StepFinishPart, StepStartPart, SymbolSource, TextPart, Todo, ToolPart, ToolState, ToolStateCompleted, ToolStateError, ToolStatePending, ToolStateRunning, UnknownError, UserMessage } from './types.gen'; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-axios/sdk.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-axios/sdk.gen.ts index 77935ae81..544c2aed1 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-axios/sdk.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-axios/sdk.gen.ts @@ -19,6 +19,8 @@ export type Options(options?: Options) => (options?.client ?? client).sse.get({ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-axios/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-axios/types.gen.ts index e8552bf4d..114a11523 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-axios/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-axios/types.gen.ts @@ -4,6 +4,16 @@ export type ClientOptions = { baseURL: `${string}://${string}` | (string & {}); }; +export type PermissionAction = 'allow' | 'deny' | 'ask'; + +export type PermissionRule = { + permission: string; + pattern: string; + action: PermissionAction; +}; + +export type PermissionRuleset = Array; + export type Range = { start: { line: number; @@ -36,31 +46,73 @@ export type FileSource = { path: string; }; -export type FilePartSource = ({ - type: 'file'; -} & FileSource) | ({ - type: 'symbol'; -} & SymbolSource); +export type FilePartSource = FileSource | SymbolSource; -export type EventIdeInstalled = { - type: 'ide.installed'; +export type EventGlobalDisposed = { + type: 'global.disposed'; properties: { - ide: string; + [key: string]: unknown; }; }; -export type EventFileWatcherUpdated = { - type: 'file.watcher.updated'; +export type EventServerConnected = { + type: 'server.connected'; properties: { - file: string; - event: 'rename' | 'change'; + [key: string]: unknown; }; }; -export type EventServerConnected = { - type: 'server.connected'; +export type EventPtyDeleted = { + type: 'pty.deleted'; properties: { - [key: string]: unknown; + id: string; + }; +}; + +export type EventPtyExited = { + type: 'pty.exited'; + properties: { + id: string; + exitCode: number; + }; +}; + +export type EventPtyUpdated = { + type: 'pty.updated'; + properties: { + info: Pty; + }; +}; + +export type Pty = { + id: string; + title: string; + command: string; + args: Array; + cwd: string; + status: 'running' | 'exited'; + pid: number; +}; + +export type EventPtyCreated = { + type: 'pty.created'; + properties: { + info: Pty; + }; +}; + +export type EventVcsBranchUpdated = { + type: 'vcs.branch.updated'; + properties: { + branch?: string; + }; +}; + +export type EventFileWatcherUpdated = { + type: 'file.watcher.updated'; + properties: { + file: string; + event: 'add' | 'change' | 'unlink'; }; }; @@ -68,22 +120,30 @@ export type EventSessionError = { type: 'session.error'; properties: { sessionID?: string; - error?: ({ - name: 'ProviderAuthError'; - } & ProviderAuthError) | ({ - name: 'UnknownError'; - } & UnknownError) | ({ - name: 'MessageOutputLengthError'; - } & MessageOutputLengthError) | ({ - name: 'MessageAbortedError'; - } & MessageAbortedError); + error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError | ApiError; + }; +}; + +export type ApiError = { + name: 'APIError'; + data: { + message: string; + statusCode?: number; + isRetryable: boolean; + responseHeaders?: { + [key: string]: string; + }; + responseBody?: string; + metadata?: { + [key: string]: string; + }; }; }; export type MessageAbortedError = { name: 'MessageAbortedError'; data: { - [key: string]: unknown; + message: string; }; }; @@ -109,13 +169,22 @@ export type ProviderAuthError = { }; }; -export type EventSessionIdle = { - type: 'session.idle'; +export type EventSessionDiff = { + type: 'session.diff'; properties: { sessionID: string; + diff: Array; }; }; +export type FileDiff = { + file: string; + before: string; + after: string; + additions: number; + deletions: number; +}; + export type EventSessionDeleted = { type: 'session.deleted'; properties: { @@ -125,7 +194,15 @@ export type EventSessionDeleted = { export type Session = { id: string; + projectID: string; + directory: string; parentID?: string; + summary?: { + additions: number; + deletions: number; + files: number; + diffs?: Array; + }; share?: { url: string; }; @@ -134,7 +211,10 @@ export type Session = { time: { created: number; updated: number; + compacting?: number; + archived?: number; }; + permission?: PermissionRuleset; revert?: { messageID: string; partID?: string; @@ -150,6 +230,84 @@ export type EventSessionUpdated = { }; }; +export type EventSessionCreated = { + type: 'session.created'; + properties: { + info: Session; + }; +}; + +export type EventCommandExecuted = { + type: 'command.executed'; + properties: { + name: string; + sessionID: string; + arguments: string; + messageID: string; + }; +}; + +export type EventMcpToolsChanged = { + type: 'mcp.tools.changed'; + properties: { + server: string; + }; +}; + +export type EventTuiToastShow = { + type: 'tui.toast.show'; + properties: { + title?: string; + message: string; + variant: 'info' | 'success' | 'warning' | 'error'; + /** + * Duration in milliseconds + */ + duration?: number; + }; +}; + +export type EventTuiCommandExecute = { + type: 'tui.command.execute'; + properties: { + command: 'session.list' | 'session.new' | 'session.share' | 'session.interrupt' | 'session.compact' | 'session.page.up' | 'session.page.down' | 'session.half.page.up' | 'session.half.page.down' | 'session.first' | 'session.last' | 'prompt.clear' | 'prompt.submit' | 'agent.cycle' | string; + }; +}; + +export type EventTuiPromptAppend = { + type: 'tui.prompt.append'; + properties: { + text: 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; + /** + * Unique identifier for the todo item + */ + id: string; +}; + +export type EventTodoUpdated = { + type: 'todo.updated'; + properties: { + sessionID: string; + todos: Array; + }; +}; + export type EventFileEdited = { type: 'file.edited'; properties: { @@ -157,42 +315,66 @@ export type EventFileEdited = { }; }; +export type EventSessionCompacted = { + type: 'session.compacted'; + properties: { + sessionID: string; + }; +}; + +export type EventSessionIdle = { + type: 'session.idle'; + properties: { + sessionID: string; + }; +}; + +export type SessionStatus = { + type: 'idle'; +} | { + type: 'retry'; + attempt: number; + message: string; + next: number; +} | { + type: 'busy'; +}; + +export type EventSessionStatus = { + type: 'session.status'; + properties: { + sessionID: string; + status: SessionStatus; + }; +}; + export type EventPermissionReplied = { type: 'permission.replied'; properties: { sessionID: string; - permissionID: string; - response: string; + requestID: string; + reply: 'once' | 'always' | 'reject'; }; }; -export type Permission = { +export type PermissionRequest = { id: string; - type: string; - pattern?: string; sessionID: string; - messageID: string; - callID?: string; - title: string; + permission: string; + patterns: Array; metadata: { [key: string]: unknown; }; - time: { - created: number; + always: Array; + tool?: { + messageID: string; + callID: string; }; }; -export type EventPermissionUpdated = { - type: 'permission.updated'; - properties: Permission; -}; - -export type EventStorageWrite = { - type: 'storage.write'; - properties: { - key: string; - content?: unknown; - }; +export type EventPermissionAsked = { + type: 'permission.asked'; + properties: PermissionRequest; }; export type EventMessagePartRemoved = { @@ -204,6 +386,26 @@ export type EventMessagePartRemoved = { }; }; +export type CompactionPart = { + id: string; + sessionID: string; + messageID: string; + type: 'compaction'; + auto: boolean; +}; + +export type RetryPart = { + id: string; + sessionID: string; + messageID: string; + type: 'retry'; + attempt: number; + error: ApiError; + time: { + created: number; + }; +}; + export type AgentPart = { id: string; sessionID: string; @@ -239,6 +441,8 @@ export type StepFinishPart = { sessionID: string; messageID: string; type: 'step-finish'; + reason: string; + snapshot?: string; cost: number; tokens: { input: number; @@ -256,6 +460,7 @@ export type StepStartPart = { sessionID: string; messageID: string; type: 'step-start'; + snapshot?: string; }; export type ToolStateError = { @@ -286,12 +491,27 @@ export type ToolStateCompleted = { time: { start: number; end: number; + compacted?: number; }; + attachments?: Array; +}; + +export type FilePart = { + id: string; + sessionID: string; + messageID: string; + type: 'file'; + mime: string; + filename?: string; + url: string; + source?: FilePartSource; }; export type ToolStateRunning = { status: 'running'; - input?: unknown; + input: { + [key: string]: unknown; + }; title?: string; metadata?: { [key: string]: unknown; @@ -303,17 +523,13 @@ export type ToolStateRunning = { export type ToolStatePending = { status: 'pending'; + input: { + [key: string]: unknown; + }; + raw: string; }; -export type ToolState = ({ - status: 'pending'; -} & ToolStatePending) | ({ - status: 'running'; -} & ToolStateRunning) | ({ - status: 'completed'; -} & ToolStateCompleted) | ({ - status: 'error'; -} & ToolStateError); +export type ToolState = ToolStatePending | ToolStateRunning | ToolStateCompleted | ToolStateError; export type ToolPart = { id: string; @@ -323,17 +539,9 @@ export type ToolPart = { callID: string; tool: string; state: ToolState; -}; - -export type FilePart = { - id: string; - sessionID: string; - messageID: string; - type: 'file'; - mime: string; - filename?: string; - url: string; - source?: FilePartSource; + metadata?: { + [key: string]: unknown; + }; }; export type ReasoningPart = { @@ -358,36 +566,32 @@ export type TextPart = { type: 'text'; text: string; synthetic?: boolean; + ignored?: boolean; time?: { start: number; end?: number; }; + metadata?: { + [key: string]: unknown; + }; }; -export type Part = ({ - type: 'text'; -} & TextPart) | ({ - type: 'reasoning'; -} & ReasoningPart) | ({ - type: 'file'; -} & FilePart) | ({ - type: 'tool'; -} & ToolPart) | ({ - type: 'step-start'; -} & StepStartPart) | ({ - type: 'step-finish'; -} & StepFinishPart) | ({ - type: 'snapshot'; -} & SnapshotPart) | ({ - type: 'patch'; -} & PatchPart) | ({ - type: 'agent'; -} & AgentPart); +export type Part = TextPart | { + id: string; + sessionID: string; + messageID: string; + type: 'subtask'; + prompt: string; + description: string; + agent: string; + command?: string; +} | ReasoningPart | FilePart | ToolPart | StepStartPart | StepFinishPart | SnapshotPart | PatchPart | AgentPart | RetryPart | CompactionPart; export type EventMessagePartUpdated = { type: 'message.part.updated'; properties: { part: Part; + delta?: string; }; }; @@ -407,19 +611,12 @@ export type AssistantMessage = { created: number; completed?: number; }; - error?: ({ - name: 'ProviderAuthError'; - } & ProviderAuthError) | ({ - name: 'UnknownError'; - } & UnknownError) | ({ - name: 'MessageOutputLengthError'; - } & MessageOutputLengthError) | ({ - name: 'MessageAbortedError'; - } & MessageAbortedError); - system: Array; + error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError | ApiError; + parentID: string; modelID: string; providerID: string; mode: string; + agent: string; path: { cwd: string; root: string; @@ -435,6 +632,7 @@ export type AssistantMessage = { write: number; }; }; + finish?: string; }; export type UserMessage = { @@ -444,13 +642,24 @@ export type UserMessage = { time: { created: number; }; + summary?: { + title?: string; + body?: string; + diffs: Array; + }; + agent: string; + model: { + providerID: string; + modelID: string; + }; + system?: string; + tools?: { + [key: string]: boolean; + }; + variant?: string; }; -export type Message = ({ - role: 'user'; -} & UserMessage) | ({ - role: 'assistant'; -} & AssistantMessage); +export type Message = UserMessage | AssistantMessage; export type EventMessageUpdated = { type: 'message.updated'; @@ -459,6 +668,13 @@ export type EventMessageUpdated = { }; }; +export type EventLspUpdated = { + type: 'lsp.updated'; + properties: { + [key: string]: unknown; + }; +}; + export type EventLspClientDiagnostics = { type: 'lsp.client.diagnostics'; properties: { @@ -467,6 +683,41 @@ export type EventLspClientDiagnostics = { }; }; +export type EventServerInstanceDisposed = { + type: 'server.instance.disposed'; + properties: { + directory: string; + }; +}; + +export type Project = { + id: string; + worktree: string; + vcs?: 'git'; + name?: string; + icon?: { + url?: string; + color?: string; + }; + time: { + created: number; + updated: number; + initialized?: number; + }; +}; + +export type EventProjectUpdated = { + type: 'project.updated'; + properties: Project; +}; + +export type EventInstallationUpdateAvailable = { + type: 'installation.update-available'; + properties: { + version: string; + }; +}; + export type EventInstallationUpdated = { type: 'installation.updated'; properties: { @@ -474,46 +725,14 @@ export type EventInstallationUpdated = { }; }; -export type Event = ({ - type: 'installation.updated'; -} & EventInstallationUpdated) | ({ - type: 'lsp.client.diagnostics'; -} & EventLspClientDiagnostics) | ({ - type: 'message.updated'; -} & EventMessageUpdated) | ({ - type: 'message.removed'; -} & EventMessageRemoved) | ({ - type: 'message.part.updated'; -} & EventMessagePartUpdated) | ({ - type: 'message.part.removed'; -} & EventMessagePartRemoved) | ({ - type: 'storage.write'; -} & EventStorageWrite) | ({ - type: 'permission.updated'; -} & EventPermissionUpdated) | ({ - type: 'permission.replied'; -} & EventPermissionReplied) | ({ - type: 'file.edited'; -} & EventFileEdited) | ({ - type: 'session.updated'; -} & EventSessionUpdated) | ({ - type: 'session.deleted'; -} & EventSessionDeleted) | ({ - type: 'session.idle'; -} & EventSessionIdle) | ({ - type: 'session.error'; -} & EventSessionError) | ({ - type: 'server.connected'; -} & EventServerConnected) | ({ - type: 'file.watcher.updated'; -} & EventFileWatcherUpdated) | ({ - type: 'ide.installed'; -} & EventIdeInstalled); +export type Event = EventInstallationUpdated | EventInstallationUpdateAvailable | EventProjectUpdated | EventServerInstanceDisposed | EventLspClientDiagnostics | EventLspUpdated | EventMessageUpdated | EventMessageRemoved | EventMessagePartUpdated | EventMessagePartRemoved | EventPermissionAsked | EventPermissionReplied | EventSessionStatus | EventSessionIdle | EventSessionCompacted | EventFileEdited | EventTodoUpdated | EventTuiPromptAppend | EventTuiCommandExecute | EventTuiToastShow | EventMcpToolsChanged | EventCommandExecuted | EventSessionCreated | EventSessionUpdated | EventSessionDeleted | EventSessionDiff | EventSessionError | EventFileWatcherUpdated | EventVcsBranchUpdated | EventPtyCreated | EventPtyUpdated | EventPtyExited | EventPtyDeleted | EventServerConnected | EventGlobalDisposed; export type EventSubscribeData = { body?: never; path?: never; - query?: never; + query?: { + directory?: string; + }; url: '/event'; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/index.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/index.ts index f08474c60..8b70601c1 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/index.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/index.ts @@ -1,4 +1,4 @@ // This file is auto-generated by @hey-api/openapi-ts export { eventSubscribe, type Options } from './sdk.gen'; -export type { AgentPart, AssistantMessage, ClientOptions, Event, EventFileEdited, EventFileWatcherUpdated, EventIdeInstalled, EventInstallationUpdated, EventLspClientDiagnostics, EventMessagePartRemoved, EventMessagePartUpdated, EventMessageRemoved, EventMessageUpdated, EventPermissionReplied, EventPermissionUpdated, EventServerConnected, EventSessionDeleted, EventSessionError, EventSessionIdle, EventSessionUpdated, EventStorageWrite, EventSubscribeData, EventSubscribeResponse, EventSubscribeResponses, FilePart, FilePartSource, FilePartSourceText, FileSource, Message, MessageAbortedError, MessageOutputLengthError, Part, PatchPart, Permission, ProviderAuthError, Range, ReasoningPart, Session, SnapshotPart, StepFinishPart, StepStartPart, SymbolSource, TextPart, ToolPart, ToolState, ToolStateCompleted, ToolStateError, ToolStatePending, ToolStateRunning, UnknownError, UserMessage } from './types.gen'; +export type { AgentPart, ApiError, AssistantMessage, ClientOptions, CompactionPart, Event, EventCommandExecuted, EventFileEdited, EventFileWatcherUpdated, EventGlobalDisposed, EventInstallationUpdateAvailable, EventInstallationUpdated, EventLspClientDiagnostics, EventLspUpdated, EventMcpToolsChanged, EventMessagePartRemoved, EventMessagePartUpdated, EventMessageRemoved, EventMessageUpdated, EventPermissionAsked, EventPermissionReplied, EventProjectUpdated, EventPtyCreated, EventPtyDeleted, EventPtyExited, EventPtyUpdated, EventServerConnected, EventServerInstanceDisposed, EventSessionCompacted, EventSessionCreated, EventSessionDeleted, EventSessionDiff, EventSessionError, EventSessionIdle, EventSessionStatus, EventSessionUpdated, EventSubscribeData, EventSubscribeResponse, EventSubscribeResponses, EventTodoUpdated, EventTuiCommandExecute, EventTuiPromptAppend, EventTuiToastShow, EventVcsBranchUpdated, FileDiff, FilePart, FilePartSource, FilePartSourceText, FileSource, Message, MessageAbortedError, MessageOutputLengthError, Part, PatchPart, PermissionAction, PermissionRequest, PermissionRule, PermissionRuleset, Project, ProviderAuthError, Pty, Range, ReasoningPart, RetryPart, Session, SessionStatus, SnapshotPart, StepFinishPart, StepStartPart, SymbolSource, TextPart, Todo, ToolPart, ToolState, ToolStateCompleted, ToolStateError, ToolStatePending, ToolStateRunning, UnknownError, UserMessage } from './types.gen'; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/sdk.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/sdk.gen.ts index 361b64c2e..9e54b1a5b 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/sdk.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/sdk.gen.ts @@ -19,6 +19,8 @@ export type Options(options?: Options) => (options?.client ?? client).sse.get({ url: '/event', ...options }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/types.gen.ts index d3fe8ca92..dd1e1efa2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/types.gen.ts @@ -4,6 +4,16 @@ export type ClientOptions = { baseUrl: `${string}://${string}` | (string & {}); }; +export type PermissionAction = 'allow' | 'deny' | 'ask'; + +export type PermissionRule = { + permission: string; + pattern: string; + action: PermissionAction; +}; + +export type PermissionRuleset = Array; + export type Range = { start: { line: number; @@ -36,31 +46,73 @@ export type FileSource = { path: string; }; -export type FilePartSource = ({ - type: 'file'; -} & FileSource) | ({ - type: 'symbol'; -} & SymbolSource); +export type FilePartSource = FileSource | SymbolSource; -export type EventIdeInstalled = { - type: 'ide.installed'; +export type EventGlobalDisposed = { + type: 'global.disposed'; properties: { - ide: string; + [key: string]: unknown; }; }; -export type EventFileWatcherUpdated = { - type: 'file.watcher.updated'; +export type EventServerConnected = { + type: 'server.connected'; properties: { - file: string; - event: 'rename' | 'change'; + [key: string]: unknown; }; }; -export type EventServerConnected = { - type: 'server.connected'; +export type EventPtyDeleted = { + type: 'pty.deleted'; properties: { - [key: string]: unknown; + id: string; + }; +}; + +export type EventPtyExited = { + type: 'pty.exited'; + properties: { + id: string; + exitCode: number; + }; +}; + +export type EventPtyUpdated = { + type: 'pty.updated'; + properties: { + info: Pty; + }; +}; + +export type Pty = { + id: string; + title: string; + command: string; + args: Array; + cwd: string; + status: 'running' | 'exited'; + pid: number; +}; + +export type EventPtyCreated = { + type: 'pty.created'; + properties: { + info: Pty; + }; +}; + +export type EventVcsBranchUpdated = { + type: 'vcs.branch.updated'; + properties: { + branch?: string; + }; +}; + +export type EventFileWatcherUpdated = { + type: 'file.watcher.updated'; + properties: { + file: string; + event: 'add' | 'change' | 'unlink'; }; }; @@ -68,22 +120,30 @@ export type EventSessionError = { type: 'session.error'; properties: { sessionID?: string; - error?: ({ - name: 'ProviderAuthError'; - } & ProviderAuthError) | ({ - name: 'UnknownError'; - } & UnknownError) | ({ - name: 'MessageOutputLengthError'; - } & MessageOutputLengthError) | ({ - name: 'MessageAbortedError'; - } & MessageAbortedError); + error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError | ApiError; + }; +}; + +export type ApiError = { + name: 'APIError'; + data: { + message: string; + statusCode?: number; + isRetryable: boolean; + responseHeaders?: { + [key: string]: string; + }; + responseBody?: string; + metadata?: { + [key: string]: string; + }; }; }; export type MessageAbortedError = { name: 'MessageAbortedError'; data: { - [key: string]: unknown; + message: string; }; }; @@ -109,13 +169,22 @@ export type ProviderAuthError = { }; }; -export type EventSessionIdle = { - type: 'session.idle'; +export type EventSessionDiff = { + type: 'session.diff'; properties: { sessionID: string; + diff: Array; }; }; +export type FileDiff = { + file: string; + before: string; + after: string; + additions: number; + deletions: number; +}; + export type EventSessionDeleted = { type: 'session.deleted'; properties: { @@ -125,7 +194,15 @@ export type EventSessionDeleted = { export type Session = { id: string; + projectID: string; + directory: string; parentID?: string; + summary?: { + additions: number; + deletions: number; + files: number; + diffs?: Array; + }; share?: { url: string; }; @@ -134,7 +211,10 @@ export type Session = { time: { created: number; updated: number; + compacting?: number; + archived?: number; }; + permission?: PermissionRuleset; revert?: { messageID: string; partID?: string; @@ -150,6 +230,84 @@ export type EventSessionUpdated = { }; }; +export type EventSessionCreated = { + type: 'session.created'; + properties: { + info: Session; + }; +}; + +export type EventCommandExecuted = { + type: 'command.executed'; + properties: { + name: string; + sessionID: string; + arguments: string; + messageID: string; + }; +}; + +export type EventMcpToolsChanged = { + type: 'mcp.tools.changed'; + properties: { + server: string; + }; +}; + +export type EventTuiToastShow = { + type: 'tui.toast.show'; + properties: { + title?: string; + message: string; + variant: 'info' | 'success' | 'warning' | 'error'; + /** + * Duration in milliseconds + */ + duration?: number; + }; +}; + +export type EventTuiCommandExecute = { + type: 'tui.command.execute'; + properties: { + command: 'session.list' | 'session.new' | 'session.share' | 'session.interrupt' | 'session.compact' | 'session.page.up' | 'session.page.down' | 'session.half.page.up' | 'session.half.page.down' | 'session.first' | 'session.last' | 'prompt.clear' | 'prompt.submit' | 'agent.cycle' | string; + }; +}; + +export type EventTuiPromptAppend = { + type: 'tui.prompt.append'; + properties: { + text: 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; + /** + * Unique identifier for the todo item + */ + id: string; +}; + +export type EventTodoUpdated = { + type: 'todo.updated'; + properties: { + sessionID: string; + todos: Array; + }; +}; + export type EventFileEdited = { type: 'file.edited'; properties: { @@ -157,42 +315,66 @@ export type EventFileEdited = { }; }; +export type EventSessionCompacted = { + type: 'session.compacted'; + properties: { + sessionID: string; + }; +}; + +export type EventSessionIdle = { + type: 'session.idle'; + properties: { + sessionID: string; + }; +}; + +export type SessionStatus = { + type: 'idle'; +} | { + type: 'retry'; + attempt: number; + message: string; + next: number; +} | { + type: 'busy'; +}; + +export type EventSessionStatus = { + type: 'session.status'; + properties: { + sessionID: string; + status: SessionStatus; + }; +}; + export type EventPermissionReplied = { type: 'permission.replied'; properties: { sessionID: string; - permissionID: string; - response: string; + requestID: string; + reply: 'once' | 'always' | 'reject'; }; }; -export type Permission = { +export type PermissionRequest = { id: string; - type: string; - pattern?: string; sessionID: string; - messageID: string; - callID?: string; - title: string; + permission: string; + patterns: Array; metadata: { [key: string]: unknown; }; - time: { - created: number; + always: Array; + tool?: { + messageID: string; + callID: string; }; }; -export type EventPermissionUpdated = { - type: 'permission.updated'; - properties: Permission; -}; - -export type EventStorageWrite = { - type: 'storage.write'; - properties: { - key: string; - content?: unknown; - }; +export type EventPermissionAsked = { + type: 'permission.asked'; + properties: PermissionRequest; }; export type EventMessagePartRemoved = { @@ -204,6 +386,26 @@ export type EventMessagePartRemoved = { }; }; +export type CompactionPart = { + id: string; + sessionID: string; + messageID: string; + type: 'compaction'; + auto: boolean; +}; + +export type RetryPart = { + id: string; + sessionID: string; + messageID: string; + type: 'retry'; + attempt: number; + error: ApiError; + time: { + created: number; + }; +}; + export type AgentPart = { id: string; sessionID: string; @@ -239,6 +441,8 @@ export type StepFinishPart = { sessionID: string; messageID: string; type: 'step-finish'; + reason: string; + snapshot?: string; cost: number; tokens: { input: number; @@ -256,6 +460,7 @@ export type StepStartPart = { sessionID: string; messageID: string; type: 'step-start'; + snapshot?: string; }; export type ToolStateError = { @@ -286,12 +491,27 @@ export type ToolStateCompleted = { time: { start: number; end: number; + compacted?: number; }; + attachments?: Array; +}; + +export type FilePart = { + id: string; + sessionID: string; + messageID: string; + type: 'file'; + mime: string; + filename?: string; + url: string; + source?: FilePartSource; }; export type ToolStateRunning = { status: 'running'; - input?: unknown; + input: { + [key: string]: unknown; + }; title?: string; metadata?: { [key: string]: unknown; @@ -303,17 +523,13 @@ export type ToolStateRunning = { export type ToolStatePending = { status: 'pending'; + input: { + [key: string]: unknown; + }; + raw: string; }; -export type ToolState = ({ - status: 'pending'; -} & ToolStatePending) | ({ - status: 'running'; -} & ToolStateRunning) | ({ - status: 'completed'; -} & ToolStateCompleted) | ({ - status: 'error'; -} & ToolStateError); +export type ToolState = ToolStatePending | ToolStateRunning | ToolStateCompleted | ToolStateError; export type ToolPart = { id: string; @@ -323,17 +539,9 @@ export type ToolPart = { callID: string; tool: string; state: ToolState; -}; - -export type FilePart = { - id: string; - sessionID: string; - messageID: string; - type: 'file'; - mime: string; - filename?: string; - url: string; - source?: FilePartSource; + metadata?: { + [key: string]: unknown; + }; }; export type ReasoningPart = { @@ -358,36 +566,32 @@ export type TextPart = { type: 'text'; text: string; synthetic?: boolean; + ignored?: boolean; time?: { start: number; end?: number; }; + metadata?: { + [key: string]: unknown; + }; }; -export type Part = ({ - type: 'text'; -} & TextPart) | ({ - type: 'reasoning'; -} & ReasoningPart) | ({ - type: 'file'; -} & FilePart) | ({ - type: 'tool'; -} & ToolPart) | ({ - type: 'step-start'; -} & StepStartPart) | ({ - type: 'step-finish'; -} & StepFinishPart) | ({ - type: 'snapshot'; -} & SnapshotPart) | ({ - type: 'patch'; -} & PatchPart) | ({ - type: 'agent'; -} & AgentPart); +export type Part = TextPart | { + id: string; + sessionID: string; + messageID: string; + type: 'subtask'; + prompt: string; + description: string; + agent: string; + command?: string; +} | ReasoningPart | FilePart | ToolPart | StepStartPart | StepFinishPart | SnapshotPart | PatchPart | AgentPart | RetryPart | CompactionPart; export type EventMessagePartUpdated = { type: 'message.part.updated'; properties: { part: Part; + delta?: string; }; }; @@ -407,19 +611,12 @@ export type AssistantMessage = { created: number; completed?: number; }; - error?: ({ - name: 'ProviderAuthError'; - } & ProviderAuthError) | ({ - name: 'UnknownError'; - } & UnknownError) | ({ - name: 'MessageOutputLengthError'; - } & MessageOutputLengthError) | ({ - name: 'MessageAbortedError'; - } & MessageAbortedError); - system: Array; + error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError | ApiError; + parentID: string; modelID: string; providerID: string; mode: string; + agent: string; path: { cwd: string; root: string; @@ -435,6 +632,7 @@ export type AssistantMessage = { write: number; }; }; + finish?: string; }; export type UserMessage = { @@ -444,13 +642,24 @@ export type UserMessage = { time: { created: number; }; + summary?: { + title?: string; + body?: string; + diffs: Array; + }; + agent: string; + model: { + providerID: string; + modelID: string; + }; + system?: string; + tools?: { + [key: string]: boolean; + }; + variant?: string; }; -export type Message = ({ - role: 'user'; -} & UserMessage) | ({ - role: 'assistant'; -} & AssistantMessage); +export type Message = UserMessage | AssistantMessage; export type EventMessageUpdated = { type: 'message.updated'; @@ -459,6 +668,13 @@ export type EventMessageUpdated = { }; }; +export type EventLspUpdated = { + type: 'lsp.updated'; + properties: { + [key: string]: unknown; + }; +}; + export type EventLspClientDiagnostics = { type: 'lsp.client.diagnostics'; properties: { @@ -467,6 +683,41 @@ export type EventLspClientDiagnostics = { }; }; +export type EventServerInstanceDisposed = { + type: 'server.instance.disposed'; + properties: { + directory: string; + }; +}; + +export type Project = { + id: string; + worktree: string; + vcs?: 'git'; + name?: string; + icon?: { + url?: string; + color?: string; + }; + time: { + created: number; + updated: number; + initialized?: number; + }; +}; + +export type EventProjectUpdated = { + type: 'project.updated'; + properties: Project; +}; + +export type EventInstallationUpdateAvailable = { + type: 'installation.update-available'; + properties: { + version: string; + }; +}; + export type EventInstallationUpdated = { type: 'installation.updated'; properties: { @@ -474,46 +725,14 @@ export type EventInstallationUpdated = { }; }; -export type Event = ({ - type: 'installation.updated'; -} & EventInstallationUpdated) | ({ - type: 'lsp.client.diagnostics'; -} & EventLspClientDiagnostics) | ({ - type: 'message.updated'; -} & EventMessageUpdated) | ({ - type: 'message.removed'; -} & EventMessageRemoved) | ({ - type: 'message.part.updated'; -} & EventMessagePartUpdated) | ({ - type: 'message.part.removed'; -} & EventMessagePartRemoved) | ({ - type: 'storage.write'; -} & EventStorageWrite) | ({ - type: 'permission.updated'; -} & EventPermissionUpdated) | ({ - type: 'permission.replied'; -} & EventPermissionReplied) | ({ - type: 'file.edited'; -} & EventFileEdited) | ({ - type: 'session.updated'; -} & EventSessionUpdated) | ({ - type: 'session.deleted'; -} & EventSessionDeleted) | ({ - type: 'session.idle'; -} & EventSessionIdle) | ({ - type: 'session.error'; -} & EventSessionError) | ({ - type: 'server.connected'; -} & EventServerConnected) | ({ - type: 'file.watcher.updated'; -} & EventFileWatcherUpdated) | ({ - type: 'ide.installed'; -} & EventIdeInstalled); +export type Event = EventInstallationUpdated | EventInstallationUpdateAvailable | EventProjectUpdated | EventServerInstanceDisposed | EventLspClientDiagnostics | EventLspUpdated | EventMessageUpdated | EventMessageRemoved | EventMessagePartUpdated | EventMessagePartRemoved | EventPermissionAsked | EventPermissionReplied | EventSessionStatus | EventSessionIdle | EventSessionCompacted | EventFileEdited | EventTodoUpdated | EventTuiPromptAppend | EventTuiCommandExecute | EventTuiToastShow | EventMcpToolsChanged | EventCommandExecuted | EventSessionCreated | EventSessionUpdated | EventSessionDeleted | EventSessionDiff | EventSessionError | EventFileWatcherUpdated | EventVcsBranchUpdated | EventPtyCreated | EventPtyUpdated | EventPtyExited | EventPtyDeleted | EventServerConnected | EventGlobalDisposed; export type EventSubscribeData = { body?: never; path?: never; - query?: never; + query?: { + directory?: string; + }; url: '/event'; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/index.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/index.ts index f08474c60..8b70601c1 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/index.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/index.ts @@ -1,4 +1,4 @@ // This file is auto-generated by @hey-api/openapi-ts export { eventSubscribe, type Options } from './sdk.gen'; -export type { AgentPart, AssistantMessage, ClientOptions, Event, EventFileEdited, EventFileWatcherUpdated, EventIdeInstalled, EventInstallationUpdated, EventLspClientDiagnostics, EventMessagePartRemoved, EventMessagePartUpdated, EventMessageRemoved, EventMessageUpdated, EventPermissionReplied, EventPermissionUpdated, EventServerConnected, EventSessionDeleted, EventSessionError, EventSessionIdle, EventSessionUpdated, EventStorageWrite, EventSubscribeData, EventSubscribeResponse, EventSubscribeResponses, FilePart, FilePartSource, FilePartSourceText, FileSource, Message, MessageAbortedError, MessageOutputLengthError, Part, PatchPart, Permission, ProviderAuthError, Range, ReasoningPart, Session, SnapshotPart, StepFinishPart, StepStartPart, SymbolSource, TextPart, ToolPart, ToolState, ToolStateCompleted, ToolStateError, ToolStatePending, ToolStateRunning, UnknownError, UserMessage } from './types.gen'; +export type { AgentPart, ApiError, AssistantMessage, ClientOptions, CompactionPart, Event, EventCommandExecuted, EventFileEdited, EventFileWatcherUpdated, EventGlobalDisposed, EventInstallationUpdateAvailable, EventInstallationUpdated, EventLspClientDiagnostics, EventLspUpdated, EventMcpToolsChanged, EventMessagePartRemoved, EventMessagePartUpdated, EventMessageRemoved, EventMessageUpdated, EventPermissionAsked, EventPermissionReplied, EventProjectUpdated, EventPtyCreated, EventPtyDeleted, EventPtyExited, EventPtyUpdated, EventServerConnected, EventServerInstanceDisposed, EventSessionCompacted, EventSessionCreated, EventSessionDeleted, EventSessionDiff, EventSessionError, EventSessionIdle, EventSessionStatus, EventSessionUpdated, EventSubscribeData, EventSubscribeResponse, EventSubscribeResponses, EventTodoUpdated, EventTuiCommandExecute, EventTuiPromptAppend, EventTuiToastShow, EventVcsBranchUpdated, FileDiff, FilePart, FilePartSource, FilePartSourceText, FileSource, Message, MessageAbortedError, MessageOutputLengthError, Part, PatchPart, PermissionAction, PermissionRequest, PermissionRule, PermissionRuleset, Project, ProviderAuthError, Pty, Range, ReasoningPart, RetryPart, Session, SessionStatus, SnapshotPart, StepFinishPart, StepStartPart, SymbolSource, TextPart, Todo, ToolPart, ToolState, ToolStateCompleted, ToolStateError, ToolStatePending, ToolStateRunning, UnknownError, UserMessage } from './types.gen'; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/sdk.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/sdk.gen.ts index 361b64c2e..9e54b1a5b 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/sdk.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/sdk.gen.ts @@ -19,6 +19,8 @@ export type Options(options?: Options) => (options?.client ?? client).sse.get({ url: '/event', ...options }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/types.gen.ts index d3fe8ca92..dd1e1efa2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/types.gen.ts @@ -4,6 +4,16 @@ export type ClientOptions = { baseUrl: `${string}://${string}` | (string & {}); }; +export type PermissionAction = 'allow' | 'deny' | 'ask'; + +export type PermissionRule = { + permission: string; + pattern: string; + action: PermissionAction; +}; + +export type PermissionRuleset = Array; + export type Range = { start: { line: number; @@ -36,31 +46,73 @@ export type FileSource = { path: string; }; -export type FilePartSource = ({ - type: 'file'; -} & FileSource) | ({ - type: 'symbol'; -} & SymbolSource); +export type FilePartSource = FileSource | SymbolSource; -export type EventIdeInstalled = { - type: 'ide.installed'; +export type EventGlobalDisposed = { + type: 'global.disposed'; properties: { - ide: string; + [key: string]: unknown; }; }; -export type EventFileWatcherUpdated = { - type: 'file.watcher.updated'; +export type EventServerConnected = { + type: 'server.connected'; properties: { - file: string; - event: 'rename' | 'change'; + [key: string]: unknown; }; }; -export type EventServerConnected = { - type: 'server.connected'; +export type EventPtyDeleted = { + type: 'pty.deleted'; properties: { - [key: string]: unknown; + id: string; + }; +}; + +export type EventPtyExited = { + type: 'pty.exited'; + properties: { + id: string; + exitCode: number; + }; +}; + +export type EventPtyUpdated = { + type: 'pty.updated'; + properties: { + info: Pty; + }; +}; + +export type Pty = { + id: string; + title: string; + command: string; + args: Array; + cwd: string; + status: 'running' | 'exited'; + pid: number; +}; + +export type EventPtyCreated = { + type: 'pty.created'; + properties: { + info: Pty; + }; +}; + +export type EventVcsBranchUpdated = { + type: 'vcs.branch.updated'; + properties: { + branch?: string; + }; +}; + +export type EventFileWatcherUpdated = { + type: 'file.watcher.updated'; + properties: { + file: string; + event: 'add' | 'change' | 'unlink'; }; }; @@ -68,22 +120,30 @@ export type EventSessionError = { type: 'session.error'; properties: { sessionID?: string; - error?: ({ - name: 'ProviderAuthError'; - } & ProviderAuthError) | ({ - name: 'UnknownError'; - } & UnknownError) | ({ - name: 'MessageOutputLengthError'; - } & MessageOutputLengthError) | ({ - name: 'MessageAbortedError'; - } & MessageAbortedError); + error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError | ApiError; + }; +}; + +export type ApiError = { + name: 'APIError'; + data: { + message: string; + statusCode?: number; + isRetryable: boolean; + responseHeaders?: { + [key: string]: string; + }; + responseBody?: string; + metadata?: { + [key: string]: string; + }; }; }; export type MessageAbortedError = { name: 'MessageAbortedError'; data: { - [key: string]: unknown; + message: string; }; }; @@ -109,13 +169,22 @@ export type ProviderAuthError = { }; }; -export type EventSessionIdle = { - type: 'session.idle'; +export type EventSessionDiff = { + type: 'session.diff'; properties: { sessionID: string; + diff: Array; }; }; +export type FileDiff = { + file: string; + before: string; + after: string; + additions: number; + deletions: number; +}; + export type EventSessionDeleted = { type: 'session.deleted'; properties: { @@ -125,7 +194,15 @@ export type EventSessionDeleted = { export type Session = { id: string; + projectID: string; + directory: string; parentID?: string; + summary?: { + additions: number; + deletions: number; + files: number; + diffs?: Array; + }; share?: { url: string; }; @@ -134,7 +211,10 @@ export type Session = { time: { created: number; updated: number; + compacting?: number; + archived?: number; }; + permission?: PermissionRuleset; revert?: { messageID: string; partID?: string; @@ -150,6 +230,84 @@ export type EventSessionUpdated = { }; }; +export type EventSessionCreated = { + type: 'session.created'; + properties: { + info: Session; + }; +}; + +export type EventCommandExecuted = { + type: 'command.executed'; + properties: { + name: string; + sessionID: string; + arguments: string; + messageID: string; + }; +}; + +export type EventMcpToolsChanged = { + type: 'mcp.tools.changed'; + properties: { + server: string; + }; +}; + +export type EventTuiToastShow = { + type: 'tui.toast.show'; + properties: { + title?: string; + message: string; + variant: 'info' | 'success' | 'warning' | 'error'; + /** + * Duration in milliseconds + */ + duration?: number; + }; +}; + +export type EventTuiCommandExecute = { + type: 'tui.command.execute'; + properties: { + command: 'session.list' | 'session.new' | 'session.share' | 'session.interrupt' | 'session.compact' | 'session.page.up' | 'session.page.down' | 'session.half.page.up' | 'session.half.page.down' | 'session.first' | 'session.last' | 'prompt.clear' | 'prompt.submit' | 'agent.cycle' | string; + }; +}; + +export type EventTuiPromptAppend = { + type: 'tui.prompt.append'; + properties: { + text: 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; + /** + * Unique identifier for the todo item + */ + id: string; +}; + +export type EventTodoUpdated = { + type: 'todo.updated'; + properties: { + sessionID: string; + todos: Array; + }; +}; + export type EventFileEdited = { type: 'file.edited'; properties: { @@ -157,42 +315,66 @@ export type EventFileEdited = { }; }; +export type EventSessionCompacted = { + type: 'session.compacted'; + properties: { + sessionID: string; + }; +}; + +export type EventSessionIdle = { + type: 'session.idle'; + properties: { + sessionID: string; + }; +}; + +export type SessionStatus = { + type: 'idle'; +} | { + type: 'retry'; + attempt: number; + message: string; + next: number; +} | { + type: 'busy'; +}; + +export type EventSessionStatus = { + type: 'session.status'; + properties: { + sessionID: string; + status: SessionStatus; + }; +}; + export type EventPermissionReplied = { type: 'permission.replied'; properties: { sessionID: string; - permissionID: string; - response: string; + requestID: string; + reply: 'once' | 'always' | 'reject'; }; }; -export type Permission = { +export type PermissionRequest = { id: string; - type: string; - pattern?: string; sessionID: string; - messageID: string; - callID?: string; - title: string; + permission: string; + patterns: Array; metadata: { [key: string]: unknown; }; - time: { - created: number; + always: Array; + tool?: { + messageID: string; + callID: string; }; }; -export type EventPermissionUpdated = { - type: 'permission.updated'; - properties: Permission; -}; - -export type EventStorageWrite = { - type: 'storage.write'; - properties: { - key: string; - content?: unknown; - }; +export type EventPermissionAsked = { + type: 'permission.asked'; + properties: PermissionRequest; }; export type EventMessagePartRemoved = { @@ -204,6 +386,26 @@ export type EventMessagePartRemoved = { }; }; +export type CompactionPart = { + id: string; + sessionID: string; + messageID: string; + type: 'compaction'; + auto: boolean; +}; + +export type RetryPart = { + id: string; + sessionID: string; + messageID: string; + type: 'retry'; + attempt: number; + error: ApiError; + time: { + created: number; + }; +}; + export type AgentPart = { id: string; sessionID: string; @@ -239,6 +441,8 @@ export type StepFinishPart = { sessionID: string; messageID: string; type: 'step-finish'; + reason: string; + snapshot?: string; cost: number; tokens: { input: number; @@ -256,6 +460,7 @@ export type StepStartPart = { sessionID: string; messageID: string; type: 'step-start'; + snapshot?: string; }; export type ToolStateError = { @@ -286,12 +491,27 @@ export type ToolStateCompleted = { time: { start: number; end: number; + compacted?: number; }; + attachments?: Array; +}; + +export type FilePart = { + id: string; + sessionID: string; + messageID: string; + type: 'file'; + mime: string; + filename?: string; + url: string; + source?: FilePartSource; }; export type ToolStateRunning = { status: 'running'; - input?: unknown; + input: { + [key: string]: unknown; + }; title?: string; metadata?: { [key: string]: unknown; @@ -303,17 +523,13 @@ export type ToolStateRunning = { export type ToolStatePending = { status: 'pending'; + input: { + [key: string]: unknown; + }; + raw: string; }; -export type ToolState = ({ - status: 'pending'; -} & ToolStatePending) | ({ - status: 'running'; -} & ToolStateRunning) | ({ - status: 'completed'; -} & ToolStateCompleted) | ({ - status: 'error'; -} & ToolStateError); +export type ToolState = ToolStatePending | ToolStateRunning | ToolStateCompleted | ToolStateError; export type ToolPart = { id: string; @@ -323,17 +539,9 @@ export type ToolPart = { callID: string; tool: string; state: ToolState; -}; - -export type FilePart = { - id: string; - sessionID: string; - messageID: string; - type: 'file'; - mime: string; - filename?: string; - url: string; - source?: FilePartSource; + metadata?: { + [key: string]: unknown; + }; }; export type ReasoningPart = { @@ -358,36 +566,32 @@ export type TextPart = { type: 'text'; text: string; synthetic?: boolean; + ignored?: boolean; time?: { start: number; end?: number; }; + metadata?: { + [key: string]: unknown; + }; }; -export type Part = ({ - type: 'text'; -} & TextPart) | ({ - type: 'reasoning'; -} & ReasoningPart) | ({ - type: 'file'; -} & FilePart) | ({ - type: 'tool'; -} & ToolPart) | ({ - type: 'step-start'; -} & StepStartPart) | ({ - type: 'step-finish'; -} & StepFinishPart) | ({ - type: 'snapshot'; -} & SnapshotPart) | ({ - type: 'patch'; -} & PatchPart) | ({ - type: 'agent'; -} & AgentPart); +export type Part = TextPart | { + id: string; + sessionID: string; + messageID: string; + type: 'subtask'; + prompt: string; + description: string; + agent: string; + command?: string; +} | ReasoningPart | FilePart | ToolPart | StepStartPart | StepFinishPart | SnapshotPart | PatchPart | AgentPart | RetryPart | CompactionPart; export type EventMessagePartUpdated = { type: 'message.part.updated'; properties: { part: Part; + delta?: string; }; }; @@ -407,19 +611,12 @@ export type AssistantMessage = { created: number; completed?: number; }; - error?: ({ - name: 'ProviderAuthError'; - } & ProviderAuthError) | ({ - name: 'UnknownError'; - } & UnknownError) | ({ - name: 'MessageOutputLengthError'; - } & MessageOutputLengthError) | ({ - name: 'MessageAbortedError'; - } & MessageAbortedError); - system: Array; + error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError | ApiError; + parentID: string; modelID: string; providerID: string; mode: string; + agent: string; path: { cwd: string; root: string; @@ -435,6 +632,7 @@ export type AssistantMessage = { write: number; }; }; + finish?: string; }; export type UserMessage = { @@ -444,13 +642,24 @@ export type UserMessage = { time: { created: number; }; + summary?: { + title?: string; + body?: string; + diffs: Array; + }; + agent: string; + model: { + providerID: string; + modelID: string; + }; + system?: string; + tools?: { + [key: string]: boolean; + }; + variant?: string; }; -export type Message = ({ - role: 'user'; -} & UserMessage) | ({ - role: 'assistant'; -} & AssistantMessage); +export type Message = UserMessage | AssistantMessage; export type EventMessageUpdated = { type: 'message.updated'; @@ -459,6 +668,13 @@ export type EventMessageUpdated = { }; }; +export type EventLspUpdated = { + type: 'lsp.updated'; + properties: { + [key: string]: unknown; + }; +}; + export type EventLspClientDiagnostics = { type: 'lsp.client.diagnostics'; properties: { @@ -467,6 +683,41 @@ export type EventLspClientDiagnostics = { }; }; +export type EventServerInstanceDisposed = { + type: 'server.instance.disposed'; + properties: { + directory: string; + }; +}; + +export type Project = { + id: string; + worktree: string; + vcs?: 'git'; + name?: string; + icon?: { + url?: string; + color?: string; + }; + time: { + created: number; + updated: number; + initialized?: number; + }; +}; + +export type EventProjectUpdated = { + type: 'project.updated'; + properties: Project; +}; + +export type EventInstallationUpdateAvailable = { + type: 'installation.update-available'; + properties: { + version: string; + }; +}; + export type EventInstallationUpdated = { type: 'installation.updated'; properties: { @@ -474,46 +725,14 @@ export type EventInstallationUpdated = { }; }; -export type Event = ({ - type: 'installation.updated'; -} & EventInstallationUpdated) | ({ - type: 'lsp.client.diagnostics'; -} & EventLspClientDiagnostics) | ({ - type: 'message.updated'; -} & EventMessageUpdated) | ({ - type: 'message.removed'; -} & EventMessageRemoved) | ({ - type: 'message.part.updated'; -} & EventMessagePartUpdated) | ({ - type: 'message.part.removed'; -} & EventMessagePartRemoved) | ({ - type: 'storage.write'; -} & EventStorageWrite) | ({ - type: 'permission.updated'; -} & EventPermissionUpdated) | ({ - type: 'permission.replied'; -} & EventPermissionReplied) | ({ - type: 'file.edited'; -} & EventFileEdited) | ({ - type: 'session.updated'; -} & EventSessionUpdated) | ({ - type: 'session.deleted'; -} & EventSessionDeleted) | ({ - type: 'session.idle'; -} & EventSessionIdle) | ({ - type: 'session.error'; -} & EventSessionError) | ({ - type: 'server.connected'; -} & EventServerConnected) | ({ - type: 'file.watcher.updated'; -} & EventFileWatcherUpdated) | ({ - type: 'ide.installed'; -} & EventIdeInstalled); +export type Event = EventInstallationUpdated | EventInstallationUpdateAvailable | EventProjectUpdated | EventServerInstanceDisposed | EventLspClientDiagnostics | EventLspUpdated | EventMessageUpdated | EventMessageRemoved | EventMessagePartUpdated | EventMessagePartRemoved | EventPermissionAsked | EventPermissionReplied | EventSessionStatus | EventSessionIdle | EventSessionCompacted | EventFileEdited | EventTodoUpdated | EventTuiPromptAppend | EventTuiCommandExecute | EventTuiToastShow | EventMcpToolsChanged | EventCommandExecuted | EventSessionCreated | EventSessionUpdated | EventSessionDeleted | EventSessionDiff | EventSessionError | EventFileWatcherUpdated | EventVcsBranchUpdated | EventPtyCreated | EventPtyUpdated | EventPtyExited | EventPtyDeleted | EventServerConnected | EventGlobalDisposed; export type EventSubscribeData = { body?: never; path?: never; - query?: never; + query?: { + directory?: string; + }; url: '/event'; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-nuxt/index.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-nuxt/index.ts index f08474c60..8b70601c1 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-nuxt/index.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-nuxt/index.ts @@ -1,4 +1,4 @@ // This file is auto-generated by @hey-api/openapi-ts export { eventSubscribe, type Options } from './sdk.gen'; -export type { AgentPart, AssistantMessage, ClientOptions, Event, EventFileEdited, EventFileWatcherUpdated, EventIdeInstalled, EventInstallationUpdated, EventLspClientDiagnostics, EventMessagePartRemoved, EventMessagePartUpdated, EventMessageRemoved, EventMessageUpdated, EventPermissionReplied, EventPermissionUpdated, EventServerConnected, EventSessionDeleted, EventSessionError, EventSessionIdle, EventSessionUpdated, EventStorageWrite, EventSubscribeData, EventSubscribeResponse, EventSubscribeResponses, FilePart, FilePartSource, FilePartSourceText, FileSource, Message, MessageAbortedError, MessageOutputLengthError, Part, PatchPart, Permission, ProviderAuthError, Range, ReasoningPart, Session, SnapshotPart, StepFinishPart, StepStartPart, SymbolSource, TextPart, ToolPart, ToolState, ToolStateCompleted, ToolStateError, ToolStatePending, ToolStateRunning, UnknownError, UserMessage } from './types.gen'; +export type { AgentPart, ApiError, AssistantMessage, ClientOptions, CompactionPart, Event, EventCommandExecuted, EventFileEdited, EventFileWatcherUpdated, EventGlobalDisposed, EventInstallationUpdateAvailable, EventInstallationUpdated, EventLspClientDiagnostics, EventLspUpdated, EventMcpToolsChanged, EventMessagePartRemoved, EventMessagePartUpdated, EventMessageRemoved, EventMessageUpdated, EventPermissionAsked, EventPermissionReplied, EventProjectUpdated, EventPtyCreated, EventPtyDeleted, EventPtyExited, EventPtyUpdated, EventServerConnected, EventServerInstanceDisposed, EventSessionCompacted, EventSessionCreated, EventSessionDeleted, EventSessionDiff, EventSessionError, EventSessionIdle, EventSessionStatus, EventSessionUpdated, EventSubscribeData, EventSubscribeResponse, EventSubscribeResponses, EventTodoUpdated, EventTuiCommandExecute, EventTuiPromptAppend, EventTuiToastShow, EventVcsBranchUpdated, FileDiff, FilePart, FilePartSource, FilePartSourceText, FileSource, Message, MessageAbortedError, MessageOutputLengthError, Part, PatchPart, PermissionAction, PermissionRequest, PermissionRule, PermissionRuleset, Project, ProviderAuthError, Pty, Range, ReasoningPart, RetryPart, Session, SessionStatus, SnapshotPart, StepFinishPart, StepStartPart, SymbolSource, TextPart, Todo, ToolPart, ToolState, ToolStateCompleted, ToolStateError, ToolStatePending, ToolStateRunning, UnknownError, UserMessage } from './types.gen'; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-nuxt/sdk.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-nuxt/sdk.gen.ts index e6186470a..7dcd68e14 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-nuxt/sdk.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-nuxt/sdk.gen.ts @@ -19,6 +19,8 @@ export type Options(options: Options) => (options.client ?? client).sse.get({ url: '/event', ...options }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-nuxt/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-nuxt/types.gen.ts index e8552bf4d..114a11523 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-nuxt/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-nuxt/types.gen.ts @@ -4,6 +4,16 @@ export type ClientOptions = { baseURL: `${string}://${string}` | (string & {}); }; +export type PermissionAction = 'allow' | 'deny' | 'ask'; + +export type PermissionRule = { + permission: string; + pattern: string; + action: PermissionAction; +}; + +export type PermissionRuleset = Array; + export type Range = { start: { line: number; @@ -36,31 +46,73 @@ export type FileSource = { path: string; }; -export type FilePartSource = ({ - type: 'file'; -} & FileSource) | ({ - type: 'symbol'; -} & SymbolSource); +export type FilePartSource = FileSource | SymbolSource; -export type EventIdeInstalled = { - type: 'ide.installed'; +export type EventGlobalDisposed = { + type: 'global.disposed'; properties: { - ide: string; + [key: string]: unknown; }; }; -export type EventFileWatcherUpdated = { - type: 'file.watcher.updated'; +export type EventServerConnected = { + type: 'server.connected'; properties: { - file: string; - event: 'rename' | 'change'; + [key: string]: unknown; }; }; -export type EventServerConnected = { - type: 'server.connected'; +export type EventPtyDeleted = { + type: 'pty.deleted'; properties: { - [key: string]: unknown; + id: string; + }; +}; + +export type EventPtyExited = { + type: 'pty.exited'; + properties: { + id: string; + exitCode: number; + }; +}; + +export type EventPtyUpdated = { + type: 'pty.updated'; + properties: { + info: Pty; + }; +}; + +export type Pty = { + id: string; + title: string; + command: string; + args: Array; + cwd: string; + status: 'running' | 'exited'; + pid: number; +}; + +export type EventPtyCreated = { + type: 'pty.created'; + properties: { + info: Pty; + }; +}; + +export type EventVcsBranchUpdated = { + type: 'vcs.branch.updated'; + properties: { + branch?: string; + }; +}; + +export type EventFileWatcherUpdated = { + type: 'file.watcher.updated'; + properties: { + file: string; + event: 'add' | 'change' | 'unlink'; }; }; @@ -68,22 +120,30 @@ export type EventSessionError = { type: 'session.error'; properties: { sessionID?: string; - error?: ({ - name: 'ProviderAuthError'; - } & ProviderAuthError) | ({ - name: 'UnknownError'; - } & UnknownError) | ({ - name: 'MessageOutputLengthError'; - } & MessageOutputLengthError) | ({ - name: 'MessageAbortedError'; - } & MessageAbortedError); + error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError | ApiError; + }; +}; + +export type ApiError = { + name: 'APIError'; + data: { + message: string; + statusCode?: number; + isRetryable: boolean; + responseHeaders?: { + [key: string]: string; + }; + responseBody?: string; + metadata?: { + [key: string]: string; + }; }; }; export type MessageAbortedError = { name: 'MessageAbortedError'; data: { - [key: string]: unknown; + message: string; }; }; @@ -109,13 +169,22 @@ export type ProviderAuthError = { }; }; -export type EventSessionIdle = { - type: 'session.idle'; +export type EventSessionDiff = { + type: 'session.diff'; properties: { sessionID: string; + diff: Array; }; }; +export type FileDiff = { + file: string; + before: string; + after: string; + additions: number; + deletions: number; +}; + export type EventSessionDeleted = { type: 'session.deleted'; properties: { @@ -125,7 +194,15 @@ export type EventSessionDeleted = { export type Session = { id: string; + projectID: string; + directory: string; parentID?: string; + summary?: { + additions: number; + deletions: number; + files: number; + diffs?: Array; + }; share?: { url: string; }; @@ -134,7 +211,10 @@ export type Session = { time: { created: number; updated: number; + compacting?: number; + archived?: number; }; + permission?: PermissionRuleset; revert?: { messageID: string; partID?: string; @@ -150,6 +230,84 @@ export type EventSessionUpdated = { }; }; +export type EventSessionCreated = { + type: 'session.created'; + properties: { + info: Session; + }; +}; + +export type EventCommandExecuted = { + type: 'command.executed'; + properties: { + name: string; + sessionID: string; + arguments: string; + messageID: string; + }; +}; + +export type EventMcpToolsChanged = { + type: 'mcp.tools.changed'; + properties: { + server: string; + }; +}; + +export type EventTuiToastShow = { + type: 'tui.toast.show'; + properties: { + title?: string; + message: string; + variant: 'info' | 'success' | 'warning' | 'error'; + /** + * Duration in milliseconds + */ + duration?: number; + }; +}; + +export type EventTuiCommandExecute = { + type: 'tui.command.execute'; + properties: { + command: 'session.list' | 'session.new' | 'session.share' | 'session.interrupt' | 'session.compact' | 'session.page.up' | 'session.page.down' | 'session.half.page.up' | 'session.half.page.down' | 'session.first' | 'session.last' | 'prompt.clear' | 'prompt.submit' | 'agent.cycle' | string; + }; +}; + +export type EventTuiPromptAppend = { + type: 'tui.prompt.append'; + properties: { + text: 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; + /** + * Unique identifier for the todo item + */ + id: string; +}; + +export type EventTodoUpdated = { + type: 'todo.updated'; + properties: { + sessionID: string; + todos: Array; + }; +}; + export type EventFileEdited = { type: 'file.edited'; properties: { @@ -157,42 +315,66 @@ export type EventFileEdited = { }; }; +export type EventSessionCompacted = { + type: 'session.compacted'; + properties: { + sessionID: string; + }; +}; + +export type EventSessionIdle = { + type: 'session.idle'; + properties: { + sessionID: string; + }; +}; + +export type SessionStatus = { + type: 'idle'; +} | { + type: 'retry'; + attempt: number; + message: string; + next: number; +} | { + type: 'busy'; +}; + +export type EventSessionStatus = { + type: 'session.status'; + properties: { + sessionID: string; + status: SessionStatus; + }; +}; + export type EventPermissionReplied = { type: 'permission.replied'; properties: { sessionID: string; - permissionID: string; - response: string; + requestID: string; + reply: 'once' | 'always' | 'reject'; }; }; -export type Permission = { +export type PermissionRequest = { id: string; - type: string; - pattern?: string; sessionID: string; - messageID: string; - callID?: string; - title: string; + permission: string; + patterns: Array; metadata: { [key: string]: unknown; }; - time: { - created: number; + always: Array; + tool?: { + messageID: string; + callID: string; }; }; -export type EventPermissionUpdated = { - type: 'permission.updated'; - properties: Permission; -}; - -export type EventStorageWrite = { - type: 'storage.write'; - properties: { - key: string; - content?: unknown; - }; +export type EventPermissionAsked = { + type: 'permission.asked'; + properties: PermissionRequest; }; export type EventMessagePartRemoved = { @@ -204,6 +386,26 @@ export type EventMessagePartRemoved = { }; }; +export type CompactionPart = { + id: string; + sessionID: string; + messageID: string; + type: 'compaction'; + auto: boolean; +}; + +export type RetryPart = { + id: string; + sessionID: string; + messageID: string; + type: 'retry'; + attempt: number; + error: ApiError; + time: { + created: number; + }; +}; + export type AgentPart = { id: string; sessionID: string; @@ -239,6 +441,8 @@ export type StepFinishPart = { sessionID: string; messageID: string; type: 'step-finish'; + reason: string; + snapshot?: string; cost: number; tokens: { input: number; @@ -256,6 +460,7 @@ export type StepStartPart = { sessionID: string; messageID: string; type: 'step-start'; + snapshot?: string; }; export type ToolStateError = { @@ -286,12 +491,27 @@ export type ToolStateCompleted = { time: { start: number; end: number; + compacted?: number; }; + attachments?: Array; +}; + +export type FilePart = { + id: string; + sessionID: string; + messageID: string; + type: 'file'; + mime: string; + filename?: string; + url: string; + source?: FilePartSource; }; export type ToolStateRunning = { status: 'running'; - input?: unknown; + input: { + [key: string]: unknown; + }; title?: string; metadata?: { [key: string]: unknown; @@ -303,17 +523,13 @@ export type ToolStateRunning = { export type ToolStatePending = { status: 'pending'; + input: { + [key: string]: unknown; + }; + raw: string; }; -export type ToolState = ({ - status: 'pending'; -} & ToolStatePending) | ({ - status: 'running'; -} & ToolStateRunning) | ({ - status: 'completed'; -} & ToolStateCompleted) | ({ - status: 'error'; -} & ToolStateError); +export type ToolState = ToolStatePending | ToolStateRunning | ToolStateCompleted | ToolStateError; export type ToolPart = { id: string; @@ -323,17 +539,9 @@ export type ToolPart = { callID: string; tool: string; state: ToolState; -}; - -export type FilePart = { - id: string; - sessionID: string; - messageID: string; - type: 'file'; - mime: string; - filename?: string; - url: string; - source?: FilePartSource; + metadata?: { + [key: string]: unknown; + }; }; export type ReasoningPart = { @@ -358,36 +566,32 @@ export type TextPart = { type: 'text'; text: string; synthetic?: boolean; + ignored?: boolean; time?: { start: number; end?: number; }; + metadata?: { + [key: string]: unknown; + }; }; -export type Part = ({ - type: 'text'; -} & TextPart) | ({ - type: 'reasoning'; -} & ReasoningPart) | ({ - type: 'file'; -} & FilePart) | ({ - type: 'tool'; -} & ToolPart) | ({ - type: 'step-start'; -} & StepStartPart) | ({ - type: 'step-finish'; -} & StepFinishPart) | ({ - type: 'snapshot'; -} & SnapshotPart) | ({ - type: 'patch'; -} & PatchPart) | ({ - type: 'agent'; -} & AgentPart); +export type Part = TextPart | { + id: string; + sessionID: string; + messageID: string; + type: 'subtask'; + prompt: string; + description: string; + agent: string; + command?: string; +} | ReasoningPart | FilePart | ToolPart | StepStartPart | StepFinishPart | SnapshotPart | PatchPart | AgentPart | RetryPart | CompactionPart; export type EventMessagePartUpdated = { type: 'message.part.updated'; properties: { part: Part; + delta?: string; }; }; @@ -407,19 +611,12 @@ export type AssistantMessage = { created: number; completed?: number; }; - error?: ({ - name: 'ProviderAuthError'; - } & ProviderAuthError) | ({ - name: 'UnknownError'; - } & UnknownError) | ({ - name: 'MessageOutputLengthError'; - } & MessageOutputLengthError) | ({ - name: 'MessageAbortedError'; - } & MessageAbortedError); - system: Array; + error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError | ApiError; + parentID: string; modelID: string; providerID: string; mode: string; + agent: string; path: { cwd: string; root: string; @@ -435,6 +632,7 @@ export type AssistantMessage = { write: number; }; }; + finish?: string; }; export type UserMessage = { @@ -444,13 +642,24 @@ export type UserMessage = { time: { created: number; }; + summary?: { + title?: string; + body?: string; + diffs: Array; + }; + agent: string; + model: { + providerID: string; + modelID: string; + }; + system?: string; + tools?: { + [key: string]: boolean; + }; + variant?: string; }; -export type Message = ({ - role: 'user'; -} & UserMessage) | ({ - role: 'assistant'; -} & AssistantMessage); +export type Message = UserMessage | AssistantMessage; export type EventMessageUpdated = { type: 'message.updated'; @@ -459,6 +668,13 @@ export type EventMessageUpdated = { }; }; +export type EventLspUpdated = { + type: 'lsp.updated'; + properties: { + [key: string]: unknown; + }; +}; + export type EventLspClientDiagnostics = { type: 'lsp.client.diagnostics'; properties: { @@ -467,6 +683,41 @@ export type EventLspClientDiagnostics = { }; }; +export type EventServerInstanceDisposed = { + type: 'server.instance.disposed'; + properties: { + directory: string; + }; +}; + +export type Project = { + id: string; + worktree: string; + vcs?: 'git'; + name?: string; + icon?: { + url?: string; + color?: string; + }; + time: { + created: number; + updated: number; + initialized?: number; + }; +}; + +export type EventProjectUpdated = { + type: 'project.updated'; + properties: Project; +}; + +export type EventInstallationUpdateAvailable = { + type: 'installation.update-available'; + properties: { + version: string; + }; +}; + export type EventInstallationUpdated = { type: 'installation.updated'; properties: { @@ -474,46 +725,14 @@ export type EventInstallationUpdated = { }; }; -export type Event = ({ - type: 'installation.updated'; -} & EventInstallationUpdated) | ({ - type: 'lsp.client.diagnostics'; -} & EventLspClientDiagnostics) | ({ - type: 'message.updated'; -} & EventMessageUpdated) | ({ - type: 'message.removed'; -} & EventMessageRemoved) | ({ - type: 'message.part.updated'; -} & EventMessagePartUpdated) | ({ - type: 'message.part.removed'; -} & EventMessagePartRemoved) | ({ - type: 'storage.write'; -} & EventStorageWrite) | ({ - type: 'permission.updated'; -} & EventPermissionUpdated) | ({ - type: 'permission.replied'; -} & EventPermissionReplied) | ({ - type: 'file.edited'; -} & EventFileEdited) | ({ - type: 'session.updated'; -} & EventSessionUpdated) | ({ - type: 'session.deleted'; -} & EventSessionDeleted) | ({ - type: 'session.idle'; -} & EventSessionIdle) | ({ - type: 'session.error'; -} & EventSessionError) | ({ - type: 'server.connected'; -} & EventServerConnected) | ({ - type: 'file.watcher.updated'; -} & EventFileWatcherUpdated) | ({ - type: 'ide.installed'; -} & EventIdeInstalled); +export type Event = EventInstallationUpdated | EventInstallationUpdateAvailable | EventProjectUpdated | EventServerInstanceDisposed | EventLspClientDiagnostics | EventLspUpdated | EventMessageUpdated | EventMessageRemoved | EventMessagePartUpdated | EventMessagePartRemoved | EventPermissionAsked | EventPermissionReplied | EventSessionStatus | EventSessionIdle | EventSessionCompacted | EventFileEdited | EventTodoUpdated | EventTuiPromptAppend | EventTuiCommandExecute | EventTuiToastShow | EventMcpToolsChanged | EventCommandExecuted | EventSessionCreated | EventSessionUpdated | EventSessionDeleted | EventSessionDiff | EventSessionError | EventFileWatcherUpdated | EventVcsBranchUpdated | EventPtyCreated | EventPtyUpdated | EventPtyExited | EventPtyDeleted | EventServerConnected | EventGlobalDisposed; export type EventSubscribeData = { body?: never; path?: never; - query?: never; + query?: { + directory?: string; + }; url: '/event'; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-ofetch/index.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-ofetch/index.ts index f08474c60..8b70601c1 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-ofetch/index.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-ofetch/index.ts @@ -1,4 +1,4 @@ // This file is auto-generated by @hey-api/openapi-ts export { eventSubscribe, type Options } from './sdk.gen'; -export type { AgentPart, AssistantMessage, ClientOptions, Event, EventFileEdited, EventFileWatcherUpdated, EventIdeInstalled, EventInstallationUpdated, EventLspClientDiagnostics, EventMessagePartRemoved, EventMessagePartUpdated, EventMessageRemoved, EventMessageUpdated, EventPermissionReplied, EventPermissionUpdated, EventServerConnected, EventSessionDeleted, EventSessionError, EventSessionIdle, EventSessionUpdated, EventStorageWrite, EventSubscribeData, EventSubscribeResponse, EventSubscribeResponses, FilePart, FilePartSource, FilePartSourceText, FileSource, Message, MessageAbortedError, MessageOutputLengthError, Part, PatchPart, Permission, ProviderAuthError, Range, ReasoningPart, Session, SnapshotPart, StepFinishPart, StepStartPart, SymbolSource, TextPart, ToolPart, ToolState, ToolStateCompleted, ToolStateError, ToolStatePending, ToolStateRunning, UnknownError, UserMessage } from './types.gen'; +export type { AgentPart, ApiError, AssistantMessage, ClientOptions, CompactionPart, Event, EventCommandExecuted, EventFileEdited, EventFileWatcherUpdated, EventGlobalDisposed, EventInstallationUpdateAvailable, EventInstallationUpdated, EventLspClientDiagnostics, EventLspUpdated, EventMcpToolsChanged, EventMessagePartRemoved, EventMessagePartUpdated, EventMessageRemoved, EventMessageUpdated, EventPermissionAsked, EventPermissionReplied, EventProjectUpdated, EventPtyCreated, EventPtyDeleted, EventPtyExited, EventPtyUpdated, EventServerConnected, EventServerInstanceDisposed, EventSessionCompacted, EventSessionCreated, EventSessionDeleted, EventSessionDiff, EventSessionError, EventSessionIdle, EventSessionStatus, EventSessionUpdated, EventSubscribeData, EventSubscribeResponse, EventSubscribeResponses, EventTodoUpdated, EventTuiCommandExecute, EventTuiPromptAppend, EventTuiToastShow, EventVcsBranchUpdated, FileDiff, FilePart, FilePartSource, FilePartSourceText, FileSource, Message, MessageAbortedError, MessageOutputLengthError, Part, PatchPart, PermissionAction, PermissionRequest, PermissionRule, PermissionRuleset, Project, ProviderAuthError, Pty, Range, ReasoningPart, RetryPart, Session, SessionStatus, SnapshotPart, StepFinishPart, StepStartPart, SymbolSource, TextPart, Todo, ToolPart, ToolState, ToolStateCompleted, ToolStateError, ToolStatePending, ToolStateRunning, UnknownError, UserMessage } from './types.gen'; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-ofetch/sdk.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-ofetch/sdk.gen.ts index 361b64c2e..9e54b1a5b 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-ofetch/sdk.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-ofetch/sdk.gen.ts @@ -19,6 +19,8 @@ export type Options(options?: Options) => (options?.client ?? client).sse.get({ url: '/event', ...options }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-ofetch/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-ofetch/types.gen.ts index d3fe8ca92..dd1e1efa2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-ofetch/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-ofetch/types.gen.ts @@ -4,6 +4,16 @@ export type ClientOptions = { baseUrl: `${string}://${string}` | (string & {}); }; +export type PermissionAction = 'allow' | 'deny' | 'ask'; + +export type PermissionRule = { + permission: string; + pattern: string; + action: PermissionAction; +}; + +export type PermissionRuleset = Array; + export type Range = { start: { line: number; @@ -36,31 +46,73 @@ export type FileSource = { path: string; }; -export type FilePartSource = ({ - type: 'file'; -} & FileSource) | ({ - type: 'symbol'; -} & SymbolSource); +export type FilePartSource = FileSource | SymbolSource; -export type EventIdeInstalled = { - type: 'ide.installed'; +export type EventGlobalDisposed = { + type: 'global.disposed'; properties: { - ide: string; + [key: string]: unknown; }; }; -export type EventFileWatcherUpdated = { - type: 'file.watcher.updated'; +export type EventServerConnected = { + type: 'server.connected'; properties: { - file: string; - event: 'rename' | 'change'; + [key: string]: unknown; }; }; -export type EventServerConnected = { - type: 'server.connected'; +export type EventPtyDeleted = { + type: 'pty.deleted'; properties: { - [key: string]: unknown; + id: string; + }; +}; + +export type EventPtyExited = { + type: 'pty.exited'; + properties: { + id: string; + exitCode: number; + }; +}; + +export type EventPtyUpdated = { + type: 'pty.updated'; + properties: { + info: Pty; + }; +}; + +export type Pty = { + id: string; + title: string; + command: string; + args: Array; + cwd: string; + status: 'running' | 'exited'; + pid: number; +}; + +export type EventPtyCreated = { + type: 'pty.created'; + properties: { + info: Pty; + }; +}; + +export type EventVcsBranchUpdated = { + type: 'vcs.branch.updated'; + properties: { + branch?: string; + }; +}; + +export type EventFileWatcherUpdated = { + type: 'file.watcher.updated'; + properties: { + file: string; + event: 'add' | 'change' | 'unlink'; }; }; @@ -68,22 +120,30 @@ export type EventSessionError = { type: 'session.error'; properties: { sessionID?: string; - error?: ({ - name: 'ProviderAuthError'; - } & ProviderAuthError) | ({ - name: 'UnknownError'; - } & UnknownError) | ({ - name: 'MessageOutputLengthError'; - } & MessageOutputLengthError) | ({ - name: 'MessageAbortedError'; - } & MessageAbortedError); + error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError | ApiError; + }; +}; + +export type ApiError = { + name: 'APIError'; + data: { + message: string; + statusCode?: number; + isRetryable: boolean; + responseHeaders?: { + [key: string]: string; + }; + responseBody?: string; + metadata?: { + [key: string]: string; + }; }; }; export type MessageAbortedError = { name: 'MessageAbortedError'; data: { - [key: string]: unknown; + message: string; }; }; @@ -109,13 +169,22 @@ export type ProviderAuthError = { }; }; -export type EventSessionIdle = { - type: 'session.idle'; +export type EventSessionDiff = { + type: 'session.diff'; properties: { sessionID: string; + diff: Array; }; }; +export type FileDiff = { + file: string; + before: string; + after: string; + additions: number; + deletions: number; +}; + export type EventSessionDeleted = { type: 'session.deleted'; properties: { @@ -125,7 +194,15 @@ export type EventSessionDeleted = { export type Session = { id: string; + projectID: string; + directory: string; parentID?: string; + summary?: { + additions: number; + deletions: number; + files: number; + diffs?: Array; + }; share?: { url: string; }; @@ -134,7 +211,10 @@ export type Session = { time: { created: number; updated: number; + compacting?: number; + archived?: number; }; + permission?: PermissionRuleset; revert?: { messageID: string; partID?: string; @@ -150,6 +230,84 @@ export type EventSessionUpdated = { }; }; +export type EventSessionCreated = { + type: 'session.created'; + properties: { + info: Session; + }; +}; + +export type EventCommandExecuted = { + type: 'command.executed'; + properties: { + name: string; + sessionID: string; + arguments: string; + messageID: string; + }; +}; + +export type EventMcpToolsChanged = { + type: 'mcp.tools.changed'; + properties: { + server: string; + }; +}; + +export type EventTuiToastShow = { + type: 'tui.toast.show'; + properties: { + title?: string; + message: string; + variant: 'info' | 'success' | 'warning' | 'error'; + /** + * Duration in milliseconds + */ + duration?: number; + }; +}; + +export type EventTuiCommandExecute = { + type: 'tui.command.execute'; + properties: { + command: 'session.list' | 'session.new' | 'session.share' | 'session.interrupt' | 'session.compact' | 'session.page.up' | 'session.page.down' | 'session.half.page.up' | 'session.half.page.down' | 'session.first' | 'session.last' | 'prompt.clear' | 'prompt.submit' | 'agent.cycle' | string; + }; +}; + +export type EventTuiPromptAppend = { + type: 'tui.prompt.append'; + properties: { + text: 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; + /** + * Unique identifier for the todo item + */ + id: string; +}; + +export type EventTodoUpdated = { + type: 'todo.updated'; + properties: { + sessionID: string; + todos: Array; + }; +}; + export type EventFileEdited = { type: 'file.edited'; properties: { @@ -157,42 +315,66 @@ export type EventFileEdited = { }; }; +export type EventSessionCompacted = { + type: 'session.compacted'; + properties: { + sessionID: string; + }; +}; + +export type EventSessionIdle = { + type: 'session.idle'; + properties: { + sessionID: string; + }; +}; + +export type SessionStatus = { + type: 'idle'; +} | { + type: 'retry'; + attempt: number; + message: string; + next: number; +} | { + type: 'busy'; +}; + +export type EventSessionStatus = { + type: 'session.status'; + properties: { + sessionID: string; + status: SessionStatus; + }; +}; + export type EventPermissionReplied = { type: 'permission.replied'; properties: { sessionID: string; - permissionID: string; - response: string; + requestID: string; + reply: 'once' | 'always' | 'reject'; }; }; -export type Permission = { +export type PermissionRequest = { id: string; - type: string; - pattern?: string; sessionID: string; - messageID: string; - callID?: string; - title: string; + permission: string; + patterns: Array; metadata: { [key: string]: unknown; }; - time: { - created: number; + always: Array; + tool?: { + messageID: string; + callID: string; }; }; -export type EventPermissionUpdated = { - type: 'permission.updated'; - properties: Permission; -}; - -export type EventStorageWrite = { - type: 'storage.write'; - properties: { - key: string; - content?: unknown; - }; +export type EventPermissionAsked = { + type: 'permission.asked'; + properties: PermissionRequest; }; export type EventMessagePartRemoved = { @@ -204,6 +386,26 @@ export type EventMessagePartRemoved = { }; }; +export type CompactionPart = { + id: string; + sessionID: string; + messageID: string; + type: 'compaction'; + auto: boolean; +}; + +export type RetryPart = { + id: string; + sessionID: string; + messageID: string; + type: 'retry'; + attempt: number; + error: ApiError; + time: { + created: number; + }; +}; + export type AgentPart = { id: string; sessionID: string; @@ -239,6 +441,8 @@ export type StepFinishPart = { sessionID: string; messageID: string; type: 'step-finish'; + reason: string; + snapshot?: string; cost: number; tokens: { input: number; @@ -256,6 +460,7 @@ export type StepStartPart = { sessionID: string; messageID: string; type: 'step-start'; + snapshot?: string; }; export type ToolStateError = { @@ -286,12 +491,27 @@ export type ToolStateCompleted = { time: { start: number; end: number; + compacted?: number; }; + attachments?: Array; +}; + +export type FilePart = { + id: string; + sessionID: string; + messageID: string; + type: 'file'; + mime: string; + filename?: string; + url: string; + source?: FilePartSource; }; export type ToolStateRunning = { status: 'running'; - input?: unknown; + input: { + [key: string]: unknown; + }; title?: string; metadata?: { [key: string]: unknown; @@ -303,17 +523,13 @@ export type ToolStateRunning = { export type ToolStatePending = { status: 'pending'; + input: { + [key: string]: unknown; + }; + raw: string; }; -export type ToolState = ({ - status: 'pending'; -} & ToolStatePending) | ({ - status: 'running'; -} & ToolStateRunning) | ({ - status: 'completed'; -} & ToolStateCompleted) | ({ - status: 'error'; -} & ToolStateError); +export type ToolState = ToolStatePending | ToolStateRunning | ToolStateCompleted | ToolStateError; export type ToolPart = { id: string; @@ -323,17 +539,9 @@ export type ToolPart = { callID: string; tool: string; state: ToolState; -}; - -export type FilePart = { - id: string; - sessionID: string; - messageID: string; - type: 'file'; - mime: string; - filename?: string; - url: string; - source?: FilePartSource; + metadata?: { + [key: string]: unknown; + }; }; export type ReasoningPart = { @@ -358,36 +566,32 @@ export type TextPart = { type: 'text'; text: string; synthetic?: boolean; + ignored?: boolean; time?: { start: number; end?: number; }; + metadata?: { + [key: string]: unknown; + }; }; -export type Part = ({ - type: 'text'; -} & TextPart) | ({ - type: 'reasoning'; -} & ReasoningPart) | ({ - type: 'file'; -} & FilePart) | ({ - type: 'tool'; -} & ToolPart) | ({ - type: 'step-start'; -} & StepStartPart) | ({ - type: 'step-finish'; -} & StepFinishPart) | ({ - type: 'snapshot'; -} & SnapshotPart) | ({ - type: 'patch'; -} & PatchPart) | ({ - type: 'agent'; -} & AgentPart); +export type Part = TextPart | { + id: string; + sessionID: string; + messageID: string; + type: 'subtask'; + prompt: string; + description: string; + agent: string; + command?: string; +} | ReasoningPart | FilePart | ToolPart | StepStartPart | StepFinishPart | SnapshotPart | PatchPart | AgentPart | RetryPart | CompactionPart; export type EventMessagePartUpdated = { type: 'message.part.updated'; properties: { part: Part; + delta?: string; }; }; @@ -407,19 +611,12 @@ export type AssistantMessage = { created: number; completed?: number; }; - error?: ({ - name: 'ProviderAuthError'; - } & ProviderAuthError) | ({ - name: 'UnknownError'; - } & UnknownError) | ({ - name: 'MessageOutputLengthError'; - } & MessageOutputLengthError) | ({ - name: 'MessageAbortedError'; - } & MessageAbortedError); - system: Array; + error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError | ApiError; + parentID: string; modelID: string; providerID: string; mode: string; + agent: string; path: { cwd: string; root: string; @@ -435,6 +632,7 @@ export type AssistantMessage = { write: number; }; }; + finish?: string; }; export type UserMessage = { @@ -444,13 +642,24 @@ export type UserMessage = { time: { created: number; }; + summary?: { + title?: string; + body?: string; + diffs: Array; + }; + agent: string; + model: { + providerID: string; + modelID: string; + }; + system?: string; + tools?: { + [key: string]: boolean; + }; + variant?: string; }; -export type Message = ({ - role: 'user'; -} & UserMessage) | ({ - role: 'assistant'; -} & AssistantMessage); +export type Message = UserMessage | AssistantMessage; export type EventMessageUpdated = { type: 'message.updated'; @@ -459,6 +668,13 @@ export type EventMessageUpdated = { }; }; +export type EventLspUpdated = { + type: 'lsp.updated'; + properties: { + [key: string]: unknown; + }; +}; + export type EventLspClientDiagnostics = { type: 'lsp.client.diagnostics'; properties: { @@ -467,6 +683,41 @@ export type EventLspClientDiagnostics = { }; }; +export type EventServerInstanceDisposed = { + type: 'server.instance.disposed'; + properties: { + directory: string; + }; +}; + +export type Project = { + id: string; + worktree: string; + vcs?: 'git'; + name?: string; + icon?: { + url?: string; + color?: string; + }; + time: { + created: number; + updated: number; + initialized?: number; + }; +}; + +export type EventProjectUpdated = { + type: 'project.updated'; + properties: Project; +}; + +export type EventInstallationUpdateAvailable = { + type: 'installation.update-available'; + properties: { + version: string; + }; +}; + export type EventInstallationUpdated = { type: 'installation.updated'; properties: { @@ -474,46 +725,14 @@ export type EventInstallationUpdated = { }; }; -export type Event = ({ - type: 'installation.updated'; -} & EventInstallationUpdated) | ({ - type: 'lsp.client.diagnostics'; -} & EventLspClientDiagnostics) | ({ - type: 'message.updated'; -} & EventMessageUpdated) | ({ - type: 'message.removed'; -} & EventMessageRemoved) | ({ - type: 'message.part.updated'; -} & EventMessagePartUpdated) | ({ - type: 'message.part.removed'; -} & EventMessagePartRemoved) | ({ - type: 'storage.write'; -} & EventStorageWrite) | ({ - type: 'permission.updated'; -} & EventPermissionUpdated) | ({ - type: 'permission.replied'; -} & EventPermissionReplied) | ({ - type: 'file.edited'; -} & EventFileEdited) | ({ - type: 'session.updated'; -} & EventSessionUpdated) | ({ - type: 'session.deleted'; -} & EventSessionDeleted) | ({ - type: 'session.idle'; -} & EventSessionIdle) | ({ - type: 'session.error'; -} & EventSessionError) | ({ - type: 'server.connected'; -} & EventServerConnected) | ({ - type: 'file.watcher.updated'; -} & EventFileWatcherUpdated) | ({ - type: 'ide.installed'; -} & EventIdeInstalled); +export type Event = EventInstallationUpdated | EventInstallationUpdateAvailable | EventProjectUpdated | EventServerInstanceDisposed | EventLspClientDiagnostics | EventLspUpdated | EventMessageUpdated | EventMessageRemoved | EventMessagePartUpdated | EventMessagePartRemoved | EventPermissionAsked | EventPermissionReplied | EventSessionStatus | EventSessionIdle | EventSessionCompacted | EventFileEdited | EventTodoUpdated | EventTuiPromptAppend | EventTuiCommandExecute | EventTuiToastShow | EventMcpToolsChanged | EventCommandExecuted | EventSessionCreated | EventSessionUpdated | EventSessionDeleted | EventSessionDiff | EventSessionError | EventFileWatcherUpdated | EventVcsBranchUpdated | EventPtyCreated | EventPtyUpdated | EventPtyExited | EventPtyDeleted | EventServerConnected | EventGlobalDisposed; export type EventSubscribeData = { body?: never; path?: never; - query?: never; + query?: { + directory?: string; + }; url: '/event'; }; diff --git a/packages/openapi-ts-tests/sdks/__snapshots__/opencode/export-all/sdk.gen.ts b/packages/openapi-ts-tests/sdks/__snapshots__/opencode/export-all/sdk.gen.ts index 56ce2c581..2f40e981f 100644 --- a/packages/openapi-ts-tests/sdks/__snapshots__/opencode/export-all/sdk.gen.ts +++ b/packages/openapi-ts-tests/sdks/__snapshots__/opencode/export-all/sdk.gen.ts @@ -2,7 +2,7 @@ import { buildClientParams, type Client, type Options as Options2, type TDataShape } from './client'; import { client } from './client.gen'; -import type { AgentPartInput, AppAgentsResponses, AppGetResponses, AppInitResponses, AppLogResponses, Auth, AuthSetErrors, AuthSetResponses, ConfigGetResponses, ConfigProvidersResponses, EventSubscribeResponses, FilePartInput, FileReadResponses, FileStatusResponses, FindFilesResponses, FindSymbolsResponses, FindTextResponses, PostSessionByIdPermissionsByPermissionIdResponses, SessionAbortResponses, SessionChatResponses, SessionChildrenResponses, SessionCreateErrors, SessionCreateResponses, SessionDeleteResponses, SessionGetResponses, SessionInitResponses, SessionListResponses, SessionMessageResponses, SessionMessagesResponses, SessionRevertResponses, SessionShareResponses, SessionShellResponses, SessionSummarizeResponses, SessionUnrevertResponses, SessionUnshareResponses, SessionUpdateResponses, TextPartInput, TuiAppendPromptResponses, TuiClearPromptResponses, TuiExecuteCommandResponses, TuiOpenHelpResponses, TuiOpenModelsResponses, TuiOpenSessionsResponses, TuiOpenThemesResponses, TuiShowToastResponses, TuiSubmitPromptResponses } from './types.gen'; +import type { AgentPartInput, AppAgentsResponses, AppLogErrors, AppLogResponses, Auth, AuthSetErrors, AuthSetResponses, CommandListResponses, Config, ConfigGetResponses, ConfigProvidersResponses, ConfigUpdateErrors, ConfigUpdateResponses, EventSubscribeResponses, EventTuiCommandExecute, EventTuiPromptAppend, EventTuiToastShow, FileListResponses, FilePartInput, FileReadResponses, FileStatusResponses, FindFilesResponses, FindSymbolsResponses, FindTextResponses, FormatterStatusResponses, GlobalDisposeResponses, GlobalEventResponses, GlobalHealthResponses, InstanceDisposeResponses, LspStatusResponses, McpAddErrors, McpAddResponses, McpAuthAuthenticateErrors, McpAuthAuthenticateResponses, McpAuthCallbackErrors, McpAuthCallbackResponses, McpAuthRemoveErrors, McpAuthRemoveResponses, McpAuthStartErrors, McpAuthStartResponses, McpConnectResponses, McpDisconnectResponses, McpLocalConfig, McpRemoteConfig, McpStatusResponses, Part, PartDeleteErrors, PartDeleteResponses, PartUpdateErrors, PartUpdateResponses, PathGetResponses, PermissionListResponses, PermissionReplyErrors, PermissionReplyResponses, PermissionRespondErrors, PermissionRespondResponses, PermissionRuleset, ProjectCurrentResponses, ProjectListResponses, ProjectUpdateErrors, ProjectUpdateResponses, ProviderAuthResponses, ProviderListResponses, ProviderOauthAuthorizeErrors, ProviderOauthAuthorizeResponses, ProviderOauthCallbackErrors, ProviderOauthCallbackResponses, PtyConnectErrors, PtyConnectResponses, PtyCreateErrors, PtyCreateResponses, PtyGetErrors, PtyGetResponses, PtyListResponses, PtyRemoveErrors, PtyRemoveResponses, PtyUpdateErrors, PtyUpdateResponses, SessionAbortErrors, SessionAbortResponses, SessionChildrenErrors, SessionChildrenResponses, SessionCommandErrors, SessionCommandResponses, SessionCreateErrors, SessionCreateResponses, SessionDeleteErrors, SessionDeleteResponses, SessionDiffErrors, SessionDiffResponses, SessionForkResponses, SessionGetErrors, SessionGetResponses, SessionInitErrors, SessionInitResponses, SessionListResponses, SessionMessageErrors, SessionMessageResponses, SessionMessagesErrors, SessionMessagesResponses, SessionPromptAsyncErrors, SessionPromptAsyncResponses, SessionPromptErrors, SessionPromptResponses, SessionRevertErrors, SessionRevertResponses, SessionShareErrors, SessionShareResponses, SessionShellErrors, SessionShellResponses, SessionStatusErrors, SessionStatusResponses, SessionSummarizeErrors, SessionSummarizeResponses, SessionTodoErrors, SessionTodoResponses, SessionUnrevertErrors, SessionUnrevertResponses, SessionUnshareErrors, SessionUnshareResponses, SessionUpdateErrors, SessionUpdateResponses, SubtaskPartInput, TextPartInput, ToolIdsErrors, ToolIdsResponses, ToolListErrors, ToolListResponses, TuiAppendPromptErrors, TuiAppendPromptResponses, TuiClearPromptResponses, TuiControlNextResponses, TuiControlResponseResponses, TuiExecuteCommandErrors, TuiExecuteCommandResponses, TuiOpenHelpResponses, TuiOpenModelsResponses, TuiOpenSessionsResponses, TuiOpenThemesResponses, TuiPublishErrors, TuiPublishResponses, TuiShowToastResponses, TuiSubmitPromptResponses, VcsGetResponses } from './types.gen'; export type Options = Options2 & { /** @@ -19,38 +19,381 @@ export type Options(options?: Options) => (options?.client ?? client).get({ url: '/global/health', ...options }); + +/** + * Get global events + * + * Subscribe to global events from the OpenCode system using server-sent events. + */ +export const globalEvent = (options?: Options) => (options?.client ?? client).sse.get({ url: '/global/event', ...options }); + +/** + * Dispose instance + * + * Clean up and dispose all OpenCode instances, releasing all resources. + */ +export const globalDispose = (options?: Options) => (options?.client ?? client).post({ url: '/global/dispose', ...options }); + +/** + * List all projects + * + * Get a list of projects that have been opened with OpenCode. + */ +export const projectList = (parameters?: { + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/project', + ...options, + ...params + }); +}; + +/** + * Get current project + * + * Retrieve the currently active project that OpenCode is working with. + */ +export const projectCurrent = (parameters?: { + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/project/current', + ...options, + ...params + }); +}; + +/** + * Update project + * + * Update project properties such as name, icon and color. + */ +export const projectUpdate = (parameters: { + projectID: string; + directory?: string; + name?: string; + icon?: { + url?: string; + color?: string; + }; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'projectID' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'name' }, + { in: 'body', key: 'icon' } + ] }]); + return (options?.client ?? client).patch({ + url: '/project/{projectID}', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); +}; + +/** + * List PTY sessions + * + * Get a list of all active pseudo-terminal (PTY) sessions managed by OpenCode. + */ +export const ptyList = (parameters?: { + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/pty', + ...options, + ...params + }); +}; + +/** + * Create PTY session + * + * Create a new pseudo-terminal (PTY) session for running shell commands and processes. + */ +export const ptyCreate = (parameters?: { + directory?: string; + command?: string; + args?: Array; + cwd?: string; + title?: string; + env?: { + [key: string]: string; + }; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [ + { in: 'query', key: 'directory' }, + { in: 'body', key: 'command' }, + { in: 'body', key: 'args' }, + { in: 'body', key: 'cwd' }, + { in: 'body', key: 'title' }, + { in: 'body', key: 'env' } + ] }]); + return (options?.client ?? client).post({ + url: '/pty', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); +}; + +/** + * Remove PTY session + * + * Remove and terminate a specific pseudo-terminal (PTY) session. + */ +export const ptyRemove = (parameters: { + ptyID: string; + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'ptyID' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).delete({ + url: '/pty/{ptyID}', + ...options, + ...params + }); +}; + +/** + * Get PTY session + * + * Retrieve detailed information about a specific pseudo-terminal (PTY) session. + */ +export const ptyGet = (parameters: { + ptyID: string; + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'ptyID' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/pty/{ptyID}', + ...options, + ...params + }); +}; + +/** + * Update PTY session + * + * Update properties of an existing pseudo-terminal (PTY) session. + */ +export const ptyUpdate = (parameters: { + ptyID: string; + directory?: string; + title?: string; + size?: { + rows: number; + cols: number; + }; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'ptyID' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'title' }, + { in: 'body', key: 'size' } + ] }]); + return (options?.client ?? client).put({ + url: '/pty/{ptyID}', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); +}; + +/** + * Connect to PTY session + * + * Establish a WebSocket connection to interact with a pseudo-terminal (PTY) session in real-time. + */ +export const ptyConnect = (parameters: { + ptyID: string; + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'ptyID' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/pty/{ptyID}/connect', + ...options, + ...params + }); +}; + +/** + * Get configuration + * + * Retrieve the current OpenCode configuration settings and preferences. + */ +export const configGet = (parameters?: { + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/config', + ...options, + ...params + }); +}; + +/** + * Update configuration + * + * Update OpenCode configuration settings and preferences. + */ +export const configUpdate = (parameters?: { + directory?: string; + config?: Config; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }, { key: 'config', map: 'body' }] }]); + return (options?.client ?? client).patch({ + url: '/config', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); +}; + +/** + * List tool IDs + * + * Get a list of all available tool IDs, including both built-in tools and dynamically registered tools. + */ +export const toolIds = (parameters?: { + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/experimental/tool/ids', + ...options, + ...params + }); +}; + +/** + * List tools + * + * Get a list of available tools with their JSON schema parameters for a specific provider and model combination. */ -export const eventSubscribe = (options?: Options) => (options?.client ?? client).sse.get({ url: '/event', ...options }); +export const toolList = (parameters: { + directory?: string; + provider: string; + model: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [ + { in: 'query', key: 'directory' }, + { in: 'query', key: 'provider' }, + { in: 'query', key: 'model' } + ] }]); + return (options?.client ?? client).get({ + url: '/experimental/tool', + ...options, + ...params + }); +}; /** - * Get app info + * Dispose instance + * + * Clean up and dispose the current OpenCode instance, releasing all resources. */ -export const appGet = (options?: Options) => (options?.client ?? client).get({ url: '/app', ...options }); +export const instanceDispose = (parameters?: { + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).post({ + url: '/instance/dispose', + ...options, + ...params + }); +}; /** - * Initialize the app + * Get paths + * + * Retrieve the current working directory and related path information for the OpenCode instance. */ -export const appInit = (options?: Options) => (options?.client ?? client).post({ url: '/app/init', ...options }); +export const pathGet = (parameters?: { + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/path', + ...options, + ...params + }); +}; /** - * Get config info + * Get VCS info + * + * Retrieve version control system (VCS) information for the current project, such as git branch. */ -export const configGet = (options?: Options) => (options?.client ?? client).get({ url: '/config', ...options }); +export const vcsGet = (parameters?: { + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/vcs', + ...options, + ...params + }); +}; /** - * List all sessions + * List sessions + * + * Get a list of all OpenCode sessions, sorted by most recently updated. */ -export const sessionList = (options?: Options) => (options?.client ?? client).get({ url: '/session', ...options }); +export const sessionList = (parameters?: { + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/session', + ...options, + ...params + }); +}; /** - * Create a new session + * Create session + * + * Create a new OpenCode session for interacting with AI assistants and managing conversations. */ export const sessionCreate = (parameters?: { + directory?: string; parentID?: string; title?: string; + permission?: PermissionRuleset; }, options?: Options) => { - const params = buildClientParams([parameters], [{ args: [{ in: 'body', key: 'parentID' }, { in: 'body', key: 'title' }] }]); + const params = buildClientParams([parameters], [{ args: [ + { in: 'query', key: 'directory' }, + { in: 'body', key: 'parentID' }, + { in: 'body', key: 'title' }, + { in: 'body', key: 'permission' } + ] }]); return (options?.client ?? client).post({ url: '/session', ...options, @@ -64,43 +407,741 @@ export const sessionCreate = (parameters?: }; /** - * Delete a session and all its data + * Get session status + * + * Retrieve the current status of all sessions, including active, idle, and completed states. + */ +export const sessionStatus = (parameters?: { + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/session/status', + ...options, + ...params + }); +}; + +/** + * Delete session + * + * Delete a session and permanently remove all associated data, including messages and history. + */ +export const sessionDelete = (parameters: { + sessionID: string; + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'sessionID' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).delete({ + url: '/session/{sessionID}', + ...options, + ...params + }); +}; + +/** + * Get session + * + * Retrieve detailed information about a specific OpenCode session. + */ +export const sessionGet = (parameters: { + sessionID: string; + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'sessionID' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/session/{sessionID}', + ...options, + ...params + }); +}; + +/** + * Update session + * + * Update properties of an existing session, such as title or other metadata. + */ +export const sessionUpdate = (parameters: { + sessionID: string; + directory?: string; + title?: string; + time?: { + archived?: number; + }; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'sessionID' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'title' }, + { in: 'body', key: 'time' } + ] }]); + return (options?.client ?? client).patch({ + url: '/session/{sessionID}', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); +}; + +/** + * Get session children + * + * Retrieve all child sessions that were forked from the specified parent session. + */ +export const sessionChildren = (parameters: { + sessionID: string; + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'sessionID' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/session/{sessionID}/children', + ...options, + ...params + }); +}; + +/** + * Get session todos + * + * Retrieve the todo list associated with a specific session, showing tasks and action items. + */ +export const sessionTodo = (parameters: { + sessionID: string; + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'sessionID' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/session/{sessionID}/todo', + ...options, + ...params + }); +}; + +/** + * Initialize session + * + * Analyze the current application and create an AGENTS.md file with project-specific agent configurations. + */ +export const sessionInit = (parameters: { + sessionID: string; + directory?: string; + modelID?: string; + providerID?: string; + messageID?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'sessionID' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'modelID' }, + { in: 'body', key: 'providerID' }, + { in: 'body', key: 'messageID' } + ] }]); + return (options?.client ?? client).post({ + url: '/session/{sessionID}/init', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); +}; + +/** + * Fork session + * + * Create a new session by forking an existing session at a specific message point. + */ +export const sessionFork = (parameters: { + sessionID: string; + directory?: string; + messageID?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'sessionID' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'messageID' } + ] }]); + return (options?.client ?? client).post({ + url: '/session/{sessionID}/fork', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); +}; + +/** + * Abort session + * + * Abort an active session and stop any ongoing AI processing or command execution. + */ +export const sessionAbort = (parameters: { + sessionID: string; + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'sessionID' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).post({ + url: '/session/{sessionID}/abort', + ...options, + ...params + }); +}; + +/** + * Unshare session + * + * Remove the shareable link for a session, making it private again. + */ +export const sessionUnshare = (parameters: { + sessionID: string; + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'sessionID' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).delete({ + url: '/session/{sessionID}/share', + ...options, + ...params + }); +}; + +/** + * Share session + * + * Create a shareable link for a session, allowing others to view the conversation. + */ +export const sessionShare = (parameters: { + sessionID: string; + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'sessionID' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).post({ + url: '/session/{sessionID}/share', + ...options, + ...params + }); +}; + +/** + * Get session diff + * + * Get all file changes (diffs) made during this session. + */ +export const sessionDiff = (parameters: { + sessionID: string; + directory?: string; + messageID?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'sessionID' }, + { in: 'query', key: 'directory' }, + { in: 'query', key: 'messageID' } + ] }]); + return (options?.client ?? client).get({ + url: '/session/{sessionID}/diff', + ...options, + ...params + }); +}; + +/** + * Summarize session + * + * Generate a concise summary of the session using AI compaction to preserve key information. + */ +export const sessionSummarize = (parameters: { + sessionID: string; + directory?: string; + providerID?: string; + modelID?: string; + auto?: boolean; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'sessionID' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'providerID' }, + { in: 'body', key: 'modelID' }, + { in: 'body', key: 'auto' } + ] }]); + return (options?.client ?? client).post({ + url: '/session/{sessionID}/summarize', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); +}; + +/** + * Get session messages + * + * Retrieve all messages in a session, including user prompts and AI responses. + */ +export const sessionMessages = (parameters: { + sessionID: string; + directory?: string; + limit?: number; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'sessionID' }, + { in: 'query', key: 'directory' }, + { in: 'query', key: 'limit' } + ] }]); + return (options?.client ?? client).get({ + url: '/session/{sessionID}/message', + ...options, + ...params + }); +}; + +/** + * Send message + * + * Create and send a new message to a session, streaming the AI response. + */ +export const sessionPrompt = (parameters: { + sessionID: string; + directory?: string; + messageID?: string; + model?: { + providerID: string; + modelID: string; + }; + agent?: string; + noReply?: boolean; + tools?: { + [key: string]: boolean; + }; + system?: string; + variant?: string; + parts?: Array; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'sessionID' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'messageID' }, + { in: 'body', key: 'model' }, + { in: 'body', key: 'agent' }, + { in: 'body', key: 'noReply' }, + { in: 'body', key: 'tools' }, + { in: 'body', key: 'system' }, + { in: 'body', key: 'variant' }, + { in: 'body', key: 'parts' } + ] }]); + return (options?.client ?? client).post({ + url: '/session/{sessionID}/message', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); +}; + +/** + * Get message + * + * Retrieve a specific message from a session by its message ID. + */ +export const sessionMessage = (parameters: { + sessionID: string; + messageID: string; + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'sessionID' }, + { in: 'path', key: 'messageID' }, + { in: 'query', key: 'directory' } + ] }]); + return (options?.client ?? client).get({ + url: '/session/{sessionID}/message/{messageID}', + ...options, + ...params + }); +}; + +/** + * Delete a part from a message + */ +export const partDelete = (parameters: { + sessionID: string; + messageID: string; + partID: string; + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'sessionID' }, + { in: 'path', key: 'messageID' }, + { in: 'path', key: 'partID' }, + { in: 'query', key: 'directory' } + ] }]); + return (options?.client ?? client).delete({ + url: '/session/{sessionID}/message/{messageID}/part/{partID}', + ...options, + ...params + }); +}; + +/** + * Update a part in a message + */ +export const partUpdate = (parameters: { + sessionID: string; + messageID: string; + partID: string; + directory?: string; + part?: Part; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'sessionID' }, + { in: 'path', key: 'messageID' }, + { in: 'path', key: 'partID' }, + { in: 'query', key: 'directory' }, + { key: 'part', map: 'body' } + ] }]); + return (options?.client ?? client).patch({ + url: '/session/{sessionID}/message/{messageID}/part/{partID}', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); +}; + +/** + * Send async message + * + * Create and send a new message to a session asynchronously, starting the session if needed and returning immediately. + */ +export const sessionPromptAsync = (parameters: { + sessionID: string; + directory?: string; + messageID?: string; + model?: { + providerID: string; + modelID: string; + }; + agent?: string; + noReply?: boolean; + tools?: { + [key: string]: boolean; + }; + system?: string; + variant?: string; + parts?: Array; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'sessionID' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'messageID' }, + { in: 'body', key: 'model' }, + { in: 'body', key: 'agent' }, + { in: 'body', key: 'noReply' }, + { in: 'body', key: 'tools' }, + { in: 'body', key: 'system' }, + { in: 'body', key: 'variant' }, + { in: 'body', key: 'parts' } + ] }]); + return (options?.client ?? client).post({ + url: '/session/{sessionID}/prompt_async', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); +}; + +/** + * Send command + * + * Send a new command to a session for execution by the AI assistant. + */ +export const sessionCommand = (parameters: { + sessionID: string; + directory?: string; + messageID?: string; + agent?: string; + model?: string; + arguments?: string; + command?: string; + variant?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'sessionID' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'messageID' }, + { in: 'body', key: 'agent' }, + { in: 'body', key: 'model' }, + { in: 'body', key: 'arguments' }, + { in: 'body', key: 'command' }, + { in: 'body', key: 'variant' } + ] }]); + return (options?.client ?? client).post({ + url: '/session/{sessionID}/command', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); +}; + +/** + * Run shell command + * + * Execute a shell command within the session context and return the AI's response. + */ +export const sessionShell = (parameters: { + sessionID: string; + directory?: string; + agent?: string; + model?: { + providerID: string; + modelID: string; + }; + command?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'sessionID' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'agent' }, + { in: 'body', key: 'model' }, + { in: 'body', key: 'command' } + ] }]); + return (options?.client ?? client).post({ + url: '/session/{sessionID}/shell', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); +}; + +/** + * Revert message + * + * Revert a specific message in a session, undoing its effects and restoring the previous state. + */ +export const sessionRevert = (parameters: { + sessionID: string; + directory?: string; + messageID?: string; + partID?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'sessionID' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'messageID' }, + { in: 'body', key: 'partID' } + ] }]); + return (options?.client ?? client).post({ + url: '/session/{sessionID}/revert', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); +}; + +/** + * Restore reverted messages + * + * Restore all previously reverted messages in a session. + */ +export const sessionUnrevert = (parameters: { + sessionID: string; + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'sessionID' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).post({ + url: '/session/{sessionID}/unrevert', + ...options, + ...params + }); +}; + +/** + * Respond to permission + * + * Approve or deny a permission request from the AI assistant. + * + * @deprecated + */ +export const permissionRespond = (parameters: { + sessionID: string; + permissionID: string; + directory?: string; + response?: 'once' | 'always' | 'reject'; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'sessionID' }, + { in: 'path', key: 'permissionID' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'response' } + ] }]); + return (options?.client ?? client).post({ + url: '/session/{sessionID}/permissions/{permissionID}', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); +}; + +/** + * Respond to permission request + * + * Approve or deny a permission request from the AI assistant. + */ +export const permissionReply = (parameters: { + requestID: string; + directory?: string; + reply?: 'once' | 'always' | 'reject'; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'requestID' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'reply' } + ] }]); + return (options?.client ?? client).post({ + url: '/permission/{requestID}/reply', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); +}; + +/** + * List pending permissions + * + * Get all pending permission requests across all sessions. + */ +export const permissionList = (parameters?: { + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/permission', + ...options, + ...params + }); +}; + +/** + * List commands + * + * Get a list of all available commands in the OpenCode system. + */ +export const commandList = (parameters?: { + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/command', + ...options, + ...params + }); +}; + +/** + * List config providers + * + * Get a list of all configured AI providers and their default models. + */ +export const configProviders = (parameters?: { + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/config/providers', + ...options, + ...params + }); +}; + +/** + * List providers + * + * Get a list of all available AI providers, including both available and connected ones. */ -export const sessionDelete = (parameters: { - id: string; +export const providerList = (parameters?: { + directory?: string; }, options?: Options) => { - const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'id' }] }]); - return (options?.client ?? client).delete({ - url: '/session/{id}', + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/provider', ...options, ...params }); }; /** - * Get session + * Get provider auth methods + * + * Retrieve available authentication methods for all AI providers. */ -export const sessionGet = (parameters: { - id: string; +export const providerAuth = (parameters?: { + directory?: string; }, options?: Options) => { - const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'id' }] }]); - return (options?.client ?? client).get({ - url: '/session/{id}', + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/provider/auth', ...options, ...params }); }; /** - * Update session properties + * OAuth authorize + * + * Initiate OAuth authorization for a specific AI provider to get an authorization URL. */ -export const sessionUpdate = (parameters: { - id: string; - title?: string; +export const providerOauthAuthorize = (parameters: { + providerID: string; + directory?: string; + method?: number; }, options?: Options) => { - const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'id' }, { in: 'body', key: 'title' }] }]); - return (options?.client ?? client).patch({ - url: '/session/{id}', + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'providerID' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'method' } + ] }]); + return (options?.client ?? client).post({ + url: '/provider/{providerID}/oauth/authorize', ...options, ...params, headers: { @@ -112,36 +1153,24 @@ export const sessionUpdate = (parameters: }; /** - * Get a session's children - */ -export const sessionChildren = (parameters: { - id: string; -}, options?: Options) => { - const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'id' }] }]); - return (options?.client ?? client).get({ - url: '/session/{id}/children', - ...options, - ...params - }); -}; - -/** - * Analyze the app and create an AGENTS.md file + * OAuth callback + * + * Handle the OAuth callback from a provider after user authorization. */ -export const sessionInit = (parameters: { - id: string; - messageID?: string; - providerID?: string; - modelID?: string; +export const providerOauthCallback = (parameters: { + providerID: string; + directory?: string; + method?: number; + code?: string; }, options?: Options) => { const params = buildClientParams([parameters], [{ args: [ - { in: 'path', key: 'id' }, - { in: 'body', key: 'messageID' }, - { in: 'body', key: 'providerID' }, - { in: 'body', key: 'modelID' } + { in: 'path', key: 'providerID' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'method' }, + { in: 'body', key: 'code' } ] }]); - return (options?.client ?? client).post({ - url: '/session/{id}/init', + return (options?.client ?? client).post({ + url: '/provider/{providerID}/oauth/callback', ...options, ...params, headers: { @@ -153,119 +1182,138 @@ export const sessionInit = (parameters: { }; /** - * Abort a session + * Find text + * + * Search for text patterns across files in the project using ripgrep. */ -export const sessionAbort = (parameters: { - id: string; +export const findText = (parameters: { + directory?: string; + pattern: string; }, options?: Options) => { - const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'id' }] }]); - return (options?.client ?? client).post({ - url: '/session/{id}/abort', + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }, { in: 'query', key: 'pattern' }] }]); + return (options?.client ?? client).get({ + url: '/find', ...options, ...params }); }; /** - * Unshare the session + * Find files + * + * Search for files or directories by name or pattern in the project directory. */ -export const sessionUnshare = (parameters: { - id: string; +export const findFiles = (parameters: { + directory?: string; + query: string; + dirs?: 'true' | 'false'; + type?: 'file' | 'directory'; + limit?: number; }, options?: Options) => { - const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'id' }] }]); - return (options?.client ?? client).delete({ - url: '/session/{id}/share', + const params = buildClientParams([parameters], [{ args: [ + { in: 'query', key: 'directory' }, + { in: 'query', key: 'query' }, + { in: 'query', key: 'dirs' }, + { in: 'query', key: 'type' }, + { in: 'query', key: 'limit' } + ] }]); + return (options?.client ?? client).get({ + url: '/find/file', ...options, ...params }); }; /** - * Share a session + * Find symbols + * + * Search for workspace symbols like functions, classes, and variables using LSP. */ -export const sessionShare = (parameters: { - id: string; +export const findSymbols = (parameters: { + directory?: string; + query: string; }, options?: Options) => { - const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'id' }] }]); - return (options?.client ?? client).post({ - url: '/session/{id}/share', + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }, { in: 'query', key: 'query' }] }]); + return (options?.client ?? client).get({ + url: '/find/symbol', ...options, ...params }); }; /** - * Summarize the session + * List files + * + * List files and directories in a specified path. */ -export const sessionSummarize = (parameters: { - id: string; - providerID?: string; - modelID?: string; +export const fileList = (parameters: { + directory?: string; + path: string; }, options?: Options) => { - const params = buildClientParams([parameters], [{ args: [ - { in: 'path', key: 'id' }, - { in: 'body', key: 'providerID' }, - { in: 'body', key: 'modelID' } - ] }]); - return (options?.client ?? client).post({ - url: '/session/{id}/summarize', + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }, { in: 'query', key: 'path' }] }]); + return (options?.client ?? client).get({ + url: '/file', ...options, - ...params, - headers: { - 'Content-Type': 'application/json', - ...options?.headers, - ...params.headers - } + ...params }); }; /** - * List messages for a session + * Read file + * + * Read the content of a specified file. */ -export const sessionMessages = (parameters: { - id: string; +export const fileRead = (parameters: { + directory?: string; + path: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }, { in: 'query', key: 'path' }] }]); + return (options?.client ?? client).get({ + url: '/file/content', + ...options, + ...params + }); +}; + +/** + * Get file status + * + * Get the git status of all files in the project. + */ +export const fileStatus = (parameters?: { + directory?: string; }, options?: Options) => { - const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'id' }] }]); - return (options?.client ?? client).get({ - url: '/session/{id}/message', + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/file/status', ...options, ...params }); }; /** - * Create and send a new message to a session + * Write log + * + * Write a log entry to the server logs with specified level and metadata. */ -export const sessionChat = (parameters: { - id: string; - messageID?: string; - providerID?: string; - modelID?: string; - agent?: string; - system?: string; - tools?: { - [key: string]: boolean; +export const appLog = (parameters?: { + directory?: string; + service?: string; + level?: 'debug' | 'info' | 'error' | 'warn'; + message?: string; + extra?: { + [key: string]: unknown; }; - parts?: Array<({ - type: 'text'; - } & TextPartInput) | ({ - type: 'file'; - } & FilePartInput) | ({ - type: 'agent'; - } & AgentPartInput)>; }, options?: Options) => { const params = buildClientParams([parameters], [{ args: [ - { in: 'path', key: 'id' }, - { in: 'body', key: 'messageID' }, - { in: 'body', key: 'providerID' }, - { in: 'body', key: 'modelID' }, - { in: 'body', key: 'agent' }, - { in: 'body', key: 'system' }, - { in: 'body', key: 'tools' }, - { in: 'body', key: 'parts' } + { in: 'query', key: 'directory' }, + { in: 'body', key: 'service' }, + { in: 'body', key: 'level' }, + { in: 'body', key: 'message' }, + { in: 'body', key: 'extra' } ] }]); - return (options?.client ?? client).post({ - url: '/session/{id}/message', + return (options?.client ?? client).post({ + url: '/log', ...options, ...params, headers: { @@ -277,60 +1325,54 @@ export const sessionChat = (parameters: { }; /** - * Get a message from a session + * List agents + * + * Get a list of all available AI agents in the OpenCode system. */ -export const sessionMessage = (parameters: { - id: string; - messageID: string; +export const appAgents = (parameters?: { + directory?: string; }, options?: Options) => { - const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'id' }, { in: 'path', key: 'messageID' }] }]); - return (options?.client ?? client).get({ - url: '/session/{id}/message/{messageID}', + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/agent', ...options, ...params }); }; /** - * Run a shell command + * Get MCP status + * + * Get the status of all Model Context Protocol (MCP) servers. */ -export const sessionShell = (parameters: { - id: string; - agent?: string; - command?: string; +export const mcpStatus = (parameters?: { + directory?: string; }, options?: Options) => { - const params = buildClientParams([parameters], [{ args: [ - { in: 'path', key: 'id' }, - { in: 'body', key: 'agent' }, - { in: 'body', key: 'command' } - ] }]); - return (options?.client ?? client).post({ - url: '/session/{id}/shell', + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/mcp', ...options, - ...params, - headers: { - 'Content-Type': 'application/json', - ...options?.headers, - ...params.headers - } + ...params }); }; /** - * Revert a message + * Add MCP server + * + * Dynamically add a new Model Context Protocol (MCP) server to the system. */ -export const sessionRevert = (parameters: { - id: string; - messageID?: string; - partID?: string; +export const mcpAdd = (parameters?: { + directory?: string; + name?: string; + config?: McpLocalConfig | McpRemoteConfig; }, options?: Options) => { const params = buildClientParams([parameters], [{ args: [ - { in: 'path', key: 'id' }, - { in: 'body', key: 'messageID' }, - { in: 'body', key: 'partID' } + { in: 'query', key: 'directory' }, + { in: 'body', key: 'name' }, + { in: 'body', key: 'config' } ] }]); - return (options?.client ?? client).post({ - url: '/session/{id}/revert', + return (options?.client ?? client).post({ + url: '/mcp', ...options, ...params, headers: { @@ -342,34 +1384,56 @@ export const sessionRevert = (parameters: }; /** - * Restore all reverted messages + * Remove MCP OAuth + * + * Remove OAuth credentials for an MCP server */ -export const sessionUnrevert = (parameters: { - id: string; +export const mcpAuthRemove = (parameters: { + name: string; + directory?: string; }, options?: Options) => { - const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'id' }] }]); - return (options?.client ?? client).post({ - url: '/session/{id}/unrevert', + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'name' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).delete({ + url: '/mcp/{name}/auth', ...options, ...params }); }; /** - * Respond to a permission request + * Start MCP OAuth + * + * Start OAuth authentication flow for a Model Context Protocol (MCP) server. */ -export const postSessionByIdPermissionsByPermissionId = (parameters: { - id: string; - permissionID: string; - response?: 'once' | 'always' | 'reject'; +export const mcpAuthStart = (parameters: { + name: string; + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'name' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).post({ + url: '/mcp/{name}/auth', + ...options, + ...params + }); +}; + +/** + * Complete MCP OAuth + * + * Complete OAuth authentication for a Model Context Protocol (MCP) server using the authorization code. + */ +export const mcpAuthCallback = (parameters: { + name: string; + directory?: string; + code?: string; }, options?: Options) => { const params = buildClientParams([parameters], [{ args: [ - { in: 'path', key: 'id' }, - { in: 'path', key: 'permissionID' }, - { in: 'body', key: 'response' } + { in: 'path', key: 'name' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'code' } ] }]); - return (options?.client ?? client).post({ - url: '/session/{id}/permissions/{permissionID}', + return (options?.client ?? client).post({ + url: '/mcp/{name}/auth/callback', ...options, ...params, headers: { @@ -381,113 +1445,95 @@ export const postSessionByIdPermissionsByPermissionId = (options?: Options) => (options?.client ?? client).get({ url: '/config/providers', ...options }); - -/** - * Find text in files - */ -export const findText = (parameters: { - pattern: string; +export const mcpAuthAuthenticate = (parameters: { + name: string; + directory?: string; }, options?: Options) => { - const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'pattern' }] }]); - return (options?.client ?? client).get({ - url: '/find', + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'name' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).post({ + url: '/mcp/{name}/auth/authenticate', ...options, ...params }); }; /** - * Find files + * Connect an MCP server */ -export const findFiles = (parameters: { - query: string; +export const mcpConnect = (parameters: { + name: string; + directory?: string; }, options?: Options) => { - const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'query' }] }]); - return (options?.client ?? client).get({ - url: '/find/file', + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'name' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).post({ + url: '/mcp/{name}/connect', ...options, ...params }); }; /** - * Find workspace symbols + * Disconnect an MCP server */ -export const findSymbols = (parameters: { - query: string; +export const mcpDisconnect = (parameters: { + name: string; + directory?: string; }, options?: Options) => { - const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'query' }] }]); - return (options?.client ?? client).get({ - url: '/find/symbol', + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'name' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).post({ + url: '/mcp/{name}/disconnect', ...options, ...params }); }; /** - * Read a file + * Get LSP status + * + * Get LSP server status */ -export const fileRead = (parameters: { - path: string; +export const lspStatus = (parameters?: { + directory?: string; }, options?: Options) => { - const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'path' }] }]); - return (options?.client ?? client).get({ - url: '/file', + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/lsp', ...options, ...params }); }; /** - * Get file status - */ -export const fileStatus = (options?: Options) => (options?.client ?? client).get({ url: '/file/status', ...options }); - -/** - * Write a log entry to the server logs + * Get formatter status + * + * Get formatter status */ -export const appLog = (parameters?: { - service?: string; - level?: 'debug' | 'info' | 'error' | 'warn'; - message?: string; - extra?: { - [key: string]: unknown; - }; +export const formatterStatus = (parameters?: { + directory?: string; }, options?: Options) => { - const params = buildClientParams([parameters], [{ args: [ - { in: 'body', key: 'service' }, - { in: 'body', key: 'level' }, - { in: 'body', key: 'message' }, - { in: 'body', key: 'extra' } - ] }]); - return (options?.client ?? client).post({ - url: '/log', + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/formatter', ...options, - ...params, - headers: { - 'Content-Type': 'application/json', - ...options?.headers, - ...params.headers - } + ...params }); }; /** - * List all agents - */ -export const appAgents = (options?: Options) => (options?.client ?? client).get({ url: '/agent', ...options }); - -/** + * Append TUI prompt + * * Append prompt to the TUI */ export const tuiAppendPrompt = (parameters?: { + directory?: string; text?: string; }, options?: Options) => { - const params = buildClientParams([parameters], [{ args: [{ in: 'body', key: 'text' }] }]); - return (options?.client ?? client).post({ + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }, { in: 'body', key: 'text' }] }]); + return (options?.client ?? client).post({ url: '/tui/append-prompt', ...options, ...params, @@ -500,43 +1546,112 @@ export const tuiAppendPrompt = (parameters }; /** - * Open the help dialog + * Open help dialog + * + * Open the help dialog in the TUI to display user assistance information. */ -export const tuiOpenHelp = (options?: Options) => (options?.client ?? client).post({ url: '/tui/open-help', ...options }); +export const tuiOpenHelp = (parameters?: { + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).post({ + url: '/tui/open-help', + ...options, + ...params + }); +}; /** + * Open sessions dialog + * * Open the session dialog */ -export const tuiOpenSessions = (options?: Options) => (options?.client ?? client).post({ url: '/tui/open-sessions', ...options }); +export const tuiOpenSessions = (parameters?: { + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).post({ + url: '/tui/open-sessions', + ...options, + ...params + }); +}; /** + * Open themes dialog + * * Open the theme dialog */ -export const tuiOpenThemes = (options?: Options) => (options?.client ?? client).post({ url: '/tui/open-themes', ...options }); +export const tuiOpenThemes = (parameters?: { + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).post({ + url: '/tui/open-themes', + ...options, + ...params + }); +}; /** + * Open models dialog + * * Open the model dialog */ -export const tuiOpenModels = (options?: Options) => (options?.client ?? client).post({ url: '/tui/open-models', ...options }); +export const tuiOpenModels = (parameters?: { + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).post({ + url: '/tui/open-models', + ...options, + ...params + }); +}; /** + * Submit TUI prompt + * * Submit the prompt */ -export const tuiSubmitPrompt = (options?: Options) => (options?.client ?? client).post({ url: '/tui/submit-prompt', ...options }); +export const tuiSubmitPrompt = (parameters?: { + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).post({ + url: '/tui/submit-prompt', + ...options, + ...params + }); +}; /** + * Clear TUI prompt + * * Clear the prompt */ -export const tuiClearPrompt = (options?: Options) => (options?.client ?? client).post({ url: '/tui/clear-prompt', ...options }); +export const tuiClearPrompt = (parameters?: { + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).post({ + url: '/tui/clear-prompt', + ...options, + ...params + }); +}; /** + * Execute TUI command + * * Execute a TUI command (e.g. agent_cycle) */ export const tuiExecuteCommand = (parameters?: { + directory?: string; command?: string; }, options?: Options) => { - const params = buildClientParams([parameters], [{ args: [{ in: 'body', key: 'command' }] }]); - return (options?.client ?? client).post({ + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }, { in: 'body', key: 'command' }] }]); + return (options?.client ?? client).post({ url: '/tui/execute-command', ...options, ...params, @@ -549,17 +1664,23 @@ export const tuiExecuteCommand = (paramete }; /** + * Show TUI toast + * * Show a toast notification in the TUI */ export const tuiShowToast = (parameters?: { + directory?: string; title?: string; message?: string; variant?: 'info' | 'success' | 'warning' | 'error'; + duration?: number; }, options?: Options) => { const params = buildClientParams([parameters], [{ args: [ + { in: 'query', key: 'directory' }, { in: 'body', key: 'title' }, { in: 'body', key: 'message' }, - { in: 'body', key: 'variant' } + { in: 'body', key: 'variant' }, + { in: 'body', key: 'duration' } ] }]); return (options?.client ?? client).post({ url: '/tui/show-toast', @@ -574,15 +1695,82 @@ export const tuiShowToast = (parameters?: }; /** + * Publish TUI event + * + * Publish a TUI event + */ +export const tuiPublish = (parameters?: { + directory?: string; + body?: EventTuiPromptAppend | EventTuiCommandExecute | EventTuiToastShow; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }, { in: 'body' }] }]); + return (options?.client ?? client).post({ + url: '/tui/publish', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); +}; + +/** + * Get next TUI request + * + * Retrieve the next TUI (Terminal User Interface) request from the queue for processing. + */ +export const tuiControlNext = (parameters?: { + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/tui/control/next', + ...options, + ...params + }); +}; + +/** + * Submit TUI response + * + * Submit a response to the TUI request queue to complete a pending request. + */ +export const tuiControlResponse = (parameters?: { + directory?: string; + body?: unknown; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }, { in: 'body' }] }]); + return (options?.client ?? client).post({ + url: '/tui/control/response', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); +}; + +/** + * Set auth credentials + * * Set authentication credentials */ export const authSet = (parameters: { - id: string; + providerID: string; + directory?: string; auth?: Auth; }, options?: Options) => { - const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'id' }, { key: 'auth', map: 'body' }] }]); + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'providerID' }, + { in: 'query', key: 'directory' }, + { key: 'auth', map: 'body' } + ] }]); return (options?.client ?? client).put({ - url: '/auth/{id}', + url: '/auth/{providerID}', ...options, ...params, headers: { @@ -592,3 +1780,19 @@ export const authSet = (parameters: { } }); }; + +/** + * Subscribe to events + * + * Get events + */ +export const eventSubscribe = (parameters?: { + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).sse.get({ + url: '/event', + ...options, + ...params + }); +}; diff --git a/packages/openapi-ts-tests/sdks/__snapshots__/opencode/export-all/types.gen.ts b/packages/openapi-ts-tests/sdks/__snapshots__/opencode/export-all/types.gen.ts index ccd376c4b..e1be81f3e 100644 --- a/packages/openapi-ts-tests/sdks/__snapshots__/opencode/export-all/types.gen.ts +++ b/packages/openapi-ts-tests/sdks/__snapshots__/opencode/export-all/types.gen.ts @@ -4,42 +4,6 @@ export type ClientOptions = { baseUrl: `${string}://${string}` | (string & {}); }; -export type Event = ({ - type: 'installation.updated'; -} & EventInstallationUpdated) | ({ - type: 'lsp.client.diagnostics'; -} & EventLspClientDiagnostics) | ({ - type: 'message.updated'; -} & EventMessageUpdated) | ({ - type: 'message.removed'; -} & EventMessageRemoved) | ({ - type: 'message.part.updated'; -} & EventMessagePartUpdated) | ({ - type: 'message.part.removed'; -} & EventMessagePartRemoved) | ({ - type: 'storage.write'; -} & EventStorageWrite) | ({ - type: 'permission.updated'; -} & EventPermissionUpdated) | ({ - type: 'permission.replied'; -} & EventPermissionReplied) | ({ - type: 'file.edited'; -} & EventFileEdited) | ({ - type: 'session.updated'; -} & EventSessionUpdated) | ({ - type: 'session.deleted'; -} & EventSessionDeleted) | ({ - type: 'session.idle'; -} & EventSessionIdle) | ({ - type: 'session.error'; -} & EventSessionError) | ({ - type: 'server.connected'; -} & EventServerConnected) | ({ - type: 'file.watcher.updated'; -} & EventFileWatcherUpdated) | ({ - type: 'ide.installed'; -} & EventIdeInstalled); - export type EventInstallationUpdated = { type: 'installation.updated'; properties: { @@ -47,6 +11,41 @@ export type EventInstallationUpdated = { }; }; +export type EventInstallationUpdateAvailable = { + type: 'installation.update-available'; + properties: { + version: string; + }; +}; + +export type Project = { + id: string; + worktree: string; + vcs?: 'git'; + name?: string; + icon?: { + url?: string; + color?: string; + }; + time: { + created: number; + updated: number; + initialized?: number; + }; +}; + +export type EventProjectUpdated = { + type: 'project.updated'; + properties: Project; +}; + +export type EventServerInstanceDisposed = { + type: 'server.instance.disposed'; + properties: { + directory: string; + }; +}; + export type EventLspClientDiagnostics = { type: 'lsp.client.diagnostics'; properties: { @@ -55,18 +54,20 @@ export type EventLspClientDiagnostics = { }; }; -export type EventMessageUpdated = { - type: 'message.updated'; +export type EventLspUpdated = { + type: 'lsp.updated'; properties: { - info: Message; + [key: string]: unknown; }; }; -export type Message = ({ - role: 'user'; -} & UserMessage) | ({ - role: 'assistant'; -} & AssistantMessage); +export type FileDiff = { + file: string; + before: string; + after: string; + additions: number; + deletions: number; +}; export type UserMessage = { id: string; @@ -75,6 +76,66 @@ export type UserMessage = { time: { created: number; }; + summary?: { + title?: string; + body?: string; + diffs: Array; + }; + agent: string; + model: { + providerID: string; + modelID: string; + }; + system?: string; + tools?: { + [key: string]: boolean; + }; + variant?: string; +}; + +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 ApiError = { + name: 'APIError'; + data: { + message: string; + statusCode?: number; + isRetryable: boolean; + responseHeaders?: { + [key: string]: string; + }; + responseBody?: string; + metadata?: { + [key: string]: string; + }; + }; }; export type AssistantMessage = { @@ -85,19 +146,12 @@ export type AssistantMessage = { created: number; completed?: number; }; - error?: ({ - name: 'ProviderAuthError'; - } & ProviderAuthError) | ({ - name: 'UnknownError'; - } & UnknownError) | ({ - name: 'MessageOutputLengthError'; - } & MessageOutputLengthError) | ({ - name: 'MessageAbortedError'; - } & MessageAbortedError); - system: Array; + error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError | ApiError; + parentID: string; modelID: string; providerID: string; mode: string; + agent: string; path: { cwd: string; root: string; @@ -113,34 +167,15 @@ export type AssistantMessage = { write: number; }; }; + finish?: string; }; -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 Message = UserMessage | AssistantMessage; -export type MessageAbortedError = { - name: 'MessageAbortedError'; - data: { - [key: string]: unknown; +export type EventMessageUpdated = { + type: 'message.updated'; + properties: { + info: Message; }; }; @@ -152,33 +187,6 @@ export type EventMessageRemoved = { }; }; -export type EventMessagePartUpdated = { - type: 'message.part.updated'; - properties: { - part: Part; - }; -}; - -export type Part = ({ - type: 'text'; -} & TextPart) | ({ - type: 'reasoning'; -} & ReasoningPart) | ({ - type: 'file'; -} & FilePart) | ({ - type: 'tool'; -} & ToolPart) | ({ - type: 'step-start'; -} & StepStartPart) | ({ - type: 'step-finish'; -} & StepFinishPart) | ({ - type: 'snapshot'; -} & SnapshotPart) | ({ - type: 'patch'; -} & PatchPart) | ({ - type: 'agent'; -} & AgentPart); - export type TextPart = { id: string; sessionID: string; @@ -186,10 +194,14 @@ export type TextPart = { type: 'text'; text: string; synthetic?: boolean; + ignored?: boolean; time?: { start: number; end?: number; }; + metadata?: { + [key: string]: unknown; + }; }; export type ReasoningPart = { @@ -207,42 +219,16 @@ export type ReasoningPart = { }; }; -export type FilePart = { - id: string; - sessionID: string; - messageID: string; - type: 'file'; - mime: string; - filename?: string; - url: string; - source?: FilePartSource; -}; - -export type FilePartSource = ({ - type: 'file'; -} & FileSource) | ({ - type: 'symbol'; -} & SymbolSource); - -export type FileSource = { - text: FilePartSourceText; - type: 'file'; - path: string; -}; - export type FilePartSourceText = { value: string; start: number; end: number; }; -export type SymbolSource = { +export type FileSource = { text: FilePartSourceText; - type: 'symbol'; + type: 'file'; path: string; - range: Range; - name: string; - kind: number; }; export type Range = { @@ -256,33 +242,41 @@ export type Range = { }; }; -export type ToolPart = { +export type SymbolSource = { + text: FilePartSourceText; + type: 'symbol'; + path: string; + range: Range; + name: string; + kind: number; +}; + +export type FilePartSource = FileSource | SymbolSource; + +export type FilePart = { id: string; sessionID: string; messageID: string; - type: 'tool'; - callID: string; - tool: string; - state: ToolState; + type: 'file'; + mime: string; + filename?: string; + url: string; + source?: FilePartSource; }; -export type ToolState = ({ - status: 'pending'; -} & ToolStatePending) | ({ - status: 'running'; -} & ToolStateRunning) | ({ - status: 'completed'; -} & ToolStateCompleted) | ({ - status: 'error'; -} & ToolStateError); - export type ToolStatePending = { status: 'pending'; + input: { + [key: string]: unknown; + }; + raw: string; }; export type ToolStateRunning = { status: 'running'; - input?: unknown; + input: { + [key: string]: unknown; + }; title?: string; metadata?: { [key: string]: unknown; @@ -305,7 +299,9 @@ export type ToolStateCompleted = { time: { start: number; end: number; + compacted?: number; }; + attachments?: Array; }; export type ToolStateError = { @@ -323,11 +319,27 @@ export type ToolStateError = { }; }; +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 = { @@ -335,6 +347,8 @@ export type StepFinishPart = { sessionID: string; messageID: string; type: 'step-finish'; + reason: string; + snapshot?: string; cost: number; tokens: { input: number; @@ -377,70 +391,215 @@ export type AgentPart = { }; }; -export type EventMessagePartRemoved = { - type: 'message.part.removed'; - properties: { - sessionID: string; - messageID: string; - partID: string; +export type RetryPart = { + id: string; + sessionID: string; + messageID: string; + type: 'retry'; + attempt: number; + error: ApiError; + time: { + created: number; }; }; -export type EventStorageWrite = { - type: 'storage.write'; +export type CompactionPart = { + id: string; + sessionID: string; + messageID: string; + type: 'compaction'; + auto: boolean; +}; + +export type Part = TextPart | { + id: string; + sessionID: string; + messageID: string; + type: 'subtask'; + prompt: string; + description: string; + agent: string; + command?: string; +} | ReasoningPart | FilePart | ToolPart | StepStartPart | StepFinishPart | SnapshotPart | PatchPart | AgentPart | RetryPart | CompactionPart; + +export type EventMessagePartUpdated = { + type: 'message.part.updated'; properties: { - key: string; - content?: unknown; + part: Part; + delta?: string; }; }; -export type EventPermissionUpdated = { - type: 'permission.updated'; - properties: Permission; +export type EventMessagePartRemoved = { + type: 'message.part.removed'; + properties: { + sessionID: string; + messageID: string; + partID: string; + }; }; -export type Permission = { +export type PermissionRequest = { id: string; - type: string; - pattern?: string; sessionID: string; - messageID: string; - callID?: string; - title: string; + permission: string; + patterns: Array; metadata: { [key: string]: unknown; }; - time: { - created: number; + always: Array; + tool?: { + messageID: string; + callID: string; }; }; +export type EventPermissionAsked = { + type: 'permission.asked'; + properties: PermissionRequest; +}; + export type EventPermissionReplied = { type: 'permission.replied'; properties: { sessionID: string; - permissionID: string; - response: string; + requestID: string; + reply: 'once' | 'always' | 'reject'; }; }; -export type EventFileEdited = { - type: 'file.edited'; +export type SessionStatus = { + type: 'idle'; +} | { + type: 'retry'; + attempt: number; + message: string; + next: number; +} | { + type: 'busy'; +}; + +export type EventSessionStatus = { + type: 'session.status'; properties: { - file: string; + sessionID: string; + status: SessionStatus; }; }; -export type EventSessionUpdated = { - type: 'session.updated'; +export type EventSessionIdle = { + type: 'session.idle'; properties: { - info: Session; + sessionID: string; + }; +}; + +export type EventSessionCompacted = { + type: 'session.compacted'; + properties: { + sessionID: string; + }; +}; + +export type EventFileEdited = { + type: 'file.edited'; + properties: { + file: 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; + /** + * Unique identifier for the todo item + */ + id: string; +}; + +export type EventTodoUpdated = { + type: 'todo.updated'; + properties: { + sessionID: string; + todos: Array; }; }; +export type EventTuiPromptAppend = { + type: 'tui.prompt.append'; + properties: { + text: string; + }; +}; + +export type EventTuiCommandExecute = { + type: 'tui.command.execute'; + properties: { + command: 'session.list' | 'session.new' | 'session.share' | 'session.interrupt' | 'session.compact' | 'session.page.up' | 'session.page.down' | 'session.half.page.up' | 'session.half.page.down' | 'session.first' | 'session.last' | 'prompt.clear' | 'prompt.submit' | 'agent.cycle' | string; + }; +}; + +export type EventTuiToastShow = { + type: 'tui.toast.show'; + properties: { + title?: string; + message: string; + variant: 'info' | 'success' | 'warning' | 'error'; + /** + * Duration in milliseconds + */ + duration?: number; + }; +}; + +export type EventMcpToolsChanged = { + type: 'mcp.tools.changed'; + properties: { + server: string; + }; +}; + +export type EventCommandExecuted = { + type: 'command.executed'; + properties: { + name: string; + sessionID: string; + arguments: string; + messageID: string; + }; +}; + +export type PermissionAction = 'allow' | 'deny' | 'ask'; + +export type PermissionRule = { + permission: string; + pattern: string; + action: PermissionAction; +}; + +export type PermissionRuleset = Array; + export type Session = { id: string; + projectID: string; + directory: string; parentID?: string; + summary?: { + additions: number; + deletions: number; + files: number; + diffs?: Array; + }; share?: { url: string; }; @@ -449,7 +608,10 @@ export type Session = { time: { created: number; updated: number; + compacting?: number; + archived?: number; }; + permission?: PermissionRuleset; revert?: { messageID: string; partID?: string; @@ -458,6 +620,20 @@ export type Session = { }; }; +export type EventSessionCreated = { + type: 'session.created'; + properties: { + info: Session; + }; +}; + +export type EventSessionUpdated = { + type: 'session.updated'; + properties: { + info: Session; + }; +}; + export type EventSessionDeleted = { type: 'session.deleted'; properties: { @@ -465,10 +641,11 @@ export type EventSessionDeleted = { }; }; -export type EventSessionIdle = { - type: 'session.idle'; +export type EventSessionDiff = { + type: 'session.diff'; properties: { sessionID: string; + diff: Array; }; }; @@ -476,442 +653,516 @@ export type EventSessionError = { type: 'session.error'; properties: { sessionID?: string; - error?: ({ - name: 'ProviderAuthError'; - } & ProviderAuthError) | ({ - name: 'UnknownError'; - } & UnknownError) | ({ - name: 'MessageOutputLengthError'; - } & MessageOutputLengthError) | ({ - name: 'MessageAbortedError'; - } & MessageAbortedError); + error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError | ApiError; }; }; -export type EventServerConnected = { - type: 'server.connected'; +export type EventFileWatcherUpdated = { + type: 'file.watcher.updated'; properties: { - [key: string]: unknown; + file: string; + event: 'add' | 'change' | 'unlink'; }; }; -export type EventFileWatcherUpdated = { - type: 'file.watcher.updated'; +export type EventVcsBranchUpdated = { + type: 'vcs.branch.updated'; properties: { - file: string; - event: 'rename' | 'change'; + branch?: string; }; }; -export type EventIdeInstalled = { - type: 'ide.installed'; +export type Pty = { + id: string; + title: string; + command: string; + args: Array; + cwd: string; + status: 'running' | 'exited'; + pid: number; +}; + +export type EventPtyCreated = { + type: 'pty.created'; properties: { - ide: string; + info: Pty; }; }; -export type App = { - hostname: string; - git: boolean; - path: { - config: string; - data: string; - root: string; - cwd: string; - state: string; +export type EventPtyUpdated = { + type: 'pty.updated'; + properties: { + info: Pty; }; - time: { - initialized?: number; +}; + +export type EventPtyExited = { + type: 'pty.exited'; + properties: { + id: string; + exitCode: number; }; }; -export type Config = { +export type EventPtyDeleted = { + type: 'pty.deleted'; + properties: { + id: string; + }; +}; + +export type EventServerConnected = { + type: 'server.connected'; + properties: { + [key: string]: unknown; + }; +}; + +export type EventGlobalDisposed = { + type: 'global.disposed'; + properties: { + [key: string]: unknown; + }; +}; + +export type Event = EventInstallationUpdated | EventInstallationUpdateAvailable | EventProjectUpdated | EventServerInstanceDisposed | EventLspClientDiagnostics | EventLspUpdated | EventMessageUpdated | EventMessageRemoved | EventMessagePartUpdated | EventMessagePartRemoved | EventPermissionAsked | EventPermissionReplied | EventSessionStatus | EventSessionIdle | EventSessionCompacted | EventFileEdited | EventTodoUpdated | EventTuiPromptAppend | EventTuiCommandExecute | EventTuiToastShow | EventMcpToolsChanged | EventCommandExecuted | EventSessionCreated | EventSessionUpdated | EventSessionDeleted | EventSessionDiff | EventSessionError | EventFileWatcherUpdated | EventVcsBranchUpdated | EventPtyCreated | EventPtyUpdated | EventPtyExited | EventPtyDeleted | EventServerConnected | EventGlobalDisposed; + +export type GlobalEvent = { + directory: string; + payload: Event; +}; + +export type BadRequestError = { + data: unknown; + errors: Array<{ + [key: string]: unknown; + }>; + success: false; +}; + +export type NotFoundError = { + name: 'NotFoundError'; + data: { + message: string; + }; +}; + +/** + * Custom keybind configurations + */ +export type KeybindsConfig = { /** - * JSON schema reference for configuration validation + * Leader key for keybind combinations */ - $schema?: string; + leader?: string; /** - * Theme name to use for the interface + * Exit the application */ - theme?: string; + app_exit?: string; /** - * Custom keybind configurations + * Open external editor */ - keybinds?: KeybindsConfig; + editor_open?: string; /** - * TUI specific settings + * List available themes */ - tui?: { - /** - * TUI scroll speed - */ - scroll_speed: number; - }; - plugin?: Array; - snapshot?: boolean; + theme_list?: string; /** - * Control sharing behavior:'manual' allows manual sharing via commands, 'auto' enables automatic sharing, 'disabled' disables all sharing + * Toggle sidebar */ - share?: 'manual' | 'auto' | 'disabled'; + sidebar_toggle?: string; /** - * @deprecated Use 'share' field instead. Share newly created sessions automatically + * Toggle session scrollbar */ - autoshare?: boolean; + scrollbar_toggle?: string; /** - * Automatically update to the latest version + * Toggle username visibility */ - autoupdate?: boolean; + username_toggle?: string; /** - * Disable providers that are loaded automatically + * View status */ - disabled_providers?: Array; + status_view?: string; /** - * Model to use in the format of provider/model, eg anthropic/claude-2 + * Export session to editor */ - model?: string; + session_export?: string; /** - * Small model to use for tasks like title generation in the format of provider/model + * Create a new session */ - small_model?: string; + session_new?: string; /** - * Custom username to display in conversations instead of system username + * List all sessions */ - username?: string; + session_list?: string; /** - * @deprecated Use `agent` field instead. + * Show session timeline */ - mode?: { - build?: AgentConfig; - plan?: AgentConfig; - [key: string]: AgentConfig | undefined; - }; + session_timeline?: string; /** - * Agent configuration, see https://opencode.ai/docs/agent + * Fork session from message */ - agent?: { - plan?: AgentConfig; - build?: AgentConfig; - general?: AgentConfig; - [key: string]: AgentConfig | undefined; - }; + session_fork?: string; /** - * Custom provider configurations and model overrides + * Rename session */ - provider?: { - [key: string]: { - api?: string; - name?: string; - env?: Array; - id?: string; - npm?: string; - models?: { - [key: string]: { - id?: string; - name?: string; - release_date?: string; - attachment?: boolean; - reasoning?: boolean; - temperature?: boolean; - tool_call?: boolean; - cost?: { - input: number; - output: number; - cache_read?: number; - cache_write?: number; - }; - limit?: { - context: number; - output: number; - }; - options?: { - [key: string]: unknown; - }; - }; - }; - options?: { - apiKey?: string; - baseURL?: string; - [key: string]: unknown | string | undefined; - }; - }; - }; + session_rename?: string; /** - * MCP (Model Context Protocol) server configurations + * Share current session */ - mcp?: { - [key: string]: ({ - type: 'local'; - } & McpLocalConfig) | ({ - type: 'remote'; - } & McpRemoteConfig); - }; - formatter?: { - [key: string]: { - disabled?: boolean; - command?: Array; - environment?: { - [key: string]: string; - }; - extensions?: Array; - }; - }; - lsp?: { - [key: string]: { - disabled: true; - } | { - command: Array; - extensions?: Array; - disabled?: boolean; - env?: { - [key: string]: string; - }; - initialization?: { - [key: string]: unknown; - }; - }; - }; + session_share?: string; /** - * Additional instruction files or patterns to include + * Unshare current session */ - instructions?: Array; + session_unshare?: string; /** - * @deprecated Always uses stretch layout. + * Interrupt current session */ - layout?: LayoutConfig; - permission?: { - edit?: 'ask' | 'allow' | 'deny'; - bash?: 'ask' | 'allow' | 'deny' | { - [key: string]: 'ask' | 'allow' | 'deny'; - }; - webfetch?: 'ask' | 'allow' | 'deny'; - }; - tools?: { - [key: string]: boolean; - }; - experimental?: { - hook?: { - file_edited?: { - [key: string]: Array<{ - command: Array; - environment?: { - [key: string]: string; - }; - }>; - }; - session_completed?: Array<{ - command: Array; - environment?: { - [key: string]: string; - }; - }>; - }; - }; -}; - -export type KeybindsConfig = { + session_interrupt?: string; /** - * Leader key for keybind combinations + * Compact the session */ - leader: string; + session_compact?: string; /** - * Show help dialog + * Scroll messages up by one page */ - app_help: string; + messages_page_up?: string; /** - * Exit the application + * Scroll messages down by one page */ - app_exit: string; + messages_page_down?: string; /** - * Open external editor + * Scroll messages up by half page */ - editor_open: string; + messages_half_page_up?: string; /** - * List available themes + * Scroll messages down by half page */ - theme_list: string; + messages_half_page_down?: string; /** - * Create/update AGENTS.md + * Navigate to first message */ - project_init: string; + messages_first?: string; /** - * Toggle tool details + * Navigate to last message */ - tool_details: string; + messages_last?: string; /** - * Toggle thinking blocks + * Navigate to next message */ - thinking_blocks: string; + messages_next?: string; /** - * Export session to editor + * Navigate to previous message */ - session_export: string; + messages_previous?: string; /** - * Create a new session + * Navigate to last user message */ - session_new: string; + messages_last_user?: string; /** - * List all sessions + * Copy message */ - session_list: string; + messages_copy?: string; /** - * Show session timeline + * Undo message */ - session_timeline: string; + messages_undo?: string; /** - * Share current session + * Redo message */ - session_share: string; + messages_redo?: string; /** - * Unshare current session + * Toggle code block concealment in messages */ - session_unshare: string; + messages_toggle_conceal?: string; /** - * Interrupt current session + * Toggle tool details visibility */ - session_interrupt: string; + tool_details?: string; /** - * Compact the session + * List available models */ - session_compact: string; + model_list?: string; /** - * Cycle to next child session + * Next recently used model */ - session_child_cycle: string; + model_cycle_recent?: string; /** - * Cycle to previous child session + * Previous recently used model */ - session_child_cycle_reverse: string; + model_cycle_recent_reverse?: string; /** - * Scroll messages up by one page + * Next favorite model */ - messages_page_up: string; + model_cycle_favorite?: string; /** - * Scroll messages down by one page + * Previous favorite model */ - messages_page_down: string; + model_cycle_favorite_reverse?: string; /** - * Scroll messages up by half page + * List available commands */ - messages_half_page_up: string; + command_list?: string; /** - * Scroll messages down by half page + * List agents */ - messages_half_page_down: string; + agent_list?: string; /** - * Navigate to first message + * Next agent */ - messages_first: string; + agent_cycle?: string; /** - * Navigate to last message + * Previous agent */ - messages_last: string; + agent_cycle_reverse?: string; /** - * Copy message + * Cycle model variants */ - messages_copy: string; + variant_cycle?: string; /** - * Undo message + * Clear input field */ - messages_undo: string; + input_clear?: string; /** - * Redo message + * Paste from clipboard */ - messages_redo: string; + input_paste?: string; /** - * List available models + * Submit input */ - model_list: string; + input_submit?: string; /** - * Next recent model + * Insert newline in input */ - model_cycle_recent: string; + input_newline?: string; /** - * Previous recent model + * Move cursor left in input */ - model_cycle_recent_reverse: string; + input_move_left?: string; /** - * List agents + * Move cursor right in input */ - agent_list: string; + input_move_right?: string; /** - * Next agent + * Move cursor up in input */ - agent_cycle: string; + input_move_up?: string; /** - * Previous agent + * Move cursor down in input */ - agent_cycle_reverse: string; + input_move_down?: string; /** - * Clear input field + * Select left in input */ - input_clear: string; + input_select_left?: string; /** - * Paste from clipboard + * Select right in input */ - input_paste: string; + input_select_right?: string; /** - * Submit input + * Select up in input */ - input_submit: string; + input_select_up?: string; /** - * Insert newline in input + * Select down in input + */ + input_select_down?: string; + /** + * Move to start of line in input + */ + input_line_home?: string; + /** + * Move to end of line in input + */ + input_line_end?: string; + /** + * Select to start of line in input + */ + input_select_line_home?: string; + /** + * Select to end of line in input + */ + input_select_line_end?: string; + /** + * Move to start of visual line in input + */ + input_visual_line_home?: string; + /** + * Move to end of visual line in input + */ + input_visual_line_end?: string; + /** + * Select to start of visual line in input + */ + input_select_visual_line_home?: string; + /** + * Select to end of visual line in input + */ + input_select_visual_line_end?: string; + /** + * Move to start of buffer in input + */ + input_buffer_home?: string; + /** + * Move to end of buffer in input + */ + input_buffer_end?: string; + /** + * Select to start of buffer in input + */ + input_select_buffer_home?: string; + /** + * Select to end of buffer in input + */ + input_select_buffer_end?: string; + /** + * Delete line in input + */ + input_delete_line?: string; + /** + * Delete to end of line in input + */ + input_delete_to_line_end?: string; + /** + * Delete to start of line in input + */ + input_delete_to_line_start?: string; + /** + * Backspace in input + */ + input_backspace?: string; + /** + * Delete character in input + */ + input_delete?: string; + /** + * Undo in input + */ + input_undo?: string; + /** + * Redo in input + */ + input_redo?: string; + /** + * Move word forward in input + */ + input_word_forward?: string; + /** + * Move word backward in input + */ + input_word_backward?: string; + /** + * Select word forward in input + */ + input_select_word_forward?: string; + /** + * Select word backward in input + */ + input_select_word_backward?: string; + /** + * Delete word forward in input + */ + input_delete_word_forward?: string; + /** + * Delete word backward in input */ - input_newline: string; + input_delete_word_backward?: string; /** - * @deprecated use agent_cycle. Next mode + * Previous history item */ - switch_mode: string; + history_previous?: string; /** - * @deprecated use agent_cycle_reverse. Previous mode + * Next history item */ - switch_mode_reverse: string; + history_next?: string; /** - * @deprecated use agent_cycle. Next agent + * Next child session */ - switch_agent: string; + session_child_cycle?: string; /** - * @deprecated use agent_cycle_reverse. Previous agent + * Previous child session */ - switch_agent_reverse: string; + session_child_cycle_reverse?: string; /** - * @deprecated Currently not available. List files + * Go to parent session */ - file_list: string; + session_parent?: string; /** - * @deprecated Close file + * Suspend terminal */ - file_close: string; + terminal_suspend?: string; /** - * @deprecated Search file + * Toggle terminal title */ - file_search: string; + terminal_title_toggle?: string; /** - * @deprecated Split/unified diff + * Toggle tips on home screen */ - file_diff_toggle: string; + tips_toggle?: string; +}; + +/** + * Log level + */ +export type LogLevel = 'DEBUG' | 'INFO' | 'WARN' | 'ERROR'; + +/** + * Server configuration for opencode serve and web commands + */ +export type ServerConfig = { /** - * @deprecated Navigate to previous message + * Port to listen on */ - messages_previous: string; + port?: number; /** - * @deprecated Navigate to next message + * Hostname to listen on */ - messages_next: string; + hostname?: string; /** - * @deprecated Toggle layout + * Enable mDNS service discovery */ - messages_layout_toggle: string; + mdns?: boolean; /** - * @deprecated use messages_undo. Revert message + * Additional domains to allow for CORS */ - messages_revert: string; + cors?: Array; +}; + +export type PermissionActionConfig = 'ask' | 'allow' | 'deny'; + +export type PermissionObjectConfig = { + [key: string]: PermissionActionConfig; }; +export type PermissionRuleConfig = PermissionActionConfig | PermissionObjectConfig; + +export type PermissionConfig = { + read?: PermissionRuleConfig; + edit?: PermissionRuleConfig; + glob?: PermissionRuleConfig; + grep?: PermissionRuleConfig; + list?: PermissionRuleConfig; + bash?: PermissionRuleConfig; + task?: PermissionRuleConfig; + external_directory?: PermissionRuleConfig; + todowrite?: PermissionActionConfig; + todoread?: PermissionActionConfig; + webfetch?: PermissionActionConfig; + websearch?: PermissionActionConfig; + codesearch?: PermissionActionConfig; + lsp?: PermissionRuleConfig; + doom_loop?: PermissionActionConfig; + [key: string]: PermissionRuleConfig | PermissionActionConfig | undefined; +} | PermissionActionConfig; + export type AgentConfig = { model?: string; temperature?: number; top_p?: number; prompt?: string; + /** + * @deprecated Use 'permission' field instead + */ tools?: { [key: string]: boolean; }; @@ -921,55 +1172,111 @@ export type AgentConfig = { */ description?: string; mode?: 'subagent' | 'primary' | 'all'; - permission?: { - edit?: 'ask' | 'allow' | 'deny'; - bash?: 'ask' | 'allow' | 'deny' | { - [key: string]: 'ask' | 'allow' | 'deny'; - }; - webfetch?: 'ask' | 'allow' | 'deny'; + options?: { + [key: string]: unknown; }; + /** + * Hex color code for the agent (e.g., #FF5733) + */ + color?: string; + /** + * Maximum number of agentic iterations before forcing text-only response + */ + steps?: number; + /** + * @deprecated Use 'steps' field instead. + */ + maxSteps?: number; + permission?: PermissionConfig; [key: string]: unknown | string | number | { [key: string]: boolean; } | boolean | 'subagent' | 'primary' | 'all' | { - edit?: 'ask' | 'allow' | 'deny'; - bash?: 'ask' | 'allow' | 'deny' | { - [key: string]: 'ask' | 'allow' | 'deny'; - }; - webfetch?: 'ask' | 'allow' | 'deny'; - } | undefined; + [key: string]: unknown; + } | string | number | PermissionConfig | undefined; }; -export type Provider = { +export type ProviderConfig = { api?: string; - name: string; - env: Array; - id: string; + name?: string; + env?: Array; + id?: string; npm?: string; - models: { - [key: string]: Model; - }; -}; - -export type Model = { - id: string; - name: string; - release_date: string; - attachment: boolean; - reasoning: boolean; - temperature: boolean; - tool_call: boolean; - cost: { - input: number; - output: number; - cache_read?: number; - cache_write?: number; - }; - limit: { - context: number; - output: number; + 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; + output: number; + }; + modalities?: { + input: Array<'text' | 'audio' | 'image' | 'video' | 'pdf'>; + output: Array<'text' | 'audio' | 'image' | 'video' | 'pdf'>; + }; + experimental?: boolean; + status?: 'alpha' | 'beta' | 'deprecated'; + options?: { + [key: string]: unknown; + }; + headers?: { + [key: string]: string; + }; + provider?: { + npm: string; + }; + /** + * Variant-specific configuration + */ + variants?: { + [key: string]: { + /** + * Disable this variant for the model + */ + disabled?: boolean; + [key: string]: unknown | boolean | undefined; + }; + }; + }; }; - options: { - [key: string]: unknown; + whitelist?: Array; + blacklist?: Array; + options?: { + apiKey?: string; + baseURL?: string; + /** + * GitHub Enterprise URL for copilot authentication + */ + enterpriseUrl?: string; + /** + * Enable promptCacheKey for this provider (default false) + */ + setCacheKey?: boolean; + /** + * Timeout in milliseconds for requests to this provider. Default is 300000 (5 minutes). Set to false to disable timeout. + */ + timeout?: number | false; + [key: string]: unknown | string | boolean | number | false | undefined; }; }; @@ -992,786 +1299,2747 @@ export type McpLocalConfig = { * Enable or disable the MCP server on startup */ enabled?: boolean; + /** + * Timeout in ms for fetching tools from the MCP server. Defaults to 5000 (5 seconds) if not specified. + */ + timeout?: number; +}; + +export type McpOAuthConfig = { + /** + * OAuth client ID. If not provided, dynamic client registration (RFC 7591) will be attempted. + */ + clientId?: string; + /** + * OAuth client secret (if required by the authorization server) + */ + clientSecret?: string; + /** + * OAuth scopes to request during authorization + */ + scope?: string; +}; + +export type McpRemoteConfig = { + /** + * Type of MCP server connection + */ + type: 'remote'; + /** + * URL of the remote MCP server + */ + url: string; + /** + * Enable or disable the MCP server on startup + */ + enabled?: boolean; + /** + * Headers to send with the request + */ + headers?: { + [key: string]: string; + }; + /** + * OAuth authentication configuration for the MCP server. Set to false to disable OAuth auto-detection. + */ + oauth?: McpOAuthConfig | false; + /** + * Timeout in ms for fetching tools from the MCP server. Defaults to 5000 (5 seconds) if not specified. + */ + timeout?: number; +}; + +/** + * @deprecated Always uses stretch layout. + */ +export type LayoutConfig = 'auto' | 'stretch'; + +export type Config = { + /** + * JSON schema reference for configuration validation + */ + $schema?: string; + /** + * Theme name to use for the interface + */ + theme?: string; + keybinds?: KeybindsConfig; + logLevel?: LogLevel; + /** + * TUI specific settings + */ + tui?: { + /** + * TUI scroll speed + */ + scroll_speed?: number; + /** + * Scroll acceleration settings + */ + scroll_acceleration?: { + /** + * Enable scroll acceleration + */ + enabled: boolean; + }; + /** + * Control diff rendering style: 'auto' adapts to terminal width, 'stacked' always shows single column + */ + diff_style?: 'auto' | 'stacked'; + }; + server?: ServerConfig; + /** + * Command configuration, see https://opencode.ai/docs/commands + */ + command?: { + [key: string]: { + template: string; + description?: string; + agent?: string; + model?: string; + subtask?: boolean; + }; + }; + watcher?: { + ignore?: Array; + }; + plugin?: Array; + snapshot?: boolean; + /** + * Control sharing behavior:'manual' allows manual sharing via commands, 'auto' enables automatic sharing, 'disabled' disables all sharing + */ + share?: 'manual' | 'auto' | 'disabled'; + /** + * @deprecated Use 'share' field instead. Share newly created sessions automatically + */ + 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'; + /** + * Disable providers that are loaded automatically + */ + disabled_providers?: Array; + /** + * When set, ONLY these providers will be enabled. All other providers will be ignored + */ + enabled_providers?: Array; + /** + * Model to use in the format of provider/model, eg anthropic/claude-2 + */ + model?: string; + /** + * Small model to use for tasks like title generation in the format of provider/model + */ + small_model?: string; + /** + * Default agent to use when none is specified. Must be a primary agent. Falls back to 'build' if not set or if the specified agent is invalid. + */ + default_agent?: string; + /** + * Custom username to display in conversations instead of system username + */ + username?: string; + /** + * @deprecated Use `agent` field instead. + */ + mode?: { + build?: AgentConfig; + plan?: AgentConfig; + [key: string]: AgentConfig | undefined; + }; + /** + * Agent configuration, see https://opencode.ai/docs/agent + */ + agent?: { + plan?: AgentConfig; + build?: AgentConfig; + general?: AgentConfig; + explore?: AgentConfig; + title?: AgentConfig; + summary?: AgentConfig; + compaction?: AgentConfig; + [key: string]: AgentConfig | undefined; + }; + /** + * Custom provider configurations and model overrides + */ + provider?: { + [key: string]: ProviderConfig; + }; + /** + * MCP (Model Context Protocol) server configurations + */ + mcp?: { + [key: string]: McpLocalConfig | McpRemoteConfig; + }; + formatter?: false | { + [key: string]: { + disabled?: boolean; + command?: Array; + environment?: { + [key: string]: string; + }; + extensions?: Array; + }; + }; + lsp?: false | { + [key: string]: { + disabled: true; + } | { + command: Array; + extensions?: Array; + disabled?: boolean; + env?: { + [key: string]: string; + }; + initialization?: { + [key: string]: unknown; + }; + }; + }; + /** + * Additional instruction files or patterns to include + */ + instructions?: Array; + layout?: LayoutConfig; + permission?: PermissionConfig; + tools?: { + [key: string]: boolean; + }; + enterprise?: { + /** + * Enterprise URL + */ + url?: string; + }; + compaction?: { + /** + * Enable automatic compaction when context is full (default: true) + */ + auto?: boolean; + /** + * Enable pruning of old tool outputs (default: true) + */ + prune?: boolean; + }; + experimental?: { + hook?: { + file_edited?: { + [key: string]: Array<{ + command: Array; + environment?: { + [key: string]: string; + }; + }>; + }; + session_completed?: Array<{ + command: Array; + environment?: { + [key: string]: string; + }; + }>; + }; + /** + * Number of retries for chat completions on failure + */ + chatMaxRetries?: number; + disable_paste_summary?: boolean; + /** + * Enable the batch tool + */ + batch_tool?: boolean; + /** + * Enable OpenTelemetry spans for AI SDK calls (using the 'experimental_telemetry' flag) + */ + openTelemetry?: boolean; + /** + * Tools that should only be available to primary agents. + */ + primary_tools?: Array; + /** + * Continue the agent loop when a tool call is denied + */ + continue_loop_on_deny?: boolean; + /** + * Timeout in milliseconds for model context protocol (MCP) requests + */ + mcp_timeout?: number; + }; +}; + +export type ToolIds = Array; + +export type ToolListItem = { + id: string; + description: string; + parameters: unknown; +}; + +export type ToolList = Array; + +export type Path = { + home: string; + state: string; + config: string; + worktree: string; + directory: string; +}; + +export type VcsInfo = { + branch: 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; + command?: string; +}; + +export type Command = { + name: string; + description?: string; + agent?: string; + model?: string; + mcp?: boolean; + template: string; + subtask?: boolean; + hints: Array; +}; + +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; + 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; + key?: string; + options: { + [key: string]: unknown; + }; + models: { + [key: string]: Model; + }; +}; + +export type ProviderAuthMethod = { + type: 'oauth' | 'api'; + label: string; +}; + +export type ProviderAuthAuthorization = { + url: string; + method: 'auto' | 'code'; + instructions: 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'; + 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; + }>; + index?: string; + }; + encoding?: 'base64'; + mimeType?: string; +}; + +export type File = { + path: string; + added: number; + removed: number; + status: 'added' | 'deleted' | 'modified'; +}; + +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; + }; + prompt?: string; + options: { + [key: string]: unknown; + }; + steps?: number; +}; + +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 LspStatus = { + id: string; + name: string; + root: string; + status: 'connected' | 'error'; +}; + +export type FormatterStatus = { + name: string; + extensions: Array; + enabled: boolean; +}; + +export type OAuth = { + type: 'oauth'; + refresh: string; + access: string; + expires: number; + enterpriseUrl?: string; +}; + +export type ApiAuth = { + type: 'api'; + key: string; +}; + +export type WellKnownAuth = { + type: 'wellknown'; + key: string; + token: string; +}; + +export type Auth = OAuth | ApiAuth | WellKnownAuth; + +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 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 ProjectListData = { + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/project'; +}; + +export type ProjectListResponses = { + /** + * List of projects + */ + 200: Array; +}; + +export type ProjectListResponse = ProjectListResponses[keyof ProjectListResponses]; + +export type ProjectCurrentData = { + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/project/current'; +}; + +export type ProjectCurrentResponses = { + /** + * Current project information + */ + 200: Project; +}; + +export type ProjectCurrentResponse = ProjectCurrentResponses[keyof ProjectCurrentResponses]; + +export type ProjectUpdateData = { + body?: { + name?: string; + icon?: { + url?: string; + color?: string; + }; + }; + path: { + projectID: string; + }; + query?: { + directory?: 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 PtyListData = { + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/pty'; +}; + +export type PtyListResponses = { + /** + * List of sessions + */ + 200: Array; +}; + +export type PtyListResponse = PtyListResponses[keyof PtyListResponses]; + +export type PtyCreateData = { + body?: { + command?: string; + args?: Array; + cwd?: string; + title?: string; + env?: { + [key: string]: string; + }; + }; + path?: never; + query?: { + directory?: 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; + }; + url: '/pty/{ptyID}'; +}; + +export type PtyRemoveErrors = { + /** + * Not found + */ + 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; + }; + url: '/pty/{ptyID}'; +}; + +export type PtyGetErrors = { + /** + * Not found + */ + 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; + }; + 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 PtyConnectData = { + body?: never; + path: { + ptyID: string; + }; + query?: { + directory?: string; + }; + url: '/pty/{ptyID}/connect'; +}; + +export type PtyConnectErrors = { + /** + * Not found + */ + 404: NotFoundError; +}; + +export type PtyConnectError = PtyConnectErrors[keyof PtyConnectErrors]; + +export type PtyConnectResponses = { + /** + * Connected session + */ + 200: boolean; +}; + +export type PtyConnectResponse = PtyConnectResponses[keyof PtyConnectResponses]; + +export type ConfigGetData = { + body?: never; + path?: never; + query?: { + directory?: 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; + }; + 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 ToolIdsData = { + body?: never; + path?: never; + query?: { + directory?: 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 ToolListData = { + body?: never; + path?: never; + query: { + directory?: 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 InstanceDisposeData = { + body?: never; + path?: never; + query?: { + directory?: 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; + }; + url: '/path'; +}; + +export type PathGetResponses = { + /** + * Path + */ + 200: Path; +}; + +export type PathGetResponse = PathGetResponses[keyof PathGetResponses]; + +export type VcsGetData = { + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/vcs'; +}; + +export type VcsGetResponses = { + /** + * VCS info + */ + 200: VcsInfo; +}; + +export type VcsGetResponse = VcsGetResponses[keyof VcsGetResponses]; + +export type SessionListData = { + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/session'; +}; + +export type SessionListResponses = { + /** + * List of sessions + */ + 200: Array; +}; + +export type SessionListResponse = SessionListResponses[keyof SessionListResponses]; + +export type SessionCreateData = { + body?: { + parentID?: string; + title?: string; + permission?: PermissionRuleset; + }; + path?: never; + query?: { + directory?: 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; + }; + 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; + }; + url: '/session/{sessionID}'; +}; + +export type SessionDeleteErrors = { + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 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; + }; + url: '/session/{sessionID}'; +}; + +export type SessionGetErrors = { + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 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; + time?: { + archived?: number; + }; + }; + path: { + sessionID: string; + }; + query?: { + directory?: string; + }; + url: '/session/{sessionID}'; +}; + +export type SessionUpdateErrors = { + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 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; + }; + 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; +}; + +export type SessionChildrenResponse = SessionChildrenResponses[keyof SessionChildrenResponses]; + +export type SessionTodoData = { + body?: never; + path: { + /** + * Session ID + */ + sessionID: string; + }; + query?: { + directory?: 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; +}; + +export type SessionTodoResponse = SessionTodoResponses[keyof SessionTodoResponses]; + +export type SessionInitData = { + body?: { + modelID: string; + providerID: string; + messageID: string; + }; + path: { + /** + * Session ID + */ + sessionID: string; + }; + query?: { + directory?: 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 SessionForkData = { + body?: { + messageID?: string; + }; + path: { + sessionID: string; + }; + query?: { + directory?: string; + }; + url: '/session/{sessionID}/fork'; +}; + +export type SessionForkResponses = { + /** + * 200 + */ + 200: Session; +}; + +export type SessionForkResponse = SessionForkResponses[keyof SessionForkResponses]; + +export type SessionAbortData = { + body?: never; + path: { + sessionID: string; + }; + query?: { + directory?: 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 SessionUnshareData = { + body?: never; + path: { + sessionID: string; + }; + query?: { + directory?: string; + }; + url: '/session/{sessionID}/share'; +}; + +export type SessionUnshareErrors = { + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; + +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; + }; + url: '/session/{sessionID}/share'; +}; + +export type SessionShareErrors = { + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; + +export type SessionShareError = SessionShareErrors[keyof SessionShareErrors]; + +export type SessionShareResponses = { + /** + * Successfully shared session + */ + 200: Session; +}; + +export type SessionShareResponse = SessionShareResponses[keyof SessionShareResponses]; + +export type SessionDiffData = { + body?: never; + path: { + /** + * Session ID + */ + sessionID: string; + }; + query?: { + directory?: string; + messageID?: string; + }; + url: '/session/{sessionID}/diff'; +}; + +export type SessionDiffErrors = { + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; + +export type SessionDiffError = SessionDiffErrors[keyof SessionDiffErrors]; + +export type SessionDiffResponses = { + /** + * List of diffs + */ + 200: Array; +}; + +export type SessionDiffResponse = SessionDiffResponses[keyof SessionDiffResponses]; + +export type SessionSummarizeData = { + body?: { + providerID: string; + modelID: string; + auto?: boolean; + }; + path: { + /** + * Session ID + */ + sessionID: string; + }; + query?: { + directory?: string; + }; + url: '/session/{sessionID}/summarize'; +}; + +export type SessionSummarizeErrors = { + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; + +export type SessionSummarizeError = SessionSummarizeErrors[keyof SessionSummarizeErrors]; + +export type SessionSummarizeResponses = { + /** + * Summarized session + */ + 200: boolean; +}; + +export type SessionSummarizeResponse = SessionSummarizeResponses[keyof SessionSummarizeResponses]; + +export type SessionMessagesData = { + body?: never; + path: { + /** + * Session ID + */ + sessionID: string; + }; + query?: { + directory?: string; + limit?: number; + }; + url: '/session/{sessionID}/message'; +}; + +export type SessionMessagesErrors = { + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; + +export type SessionMessagesError = SessionMessagesErrors[keyof SessionMessagesErrors]; + +export type SessionMessagesResponses = { + /** + * List of messages + */ + 200: Array<{ + info: Message; + parts: Array; + }>; +}; + +export type SessionMessagesResponse = SessionMessagesResponses[keyof SessionMessagesResponses]; + +export type SessionPromptData = { + body?: { + messageID?: string; + model?: { + providerID: string; + modelID: string; + }; + agent?: string; + noReply?: boolean; + /** + * @deprecated tools and permissions have been merged, you can set permissions on the session itself now + */ + tools?: { + [key: string]: boolean; + }; + system?: string; + variant?: string; + parts: Array; + }; + path: { + /** + * Session ID + */ + sessionID: string; + }; + query?: { + directory?: 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; + }; +}; + +export type SessionPromptResponse = SessionPromptResponses[keyof SessionPromptResponses]; + +export type SessionMessageData = { + body?: never; + path: { + /** + * Session ID + */ + sessionID: string; + /** + * Message ID + */ + messageID: string; + }; + query?: { + directory?: string; + }; + url: '/session/{sessionID}/message/{messageID}'; +}; + +export type SessionMessageErrors = { + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; + +export type SessionMessageError = SessionMessageErrors[keyof SessionMessageErrors]; + +export type SessionMessageResponses = { + /** + * Message + */ + 200: { + info: Message; + parts: Array; + }; +}; + +export type SessionMessageResponse = SessionMessageResponses[keyof SessionMessageResponses]; + +export type PartDeleteData = { + body?: never; + path: { + /** + * Session ID + */ + sessionID: string; + /** + * Message ID + */ + messageID: string; + /** + * Part ID + */ + partID: string; + }; + query?: { + directory?: 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: { + /** + * Session ID + */ + sessionID: string; + /** + * Message ID + */ + messageID: string; + /** + * Part ID + */ + partID: string; + }; + query?: { + directory?: 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 SessionPromptAsyncData = { + body?: { + messageID?: string; + model?: { + providerID: string; + modelID: string; + }; + agent?: string; + noReply?: boolean; + /** + * @deprecated tools and permissions have been merged, you can set permissions on the session itself now + */ + tools?: { + [key: string]: boolean; + }; + system?: string; + variant?: string; + parts: Array; + }; + path: { + /** + * Session ID + */ + sessionID: string; + }; + query?: { + directory?: 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; + }; + path: { + /** + * Session ID + */ + sessionID: string; + }; + query?: { + directory?: 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; + }; +}; + +export type SessionCommandResponse = SessionCommandResponses[keyof SessionCommandResponses]; + +export type SessionShellData = { + body?: { + agent: string; + model?: { + providerID: string; + modelID: string; + }; + command: string; + }; + path: { + /** + * Session ID + */ + sessionID: string; + }; + query?: { + directory?: 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: AssistantMessage; +}; + +export type SessionShellResponse = SessionShellResponses[keyof SessionShellResponses]; + +export type SessionRevertData = { + body?: { + messageID: string; + partID?: string; + }; + path: { + sessionID: string; + }; + query?: { + directory?: 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; + }; + url: '/session/{sessionID}/unrevert'; }; -export type McpRemoteConfig = { - /** - * Type of MCP server connection - */ - type: 'remote'; +export type SessionUnrevertErrors = { /** - * URL of the remote MCP server + * Bad request */ - url: string; + 400: BadRequestError; /** - * Enable or disable the MCP server on startup + * Not found */ - enabled?: boolean; + 404: NotFoundError; +}; + +export type SessionUnrevertError = SessionUnrevertErrors[keyof SessionUnrevertErrors]; + +export type SessionUnrevertResponses = { /** - * Headers to send with the request + * Updated session */ - headers?: { - [key: string]: string; - }; + 200: Session; }; -export type LayoutConfig = 'auto' | 'stretch'; +export type SessionUnrevertResponse = SessionUnrevertResponses[keyof SessionUnrevertResponses]; -export type Error = { - data: { - [key: string]: unknown; +export type PermissionRespondData = { + body?: { + response: 'once' | 'always' | 'reject'; }; -}; - -export type TextPartInput = { - id?: string; - type: 'text'; - text: string; - synthetic?: boolean; - time?: { - start: number; - end?: number; + path: { + sessionID: string; + permissionID: string; + }; + query?: { + directory?: string; }; + url: '/session/{sessionID}/permissions/{permissionID}'; }; -export type FilePartInput = { - id?: string; - type: 'file'; - mime: string; - filename?: string; - url: string; - source?: FilePartSource; +export type PermissionRespondErrors = { + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; }; -export type AgentPartInput = { - id?: string; - type: 'agent'; - name: string; - source?: { - value: string; - start: number; - end: number; - }; -}; +export type PermissionRespondError = PermissionRespondErrors[keyof PermissionRespondErrors]; -export type Symbol = { - name: string; - kind: number; - location: { - uri: string; - range: Range; - }; +export type PermissionRespondResponses = { + /** + * Permission processed successfully + */ + 200: boolean; }; -export type File = { - path: string; - added: number; - removed: number; - status: 'added' | 'deleted' | 'modified'; -}; +export type PermissionRespondResponse = PermissionRespondResponses[keyof PermissionRespondResponses]; -export type Agent = { - name: string; - description?: string; - mode: 'subagent' | 'primary' | 'all'; - builtIn: boolean; - topP?: number; - temperature?: number; - permission: { - edit: 'ask' | 'allow' | 'deny'; - bash: { - [key: string]: 'ask' | 'allow' | 'deny'; - }; - webfetch?: 'ask' | 'allow' | 'deny'; - }; - model?: { - modelID: string; - providerID: string; +export type PermissionReplyData = { + body?: { + reply: 'once' | 'always' | 'reject'; }; - prompt?: string; - tools: { - [key: string]: boolean; + path: { + requestID: string; }; - options: { - [key: string]: unknown; + query?: { + directory?: string; }; + url: '/permission/{requestID}/reply'; }; -export type Auth = ({ - type: 'oauth'; -} & OAuth) | ({ - type: 'api'; -} & ApiAuth) | ({ - type: 'wellknown'; -} & WellKnownAuth); - -export type OAuth = { - type: 'oauth'; - refresh: string; - access: string; - expires: number; +export type PermissionReplyErrors = { + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; }; -export type ApiAuth = { - type: 'api'; - key: string; -}; +export type PermissionReplyError = PermissionReplyErrors[keyof PermissionReplyErrors]; -export type WellKnownAuth = { - type: 'wellknown'; - key: string; - token: string; +export type PermissionReplyResponses = { + /** + * Permission processed successfully + */ + 200: boolean; }; -export type EventSubscribeData = { +export type PermissionReplyResponse = PermissionReplyResponses[keyof PermissionReplyResponses]; + +export type PermissionListData = { body?: never; path?: never; - query?: never; - url: '/event'; + query?: { + directory?: string; + }; + url: '/permission'; }; -export type EventSubscribeResponses = { +export type PermissionListResponses = { /** - * Event stream + * List of pending permissions */ - 200: Event; + 200: Array; }; -export type EventSubscribeResponse = EventSubscribeResponses[keyof EventSubscribeResponses]; +export type PermissionListResponse = PermissionListResponses[keyof PermissionListResponses]; -export type AppGetData = { +export type CommandListData = { body?: never; path?: never; - query?: never; - url: '/app'; + query?: { + directory?: string; + }; + url: '/command'; }; -export type AppGetResponses = { +export type CommandListResponses = { /** - * 200 + * List of commands */ - 200: App; + 200: Array; }; -export type AppGetResponse = AppGetResponses[keyof AppGetResponses]; +export type CommandListResponse = CommandListResponses[keyof CommandListResponses]; -export type AppInitData = { +export type ConfigProvidersData = { body?: never; path?: never; - query?: never; - url: '/app/init'; + query?: { + directory?: string; + }; + url: '/config/providers'; }; -export type AppInitResponses = { +export type ConfigProvidersResponses = { /** - * Initialize the app + * List of providers */ - 200: boolean; + 200: { + providers: Array; + default: { + [key: string]: string; + }; + }; }; -export type AppInitResponse = AppInitResponses[keyof AppInitResponses]; +export type ConfigProvidersResponse = ConfigProvidersResponses[keyof ConfigProvidersResponses]; -export type ConfigGetData = { +export type ProviderListData = { body?: never; path?: never; - query?: never; - url: '/config'; + query?: { + directory?: string; + }; + url: '/provider'; }; -export type ConfigGetResponses = { +export type ProviderListResponses = { /** - * Get config info + * List of providers */ - 200: Config; + 200: { + all: Array<{ + api?: string; + name: string; + env: Array; + id: string; + npm?: string; + 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; + output: number; + }; + modalities?: { + input: Array<'text' | 'audio' | 'image' | 'video' | 'pdf'>; + output: Array<'text' | 'audio' | 'image' | 'video' | 'pdf'>; + }; + experimental?: boolean; + status?: 'alpha' | 'beta' | 'deprecated'; + options: { + [key: string]: unknown; + }; + headers?: { + [key: string]: string; + }; + provider?: { + npm: string; + }; + variants?: { + [key: string]: { + [key: string]: unknown; + }; + }; + }; + }; + }>; + default: { + [key: string]: string; + }; + connected: Array; + }; }; -export type ConfigGetResponse = ConfigGetResponses[keyof ConfigGetResponses]; +export type ProviderListResponse = ProviderListResponses[keyof ProviderListResponses]; -export type SessionListData = { +export type ProviderAuthData = { body?: never; path?: never; - query?: never; - url: '/session'; + query?: { + directory?: string; + }; + url: '/provider/auth'; }; -export type SessionListResponses = { +export type ProviderAuthResponses = { /** - * List of sessions + * Provider auth methods */ - 200: Array; + 200: { + [key: string]: Array; + }; }; -export type SessionListResponse = SessionListResponses[keyof SessionListResponses]; +export type ProviderAuthResponse = ProviderAuthResponses[keyof ProviderAuthResponses]; -export type SessionCreateData = { +export type ProviderOauthAuthorizeData = { body?: { - parentID?: string; - title?: string; + /** + * Auth method index + */ + method: number; }; - path?: never; - query?: never; - url: '/session'; + path: { + /** + * Provider ID + */ + providerID: string; + }; + query?: { + directory?: string; + }; + url: '/provider/{providerID}/oauth/authorize'; }; -export type SessionCreateErrors = { +export type ProviderOauthAuthorizeErrors = { /** * Bad request */ - 400: Error; + 400: BadRequestError; }; -export type SessionCreateError = SessionCreateErrors[keyof SessionCreateErrors]; +export type ProviderOauthAuthorizeError = ProviderOauthAuthorizeErrors[keyof ProviderOauthAuthorizeErrors]; -export type SessionCreateResponses = { +export type ProviderOauthAuthorizeResponses = { /** - * Successfully created session + * Authorization URL and method */ - 200: Session; + 200: ProviderAuthAuthorization; }; -export type SessionCreateResponse = SessionCreateResponses[keyof SessionCreateResponses]; +export type ProviderOauthAuthorizeResponse = ProviderOauthAuthorizeResponses[keyof ProviderOauthAuthorizeResponses]; -export type SessionDeleteData = { - body?: never; +export type ProviderOauthCallbackData = { + body?: { + /** + * Auth method index + */ + method: number; + /** + * OAuth authorization code + */ + code?: string; + }; path: { - id: string; + /** + * Provider ID + */ + providerID: string; }; - query?: never; - url: '/session/{id}'; + query?: { + directory?: string; + }; + url: '/provider/{providerID}/oauth/callback'; }; -export type SessionDeleteResponses = { +export type ProviderOauthCallbackErrors = { /** - * Successfully deleted session + * Bad request */ - 200: boolean; + 400: BadRequestError; }; -export type SessionDeleteResponse = SessionDeleteResponses[keyof SessionDeleteResponses]; - -export type SessionGetData = { - body?: never; - path: { - id: string; - }; - query?: never; - url: '/session/{id}'; -}; +export type ProviderOauthCallbackError = ProviderOauthCallbackErrors[keyof ProviderOauthCallbackErrors]; -export type SessionGetResponses = { +export type ProviderOauthCallbackResponses = { /** - * Get session + * OAuth callback processed successfully */ - 200: Session; + 200: boolean; }; -export type SessionGetResponse = SessionGetResponses[keyof SessionGetResponses]; +export type ProviderOauthCallbackResponse = ProviderOauthCallbackResponses[keyof ProviderOauthCallbackResponses]; -export type SessionUpdateData = { - body?: { - title?: string; - }; - path: { - id: string; +export type FindTextData = { + body?: never; + path?: never; + query: { + directory?: string; + pattern: string; }; - query?: never; - url: '/session/{id}'; + url: '/find'; }; -export type SessionUpdateResponses = { +export type FindTextResponses = { /** - * Successfully updated session + * Matches */ - 200: Session; + 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 SessionUpdateResponse = SessionUpdateResponses[keyof SessionUpdateResponses]; +export type FindTextResponse = FindTextResponses[keyof FindTextResponses]; -export type SessionChildrenData = { +export type FindFilesData = { body?: never; - path: { - id: string; + path?: never; + query: { + directory?: string; + query: string; + dirs?: 'true' | 'false'; + type?: 'file' | 'directory'; + limit?: number; }; - query?: never; - url: '/session/{id}/children'; + url: '/find/file'; }; -export type SessionChildrenResponses = { +export type FindFilesResponses = { /** - * List of children + * File paths */ - 200: Array; + 200: Array; }; -export type SessionChildrenResponse = SessionChildrenResponses[keyof SessionChildrenResponses]; +export type FindFilesResponse = FindFilesResponses[keyof FindFilesResponses]; -export type SessionInitData = { - body?: { - messageID: string; - providerID: string; - modelID: string; - }; - path: { - /** - * Session ID - */ - id: string; +export type FindSymbolsData = { + body?: never; + path?: never; + query: { + directory?: string; + query: string; }; - query?: never; - url: '/session/{id}/init'; + url: '/find/symbol'; }; -export type SessionInitResponses = { +export type FindSymbolsResponses = { /** - * 200 + * Symbols */ - 200: boolean; + 200: Array; }; -export type SessionInitResponse = SessionInitResponses[keyof SessionInitResponses]; +export type FindSymbolsResponse = FindSymbolsResponses[keyof FindSymbolsResponses]; -export type SessionAbortData = { +export type FileListData = { body?: never; - path: { - id: string; + path?: never; + query: { + directory?: string; + path: string; }; - query?: never; - url: '/session/{id}/abort'; + url: '/file'; }; -export type SessionAbortResponses = { +export type FileListResponses = { /** - * Aborted session + * Files and directories */ - 200: boolean; + 200: Array; }; -export type SessionAbortResponse = SessionAbortResponses[keyof SessionAbortResponses]; +export type FileListResponse = FileListResponses[keyof FileListResponses]; -export type SessionUnshareData = { +export type FileReadData = { body?: never; - path: { - id: string; + path?: never; + query: { + directory?: string; + path: string; }; - query?: never; - url: '/session/{id}/share'; + url: '/file/content'; }; -export type SessionUnshareResponses = { +export type FileReadResponses = { /** - * Successfully unshared session + * File content */ - 200: Session; + 200: FileContent; }; -export type SessionUnshareResponse = SessionUnshareResponses[keyof SessionUnshareResponses]; +export type FileReadResponse = FileReadResponses[keyof FileReadResponses]; -export type SessionShareData = { +export type FileStatusData = { body?: never; - path: { - id: string; + path?: never; + query?: { + directory?: string; }; - query?: never; - url: '/session/{id}/share'; + url: '/file/status'; }; -export type SessionShareResponses = { +export type FileStatusResponses = { /** - * Successfully shared session + * File status */ - 200: Session; + 200: Array; }; -export type SessionShareResponse = SessionShareResponses[keyof SessionShareResponses]; +export type FileStatusResponse = FileStatusResponses[keyof FileStatusResponses]; -export type SessionSummarizeData = { +export type AppLogData = { body?: { - providerID: string; - modelID: string; - }; - path: { /** - * Session ID + * Service name for the log entry */ - id: string; + service: string; + /** + * Log level + */ + level: 'debug' | 'info' | 'error' | 'warn'; + /** + * Log message + */ + message: string; + /** + * Additional metadata for the log entry + */ + extra?: { + [key: string]: unknown; + }; }; - query?: never; - url: '/session/{id}/summarize'; + path?: never; + query?: { + directory?: string; + }; + url: '/log'; }; -export type SessionSummarizeResponses = { +export type AppLogErrors = { /** - * Summarized session + * Bad request */ - 200: boolean; + 400: BadRequestError; }; -export type SessionSummarizeResponse = SessionSummarizeResponses[keyof SessionSummarizeResponses]; - -export type SessionMessagesData = { - body?: never; - path: { - /** - * Session ID - */ - id: string; - }; - query?: never; - url: '/session/{id}/message'; -}; +export type AppLogError = AppLogErrors[keyof AppLogErrors]; -export type SessionMessagesResponses = { +export type AppLogResponses = { /** - * List of messages + * Log entry written successfully */ - 200: Array<{ - info: Message; - parts: Array; - }>; + 200: boolean; }; -export type SessionMessagesResponse = SessionMessagesResponses[keyof SessionMessagesResponses]; +export type AppLogResponse = AppLogResponses[keyof AppLogResponses]; -export type SessionChatData = { - body?: { - messageID?: string; - providerID: string; - modelID: string; - agent?: string; - system?: string; - tools?: { - [key: string]: boolean; - }; - parts: Array<({ - type: 'text'; - } & TextPartInput) | ({ - type: 'file'; - } & FilePartInput) | ({ - type: 'agent'; - } & AgentPartInput)>; - }; - path: { - /** - * Session ID - */ - id: string; +export type AppAgentsData = { + body?: never; + path?: never; + query?: { + directory?: string; }; - query?: never; - url: '/session/{id}/message'; + url: '/agent'; }; -export type SessionChatResponses = { +export type AppAgentsResponses = { /** - * Created message + * List of agents */ - 200: { - info: AssistantMessage; - parts: Array; - }; + 200: Array; }; -export type SessionChatResponse = SessionChatResponses[keyof SessionChatResponses]; +export type AppAgentsResponse = AppAgentsResponses[keyof AppAgentsResponses]; -export type SessionMessageData = { +export type McpStatusData = { body?: never; - path: { - /** - * Session ID - */ - id: string; - /** - * Message ID - */ - messageID: string; + path?: never; + query?: { + directory?: string; }; - query?: never; - url: '/session/{id}/message/{messageID}'; + url: '/mcp'; }; -export type SessionMessageResponses = { +export type McpStatusResponses = { /** - * Message + * MCP server status */ 200: { - info: Message; - parts: Array; + [key: string]: McpStatus; }; }; -export type SessionMessageResponse = SessionMessageResponses[keyof SessionMessageResponses]; +export type McpStatusResponse = McpStatusResponses[keyof McpStatusResponses]; -export type SessionShellData = { +export type McpAddData = { body?: { - agent: string; - command: string; + name: string; + config: McpLocalConfig | McpRemoteConfig; }; - path: { - /** - * Session ID - */ - id: string; + path?: never; + query?: { + directory?: string; }; - query?: never; - url: '/session/{id}/shell'; + url: '/mcp'; }; -export type SessionShellResponses = { +export type McpAddErrors = { /** - * Created message + * Bad request */ - 200: AssistantMessage; + 400: BadRequestError; }; -export type SessionShellResponse = SessionShellResponses[keyof SessionShellResponses]; - -export type SessionRevertData = { - body?: { - messageID: string; - partID?: string; - }; - path: { - id: string; - }; - query?: never; - url: '/session/{id}/revert'; -}; +export type McpAddError = McpAddErrors[keyof McpAddErrors]; -export type SessionRevertResponses = { +export type McpAddResponses = { /** - * Updated session + * MCP server added successfully */ - 200: Session; + 200: { + [key: string]: McpStatus; + }; }; -export type SessionRevertResponse = SessionRevertResponses[keyof SessionRevertResponses]; +export type McpAddResponse = McpAddResponses[keyof McpAddResponses]; -export type SessionUnrevertData = { +export type McpAuthRemoveData = { body?: never; path: { - id: string; + name: string; }; - query?: never; - url: '/session/{id}/unrevert'; + query?: { + directory?: string; + }; + url: '/mcp/{name}/auth'; +}; + +export type McpAuthRemoveErrors = { + /** + * Not found + */ + 404: NotFoundError; }; -export type SessionUnrevertResponses = { +export type McpAuthRemoveError = McpAuthRemoveErrors[keyof McpAuthRemoveErrors]; + +export type McpAuthRemoveResponses = { /** - * Updated session + * OAuth credentials removed */ - 200: Session; + 200: { + success: true; + }; }; -export type SessionUnrevertResponse = SessionUnrevertResponses[keyof SessionUnrevertResponses]; +export type McpAuthRemoveResponse = McpAuthRemoveResponses[keyof McpAuthRemoveResponses]; -export type PostSessionByIdPermissionsByPermissionIdData = { - body?: { - response: 'once' | 'always' | 'reject'; - }; +export type McpAuthStartData = { + body?: never; path: { - id: string; - permissionID: string; + name: string; }; - query?: never; - url: '/session/{id}/permissions/{permissionID}'; + query?: { + directory?: string; + }; + url: '/mcp/{name}/auth'; }; -export type PostSessionByIdPermissionsByPermissionIdResponses = { +export type McpAuthStartErrors = { /** - * Permission processed successfully + * Bad request */ - 200: boolean; + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; }; -export type PostSessionByIdPermissionsByPermissionIdResponse = PostSessionByIdPermissionsByPermissionIdResponses[keyof PostSessionByIdPermissionsByPermissionIdResponses]; - -export type ConfigProvidersData = { - body?: never; - path?: never; - query?: never; - url: '/config/providers'; -}; +export type McpAuthStartError = McpAuthStartErrors[keyof McpAuthStartErrors]; -export type ConfigProvidersResponses = { +export type McpAuthStartResponses = { /** - * List of providers + * OAuth flow started */ 200: { - providers: Array; - default: { - [key: string]: string; - }; + /** + * URL to open in browser for authorization + */ + authorizationUrl: string; }; }; -export type ConfigProvidersResponse = ConfigProvidersResponses[keyof ConfigProvidersResponses]; +export type McpAuthStartResponse = McpAuthStartResponses[keyof McpAuthStartResponses]; -export type FindTextData = { - body?: never; - path?: never; - query: { - pattern: string; +export type McpAuthCallbackData = { + body?: { + /** + * Authorization code from OAuth callback + */ + code: string; }; - url: '/find'; + path: { + name: string; + }; + query?: { + directory?: string; + }; + url: '/mcp/{name}/auth/callback'; }; -export type FindTextResponses = { +export type McpAuthCallbackErrors = { /** - * Matches + * Bad request */ - 200: Array<{ - path: { - text: string; - }; - lines: { - text: string; - }; - line_number: number; - absolute_offset: number; - submatches: Array<{ - match: { - text: string; - }; - start: number; - end: number; - }>; - }>; + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; }; -export type FindTextResponse = FindTextResponses[keyof FindTextResponses]; - -export type FindFilesData = { - body?: never; - path?: never; - query: { - query: string; - }; - url: '/find/file'; -}; +export type McpAuthCallbackError = McpAuthCallbackErrors[keyof McpAuthCallbackErrors]; -export type FindFilesResponses = { +export type McpAuthCallbackResponses = { /** - * File paths + * OAuth authentication completed */ - 200: Array; + 200: McpStatus; }; -export type FindFilesResponse = FindFilesResponses[keyof FindFilesResponses]; +export type McpAuthCallbackResponse = McpAuthCallbackResponses[keyof McpAuthCallbackResponses]; -export type FindSymbolsData = { +export type McpAuthAuthenticateData = { body?: never; - path?: never; - query: { - query: string; + path: { + name: string; }; - url: '/find/symbol'; + query?: { + directory?: string; + }; + url: '/mcp/{name}/auth/authenticate'; }; -export type FindSymbolsResponses = { +export type McpAuthAuthenticateErrors = { /** - * Symbols + * Bad request */ - 200: Array; + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; }; -export type FindSymbolsResponse = FindSymbolsResponses[keyof FindSymbolsResponses]; +export type McpAuthAuthenticateError = McpAuthAuthenticateErrors[keyof McpAuthAuthenticateErrors]; -export type FileReadData = { +export type McpAuthAuthenticateResponses = { + /** + * OAuth authentication completed + */ + 200: McpStatus; +}; + +export type McpAuthAuthenticateResponse = McpAuthAuthenticateResponses[keyof McpAuthAuthenticateResponses]; + +export type McpConnectData = { body?: never; - path?: never; - query: { - path: string; + path: { + name: string; }; - url: '/file'; + query?: { + directory?: string; + }; + url: '/mcp/{name}/connect'; }; -export type FileReadResponses = { +export type McpConnectResponses = { /** - * File content + * MCP server connected successfully */ - 200: { - type: 'raw' | 'patch'; - content: string; - }; + 200: boolean; }; -export type FileReadResponse = FileReadResponses[keyof FileReadResponses]; +export type McpConnectResponse = McpConnectResponses[keyof McpConnectResponses]; -export type FileStatusData = { +export type McpDisconnectData = { body?: never; - path?: never; - query?: never; - url: '/file/status'; + path: { + name: string; + }; + query?: { + directory?: string; + }; + url: '/mcp/{name}/disconnect'; }; -export type FileStatusResponses = { +export type McpDisconnectResponses = { /** - * File status + * MCP server disconnected successfully */ - 200: Array; + 200: boolean; }; -export type FileStatusResponse = FileStatusResponses[keyof FileStatusResponses]; +export type McpDisconnectResponse = McpDisconnectResponses[keyof McpDisconnectResponses]; -export type AppLogData = { - body?: { - /** - * Service name for the log entry - */ - service: string; - /** - * Log level - */ - level: 'debug' | 'info' | 'error' | 'warn'; - /** - * Log message - */ - message: string; - /** - * Additional metadata for the log entry - */ - extra?: { - [key: string]: unknown; - }; - }; +export type LspStatusData = { + body?: never; path?: never; - query?: never; - url: '/log'; + query?: { + directory?: string; + }; + url: '/lsp'; }; -export type AppLogResponses = { +export type LspStatusResponses = { /** - * Log entry written successfully + * LSP server status */ - 200: boolean; + 200: Array; }; -export type AppLogResponse = AppLogResponses[keyof AppLogResponses]; +export type LspStatusResponse = LspStatusResponses[keyof LspStatusResponses]; -export type AppAgentsData = { +export type FormatterStatusData = { body?: never; path?: never; - query?: never; - url: '/agent'; + query?: { + directory?: string; + }; + url: '/formatter'; }; -export type AppAgentsResponses = { +export type FormatterStatusResponses = { /** - * List of agents + * Formatter status */ - 200: Array; + 200: Array; }; -export type AppAgentsResponse = AppAgentsResponses[keyof AppAgentsResponses]; +export type FormatterStatusResponse = FormatterStatusResponses[keyof FormatterStatusResponses]; export type TuiAppendPromptData = { body?: { text: string; }; path?: never; - query?: never; + query?: { + directory?: string; + }; url: '/tui/append-prompt'; }; +export type TuiAppendPromptErrors = { + /** + * Bad request + */ + 400: BadRequestError; +}; + +export type TuiAppendPromptError = TuiAppendPromptErrors[keyof TuiAppendPromptErrors]; + export type TuiAppendPromptResponses = { /** * Prompt processed successfully @@ -1784,7 +4052,9 @@ export type TuiAppendPromptResponse = TuiAppendPromptResponses[keyof TuiAppendPr export type TuiOpenHelpData = { body?: never; path?: never; - query?: never; + query?: { + directory?: string; + }; url: '/tui/open-help'; }; @@ -1800,7 +4070,9 @@ export type TuiOpenHelpResponse = TuiOpenHelpResponses[keyof TuiOpenHelpResponse export type TuiOpenSessionsData = { body?: never; path?: never; - query?: never; + query?: { + directory?: string; + }; url: '/tui/open-sessions'; }; @@ -1816,7 +4088,9 @@ export type TuiOpenSessionsResponse = TuiOpenSessionsResponses[keyof TuiOpenSess export type TuiOpenThemesData = { body?: never; path?: never; - query?: never; + query?: { + directory?: string; + }; url: '/tui/open-themes'; }; @@ -1832,7 +4106,9 @@ export type TuiOpenThemesResponse = TuiOpenThemesResponses[keyof TuiOpenThemesRe export type TuiOpenModelsData = { body?: never; path?: never; - query?: never; + query?: { + directory?: string; + }; url: '/tui/open-models'; }; @@ -1848,7 +4124,9 @@ export type TuiOpenModelsResponse = TuiOpenModelsResponses[keyof TuiOpenModelsRe export type TuiSubmitPromptData = { body?: never; path?: never; - query?: never; + query?: { + directory?: string; + }; url: '/tui/submit-prompt'; }; @@ -1864,7 +4142,9 @@ export type TuiSubmitPromptResponse = TuiSubmitPromptResponses[keyof TuiSubmitPr export type TuiClearPromptData = { body?: never; path?: never; - query?: never; + query?: { + directory?: string; + }; url: '/tui/clear-prompt'; }; @@ -1882,10 +4162,21 @@ export type TuiExecuteCommandData = { command: string; }; path?: never; - query?: never; + query?: { + directory?: string; + }; url: '/tui/execute-command'; }; +export type TuiExecuteCommandErrors = { + /** + * Bad request + */ + 400: BadRequestError; +}; + +export type TuiExecuteCommandError = TuiExecuteCommandErrors[keyof TuiExecuteCommandErrors]; + export type TuiExecuteCommandResponses = { /** * Command executed successfully @@ -1900,9 +4191,15 @@ export type TuiShowToastData = { title?: string; message: string; variant: 'info' | 'success' | 'warning' | 'error'; + /** + * Duration in milliseconds + */ + duration?: number; }; path?: never; - query?: never; + query?: { + directory?: string; + }; url: '/tui/show-toast'; }; @@ -1915,20 +4212,88 @@ export type TuiShowToastResponses = { export type TuiShowToastResponse = TuiShowToastResponses[keyof TuiShowToastResponses]; +export type TuiPublishData = { + body?: EventTuiPromptAppend | EventTuiCommandExecute | EventTuiToastShow; + path?: never; + query?: { + directory?: 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 TuiControlNextData = { + body?: never; + path?: never; + query?: { + directory?: 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; + }; + url: '/tui/control/response'; +}; + +export type TuiControlResponseResponses = { + /** + * Response submitted successfully + */ + 200: boolean; +}; + +export type TuiControlResponseResponse = TuiControlResponseResponses[keyof TuiControlResponseResponses]; + export type AuthSetData = { body?: Auth; path: { - id: string; + providerID: string; }; - query?: never; - url: '/auth/{id}'; + query?: { + directory?: string; + }; + url: '/auth/{providerID}'; }; export type AuthSetErrors = { /** * Bad request */ - 400: Error; + 400: BadRequestError; }; export type AuthSetError = AuthSetErrors[keyof AuthSetErrors]; @@ -1941,3 +4306,21 @@ export type AuthSetResponses = { }; export type AuthSetResponse = AuthSetResponses[keyof AuthSetResponses]; + +export type EventSubscribeData = { + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/event'; +}; + +export type EventSubscribeResponses = { + /** + * Event stream + */ + 200: Event; +}; + +export type EventSubscribeResponse = EventSubscribeResponses[keyof EventSubscribeResponses]; diff --git a/packages/openapi-ts-tests/sdks/__snapshots__/opencode/flat/index.ts b/packages/openapi-ts-tests/sdks/__snapshots__/opencode/flat/index.ts index 1c5264152..c1f98cb47 100644 --- a/packages/openapi-ts-tests/sdks/__snapshots__/opencode/flat/index.ts +++ b/packages/openapi-ts-tests/sdks/__snapshots__/opencode/flat/index.ts @@ -1,4 +1,4 @@ // This file is auto-generated by @hey-api/openapi-ts -export { appAgents, appGet, appInit, appLog, authSet, configGet, configProviders, eventSubscribe, fileRead, fileStatus, findFiles, findSymbols, findText, type Options, postSessionByIdPermissionsByPermissionId, sessionAbort, sessionChat, sessionChildren, sessionCreate, sessionDelete, sessionGet, sessionInit, sessionList, sessionMessage, sessionMessages, sessionRevert, sessionShare, sessionShell, sessionSummarize, sessionUnrevert, sessionUnshare, sessionUpdate, tuiAppendPrompt, tuiClearPrompt, tuiExecuteCommand, tuiOpenHelp, tuiOpenModels, tuiOpenSessions, tuiOpenThemes, tuiShowToast, tuiSubmitPrompt } from './sdk.gen'; -export type { Agent, AgentConfig, AgentPart, AgentPartInput, ApiAuth, App, AppAgentsData, AppAgentsResponse, AppAgentsResponses, AppGetData, AppGetResponse, AppGetResponses, AppInitData, AppInitResponse, AppInitResponses, AppLogData, AppLogResponse, AppLogResponses, AssistantMessage, Auth, AuthSetData, AuthSetError, AuthSetErrors, AuthSetResponse, AuthSetResponses, ClientOptions, Config, ConfigGetData, ConfigGetResponse, ConfigGetResponses, ConfigProvidersData, ConfigProvidersResponse, ConfigProvidersResponses, Error, Event, EventFileEdited, EventFileWatcherUpdated, EventIdeInstalled, EventInstallationUpdated, EventLspClientDiagnostics, EventMessagePartRemoved, EventMessagePartUpdated, EventMessageRemoved, EventMessageUpdated, EventPermissionReplied, EventPermissionUpdated, EventServerConnected, EventSessionDeleted, EventSessionError, EventSessionIdle, EventSessionUpdated, EventStorageWrite, EventSubscribeData, EventSubscribeResponse, EventSubscribeResponses, File, FilePart, FilePartInput, FilePartSource, FilePartSourceText, FileReadData, FileReadResponse, FileReadResponses, FileSource, FileStatusData, FileStatusResponse, FileStatusResponses, FindFilesData, FindFilesResponse, FindFilesResponses, FindSymbolsData, FindSymbolsResponse, FindSymbolsResponses, FindTextData, FindTextResponse, FindTextResponses, KeybindsConfig, LayoutConfig, McpLocalConfig, McpRemoteConfig, Message, MessageAbortedError, MessageOutputLengthError, Model, OAuth, Part, PatchPart, Permission, PostSessionByIdPermissionsByPermissionIdData, PostSessionByIdPermissionsByPermissionIdResponse, PostSessionByIdPermissionsByPermissionIdResponses, Provider, ProviderAuthError, Range, ReasoningPart, Session, SessionAbortData, SessionAbortResponse, SessionAbortResponses, SessionChatData, SessionChatResponse, SessionChatResponses, SessionChildrenData, SessionChildrenResponse, SessionChildrenResponses, SessionCreateData, SessionCreateError, SessionCreateErrors, SessionCreateResponse, SessionCreateResponses, SessionDeleteData, SessionDeleteResponse, SessionDeleteResponses, SessionGetData, SessionGetResponse, SessionGetResponses, SessionInitData, SessionInitResponse, SessionInitResponses, SessionListData, SessionListResponse, SessionListResponses, SessionMessageData, SessionMessageResponse, SessionMessageResponses, SessionMessagesData, SessionMessagesResponse, SessionMessagesResponses, SessionRevertData, SessionRevertResponse, SessionRevertResponses, SessionShareData, SessionShareResponse, SessionShareResponses, SessionShellData, SessionShellResponse, SessionShellResponses, SessionSummarizeData, SessionSummarizeResponse, SessionSummarizeResponses, SessionUnrevertData, SessionUnrevertResponse, SessionUnrevertResponses, SessionUnshareData, SessionUnshareResponse, SessionUnshareResponses, SessionUpdateData, SessionUpdateResponse, SessionUpdateResponses, SnapshotPart, StepFinishPart, StepStartPart, Symbol, SymbolSource, TextPart, TextPartInput, ToolPart, ToolState, ToolStateCompleted, ToolStateError, ToolStatePending, ToolStateRunning, TuiAppendPromptData, TuiAppendPromptResponse, TuiAppendPromptResponses, TuiClearPromptData, TuiClearPromptResponse, TuiClearPromptResponses, TuiExecuteCommandData, TuiExecuteCommandResponse, TuiExecuteCommandResponses, TuiOpenHelpData, TuiOpenHelpResponse, TuiOpenHelpResponses, TuiOpenModelsData, TuiOpenModelsResponse, TuiOpenModelsResponses, TuiOpenSessionsData, TuiOpenSessionsResponse, TuiOpenSessionsResponses, TuiOpenThemesData, TuiOpenThemesResponse, TuiOpenThemesResponses, TuiShowToastData, TuiShowToastResponse, TuiShowToastResponses, TuiSubmitPromptData, TuiSubmitPromptResponse, TuiSubmitPromptResponses, UnknownError, UserMessage, WellKnownAuth } from './types.gen'; +export { appAgents, appLog, authSet, commandList, configGet, configProviders, configUpdate, eventSubscribe, fileList, fileRead, fileStatus, findFiles, findSymbols, findText, formatterStatus, globalDispose, globalEvent, globalHealth, instanceDispose, lspStatus, mcpAdd, mcpAuthAuthenticate, mcpAuthCallback, mcpAuthRemove, mcpAuthStart, mcpConnect, mcpDisconnect, mcpStatus, type Options, partDelete, partUpdate, pathGet, permissionList, permissionReply, permissionRespond, projectCurrent, projectList, projectUpdate, providerAuth, providerList, providerOauthAuthorize, providerOauthCallback, ptyConnect, ptyCreate, ptyGet, ptyList, ptyRemove, ptyUpdate, sessionAbort, sessionChildren, sessionCommand, sessionCreate, sessionDelete, sessionDiff, sessionFork, sessionGet, sessionInit, sessionList, sessionMessage, sessionMessages, sessionPrompt, sessionPromptAsync, sessionRevert, sessionShare, sessionShell, sessionStatus, sessionSummarize, sessionTodo, sessionUnrevert, sessionUnshare, sessionUpdate, toolIds, toolList, tuiAppendPrompt, tuiClearPrompt, tuiControlNext, tuiControlResponse, tuiExecuteCommand, tuiOpenHelp, tuiOpenModels, tuiOpenSessions, tuiOpenThemes, tuiPublish, tuiShowToast, tuiSubmitPrompt, vcsGet } from './sdk.gen'; +export type { Agent, AgentConfig, AgentPart, AgentPartInput, ApiAuth, ApiError, AppAgentsData, AppAgentsResponse, AppAgentsResponses, AppLogData, AppLogError, AppLogErrors, AppLogResponse, AppLogResponses, AssistantMessage, Auth, AuthSetData, AuthSetError, AuthSetErrors, AuthSetResponse, AuthSetResponses, BadRequestError, ClientOptions, Command, CommandListData, CommandListResponse, CommandListResponses, CompactionPart, Config, ConfigGetData, ConfigGetResponse, ConfigGetResponses, ConfigProvidersData, ConfigProvidersResponse, ConfigProvidersResponses, ConfigUpdateData, ConfigUpdateError, ConfigUpdateErrors, ConfigUpdateResponse, ConfigUpdateResponses, Event, EventCommandExecuted, EventFileEdited, EventFileWatcherUpdated, EventGlobalDisposed, EventInstallationUpdateAvailable, EventInstallationUpdated, EventLspClientDiagnostics, EventLspUpdated, EventMcpToolsChanged, EventMessagePartRemoved, EventMessagePartUpdated, EventMessageRemoved, EventMessageUpdated, EventPermissionAsked, EventPermissionReplied, EventProjectUpdated, EventPtyCreated, EventPtyDeleted, EventPtyExited, EventPtyUpdated, EventServerConnected, EventServerInstanceDisposed, EventSessionCompacted, EventSessionCreated, EventSessionDeleted, EventSessionDiff, EventSessionError, EventSessionIdle, EventSessionStatus, EventSessionUpdated, EventSubscribeData, EventSubscribeResponse, EventSubscribeResponses, EventTodoUpdated, EventTuiCommandExecute, EventTuiPromptAppend, EventTuiToastShow, EventVcsBranchUpdated, File, FileContent, FileDiff, FileListData, FileListResponse, FileListResponses, FileNode, FilePart, FilePartInput, FilePartSource, FilePartSourceText, FileReadData, FileReadResponse, FileReadResponses, FileSource, FileStatusData, FileStatusResponse, FileStatusResponses, FindFilesData, FindFilesResponse, FindFilesResponses, FindSymbolsData, FindSymbolsResponse, FindSymbolsResponses, FindTextData, FindTextResponse, FindTextResponses, FormatterStatus, FormatterStatusData, FormatterStatusResponse, FormatterStatusResponses, GlobalDisposeData, GlobalDisposeResponse, GlobalDisposeResponses, GlobalEvent, GlobalEventData, GlobalEventResponse, GlobalEventResponses, GlobalHealthData, GlobalHealthResponse, GlobalHealthResponses, InstanceDisposeData, InstanceDisposeResponse, InstanceDisposeResponses, KeybindsConfig, LayoutConfig, LogLevel, LspStatus, LspStatusData, LspStatusResponse, LspStatusResponses, McpAddData, McpAddError, McpAddErrors, McpAddResponse, McpAddResponses, McpAuthAuthenticateData, McpAuthAuthenticateError, McpAuthAuthenticateErrors, McpAuthAuthenticateResponse, McpAuthAuthenticateResponses, McpAuthCallbackData, McpAuthCallbackError, McpAuthCallbackErrors, McpAuthCallbackResponse, McpAuthCallbackResponses, McpAuthRemoveData, McpAuthRemoveError, McpAuthRemoveErrors, McpAuthRemoveResponse, McpAuthRemoveResponses, McpAuthStartData, McpAuthStartError, McpAuthStartErrors, McpAuthStartResponse, McpAuthStartResponses, McpConnectData, McpConnectResponse, McpConnectResponses, McpDisconnectData, McpDisconnectResponse, McpDisconnectResponses, McpLocalConfig, McpOAuthConfig, McpRemoteConfig, McpStatus, McpStatusConnected, McpStatusData, McpStatusDisabled, McpStatusFailed, McpStatusNeedsAuth, McpStatusNeedsClientRegistration, McpStatusResponse, McpStatusResponses, Message, MessageAbortedError, MessageOutputLengthError, Model, NotFoundError, OAuth, Part, PartDeleteData, PartDeleteError, PartDeleteErrors, PartDeleteResponse, PartDeleteResponses, PartUpdateData, PartUpdateError, PartUpdateErrors, PartUpdateResponse, PartUpdateResponses, PatchPart, Path, PathGetData, PathGetResponse, PathGetResponses, PermissionAction, PermissionActionConfig, PermissionConfig, PermissionListData, PermissionListResponse, PermissionListResponses, PermissionObjectConfig, PermissionReplyData, PermissionReplyError, PermissionReplyErrors, PermissionReplyResponse, PermissionReplyResponses, PermissionRequest, PermissionRespondData, PermissionRespondError, PermissionRespondErrors, PermissionRespondResponse, PermissionRespondResponses, PermissionRule, PermissionRuleConfig, PermissionRuleset, Project, ProjectCurrentData, ProjectCurrentResponse, ProjectCurrentResponses, ProjectListData, ProjectListResponse, ProjectListResponses, ProjectUpdateData, ProjectUpdateError, ProjectUpdateErrors, ProjectUpdateResponse, ProjectUpdateResponses, Provider, ProviderAuthAuthorization, ProviderAuthData, ProviderAuthError, ProviderAuthMethod, ProviderAuthResponse, ProviderAuthResponses, ProviderConfig, ProviderListData, ProviderListResponse, ProviderListResponses, ProviderOauthAuthorizeData, ProviderOauthAuthorizeError, ProviderOauthAuthorizeErrors, ProviderOauthAuthorizeResponse, ProviderOauthAuthorizeResponses, ProviderOauthCallbackData, ProviderOauthCallbackError, ProviderOauthCallbackErrors, ProviderOauthCallbackResponse, ProviderOauthCallbackResponses, Pty, PtyConnectData, PtyConnectError, PtyConnectErrors, PtyConnectResponse, PtyConnectResponses, PtyCreateData, PtyCreateError, PtyCreateErrors, PtyCreateResponse, PtyCreateResponses, PtyGetData, PtyGetError, PtyGetErrors, PtyGetResponse, PtyGetResponses, PtyListData, PtyListResponse, PtyListResponses, PtyRemoveData, PtyRemoveError, PtyRemoveErrors, PtyRemoveResponse, PtyRemoveResponses, PtyUpdateData, PtyUpdateError, PtyUpdateErrors, PtyUpdateResponse, PtyUpdateResponses, Range, ReasoningPart, RetryPart, ServerConfig, Session, SessionAbortData, SessionAbortError, SessionAbortErrors, SessionAbortResponse, SessionAbortResponses, SessionChildrenData, SessionChildrenError, SessionChildrenErrors, SessionChildrenResponse, SessionChildrenResponses, SessionCommandData, SessionCommandError, SessionCommandErrors, SessionCommandResponse, SessionCommandResponses, SessionCreateData, SessionCreateError, SessionCreateErrors, SessionCreateResponse, SessionCreateResponses, SessionDeleteData, SessionDeleteError, SessionDeleteErrors, SessionDeleteResponse, SessionDeleteResponses, SessionDiffData, SessionDiffError, SessionDiffErrors, SessionDiffResponse, SessionDiffResponses, SessionForkData, SessionForkResponse, SessionForkResponses, SessionGetData, SessionGetError, SessionGetErrors, SessionGetResponse, SessionGetResponses, SessionInitData, SessionInitError, SessionInitErrors, SessionInitResponse, SessionInitResponses, SessionListData, SessionListResponse, SessionListResponses, SessionMessageData, SessionMessageError, SessionMessageErrors, SessionMessageResponse, SessionMessageResponses, SessionMessagesData, SessionMessagesError, SessionMessagesErrors, SessionMessagesResponse, SessionMessagesResponses, SessionPromptAsyncData, SessionPromptAsyncError, SessionPromptAsyncErrors, SessionPromptAsyncResponse, SessionPromptAsyncResponses, SessionPromptData, SessionPromptError, SessionPromptErrors, SessionPromptResponse, SessionPromptResponses, SessionRevertData, SessionRevertError, SessionRevertErrors, SessionRevertResponse, SessionRevertResponses, SessionShareData, SessionShareError, SessionShareErrors, SessionShareResponse, SessionShareResponses, SessionShellData, SessionShellError, SessionShellErrors, SessionShellResponse, SessionShellResponses, SessionStatus, SessionStatusData, SessionStatusError, SessionStatusErrors, SessionStatusResponse, SessionStatusResponses, SessionSummarizeData, SessionSummarizeError, SessionSummarizeErrors, SessionSummarizeResponse, SessionSummarizeResponses, SessionTodoData, SessionTodoError, SessionTodoErrors, SessionTodoResponse, SessionTodoResponses, SessionUnrevertData, SessionUnrevertError, SessionUnrevertErrors, SessionUnrevertResponse, SessionUnrevertResponses, SessionUnshareData, SessionUnshareError, SessionUnshareErrors, SessionUnshareResponse, SessionUnshareResponses, SessionUpdateData, SessionUpdateError, SessionUpdateErrors, SessionUpdateResponse, SessionUpdateResponses, SnapshotPart, StepFinishPart, StepStartPart, SubtaskPartInput, Symbol, SymbolSource, TextPart, TextPartInput, Todo, ToolIds, ToolIdsData, ToolIdsError, ToolIdsErrors, ToolIdsResponse, ToolIdsResponses, ToolList, ToolListData, ToolListError, ToolListErrors, ToolListItem, ToolListResponse, ToolListResponses, ToolPart, ToolState, ToolStateCompleted, ToolStateError, ToolStatePending, ToolStateRunning, TuiAppendPromptData, TuiAppendPromptError, TuiAppendPromptErrors, TuiAppendPromptResponse, TuiAppendPromptResponses, TuiClearPromptData, TuiClearPromptResponse, TuiClearPromptResponses, TuiControlNextData, TuiControlNextResponse, TuiControlNextResponses, TuiControlResponseData, TuiControlResponseResponse, TuiControlResponseResponses, TuiExecuteCommandData, TuiExecuteCommandError, TuiExecuteCommandErrors, TuiExecuteCommandResponse, TuiExecuteCommandResponses, TuiOpenHelpData, TuiOpenHelpResponse, TuiOpenHelpResponses, TuiOpenModelsData, TuiOpenModelsResponse, TuiOpenModelsResponses, TuiOpenSessionsData, TuiOpenSessionsResponse, TuiOpenSessionsResponses, TuiOpenThemesData, TuiOpenThemesResponse, TuiOpenThemesResponses, TuiPublishData, TuiPublishError, TuiPublishErrors, TuiPublishResponse, TuiPublishResponses, TuiShowToastData, TuiShowToastResponse, TuiShowToastResponses, TuiSubmitPromptData, TuiSubmitPromptResponse, TuiSubmitPromptResponses, UnknownError, UserMessage, VcsGetData, VcsGetResponse, VcsGetResponses, VcsInfo, WellKnownAuth } from './types.gen'; diff --git a/packages/openapi-ts-tests/sdks/__snapshots__/opencode/flat/sdk.gen.ts b/packages/openapi-ts-tests/sdks/__snapshots__/opencode/flat/sdk.gen.ts index 56ce2c581..2f40e981f 100644 --- a/packages/openapi-ts-tests/sdks/__snapshots__/opencode/flat/sdk.gen.ts +++ b/packages/openapi-ts-tests/sdks/__snapshots__/opencode/flat/sdk.gen.ts @@ -2,7 +2,7 @@ import { buildClientParams, type Client, type Options as Options2, type TDataShape } from './client'; import { client } from './client.gen'; -import type { AgentPartInput, AppAgentsResponses, AppGetResponses, AppInitResponses, AppLogResponses, Auth, AuthSetErrors, AuthSetResponses, ConfigGetResponses, ConfigProvidersResponses, EventSubscribeResponses, FilePartInput, FileReadResponses, FileStatusResponses, FindFilesResponses, FindSymbolsResponses, FindTextResponses, PostSessionByIdPermissionsByPermissionIdResponses, SessionAbortResponses, SessionChatResponses, SessionChildrenResponses, SessionCreateErrors, SessionCreateResponses, SessionDeleteResponses, SessionGetResponses, SessionInitResponses, SessionListResponses, SessionMessageResponses, SessionMessagesResponses, SessionRevertResponses, SessionShareResponses, SessionShellResponses, SessionSummarizeResponses, SessionUnrevertResponses, SessionUnshareResponses, SessionUpdateResponses, TextPartInput, TuiAppendPromptResponses, TuiClearPromptResponses, TuiExecuteCommandResponses, TuiOpenHelpResponses, TuiOpenModelsResponses, TuiOpenSessionsResponses, TuiOpenThemesResponses, TuiShowToastResponses, TuiSubmitPromptResponses } from './types.gen'; +import type { AgentPartInput, AppAgentsResponses, AppLogErrors, AppLogResponses, Auth, AuthSetErrors, AuthSetResponses, CommandListResponses, Config, ConfigGetResponses, ConfigProvidersResponses, ConfigUpdateErrors, ConfigUpdateResponses, EventSubscribeResponses, EventTuiCommandExecute, EventTuiPromptAppend, EventTuiToastShow, FileListResponses, FilePartInput, FileReadResponses, FileStatusResponses, FindFilesResponses, FindSymbolsResponses, FindTextResponses, FormatterStatusResponses, GlobalDisposeResponses, GlobalEventResponses, GlobalHealthResponses, InstanceDisposeResponses, LspStatusResponses, McpAddErrors, McpAddResponses, McpAuthAuthenticateErrors, McpAuthAuthenticateResponses, McpAuthCallbackErrors, McpAuthCallbackResponses, McpAuthRemoveErrors, McpAuthRemoveResponses, McpAuthStartErrors, McpAuthStartResponses, McpConnectResponses, McpDisconnectResponses, McpLocalConfig, McpRemoteConfig, McpStatusResponses, Part, PartDeleteErrors, PartDeleteResponses, PartUpdateErrors, PartUpdateResponses, PathGetResponses, PermissionListResponses, PermissionReplyErrors, PermissionReplyResponses, PermissionRespondErrors, PermissionRespondResponses, PermissionRuleset, ProjectCurrentResponses, ProjectListResponses, ProjectUpdateErrors, ProjectUpdateResponses, ProviderAuthResponses, ProviderListResponses, ProviderOauthAuthorizeErrors, ProviderOauthAuthorizeResponses, ProviderOauthCallbackErrors, ProviderOauthCallbackResponses, PtyConnectErrors, PtyConnectResponses, PtyCreateErrors, PtyCreateResponses, PtyGetErrors, PtyGetResponses, PtyListResponses, PtyRemoveErrors, PtyRemoveResponses, PtyUpdateErrors, PtyUpdateResponses, SessionAbortErrors, SessionAbortResponses, SessionChildrenErrors, SessionChildrenResponses, SessionCommandErrors, SessionCommandResponses, SessionCreateErrors, SessionCreateResponses, SessionDeleteErrors, SessionDeleteResponses, SessionDiffErrors, SessionDiffResponses, SessionForkResponses, SessionGetErrors, SessionGetResponses, SessionInitErrors, SessionInitResponses, SessionListResponses, SessionMessageErrors, SessionMessageResponses, SessionMessagesErrors, SessionMessagesResponses, SessionPromptAsyncErrors, SessionPromptAsyncResponses, SessionPromptErrors, SessionPromptResponses, SessionRevertErrors, SessionRevertResponses, SessionShareErrors, SessionShareResponses, SessionShellErrors, SessionShellResponses, SessionStatusErrors, SessionStatusResponses, SessionSummarizeErrors, SessionSummarizeResponses, SessionTodoErrors, SessionTodoResponses, SessionUnrevertErrors, SessionUnrevertResponses, SessionUnshareErrors, SessionUnshareResponses, SessionUpdateErrors, SessionUpdateResponses, SubtaskPartInput, TextPartInput, ToolIdsErrors, ToolIdsResponses, ToolListErrors, ToolListResponses, TuiAppendPromptErrors, TuiAppendPromptResponses, TuiClearPromptResponses, TuiControlNextResponses, TuiControlResponseResponses, TuiExecuteCommandErrors, TuiExecuteCommandResponses, TuiOpenHelpResponses, TuiOpenModelsResponses, TuiOpenSessionsResponses, TuiOpenThemesResponses, TuiPublishErrors, TuiPublishResponses, TuiShowToastResponses, TuiSubmitPromptResponses, VcsGetResponses } from './types.gen'; export type Options = Options2 & { /** @@ -19,38 +19,381 @@ export type Options(options?: Options) => (options?.client ?? client).get({ url: '/global/health', ...options }); + +/** + * Get global events + * + * Subscribe to global events from the OpenCode system using server-sent events. + */ +export const globalEvent = (options?: Options) => (options?.client ?? client).sse.get({ url: '/global/event', ...options }); + +/** + * Dispose instance + * + * Clean up and dispose all OpenCode instances, releasing all resources. + */ +export const globalDispose = (options?: Options) => (options?.client ?? client).post({ url: '/global/dispose', ...options }); + +/** + * List all projects + * + * Get a list of projects that have been opened with OpenCode. + */ +export const projectList = (parameters?: { + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/project', + ...options, + ...params + }); +}; + +/** + * Get current project + * + * Retrieve the currently active project that OpenCode is working with. + */ +export const projectCurrent = (parameters?: { + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/project/current', + ...options, + ...params + }); +}; + +/** + * Update project + * + * Update project properties such as name, icon and color. + */ +export const projectUpdate = (parameters: { + projectID: string; + directory?: string; + name?: string; + icon?: { + url?: string; + color?: string; + }; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'projectID' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'name' }, + { in: 'body', key: 'icon' } + ] }]); + return (options?.client ?? client).patch({ + url: '/project/{projectID}', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); +}; + +/** + * List PTY sessions + * + * Get a list of all active pseudo-terminal (PTY) sessions managed by OpenCode. + */ +export const ptyList = (parameters?: { + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/pty', + ...options, + ...params + }); +}; + +/** + * Create PTY session + * + * Create a new pseudo-terminal (PTY) session for running shell commands and processes. + */ +export const ptyCreate = (parameters?: { + directory?: string; + command?: string; + args?: Array; + cwd?: string; + title?: string; + env?: { + [key: string]: string; + }; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [ + { in: 'query', key: 'directory' }, + { in: 'body', key: 'command' }, + { in: 'body', key: 'args' }, + { in: 'body', key: 'cwd' }, + { in: 'body', key: 'title' }, + { in: 'body', key: 'env' } + ] }]); + return (options?.client ?? client).post({ + url: '/pty', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); +}; + +/** + * Remove PTY session + * + * Remove and terminate a specific pseudo-terminal (PTY) session. + */ +export const ptyRemove = (parameters: { + ptyID: string; + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'ptyID' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).delete({ + url: '/pty/{ptyID}', + ...options, + ...params + }); +}; + +/** + * Get PTY session + * + * Retrieve detailed information about a specific pseudo-terminal (PTY) session. + */ +export const ptyGet = (parameters: { + ptyID: string; + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'ptyID' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/pty/{ptyID}', + ...options, + ...params + }); +}; + +/** + * Update PTY session + * + * Update properties of an existing pseudo-terminal (PTY) session. + */ +export const ptyUpdate = (parameters: { + ptyID: string; + directory?: string; + title?: string; + size?: { + rows: number; + cols: number; + }; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'ptyID' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'title' }, + { in: 'body', key: 'size' } + ] }]); + return (options?.client ?? client).put({ + url: '/pty/{ptyID}', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); +}; + +/** + * Connect to PTY session + * + * Establish a WebSocket connection to interact with a pseudo-terminal (PTY) session in real-time. + */ +export const ptyConnect = (parameters: { + ptyID: string; + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'ptyID' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/pty/{ptyID}/connect', + ...options, + ...params + }); +}; + +/** + * Get configuration + * + * Retrieve the current OpenCode configuration settings and preferences. + */ +export const configGet = (parameters?: { + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/config', + ...options, + ...params + }); +}; + +/** + * Update configuration + * + * Update OpenCode configuration settings and preferences. + */ +export const configUpdate = (parameters?: { + directory?: string; + config?: Config; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }, { key: 'config', map: 'body' }] }]); + return (options?.client ?? client).patch({ + url: '/config', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); +}; + +/** + * List tool IDs + * + * Get a list of all available tool IDs, including both built-in tools and dynamically registered tools. + */ +export const toolIds = (parameters?: { + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/experimental/tool/ids', + ...options, + ...params + }); +}; + +/** + * List tools + * + * Get a list of available tools with their JSON schema parameters for a specific provider and model combination. */ -export const eventSubscribe = (options?: Options) => (options?.client ?? client).sse.get({ url: '/event', ...options }); +export const toolList = (parameters: { + directory?: string; + provider: string; + model: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [ + { in: 'query', key: 'directory' }, + { in: 'query', key: 'provider' }, + { in: 'query', key: 'model' } + ] }]); + return (options?.client ?? client).get({ + url: '/experimental/tool', + ...options, + ...params + }); +}; /** - * Get app info + * Dispose instance + * + * Clean up and dispose the current OpenCode instance, releasing all resources. */ -export const appGet = (options?: Options) => (options?.client ?? client).get({ url: '/app', ...options }); +export const instanceDispose = (parameters?: { + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).post({ + url: '/instance/dispose', + ...options, + ...params + }); +}; /** - * Initialize the app + * Get paths + * + * Retrieve the current working directory and related path information for the OpenCode instance. */ -export const appInit = (options?: Options) => (options?.client ?? client).post({ url: '/app/init', ...options }); +export const pathGet = (parameters?: { + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/path', + ...options, + ...params + }); +}; /** - * Get config info + * Get VCS info + * + * Retrieve version control system (VCS) information for the current project, such as git branch. */ -export const configGet = (options?: Options) => (options?.client ?? client).get({ url: '/config', ...options }); +export const vcsGet = (parameters?: { + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/vcs', + ...options, + ...params + }); +}; /** - * List all sessions + * List sessions + * + * Get a list of all OpenCode sessions, sorted by most recently updated. */ -export const sessionList = (options?: Options) => (options?.client ?? client).get({ url: '/session', ...options }); +export const sessionList = (parameters?: { + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/session', + ...options, + ...params + }); +}; /** - * Create a new session + * Create session + * + * Create a new OpenCode session for interacting with AI assistants and managing conversations. */ export const sessionCreate = (parameters?: { + directory?: string; parentID?: string; title?: string; + permission?: PermissionRuleset; }, options?: Options) => { - const params = buildClientParams([parameters], [{ args: [{ in: 'body', key: 'parentID' }, { in: 'body', key: 'title' }] }]); + const params = buildClientParams([parameters], [{ args: [ + { in: 'query', key: 'directory' }, + { in: 'body', key: 'parentID' }, + { in: 'body', key: 'title' }, + { in: 'body', key: 'permission' } + ] }]); return (options?.client ?? client).post({ url: '/session', ...options, @@ -64,43 +407,741 @@ export const sessionCreate = (parameters?: }; /** - * Delete a session and all its data + * Get session status + * + * Retrieve the current status of all sessions, including active, idle, and completed states. + */ +export const sessionStatus = (parameters?: { + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/session/status', + ...options, + ...params + }); +}; + +/** + * Delete session + * + * Delete a session and permanently remove all associated data, including messages and history. + */ +export const sessionDelete = (parameters: { + sessionID: string; + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'sessionID' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).delete({ + url: '/session/{sessionID}', + ...options, + ...params + }); +}; + +/** + * Get session + * + * Retrieve detailed information about a specific OpenCode session. + */ +export const sessionGet = (parameters: { + sessionID: string; + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'sessionID' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/session/{sessionID}', + ...options, + ...params + }); +}; + +/** + * Update session + * + * Update properties of an existing session, such as title or other metadata. + */ +export const sessionUpdate = (parameters: { + sessionID: string; + directory?: string; + title?: string; + time?: { + archived?: number; + }; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'sessionID' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'title' }, + { in: 'body', key: 'time' } + ] }]); + return (options?.client ?? client).patch({ + url: '/session/{sessionID}', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); +}; + +/** + * Get session children + * + * Retrieve all child sessions that were forked from the specified parent session. + */ +export const sessionChildren = (parameters: { + sessionID: string; + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'sessionID' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/session/{sessionID}/children', + ...options, + ...params + }); +}; + +/** + * Get session todos + * + * Retrieve the todo list associated with a specific session, showing tasks and action items. + */ +export const sessionTodo = (parameters: { + sessionID: string; + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'sessionID' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/session/{sessionID}/todo', + ...options, + ...params + }); +}; + +/** + * Initialize session + * + * Analyze the current application and create an AGENTS.md file with project-specific agent configurations. + */ +export const sessionInit = (parameters: { + sessionID: string; + directory?: string; + modelID?: string; + providerID?: string; + messageID?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'sessionID' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'modelID' }, + { in: 'body', key: 'providerID' }, + { in: 'body', key: 'messageID' } + ] }]); + return (options?.client ?? client).post({ + url: '/session/{sessionID}/init', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); +}; + +/** + * Fork session + * + * Create a new session by forking an existing session at a specific message point. + */ +export const sessionFork = (parameters: { + sessionID: string; + directory?: string; + messageID?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'sessionID' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'messageID' } + ] }]); + return (options?.client ?? client).post({ + url: '/session/{sessionID}/fork', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); +}; + +/** + * Abort session + * + * Abort an active session and stop any ongoing AI processing or command execution. + */ +export const sessionAbort = (parameters: { + sessionID: string; + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'sessionID' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).post({ + url: '/session/{sessionID}/abort', + ...options, + ...params + }); +}; + +/** + * Unshare session + * + * Remove the shareable link for a session, making it private again. + */ +export const sessionUnshare = (parameters: { + sessionID: string; + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'sessionID' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).delete({ + url: '/session/{sessionID}/share', + ...options, + ...params + }); +}; + +/** + * Share session + * + * Create a shareable link for a session, allowing others to view the conversation. + */ +export const sessionShare = (parameters: { + sessionID: string; + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'sessionID' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).post({ + url: '/session/{sessionID}/share', + ...options, + ...params + }); +}; + +/** + * Get session diff + * + * Get all file changes (diffs) made during this session. + */ +export const sessionDiff = (parameters: { + sessionID: string; + directory?: string; + messageID?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'sessionID' }, + { in: 'query', key: 'directory' }, + { in: 'query', key: 'messageID' } + ] }]); + return (options?.client ?? client).get({ + url: '/session/{sessionID}/diff', + ...options, + ...params + }); +}; + +/** + * Summarize session + * + * Generate a concise summary of the session using AI compaction to preserve key information. + */ +export const sessionSummarize = (parameters: { + sessionID: string; + directory?: string; + providerID?: string; + modelID?: string; + auto?: boolean; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'sessionID' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'providerID' }, + { in: 'body', key: 'modelID' }, + { in: 'body', key: 'auto' } + ] }]); + return (options?.client ?? client).post({ + url: '/session/{sessionID}/summarize', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); +}; + +/** + * Get session messages + * + * Retrieve all messages in a session, including user prompts and AI responses. + */ +export const sessionMessages = (parameters: { + sessionID: string; + directory?: string; + limit?: number; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'sessionID' }, + { in: 'query', key: 'directory' }, + { in: 'query', key: 'limit' } + ] }]); + return (options?.client ?? client).get({ + url: '/session/{sessionID}/message', + ...options, + ...params + }); +}; + +/** + * Send message + * + * Create and send a new message to a session, streaming the AI response. + */ +export const sessionPrompt = (parameters: { + sessionID: string; + directory?: string; + messageID?: string; + model?: { + providerID: string; + modelID: string; + }; + agent?: string; + noReply?: boolean; + tools?: { + [key: string]: boolean; + }; + system?: string; + variant?: string; + parts?: Array; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'sessionID' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'messageID' }, + { in: 'body', key: 'model' }, + { in: 'body', key: 'agent' }, + { in: 'body', key: 'noReply' }, + { in: 'body', key: 'tools' }, + { in: 'body', key: 'system' }, + { in: 'body', key: 'variant' }, + { in: 'body', key: 'parts' } + ] }]); + return (options?.client ?? client).post({ + url: '/session/{sessionID}/message', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); +}; + +/** + * Get message + * + * Retrieve a specific message from a session by its message ID. + */ +export const sessionMessage = (parameters: { + sessionID: string; + messageID: string; + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'sessionID' }, + { in: 'path', key: 'messageID' }, + { in: 'query', key: 'directory' } + ] }]); + return (options?.client ?? client).get({ + url: '/session/{sessionID}/message/{messageID}', + ...options, + ...params + }); +}; + +/** + * Delete a part from a message + */ +export const partDelete = (parameters: { + sessionID: string; + messageID: string; + partID: string; + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'sessionID' }, + { in: 'path', key: 'messageID' }, + { in: 'path', key: 'partID' }, + { in: 'query', key: 'directory' } + ] }]); + return (options?.client ?? client).delete({ + url: '/session/{sessionID}/message/{messageID}/part/{partID}', + ...options, + ...params + }); +}; + +/** + * Update a part in a message + */ +export const partUpdate = (parameters: { + sessionID: string; + messageID: string; + partID: string; + directory?: string; + part?: Part; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'sessionID' }, + { in: 'path', key: 'messageID' }, + { in: 'path', key: 'partID' }, + { in: 'query', key: 'directory' }, + { key: 'part', map: 'body' } + ] }]); + return (options?.client ?? client).patch({ + url: '/session/{sessionID}/message/{messageID}/part/{partID}', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); +}; + +/** + * Send async message + * + * Create and send a new message to a session asynchronously, starting the session if needed and returning immediately. + */ +export const sessionPromptAsync = (parameters: { + sessionID: string; + directory?: string; + messageID?: string; + model?: { + providerID: string; + modelID: string; + }; + agent?: string; + noReply?: boolean; + tools?: { + [key: string]: boolean; + }; + system?: string; + variant?: string; + parts?: Array; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'sessionID' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'messageID' }, + { in: 'body', key: 'model' }, + { in: 'body', key: 'agent' }, + { in: 'body', key: 'noReply' }, + { in: 'body', key: 'tools' }, + { in: 'body', key: 'system' }, + { in: 'body', key: 'variant' }, + { in: 'body', key: 'parts' } + ] }]); + return (options?.client ?? client).post({ + url: '/session/{sessionID}/prompt_async', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); +}; + +/** + * Send command + * + * Send a new command to a session for execution by the AI assistant. + */ +export const sessionCommand = (parameters: { + sessionID: string; + directory?: string; + messageID?: string; + agent?: string; + model?: string; + arguments?: string; + command?: string; + variant?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'sessionID' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'messageID' }, + { in: 'body', key: 'agent' }, + { in: 'body', key: 'model' }, + { in: 'body', key: 'arguments' }, + { in: 'body', key: 'command' }, + { in: 'body', key: 'variant' } + ] }]); + return (options?.client ?? client).post({ + url: '/session/{sessionID}/command', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); +}; + +/** + * Run shell command + * + * Execute a shell command within the session context and return the AI's response. + */ +export const sessionShell = (parameters: { + sessionID: string; + directory?: string; + agent?: string; + model?: { + providerID: string; + modelID: string; + }; + command?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'sessionID' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'agent' }, + { in: 'body', key: 'model' }, + { in: 'body', key: 'command' } + ] }]); + return (options?.client ?? client).post({ + url: '/session/{sessionID}/shell', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); +}; + +/** + * Revert message + * + * Revert a specific message in a session, undoing its effects and restoring the previous state. + */ +export const sessionRevert = (parameters: { + sessionID: string; + directory?: string; + messageID?: string; + partID?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'sessionID' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'messageID' }, + { in: 'body', key: 'partID' } + ] }]); + return (options?.client ?? client).post({ + url: '/session/{sessionID}/revert', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); +}; + +/** + * Restore reverted messages + * + * Restore all previously reverted messages in a session. + */ +export const sessionUnrevert = (parameters: { + sessionID: string; + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'sessionID' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).post({ + url: '/session/{sessionID}/unrevert', + ...options, + ...params + }); +}; + +/** + * Respond to permission + * + * Approve or deny a permission request from the AI assistant. + * + * @deprecated + */ +export const permissionRespond = (parameters: { + sessionID: string; + permissionID: string; + directory?: string; + response?: 'once' | 'always' | 'reject'; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'sessionID' }, + { in: 'path', key: 'permissionID' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'response' } + ] }]); + return (options?.client ?? client).post({ + url: '/session/{sessionID}/permissions/{permissionID}', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); +}; + +/** + * Respond to permission request + * + * Approve or deny a permission request from the AI assistant. + */ +export const permissionReply = (parameters: { + requestID: string; + directory?: string; + reply?: 'once' | 'always' | 'reject'; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'requestID' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'reply' } + ] }]); + return (options?.client ?? client).post({ + url: '/permission/{requestID}/reply', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); +}; + +/** + * List pending permissions + * + * Get all pending permission requests across all sessions. + */ +export const permissionList = (parameters?: { + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/permission', + ...options, + ...params + }); +}; + +/** + * List commands + * + * Get a list of all available commands in the OpenCode system. + */ +export const commandList = (parameters?: { + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/command', + ...options, + ...params + }); +}; + +/** + * List config providers + * + * Get a list of all configured AI providers and their default models. + */ +export const configProviders = (parameters?: { + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/config/providers', + ...options, + ...params + }); +}; + +/** + * List providers + * + * Get a list of all available AI providers, including both available and connected ones. */ -export const sessionDelete = (parameters: { - id: string; +export const providerList = (parameters?: { + directory?: string; }, options?: Options) => { - const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'id' }] }]); - return (options?.client ?? client).delete({ - url: '/session/{id}', + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/provider', ...options, ...params }); }; /** - * Get session + * Get provider auth methods + * + * Retrieve available authentication methods for all AI providers. */ -export const sessionGet = (parameters: { - id: string; +export const providerAuth = (parameters?: { + directory?: string; }, options?: Options) => { - const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'id' }] }]); - return (options?.client ?? client).get({ - url: '/session/{id}', + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/provider/auth', ...options, ...params }); }; /** - * Update session properties + * OAuth authorize + * + * Initiate OAuth authorization for a specific AI provider to get an authorization URL. */ -export const sessionUpdate = (parameters: { - id: string; - title?: string; +export const providerOauthAuthorize = (parameters: { + providerID: string; + directory?: string; + method?: number; }, options?: Options) => { - const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'id' }, { in: 'body', key: 'title' }] }]); - return (options?.client ?? client).patch({ - url: '/session/{id}', + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'providerID' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'method' } + ] }]); + return (options?.client ?? client).post({ + url: '/provider/{providerID}/oauth/authorize', ...options, ...params, headers: { @@ -112,36 +1153,24 @@ export const sessionUpdate = (parameters: }; /** - * Get a session's children - */ -export const sessionChildren = (parameters: { - id: string; -}, options?: Options) => { - const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'id' }] }]); - return (options?.client ?? client).get({ - url: '/session/{id}/children', - ...options, - ...params - }); -}; - -/** - * Analyze the app and create an AGENTS.md file + * OAuth callback + * + * Handle the OAuth callback from a provider after user authorization. */ -export const sessionInit = (parameters: { - id: string; - messageID?: string; - providerID?: string; - modelID?: string; +export const providerOauthCallback = (parameters: { + providerID: string; + directory?: string; + method?: number; + code?: string; }, options?: Options) => { const params = buildClientParams([parameters], [{ args: [ - { in: 'path', key: 'id' }, - { in: 'body', key: 'messageID' }, - { in: 'body', key: 'providerID' }, - { in: 'body', key: 'modelID' } + { in: 'path', key: 'providerID' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'method' }, + { in: 'body', key: 'code' } ] }]); - return (options?.client ?? client).post({ - url: '/session/{id}/init', + return (options?.client ?? client).post({ + url: '/provider/{providerID}/oauth/callback', ...options, ...params, headers: { @@ -153,119 +1182,138 @@ export const sessionInit = (parameters: { }; /** - * Abort a session + * Find text + * + * Search for text patterns across files in the project using ripgrep. */ -export const sessionAbort = (parameters: { - id: string; +export const findText = (parameters: { + directory?: string; + pattern: string; }, options?: Options) => { - const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'id' }] }]); - return (options?.client ?? client).post({ - url: '/session/{id}/abort', + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }, { in: 'query', key: 'pattern' }] }]); + return (options?.client ?? client).get({ + url: '/find', ...options, ...params }); }; /** - * Unshare the session + * Find files + * + * Search for files or directories by name or pattern in the project directory. */ -export const sessionUnshare = (parameters: { - id: string; +export const findFiles = (parameters: { + directory?: string; + query: string; + dirs?: 'true' | 'false'; + type?: 'file' | 'directory'; + limit?: number; }, options?: Options) => { - const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'id' }] }]); - return (options?.client ?? client).delete({ - url: '/session/{id}/share', + const params = buildClientParams([parameters], [{ args: [ + { in: 'query', key: 'directory' }, + { in: 'query', key: 'query' }, + { in: 'query', key: 'dirs' }, + { in: 'query', key: 'type' }, + { in: 'query', key: 'limit' } + ] }]); + return (options?.client ?? client).get({ + url: '/find/file', ...options, ...params }); }; /** - * Share a session + * Find symbols + * + * Search for workspace symbols like functions, classes, and variables using LSP. */ -export const sessionShare = (parameters: { - id: string; +export const findSymbols = (parameters: { + directory?: string; + query: string; }, options?: Options) => { - const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'id' }] }]); - return (options?.client ?? client).post({ - url: '/session/{id}/share', + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }, { in: 'query', key: 'query' }] }]); + return (options?.client ?? client).get({ + url: '/find/symbol', ...options, ...params }); }; /** - * Summarize the session + * List files + * + * List files and directories in a specified path. */ -export const sessionSummarize = (parameters: { - id: string; - providerID?: string; - modelID?: string; +export const fileList = (parameters: { + directory?: string; + path: string; }, options?: Options) => { - const params = buildClientParams([parameters], [{ args: [ - { in: 'path', key: 'id' }, - { in: 'body', key: 'providerID' }, - { in: 'body', key: 'modelID' } - ] }]); - return (options?.client ?? client).post({ - url: '/session/{id}/summarize', + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }, { in: 'query', key: 'path' }] }]); + return (options?.client ?? client).get({ + url: '/file', ...options, - ...params, - headers: { - 'Content-Type': 'application/json', - ...options?.headers, - ...params.headers - } + ...params }); }; /** - * List messages for a session + * Read file + * + * Read the content of a specified file. */ -export const sessionMessages = (parameters: { - id: string; +export const fileRead = (parameters: { + directory?: string; + path: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }, { in: 'query', key: 'path' }] }]); + return (options?.client ?? client).get({ + url: '/file/content', + ...options, + ...params + }); +}; + +/** + * Get file status + * + * Get the git status of all files in the project. + */ +export const fileStatus = (parameters?: { + directory?: string; }, options?: Options) => { - const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'id' }] }]); - return (options?.client ?? client).get({ - url: '/session/{id}/message', + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/file/status', ...options, ...params }); }; /** - * Create and send a new message to a session + * Write log + * + * Write a log entry to the server logs with specified level and metadata. */ -export const sessionChat = (parameters: { - id: string; - messageID?: string; - providerID?: string; - modelID?: string; - agent?: string; - system?: string; - tools?: { - [key: string]: boolean; +export const appLog = (parameters?: { + directory?: string; + service?: string; + level?: 'debug' | 'info' | 'error' | 'warn'; + message?: string; + extra?: { + [key: string]: unknown; }; - parts?: Array<({ - type: 'text'; - } & TextPartInput) | ({ - type: 'file'; - } & FilePartInput) | ({ - type: 'agent'; - } & AgentPartInput)>; }, options?: Options) => { const params = buildClientParams([parameters], [{ args: [ - { in: 'path', key: 'id' }, - { in: 'body', key: 'messageID' }, - { in: 'body', key: 'providerID' }, - { in: 'body', key: 'modelID' }, - { in: 'body', key: 'agent' }, - { in: 'body', key: 'system' }, - { in: 'body', key: 'tools' }, - { in: 'body', key: 'parts' } + { in: 'query', key: 'directory' }, + { in: 'body', key: 'service' }, + { in: 'body', key: 'level' }, + { in: 'body', key: 'message' }, + { in: 'body', key: 'extra' } ] }]); - return (options?.client ?? client).post({ - url: '/session/{id}/message', + return (options?.client ?? client).post({ + url: '/log', ...options, ...params, headers: { @@ -277,60 +1325,54 @@ export const sessionChat = (parameters: { }; /** - * Get a message from a session + * List agents + * + * Get a list of all available AI agents in the OpenCode system. */ -export const sessionMessage = (parameters: { - id: string; - messageID: string; +export const appAgents = (parameters?: { + directory?: string; }, options?: Options) => { - const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'id' }, { in: 'path', key: 'messageID' }] }]); - return (options?.client ?? client).get({ - url: '/session/{id}/message/{messageID}', + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/agent', ...options, ...params }); }; /** - * Run a shell command + * Get MCP status + * + * Get the status of all Model Context Protocol (MCP) servers. */ -export const sessionShell = (parameters: { - id: string; - agent?: string; - command?: string; +export const mcpStatus = (parameters?: { + directory?: string; }, options?: Options) => { - const params = buildClientParams([parameters], [{ args: [ - { in: 'path', key: 'id' }, - { in: 'body', key: 'agent' }, - { in: 'body', key: 'command' } - ] }]); - return (options?.client ?? client).post({ - url: '/session/{id}/shell', + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/mcp', ...options, - ...params, - headers: { - 'Content-Type': 'application/json', - ...options?.headers, - ...params.headers - } + ...params }); }; /** - * Revert a message + * Add MCP server + * + * Dynamically add a new Model Context Protocol (MCP) server to the system. */ -export const sessionRevert = (parameters: { - id: string; - messageID?: string; - partID?: string; +export const mcpAdd = (parameters?: { + directory?: string; + name?: string; + config?: McpLocalConfig | McpRemoteConfig; }, options?: Options) => { const params = buildClientParams([parameters], [{ args: [ - { in: 'path', key: 'id' }, - { in: 'body', key: 'messageID' }, - { in: 'body', key: 'partID' } + { in: 'query', key: 'directory' }, + { in: 'body', key: 'name' }, + { in: 'body', key: 'config' } ] }]); - return (options?.client ?? client).post({ - url: '/session/{id}/revert', + return (options?.client ?? client).post({ + url: '/mcp', ...options, ...params, headers: { @@ -342,34 +1384,56 @@ export const sessionRevert = (parameters: }; /** - * Restore all reverted messages + * Remove MCP OAuth + * + * Remove OAuth credentials for an MCP server */ -export const sessionUnrevert = (parameters: { - id: string; +export const mcpAuthRemove = (parameters: { + name: string; + directory?: string; }, options?: Options) => { - const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'id' }] }]); - return (options?.client ?? client).post({ - url: '/session/{id}/unrevert', + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'name' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).delete({ + url: '/mcp/{name}/auth', ...options, ...params }); }; /** - * Respond to a permission request + * Start MCP OAuth + * + * Start OAuth authentication flow for a Model Context Protocol (MCP) server. */ -export const postSessionByIdPermissionsByPermissionId = (parameters: { - id: string; - permissionID: string; - response?: 'once' | 'always' | 'reject'; +export const mcpAuthStart = (parameters: { + name: string; + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'name' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).post({ + url: '/mcp/{name}/auth', + ...options, + ...params + }); +}; + +/** + * Complete MCP OAuth + * + * Complete OAuth authentication for a Model Context Protocol (MCP) server using the authorization code. + */ +export const mcpAuthCallback = (parameters: { + name: string; + directory?: string; + code?: string; }, options?: Options) => { const params = buildClientParams([parameters], [{ args: [ - { in: 'path', key: 'id' }, - { in: 'path', key: 'permissionID' }, - { in: 'body', key: 'response' } + { in: 'path', key: 'name' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'code' } ] }]); - return (options?.client ?? client).post({ - url: '/session/{id}/permissions/{permissionID}', + return (options?.client ?? client).post({ + url: '/mcp/{name}/auth/callback', ...options, ...params, headers: { @@ -381,113 +1445,95 @@ export const postSessionByIdPermissionsByPermissionId = (options?: Options) => (options?.client ?? client).get({ url: '/config/providers', ...options }); - -/** - * Find text in files - */ -export const findText = (parameters: { - pattern: string; +export const mcpAuthAuthenticate = (parameters: { + name: string; + directory?: string; }, options?: Options) => { - const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'pattern' }] }]); - return (options?.client ?? client).get({ - url: '/find', + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'name' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).post({ + url: '/mcp/{name}/auth/authenticate', ...options, ...params }); }; /** - * Find files + * Connect an MCP server */ -export const findFiles = (parameters: { - query: string; +export const mcpConnect = (parameters: { + name: string; + directory?: string; }, options?: Options) => { - const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'query' }] }]); - return (options?.client ?? client).get({ - url: '/find/file', + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'name' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).post({ + url: '/mcp/{name}/connect', ...options, ...params }); }; /** - * Find workspace symbols + * Disconnect an MCP server */ -export const findSymbols = (parameters: { - query: string; +export const mcpDisconnect = (parameters: { + name: string; + directory?: string; }, options?: Options) => { - const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'query' }] }]); - return (options?.client ?? client).get({ - url: '/find/symbol', + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'name' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).post({ + url: '/mcp/{name}/disconnect', ...options, ...params }); }; /** - * Read a file + * Get LSP status + * + * Get LSP server status */ -export const fileRead = (parameters: { - path: string; +export const lspStatus = (parameters?: { + directory?: string; }, options?: Options) => { - const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'path' }] }]); - return (options?.client ?? client).get({ - url: '/file', + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/lsp', ...options, ...params }); }; /** - * Get file status - */ -export const fileStatus = (options?: Options) => (options?.client ?? client).get({ url: '/file/status', ...options }); - -/** - * Write a log entry to the server logs + * Get formatter status + * + * Get formatter status */ -export const appLog = (parameters?: { - service?: string; - level?: 'debug' | 'info' | 'error' | 'warn'; - message?: string; - extra?: { - [key: string]: unknown; - }; +export const formatterStatus = (parameters?: { + directory?: string; }, options?: Options) => { - const params = buildClientParams([parameters], [{ args: [ - { in: 'body', key: 'service' }, - { in: 'body', key: 'level' }, - { in: 'body', key: 'message' }, - { in: 'body', key: 'extra' } - ] }]); - return (options?.client ?? client).post({ - url: '/log', + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/formatter', ...options, - ...params, - headers: { - 'Content-Type': 'application/json', - ...options?.headers, - ...params.headers - } + ...params }); }; /** - * List all agents - */ -export const appAgents = (options?: Options) => (options?.client ?? client).get({ url: '/agent', ...options }); - -/** + * Append TUI prompt + * * Append prompt to the TUI */ export const tuiAppendPrompt = (parameters?: { + directory?: string; text?: string; }, options?: Options) => { - const params = buildClientParams([parameters], [{ args: [{ in: 'body', key: 'text' }] }]); - return (options?.client ?? client).post({ + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }, { in: 'body', key: 'text' }] }]); + return (options?.client ?? client).post({ url: '/tui/append-prompt', ...options, ...params, @@ -500,43 +1546,112 @@ export const tuiAppendPrompt = (parameters }; /** - * Open the help dialog + * Open help dialog + * + * Open the help dialog in the TUI to display user assistance information. */ -export const tuiOpenHelp = (options?: Options) => (options?.client ?? client).post({ url: '/tui/open-help', ...options }); +export const tuiOpenHelp = (parameters?: { + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).post({ + url: '/tui/open-help', + ...options, + ...params + }); +}; /** + * Open sessions dialog + * * Open the session dialog */ -export const tuiOpenSessions = (options?: Options) => (options?.client ?? client).post({ url: '/tui/open-sessions', ...options }); +export const tuiOpenSessions = (parameters?: { + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).post({ + url: '/tui/open-sessions', + ...options, + ...params + }); +}; /** + * Open themes dialog + * * Open the theme dialog */ -export const tuiOpenThemes = (options?: Options) => (options?.client ?? client).post({ url: '/tui/open-themes', ...options }); +export const tuiOpenThemes = (parameters?: { + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).post({ + url: '/tui/open-themes', + ...options, + ...params + }); +}; /** + * Open models dialog + * * Open the model dialog */ -export const tuiOpenModels = (options?: Options) => (options?.client ?? client).post({ url: '/tui/open-models', ...options }); +export const tuiOpenModels = (parameters?: { + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).post({ + url: '/tui/open-models', + ...options, + ...params + }); +}; /** + * Submit TUI prompt + * * Submit the prompt */ -export const tuiSubmitPrompt = (options?: Options) => (options?.client ?? client).post({ url: '/tui/submit-prompt', ...options }); +export const tuiSubmitPrompt = (parameters?: { + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).post({ + url: '/tui/submit-prompt', + ...options, + ...params + }); +}; /** + * Clear TUI prompt + * * Clear the prompt */ -export const tuiClearPrompt = (options?: Options) => (options?.client ?? client).post({ url: '/tui/clear-prompt', ...options }); +export const tuiClearPrompt = (parameters?: { + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).post({ + url: '/tui/clear-prompt', + ...options, + ...params + }); +}; /** + * Execute TUI command + * * Execute a TUI command (e.g. agent_cycle) */ export const tuiExecuteCommand = (parameters?: { + directory?: string; command?: string; }, options?: Options) => { - const params = buildClientParams([parameters], [{ args: [{ in: 'body', key: 'command' }] }]); - return (options?.client ?? client).post({ + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }, { in: 'body', key: 'command' }] }]); + return (options?.client ?? client).post({ url: '/tui/execute-command', ...options, ...params, @@ -549,17 +1664,23 @@ export const tuiExecuteCommand = (paramete }; /** + * Show TUI toast + * * Show a toast notification in the TUI */ export const tuiShowToast = (parameters?: { + directory?: string; title?: string; message?: string; variant?: 'info' | 'success' | 'warning' | 'error'; + duration?: number; }, options?: Options) => { const params = buildClientParams([parameters], [{ args: [ + { in: 'query', key: 'directory' }, { in: 'body', key: 'title' }, { in: 'body', key: 'message' }, - { in: 'body', key: 'variant' } + { in: 'body', key: 'variant' }, + { in: 'body', key: 'duration' } ] }]); return (options?.client ?? client).post({ url: '/tui/show-toast', @@ -574,15 +1695,82 @@ export const tuiShowToast = (parameters?: }; /** + * Publish TUI event + * + * Publish a TUI event + */ +export const tuiPublish = (parameters?: { + directory?: string; + body?: EventTuiPromptAppend | EventTuiCommandExecute | EventTuiToastShow; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }, { in: 'body' }] }]); + return (options?.client ?? client).post({ + url: '/tui/publish', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); +}; + +/** + * Get next TUI request + * + * Retrieve the next TUI (Terminal User Interface) request from the queue for processing. + */ +export const tuiControlNext = (parameters?: { + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).get({ + url: '/tui/control/next', + ...options, + ...params + }); +}; + +/** + * Submit TUI response + * + * Submit a response to the TUI request queue to complete a pending request. + */ +export const tuiControlResponse = (parameters?: { + directory?: string; + body?: unknown; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }, { in: 'body' }] }]); + return (options?.client ?? client).post({ + url: '/tui/control/response', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); +}; + +/** + * Set auth credentials + * * Set authentication credentials */ export const authSet = (parameters: { - id: string; + providerID: string; + directory?: string; auth?: Auth; }, options?: Options) => { - const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'id' }, { key: 'auth', map: 'body' }] }]); + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'providerID' }, + { in: 'query', key: 'directory' }, + { key: 'auth', map: 'body' } + ] }]); return (options?.client ?? client).put({ - url: '/auth/{id}', + url: '/auth/{providerID}', ...options, ...params, headers: { @@ -592,3 +1780,19 @@ export const authSet = (parameters: { } }); }; + +/** + * Subscribe to events + * + * Get events + */ +export const eventSubscribe = (parameters?: { + directory?: string; +}, options?: Options) => { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? client).sse.get({ + url: '/event', + ...options, + ...params + }); +}; diff --git a/packages/openapi-ts-tests/sdks/__snapshots__/opencode/flat/types.gen.ts b/packages/openapi-ts-tests/sdks/__snapshots__/opencode/flat/types.gen.ts index ccd376c4b..e1be81f3e 100644 --- a/packages/openapi-ts-tests/sdks/__snapshots__/opencode/flat/types.gen.ts +++ b/packages/openapi-ts-tests/sdks/__snapshots__/opencode/flat/types.gen.ts @@ -4,42 +4,6 @@ export type ClientOptions = { baseUrl: `${string}://${string}` | (string & {}); }; -export type Event = ({ - type: 'installation.updated'; -} & EventInstallationUpdated) | ({ - type: 'lsp.client.diagnostics'; -} & EventLspClientDiagnostics) | ({ - type: 'message.updated'; -} & EventMessageUpdated) | ({ - type: 'message.removed'; -} & EventMessageRemoved) | ({ - type: 'message.part.updated'; -} & EventMessagePartUpdated) | ({ - type: 'message.part.removed'; -} & EventMessagePartRemoved) | ({ - type: 'storage.write'; -} & EventStorageWrite) | ({ - type: 'permission.updated'; -} & EventPermissionUpdated) | ({ - type: 'permission.replied'; -} & EventPermissionReplied) | ({ - type: 'file.edited'; -} & EventFileEdited) | ({ - type: 'session.updated'; -} & EventSessionUpdated) | ({ - type: 'session.deleted'; -} & EventSessionDeleted) | ({ - type: 'session.idle'; -} & EventSessionIdle) | ({ - type: 'session.error'; -} & EventSessionError) | ({ - type: 'server.connected'; -} & EventServerConnected) | ({ - type: 'file.watcher.updated'; -} & EventFileWatcherUpdated) | ({ - type: 'ide.installed'; -} & EventIdeInstalled); - export type EventInstallationUpdated = { type: 'installation.updated'; properties: { @@ -47,6 +11,41 @@ export type EventInstallationUpdated = { }; }; +export type EventInstallationUpdateAvailable = { + type: 'installation.update-available'; + properties: { + version: string; + }; +}; + +export type Project = { + id: string; + worktree: string; + vcs?: 'git'; + name?: string; + icon?: { + url?: string; + color?: string; + }; + time: { + created: number; + updated: number; + initialized?: number; + }; +}; + +export type EventProjectUpdated = { + type: 'project.updated'; + properties: Project; +}; + +export type EventServerInstanceDisposed = { + type: 'server.instance.disposed'; + properties: { + directory: string; + }; +}; + export type EventLspClientDiagnostics = { type: 'lsp.client.diagnostics'; properties: { @@ -55,18 +54,20 @@ export type EventLspClientDiagnostics = { }; }; -export type EventMessageUpdated = { - type: 'message.updated'; +export type EventLspUpdated = { + type: 'lsp.updated'; properties: { - info: Message; + [key: string]: unknown; }; }; -export type Message = ({ - role: 'user'; -} & UserMessage) | ({ - role: 'assistant'; -} & AssistantMessage); +export type FileDiff = { + file: string; + before: string; + after: string; + additions: number; + deletions: number; +}; export type UserMessage = { id: string; @@ -75,6 +76,66 @@ export type UserMessage = { time: { created: number; }; + summary?: { + title?: string; + body?: string; + diffs: Array; + }; + agent: string; + model: { + providerID: string; + modelID: string; + }; + system?: string; + tools?: { + [key: string]: boolean; + }; + variant?: string; +}; + +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 ApiError = { + name: 'APIError'; + data: { + message: string; + statusCode?: number; + isRetryable: boolean; + responseHeaders?: { + [key: string]: string; + }; + responseBody?: string; + metadata?: { + [key: string]: string; + }; + }; }; export type AssistantMessage = { @@ -85,19 +146,12 @@ export type AssistantMessage = { created: number; completed?: number; }; - error?: ({ - name: 'ProviderAuthError'; - } & ProviderAuthError) | ({ - name: 'UnknownError'; - } & UnknownError) | ({ - name: 'MessageOutputLengthError'; - } & MessageOutputLengthError) | ({ - name: 'MessageAbortedError'; - } & MessageAbortedError); - system: Array; + error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError | ApiError; + parentID: string; modelID: string; providerID: string; mode: string; + agent: string; path: { cwd: string; root: string; @@ -113,34 +167,15 @@ export type AssistantMessage = { write: number; }; }; + finish?: string; }; -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 Message = UserMessage | AssistantMessage; -export type MessageAbortedError = { - name: 'MessageAbortedError'; - data: { - [key: string]: unknown; +export type EventMessageUpdated = { + type: 'message.updated'; + properties: { + info: Message; }; }; @@ -152,33 +187,6 @@ export type EventMessageRemoved = { }; }; -export type EventMessagePartUpdated = { - type: 'message.part.updated'; - properties: { - part: Part; - }; -}; - -export type Part = ({ - type: 'text'; -} & TextPart) | ({ - type: 'reasoning'; -} & ReasoningPart) | ({ - type: 'file'; -} & FilePart) | ({ - type: 'tool'; -} & ToolPart) | ({ - type: 'step-start'; -} & StepStartPart) | ({ - type: 'step-finish'; -} & StepFinishPart) | ({ - type: 'snapshot'; -} & SnapshotPart) | ({ - type: 'patch'; -} & PatchPart) | ({ - type: 'agent'; -} & AgentPart); - export type TextPart = { id: string; sessionID: string; @@ -186,10 +194,14 @@ export type TextPart = { type: 'text'; text: string; synthetic?: boolean; + ignored?: boolean; time?: { start: number; end?: number; }; + metadata?: { + [key: string]: unknown; + }; }; export type ReasoningPart = { @@ -207,42 +219,16 @@ export type ReasoningPart = { }; }; -export type FilePart = { - id: string; - sessionID: string; - messageID: string; - type: 'file'; - mime: string; - filename?: string; - url: string; - source?: FilePartSource; -}; - -export type FilePartSource = ({ - type: 'file'; -} & FileSource) | ({ - type: 'symbol'; -} & SymbolSource); - -export type FileSource = { - text: FilePartSourceText; - type: 'file'; - path: string; -}; - export type FilePartSourceText = { value: string; start: number; end: number; }; -export type SymbolSource = { +export type FileSource = { text: FilePartSourceText; - type: 'symbol'; + type: 'file'; path: string; - range: Range; - name: string; - kind: number; }; export type Range = { @@ -256,33 +242,41 @@ export type Range = { }; }; -export type ToolPart = { +export type SymbolSource = { + text: FilePartSourceText; + type: 'symbol'; + path: string; + range: Range; + name: string; + kind: number; +}; + +export type FilePartSource = FileSource | SymbolSource; + +export type FilePart = { id: string; sessionID: string; messageID: string; - type: 'tool'; - callID: string; - tool: string; - state: ToolState; + type: 'file'; + mime: string; + filename?: string; + url: string; + source?: FilePartSource; }; -export type ToolState = ({ - status: 'pending'; -} & ToolStatePending) | ({ - status: 'running'; -} & ToolStateRunning) | ({ - status: 'completed'; -} & ToolStateCompleted) | ({ - status: 'error'; -} & ToolStateError); - export type ToolStatePending = { status: 'pending'; + input: { + [key: string]: unknown; + }; + raw: string; }; export type ToolStateRunning = { status: 'running'; - input?: unknown; + input: { + [key: string]: unknown; + }; title?: string; metadata?: { [key: string]: unknown; @@ -305,7 +299,9 @@ export type ToolStateCompleted = { time: { start: number; end: number; + compacted?: number; }; + attachments?: Array; }; export type ToolStateError = { @@ -323,11 +319,27 @@ export type ToolStateError = { }; }; +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 = { @@ -335,6 +347,8 @@ export type StepFinishPart = { sessionID: string; messageID: string; type: 'step-finish'; + reason: string; + snapshot?: string; cost: number; tokens: { input: number; @@ -377,70 +391,215 @@ export type AgentPart = { }; }; -export type EventMessagePartRemoved = { - type: 'message.part.removed'; - properties: { - sessionID: string; - messageID: string; - partID: string; +export type RetryPart = { + id: string; + sessionID: string; + messageID: string; + type: 'retry'; + attempt: number; + error: ApiError; + time: { + created: number; }; }; -export type EventStorageWrite = { - type: 'storage.write'; +export type CompactionPart = { + id: string; + sessionID: string; + messageID: string; + type: 'compaction'; + auto: boolean; +}; + +export type Part = TextPart | { + id: string; + sessionID: string; + messageID: string; + type: 'subtask'; + prompt: string; + description: string; + agent: string; + command?: string; +} | ReasoningPart | FilePart | ToolPart | StepStartPart | StepFinishPart | SnapshotPart | PatchPart | AgentPart | RetryPart | CompactionPart; + +export type EventMessagePartUpdated = { + type: 'message.part.updated'; properties: { - key: string; - content?: unknown; + part: Part; + delta?: string; }; }; -export type EventPermissionUpdated = { - type: 'permission.updated'; - properties: Permission; +export type EventMessagePartRemoved = { + type: 'message.part.removed'; + properties: { + sessionID: string; + messageID: string; + partID: string; + }; }; -export type Permission = { +export type PermissionRequest = { id: string; - type: string; - pattern?: string; sessionID: string; - messageID: string; - callID?: string; - title: string; + permission: string; + patterns: Array; metadata: { [key: string]: unknown; }; - time: { - created: number; + always: Array; + tool?: { + messageID: string; + callID: string; }; }; +export type EventPermissionAsked = { + type: 'permission.asked'; + properties: PermissionRequest; +}; + export type EventPermissionReplied = { type: 'permission.replied'; properties: { sessionID: string; - permissionID: string; - response: string; + requestID: string; + reply: 'once' | 'always' | 'reject'; }; }; -export type EventFileEdited = { - type: 'file.edited'; +export type SessionStatus = { + type: 'idle'; +} | { + type: 'retry'; + attempt: number; + message: string; + next: number; +} | { + type: 'busy'; +}; + +export type EventSessionStatus = { + type: 'session.status'; properties: { - file: string; + sessionID: string; + status: SessionStatus; }; }; -export type EventSessionUpdated = { - type: 'session.updated'; +export type EventSessionIdle = { + type: 'session.idle'; properties: { - info: Session; + sessionID: string; + }; +}; + +export type EventSessionCompacted = { + type: 'session.compacted'; + properties: { + sessionID: string; + }; +}; + +export type EventFileEdited = { + type: 'file.edited'; + properties: { + file: 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; + /** + * Unique identifier for the todo item + */ + id: string; +}; + +export type EventTodoUpdated = { + type: 'todo.updated'; + properties: { + sessionID: string; + todos: Array; }; }; +export type EventTuiPromptAppend = { + type: 'tui.prompt.append'; + properties: { + text: string; + }; +}; + +export type EventTuiCommandExecute = { + type: 'tui.command.execute'; + properties: { + command: 'session.list' | 'session.new' | 'session.share' | 'session.interrupt' | 'session.compact' | 'session.page.up' | 'session.page.down' | 'session.half.page.up' | 'session.half.page.down' | 'session.first' | 'session.last' | 'prompt.clear' | 'prompt.submit' | 'agent.cycle' | string; + }; +}; + +export type EventTuiToastShow = { + type: 'tui.toast.show'; + properties: { + title?: string; + message: string; + variant: 'info' | 'success' | 'warning' | 'error'; + /** + * Duration in milliseconds + */ + duration?: number; + }; +}; + +export type EventMcpToolsChanged = { + type: 'mcp.tools.changed'; + properties: { + server: string; + }; +}; + +export type EventCommandExecuted = { + type: 'command.executed'; + properties: { + name: string; + sessionID: string; + arguments: string; + messageID: string; + }; +}; + +export type PermissionAction = 'allow' | 'deny' | 'ask'; + +export type PermissionRule = { + permission: string; + pattern: string; + action: PermissionAction; +}; + +export type PermissionRuleset = Array; + export type Session = { id: string; + projectID: string; + directory: string; parentID?: string; + summary?: { + additions: number; + deletions: number; + files: number; + diffs?: Array; + }; share?: { url: string; }; @@ -449,7 +608,10 @@ export type Session = { time: { created: number; updated: number; + compacting?: number; + archived?: number; }; + permission?: PermissionRuleset; revert?: { messageID: string; partID?: string; @@ -458,6 +620,20 @@ export type Session = { }; }; +export type EventSessionCreated = { + type: 'session.created'; + properties: { + info: Session; + }; +}; + +export type EventSessionUpdated = { + type: 'session.updated'; + properties: { + info: Session; + }; +}; + export type EventSessionDeleted = { type: 'session.deleted'; properties: { @@ -465,10 +641,11 @@ export type EventSessionDeleted = { }; }; -export type EventSessionIdle = { - type: 'session.idle'; +export type EventSessionDiff = { + type: 'session.diff'; properties: { sessionID: string; + diff: Array; }; }; @@ -476,442 +653,516 @@ export type EventSessionError = { type: 'session.error'; properties: { sessionID?: string; - error?: ({ - name: 'ProviderAuthError'; - } & ProviderAuthError) | ({ - name: 'UnknownError'; - } & UnknownError) | ({ - name: 'MessageOutputLengthError'; - } & MessageOutputLengthError) | ({ - name: 'MessageAbortedError'; - } & MessageAbortedError); + error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError | ApiError; }; }; -export type EventServerConnected = { - type: 'server.connected'; +export type EventFileWatcherUpdated = { + type: 'file.watcher.updated'; properties: { - [key: string]: unknown; + file: string; + event: 'add' | 'change' | 'unlink'; }; }; -export type EventFileWatcherUpdated = { - type: 'file.watcher.updated'; +export type EventVcsBranchUpdated = { + type: 'vcs.branch.updated'; properties: { - file: string; - event: 'rename' | 'change'; + branch?: string; }; }; -export type EventIdeInstalled = { - type: 'ide.installed'; +export type Pty = { + id: string; + title: string; + command: string; + args: Array; + cwd: string; + status: 'running' | 'exited'; + pid: number; +}; + +export type EventPtyCreated = { + type: 'pty.created'; properties: { - ide: string; + info: Pty; }; }; -export type App = { - hostname: string; - git: boolean; - path: { - config: string; - data: string; - root: string; - cwd: string; - state: string; +export type EventPtyUpdated = { + type: 'pty.updated'; + properties: { + info: Pty; }; - time: { - initialized?: number; +}; + +export type EventPtyExited = { + type: 'pty.exited'; + properties: { + id: string; + exitCode: number; }; }; -export type Config = { +export type EventPtyDeleted = { + type: 'pty.deleted'; + properties: { + id: string; + }; +}; + +export type EventServerConnected = { + type: 'server.connected'; + properties: { + [key: string]: unknown; + }; +}; + +export type EventGlobalDisposed = { + type: 'global.disposed'; + properties: { + [key: string]: unknown; + }; +}; + +export type Event = EventInstallationUpdated | EventInstallationUpdateAvailable | EventProjectUpdated | EventServerInstanceDisposed | EventLspClientDiagnostics | EventLspUpdated | EventMessageUpdated | EventMessageRemoved | EventMessagePartUpdated | EventMessagePartRemoved | EventPermissionAsked | EventPermissionReplied | EventSessionStatus | EventSessionIdle | EventSessionCompacted | EventFileEdited | EventTodoUpdated | EventTuiPromptAppend | EventTuiCommandExecute | EventTuiToastShow | EventMcpToolsChanged | EventCommandExecuted | EventSessionCreated | EventSessionUpdated | EventSessionDeleted | EventSessionDiff | EventSessionError | EventFileWatcherUpdated | EventVcsBranchUpdated | EventPtyCreated | EventPtyUpdated | EventPtyExited | EventPtyDeleted | EventServerConnected | EventGlobalDisposed; + +export type GlobalEvent = { + directory: string; + payload: Event; +}; + +export type BadRequestError = { + data: unknown; + errors: Array<{ + [key: string]: unknown; + }>; + success: false; +}; + +export type NotFoundError = { + name: 'NotFoundError'; + data: { + message: string; + }; +}; + +/** + * Custom keybind configurations + */ +export type KeybindsConfig = { /** - * JSON schema reference for configuration validation + * Leader key for keybind combinations */ - $schema?: string; + leader?: string; /** - * Theme name to use for the interface + * Exit the application */ - theme?: string; + app_exit?: string; /** - * Custom keybind configurations + * Open external editor */ - keybinds?: KeybindsConfig; + editor_open?: string; /** - * TUI specific settings + * List available themes */ - tui?: { - /** - * TUI scroll speed - */ - scroll_speed: number; - }; - plugin?: Array; - snapshot?: boolean; + theme_list?: string; /** - * Control sharing behavior:'manual' allows manual sharing via commands, 'auto' enables automatic sharing, 'disabled' disables all sharing + * Toggle sidebar */ - share?: 'manual' | 'auto' | 'disabled'; + sidebar_toggle?: string; /** - * @deprecated Use 'share' field instead. Share newly created sessions automatically + * Toggle session scrollbar */ - autoshare?: boolean; + scrollbar_toggle?: string; /** - * Automatically update to the latest version + * Toggle username visibility */ - autoupdate?: boolean; + username_toggle?: string; /** - * Disable providers that are loaded automatically + * View status */ - disabled_providers?: Array; + status_view?: string; /** - * Model to use in the format of provider/model, eg anthropic/claude-2 + * Export session to editor */ - model?: string; + session_export?: string; /** - * Small model to use for tasks like title generation in the format of provider/model + * Create a new session */ - small_model?: string; + session_new?: string; /** - * Custom username to display in conversations instead of system username + * List all sessions */ - username?: string; + session_list?: string; /** - * @deprecated Use `agent` field instead. + * Show session timeline */ - mode?: { - build?: AgentConfig; - plan?: AgentConfig; - [key: string]: AgentConfig | undefined; - }; + session_timeline?: string; /** - * Agent configuration, see https://opencode.ai/docs/agent + * Fork session from message */ - agent?: { - plan?: AgentConfig; - build?: AgentConfig; - general?: AgentConfig; - [key: string]: AgentConfig | undefined; - }; + session_fork?: string; /** - * Custom provider configurations and model overrides + * Rename session */ - provider?: { - [key: string]: { - api?: string; - name?: string; - env?: Array; - id?: string; - npm?: string; - models?: { - [key: string]: { - id?: string; - name?: string; - release_date?: string; - attachment?: boolean; - reasoning?: boolean; - temperature?: boolean; - tool_call?: boolean; - cost?: { - input: number; - output: number; - cache_read?: number; - cache_write?: number; - }; - limit?: { - context: number; - output: number; - }; - options?: { - [key: string]: unknown; - }; - }; - }; - options?: { - apiKey?: string; - baseURL?: string; - [key: string]: unknown | string | undefined; - }; - }; - }; + session_rename?: string; /** - * MCP (Model Context Protocol) server configurations + * Share current session */ - mcp?: { - [key: string]: ({ - type: 'local'; - } & McpLocalConfig) | ({ - type: 'remote'; - } & McpRemoteConfig); - }; - formatter?: { - [key: string]: { - disabled?: boolean; - command?: Array; - environment?: { - [key: string]: string; - }; - extensions?: Array; - }; - }; - lsp?: { - [key: string]: { - disabled: true; - } | { - command: Array; - extensions?: Array; - disabled?: boolean; - env?: { - [key: string]: string; - }; - initialization?: { - [key: string]: unknown; - }; - }; - }; + session_share?: string; /** - * Additional instruction files or patterns to include + * Unshare current session */ - instructions?: Array; + session_unshare?: string; /** - * @deprecated Always uses stretch layout. + * Interrupt current session */ - layout?: LayoutConfig; - permission?: { - edit?: 'ask' | 'allow' | 'deny'; - bash?: 'ask' | 'allow' | 'deny' | { - [key: string]: 'ask' | 'allow' | 'deny'; - }; - webfetch?: 'ask' | 'allow' | 'deny'; - }; - tools?: { - [key: string]: boolean; - }; - experimental?: { - hook?: { - file_edited?: { - [key: string]: Array<{ - command: Array; - environment?: { - [key: string]: string; - }; - }>; - }; - session_completed?: Array<{ - command: Array; - environment?: { - [key: string]: string; - }; - }>; - }; - }; -}; - -export type KeybindsConfig = { + session_interrupt?: string; /** - * Leader key for keybind combinations + * Compact the session */ - leader: string; + session_compact?: string; /** - * Show help dialog + * Scroll messages up by one page */ - app_help: string; + messages_page_up?: string; /** - * Exit the application + * Scroll messages down by one page */ - app_exit: string; + messages_page_down?: string; /** - * Open external editor + * Scroll messages up by half page */ - editor_open: string; + messages_half_page_up?: string; /** - * List available themes + * Scroll messages down by half page */ - theme_list: string; + messages_half_page_down?: string; /** - * Create/update AGENTS.md + * Navigate to first message */ - project_init: string; + messages_first?: string; /** - * Toggle tool details + * Navigate to last message */ - tool_details: string; + messages_last?: string; /** - * Toggle thinking blocks + * Navigate to next message */ - thinking_blocks: string; + messages_next?: string; /** - * Export session to editor + * Navigate to previous message */ - session_export: string; + messages_previous?: string; /** - * Create a new session + * Navigate to last user message */ - session_new: string; + messages_last_user?: string; /** - * List all sessions + * Copy message */ - session_list: string; + messages_copy?: string; /** - * Show session timeline + * Undo message */ - session_timeline: string; + messages_undo?: string; /** - * Share current session + * Redo message */ - session_share: string; + messages_redo?: string; /** - * Unshare current session + * Toggle code block concealment in messages */ - session_unshare: string; + messages_toggle_conceal?: string; /** - * Interrupt current session + * Toggle tool details visibility */ - session_interrupt: string; + tool_details?: string; /** - * Compact the session + * List available models */ - session_compact: string; + model_list?: string; /** - * Cycle to next child session + * Next recently used model */ - session_child_cycle: string; + model_cycle_recent?: string; /** - * Cycle to previous child session + * Previous recently used model */ - session_child_cycle_reverse: string; + model_cycle_recent_reverse?: string; /** - * Scroll messages up by one page + * Next favorite model */ - messages_page_up: string; + model_cycle_favorite?: string; /** - * Scroll messages down by one page + * Previous favorite model */ - messages_page_down: string; + model_cycle_favorite_reverse?: string; /** - * Scroll messages up by half page + * List available commands */ - messages_half_page_up: string; + command_list?: string; /** - * Scroll messages down by half page + * List agents */ - messages_half_page_down: string; + agent_list?: string; /** - * Navigate to first message + * Next agent */ - messages_first: string; + agent_cycle?: string; /** - * Navigate to last message + * Previous agent */ - messages_last: string; + agent_cycle_reverse?: string; /** - * Copy message + * Cycle model variants */ - messages_copy: string; + variant_cycle?: string; /** - * Undo message + * Clear input field */ - messages_undo: string; + input_clear?: string; /** - * Redo message + * Paste from clipboard */ - messages_redo: string; + input_paste?: string; /** - * List available models + * Submit input */ - model_list: string; + input_submit?: string; /** - * Next recent model + * Insert newline in input */ - model_cycle_recent: string; + input_newline?: string; /** - * Previous recent model + * Move cursor left in input */ - model_cycle_recent_reverse: string; + input_move_left?: string; /** - * List agents + * Move cursor right in input */ - agent_list: string; + input_move_right?: string; /** - * Next agent + * Move cursor up in input */ - agent_cycle: string; + input_move_up?: string; /** - * Previous agent + * Move cursor down in input */ - agent_cycle_reverse: string; + input_move_down?: string; /** - * Clear input field + * Select left in input */ - input_clear: string; + input_select_left?: string; /** - * Paste from clipboard + * Select right in input */ - input_paste: string; + input_select_right?: string; /** - * Submit input + * Select up in input */ - input_submit: string; + input_select_up?: string; /** - * Insert newline in input + * Select down in input + */ + input_select_down?: string; + /** + * Move to start of line in input + */ + input_line_home?: string; + /** + * Move to end of line in input + */ + input_line_end?: string; + /** + * Select to start of line in input + */ + input_select_line_home?: string; + /** + * Select to end of line in input + */ + input_select_line_end?: string; + /** + * Move to start of visual line in input + */ + input_visual_line_home?: string; + /** + * Move to end of visual line in input + */ + input_visual_line_end?: string; + /** + * Select to start of visual line in input + */ + input_select_visual_line_home?: string; + /** + * Select to end of visual line in input + */ + input_select_visual_line_end?: string; + /** + * Move to start of buffer in input + */ + input_buffer_home?: string; + /** + * Move to end of buffer in input + */ + input_buffer_end?: string; + /** + * Select to start of buffer in input + */ + input_select_buffer_home?: string; + /** + * Select to end of buffer in input + */ + input_select_buffer_end?: string; + /** + * Delete line in input + */ + input_delete_line?: string; + /** + * Delete to end of line in input + */ + input_delete_to_line_end?: string; + /** + * Delete to start of line in input + */ + input_delete_to_line_start?: string; + /** + * Backspace in input + */ + input_backspace?: string; + /** + * Delete character in input + */ + input_delete?: string; + /** + * Undo in input + */ + input_undo?: string; + /** + * Redo in input + */ + input_redo?: string; + /** + * Move word forward in input + */ + input_word_forward?: string; + /** + * Move word backward in input + */ + input_word_backward?: string; + /** + * Select word forward in input + */ + input_select_word_forward?: string; + /** + * Select word backward in input + */ + input_select_word_backward?: string; + /** + * Delete word forward in input + */ + input_delete_word_forward?: string; + /** + * Delete word backward in input */ - input_newline: string; + input_delete_word_backward?: string; /** - * @deprecated use agent_cycle. Next mode + * Previous history item */ - switch_mode: string; + history_previous?: string; /** - * @deprecated use agent_cycle_reverse. Previous mode + * Next history item */ - switch_mode_reverse: string; + history_next?: string; /** - * @deprecated use agent_cycle. Next agent + * Next child session */ - switch_agent: string; + session_child_cycle?: string; /** - * @deprecated use agent_cycle_reverse. Previous agent + * Previous child session */ - switch_agent_reverse: string; + session_child_cycle_reverse?: string; /** - * @deprecated Currently not available. List files + * Go to parent session */ - file_list: string; + session_parent?: string; /** - * @deprecated Close file + * Suspend terminal */ - file_close: string; + terminal_suspend?: string; /** - * @deprecated Search file + * Toggle terminal title */ - file_search: string; + terminal_title_toggle?: string; /** - * @deprecated Split/unified diff + * Toggle tips on home screen */ - file_diff_toggle: string; + tips_toggle?: string; +}; + +/** + * Log level + */ +export type LogLevel = 'DEBUG' | 'INFO' | 'WARN' | 'ERROR'; + +/** + * Server configuration for opencode serve and web commands + */ +export type ServerConfig = { /** - * @deprecated Navigate to previous message + * Port to listen on */ - messages_previous: string; + port?: number; /** - * @deprecated Navigate to next message + * Hostname to listen on */ - messages_next: string; + hostname?: string; /** - * @deprecated Toggle layout + * Enable mDNS service discovery */ - messages_layout_toggle: string; + mdns?: boolean; /** - * @deprecated use messages_undo. Revert message + * Additional domains to allow for CORS */ - messages_revert: string; + cors?: Array; +}; + +export type PermissionActionConfig = 'ask' | 'allow' | 'deny'; + +export type PermissionObjectConfig = { + [key: string]: PermissionActionConfig; }; +export type PermissionRuleConfig = PermissionActionConfig | PermissionObjectConfig; + +export type PermissionConfig = { + read?: PermissionRuleConfig; + edit?: PermissionRuleConfig; + glob?: PermissionRuleConfig; + grep?: PermissionRuleConfig; + list?: PermissionRuleConfig; + bash?: PermissionRuleConfig; + task?: PermissionRuleConfig; + external_directory?: PermissionRuleConfig; + todowrite?: PermissionActionConfig; + todoread?: PermissionActionConfig; + webfetch?: PermissionActionConfig; + websearch?: PermissionActionConfig; + codesearch?: PermissionActionConfig; + lsp?: PermissionRuleConfig; + doom_loop?: PermissionActionConfig; + [key: string]: PermissionRuleConfig | PermissionActionConfig | undefined; +} | PermissionActionConfig; + export type AgentConfig = { model?: string; temperature?: number; top_p?: number; prompt?: string; + /** + * @deprecated Use 'permission' field instead + */ tools?: { [key: string]: boolean; }; @@ -921,55 +1172,111 @@ export type AgentConfig = { */ description?: string; mode?: 'subagent' | 'primary' | 'all'; - permission?: { - edit?: 'ask' | 'allow' | 'deny'; - bash?: 'ask' | 'allow' | 'deny' | { - [key: string]: 'ask' | 'allow' | 'deny'; - }; - webfetch?: 'ask' | 'allow' | 'deny'; + options?: { + [key: string]: unknown; }; + /** + * Hex color code for the agent (e.g., #FF5733) + */ + color?: string; + /** + * Maximum number of agentic iterations before forcing text-only response + */ + steps?: number; + /** + * @deprecated Use 'steps' field instead. + */ + maxSteps?: number; + permission?: PermissionConfig; [key: string]: unknown | string | number | { [key: string]: boolean; } | boolean | 'subagent' | 'primary' | 'all' | { - edit?: 'ask' | 'allow' | 'deny'; - bash?: 'ask' | 'allow' | 'deny' | { - [key: string]: 'ask' | 'allow' | 'deny'; - }; - webfetch?: 'ask' | 'allow' | 'deny'; - } | undefined; + [key: string]: unknown; + } | string | number | PermissionConfig | undefined; }; -export type Provider = { +export type ProviderConfig = { api?: string; - name: string; - env: Array; - id: string; + name?: string; + env?: Array; + id?: string; npm?: string; - models: { - [key: string]: Model; - }; -}; - -export type Model = { - id: string; - name: string; - release_date: string; - attachment: boolean; - reasoning: boolean; - temperature: boolean; - tool_call: boolean; - cost: { - input: number; - output: number; - cache_read?: number; - cache_write?: number; - }; - limit: { - context: number; - output: number; + 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; + output: number; + }; + modalities?: { + input: Array<'text' | 'audio' | 'image' | 'video' | 'pdf'>; + output: Array<'text' | 'audio' | 'image' | 'video' | 'pdf'>; + }; + experimental?: boolean; + status?: 'alpha' | 'beta' | 'deprecated'; + options?: { + [key: string]: unknown; + }; + headers?: { + [key: string]: string; + }; + provider?: { + npm: string; + }; + /** + * Variant-specific configuration + */ + variants?: { + [key: string]: { + /** + * Disable this variant for the model + */ + disabled?: boolean; + [key: string]: unknown | boolean | undefined; + }; + }; + }; }; - options: { - [key: string]: unknown; + whitelist?: Array; + blacklist?: Array; + options?: { + apiKey?: string; + baseURL?: string; + /** + * GitHub Enterprise URL for copilot authentication + */ + enterpriseUrl?: string; + /** + * Enable promptCacheKey for this provider (default false) + */ + setCacheKey?: boolean; + /** + * Timeout in milliseconds for requests to this provider. Default is 300000 (5 minutes). Set to false to disable timeout. + */ + timeout?: number | false; + [key: string]: unknown | string | boolean | number | false | undefined; }; }; @@ -992,786 +1299,2747 @@ export type McpLocalConfig = { * Enable or disable the MCP server on startup */ enabled?: boolean; + /** + * Timeout in ms for fetching tools from the MCP server. Defaults to 5000 (5 seconds) if not specified. + */ + timeout?: number; +}; + +export type McpOAuthConfig = { + /** + * OAuth client ID. If not provided, dynamic client registration (RFC 7591) will be attempted. + */ + clientId?: string; + /** + * OAuth client secret (if required by the authorization server) + */ + clientSecret?: string; + /** + * OAuth scopes to request during authorization + */ + scope?: string; +}; + +export type McpRemoteConfig = { + /** + * Type of MCP server connection + */ + type: 'remote'; + /** + * URL of the remote MCP server + */ + url: string; + /** + * Enable or disable the MCP server on startup + */ + enabled?: boolean; + /** + * Headers to send with the request + */ + headers?: { + [key: string]: string; + }; + /** + * OAuth authentication configuration for the MCP server. Set to false to disable OAuth auto-detection. + */ + oauth?: McpOAuthConfig | false; + /** + * Timeout in ms for fetching tools from the MCP server. Defaults to 5000 (5 seconds) if not specified. + */ + timeout?: number; +}; + +/** + * @deprecated Always uses stretch layout. + */ +export type LayoutConfig = 'auto' | 'stretch'; + +export type Config = { + /** + * JSON schema reference for configuration validation + */ + $schema?: string; + /** + * Theme name to use for the interface + */ + theme?: string; + keybinds?: KeybindsConfig; + logLevel?: LogLevel; + /** + * TUI specific settings + */ + tui?: { + /** + * TUI scroll speed + */ + scroll_speed?: number; + /** + * Scroll acceleration settings + */ + scroll_acceleration?: { + /** + * Enable scroll acceleration + */ + enabled: boolean; + }; + /** + * Control diff rendering style: 'auto' adapts to terminal width, 'stacked' always shows single column + */ + diff_style?: 'auto' | 'stacked'; + }; + server?: ServerConfig; + /** + * Command configuration, see https://opencode.ai/docs/commands + */ + command?: { + [key: string]: { + template: string; + description?: string; + agent?: string; + model?: string; + subtask?: boolean; + }; + }; + watcher?: { + ignore?: Array; + }; + plugin?: Array; + snapshot?: boolean; + /** + * Control sharing behavior:'manual' allows manual sharing via commands, 'auto' enables automatic sharing, 'disabled' disables all sharing + */ + share?: 'manual' | 'auto' | 'disabled'; + /** + * @deprecated Use 'share' field instead. Share newly created sessions automatically + */ + 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'; + /** + * Disable providers that are loaded automatically + */ + disabled_providers?: Array; + /** + * When set, ONLY these providers will be enabled. All other providers will be ignored + */ + enabled_providers?: Array; + /** + * Model to use in the format of provider/model, eg anthropic/claude-2 + */ + model?: string; + /** + * Small model to use for tasks like title generation in the format of provider/model + */ + small_model?: string; + /** + * Default agent to use when none is specified. Must be a primary agent. Falls back to 'build' if not set or if the specified agent is invalid. + */ + default_agent?: string; + /** + * Custom username to display in conversations instead of system username + */ + username?: string; + /** + * @deprecated Use `agent` field instead. + */ + mode?: { + build?: AgentConfig; + plan?: AgentConfig; + [key: string]: AgentConfig | undefined; + }; + /** + * Agent configuration, see https://opencode.ai/docs/agent + */ + agent?: { + plan?: AgentConfig; + build?: AgentConfig; + general?: AgentConfig; + explore?: AgentConfig; + title?: AgentConfig; + summary?: AgentConfig; + compaction?: AgentConfig; + [key: string]: AgentConfig | undefined; + }; + /** + * Custom provider configurations and model overrides + */ + provider?: { + [key: string]: ProviderConfig; + }; + /** + * MCP (Model Context Protocol) server configurations + */ + mcp?: { + [key: string]: McpLocalConfig | McpRemoteConfig; + }; + formatter?: false | { + [key: string]: { + disabled?: boolean; + command?: Array; + environment?: { + [key: string]: string; + }; + extensions?: Array; + }; + }; + lsp?: false | { + [key: string]: { + disabled: true; + } | { + command: Array; + extensions?: Array; + disabled?: boolean; + env?: { + [key: string]: string; + }; + initialization?: { + [key: string]: unknown; + }; + }; + }; + /** + * Additional instruction files or patterns to include + */ + instructions?: Array; + layout?: LayoutConfig; + permission?: PermissionConfig; + tools?: { + [key: string]: boolean; + }; + enterprise?: { + /** + * Enterprise URL + */ + url?: string; + }; + compaction?: { + /** + * Enable automatic compaction when context is full (default: true) + */ + auto?: boolean; + /** + * Enable pruning of old tool outputs (default: true) + */ + prune?: boolean; + }; + experimental?: { + hook?: { + file_edited?: { + [key: string]: Array<{ + command: Array; + environment?: { + [key: string]: string; + }; + }>; + }; + session_completed?: Array<{ + command: Array; + environment?: { + [key: string]: string; + }; + }>; + }; + /** + * Number of retries for chat completions on failure + */ + chatMaxRetries?: number; + disable_paste_summary?: boolean; + /** + * Enable the batch tool + */ + batch_tool?: boolean; + /** + * Enable OpenTelemetry spans for AI SDK calls (using the 'experimental_telemetry' flag) + */ + openTelemetry?: boolean; + /** + * Tools that should only be available to primary agents. + */ + primary_tools?: Array; + /** + * Continue the agent loop when a tool call is denied + */ + continue_loop_on_deny?: boolean; + /** + * Timeout in milliseconds for model context protocol (MCP) requests + */ + mcp_timeout?: number; + }; +}; + +export type ToolIds = Array; + +export type ToolListItem = { + id: string; + description: string; + parameters: unknown; +}; + +export type ToolList = Array; + +export type Path = { + home: string; + state: string; + config: string; + worktree: string; + directory: string; +}; + +export type VcsInfo = { + branch: 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; + command?: string; +}; + +export type Command = { + name: string; + description?: string; + agent?: string; + model?: string; + mcp?: boolean; + template: string; + subtask?: boolean; + hints: Array; +}; + +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; + 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; + key?: string; + options: { + [key: string]: unknown; + }; + models: { + [key: string]: Model; + }; +}; + +export type ProviderAuthMethod = { + type: 'oauth' | 'api'; + label: string; +}; + +export type ProviderAuthAuthorization = { + url: string; + method: 'auto' | 'code'; + instructions: 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'; + 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; + }>; + index?: string; + }; + encoding?: 'base64'; + mimeType?: string; +}; + +export type File = { + path: string; + added: number; + removed: number; + status: 'added' | 'deleted' | 'modified'; +}; + +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; + }; + prompt?: string; + options: { + [key: string]: unknown; + }; + steps?: number; +}; + +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 LspStatus = { + id: string; + name: string; + root: string; + status: 'connected' | 'error'; +}; + +export type FormatterStatus = { + name: string; + extensions: Array; + enabled: boolean; +}; + +export type OAuth = { + type: 'oauth'; + refresh: string; + access: string; + expires: number; + enterpriseUrl?: string; +}; + +export type ApiAuth = { + type: 'api'; + key: string; +}; + +export type WellKnownAuth = { + type: 'wellknown'; + key: string; + token: string; +}; + +export type Auth = OAuth | ApiAuth | WellKnownAuth; + +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 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 ProjectListData = { + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/project'; +}; + +export type ProjectListResponses = { + /** + * List of projects + */ + 200: Array; +}; + +export type ProjectListResponse = ProjectListResponses[keyof ProjectListResponses]; + +export type ProjectCurrentData = { + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/project/current'; +}; + +export type ProjectCurrentResponses = { + /** + * Current project information + */ + 200: Project; +}; + +export type ProjectCurrentResponse = ProjectCurrentResponses[keyof ProjectCurrentResponses]; + +export type ProjectUpdateData = { + body?: { + name?: string; + icon?: { + url?: string; + color?: string; + }; + }; + path: { + projectID: string; + }; + query?: { + directory?: 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 PtyListData = { + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/pty'; +}; + +export type PtyListResponses = { + /** + * List of sessions + */ + 200: Array; +}; + +export type PtyListResponse = PtyListResponses[keyof PtyListResponses]; + +export type PtyCreateData = { + body?: { + command?: string; + args?: Array; + cwd?: string; + title?: string; + env?: { + [key: string]: string; + }; + }; + path?: never; + query?: { + directory?: 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; + }; + url: '/pty/{ptyID}'; +}; + +export type PtyRemoveErrors = { + /** + * Not found + */ + 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; + }; + url: '/pty/{ptyID}'; +}; + +export type PtyGetErrors = { + /** + * Not found + */ + 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; + }; + 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 PtyConnectData = { + body?: never; + path: { + ptyID: string; + }; + query?: { + directory?: string; + }; + url: '/pty/{ptyID}/connect'; +}; + +export type PtyConnectErrors = { + /** + * Not found + */ + 404: NotFoundError; +}; + +export type PtyConnectError = PtyConnectErrors[keyof PtyConnectErrors]; + +export type PtyConnectResponses = { + /** + * Connected session + */ + 200: boolean; +}; + +export type PtyConnectResponse = PtyConnectResponses[keyof PtyConnectResponses]; + +export type ConfigGetData = { + body?: never; + path?: never; + query?: { + directory?: 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; + }; + 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 ToolIdsData = { + body?: never; + path?: never; + query?: { + directory?: 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 ToolListData = { + body?: never; + path?: never; + query: { + directory?: 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 InstanceDisposeData = { + body?: never; + path?: never; + query?: { + directory?: 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; + }; + url: '/path'; +}; + +export type PathGetResponses = { + /** + * Path + */ + 200: Path; +}; + +export type PathGetResponse = PathGetResponses[keyof PathGetResponses]; + +export type VcsGetData = { + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/vcs'; +}; + +export type VcsGetResponses = { + /** + * VCS info + */ + 200: VcsInfo; +}; + +export type VcsGetResponse = VcsGetResponses[keyof VcsGetResponses]; + +export type SessionListData = { + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/session'; +}; + +export type SessionListResponses = { + /** + * List of sessions + */ + 200: Array; +}; + +export type SessionListResponse = SessionListResponses[keyof SessionListResponses]; + +export type SessionCreateData = { + body?: { + parentID?: string; + title?: string; + permission?: PermissionRuleset; + }; + path?: never; + query?: { + directory?: 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; + }; + 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; + }; + url: '/session/{sessionID}'; +}; + +export type SessionDeleteErrors = { + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 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; + }; + url: '/session/{sessionID}'; +}; + +export type SessionGetErrors = { + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 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; + time?: { + archived?: number; + }; + }; + path: { + sessionID: string; + }; + query?: { + directory?: string; + }; + url: '/session/{sessionID}'; +}; + +export type SessionUpdateErrors = { + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 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; + }; + 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; +}; + +export type SessionChildrenResponse = SessionChildrenResponses[keyof SessionChildrenResponses]; + +export type SessionTodoData = { + body?: never; + path: { + /** + * Session ID + */ + sessionID: string; + }; + query?: { + directory?: 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; +}; + +export type SessionTodoResponse = SessionTodoResponses[keyof SessionTodoResponses]; + +export type SessionInitData = { + body?: { + modelID: string; + providerID: string; + messageID: string; + }; + path: { + /** + * Session ID + */ + sessionID: string; + }; + query?: { + directory?: 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 SessionForkData = { + body?: { + messageID?: string; + }; + path: { + sessionID: string; + }; + query?: { + directory?: string; + }; + url: '/session/{sessionID}/fork'; +}; + +export type SessionForkResponses = { + /** + * 200 + */ + 200: Session; +}; + +export type SessionForkResponse = SessionForkResponses[keyof SessionForkResponses]; + +export type SessionAbortData = { + body?: never; + path: { + sessionID: string; + }; + query?: { + directory?: 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 SessionUnshareData = { + body?: never; + path: { + sessionID: string; + }; + query?: { + directory?: string; + }; + url: '/session/{sessionID}/share'; +}; + +export type SessionUnshareErrors = { + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; + +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; + }; + url: '/session/{sessionID}/share'; +}; + +export type SessionShareErrors = { + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; + +export type SessionShareError = SessionShareErrors[keyof SessionShareErrors]; + +export type SessionShareResponses = { + /** + * Successfully shared session + */ + 200: Session; +}; + +export type SessionShareResponse = SessionShareResponses[keyof SessionShareResponses]; + +export type SessionDiffData = { + body?: never; + path: { + /** + * Session ID + */ + sessionID: string; + }; + query?: { + directory?: string; + messageID?: string; + }; + url: '/session/{sessionID}/diff'; +}; + +export type SessionDiffErrors = { + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; + +export type SessionDiffError = SessionDiffErrors[keyof SessionDiffErrors]; + +export type SessionDiffResponses = { + /** + * List of diffs + */ + 200: Array; +}; + +export type SessionDiffResponse = SessionDiffResponses[keyof SessionDiffResponses]; + +export type SessionSummarizeData = { + body?: { + providerID: string; + modelID: string; + auto?: boolean; + }; + path: { + /** + * Session ID + */ + sessionID: string; + }; + query?: { + directory?: string; + }; + url: '/session/{sessionID}/summarize'; +}; + +export type SessionSummarizeErrors = { + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; + +export type SessionSummarizeError = SessionSummarizeErrors[keyof SessionSummarizeErrors]; + +export type SessionSummarizeResponses = { + /** + * Summarized session + */ + 200: boolean; +}; + +export type SessionSummarizeResponse = SessionSummarizeResponses[keyof SessionSummarizeResponses]; + +export type SessionMessagesData = { + body?: never; + path: { + /** + * Session ID + */ + sessionID: string; + }; + query?: { + directory?: string; + limit?: number; + }; + url: '/session/{sessionID}/message'; +}; + +export type SessionMessagesErrors = { + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; + +export type SessionMessagesError = SessionMessagesErrors[keyof SessionMessagesErrors]; + +export type SessionMessagesResponses = { + /** + * List of messages + */ + 200: Array<{ + info: Message; + parts: Array; + }>; +}; + +export type SessionMessagesResponse = SessionMessagesResponses[keyof SessionMessagesResponses]; + +export type SessionPromptData = { + body?: { + messageID?: string; + model?: { + providerID: string; + modelID: string; + }; + agent?: string; + noReply?: boolean; + /** + * @deprecated tools and permissions have been merged, you can set permissions on the session itself now + */ + tools?: { + [key: string]: boolean; + }; + system?: string; + variant?: string; + parts: Array; + }; + path: { + /** + * Session ID + */ + sessionID: string; + }; + query?: { + directory?: 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; + }; +}; + +export type SessionPromptResponse = SessionPromptResponses[keyof SessionPromptResponses]; + +export type SessionMessageData = { + body?: never; + path: { + /** + * Session ID + */ + sessionID: string; + /** + * Message ID + */ + messageID: string; + }; + query?: { + directory?: string; + }; + url: '/session/{sessionID}/message/{messageID}'; +}; + +export type SessionMessageErrors = { + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; + +export type SessionMessageError = SessionMessageErrors[keyof SessionMessageErrors]; + +export type SessionMessageResponses = { + /** + * Message + */ + 200: { + info: Message; + parts: Array; + }; +}; + +export type SessionMessageResponse = SessionMessageResponses[keyof SessionMessageResponses]; + +export type PartDeleteData = { + body?: never; + path: { + /** + * Session ID + */ + sessionID: string; + /** + * Message ID + */ + messageID: string; + /** + * Part ID + */ + partID: string; + }; + query?: { + directory?: 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: { + /** + * Session ID + */ + sessionID: string; + /** + * Message ID + */ + messageID: string; + /** + * Part ID + */ + partID: string; + }; + query?: { + directory?: 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 SessionPromptAsyncData = { + body?: { + messageID?: string; + model?: { + providerID: string; + modelID: string; + }; + agent?: string; + noReply?: boolean; + /** + * @deprecated tools and permissions have been merged, you can set permissions on the session itself now + */ + tools?: { + [key: string]: boolean; + }; + system?: string; + variant?: string; + parts: Array; + }; + path: { + /** + * Session ID + */ + sessionID: string; + }; + query?: { + directory?: 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; + }; + path: { + /** + * Session ID + */ + sessionID: string; + }; + query?: { + directory?: 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; + }; +}; + +export type SessionCommandResponse = SessionCommandResponses[keyof SessionCommandResponses]; + +export type SessionShellData = { + body?: { + agent: string; + model?: { + providerID: string; + modelID: string; + }; + command: string; + }; + path: { + /** + * Session ID + */ + sessionID: string; + }; + query?: { + directory?: 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: AssistantMessage; +}; + +export type SessionShellResponse = SessionShellResponses[keyof SessionShellResponses]; + +export type SessionRevertData = { + body?: { + messageID: string; + partID?: string; + }; + path: { + sessionID: string; + }; + query?: { + directory?: 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; + }; + url: '/session/{sessionID}/unrevert'; }; -export type McpRemoteConfig = { - /** - * Type of MCP server connection - */ - type: 'remote'; +export type SessionUnrevertErrors = { /** - * URL of the remote MCP server + * Bad request */ - url: string; + 400: BadRequestError; /** - * Enable or disable the MCP server on startup + * Not found */ - enabled?: boolean; + 404: NotFoundError; +}; + +export type SessionUnrevertError = SessionUnrevertErrors[keyof SessionUnrevertErrors]; + +export type SessionUnrevertResponses = { /** - * Headers to send with the request + * Updated session */ - headers?: { - [key: string]: string; - }; + 200: Session; }; -export type LayoutConfig = 'auto' | 'stretch'; +export type SessionUnrevertResponse = SessionUnrevertResponses[keyof SessionUnrevertResponses]; -export type Error = { - data: { - [key: string]: unknown; +export type PermissionRespondData = { + body?: { + response: 'once' | 'always' | 'reject'; }; -}; - -export type TextPartInput = { - id?: string; - type: 'text'; - text: string; - synthetic?: boolean; - time?: { - start: number; - end?: number; + path: { + sessionID: string; + permissionID: string; + }; + query?: { + directory?: string; }; + url: '/session/{sessionID}/permissions/{permissionID}'; }; -export type FilePartInput = { - id?: string; - type: 'file'; - mime: string; - filename?: string; - url: string; - source?: FilePartSource; +export type PermissionRespondErrors = { + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; }; -export type AgentPartInput = { - id?: string; - type: 'agent'; - name: string; - source?: { - value: string; - start: number; - end: number; - }; -}; +export type PermissionRespondError = PermissionRespondErrors[keyof PermissionRespondErrors]; -export type Symbol = { - name: string; - kind: number; - location: { - uri: string; - range: Range; - }; +export type PermissionRespondResponses = { + /** + * Permission processed successfully + */ + 200: boolean; }; -export type File = { - path: string; - added: number; - removed: number; - status: 'added' | 'deleted' | 'modified'; -}; +export type PermissionRespondResponse = PermissionRespondResponses[keyof PermissionRespondResponses]; -export type Agent = { - name: string; - description?: string; - mode: 'subagent' | 'primary' | 'all'; - builtIn: boolean; - topP?: number; - temperature?: number; - permission: { - edit: 'ask' | 'allow' | 'deny'; - bash: { - [key: string]: 'ask' | 'allow' | 'deny'; - }; - webfetch?: 'ask' | 'allow' | 'deny'; - }; - model?: { - modelID: string; - providerID: string; +export type PermissionReplyData = { + body?: { + reply: 'once' | 'always' | 'reject'; }; - prompt?: string; - tools: { - [key: string]: boolean; + path: { + requestID: string; }; - options: { - [key: string]: unknown; + query?: { + directory?: string; }; + url: '/permission/{requestID}/reply'; }; -export type Auth = ({ - type: 'oauth'; -} & OAuth) | ({ - type: 'api'; -} & ApiAuth) | ({ - type: 'wellknown'; -} & WellKnownAuth); - -export type OAuth = { - type: 'oauth'; - refresh: string; - access: string; - expires: number; +export type PermissionReplyErrors = { + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; }; -export type ApiAuth = { - type: 'api'; - key: string; -}; +export type PermissionReplyError = PermissionReplyErrors[keyof PermissionReplyErrors]; -export type WellKnownAuth = { - type: 'wellknown'; - key: string; - token: string; +export type PermissionReplyResponses = { + /** + * Permission processed successfully + */ + 200: boolean; }; -export type EventSubscribeData = { +export type PermissionReplyResponse = PermissionReplyResponses[keyof PermissionReplyResponses]; + +export type PermissionListData = { body?: never; path?: never; - query?: never; - url: '/event'; + query?: { + directory?: string; + }; + url: '/permission'; }; -export type EventSubscribeResponses = { +export type PermissionListResponses = { /** - * Event stream + * List of pending permissions */ - 200: Event; + 200: Array; }; -export type EventSubscribeResponse = EventSubscribeResponses[keyof EventSubscribeResponses]; +export type PermissionListResponse = PermissionListResponses[keyof PermissionListResponses]; -export type AppGetData = { +export type CommandListData = { body?: never; path?: never; - query?: never; - url: '/app'; + query?: { + directory?: string; + }; + url: '/command'; }; -export type AppGetResponses = { +export type CommandListResponses = { /** - * 200 + * List of commands */ - 200: App; + 200: Array; }; -export type AppGetResponse = AppGetResponses[keyof AppGetResponses]; +export type CommandListResponse = CommandListResponses[keyof CommandListResponses]; -export type AppInitData = { +export type ConfigProvidersData = { body?: never; path?: never; - query?: never; - url: '/app/init'; + query?: { + directory?: string; + }; + url: '/config/providers'; }; -export type AppInitResponses = { +export type ConfigProvidersResponses = { /** - * Initialize the app + * List of providers */ - 200: boolean; + 200: { + providers: Array; + default: { + [key: string]: string; + }; + }; }; -export type AppInitResponse = AppInitResponses[keyof AppInitResponses]; +export type ConfigProvidersResponse = ConfigProvidersResponses[keyof ConfigProvidersResponses]; -export type ConfigGetData = { +export type ProviderListData = { body?: never; path?: never; - query?: never; - url: '/config'; + query?: { + directory?: string; + }; + url: '/provider'; }; -export type ConfigGetResponses = { +export type ProviderListResponses = { /** - * Get config info + * List of providers */ - 200: Config; + 200: { + all: Array<{ + api?: string; + name: string; + env: Array; + id: string; + npm?: string; + 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; + output: number; + }; + modalities?: { + input: Array<'text' | 'audio' | 'image' | 'video' | 'pdf'>; + output: Array<'text' | 'audio' | 'image' | 'video' | 'pdf'>; + }; + experimental?: boolean; + status?: 'alpha' | 'beta' | 'deprecated'; + options: { + [key: string]: unknown; + }; + headers?: { + [key: string]: string; + }; + provider?: { + npm: string; + }; + variants?: { + [key: string]: { + [key: string]: unknown; + }; + }; + }; + }; + }>; + default: { + [key: string]: string; + }; + connected: Array; + }; }; -export type ConfigGetResponse = ConfigGetResponses[keyof ConfigGetResponses]; +export type ProviderListResponse = ProviderListResponses[keyof ProviderListResponses]; -export type SessionListData = { +export type ProviderAuthData = { body?: never; path?: never; - query?: never; - url: '/session'; + query?: { + directory?: string; + }; + url: '/provider/auth'; }; -export type SessionListResponses = { +export type ProviderAuthResponses = { /** - * List of sessions + * Provider auth methods */ - 200: Array; + 200: { + [key: string]: Array; + }; }; -export type SessionListResponse = SessionListResponses[keyof SessionListResponses]; +export type ProviderAuthResponse = ProviderAuthResponses[keyof ProviderAuthResponses]; -export type SessionCreateData = { +export type ProviderOauthAuthorizeData = { body?: { - parentID?: string; - title?: string; + /** + * Auth method index + */ + method: number; }; - path?: never; - query?: never; - url: '/session'; + path: { + /** + * Provider ID + */ + providerID: string; + }; + query?: { + directory?: string; + }; + url: '/provider/{providerID}/oauth/authorize'; }; -export type SessionCreateErrors = { +export type ProviderOauthAuthorizeErrors = { /** * Bad request */ - 400: Error; + 400: BadRequestError; }; -export type SessionCreateError = SessionCreateErrors[keyof SessionCreateErrors]; +export type ProviderOauthAuthorizeError = ProviderOauthAuthorizeErrors[keyof ProviderOauthAuthorizeErrors]; -export type SessionCreateResponses = { +export type ProviderOauthAuthorizeResponses = { /** - * Successfully created session + * Authorization URL and method */ - 200: Session; + 200: ProviderAuthAuthorization; }; -export type SessionCreateResponse = SessionCreateResponses[keyof SessionCreateResponses]; +export type ProviderOauthAuthorizeResponse = ProviderOauthAuthorizeResponses[keyof ProviderOauthAuthorizeResponses]; -export type SessionDeleteData = { - body?: never; +export type ProviderOauthCallbackData = { + body?: { + /** + * Auth method index + */ + method: number; + /** + * OAuth authorization code + */ + code?: string; + }; path: { - id: string; + /** + * Provider ID + */ + providerID: string; }; - query?: never; - url: '/session/{id}'; + query?: { + directory?: string; + }; + url: '/provider/{providerID}/oauth/callback'; }; -export type SessionDeleteResponses = { +export type ProviderOauthCallbackErrors = { /** - * Successfully deleted session + * Bad request */ - 200: boolean; + 400: BadRequestError; }; -export type SessionDeleteResponse = SessionDeleteResponses[keyof SessionDeleteResponses]; - -export type SessionGetData = { - body?: never; - path: { - id: string; - }; - query?: never; - url: '/session/{id}'; -}; +export type ProviderOauthCallbackError = ProviderOauthCallbackErrors[keyof ProviderOauthCallbackErrors]; -export type SessionGetResponses = { +export type ProviderOauthCallbackResponses = { /** - * Get session + * OAuth callback processed successfully */ - 200: Session; + 200: boolean; }; -export type SessionGetResponse = SessionGetResponses[keyof SessionGetResponses]; +export type ProviderOauthCallbackResponse = ProviderOauthCallbackResponses[keyof ProviderOauthCallbackResponses]; -export type SessionUpdateData = { - body?: { - title?: string; - }; - path: { - id: string; +export type FindTextData = { + body?: never; + path?: never; + query: { + directory?: string; + pattern: string; }; - query?: never; - url: '/session/{id}'; + url: '/find'; }; -export type SessionUpdateResponses = { +export type FindTextResponses = { /** - * Successfully updated session + * Matches */ - 200: Session; + 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 SessionUpdateResponse = SessionUpdateResponses[keyof SessionUpdateResponses]; +export type FindTextResponse = FindTextResponses[keyof FindTextResponses]; -export type SessionChildrenData = { +export type FindFilesData = { body?: never; - path: { - id: string; + path?: never; + query: { + directory?: string; + query: string; + dirs?: 'true' | 'false'; + type?: 'file' | 'directory'; + limit?: number; }; - query?: never; - url: '/session/{id}/children'; + url: '/find/file'; }; -export type SessionChildrenResponses = { +export type FindFilesResponses = { /** - * List of children + * File paths */ - 200: Array; + 200: Array; }; -export type SessionChildrenResponse = SessionChildrenResponses[keyof SessionChildrenResponses]; +export type FindFilesResponse = FindFilesResponses[keyof FindFilesResponses]; -export type SessionInitData = { - body?: { - messageID: string; - providerID: string; - modelID: string; - }; - path: { - /** - * Session ID - */ - id: string; +export type FindSymbolsData = { + body?: never; + path?: never; + query: { + directory?: string; + query: string; }; - query?: never; - url: '/session/{id}/init'; + url: '/find/symbol'; }; -export type SessionInitResponses = { +export type FindSymbolsResponses = { /** - * 200 + * Symbols */ - 200: boolean; + 200: Array; }; -export type SessionInitResponse = SessionInitResponses[keyof SessionInitResponses]; +export type FindSymbolsResponse = FindSymbolsResponses[keyof FindSymbolsResponses]; -export type SessionAbortData = { +export type FileListData = { body?: never; - path: { - id: string; + path?: never; + query: { + directory?: string; + path: string; }; - query?: never; - url: '/session/{id}/abort'; + url: '/file'; }; -export type SessionAbortResponses = { +export type FileListResponses = { /** - * Aborted session + * Files and directories */ - 200: boolean; + 200: Array; }; -export type SessionAbortResponse = SessionAbortResponses[keyof SessionAbortResponses]; +export type FileListResponse = FileListResponses[keyof FileListResponses]; -export type SessionUnshareData = { +export type FileReadData = { body?: never; - path: { - id: string; + path?: never; + query: { + directory?: string; + path: string; }; - query?: never; - url: '/session/{id}/share'; + url: '/file/content'; }; -export type SessionUnshareResponses = { +export type FileReadResponses = { /** - * Successfully unshared session + * File content */ - 200: Session; + 200: FileContent; }; -export type SessionUnshareResponse = SessionUnshareResponses[keyof SessionUnshareResponses]; +export type FileReadResponse = FileReadResponses[keyof FileReadResponses]; -export type SessionShareData = { +export type FileStatusData = { body?: never; - path: { - id: string; + path?: never; + query?: { + directory?: string; }; - query?: never; - url: '/session/{id}/share'; + url: '/file/status'; }; -export type SessionShareResponses = { +export type FileStatusResponses = { /** - * Successfully shared session + * File status */ - 200: Session; + 200: Array; }; -export type SessionShareResponse = SessionShareResponses[keyof SessionShareResponses]; +export type FileStatusResponse = FileStatusResponses[keyof FileStatusResponses]; -export type SessionSummarizeData = { +export type AppLogData = { body?: { - providerID: string; - modelID: string; - }; - path: { /** - * Session ID + * Service name for the log entry */ - id: string; + service: string; + /** + * Log level + */ + level: 'debug' | 'info' | 'error' | 'warn'; + /** + * Log message + */ + message: string; + /** + * Additional metadata for the log entry + */ + extra?: { + [key: string]: unknown; + }; }; - query?: never; - url: '/session/{id}/summarize'; + path?: never; + query?: { + directory?: string; + }; + url: '/log'; }; -export type SessionSummarizeResponses = { +export type AppLogErrors = { /** - * Summarized session + * Bad request */ - 200: boolean; + 400: BadRequestError; }; -export type SessionSummarizeResponse = SessionSummarizeResponses[keyof SessionSummarizeResponses]; - -export type SessionMessagesData = { - body?: never; - path: { - /** - * Session ID - */ - id: string; - }; - query?: never; - url: '/session/{id}/message'; -}; +export type AppLogError = AppLogErrors[keyof AppLogErrors]; -export type SessionMessagesResponses = { +export type AppLogResponses = { /** - * List of messages + * Log entry written successfully */ - 200: Array<{ - info: Message; - parts: Array; - }>; + 200: boolean; }; -export type SessionMessagesResponse = SessionMessagesResponses[keyof SessionMessagesResponses]; +export type AppLogResponse = AppLogResponses[keyof AppLogResponses]; -export type SessionChatData = { - body?: { - messageID?: string; - providerID: string; - modelID: string; - agent?: string; - system?: string; - tools?: { - [key: string]: boolean; - }; - parts: Array<({ - type: 'text'; - } & TextPartInput) | ({ - type: 'file'; - } & FilePartInput) | ({ - type: 'agent'; - } & AgentPartInput)>; - }; - path: { - /** - * Session ID - */ - id: string; +export type AppAgentsData = { + body?: never; + path?: never; + query?: { + directory?: string; }; - query?: never; - url: '/session/{id}/message'; + url: '/agent'; }; -export type SessionChatResponses = { +export type AppAgentsResponses = { /** - * Created message + * List of agents */ - 200: { - info: AssistantMessage; - parts: Array; - }; + 200: Array; }; -export type SessionChatResponse = SessionChatResponses[keyof SessionChatResponses]; +export type AppAgentsResponse = AppAgentsResponses[keyof AppAgentsResponses]; -export type SessionMessageData = { +export type McpStatusData = { body?: never; - path: { - /** - * Session ID - */ - id: string; - /** - * Message ID - */ - messageID: string; + path?: never; + query?: { + directory?: string; }; - query?: never; - url: '/session/{id}/message/{messageID}'; + url: '/mcp'; }; -export type SessionMessageResponses = { +export type McpStatusResponses = { /** - * Message + * MCP server status */ 200: { - info: Message; - parts: Array; + [key: string]: McpStatus; }; }; -export type SessionMessageResponse = SessionMessageResponses[keyof SessionMessageResponses]; +export type McpStatusResponse = McpStatusResponses[keyof McpStatusResponses]; -export type SessionShellData = { +export type McpAddData = { body?: { - agent: string; - command: string; + name: string; + config: McpLocalConfig | McpRemoteConfig; }; - path: { - /** - * Session ID - */ - id: string; + path?: never; + query?: { + directory?: string; }; - query?: never; - url: '/session/{id}/shell'; + url: '/mcp'; }; -export type SessionShellResponses = { +export type McpAddErrors = { /** - * Created message + * Bad request */ - 200: AssistantMessage; + 400: BadRequestError; }; -export type SessionShellResponse = SessionShellResponses[keyof SessionShellResponses]; - -export type SessionRevertData = { - body?: { - messageID: string; - partID?: string; - }; - path: { - id: string; - }; - query?: never; - url: '/session/{id}/revert'; -}; +export type McpAddError = McpAddErrors[keyof McpAddErrors]; -export type SessionRevertResponses = { +export type McpAddResponses = { /** - * Updated session + * MCP server added successfully */ - 200: Session; + 200: { + [key: string]: McpStatus; + }; }; -export type SessionRevertResponse = SessionRevertResponses[keyof SessionRevertResponses]; +export type McpAddResponse = McpAddResponses[keyof McpAddResponses]; -export type SessionUnrevertData = { +export type McpAuthRemoveData = { body?: never; path: { - id: string; + name: string; }; - query?: never; - url: '/session/{id}/unrevert'; + query?: { + directory?: string; + }; + url: '/mcp/{name}/auth'; +}; + +export type McpAuthRemoveErrors = { + /** + * Not found + */ + 404: NotFoundError; }; -export type SessionUnrevertResponses = { +export type McpAuthRemoveError = McpAuthRemoveErrors[keyof McpAuthRemoveErrors]; + +export type McpAuthRemoveResponses = { /** - * Updated session + * OAuth credentials removed */ - 200: Session; + 200: { + success: true; + }; }; -export type SessionUnrevertResponse = SessionUnrevertResponses[keyof SessionUnrevertResponses]; +export type McpAuthRemoveResponse = McpAuthRemoveResponses[keyof McpAuthRemoveResponses]; -export type PostSessionByIdPermissionsByPermissionIdData = { - body?: { - response: 'once' | 'always' | 'reject'; - }; +export type McpAuthStartData = { + body?: never; path: { - id: string; - permissionID: string; + name: string; }; - query?: never; - url: '/session/{id}/permissions/{permissionID}'; + query?: { + directory?: string; + }; + url: '/mcp/{name}/auth'; }; -export type PostSessionByIdPermissionsByPermissionIdResponses = { +export type McpAuthStartErrors = { /** - * Permission processed successfully + * Bad request */ - 200: boolean; + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; }; -export type PostSessionByIdPermissionsByPermissionIdResponse = PostSessionByIdPermissionsByPermissionIdResponses[keyof PostSessionByIdPermissionsByPermissionIdResponses]; - -export type ConfigProvidersData = { - body?: never; - path?: never; - query?: never; - url: '/config/providers'; -}; +export type McpAuthStartError = McpAuthStartErrors[keyof McpAuthStartErrors]; -export type ConfigProvidersResponses = { +export type McpAuthStartResponses = { /** - * List of providers + * OAuth flow started */ 200: { - providers: Array; - default: { - [key: string]: string; - }; + /** + * URL to open in browser for authorization + */ + authorizationUrl: string; }; }; -export type ConfigProvidersResponse = ConfigProvidersResponses[keyof ConfigProvidersResponses]; +export type McpAuthStartResponse = McpAuthStartResponses[keyof McpAuthStartResponses]; -export type FindTextData = { - body?: never; - path?: never; - query: { - pattern: string; +export type McpAuthCallbackData = { + body?: { + /** + * Authorization code from OAuth callback + */ + code: string; }; - url: '/find'; + path: { + name: string; + }; + query?: { + directory?: string; + }; + url: '/mcp/{name}/auth/callback'; }; -export type FindTextResponses = { +export type McpAuthCallbackErrors = { /** - * Matches + * Bad request */ - 200: Array<{ - path: { - text: string; - }; - lines: { - text: string; - }; - line_number: number; - absolute_offset: number; - submatches: Array<{ - match: { - text: string; - }; - start: number; - end: number; - }>; - }>; + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; }; -export type FindTextResponse = FindTextResponses[keyof FindTextResponses]; - -export type FindFilesData = { - body?: never; - path?: never; - query: { - query: string; - }; - url: '/find/file'; -}; +export type McpAuthCallbackError = McpAuthCallbackErrors[keyof McpAuthCallbackErrors]; -export type FindFilesResponses = { +export type McpAuthCallbackResponses = { /** - * File paths + * OAuth authentication completed */ - 200: Array; + 200: McpStatus; }; -export type FindFilesResponse = FindFilesResponses[keyof FindFilesResponses]; +export type McpAuthCallbackResponse = McpAuthCallbackResponses[keyof McpAuthCallbackResponses]; -export type FindSymbolsData = { +export type McpAuthAuthenticateData = { body?: never; - path?: never; - query: { - query: string; + path: { + name: string; }; - url: '/find/symbol'; + query?: { + directory?: string; + }; + url: '/mcp/{name}/auth/authenticate'; }; -export type FindSymbolsResponses = { +export type McpAuthAuthenticateErrors = { /** - * Symbols + * Bad request */ - 200: Array; + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; }; -export type FindSymbolsResponse = FindSymbolsResponses[keyof FindSymbolsResponses]; +export type McpAuthAuthenticateError = McpAuthAuthenticateErrors[keyof McpAuthAuthenticateErrors]; -export type FileReadData = { +export type McpAuthAuthenticateResponses = { + /** + * OAuth authentication completed + */ + 200: McpStatus; +}; + +export type McpAuthAuthenticateResponse = McpAuthAuthenticateResponses[keyof McpAuthAuthenticateResponses]; + +export type McpConnectData = { body?: never; - path?: never; - query: { - path: string; + path: { + name: string; }; - url: '/file'; + query?: { + directory?: string; + }; + url: '/mcp/{name}/connect'; }; -export type FileReadResponses = { +export type McpConnectResponses = { /** - * File content + * MCP server connected successfully */ - 200: { - type: 'raw' | 'patch'; - content: string; - }; + 200: boolean; }; -export type FileReadResponse = FileReadResponses[keyof FileReadResponses]; +export type McpConnectResponse = McpConnectResponses[keyof McpConnectResponses]; -export type FileStatusData = { +export type McpDisconnectData = { body?: never; - path?: never; - query?: never; - url: '/file/status'; + path: { + name: string; + }; + query?: { + directory?: string; + }; + url: '/mcp/{name}/disconnect'; }; -export type FileStatusResponses = { +export type McpDisconnectResponses = { /** - * File status + * MCP server disconnected successfully */ - 200: Array; + 200: boolean; }; -export type FileStatusResponse = FileStatusResponses[keyof FileStatusResponses]; +export type McpDisconnectResponse = McpDisconnectResponses[keyof McpDisconnectResponses]; -export type AppLogData = { - body?: { - /** - * Service name for the log entry - */ - service: string; - /** - * Log level - */ - level: 'debug' | 'info' | 'error' | 'warn'; - /** - * Log message - */ - message: string; - /** - * Additional metadata for the log entry - */ - extra?: { - [key: string]: unknown; - }; - }; +export type LspStatusData = { + body?: never; path?: never; - query?: never; - url: '/log'; + query?: { + directory?: string; + }; + url: '/lsp'; }; -export type AppLogResponses = { +export type LspStatusResponses = { /** - * Log entry written successfully + * LSP server status */ - 200: boolean; + 200: Array; }; -export type AppLogResponse = AppLogResponses[keyof AppLogResponses]; +export type LspStatusResponse = LspStatusResponses[keyof LspStatusResponses]; -export type AppAgentsData = { +export type FormatterStatusData = { body?: never; path?: never; - query?: never; - url: '/agent'; + query?: { + directory?: string; + }; + url: '/formatter'; }; -export type AppAgentsResponses = { +export type FormatterStatusResponses = { /** - * List of agents + * Formatter status */ - 200: Array; + 200: Array; }; -export type AppAgentsResponse = AppAgentsResponses[keyof AppAgentsResponses]; +export type FormatterStatusResponse = FormatterStatusResponses[keyof FormatterStatusResponses]; export type TuiAppendPromptData = { body?: { text: string; }; path?: never; - query?: never; + query?: { + directory?: string; + }; url: '/tui/append-prompt'; }; +export type TuiAppendPromptErrors = { + /** + * Bad request + */ + 400: BadRequestError; +}; + +export type TuiAppendPromptError = TuiAppendPromptErrors[keyof TuiAppendPromptErrors]; + export type TuiAppendPromptResponses = { /** * Prompt processed successfully @@ -1784,7 +4052,9 @@ export type TuiAppendPromptResponse = TuiAppendPromptResponses[keyof TuiAppendPr export type TuiOpenHelpData = { body?: never; path?: never; - query?: never; + query?: { + directory?: string; + }; url: '/tui/open-help'; }; @@ -1800,7 +4070,9 @@ export type TuiOpenHelpResponse = TuiOpenHelpResponses[keyof TuiOpenHelpResponse export type TuiOpenSessionsData = { body?: never; path?: never; - query?: never; + query?: { + directory?: string; + }; url: '/tui/open-sessions'; }; @@ -1816,7 +4088,9 @@ export type TuiOpenSessionsResponse = TuiOpenSessionsResponses[keyof TuiOpenSess export type TuiOpenThemesData = { body?: never; path?: never; - query?: never; + query?: { + directory?: string; + }; url: '/tui/open-themes'; }; @@ -1832,7 +4106,9 @@ export type TuiOpenThemesResponse = TuiOpenThemesResponses[keyof TuiOpenThemesRe export type TuiOpenModelsData = { body?: never; path?: never; - query?: never; + query?: { + directory?: string; + }; url: '/tui/open-models'; }; @@ -1848,7 +4124,9 @@ export type TuiOpenModelsResponse = TuiOpenModelsResponses[keyof TuiOpenModelsRe export type TuiSubmitPromptData = { body?: never; path?: never; - query?: never; + query?: { + directory?: string; + }; url: '/tui/submit-prompt'; }; @@ -1864,7 +4142,9 @@ export type TuiSubmitPromptResponse = TuiSubmitPromptResponses[keyof TuiSubmitPr export type TuiClearPromptData = { body?: never; path?: never; - query?: never; + query?: { + directory?: string; + }; url: '/tui/clear-prompt'; }; @@ -1882,10 +4162,21 @@ export type TuiExecuteCommandData = { command: string; }; path?: never; - query?: never; + query?: { + directory?: string; + }; url: '/tui/execute-command'; }; +export type TuiExecuteCommandErrors = { + /** + * Bad request + */ + 400: BadRequestError; +}; + +export type TuiExecuteCommandError = TuiExecuteCommandErrors[keyof TuiExecuteCommandErrors]; + export type TuiExecuteCommandResponses = { /** * Command executed successfully @@ -1900,9 +4191,15 @@ export type TuiShowToastData = { title?: string; message: string; variant: 'info' | 'success' | 'warning' | 'error'; + /** + * Duration in milliseconds + */ + duration?: number; }; path?: never; - query?: never; + query?: { + directory?: string; + }; url: '/tui/show-toast'; }; @@ -1915,20 +4212,88 @@ export type TuiShowToastResponses = { export type TuiShowToastResponse = TuiShowToastResponses[keyof TuiShowToastResponses]; +export type TuiPublishData = { + body?: EventTuiPromptAppend | EventTuiCommandExecute | EventTuiToastShow; + path?: never; + query?: { + directory?: 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 TuiControlNextData = { + body?: never; + path?: never; + query?: { + directory?: 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; + }; + url: '/tui/control/response'; +}; + +export type TuiControlResponseResponses = { + /** + * Response submitted successfully + */ + 200: boolean; +}; + +export type TuiControlResponseResponse = TuiControlResponseResponses[keyof TuiControlResponseResponses]; + export type AuthSetData = { body?: Auth; path: { - id: string; + providerID: string; }; - query?: never; - url: '/auth/{id}'; + query?: { + directory?: string; + }; + url: '/auth/{providerID}'; }; export type AuthSetErrors = { /** * Bad request */ - 400: Error; + 400: BadRequestError; }; export type AuthSetError = AuthSetErrors[keyof AuthSetErrors]; @@ -1941,3 +4306,21 @@ export type AuthSetResponses = { }; export type AuthSetResponse = AuthSetResponses[keyof AuthSetResponses]; + +export type EventSubscribeData = { + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/event'; +}; + +export type EventSubscribeResponses = { + /** + * Event stream + */ + 200: Event; +}; + +export type EventSubscribeResponse = EventSubscribeResponses[keyof EventSubscribeResponses]; diff --git a/packages/openapi-ts-tests/sdks/__snapshots__/opencode/grouped/index.ts b/packages/openapi-ts-tests/sdks/__snapshots__/opencode/grouped/index.ts index 1c5264152..c1f98cb47 100644 --- a/packages/openapi-ts-tests/sdks/__snapshots__/opencode/grouped/index.ts +++ b/packages/openapi-ts-tests/sdks/__snapshots__/opencode/grouped/index.ts @@ -1,4 +1,4 @@ // This file is auto-generated by @hey-api/openapi-ts -export { appAgents, appGet, appInit, appLog, authSet, configGet, configProviders, eventSubscribe, fileRead, fileStatus, findFiles, findSymbols, findText, type Options, postSessionByIdPermissionsByPermissionId, sessionAbort, sessionChat, sessionChildren, sessionCreate, sessionDelete, sessionGet, sessionInit, sessionList, sessionMessage, sessionMessages, sessionRevert, sessionShare, sessionShell, sessionSummarize, sessionUnrevert, sessionUnshare, sessionUpdate, tuiAppendPrompt, tuiClearPrompt, tuiExecuteCommand, tuiOpenHelp, tuiOpenModels, tuiOpenSessions, tuiOpenThemes, tuiShowToast, tuiSubmitPrompt } from './sdk.gen'; -export type { Agent, AgentConfig, AgentPart, AgentPartInput, ApiAuth, App, AppAgentsData, AppAgentsResponse, AppAgentsResponses, AppGetData, AppGetResponse, AppGetResponses, AppInitData, AppInitResponse, AppInitResponses, AppLogData, AppLogResponse, AppLogResponses, AssistantMessage, Auth, AuthSetData, AuthSetError, AuthSetErrors, AuthSetResponse, AuthSetResponses, ClientOptions, Config, ConfigGetData, ConfigGetResponse, ConfigGetResponses, ConfigProvidersData, ConfigProvidersResponse, ConfigProvidersResponses, Error, Event, EventFileEdited, EventFileWatcherUpdated, EventIdeInstalled, EventInstallationUpdated, EventLspClientDiagnostics, EventMessagePartRemoved, EventMessagePartUpdated, EventMessageRemoved, EventMessageUpdated, EventPermissionReplied, EventPermissionUpdated, EventServerConnected, EventSessionDeleted, EventSessionError, EventSessionIdle, EventSessionUpdated, EventStorageWrite, EventSubscribeData, EventSubscribeResponse, EventSubscribeResponses, File, FilePart, FilePartInput, FilePartSource, FilePartSourceText, FileReadData, FileReadResponse, FileReadResponses, FileSource, FileStatusData, FileStatusResponse, FileStatusResponses, FindFilesData, FindFilesResponse, FindFilesResponses, FindSymbolsData, FindSymbolsResponse, FindSymbolsResponses, FindTextData, FindTextResponse, FindTextResponses, KeybindsConfig, LayoutConfig, McpLocalConfig, McpRemoteConfig, Message, MessageAbortedError, MessageOutputLengthError, Model, OAuth, Part, PatchPart, Permission, PostSessionByIdPermissionsByPermissionIdData, PostSessionByIdPermissionsByPermissionIdResponse, PostSessionByIdPermissionsByPermissionIdResponses, Provider, ProviderAuthError, Range, ReasoningPart, Session, SessionAbortData, SessionAbortResponse, SessionAbortResponses, SessionChatData, SessionChatResponse, SessionChatResponses, SessionChildrenData, SessionChildrenResponse, SessionChildrenResponses, SessionCreateData, SessionCreateError, SessionCreateErrors, SessionCreateResponse, SessionCreateResponses, SessionDeleteData, SessionDeleteResponse, SessionDeleteResponses, SessionGetData, SessionGetResponse, SessionGetResponses, SessionInitData, SessionInitResponse, SessionInitResponses, SessionListData, SessionListResponse, SessionListResponses, SessionMessageData, SessionMessageResponse, SessionMessageResponses, SessionMessagesData, SessionMessagesResponse, SessionMessagesResponses, SessionRevertData, SessionRevertResponse, SessionRevertResponses, SessionShareData, SessionShareResponse, SessionShareResponses, SessionShellData, SessionShellResponse, SessionShellResponses, SessionSummarizeData, SessionSummarizeResponse, SessionSummarizeResponses, SessionUnrevertData, SessionUnrevertResponse, SessionUnrevertResponses, SessionUnshareData, SessionUnshareResponse, SessionUnshareResponses, SessionUpdateData, SessionUpdateResponse, SessionUpdateResponses, SnapshotPart, StepFinishPart, StepStartPart, Symbol, SymbolSource, TextPart, TextPartInput, ToolPart, ToolState, ToolStateCompleted, ToolStateError, ToolStatePending, ToolStateRunning, TuiAppendPromptData, TuiAppendPromptResponse, TuiAppendPromptResponses, TuiClearPromptData, TuiClearPromptResponse, TuiClearPromptResponses, TuiExecuteCommandData, TuiExecuteCommandResponse, TuiExecuteCommandResponses, TuiOpenHelpData, TuiOpenHelpResponse, TuiOpenHelpResponses, TuiOpenModelsData, TuiOpenModelsResponse, TuiOpenModelsResponses, TuiOpenSessionsData, TuiOpenSessionsResponse, TuiOpenSessionsResponses, TuiOpenThemesData, TuiOpenThemesResponse, TuiOpenThemesResponses, TuiShowToastData, TuiShowToastResponse, TuiShowToastResponses, TuiSubmitPromptData, TuiSubmitPromptResponse, TuiSubmitPromptResponses, UnknownError, UserMessage, WellKnownAuth } from './types.gen'; +export { appAgents, appLog, authSet, commandList, configGet, configProviders, configUpdate, eventSubscribe, fileList, fileRead, fileStatus, findFiles, findSymbols, findText, formatterStatus, globalDispose, globalEvent, globalHealth, instanceDispose, lspStatus, mcpAdd, mcpAuthAuthenticate, mcpAuthCallback, mcpAuthRemove, mcpAuthStart, mcpConnect, mcpDisconnect, mcpStatus, type Options, partDelete, partUpdate, pathGet, permissionList, permissionReply, permissionRespond, projectCurrent, projectList, projectUpdate, providerAuth, providerList, providerOauthAuthorize, providerOauthCallback, ptyConnect, ptyCreate, ptyGet, ptyList, ptyRemove, ptyUpdate, sessionAbort, sessionChildren, sessionCommand, sessionCreate, sessionDelete, sessionDiff, sessionFork, sessionGet, sessionInit, sessionList, sessionMessage, sessionMessages, sessionPrompt, sessionPromptAsync, sessionRevert, sessionShare, sessionShell, sessionStatus, sessionSummarize, sessionTodo, sessionUnrevert, sessionUnshare, sessionUpdate, toolIds, toolList, tuiAppendPrompt, tuiClearPrompt, tuiControlNext, tuiControlResponse, tuiExecuteCommand, tuiOpenHelp, tuiOpenModels, tuiOpenSessions, tuiOpenThemes, tuiPublish, tuiShowToast, tuiSubmitPrompt, vcsGet } from './sdk.gen'; +export type { Agent, AgentConfig, AgentPart, AgentPartInput, ApiAuth, ApiError, AppAgentsData, AppAgentsResponse, AppAgentsResponses, AppLogData, AppLogError, AppLogErrors, AppLogResponse, AppLogResponses, AssistantMessage, Auth, AuthSetData, AuthSetError, AuthSetErrors, AuthSetResponse, AuthSetResponses, BadRequestError, ClientOptions, Command, CommandListData, CommandListResponse, CommandListResponses, CompactionPart, Config, ConfigGetData, ConfigGetResponse, ConfigGetResponses, ConfigProvidersData, ConfigProvidersResponse, ConfigProvidersResponses, ConfigUpdateData, ConfigUpdateError, ConfigUpdateErrors, ConfigUpdateResponse, ConfigUpdateResponses, Event, EventCommandExecuted, EventFileEdited, EventFileWatcherUpdated, EventGlobalDisposed, EventInstallationUpdateAvailable, EventInstallationUpdated, EventLspClientDiagnostics, EventLspUpdated, EventMcpToolsChanged, EventMessagePartRemoved, EventMessagePartUpdated, EventMessageRemoved, EventMessageUpdated, EventPermissionAsked, EventPermissionReplied, EventProjectUpdated, EventPtyCreated, EventPtyDeleted, EventPtyExited, EventPtyUpdated, EventServerConnected, EventServerInstanceDisposed, EventSessionCompacted, EventSessionCreated, EventSessionDeleted, EventSessionDiff, EventSessionError, EventSessionIdle, EventSessionStatus, EventSessionUpdated, EventSubscribeData, EventSubscribeResponse, EventSubscribeResponses, EventTodoUpdated, EventTuiCommandExecute, EventTuiPromptAppend, EventTuiToastShow, EventVcsBranchUpdated, File, FileContent, FileDiff, FileListData, FileListResponse, FileListResponses, FileNode, FilePart, FilePartInput, FilePartSource, FilePartSourceText, FileReadData, FileReadResponse, FileReadResponses, FileSource, FileStatusData, FileStatusResponse, FileStatusResponses, FindFilesData, FindFilesResponse, FindFilesResponses, FindSymbolsData, FindSymbolsResponse, FindSymbolsResponses, FindTextData, FindTextResponse, FindTextResponses, FormatterStatus, FormatterStatusData, FormatterStatusResponse, FormatterStatusResponses, GlobalDisposeData, GlobalDisposeResponse, GlobalDisposeResponses, GlobalEvent, GlobalEventData, GlobalEventResponse, GlobalEventResponses, GlobalHealthData, GlobalHealthResponse, GlobalHealthResponses, InstanceDisposeData, InstanceDisposeResponse, InstanceDisposeResponses, KeybindsConfig, LayoutConfig, LogLevel, LspStatus, LspStatusData, LspStatusResponse, LspStatusResponses, McpAddData, McpAddError, McpAddErrors, McpAddResponse, McpAddResponses, McpAuthAuthenticateData, McpAuthAuthenticateError, McpAuthAuthenticateErrors, McpAuthAuthenticateResponse, McpAuthAuthenticateResponses, McpAuthCallbackData, McpAuthCallbackError, McpAuthCallbackErrors, McpAuthCallbackResponse, McpAuthCallbackResponses, McpAuthRemoveData, McpAuthRemoveError, McpAuthRemoveErrors, McpAuthRemoveResponse, McpAuthRemoveResponses, McpAuthStartData, McpAuthStartError, McpAuthStartErrors, McpAuthStartResponse, McpAuthStartResponses, McpConnectData, McpConnectResponse, McpConnectResponses, McpDisconnectData, McpDisconnectResponse, McpDisconnectResponses, McpLocalConfig, McpOAuthConfig, McpRemoteConfig, McpStatus, McpStatusConnected, McpStatusData, McpStatusDisabled, McpStatusFailed, McpStatusNeedsAuth, McpStatusNeedsClientRegistration, McpStatusResponse, McpStatusResponses, Message, MessageAbortedError, MessageOutputLengthError, Model, NotFoundError, OAuth, Part, PartDeleteData, PartDeleteError, PartDeleteErrors, PartDeleteResponse, PartDeleteResponses, PartUpdateData, PartUpdateError, PartUpdateErrors, PartUpdateResponse, PartUpdateResponses, PatchPart, Path, PathGetData, PathGetResponse, PathGetResponses, PermissionAction, PermissionActionConfig, PermissionConfig, PermissionListData, PermissionListResponse, PermissionListResponses, PermissionObjectConfig, PermissionReplyData, PermissionReplyError, PermissionReplyErrors, PermissionReplyResponse, PermissionReplyResponses, PermissionRequest, PermissionRespondData, PermissionRespondError, PermissionRespondErrors, PermissionRespondResponse, PermissionRespondResponses, PermissionRule, PermissionRuleConfig, PermissionRuleset, Project, ProjectCurrentData, ProjectCurrentResponse, ProjectCurrentResponses, ProjectListData, ProjectListResponse, ProjectListResponses, ProjectUpdateData, ProjectUpdateError, ProjectUpdateErrors, ProjectUpdateResponse, ProjectUpdateResponses, Provider, ProviderAuthAuthorization, ProviderAuthData, ProviderAuthError, ProviderAuthMethod, ProviderAuthResponse, ProviderAuthResponses, ProviderConfig, ProviderListData, ProviderListResponse, ProviderListResponses, ProviderOauthAuthorizeData, ProviderOauthAuthorizeError, ProviderOauthAuthorizeErrors, ProviderOauthAuthorizeResponse, ProviderOauthAuthorizeResponses, ProviderOauthCallbackData, ProviderOauthCallbackError, ProviderOauthCallbackErrors, ProviderOauthCallbackResponse, ProviderOauthCallbackResponses, Pty, PtyConnectData, PtyConnectError, PtyConnectErrors, PtyConnectResponse, PtyConnectResponses, PtyCreateData, PtyCreateError, PtyCreateErrors, PtyCreateResponse, PtyCreateResponses, PtyGetData, PtyGetError, PtyGetErrors, PtyGetResponse, PtyGetResponses, PtyListData, PtyListResponse, PtyListResponses, PtyRemoveData, PtyRemoveError, PtyRemoveErrors, PtyRemoveResponse, PtyRemoveResponses, PtyUpdateData, PtyUpdateError, PtyUpdateErrors, PtyUpdateResponse, PtyUpdateResponses, Range, ReasoningPart, RetryPart, ServerConfig, Session, SessionAbortData, SessionAbortError, SessionAbortErrors, SessionAbortResponse, SessionAbortResponses, SessionChildrenData, SessionChildrenError, SessionChildrenErrors, SessionChildrenResponse, SessionChildrenResponses, SessionCommandData, SessionCommandError, SessionCommandErrors, SessionCommandResponse, SessionCommandResponses, SessionCreateData, SessionCreateError, SessionCreateErrors, SessionCreateResponse, SessionCreateResponses, SessionDeleteData, SessionDeleteError, SessionDeleteErrors, SessionDeleteResponse, SessionDeleteResponses, SessionDiffData, SessionDiffError, SessionDiffErrors, SessionDiffResponse, SessionDiffResponses, SessionForkData, SessionForkResponse, SessionForkResponses, SessionGetData, SessionGetError, SessionGetErrors, SessionGetResponse, SessionGetResponses, SessionInitData, SessionInitError, SessionInitErrors, SessionInitResponse, SessionInitResponses, SessionListData, SessionListResponse, SessionListResponses, SessionMessageData, SessionMessageError, SessionMessageErrors, SessionMessageResponse, SessionMessageResponses, SessionMessagesData, SessionMessagesError, SessionMessagesErrors, SessionMessagesResponse, SessionMessagesResponses, SessionPromptAsyncData, SessionPromptAsyncError, SessionPromptAsyncErrors, SessionPromptAsyncResponse, SessionPromptAsyncResponses, SessionPromptData, SessionPromptError, SessionPromptErrors, SessionPromptResponse, SessionPromptResponses, SessionRevertData, SessionRevertError, SessionRevertErrors, SessionRevertResponse, SessionRevertResponses, SessionShareData, SessionShareError, SessionShareErrors, SessionShareResponse, SessionShareResponses, SessionShellData, SessionShellError, SessionShellErrors, SessionShellResponse, SessionShellResponses, SessionStatus, SessionStatusData, SessionStatusError, SessionStatusErrors, SessionStatusResponse, SessionStatusResponses, SessionSummarizeData, SessionSummarizeError, SessionSummarizeErrors, SessionSummarizeResponse, SessionSummarizeResponses, SessionTodoData, SessionTodoError, SessionTodoErrors, SessionTodoResponse, SessionTodoResponses, SessionUnrevertData, SessionUnrevertError, SessionUnrevertErrors, SessionUnrevertResponse, SessionUnrevertResponses, SessionUnshareData, SessionUnshareError, SessionUnshareErrors, SessionUnshareResponse, SessionUnshareResponses, SessionUpdateData, SessionUpdateError, SessionUpdateErrors, SessionUpdateResponse, SessionUpdateResponses, SnapshotPart, StepFinishPart, StepStartPart, SubtaskPartInput, Symbol, SymbolSource, TextPart, TextPartInput, Todo, ToolIds, ToolIdsData, ToolIdsError, ToolIdsErrors, ToolIdsResponse, ToolIdsResponses, ToolList, ToolListData, ToolListError, ToolListErrors, ToolListItem, ToolListResponse, ToolListResponses, ToolPart, ToolState, ToolStateCompleted, ToolStateError, ToolStatePending, ToolStateRunning, TuiAppendPromptData, TuiAppendPromptError, TuiAppendPromptErrors, TuiAppendPromptResponse, TuiAppendPromptResponses, TuiClearPromptData, TuiClearPromptResponse, TuiClearPromptResponses, TuiControlNextData, TuiControlNextResponse, TuiControlNextResponses, TuiControlResponseData, TuiControlResponseResponse, TuiControlResponseResponses, TuiExecuteCommandData, TuiExecuteCommandError, TuiExecuteCommandErrors, TuiExecuteCommandResponse, TuiExecuteCommandResponses, TuiOpenHelpData, TuiOpenHelpResponse, TuiOpenHelpResponses, TuiOpenModelsData, TuiOpenModelsResponse, TuiOpenModelsResponses, TuiOpenSessionsData, TuiOpenSessionsResponse, TuiOpenSessionsResponses, TuiOpenThemesData, TuiOpenThemesResponse, TuiOpenThemesResponses, TuiPublishData, TuiPublishError, TuiPublishErrors, TuiPublishResponse, TuiPublishResponses, TuiShowToastData, TuiShowToastResponse, TuiShowToastResponses, TuiSubmitPromptData, TuiSubmitPromptResponse, TuiSubmitPromptResponses, UnknownError, UserMessage, VcsGetData, VcsGetResponse, VcsGetResponses, VcsInfo, WellKnownAuth } from './types.gen'; diff --git a/packages/openapi-ts-tests/sdks/__snapshots__/opencode/grouped/sdk.gen.ts b/packages/openapi-ts-tests/sdks/__snapshots__/opencode/grouped/sdk.gen.ts index c74ddf5b1..3fbe50fde 100644 --- a/packages/openapi-ts-tests/sdks/__snapshots__/opencode/grouped/sdk.gen.ts +++ b/packages/openapi-ts-tests/sdks/__snapshots__/opencode/grouped/sdk.gen.ts @@ -2,7 +2,7 @@ import type { Client, Options as Options2, TDataShape } from './client'; import { client } from './client.gen'; -import type { AppAgentsData, AppAgentsResponses, AppGetData, AppGetResponses, AppInitData, AppInitResponses, AppLogData, AppLogResponses, AuthSetData, AuthSetErrors, AuthSetResponses, ConfigGetData, ConfigGetResponses, ConfigProvidersData, ConfigProvidersResponses, EventSubscribeData, EventSubscribeResponses, FileReadData, FileReadResponses, FileStatusData, FileStatusResponses, FindFilesData, FindFilesResponses, FindSymbolsData, FindSymbolsResponses, FindTextData, FindTextResponses, PostSessionByIdPermissionsByPermissionIdData, PostSessionByIdPermissionsByPermissionIdResponses, SessionAbortData, SessionAbortResponses, SessionChatData, SessionChatResponses, SessionChildrenData, SessionChildrenResponses, SessionCreateData, SessionCreateErrors, SessionCreateResponses, SessionDeleteData, SessionDeleteResponses, SessionGetData, SessionGetResponses, SessionInitData, SessionInitResponses, SessionListData, SessionListResponses, SessionMessageData, SessionMessageResponses, SessionMessagesData, SessionMessagesResponses, SessionRevertData, SessionRevertResponses, SessionShareData, SessionShareResponses, SessionShellData, SessionShellResponses, SessionSummarizeData, SessionSummarizeResponses, SessionUnrevertData, SessionUnrevertResponses, SessionUnshareData, SessionUnshareResponses, SessionUpdateData, SessionUpdateResponses, TuiAppendPromptData, TuiAppendPromptResponses, TuiClearPromptData, TuiClearPromptResponses, TuiExecuteCommandData, TuiExecuteCommandResponses, TuiOpenHelpData, TuiOpenHelpResponses, TuiOpenModelsData, TuiOpenModelsResponses, TuiOpenSessionsData, TuiOpenSessionsResponses, TuiOpenThemesData, TuiOpenThemesResponses, TuiShowToastData, TuiShowToastResponses, TuiSubmitPromptData, TuiSubmitPromptResponses } from './types.gen'; +import type { AppAgentsData, AppAgentsResponses, AppLogData, AppLogErrors, AppLogResponses, AuthSetData, AuthSetErrors, AuthSetResponses, CommandListData, CommandListResponses, ConfigGetData, ConfigGetResponses, ConfigProvidersData, ConfigProvidersResponses, ConfigUpdateData, ConfigUpdateErrors, ConfigUpdateResponses, EventSubscribeData, EventSubscribeResponses, FileListData, FileListResponses, FileReadData, FileReadResponses, FileStatusData, FileStatusResponses, FindFilesData, FindFilesResponses, FindSymbolsData, FindSymbolsResponses, FindTextData, FindTextResponses, FormatterStatusData, FormatterStatusResponses, GlobalDisposeData, GlobalDisposeResponses, GlobalEventData, GlobalEventResponses, GlobalHealthData, GlobalHealthResponses, InstanceDisposeData, InstanceDisposeResponses, LspStatusData, LspStatusResponses, McpAddData, McpAddErrors, McpAddResponses, McpAuthAuthenticateData, McpAuthAuthenticateErrors, McpAuthAuthenticateResponses, McpAuthCallbackData, McpAuthCallbackErrors, McpAuthCallbackResponses, McpAuthRemoveData, McpAuthRemoveErrors, McpAuthRemoveResponses, McpAuthStartData, McpAuthStartErrors, McpAuthStartResponses, McpConnectData, McpConnectResponses, McpDisconnectData, McpDisconnectResponses, McpStatusData, McpStatusResponses, PartDeleteData, PartDeleteErrors, PartDeleteResponses, PartUpdateData, PartUpdateErrors, PartUpdateResponses, PathGetData, PathGetResponses, PermissionListData, PermissionListResponses, PermissionReplyData, PermissionReplyErrors, PermissionReplyResponses, PermissionRespondData, PermissionRespondErrors, PermissionRespondResponses, ProjectCurrentData, ProjectCurrentResponses, ProjectListData, ProjectListResponses, ProjectUpdateData, ProjectUpdateErrors, ProjectUpdateResponses, ProviderAuthData, ProviderAuthResponses, ProviderListData, ProviderListResponses, ProviderOauthAuthorizeData, ProviderOauthAuthorizeErrors, ProviderOauthAuthorizeResponses, ProviderOauthCallbackData, ProviderOauthCallbackErrors, ProviderOauthCallbackResponses, PtyConnectData, PtyConnectErrors, PtyConnectResponses, PtyCreateData, PtyCreateErrors, PtyCreateResponses, PtyGetData, PtyGetErrors, PtyGetResponses, PtyListData, PtyListResponses, PtyRemoveData, PtyRemoveErrors, PtyRemoveResponses, PtyUpdateData, PtyUpdateErrors, PtyUpdateResponses, SessionAbortData, SessionAbortErrors, SessionAbortResponses, SessionChildrenData, SessionChildrenErrors, SessionChildrenResponses, SessionCommandData, SessionCommandErrors, SessionCommandResponses, SessionCreateData, SessionCreateErrors, SessionCreateResponses, SessionDeleteData, SessionDeleteErrors, SessionDeleteResponses, SessionDiffData, SessionDiffErrors, SessionDiffResponses, SessionForkData, SessionForkResponses, SessionGetData, SessionGetErrors, SessionGetResponses, SessionInitData, SessionInitErrors, SessionInitResponses, SessionListData, SessionListResponses, SessionMessageData, SessionMessageErrors, SessionMessageResponses, SessionMessagesData, SessionMessagesErrors, SessionMessagesResponses, SessionPromptAsyncData, SessionPromptAsyncErrors, SessionPromptAsyncResponses, SessionPromptData, SessionPromptErrors, SessionPromptResponses, SessionRevertData, SessionRevertErrors, SessionRevertResponses, SessionShareData, SessionShareErrors, SessionShareResponses, SessionShellData, SessionShellErrors, SessionShellResponses, SessionStatusData, SessionStatusErrors, SessionStatusResponses, SessionSummarizeData, SessionSummarizeErrors, SessionSummarizeResponses, SessionTodoData, SessionTodoErrors, SessionTodoResponses, SessionUnrevertData, SessionUnrevertErrors, SessionUnrevertResponses, SessionUnshareData, SessionUnshareErrors, SessionUnshareResponses, SessionUpdateData, SessionUpdateErrors, SessionUpdateResponses, ToolIdsData, ToolIdsErrors, ToolIdsResponses, ToolListData, ToolListErrors, ToolListResponses, TuiAppendPromptData, TuiAppendPromptErrors, TuiAppendPromptResponses, TuiClearPromptData, TuiClearPromptResponses, TuiControlNextData, TuiControlNextResponses, TuiControlResponseData, TuiControlResponseResponses, TuiExecuteCommandData, TuiExecuteCommandErrors, TuiExecuteCommandResponses, TuiOpenHelpData, TuiOpenHelpResponses, TuiOpenModelsData, TuiOpenModelsResponses, TuiOpenSessionsData, TuiOpenSessionsResponses, TuiOpenThemesData, TuiOpenThemesResponses, TuiPublishData, TuiPublishErrors, TuiPublishResponses, TuiShowToastData, TuiShowToastResponses, TuiSubmitPromptData, TuiSubmitPromptResponses, VcsGetData, VcsGetResponses } from './types.gen'; export type Options = Options2 & { /** @@ -19,32 +19,177 @@ export type Options(options?: Options) => (options?.client ?? client).sse.get({ url: '/event', ...options }); +export const globalHealth = (options?: Options) => (options?.client ?? client).get({ url: '/global/health', ...options }); + +/** + * Get global events + * + * Subscribe to global events from the OpenCode system using server-sent events. + */ +export const globalEvent = (options?: Options) => (options?.client ?? client).sse.get({ url: '/global/event', ...options }); + +/** + * Dispose instance + * + * Clean up and dispose all OpenCode instances, releasing all resources. + */ +export const globalDispose = (options?: Options) => (options?.client ?? client).post({ url: '/global/dispose', ...options }); + +/** + * List all projects + * + * Get a list of projects that have been opened with OpenCode. + */ +export const projectList = (options?: Options) => (options?.client ?? client).get({ url: '/project', ...options }); + +/** + * Get current project + * + * Retrieve the currently active project that OpenCode is working with. + */ +export const projectCurrent = (options?: Options) => (options?.client ?? client).get({ url: '/project/current', ...options }); + +/** + * Update project + * + * Update project properties such as name, icon and color. + */ +export const projectUpdate = (options: Options) => (options.client ?? client).patch({ + url: '/project/{projectID}', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options.headers + } +}); + +/** + * List PTY sessions + * + * Get a list of all active pseudo-terminal (PTY) sessions managed by OpenCode. + */ +export const ptyList = (options?: Options) => (options?.client ?? client).get({ url: '/pty', ...options }); + +/** + * Create PTY session + * + * Create a new pseudo-terminal (PTY) session for running shell commands and processes. + */ +export const ptyCreate = (options?: Options) => (options?.client ?? client).post({ + url: '/pty', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } +}); /** - * Get app info + * Remove PTY session + * + * Remove and terminate a specific pseudo-terminal (PTY) session. */ -export const appGet = (options?: Options) => (options?.client ?? client).get({ url: '/app', ...options }); +export const ptyRemove = (options: Options) => (options.client ?? client).delete({ url: '/pty/{ptyID}', ...options }); /** - * Initialize the app + * Get PTY session + * + * Retrieve detailed information about a specific pseudo-terminal (PTY) session. */ -export const appInit = (options?: Options) => (options?.client ?? client).post({ url: '/app/init', ...options }); +export const ptyGet = (options: Options) => (options.client ?? client).get({ url: '/pty/{ptyID}', ...options }); + +/** + * Update PTY session + * + * Update properties of an existing pseudo-terminal (PTY) session. + */ +export const ptyUpdate = (options: Options) => (options.client ?? client).put({ + url: '/pty/{ptyID}', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options.headers + } +}); /** - * Get config info + * Connect to PTY session + * + * Establish a WebSocket connection to interact with a pseudo-terminal (PTY) session in real-time. + */ +export const ptyConnect = (options: Options) => (options.client ?? client).get({ url: '/pty/{ptyID}/connect', ...options }); + +/** + * Get configuration + * + * Retrieve the current OpenCode configuration settings and preferences. */ export const configGet = (options?: Options) => (options?.client ?? client).get({ url: '/config', ...options }); /** - * List all sessions + * Update configuration + * + * Update OpenCode configuration settings and preferences. + */ +export const configUpdate = (options?: Options) => (options?.client ?? client).patch({ + url: '/config', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } +}); + +/** + * List tool IDs + * + * Get a list of all available tool IDs, including both built-in tools and dynamically registered tools. + */ +export const toolIds = (options?: Options) => (options?.client ?? client).get({ url: '/experimental/tool/ids', ...options }); + +/** + * List tools + * + * Get a list of available tools with their JSON schema parameters for a specific provider and model combination. + */ +export const toolList = (options: Options) => (options.client ?? client).get({ url: '/experimental/tool', ...options }); + +/** + * Dispose instance + * + * Clean up and dispose the current OpenCode instance, releasing all resources. + */ +export const instanceDispose = (options?: Options) => (options?.client ?? client).post({ url: '/instance/dispose', ...options }); + +/** + * Get paths + * + * Retrieve the current working directory and related path information for the OpenCode instance. + */ +export const pathGet = (options?: Options) => (options?.client ?? client).get({ url: '/path', ...options }); + +/** + * Get VCS info + * + * Retrieve version control system (VCS) information for the current project, such as git branch. + */ +export const vcsGet = (options?: Options) => (options?.client ?? client).get({ url: '/vcs', ...options }); + +/** + * List sessions + * + * Get a list of all OpenCode sessions, sorted by most recently updated. */ export const sessionList = (options?: Options) => (options?.client ?? client).get({ url: '/session', ...options }); /** - * Create a new session + * Create session + * + * Create a new OpenCode session for interacting with AI assistants and managing conversations. */ export const sessionCreate = (options?: Options) => (options?.client ?? client).post({ url: '/session', @@ -56,20 +201,33 @@ export const sessionCreate = (options?: Op }); /** - * Delete a session and all its data + * Get session status + * + * Retrieve the current status of all sessions, including active, idle, and completed states. */ -export const sessionDelete = (options: Options) => (options.client ?? client).delete({ url: '/session/{id}', ...options }); +export const sessionStatus = (options?: Options) => (options?.client ?? client).get({ url: '/session/status', ...options }); + +/** + * Delete session + * + * Delete a session and permanently remove all associated data, including messages and history. + */ +export const sessionDelete = (options: Options) => (options.client ?? client).delete({ url: '/session/{sessionID}', ...options }); /** * Get session + * + * Retrieve detailed information about a specific OpenCode session. */ -export const sessionGet = (options: Options) => (options.client ?? client).get({ url: '/session/{id}', ...options }); +export const sessionGet = (options: Options) => (options.client ?? client).get({ url: '/session/{sessionID}', ...options }); /** - * Update session properties + * Update session + * + * Update properties of an existing session, such as title or other metadata. */ -export const sessionUpdate = (options: Options) => (options.client ?? client).patch({ - url: '/session/{id}', +export const sessionUpdate = (options: Options) => (options.client ?? client).patch({ + url: '/session/{sessionID}', ...options, headers: { 'Content-Type': 'application/json', @@ -78,15 +236,40 @@ export const sessionUpdate = (options: Opt }); /** - * Get a session's children + * Get session children + * + * Retrieve all child sessions that were forked from the specified parent session. + */ +export const sessionChildren = (options: Options) => (options.client ?? client).get({ url: '/session/{sessionID}/children', ...options }); + +/** + * Get session todos + * + * Retrieve the todo list associated with a specific session, showing tasks and action items. + */ +export const sessionTodo = (options: Options) => (options.client ?? client).get({ url: '/session/{sessionID}/todo', ...options }); + +/** + * Initialize session + * + * Analyze the current application and create an AGENTS.md file with project-specific agent configurations. */ -export const sessionChildren = (options: Options) => (options.client ?? client).get({ url: '/session/{id}/children', ...options }); +export const sessionInit = (options: Options) => (options.client ?? client).post({ + url: '/session/{sessionID}/init', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options.headers + } +}); /** - * Analyze the app and create an AGENTS.md file + * Fork session + * + * Create a new session by forking an existing session at a specific message point. */ -export const sessionInit = (options: Options) => (options.client ?? client).post({ - url: '/session/{id}/init', +export const sessionFork = (options: Options) => (options.client ?? client).post({ + url: '/session/{sessionID}/fork', ...options, headers: { 'Content-Type': 'application/json', @@ -95,25 +278,40 @@ export const sessionInit = (options: Optio }); /** - * Abort a session + * Abort session + * + * Abort an active session and stop any ongoing AI processing or command execution. */ -export const sessionAbort = (options: Options) => (options.client ?? client).post({ url: '/session/{id}/abort', ...options }); +export const sessionAbort = (options: Options) => (options.client ?? client).post({ url: '/session/{sessionID}/abort', ...options }); /** - * Unshare the session + * Unshare session + * + * Remove the shareable link for a session, making it private again. */ -export const sessionUnshare = (options: Options) => (options.client ?? client).delete({ url: '/session/{id}/share', ...options }); +export const sessionUnshare = (options: Options) => (options.client ?? client).delete({ url: '/session/{sessionID}/share', ...options }); /** - * Share a session + * Share session + * + * Create a shareable link for a session, allowing others to view the conversation. */ -export const sessionShare = (options: Options) => (options.client ?? client).post({ url: '/session/{id}/share', ...options }); +export const sessionShare = (options: Options) => (options.client ?? client).post({ url: '/session/{sessionID}/share', ...options }); /** - * Summarize the session + * Get session diff + * + * Get all file changes (diffs) made during this session. */ -export const sessionSummarize = (options: Options) => (options.client ?? client).post({ - url: '/session/{id}/summarize', +export const sessionDiff = (options: Options) => (options.client ?? client).get({ url: '/session/{sessionID}/diff', ...options }); + +/** + * Summarize session + * + * Generate a concise summary of the session using AI compaction to preserve key information. + */ +export const sessionSummarize = (options: Options) => (options.client ?? client).post({ + url: '/session/{sessionID}/summarize', ...options, headers: { 'Content-Type': 'application/json', @@ -122,15 +320,19 @@ export const sessionSummarize = (options: }); /** - * List messages for a session + * Get session messages + * + * Retrieve all messages in a session, including user prompts and AI responses. */ -export const sessionMessages = (options: Options) => (options.client ?? client).get({ url: '/session/{id}/message', ...options }); +export const sessionMessages = (options: Options) => (options.client ?? client).get({ url: '/session/{sessionID}/message', ...options }); /** - * Create and send a new message to a session + * Send message + * + * Create and send a new message to a session, streaming the AI response. */ -export const sessionChat = (options: Options) => (options.client ?? client).post({ - url: '/session/{id}/message', +export const sessionPrompt = (options: Options) => (options.client ?? client).post({ + url: '/session/{sessionID}/message', ...options, headers: { 'Content-Type': 'application/json', @@ -139,15 +341,36 @@ export const sessionChat = (options: Optio }); /** - * Get a message from a session + * Get message + * + * Retrieve a specific message from a session by its message ID. + */ +export const sessionMessage = (options: Options) => (options.client ?? client).get({ url: '/session/{sessionID}/message/{messageID}', ...options }); + +/** + * Delete a part from a message + */ +export const partDelete = (options: Options) => (options.client ?? client).delete({ url: '/session/{sessionID}/message/{messageID}/part/{partID}', ...options }); + +/** + * Update a part in a message */ -export const sessionMessage = (options: Options) => (options.client ?? client).get({ url: '/session/{id}/message/{messageID}', ...options }); +export const partUpdate = (options: Options) => (options.client ?? client).patch({ + url: '/session/{sessionID}/message/{messageID}/part/{partID}', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options.headers + } +}); /** - * Run a shell command + * Send async message + * + * Create and send a new message to a session asynchronously, starting the session if needed and returning immediately. */ -export const sessionShell = (options: Options) => (options.client ?? client).post({ - url: '/session/{id}/shell', +export const sessionPromptAsync = (options: Options) => (options.client ?? client).post({ + url: '/session/{sessionID}/prompt_async', ...options, headers: { 'Content-Type': 'application/json', @@ -156,10 +379,12 @@ export const sessionShell = (options: Opti }); /** - * Revert a message + * Send command + * + * Send a new command to a session for execution by the AI assistant. */ -export const sessionRevert = (options: Options) => (options.client ?? client).post({ - url: '/session/{id}/revert', +export const sessionCommand = (options: Options) => (options.client ?? client).post({ + url: '/session/{sessionID}/command', ...options, headers: { 'Content-Type': 'application/json', @@ -168,15 +393,26 @@ export const sessionRevert = (options: Opt }); /** - * Restore all reverted messages + * Run shell command + * + * Execute a shell command within the session context and return the AI's response. */ -export const sessionUnrevert = (options: Options) => (options.client ?? client).post({ url: '/session/{id}/unrevert', ...options }); +export const sessionShell = (options: Options) => (options.client ?? client).post({ + url: '/session/{sessionID}/shell', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options.headers + } +}); /** - * Respond to a permission request + * Revert message + * + * Revert a specific message in a session, undoing its effects and restoring the previous state. */ -export const postSessionByIdPermissionsByPermissionId = (options: Options) => (options.client ?? client).post({ - url: '/session/{id}/permissions/{permissionID}', +export const sessionRevert = (options: Options) => (options.client ?? client).post({ + url: '/session/{sessionID}/revert', ...options, headers: { 'Content-Type': 'application/json', @@ -185,39 +421,153 @@ export const postSessionByIdPermissionsByPermissionId = (options: Options) => (options.client ?? client).post({ url: '/session/{sessionID}/unrevert', ...options }); + +/** + * Respond to permission + * + * Approve or deny a permission request from the AI assistant. + * + * @deprecated + */ +export const permissionRespond = (options: Options) => (options.client ?? client).post({ + url: '/session/{sessionID}/permissions/{permissionID}', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options.headers + } +}); + +/** + * Respond to permission request + * + * Approve or deny a permission request from the AI assistant. + */ +export const permissionReply = (options: Options) => (options.client ?? client).post({ + url: '/permission/{requestID}/reply', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options.headers + } +}); + +/** + * List pending permissions + * + * Get all pending permission requests across all sessions. + */ +export const permissionList = (options?: Options) => (options?.client ?? client).get({ url: '/permission', ...options }); + +/** + * List commands + * + * Get a list of all available commands in the OpenCode system. + */ +export const commandList = (options?: Options) => (options?.client ?? client).get({ url: '/command', ...options }); + +/** + * List config providers + * + * Get a list of all configured AI providers and their default models. */ export const configProviders = (options?: Options) => (options?.client ?? client).get({ url: '/config/providers', ...options }); /** - * Find text in files + * List providers + * + * Get a list of all available AI providers, including both available and connected ones. + */ +export const providerList = (options?: Options) => (options?.client ?? client).get({ url: '/provider', ...options }); + +/** + * Get provider auth methods + * + * Retrieve available authentication methods for all AI providers. + */ +export const providerAuth = (options?: Options) => (options?.client ?? client).get({ url: '/provider/auth', ...options }); + +/** + * OAuth authorize + * + * Initiate OAuth authorization for a specific AI provider to get an authorization URL. + */ +export const providerOauthAuthorize = (options: Options) => (options.client ?? client).post({ + url: '/provider/{providerID}/oauth/authorize', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options.headers + } +}); + +/** + * OAuth callback + * + * Handle the OAuth callback from a provider after user authorization. + */ +export const providerOauthCallback = (options: Options) => (options.client ?? client).post({ + url: '/provider/{providerID}/oauth/callback', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options.headers + } +}); + +/** + * Find text + * + * Search for text patterns across files in the project using ripgrep. */ export const findText = (options: Options) => (options.client ?? client).get({ url: '/find', ...options }); /** * Find files + * + * Search for files or directories by name or pattern in the project directory. */ export const findFiles = (options: Options) => (options.client ?? client).get({ url: '/find/file', ...options }); /** - * Find workspace symbols + * Find symbols + * + * Search for workspace symbols like functions, classes, and variables using LSP. */ export const findSymbols = (options: Options) => (options.client ?? client).get({ url: '/find/symbol', ...options }); /** - * Read a file + * List files + * + * List files and directories in a specified path. */ -export const fileRead = (options: Options) => (options.client ?? client).get({ url: '/file', ...options }); +export const fileList = (options: Options) => (options.client ?? client).get({ url: '/file', ...options }); + +/** + * Read file + * + * Read the content of a specified file. + */ +export const fileRead = (options: Options) => (options.client ?? client).get({ url: '/file/content', ...options }); /** * Get file status + * + * Get the git status of all files in the project. */ export const fileStatus = (options?: Options) => (options?.client ?? client).get({ url: '/file/status', ...options }); /** - * Write a log entry to the server logs + * Write log + * + * Write a log entry to the server logs with specified level and metadata. */ -export const appLog = (options?: Options) => (options?.client ?? client).post({ +export const appLog = (options?: Options) => (options?.client ?? client).post({ url: '/log', ...options, headers: { @@ -227,14 +577,98 @@ export const appLog = (options?: Options(options?: Options) => (options?.client ?? client).get({ url: '/agent', ...options }); /** + * Get MCP status + * + * Get the status of all Model Context Protocol (MCP) servers. + */ +export const mcpStatus = (options?: Options) => (options?.client ?? client).get({ url: '/mcp', ...options }); + +/** + * Add MCP server + * + * Dynamically add a new Model Context Protocol (MCP) server to the system. + */ +export const mcpAdd = (options?: Options) => (options?.client ?? client).post({ + url: '/mcp', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } +}); + +/** + * Remove MCP OAuth + * + * Remove OAuth credentials for an MCP server + */ +export const mcpAuthRemove = (options: Options) => (options.client ?? client).delete({ url: '/mcp/{name}/auth', ...options }); + +/** + * Start MCP OAuth + * + * Start OAuth authentication flow for a Model Context Protocol (MCP) server. + */ +export const mcpAuthStart = (options: Options) => (options.client ?? client).post({ url: '/mcp/{name}/auth', ...options }); + +/** + * Complete MCP OAuth + * + * Complete OAuth authentication for a Model Context Protocol (MCP) server using the authorization code. + */ +export const mcpAuthCallback = (options: Options) => (options.client ?? client).post({ + url: '/mcp/{name}/auth/callback', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options.headers + } +}); + +/** + * Authenticate MCP OAuth + * + * Start OAuth flow and wait for callback (opens browser) + */ +export const mcpAuthAuthenticate = (options: Options) => (options.client ?? client).post({ url: '/mcp/{name}/auth/authenticate', ...options }); + +/** + * Connect an MCP server + */ +export const mcpConnect = (options: Options) => (options.client ?? client).post({ url: '/mcp/{name}/connect', ...options }); + +/** + * Disconnect an MCP server + */ +export const mcpDisconnect = (options: Options) => (options.client ?? client).post({ url: '/mcp/{name}/disconnect', ...options }); + +/** + * Get LSP status + * + * Get LSP server status + */ +export const lspStatus = (options?: Options) => (options?.client ?? client).get({ url: '/lsp', ...options }); + +/** + * Get formatter status + * + * Get formatter status + */ +export const formatterStatus = (options?: Options) => (options?.client ?? client).get({ url: '/formatter', ...options }); + +/** + * Append TUI prompt + * * Append prompt to the TUI */ -export const tuiAppendPrompt = (options?: Options) => (options?.client ?? client).post({ +export const tuiAppendPrompt = (options?: Options) => (options?.client ?? client).post({ url: '/tui/append-prompt', ...options, headers: { @@ -244,39 +678,53 @@ export const tuiAppendPrompt = (options?: }); /** - * Open the help dialog + * Open help dialog + * + * Open the help dialog in the TUI to display user assistance information. */ export const tuiOpenHelp = (options?: Options) => (options?.client ?? client).post({ url: '/tui/open-help', ...options }); /** + * Open sessions dialog + * * Open the session dialog */ export const tuiOpenSessions = (options?: Options) => (options?.client ?? client).post({ url: '/tui/open-sessions', ...options }); /** + * Open themes dialog + * * Open the theme dialog */ export const tuiOpenThemes = (options?: Options) => (options?.client ?? client).post({ url: '/tui/open-themes', ...options }); /** + * Open models dialog + * * Open the model dialog */ export const tuiOpenModels = (options?: Options) => (options?.client ?? client).post({ url: '/tui/open-models', ...options }); /** + * Submit TUI prompt + * * Submit the prompt */ export const tuiSubmitPrompt = (options?: Options) => (options?.client ?? client).post({ url: '/tui/submit-prompt', ...options }); /** + * Clear TUI prompt + * * Clear the prompt */ export const tuiClearPrompt = (options?: Options) => (options?.client ?? client).post({ url: '/tui/clear-prompt', ...options }); /** + * Execute TUI command + * * Execute a TUI command (e.g. agent_cycle) */ -export const tuiExecuteCommand = (options?: Options) => (options?.client ?? client).post({ +export const tuiExecuteCommand = (options?: Options) => (options?.client ?? client).post({ url: '/tui/execute-command', ...options, headers: { @@ -286,6 +734,8 @@ export const tuiExecuteCommand = (options? }); /** + * Show TUI toast + * * Show a toast notification in the TUI */ export const tuiShowToast = (options?: Options) => (options?.client ?? client).post({ @@ -298,13 +748,57 @@ export const tuiShowToast = (options?: Opt }); /** + * Publish TUI event + * + * Publish a TUI event + */ +export const tuiPublish = (options?: Options) => (options?.client ?? client).post({ + url: '/tui/publish', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } +}); + +/** + * Get next TUI request + * + * Retrieve the next TUI (Terminal User Interface) request from the queue for processing. + */ +export const tuiControlNext = (options?: Options) => (options?.client ?? client).get({ url: '/tui/control/next', ...options }); + +/** + * Submit TUI response + * + * Submit a response to the TUI request queue to complete a pending request. + */ +export const tuiControlResponse = (options?: Options) => (options?.client ?? client).post({ + url: '/tui/control/response', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } +}); + +/** + * Set auth credentials + * * Set authentication credentials */ export const authSet = (options: Options) => (options.client ?? client).put({ - url: '/auth/{id}', + url: '/auth/{providerID}', ...options, headers: { 'Content-Type': 'application/json', ...options.headers } }); + +/** + * Subscribe to events + * + * Get events + */ +export const eventSubscribe = (options?: Options) => (options?.client ?? client).sse.get({ url: '/event', ...options }); diff --git a/packages/openapi-ts-tests/sdks/__snapshots__/opencode/grouped/types.gen.ts b/packages/openapi-ts-tests/sdks/__snapshots__/opencode/grouped/types.gen.ts index ccd376c4b..e1be81f3e 100644 --- a/packages/openapi-ts-tests/sdks/__snapshots__/opencode/grouped/types.gen.ts +++ b/packages/openapi-ts-tests/sdks/__snapshots__/opencode/grouped/types.gen.ts @@ -4,42 +4,6 @@ export type ClientOptions = { baseUrl: `${string}://${string}` | (string & {}); }; -export type Event = ({ - type: 'installation.updated'; -} & EventInstallationUpdated) | ({ - type: 'lsp.client.diagnostics'; -} & EventLspClientDiagnostics) | ({ - type: 'message.updated'; -} & EventMessageUpdated) | ({ - type: 'message.removed'; -} & EventMessageRemoved) | ({ - type: 'message.part.updated'; -} & EventMessagePartUpdated) | ({ - type: 'message.part.removed'; -} & EventMessagePartRemoved) | ({ - type: 'storage.write'; -} & EventStorageWrite) | ({ - type: 'permission.updated'; -} & EventPermissionUpdated) | ({ - type: 'permission.replied'; -} & EventPermissionReplied) | ({ - type: 'file.edited'; -} & EventFileEdited) | ({ - type: 'session.updated'; -} & EventSessionUpdated) | ({ - type: 'session.deleted'; -} & EventSessionDeleted) | ({ - type: 'session.idle'; -} & EventSessionIdle) | ({ - type: 'session.error'; -} & EventSessionError) | ({ - type: 'server.connected'; -} & EventServerConnected) | ({ - type: 'file.watcher.updated'; -} & EventFileWatcherUpdated) | ({ - type: 'ide.installed'; -} & EventIdeInstalled); - export type EventInstallationUpdated = { type: 'installation.updated'; properties: { @@ -47,6 +11,41 @@ export type EventInstallationUpdated = { }; }; +export type EventInstallationUpdateAvailable = { + type: 'installation.update-available'; + properties: { + version: string; + }; +}; + +export type Project = { + id: string; + worktree: string; + vcs?: 'git'; + name?: string; + icon?: { + url?: string; + color?: string; + }; + time: { + created: number; + updated: number; + initialized?: number; + }; +}; + +export type EventProjectUpdated = { + type: 'project.updated'; + properties: Project; +}; + +export type EventServerInstanceDisposed = { + type: 'server.instance.disposed'; + properties: { + directory: string; + }; +}; + export type EventLspClientDiagnostics = { type: 'lsp.client.diagnostics'; properties: { @@ -55,18 +54,20 @@ export type EventLspClientDiagnostics = { }; }; -export type EventMessageUpdated = { - type: 'message.updated'; +export type EventLspUpdated = { + type: 'lsp.updated'; properties: { - info: Message; + [key: string]: unknown; }; }; -export type Message = ({ - role: 'user'; -} & UserMessage) | ({ - role: 'assistant'; -} & AssistantMessage); +export type FileDiff = { + file: string; + before: string; + after: string; + additions: number; + deletions: number; +}; export type UserMessage = { id: string; @@ -75,6 +76,66 @@ export type UserMessage = { time: { created: number; }; + summary?: { + title?: string; + body?: string; + diffs: Array; + }; + agent: string; + model: { + providerID: string; + modelID: string; + }; + system?: string; + tools?: { + [key: string]: boolean; + }; + variant?: string; +}; + +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 ApiError = { + name: 'APIError'; + data: { + message: string; + statusCode?: number; + isRetryable: boolean; + responseHeaders?: { + [key: string]: string; + }; + responseBody?: string; + metadata?: { + [key: string]: string; + }; + }; }; export type AssistantMessage = { @@ -85,19 +146,12 @@ export type AssistantMessage = { created: number; completed?: number; }; - error?: ({ - name: 'ProviderAuthError'; - } & ProviderAuthError) | ({ - name: 'UnknownError'; - } & UnknownError) | ({ - name: 'MessageOutputLengthError'; - } & MessageOutputLengthError) | ({ - name: 'MessageAbortedError'; - } & MessageAbortedError); - system: Array; + error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError | ApiError; + parentID: string; modelID: string; providerID: string; mode: string; + agent: string; path: { cwd: string; root: string; @@ -113,34 +167,15 @@ export type AssistantMessage = { write: number; }; }; + finish?: string; }; -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 Message = UserMessage | AssistantMessage; -export type MessageAbortedError = { - name: 'MessageAbortedError'; - data: { - [key: string]: unknown; +export type EventMessageUpdated = { + type: 'message.updated'; + properties: { + info: Message; }; }; @@ -152,33 +187,6 @@ export type EventMessageRemoved = { }; }; -export type EventMessagePartUpdated = { - type: 'message.part.updated'; - properties: { - part: Part; - }; -}; - -export type Part = ({ - type: 'text'; -} & TextPart) | ({ - type: 'reasoning'; -} & ReasoningPart) | ({ - type: 'file'; -} & FilePart) | ({ - type: 'tool'; -} & ToolPart) | ({ - type: 'step-start'; -} & StepStartPart) | ({ - type: 'step-finish'; -} & StepFinishPart) | ({ - type: 'snapshot'; -} & SnapshotPart) | ({ - type: 'patch'; -} & PatchPart) | ({ - type: 'agent'; -} & AgentPart); - export type TextPart = { id: string; sessionID: string; @@ -186,10 +194,14 @@ export type TextPart = { type: 'text'; text: string; synthetic?: boolean; + ignored?: boolean; time?: { start: number; end?: number; }; + metadata?: { + [key: string]: unknown; + }; }; export type ReasoningPart = { @@ -207,42 +219,16 @@ export type ReasoningPart = { }; }; -export type FilePart = { - id: string; - sessionID: string; - messageID: string; - type: 'file'; - mime: string; - filename?: string; - url: string; - source?: FilePartSource; -}; - -export type FilePartSource = ({ - type: 'file'; -} & FileSource) | ({ - type: 'symbol'; -} & SymbolSource); - -export type FileSource = { - text: FilePartSourceText; - type: 'file'; - path: string; -}; - export type FilePartSourceText = { value: string; start: number; end: number; }; -export type SymbolSource = { +export type FileSource = { text: FilePartSourceText; - type: 'symbol'; + type: 'file'; path: string; - range: Range; - name: string; - kind: number; }; export type Range = { @@ -256,33 +242,41 @@ export type Range = { }; }; -export type ToolPart = { +export type SymbolSource = { + text: FilePartSourceText; + type: 'symbol'; + path: string; + range: Range; + name: string; + kind: number; +}; + +export type FilePartSource = FileSource | SymbolSource; + +export type FilePart = { id: string; sessionID: string; messageID: string; - type: 'tool'; - callID: string; - tool: string; - state: ToolState; + type: 'file'; + mime: string; + filename?: string; + url: string; + source?: FilePartSource; }; -export type ToolState = ({ - status: 'pending'; -} & ToolStatePending) | ({ - status: 'running'; -} & ToolStateRunning) | ({ - status: 'completed'; -} & ToolStateCompleted) | ({ - status: 'error'; -} & ToolStateError); - export type ToolStatePending = { status: 'pending'; + input: { + [key: string]: unknown; + }; + raw: string; }; export type ToolStateRunning = { status: 'running'; - input?: unknown; + input: { + [key: string]: unknown; + }; title?: string; metadata?: { [key: string]: unknown; @@ -305,7 +299,9 @@ export type ToolStateCompleted = { time: { start: number; end: number; + compacted?: number; }; + attachments?: Array; }; export type ToolStateError = { @@ -323,11 +319,27 @@ export type ToolStateError = { }; }; +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 = { @@ -335,6 +347,8 @@ export type StepFinishPart = { sessionID: string; messageID: string; type: 'step-finish'; + reason: string; + snapshot?: string; cost: number; tokens: { input: number; @@ -377,70 +391,215 @@ export type AgentPart = { }; }; -export type EventMessagePartRemoved = { - type: 'message.part.removed'; - properties: { - sessionID: string; - messageID: string; - partID: string; +export type RetryPart = { + id: string; + sessionID: string; + messageID: string; + type: 'retry'; + attempt: number; + error: ApiError; + time: { + created: number; }; }; -export type EventStorageWrite = { - type: 'storage.write'; +export type CompactionPart = { + id: string; + sessionID: string; + messageID: string; + type: 'compaction'; + auto: boolean; +}; + +export type Part = TextPart | { + id: string; + sessionID: string; + messageID: string; + type: 'subtask'; + prompt: string; + description: string; + agent: string; + command?: string; +} | ReasoningPart | FilePart | ToolPart | StepStartPart | StepFinishPart | SnapshotPart | PatchPart | AgentPart | RetryPart | CompactionPart; + +export type EventMessagePartUpdated = { + type: 'message.part.updated'; properties: { - key: string; - content?: unknown; + part: Part; + delta?: string; }; }; -export type EventPermissionUpdated = { - type: 'permission.updated'; - properties: Permission; +export type EventMessagePartRemoved = { + type: 'message.part.removed'; + properties: { + sessionID: string; + messageID: string; + partID: string; + }; }; -export type Permission = { +export type PermissionRequest = { id: string; - type: string; - pattern?: string; sessionID: string; - messageID: string; - callID?: string; - title: string; + permission: string; + patterns: Array; metadata: { [key: string]: unknown; }; - time: { - created: number; + always: Array; + tool?: { + messageID: string; + callID: string; }; }; +export type EventPermissionAsked = { + type: 'permission.asked'; + properties: PermissionRequest; +}; + export type EventPermissionReplied = { type: 'permission.replied'; properties: { sessionID: string; - permissionID: string; - response: string; + requestID: string; + reply: 'once' | 'always' | 'reject'; }; }; -export type EventFileEdited = { - type: 'file.edited'; +export type SessionStatus = { + type: 'idle'; +} | { + type: 'retry'; + attempt: number; + message: string; + next: number; +} | { + type: 'busy'; +}; + +export type EventSessionStatus = { + type: 'session.status'; properties: { - file: string; + sessionID: string; + status: SessionStatus; }; }; -export type EventSessionUpdated = { - type: 'session.updated'; +export type EventSessionIdle = { + type: 'session.idle'; properties: { - info: Session; + sessionID: string; + }; +}; + +export type EventSessionCompacted = { + type: 'session.compacted'; + properties: { + sessionID: string; + }; +}; + +export type EventFileEdited = { + type: 'file.edited'; + properties: { + file: 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; + /** + * Unique identifier for the todo item + */ + id: string; +}; + +export type EventTodoUpdated = { + type: 'todo.updated'; + properties: { + sessionID: string; + todos: Array; }; }; +export type EventTuiPromptAppend = { + type: 'tui.prompt.append'; + properties: { + text: string; + }; +}; + +export type EventTuiCommandExecute = { + type: 'tui.command.execute'; + properties: { + command: 'session.list' | 'session.new' | 'session.share' | 'session.interrupt' | 'session.compact' | 'session.page.up' | 'session.page.down' | 'session.half.page.up' | 'session.half.page.down' | 'session.first' | 'session.last' | 'prompt.clear' | 'prompt.submit' | 'agent.cycle' | string; + }; +}; + +export type EventTuiToastShow = { + type: 'tui.toast.show'; + properties: { + title?: string; + message: string; + variant: 'info' | 'success' | 'warning' | 'error'; + /** + * Duration in milliseconds + */ + duration?: number; + }; +}; + +export type EventMcpToolsChanged = { + type: 'mcp.tools.changed'; + properties: { + server: string; + }; +}; + +export type EventCommandExecuted = { + type: 'command.executed'; + properties: { + name: string; + sessionID: string; + arguments: string; + messageID: string; + }; +}; + +export type PermissionAction = 'allow' | 'deny' | 'ask'; + +export type PermissionRule = { + permission: string; + pattern: string; + action: PermissionAction; +}; + +export type PermissionRuleset = Array; + export type Session = { id: string; + projectID: string; + directory: string; parentID?: string; + summary?: { + additions: number; + deletions: number; + files: number; + diffs?: Array; + }; share?: { url: string; }; @@ -449,7 +608,10 @@ export type Session = { time: { created: number; updated: number; + compacting?: number; + archived?: number; }; + permission?: PermissionRuleset; revert?: { messageID: string; partID?: string; @@ -458,6 +620,20 @@ export type Session = { }; }; +export type EventSessionCreated = { + type: 'session.created'; + properties: { + info: Session; + }; +}; + +export type EventSessionUpdated = { + type: 'session.updated'; + properties: { + info: Session; + }; +}; + export type EventSessionDeleted = { type: 'session.deleted'; properties: { @@ -465,10 +641,11 @@ export type EventSessionDeleted = { }; }; -export type EventSessionIdle = { - type: 'session.idle'; +export type EventSessionDiff = { + type: 'session.diff'; properties: { sessionID: string; + diff: Array; }; }; @@ -476,442 +653,516 @@ export type EventSessionError = { type: 'session.error'; properties: { sessionID?: string; - error?: ({ - name: 'ProviderAuthError'; - } & ProviderAuthError) | ({ - name: 'UnknownError'; - } & UnknownError) | ({ - name: 'MessageOutputLengthError'; - } & MessageOutputLengthError) | ({ - name: 'MessageAbortedError'; - } & MessageAbortedError); + error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError | ApiError; }; }; -export type EventServerConnected = { - type: 'server.connected'; +export type EventFileWatcherUpdated = { + type: 'file.watcher.updated'; properties: { - [key: string]: unknown; + file: string; + event: 'add' | 'change' | 'unlink'; }; }; -export type EventFileWatcherUpdated = { - type: 'file.watcher.updated'; +export type EventVcsBranchUpdated = { + type: 'vcs.branch.updated'; properties: { - file: string; - event: 'rename' | 'change'; + branch?: string; }; }; -export type EventIdeInstalled = { - type: 'ide.installed'; +export type Pty = { + id: string; + title: string; + command: string; + args: Array; + cwd: string; + status: 'running' | 'exited'; + pid: number; +}; + +export type EventPtyCreated = { + type: 'pty.created'; properties: { - ide: string; + info: Pty; }; }; -export type App = { - hostname: string; - git: boolean; - path: { - config: string; - data: string; - root: string; - cwd: string; - state: string; +export type EventPtyUpdated = { + type: 'pty.updated'; + properties: { + info: Pty; }; - time: { - initialized?: number; +}; + +export type EventPtyExited = { + type: 'pty.exited'; + properties: { + id: string; + exitCode: number; }; }; -export type Config = { +export type EventPtyDeleted = { + type: 'pty.deleted'; + properties: { + id: string; + }; +}; + +export type EventServerConnected = { + type: 'server.connected'; + properties: { + [key: string]: unknown; + }; +}; + +export type EventGlobalDisposed = { + type: 'global.disposed'; + properties: { + [key: string]: unknown; + }; +}; + +export type Event = EventInstallationUpdated | EventInstallationUpdateAvailable | EventProjectUpdated | EventServerInstanceDisposed | EventLspClientDiagnostics | EventLspUpdated | EventMessageUpdated | EventMessageRemoved | EventMessagePartUpdated | EventMessagePartRemoved | EventPermissionAsked | EventPermissionReplied | EventSessionStatus | EventSessionIdle | EventSessionCompacted | EventFileEdited | EventTodoUpdated | EventTuiPromptAppend | EventTuiCommandExecute | EventTuiToastShow | EventMcpToolsChanged | EventCommandExecuted | EventSessionCreated | EventSessionUpdated | EventSessionDeleted | EventSessionDiff | EventSessionError | EventFileWatcherUpdated | EventVcsBranchUpdated | EventPtyCreated | EventPtyUpdated | EventPtyExited | EventPtyDeleted | EventServerConnected | EventGlobalDisposed; + +export type GlobalEvent = { + directory: string; + payload: Event; +}; + +export type BadRequestError = { + data: unknown; + errors: Array<{ + [key: string]: unknown; + }>; + success: false; +}; + +export type NotFoundError = { + name: 'NotFoundError'; + data: { + message: string; + }; +}; + +/** + * Custom keybind configurations + */ +export type KeybindsConfig = { /** - * JSON schema reference for configuration validation + * Leader key for keybind combinations */ - $schema?: string; + leader?: string; /** - * Theme name to use for the interface + * Exit the application */ - theme?: string; + app_exit?: string; /** - * Custom keybind configurations + * Open external editor */ - keybinds?: KeybindsConfig; + editor_open?: string; /** - * TUI specific settings + * List available themes */ - tui?: { - /** - * TUI scroll speed - */ - scroll_speed: number; - }; - plugin?: Array; - snapshot?: boolean; + theme_list?: string; /** - * Control sharing behavior:'manual' allows manual sharing via commands, 'auto' enables automatic sharing, 'disabled' disables all sharing + * Toggle sidebar */ - share?: 'manual' | 'auto' | 'disabled'; + sidebar_toggle?: string; /** - * @deprecated Use 'share' field instead. Share newly created sessions automatically + * Toggle session scrollbar */ - autoshare?: boolean; + scrollbar_toggle?: string; /** - * Automatically update to the latest version + * Toggle username visibility */ - autoupdate?: boolean; + username_toggle?: string; /** - * Disable providers that are loaded automatically + * View status */ - disabled_providers?: Array; + status_view?: string; /** - * Model to use in the format of provider/model, eg anthropic/claude-2 + * Export session to editor */ - model?: string; + session_export?: string; /** - * Small model to use for tasks like title generation in the format of provider/model + * Create a new session */ - small_model?: string; + session_new?: string; /** - * Custom username to display in conversations instead of system username + * List all sessions */ - username?: string; + session_list?: string; /** - * @deprecated Use `agent` field instead. + * Show session timeline */ - mode?: { - build?: AgentConfig; - plan?: AgentConfig; - [key: string]: AgentConfig | undefined; - }; + session_timeline?: string; /** - * Agent configuration, see https://opencode.ai/docs/agent + * Fork session from message */ - agent?: { - plan?: AgentConfig; - build?: AgentConfig; - general?: AgentConfig; - [key: string]: AgentConfig | undefined; - }; + session_fork?: string; /** - * Custom provider configurations and model overrides + * Rename session */ - provider?: { - [key: string]: { - api?: string; - name?: string; - env?: Array; - id?: string; - npm?: string; - models?: { - [key: string]: { - id?: string; - name?: string; - release_date?: string; - attachment?: boolean; - reasoning?: boolean; - temperature?: boolean; - tool_call?: boolean; - cost?: { - input: number; - output: number; - cache_read?: number; - cache_write?: number; - }; - limit?: { - context: number; - output: number; - }; - options?: { - [key: string]: unknown; - }; - }; - }; - options?: { - apiKey?: string; - baseURL?: string; - [key: string]: unknown | string | undefined; - }; - }; - }; + session_rename?: string; /** - * MCP (Model Context Protocol) server configurations + * Share current session */ - mcp?: { - [key: string]: ({ - type: 'local'; - } & McpLocalConfig) | ({ - type: 'remote'; - } & McpRemoteConfig); - }; - formatter?: { - [key: string]: { - disabled?: boolean; - command?: Array; - environment?: { - [key: string]: string; - }; - extensions?: Array; - }; - }; - lsp?: { - [key: string]: { - disabled: true; - } | { - command: Array; - extensions?: Array; - disabled?: boolean; - env?: { - [key: string]: string; - }; - initialization?: { - [key: string]: unknown; - }; - }; - }; + session_share?: string; /** - * Additional instruction files or patterns to include + * Unshare current session */ - instructions?: Array; + session_unshare?: string; /** - * @deprecated Always uses stretch layout. + * Interrupt current session */ - layout?: LayoutConfig; - permission?: { - edit?: 'ask' | 'allow' | 'deny'; - bash?: 'ask' | 'allow' | 'deny' | { - [key: string]: 'ask' | 'allow' | 'deny'; - }; - webfetch?: 'ask' | 'allow' | 'deny'; - }; - tools?: { - [key: string]: boolean; - }; - experimental?: { - hook?: { - file_edited?: { - [key: string]: Array<{ - command: Array; - environment?: { - [key: string]: string; - }; - }>; - }; - session_completed?: Array<{ - command: Array; - environment?: { - [key: string]: string; - }; - }>; - }; - }; -}; - -export type KeybindsConfig = { + session_interrupt?: string; /** - * Leader key for keybind combinations + * Compact the session */ - leader: string; + session_compact?: string; /** - * Show help dialog + * Scroll messages up by one page */ - app_help: string; + messages_page_up?: string; /** - * Exit the application + * Scroll messages down by one page */ - app_exit: string; + messages_page_down?: string; /** - * Open external editor + * Scroll messages up by half page */ - editor_open: string; + messages_half_page_up?: string; /** - * List available themes + * Scroll messages down by half page */ - theme_list: string; + messages_half_page_down?: string; /** - * Create/update AGENTS.md + * Navigate to first message */ - project_init: string; + messages_first?: string; /** - * Toggle tool details + * Navigate to last message */ - tool_details: string; + messages_last?: string; /** - * Toggle thinking blocks + * Navigate to next message */ - thinking_blocks: string; + messages_next?: string; /** - * Export session to editor + * Navigate to previous message */ - session_export: string; + messages_previous?: string; /** - * Create a new session + * Navigate to last user message */ - session_new: string; + messages_last_user?: string; /** - * List all sessions + * Copy message */ - session_list: string; + messages_copy?: string; /** - * Show session timeline + * Undo message */ - session_timeline: string; + messages_undo?: string; /** - * Share current session + * Redo message */ - session_share: string; + messages_redo?: string; /** - * Unshare current session + * Toggle code block concealment in messages */ - session_unshare: string; + messages_toggle_conceal?: string; /** - * Interrupt current session + * Toggle tool details visibility */ - session_interrupt: string; + tool_details?: string; /** - * Compact the session + * List available models */ - session_compact: string; + model_list?: string; /** - * Cycle to next child session + * Next recently used model */ - session_child_cycle: string; + model_cycle_recent?: string; /** - * Cycle to previous child session + * Previous recently used model */ - session_child_cycle_reverse: string; + model_cycle_recent_reverse?: string; /** - * Scroll messages up by one page + * Next favorite model */ - messages_page_up: string; + model_cycle_favorite?: string; /** - * Scroll messages down by one page + * Previous favorite model */ - messages_page_down: string; + model_cycle_favorite_reverse?: string; /** - * Scroll messages up by half page + * List available commands */ - messages_half_page_up: string; + command_list?: string; /** - * Scroll messages down by half page + * List agents */ - messages_half_page_down: string; + agent_list?: string; /** - * Navigate to first message + * Next agent */ - messages_first: string; + agent_cycle?: string; /** - * Navigate to last message + * Previous agent */ - messages_last: string; + agent_cycle_reverse?: string; /** - * Copy message + * Cycle model variants */ - messages_copy: string; + variant_cycle?: string; /** - * Undo message + * Clear input field */ - messages_undo: string; + input_clear?: string; /** - * Redo message + * Paste from clipboard */ - messages_redo: string; + input_paste?: string; /** - * List available models + * Submit input */ - model_list: string; + input_submit?: string; /** - * Next recent model + * Insert newline in input */ - model_cycle_recent: string; + input_newline?: string; /** - * Previous recent model + * Move cursor left in input */ - model_cycle_recent_reverse: string; + input_move_left?: string; /** - * List agents + * Move cursor right in input */ - agent_list: string; + input_move_right?: string; /** - * Next agent + * Move cursor up in input */ - agent_cycle: string; + input_move_up?: string; /** - * Previous agent + * Move cursor down in input */ - agent_cycle_reverse: string; + input_move_down?: string; /** - * Clear input field + * Select left in input */ - input_clear: string; + input_select_left?: string; /** - * Paste from clipboard + * Select right in input */ - input_paste: string; + input_select_right?: string; /** - * Submit input + * Select up in input */ - input_submit: string; + input_select_up?: string; /** - * Insert newline in input + * Select down in input + */ + input_select_down?: string; + /** + * Move to start of line in input + */ + input_line_home?: string; + /** + * Move to end of line in input + */ + input_line_end?: string; + /** + * Select to start of line in input + */ + input_select_line_home?: string; + /** + * Select to end of line in input + */ + input_select_line_end?: string; + /** + * Move to start of visual line in input + */ + input_visual_line_home?: string; + /** + * Move to end of visual line in input + */ + input_visual_line_end?: string; + /** + * Select to start of visual line in input + */ + input_select_visual_line_home?: string; + /** + * Select to end of visual line in input + */ + input_select_visual_line_end?: string; + /** + * Move to start of buffer in input + */ + input_buffer_home?: string; + /** + * Move to end of buffer in input + */ + input_buffer_end?: string; + /** + * Select to start of buffer in input + */ + input_select_buffer_home?: string; + /** + * Select to end of buffer in input + */ + input_select_buffer_end?: string; + /** + * Delete line in input + */ + input_delete_line?: string; + /** + * Delete to end of line in input + */ + input_delete_to_line_end?: string; + /** + * Delete to start of line in input + */ + input_delete_to_line_start?: string; + /** + * Backspace in input + */ + input_backspace?: string; + /** + * Delete character in input + */ + input_delete?: string; + /** + * Undo in input + */ + input_undo?: string; + /** + * Redo in input + */ + input_redo?: string; + /** + * Move word forward in input + */ + input_word_forward?: string; + /** + * Move word backward in input + */ + input_word_backward?: string; + /** + * Select word forward in input + */ + input_select_word_forward?: string; + /** + * Select word backward in input + */ + input_select_word_backward?: string; + /** + * Delete word forward in input + */ + input_delete_word_forward?: string; + /** + * Delete word backward in input */ - input_newline: string; + input_delete_word_backward?: string; /** - * @deprecated use agent_cycle. Next mode + * Previous history item */ - switch_mode: string; + history_previous?: string; /** - * @deprecated use agent_cycle_reverse. Previous mode + * Next history item */ - switch_mode_reverse: string; + history_next?: string; /** - * @deprecated use agent_cycle. Next agent + * Next child session */ - switch_agent: string; + session_child_cycle?: string; /** - * @deprecated use agent_cycle_reverse. Previous agent + * Previous child session */ - switch_agent_reverse: string; + session_child_cycle_reverse?: string; /** - * @deprecated Currently not available. List files + * Go to parent session */ - file_list: string; + session_parent?: string; /** - * @deprecated Close file + * Suspend terminal */ - file_close: string; + terminal_suspend?: string; /** - * @deprecated Search file + * Toggle terminal title */ - file_search: string; + terminal_title_toggle?: string; /** - * @deprecated Split/unified diff + * Toggle tips on home screen */ - file_diff_toggle: string; + tips_toggle?: string; +}; + +/** + * Log level + */ +export type LogLevel = 'DEBUG' | 'INFO' | 'WARN' | 'ERROR'; + +/** + * Server configuration for opencode serve and web commands + */ +export type ServerConfig = { /** - * @deprecated Navigate to previous message + * Port to listen on */ - messages_previous: string; + port?: number; /** - * @deprecated Navigate to next message + * Hostname to listen on */ - messages_next: string; + hostname?: string; /** - * @deprecated Toggle layout + * Enable mDNS service discovery */ - messages_layout_toggle: string; + mdns?: boolean; /** - * @deprecated use messages_undo. Revert message + * Additional domains to allow for CORS */ - messages_revert: string; + cors?: Array; +}; + +export type PermissionActionConfig = 'ask' | 'allow' | 'deny'; + +export type PermissionObjectConfig = { + [key: string]: PermissionActionConfig; }; +export type PermissionRuleConfig = PermissionActionConfig | PermissionObjectConfig; + +export type PermissionConfig = { + read?: PermissionRuleConfig; + edit?: PermissionRuleConfig; + glob?: PermissionRuleConfig; + grep?: PermissionRuleConfig; + list?: PermissionRuleConfig; + bash?: PermissionRuleConfig; + task?: PermissionRuleConfig; + external_directory?: PermissionRuleConfig; + todowrite?: PermissionActionConfig; + todoread?: PermissionActionConfig; + webfetch?: PermissionActionConfig; + websearch?: PermissionActionConfig; + codesearch?: PermissionActionConfig; + lsp?: PermissionRuleConfig; + doom_loop?: PermissionActionConfig; + [key: string]: PermissionRuleConfig | PermissionActionConfig | undefined; +} | PermissionActionConfig; + export type AgentConfig = { model?: string; temperature?: number; top_p?: number; prompt?: string; + /** + * @deprecated Use 'permission' field instead + */ tools?: { [key: string]: boolean; }; @@ -921,55 +1172,111 @@ export type AgentConfig = { */ description?: string; mode?: 'subagent' | 'primary' | 'all'; - permission?: { - edit?: 'ask' | 'allow' | 'deny'; - bash?: 'ask' | 'allow' | 'deny' | { - [key: string]: 'ask' | 'allow' | 'deny'; - }; - webfetch?: 'ask' | 'allow' | 'deny'; + options?: { + [key: string]: unknown; }; + /** + * Hex color code for the agent (e.g., #FF5733) + */ + color?: string; + /** + * Maximum number of agentic iterations before forcing text-only response + */ + steps?: number; + /** + * @deprecated Use 'steps' field instead. + */ + maxSteps?: number; + permission?: PermissionConfig; [key: string]: unknown | string | number | { [key: string]: boolean; } | boolean | 'subagent' | 'primary' | 'all' | { - edit?: 'ask' | 'allow' | 'deny'; - bash?: 'ask' | 'allow' | 'deny' | { - [key: string]: 'ask' | 'allow' | 'deny'; - }; - webfetch?: 'ask' | 'allow' | 'deny'; - } | undefined; + [key: string]: unknown; + } | string | number | PermissionConfig | undefined; }; -export type Provider = { +export type ProviderConfig = { api?: string; - name: string; - env: Array; - id: string; + name?: string; + env?: Array; + id?: string; npm?: string; - models: { - [key: string]: Model; - }; -}; - -export type Model = { - id: string; - name: string; - release_date: string; - attachment: boolean; - reasoning: boolean; - temperature: boolean; - tool_call: boolean; - cost: { - input: number; - output: number; - cache_read?: number; - cache_write?: number; - }; - limit: { - context: number; - output: number; + 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; + output: number; + }; + modalities?: { + input: Array<'text' | 'audio' | 'image' | 'video' | 'pdf'>; + output: Array<'text' | 'audio' | 'image' | 'video' | 'pdf'>; + }; + experimental?: boolean; + status?: 'alpha' | 'beta' | 'deprecated'; + options?: { + [key: string]: unknown; + }; + headers?: { + [key: string]: string; + }; + provider?: { + npm: string; + }; + /** + * Variant-specific configuration + */ + variants?: { + [key: string]: { + /** + * Disable this variant for the model + */ + disabled?: boolean; + [key: string]: unknown | boolean | undefined; + }; + }; + }; }; - options: { - [key: string]: unknown; + whitelist?: Array; + blacklist?: Array; + options?: { + apiKey?: string; + baseURL?: string; + /** + * GitHub Enterprise URL for copilot authentication + */ + enterpriseUrl?: string; + /** + * Enable promptCacheKey for this provider (default false) + */ + setCacheKey?: boolean; + /** + * Timeout in milliseconds for requests to this provider. Default is 300000 (5 minutes). Set to false to disable timeout. + */ + timeout?: number | false; + [key: string]: unknown | string | boolean | number | false | undefined; }; }; @@ -992,786 +1299,2747 @@ export type McpLocalConfig = { * Enable or disable the MCP server on startup */ enabled?: boolean; + /** + * Timeout in ms for fetching tools from the MCP server. Defaults to 5000 (5 seconds) if not specified. + */ + timeout?: number; +}; + +export type McpOAuthConfig = { + /** + * OAuth client ID. If not provided, dynamic client registration (RFC 7591) will be attempted. + */ + clientId?: string; + /** + * OAuth client secret (if required by the authorization server) + */ + clientSecret?: string; + /** + * OAuth scopes to request during authorization + */ + scope?: string; +}; + +export type McpRemoteConfig = { + /** + * Type of MCP server connection + */ + type: 'remote'; + /** + * URL of the remote MCP server + */ + url: string; + /** + * Enable or disable the MCP server on startup + */ + enabled?: boolean; + /** + * Headers to send with the request + */ + headers?: { + [key: string]: string; + }; + /** + * OAuth authentication configuration for the MCP server. Set to false to disable OAuth auto-detection. + */ + oauth?: McpOAuthConfig | false; + /** + * Timeout in ms for fetching tools from the MCP server. Defaults to 5000 (5 seconds) if not specified. + */ + timeout?: number; +}; + +/** + * @deprecated Always uses stretch layout. + */ +export type LayoutConfig = 'auto' | 'stretch'; + +export type Config = { + /** + * JSON schema reference for configuration validation + */ + $schema?: string; + /** + * Theme name to use for the interface + */ + theme?: string; + keybinds?: KeybindsConfig; + logLevel?: LogLevel; + /** + * TUI specific settings + */ + tui?: { + /** + * TUI scroll speed + */ + scroll_speed?: number; + /** + * Scroll acceleration settings + */ + scroll_acceleration?: { + /** + * Enable scroll acceleration + */ + enabled: boolean; + }; + /** + * Control diff rendering style: 'auto' adapts to terminal width, 'stacked' always shows single column + */ + diff_style?: 'auto' | 'stacked'; + }; + server?: ServerConfig; + /** + * Command configuration, see https://opencode.ai/docs/commands + */ + command?: { + [key: string]: { + template: string; + description?: string; + agent?: string; + model?: string; + subtask?: boolean; + }; + }; + watcher?: { + ignore?: Array; + }; + plugin?: Array; + snapshot?: boolean; + /** + * Control sharing behavior:'manual' allows manual sharing via commands, 'auto' enables automatic sharing, 'disabled' disables all sharing + */ + share?: 'manual' | 'auto' | 'disabled'; + /** + * @deprecated Use 'share' field instead. Share newly created sessions automatically + */ + 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'; + /** + * Disable providers that are loaded automatically + */ + disabled_providers?: Array; + /** + * When set, ONLY these providers will be enabled. All other providers will be ignored + */ + enabled_providers?: Array; + /** + * Model to use in the format of provider/model, eg anthropic/claude-2 + */ + model?: string; + /** + * Small model to use for tasks like title generation in the format of provider/model + */ + small_model?: string; + /** + * Default agent to use when none is specified. Must be a primary agent. Falls back to 'build' if not set or if the specified agent is invalid. + */ + default_agent?: string; + /** + * Custom username to display in conversations instead of system username + */ + username?: string; + /** + * @deprecated Use `agent` field instead. + */ + mode?: { + build?: AgentConfig; + plan?: AgentConfig; + [key: string]: AgentConfig | undefined; + }; + /** + * Agent configuration, see https://opencode.ai/docs/agent + */ + agent?: { + plan?: AgentConfig; + build?: AgentConfig; + general?: AgentConfig; + explore?: AgentConfig; + title?: AgentConfig; + summary?: AgentConfig; + compaction?: AgentConfig; + [key: string]: AgentConfig | undefined; + }; + /** + * Custom provider configurations and model overrides + */ + provider?: { + [key: string]: ProviderConfig; + }; + /** + * MCP (Model Context Protocol) server configurations + */ + mcp?: { + [key: string]: McpLocalConfig | McpRemoteConfig; + }; + formatter?: false | { + [key: string]: { + disabled?: boolean; + command?: Array; + environment?: { + [key: string]: string; + }; + extensions?: Array; + }; + }; + lsp?: false | { + [key: string]: { + disabled: true; + } | { + command: Array; + extensions?: Array; + disabled?: boolean; + env?: { + [key: string]: string; + }; + initialization?: { + [key: string]: unknown; + }; + }; + }; + /** + * Additional instruction files or patterns to include + */ + instructions?: Array; + layout?: LayoutConfig; + permission?: PermissionConfig; + tools?: { + [key: string]: boolean; + }; + enterprise?: { + /** + * Enterprise URL + */ + url?: string; + }; + compaction?: { + /** + * Enable automatic compaction when context is full (default: true) + */ + auto?: boolean; + /** + * Enable pruning of old tool outputs (default: true) + */ + prune?: boolean; + }; + experimental?: { + hook?: { + file_edited?: { + [key: string]: Array<{ + command: Array; + environment?: { + [key: string]: string; + }; + }>; + }; + session_completed?: Array<{ + command: Array; + environment?: { + [key: string]: string; + }; + }>; + }; + /** + * Number of retries for chat completions on failure + */ + chatMaxRetries?: number; + disable_paste_summary?: boolean; + /** + * Enable the batch tool + */ + batch_tool?: boolean; + /** + * Enable OpenTelemetry spans for AI SDK calls (using the 'experimental_telemetry' flag) + */ + openTelemetry?: boolean; + /** + * Tools that should only be available to primary agents. + */ + primary_tools?: Array; + /** + * Continue the agent loop when a tool call is denied + */ + continue_loop_on_deny?: boolean; + /** + * Timeout in milliseconds for model context protocol (MCP) requests + */ + mcp_timeout?: number; + }; +}; + +export type ToolIds = Array; + +export type ToolListItem = { + id: string; + description: string; + parameters: unknown; +}; + +export type ToolList = Array; + +export type Path = { + home: string; + state: string; + config: string; + worktree: string; + directory: string; +}; + +export type VcsInfo = { + branch: 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; + command?: string; +}; + +export type Command = { + name: string; + description?: string; + agent?: string; + model?: string; + mcp?: boolean; + template: string; + subtask?: boolean; + hints: Array; +}; + +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; + 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; + key?: string; + options: { + [key: string]: unknown; + }; + models: { + [key: string]: Model; + }; +}; + +export type ProviderAuthMethod = { + type: 'oauth' | 'api'; + label: string; +}; + +export type ProviderAuthAuthorization = { + url: string; + method: 'auto' | 'code'; + instructions: 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'; + 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; + }>; + index?: string; + }; + encoding?: 'base64'; + mimeType?: string; +}; + +export type File = { + path: string; + added: number; + removed: number; + status: 'added' | 'deleted' | 'modified'; +}; + +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; + }; + prompt?: string; + options: { + [key: string]: unknown; + }; + steps?: number; +}; + +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 LspStatus = { + id: string; + name: string; + root: string; + status: 'connected' | 'error'; +}; + +export type FormatterStatus = { + name: string; + extensions: Array; + enabled: boolean; +}; + +export type OAuth = { + type: 'oauth'; + refresh: string; + access: string; + expires: number; + enterpriseUrl?: string; +}; + +export type ApiAuth = { + type: 'api'; + key: string; +}; + +export type WellKnownAuth = { + type: 'wellknown'; + key: string; + token: string; +}; + +export type Auth = OAuth | ApiAuth | WellKnownAuth; + +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 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 ProjectListData = { + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/project'; +}; + +export type ProjectListResponses = { + /** + * List of projects + */ + 200: Array; +}; + +export type ProjectListResponse = ProjectListResponses[keyof ProjectListResponses]; + +export type ProjectCurrentData = { + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/project/current'; +}; + +export type ProjectCurrentResponses = { + /** + * Current project information + */ + 200: Project; +}; + +export type ProjectCurrentResponse = ProjectCurrentResponses[keyof ProjectCurrentResponses]; + +export type ProjectUpdateData = { + body?: { + name?: string; + icon?: { + url?: string; + color?: string; + }; + }; + path: { + projectID: string; + }; + query?: { + directory?: 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 PtyListData = { + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/pty'; +}; + +export type PtyListResponses = { + /** + * List of sessions + */ + 200: Array; +}; + +export type PtyListResponse = PtyListResponses[keyof PtyListResponses]; + +export type PtyCreateData = { + body?: { + command?: string; + args?: Array; + cwd?: string; + title?: string; + env?: { + [key: string]: string; + }; + }; + path?: never; + query?: { + directory?: 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; + }; + url: '/pty/{ptyID}'; +}; + +export type PtyRemoveErrors = { + /** + * Not found + */ + 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; + }; + url: '/pty/{ptyID}'; +}; + +export type PtyGetErrors = { + /** + * Not found + */ + 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; + }; + 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 PtyConnectData = { + body?: never; + path: { + ptyID: string; + }; + query?: { + directory?: string; + }; + url: '/pty/{ptyID}/connect'; +}; + +export type PtyConnectErrors = { + /** + * Not found + */ + 404: NotFoundError; +}; + +export type PtyConnectError = PtyConnectErrors[keyof PtyConnectErrors]; + +export type PtyConnectResponses = { + /** + * Connected session + */ + 200: boolean; +}; + +export type PtyConnectResponse = PtyConnectResponses[keyof PtyConnectResponses]; + +export type ConfigGetData = { + body?: never; + path?: never; + query?: { + directory?: 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; + }; + 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 ToolIdsData = { + body?: never; + path?: never; + query?: { + directory?: 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 ToolListData = { + body?: never; + path?: never; + query: { + directory?: 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 InstanceDisposeData = { + body?: never; + path?: never; + query?: { + directory?: 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; + }; + url: '/path'; +}; + +export type PathGetResponses = { + /** + * Path + */ + 200: Path; +}; + +export type PathGetResponse = PathGetResponses[keyof PathGetResponses]; + +export type VcsGetData = { + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/vcs'; +}; + +export type VcsGetResponses = { + /** + * VCS info + */ + 200: VcsInfo; +}; + +export type VcsGetResponse = VcsGetResponses[keyof VcsGetResponses]; + +export type SessionListData = { + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/session'; +}; + +export type SessionListResponses = { + /** + * List of sessions + */ + 200: Array; +}; + +export type SessionListResponse = SessionListResponses[keyof SessionListResponses]; + +export type SessionCreateData = { + body?: { + parentID?: string; + title?: string; + permission?: PermissionRuleset; + }; + path?: never; + query?: { + directory?: 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; + }; + 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; + }; + url: '/session/{sessionID}'; +}; + +export type SessionDeleteErrors = { + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 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; + }; + url: '/session/{sessionID}'; +}; + +export type SessionGetErrors = { + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 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; + time?: { + archived?: number; + }; + }; + path: { + sessionID: string; + }; + query?: { + directory?: string; + }; + url: '/session/{sessionID}'; +}; + +export type SessionUpdateErrors = { + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 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; + }; + 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; +}; + +export type SessionChildrenResponse = SessionChildrenResponses[keyof SessionChildrenResponses]; + +export type SessionTodoData = { + body?: never; + path: { + /** + * Session ID + */ + sessionID: string; + }; + query?: { + directory?: 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; +}; + +export type SessionTodoResponse = SessionTodoResponses[keyof SessionTodoResponses]; + +export type SessionInitData = { + body?: { + modelID: string; + providerID: string; + messageID: string; + }; + path: { + /** + * Session ID + */ + sessionID: string; + }; + query?: { + directory?: 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 SessionForkData = { + body?: { + messageID?: string; + }; + path: { + sessionID: string; + }; + query?: { + directory?: string; + }; + url: '/session/{sessionID}/fork'; +}; + +export type SessionForkResponses = { + /** + * 200 + */ + 200: Session; +}; + +export type SessionForkResponse = SessionForkResponses[keyof SessionForkResponses]; + +export type SessionAbortData = { + body?: never; + path: { + sessionID: string; + }; + query?: { + directory?: 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 SessionUnshareData = { + body?: never; + path: { + sessionID: string; + }; + query?: { + directory?: string; + }; + url: '/session/{sessionID}/share'; +}; + +export type SessionUnshareErrors = { + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; + +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; + }; + url: '/session/{sessionID}/share'; +}; + +export type SessionShareErrors = { + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; + +export type SessionShareError = SessionShareErrors[keyof SessionShareErrors]; + +export type SessionShareResponses = { + /** + * Successfully shared session + */ + 200: Session; +}; + +export type SessionShareResponse = SessionShareResponses[keyof SessionShareResponses]; + +export type SessionDiffData = { + body?: never; + path: { + /** + * Session ID + */ + sessionID: string; + }; + query?: { + directory?: string; + messageID?: string; + }; + url: '/session/{sessionID}/diff'; +}; + +export type SessionDiffErrors = { + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; + +export type SessionDiffError = SessionDiffErrors[keyof SessionDiffErrors]; + +export type SessionDiffResponses = { + /** + * List of diffs + */ + 200: Array; +}; + +export type SessionDiffResponse = SessionDiffResponses[keyof SessionDiffResponses]; + +export type SessionSummarizeData = { + body?: { + providerID: string; + modelID: string; + auto?: boolean; + }; + path: { + /** + * Session ID + */ + sessionID: string; + }; + query?: { + directory?: string; + }; + url: '/session/{sessionID}/summarize'; +}; + +export type SessionSummarizeErrors = { + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; + +export type SessionSummarizeError = SessionSummarizeErrors[keyof SessionSummarizeErrors]; + +export type SessionSummarizeResponses = { + /** + * Summarized session + */ + 200: boolean; +}; + +export type SessionSummarizeResponse = SessionSummarizeResponses[keyof SessionSummarizeResponses]; + +export type SessionMessagesData = { + body?: never; + path: { + /** + * Session ID + */ + sessionID: string; + }; + query?: { + directory?: string; + limit?: number; + }; + url: '/session/{sessionID}/message'; +}; + +export type SessionMessagesErrors = { + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; + +export type SessionMessagesError = SessionMessagesErrors[keyof SessionMessagesErrors]; + +export type SessionMessagesResponses = { + /** + * List of messages + */ + 200: Array<{ + info: Message; + parts: Array; + }>; +}; + +export type SessionMessagesResponse = SessionMessagesResponses[keyof SessionMessagesResponses]; + +export type SessionPromptData = { + body?: { + messageID?: string; + model?: { + providerID: string; + modelID: string; + }; + agent?: string; + noReply?: boolean; + /** + * @deprecated tools and permissions have been merged, you can set permissions on the session itself now + */ + tools?: { + [key: string]: boolean; + }; + system?: string; + variant?: string; + parts: Array; + }; + path: { + /** + * Session ID + */ + sessionID: string; + }; + query?: { + directory?: 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; + }; +}; + +export type SessionPromptResponse = SessionPromptResponses[keyof SessionPromptResponses]; + +export type SessionMessageData = { + body?: never; + path: { + /** + * Session ID + */ + sessionID: string; + /** + * Message ID + */ + messageID: string; + }; + query?: { + directory?: string; + }; + url: '/session/{sessionID}/message/{messageID}'; +}; + +export type SessionMessageErrors = { + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; + +export type SessionMessageError = SessionMessageErrors[keyof SessionMessageErrors]; + +export type SessionMessageResponses = { + /** + * Message + */ + 200: { + info: Message; + parts: Array; + }; +}; + +export type SessionMessageResponse = SessionMessageResponses[keyof SessionMessageResponses]; + +export type PartDeleteData = { + body?: never; + path: { + /** + * Session ID + */ + sessionID: string; + /** + * Message ID + */ + messageID: string; + /** + * Part ID + */ + partID: string; + }; + query?: { + directory?: 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: { + /** + * Session ID + */ + sessionID: string; + /** + * Message ID + */ + messageID: string; + /** + * Part ID + */ + partID: string; + }; + query?: { + directory?: 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 SessionPromptAsyncData = { + body?: { + messageID?: string; + model?: { + providerID: string; + modelID: string; + }; + agent?: string; + noReply?: boolean; + /** + * @deprecated tools and permissions have been merged, you can set permissions on the session itself now + */ + tools?: { + [key: string]: boolean; + }; + system?: string; + variant?: string; + parts: Array; + }; + path: { + /** + * Session ID + */ + sessionID: string; + }; + query?: { + directory?: 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; + }; + path: { + /** + * Session ID + */ + sessionID: string; + }; + query?: { + directory?: 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; + }; +}; + +export type SessionCommandResponse = SessionCommandResponses[keyof SessionCommandResponses]; + +export type SessionShellData = { + body?: { + agent: string; + model?: { + providerID: string; + modelID: string; + }; + command: string; + }; + path: { + /** + * Session ID + */ + sessionID: string; + }; + query?: { + directory?: 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: AssistantMessage; +}; + +export type SessionShellResponse = SessionShellResponses[keyof SessionShellResponses]; + +export type SessionRevertData = { + body?: { + messageID: string; + partID?: string; + }; + path: { + sessionID: string; + }; + query?: { + directory?: 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; + }; + url: '/session/{sessionID}/unrevert'; }; -export type McpRemoteConfig = { - /** - * Type of MCP server connection - */ - type: 'remote'; +export type SessionUnrevertErrors = { /** - * URL of the remote MCP server + * Bad request */ - url: string; + 400: BadRequestError; /** - * Enable or disable the MCP server on startup + * Not found */ - enabled?: boolean; + 404: NotFoundError; +}; + +export type SessionUnrevertError = SessionUnrevertErrors[keyof SessionUnrevertErrors]; + +export type SessionUnrevertResponses = { /** - * Headers to send with the request + * Updated session */ - headers?: { - [key: string]: string; - }; + 200: Session; }; -export type LayoutConfig = 'auto' | 'stretch'; +export type SessionUnrevertResponse = SessionUnrevertResponses[keyof SessionUnrevertResponses]; -export type Error = { - data: { - [key: string]: unknown; +export type PermissionRespondData = { + body?: { + response: 'once' | 'always' | 'reject'; }; -}; - -export type TextPartInput = { - id?: string; - type: 'text'; - text: string; - synthetic?: boolean; - time?: { - start: number; - end?: number; + path: { + sessionID: string; + permissionID: string; + }; + query?: { + directory?: string; }; + url: '/session/{sessionID}/permissions/{permissionID}'; }; -export type FilePartInput = { - id?: string; - type: 'file'; - mime: string; - filename?: string; - url: string; - source?: FilePartSource; +export type PermissionRespondErrors = { + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; }; -export type AgentPartInput = { - id?: string; - type: 'agent'; - name: string; - source?: { - value: string; - start: number; - end: number; - }; -}; +export type PermissionRespondError = PermissionRespondErrors[keyof PermissionRespondErrors]; -export type Symbol = { - name: string; - kind: number; - location: { - uri: string; - range: Range; - }; +export type PermissionRespondResponses = { + /** + * Permission processed successfully + */ + 200: boolean; }; -export type File = { - path: string; - added: number; - removed: number; - status: 'added' | 'deleted' | 'modified'; -}; +export type PermissionRespondResponse = PermissionRespondResponses[keyof PermissionRespondResponses]; -export type Agent = { - name: string; - description?: string; - mode: 'subagent' | 'primary' | 'all'; - builtIn: boolean; - topP?: number; - temperature?: number; - permission: { - edit: 'ask' | 'allow' | 'deny'; - bash: { - [key: string]: 'ask' | 'allow' | 'deny'; - }; - webfetch?: 'ask' | 'allow' | 'deny'; - }; - model?: { - modelID: string; - providerID: string; +export type PermissionReplyData = { + body?: { + reply: 'once' | 'always' | 'reject'; }; - prompt?: string; - tools: { - [key: string]: boolean; + path: { + requestID: string; }; - options: { - [key: string]: unknown; + query?: { + directory?: string; }; + url: '/permission/{requestID}/reply'; }; -export type Auth = ({ - type: 'oauth'; -} & OAuth) | ({ - type: 'api'; -} & ApiAuth) | ({ - type: 'wellknown'; -} & WellKnownAuth); - -export type OAuth = { - type: 'oauth'; - refresh: string; - access: string; - expires: number; +export type PermissionReplyErrors = { + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; }; -export type ApiAuth = { - type: 'api'; - key: string; -}; +export type PermissionReplyError = PermissionReplyErrors[keyof PermissionReplyErrors]; -export type WellKnownAuth = { - type: 'wellknown'; - key: string; - token: string; +export type PermissionReplyResponses = { + /** + * Permission processed successfully + */ + 200: boolean; }; -export type EventSubscribeData = { +export type PermissionReplyResponse = PermissionReplyResponses[keyof PermissionReplyResponses]; + +export type PermissionListData = { body?: never; path?: never; - query?: never; - url: '/event'; + query?: { + directory?: string; + }; + url: '/permission'; }; -export type EventSubscribeResponses = { +export type PermissionListResponses = { /** - * Event stream + * List of pending permissions */ - 200: Event; + 200: Array; }; -export type EventSubscribeResponse = EventSubscribeResponses[keyof EventSubscribeResponses]; +export type PermissionListResponse = PermissionListResponses[keyof PermissionListResponses]; -export type AppGetData = { +export type CommandListData = { body?: never; path?: never; - query?: never; - url: '/app'; + query?: { + directory?: string; + }; + url: '/command'; }; -export type AppGetResponses = { +export type CommandListResponses = { /** - * 200 + * List of commands */ - 200: App; + 200: Array; }; -export type AppGetResponse = AppGetResponses[keyof AppGetResponses]; +export type CommandListResponse = CommandListResponses[keyof CommandListResponses]; -export type AppInitData = { +export type ConfigProvidersData = { body?: never; path?: never; - query?: never; - url: '/app/init'; + query?: { + directory?: string; + }; + url: '/config/providers'; }; -export type AppInitResponses = { +export type ConfigProvidersResponses = { /** - * Initialize the app + * List of providers */ - 200: boolean; + 200: { + providers: Array; + default: { + [key: string]: string; + }; + }; }; -export type AppInitResponse = AppInitResponses[keyof AppInitResponses]; +export type ConfigProvidersResponse = ConfigProvidersResponses[keyof ConfigProvidersResponses]; -export type ConfigGetData = { +export type ProviderListData = { body?: never; path?: never; - query?: never; - url: '/config'; + query?: { + directory?: string; + }; + url: '/provider'; }; -export type ConfigGetResponses = { +export type ProviderListResponses = { /** - * Get config info + * List of providers */ - 200: Config; + 200: { + all: Array<{ + api?: string; + name: string; + env: Array; + id: string; + npm?: string; + 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; + output: number; + }; + modalities?: { + input: Array<'text' | 'audio' | 'image' | 'video' | 'pdf'>; + output: Array<'text' | 'audio' | 'image' | 'video' | 'pdf'>; + }; + experimental?: boolean; + status?: 'alpha' | 'beta' | 'deprecated'; + options: { + [key: string]: unknown; + }; + headers?: { + [key: string]: string; + }; + provider?: { + npm: string; + }; + variants?: { + [key: string]: { + [key: string]: unknown; + }; + }; + }; + }; + }>; + default: { + [key: string]: string; + }; + connected: Array; + }; }; -export type ConfigGetResponse = ConfigGetResponses[keyof ConfigGetResponses]; +export type ProviderListResponse = ProviderListResponses[keyof ProviderListResponses]; -export type SessionListData = { +export type ProviderAuthData = { body?: never; path?: never; - query?: never; - url: '/session'; + query?: { + directory?: string; + }; + url: '/provider/auth'; }; -export type SessionListResponses = { +export type ProviderAuthResponses = { /** - * List of sessions + * Provider auth methods */ - 200: Array; + 200: { + [key: string]: Array; + }; }; -export type SessionListResponse = SessionListResponses[keyof SessionListResponses]; +export type ProviderAuthResponse = ProviderAuthResponses[keyof ProviderAuthResponses]; -export type SessionCreateData = { +export type ProviderOauthAuthorizeData = { body?: { - parentID?: string; - title?: string; + /** + * Auth method index + */ + method: number; }; - path?: never; - query?: never; - url: '/session'; + path: { + /** + * Provider ID + */ + providerID: string; + }; + query?: { + directory?: string; + }; + url: '/provider/{providerID}/oauth/authorize'; }; -export type SessionCreateErrors = { +export type ProviderOauthAuthorizeErrors = { /** * Bad request */ - 400: Error; + 400: BadRequestError; }; -export type SessionCreateError = SessionCreateErrors[keyof SessionCreateErrors]; +export type ProviderOauthAuthorizeError = ProviderOauthAuthorizeErrors[keyof ProviderOauthAuthorizeErrors]; -export type SessionCreateResponses = { +export type ProviderOauthAuthorizeResponses = { /** - * Successfully created session + * Authorization URL and method */ - 200: Session; + 200: ProviderAuthAuthorization; }; -export type SessionCreateResponse = SessionCreateResponses[keyof SessionCreateResponses]; +export type ProviderOauthAuthorizeResponse = ProviderOauthAuthorizeResponses[keyof ProviderOauthAuthorizeResponses]; -export type SessionDeleteData = { - body?: never; +export type ProviderOauthCallbackData = { + body?: { + /** + * Auth method index + */ + method: number; + /** + * OAuth authorization code + */ + code?: string; + }; path: { - id: string; + /** + * Provider ID + */ + providerID: string; }; - query?: never; - url: '/session/{id}'; + query?: { + directory?: string; + }; + url: '/provider/{providerID}/oauth/callback'; }; -export type SessionDeleteResponses = { +export type ProviderOauthCallbackErrors = { /** - * Successfully deleted session + * Bad request */ - 200: boolean; + 400: BadRequestError; }; -export type SessionDeleteResponse = SessionDeleteResponses[keyof SessionDeleteResponses]; - -export type SessionGetData = { - body?: never; - path: { - id: string; - }; - query?: never; - url: '/session/{id}'; -}; +export type ProviderOauthCallbackError = ProviderOauthCallbackErrors[keyof ProviderOauthCallbackErrors]; -export type SessionGetResponses = { +export type ProviderOauthCallbackResponses = { /** - * Get session + * OAuth callback processed successfully */ - 200: Session; + 200: boolean; }; -export type SessionGetResponse = SessionGetResponses[keyof SessionGetResponses]; +export type ProviderOauthCallbackResponse = ProviderOauthCallbackResponses[keyof ProviderOauthCallbackResponses]; -export type SessionUpdateData = { - body?: { - title?: string; - }; - path: { - id: string; +export type FindTextData = { + body?: never; + path?: never; + query: { + directory?: string; + pattern: string; }; - query?: never; - url: '/session/{id}'; + url: '/find'; }; -export type SessionUpdateResponses = { +export type FindTextResponses = { /** - * Successfully updated session + * Matches */ - 200: Session; + 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 SessionUpdateResponse = SessionUpdateResponses[keyof SessionUpdateResponses]; +export type FindTextResponse = FindTextResponses[keyof FindTextResponses]; -export type SessionChildrenData = { +export type FindFilesData = { body?: never; - path: { - id: string; + path?: never; + query: { + directory?: string; + query: string; + dirs?: 'true' | 'false'; + type?: 'file' | 'directory'; + limit?: number; }; - query?: never; - url: '/session/{id}/children'; + url: '/find/file'; }; -export type SessionChildrenResponses = { +export type FindFilesResponses = { /** - * List of children + * File paths */ - 200: Array; + 200: Array; }; -export type SessionChildrenResponse = SessionChildrenResponses[keyof SessionChildrenResponses]; +export type FindFilesResponse = FindFilesResponses[keyof FindFilesResponses]; -export type SessionInitData = { - body?: { - messageID: string; - providerID: string; - modelID: string; - }; - path: { - /** - * Session ID - */ - id: string; +export type FindSymbolsData = { + body?: never; + path?: never; + query: { + directory?: string; + query: string; }; - query?: never; - url: '/session/{id}/init'; + url: '/find/symbol'; }; -export type SessionInitResponses = { +export type FindSymbolsResponses = { /** - * 200 + * Symbols */ - 200: boolean; + 200: Array; }; -export type SessionInitResponse = SessionInitResponses[keyof SessionInitResponses]; +export type FindSymbolsResponse = FindSymbolsResponses[keyof FindSymbolsResponses]; -export type SessionAbortData = { +export type FileListData = { body?: never; - path: { - id: string; + path?: never; + query: { + directory?: string; + path: string; }; - query?: never; - url: '/session/{id}/abort'; + url: '/file'; }; -export type SessionAbortResponses = { +export type FileListResponses = { /** - * Aborted session + * Files and directories */ - 200: boolean; + 200: Array; }; -export type SessionAbortResponse = SessionAbortResponses[keyof SessionAbortResponses]; +export type FileListResponse = FileListResponses[keyof FileListResponses]; -export type SessionUnshareData = { +export type FileReadData = { body?: never; - path: { - id: string; + path?: never; + query: { + directory?: string; + path: string; }; - query?: never; - url: '/session/{id}/share'; + url: '/file/content'; }; -export type SessionUnshareResponses = { +export type FileReadResponses = { /** - * Successfully unshared session + * File content */ - 200: Session; + 200: FileContent; }; -export type SessionUnshareResponse = SessionUnshareResponses[keyof SessionUnshareResponses]; +export type FileReadResponse = FileReadResponses[keyof FileReadResponses]; -export type SessionShareData = { +export type FileStatusData = { body?: never; - path: { - id: string; + path?: never; + query?: { + directory?: string; }; - query?: never; - url: '/session/{id}/share'; + url: '/file/status'; }; -export type SessionShareResponses = { +export type FileStatusResponses = { /** - * Successfully shared session + * File status */ - 200: Session; + 200: Array; }; -export type SessionShareResponse = SessionShareResponses[keyof SessionShareResponses]; +export type FileStatusResponse = FileStatusResponses[keyof FileStatusResponses]; -export type SessionSummarizeData = { +export type AppLogData = { body?: { - providerID: string; - modelID: string; - }; - path: { /** - * Session ID + * Service name for the log entry */ - id: string; + service: string; + /** + * Log level + */ + level: 'debug' | 'info' | 'error' | 'warn'; + /** + * Log message + */ + message: string; + /** + * Additional metadata for the log entry + */ + extra?: { + [key: string]: unknown; + }; }; - query?: never; - url: '/session/{id}/summarize'; + path?: never; + query?: { + directory?: string; + }; + url: '/log'; }; -export type SessionSummarizeResponses = { +export type AppLogErrors = { /** - * Summarized session + * Bad request */ - 200: boolean; + 400: BadRequestError; }; -export type SessionSummarizeResponse = SessionSummarizeResponses[keyof SessionSummarizeResponses]; - -export type SessionMessagesData = { - body?: never; - path: { - /** - * Session ID - */ - id: string; - }; - query?: never; - url: '/session/{id}/message'; -}; +export type AppLogError = AppLogErrors[keyof AppLogErrors]; -export type SessionMessagesResponses = { +export type AppLogResponses = { /** - * List of messages + * Log entry written successfully */ - 200: Array<{ - info: Message; - parts: Array; - }>; + 200: boolean; }; -export type SessionMessagesResponse = SessionMessagesResponses[keyof SessionMessagesResponses]; +export type AppLogResponse = AppLogResponses[keyof AppLogResponses]; -export type SessionChatData = { - body?: { - messageID?: string; - providerID: string; - modelID: string; - agent?: string; - system?: string; - tools?: { - [key: string]: boolean; - }; - parts: Array<({ - type: 'text'; - } & TextPartInput) | ({ - type: 'file'; - } & FilePartInput) | ({ - type: 'agent'; - } & AgentPartInput)>; - }; - path: { - /** - * Session ID - */ - id: string; +export type AppAgentsData = { + body?: never; + path?: never; + query?: { + directory?: string; }; - query?: never; - url: '/session/{id}/message'; + url: '/agent'; }; -export type SessionChatResponses = { +export type AppAgentsResponses = { /** - * Created message + * List of agents */ - 200: { - info: AssistantMessage; - parts: Array; - }; + 200: Array; }; -export type SessionChatResponse = SessionChatResponses[keyof SessionChatResponses]; +export type AppAgentsResponse = AppAgentsResponses[keyof AppAgentsResponses]; -export type SessionMessageData = { +export type McpStatusData = { body?: never; - path: { - /** - * Session ID - */ - id: string; - /** - * Message ID - */ - messageID: string; + path?: never; + query?: { + directory?: string; }; - query?: never; - url: '/session/{id}/message/{messageID}'; + url: '/mcp'; }; -export type SessionMessageResponses = { +export type McpStatusResponses = { /** - * Message + * MCP server status */ 200: { - info: Message; - parts: Array; + [key: string]: McpStatus; }; }; -export type SessionMessageResponse = SessionMessageResponses[keyof SessionMessageResponses]; +export type McpStatusResponse = McpStatusResponses[keyof McpStatusResponses]; -export type SessionShellData = { +export type McpAddData = { body?: { - agent: string; - command: string; + name: string; + config: McpLocalConfig | McpRemoteConfig; }; - path: { - /** - * Session ID - */ - id: string; + path?: never; + query?: { + directory?: string; }; - query?: never; - url: '/session/{id}/shell'; + url: '/mcp'; }; -export type SessionShellResponses = { +export type McpAddErrors = { /** - * Created message + * Bad request */ - 200: AssistantMessage; + 400: BadRequestError; }; -export type SessionShellResponse = SessionShellResponses[keyof SessionShellResponses]; - -export type SessionRevertData = { - body?: { - messageID: string; - partID?: string; - }; - path: { - id: string; - }; - query?: never; - url: '/session/{id}/revert'; -}; +export type McpAddError = McpAddErrors[keyof McpAddErrors]; -export type SessionRevertResponses = { +export type McpAddResponses = { /** - * Updated session + * MCP server added successfully */ - 200: Session; + 200: { + [key: string]: McpStatus; + }; }; -export type SessionRevertResponse = SessionRevertResponses[keyof SessionRevertResponses]; +export type McpAddResponse = McpAddResponses[keyof McpAddResponses]; -export type SessionUnrevertData = { +export type McpAuthRemoveData = { body?: never; path: { - id: string; + name: string; }; - query?: never; - url: '/session/{id}/unrevert'; + query?: { + directory?: string; + }; + url: '/mcp/{name}/auth'; +}; + +export type McpAuthRemoveErrors = { + /** + * Not found + */ + 404: NotFoundError; }; -export type SessionUnrevertResponses = { +export type McpAuthRemoveError = McpAuthRemoveErrors[keyof McpAuthRemoveErrors]; + +export type McpAuthRemoveResponses = { /** - * Updated session + * OAuth credentials removed */ - 200: Session; + 200: { + success: true; + }; }; -export type SessionUnrevertResponse = SessionUnrevertResponses[keyof SessionUnrevertResponses]; +export type McpAuthRemoveResponse = McpAuthRemoveResponses[keyof McpAuthRemoveResponses]; -export type PostSessionByIdPermissionsByPermissionIdData = { - body?: { - response: 'once' | 'always' | 'reject'; - }; +export type McpAuthStartData = { + body?: never; path: { - id: string; - permissionID: string; + name: string; }; - query?: never; - url: '/session/{id}/permissions/{permissionID}'; + query?: { + directory?: string; + }; + url: '/mcp/{name}/auth'; }; -export type PostSessionByIdPermissionsByPermissionIdResponses = { +export type McpAuthStartErrors = { /** - * Permission processed successfully + * Bad request */ - 200: boolean; + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; }; -export type PostSessionByIdPermissionsByPermissionIdResponse = PostSessionByIdPermissionsByPermissionIdResponses[keyof PostSessionByIdPermissionsByPermissionIdResponses]; - -export type ConfigProvidersData = { - body?: never; - path?: never; - query?: never; - url: '/config/providers'; -}; +export type McpAuthStartError = McpAuthStartErrors[keyof McpAuthStartErrors]; -export type ConfigProvidersResponses = { +export type McpAuthStartResponses = { /** - * List of providers + * OAuth flow started */ 200: { - providers: Array; - default: { - [key: string]: string; - }; + /** + * URL to open in browser for authorization + */ + authorizationUrl: string; }; }; -export type ConfigProvidersResponse = ConfigProvidersResponses[keyof ConfigProvidersResponses]; +export type McpAuthStartResponse = McpAuthStartResponses[keyof McpAuthStartResponses]; -export type FindTextData = { - body?: never; - path?: never; - query: { - pattern: string; +export type McpAuthCallbackData = { + body?: { + /** + * Authorization code from OAuth callback + */ + code: string; }; - url: '/find'; + path: { + name: string; + }; + query?: { + directory?: string; + }; + url: '/mcp/{name}/auth/callback'; }; -export type FindTextResponses = { +export type McpAuthCallbackErrors = { /** - * Matches + * Bad request */ - 200: Array<{ - path: { - text: string; - }; - lines: { - text: string; - }; - line_number: number; - absolute_offset: number; - submatches: Array<{ - match: { - text: string; - }; - start: number; - end: number; - }>; - }>; + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; }; -export type FindTextResponse = FindTextResponses[keyof FindTextResponses]; - -export type FindFilesData = { - body?: never; - path?: never; - query: { - query: string; - }; - url: '/find/file'; -}; +export type McpAuthCallbackError = McpAuthCallbackErrors[keyof McpAuthCallbackErrors]; -export type FindFilesResponses = { +export type McpAuthCallbackResponses = { /** - * File paths + * OAuth authentication completed */ - 200: Array; + 200: McpStatus; }; -export type FindFilesResponse = FindFilesResponses[keyof FindFilesResponses]; +export type McpAuthCallbackResponse = McpAuthCallbackResponses[keyof McpAuthCallbackResponses]; -export type FindSymbolsData = { +export type McpAuthAuthenticateData = { body?: never; - path?: never; - query: { - query: string; + path: { + name: string; }; - url: '/find/symbol'; + query?: { + directory?: string; + }; + url: '/mcp/{name}/auth/authenticate'; }; -export type FindSymbolsResponses = { +export type McpAuthAuthenticateErrors = { /** - * Symbols + * Bad request */ - 200: Array; + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; }; -export type FindSymbolsResponse = FindSymbolsResponses[keyof FindSymbolsResponses]; +export type McpAuthAuthenticateError = McpAuthAuthenticateErrors[keyof McpAuthAuthenticateErrors]; -export type FileReadData = { +export type McpAuthAuthenticateResponses = { + /** + * OAuth authentication completed + */ + 200: McpStatus; +}; + +export type McpAuthAuthenticateResponse = McpAuthAuthenticateResponses[keyof McpAuthAuthenticateResponses]; + +export type McpConnectData = { body?: never; - path?: never; - query: { - path: string; + path: { + name: string; }; - url: '/file'; + query?: { + directory?: string; + }; + url: '/mcp/{name}/connect'; }; -export type FileReadResponses = { +export type McpConnectResponses = { /** - * File content + * MCP server connected successfully */ - 200: { - type: 'raw' | 'patch'; - content: string; - }; + 200: boolean; }; -export type FileReadResponse = FileReadResponses[keyof FileReadResponses]; +export type McpConnectResponse = McpConnectResponses[keyof McpConnectResponses]; -export type FileStatusData = { +export type McpDisconnectData = { body?: never; - path?: never; - query?: never; - url: '/file/status'; + path: { + name: string; + }; + query?: { + directory?: string; + }; + url: '/mcp/{name}/disconnect'; }; -export type FileStatusResponses = { +export type McpDisconnectResponses = { /** - * File status + * MCP server disconnected successfully */ - 200: Array; + 200: boolean; }; -export type FileStatusResponse = FileStatusResponses[keyof FileStatusResponses]; +export type McpDisconnectResponse = McpDisconnectResponses[keyof McpDisconnectResponses]; -export type AppLogData = { - body?: { - /** - * Service name for the log entry - */ - service: string; - /** - * Log level - */ - level: 'debug' | 'info' | 'error' | 'warn'; - /** - * Log message - */ - message: string; - /** - * Additional metadata for the log entry - */ - extra?: { - [key: string]: unknown; - }; - }; +export type LspStatusData = { + body?: never; path?: never; - query?: never; - url: '/log'; + query?: { + directory?: string; + }; + url: '/lsp'; }; -export type AppLogResponses = { +export type LspStatusResponses = { /** - * Log entry written successfully + * LSP server status */ - 200: boolean; + 200: Array; }; -export type AppLogResponse = AppLogResponses[keyof AppLogResponses]; +export type LspStatusResponse = LspStatusResponses[keyof LspStatusResponses]; -export type AppAgentsData = { +export type FormatterStatusData = { body?: never; path?: never; - query?: never; - url: '/agent'; + query?: { + directory?: string; + }; + url: '/formatter'; }; -export type AppAgentsResponses = { +export type FormatterStatusResponses = { /** - * List of agents + * Formatter status */ - 200: Array; + 200: Array; }; -export type AppAgentsResponse = AppAgentsResponses[keyof AppAgentsResponses]; +export type FormatterStatusResponse = FormatterStatusResponses[keyof FormatterStatusResponses]; export type TuiAppendPromptData = { body?: { text: string; }; path?: never; - query?: never; + query?: { + directory?: string; + }; url: '/tui/append-prompt'; }; +export type TuiAppendPromptErrors = { + /** + * Bad request + */ + 400: BadRequestError; +}; + +export type TuiAppendPromptError = TuiAppendPromptErrors[keyof TuiAppendPromptErrors]; + export type TuiAppendPromptResponses = { /** * Prompt processed successfully @@ -1784,7 +4052,9 @@ export type TuiAppendPromptResponse = TuiAppendPromptResponses[keyof TuiAppendPr export type TuiOpenHelpData = { body?: never; path?: never; - query?: never; + query?: { + directory?: string; + }; url: '/tui/open-help'; }; @@ -1800,7 +4070,9 @@ export type TuiOpenHelpResponse = TuiOpenHelpResponses[keyof TuiOpenHelpResponse export type TuiOpenSessionsData = { body?: never; path?: never; - query?: never; + query?: { + directory?: string; + }; url: '/tui/open-sessions'; }; @@ -1816,7 +4088,9 @@ export type TuiOpenSessionsResponse = TuiOpenSessionsResponses[keyof TuiOpenSess export type TuiOpenThemesData = { body?: never; path?: never; - query?: never; + query?: { + directory?: string; + }; url: '/tui/open-themes'; }; @@ -1832,7 +4106,9 @@ export type TuiOpenThemesResponse = TuiOpenThemesResponses[keyof TuiOpenThemesRe export type TuiOpenModelsData = { body?: never; path?: never; - query?: never; + query?: { + directory?: string; + }; url: '/tui/open-models'; }; @@ -1848,7 +4124,9 @@ export type TuiOpenModelsResponse = TuiOpenModelsResponses[keyof TuiOpenModelsRe export type TuiSubmitPromptData = { body?: never; path?: never; - query?: never; + query?: { + directory?: string; + }; url: '/tui/submit-prompt'; }; @@ -1864,7 +4142,9 @@ export type TuiSubmitPromptResponse = TuiSubmitPromptResponses[keyof TuiSubmitPr export type TuiClearPromptData = { body?: never; path?: never; - query?: never; + query?: { + directory?: string; + }; url: '/tui/clear-prompt'; }; @@ -1882,10 +4162,21 @@ export type TuiExecuteCommandData = { command: string; }; path?: never; - query?: never; + query?: { + directory?: string; + }; url: '/tui/execute-command'; }; +export type TuiExecuteCommandErrors = { + /** + * Bad request + */ + 400: BadRequestError; +}; + +export type TuiExecuteCommandError = TuiExecuteCommandErrors[keyof TuiExecuteCommandErrors]; + export type TuiExecuteCommandResponses = { /** * Command executed successfully @@ -1900,9 +4191,15 @@ export type TuiShowToastData = { title?: string; message: string; variant: 'info' | 'success' | 'warning' | 'error'; + /** + * Duration in milliseconds + */ + duration?: number; }; path?: never; - query?: never; + query?: { + directory?: string; + }; url: '/tui/show-toast'; }; @@ -1915,20 +4212,88 @@ export type TuiShowToastResponses = { export type TuiShowToastResponse = TuiShowToastResponses[keyof TuiShowToastResponses]; +export type TuiPublishData = { + body?: EventTuiPromptAppend | EventTuiCommandExecute | EventTuiToastShow; + path?: never; + query?: { + directory?: 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 TuiControlNextData = { + body?: never; + path?: never; + query?: { + directory?: 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; + }; + url: '/tui/control/response'; +}; + +export type TuiControlResponseResponses = { + /** + * Response submitted successfully + */ + 200: boolean; +}; + +export type TuiControlResponseResponse = TuiControlResponseResponses[keyof TuiControlResponseResponses]; + export type AuthSetData = { body?: Auth; path: { - id: string; + providerID: string; }; - query?: never; - url: '/auth/{id}'; + query?: { + directory?: string; + }; + url: '/auth/{providerID}'; }; export type AuthSetErrors = { /** * Bad request */ - 400: Error; + 400: BadRequestError; }; export type AuthSetError = AuthSetErrors[keyof AuthSetErrors]; @@ -1941,3 +4306,21 @@ export type AuthSetResponses = { }; export type AuthSetResponse = AuthSetResponses[keyof AuthSetResponses]; + +export type EventSubscribeData = { + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/event'; +}; + +export type EventSubscribeResponses = { + /** + * Event stream + */ + 200: Event; +}; + +export type EventSubscribeResponse = EventSubscribeResponses[keyof EventSubscribeResponses]; diff --git a/specs/3.1.x/opencode.yaml b/specs/3.1.x/opencode.yaml index 159a5dff0..780e4c972 100644 --- a/specs/3.1.x/opencode.yaml +++ b/specs/3.1.x/opencode.yaml @@ -4,2060 +4,6481 @@ info: description: opencode api version: 1.0.0 paths: - /event: + /global/health: get: + operationId: global.health + summary: Get health + description: Get health information about the OpenCode server. responses: '200': - description: Event stream + description: Health information content: - text/event-stream: + application/json: schema: - $ref: '#/components/schemas/Event' - operationId: event.subscribe - parameters: [] - description: Get events - /app: + type: object + properties: + healthy: + type: boolean + const: true + version: + type: string + required: + - healthy + - version + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.global.health({ + ... + }) + /global/event: get: + operationId: global.event + summary: Get global events + description: Subscribe to global events from the OpenCode system using + server-sent events. responses: '200': - description: '200' + description: Event stream content: - application/json: + text/event-stream: schema: - $ref: '#/components/schemas/App' - operationId: app.get - parameters: [] - description: Get app info - /app/init: + $ref: '#/components/schemas/GlobalEvent' + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.global.event({ + ... + }) + /global/dispose: post: + operationId: global.dispose + summary: Dispose instance + description: Clean up and dispose all OpenCode instances, releasing all resources. responses: '200': - description: Initialize the app + description: Global disposed content: application/json: schema: type: boolean - operationId: app.init - parameters: [] - description: Initialize the app - /config: + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.global.dispose({ + ... + }) + /project: get: + operationId: project.list + parameters: + - in: query + name: directory + schema: + type: string + summary: List all projects + description: Get a list of projects that have been opened with OpenCode. responses: '200': - description: Get config info + description: List of projects content: application/json: schema: - $ref: '#/components/schemas/Config' - operationId: config.get - parameters: [] - description: Get config info - /session: + type: array + items: + $ref: '#/components/schemas/Project' + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.project.list({ + ... + }) + /project/current: get: + operationId: project.current + parameters: + - in: query + name: directory + schema: + type: string + summary: Get current project + description: Retrieve the currently active project that OpenCode is working with. responses: '200': - description: List of sessions + description: Current project information content: application/json: schema: - type: array - items: - $ref: '#/components/schemas/Session' - operationId: session.list - parameters: [] - description: List all sessions - post: + $ref: '#/components/schemas/Project' + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.project.current({ + ... + }) + /project/{projectID}: + patch: + operationId: project.update + parameters: + - in: query + name: directory + schema: + type: string + - in: path + name: projectID + schema: + type: string + required: true + summary: Update project + description: Update project properties such as name, icon and color. responses: '200': - description: Successfully created session + description: Updated project information content: application/json: schema: - $ref: '#/components/schemas/Session' + $ref: '#/components/schemas/Project' '400': description: Bad request content: application/json: schema: - $ref: '#/components/schemas/Error' - operationId: session.create - parameters: [] - description: Create a new session + $ref: '#/components/schemas/BadRequestError' + '404': + description: Not found + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' requestBody: content: application/json: schema: type: object properties: - parentID: - type: string - title: + name: type: string - /session/{id}: + icon: + type: object + properties: + url: + type: string + color: + type: string + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.project.update({ + ... + }) + /pty: get: - responses: - '200': - description: Get session - content: - application/json: - schema: - $ref: '#/components/schemas/Session' - operationId: session.get + operationId: pty.list parameters: - - in: path - name: id + - in: query + name: directory schema: type: string - required: true - description: Get session - delete: + summary: List PTY sessions + description: + Get a list of all active pseudo-terminal (PTY) sessions managed by + OpenCode. responses: '200': - description: Successfully deleted session + description: List of sessions content: application/json: schema: - type: boolean - operationId: session.delete + type: array + items: + $ref: '#/components/schemas/Pty' + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.pty.list({ + ... + }) + post: + operationId: pty.create parameters: - - in: path - name: id + - in: query + name: directory schema: type: string - required: true - description: Delete a session and all its data - patch: + summary: Create PTY session + description: Create a new pseudo-terminal (PTY) session for running shell + commands and processes. responses: '200': - description: Successfully updated session + description: Created session content: application/json: schema: - $ref: '#/components/schemas/Session' - operationId: session.update - parameters: - - in: path - name: id - schema: - type: string - required: true - description: Update session properties + $ref: '#/components/schemas/Pty' + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' requestBody: content: application/json: schema: type: object properties: + command: + type: string + args: + type: array + items: + type: string + cwd: + type: string title: type: string - /session/{id}/children: + env: + type: object + propertyNames: + type: string + additionalProperties: + type: string + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.pty.create({ + ... + }) + /pty/{ptyID}: get: - responses: - '200': - description: List of children - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/Session' - operationId: session.children + operationId: pty.get parameters: + - in: query + name: directory + schema: + type: string - in: path - name: id + name: ptyID schema: type: string required: true - description: Get a session's children - /session/{id}/init: - post: + summary: Get PTY session + description: + Retrieve detailed information about a specific pseudo-terminal + (PTY) session. responses: '200': - description: '200' + description: Session info content: application/json: schema: - type: boolean - operationId: session.init + $ref: '#/components/schemas/Pty' + '404': + description: Not found + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.pty.get({ + ... + }) + put: + operationId: pty.update parameters: + - in: query + name: directory + schema: + type: string - in: path - name: id + name: ptyID schema: type: string - description: Session ID required: true - description: Analyze the app and create an AGENTS.md file + summary: Update PTY session + description: Update properties of an existing pseudo-terminal (PTY) session. + responses: + '200': + description: Updated session + content: + application/json: + schema: + $ref: '#/components/schemas/Pty' + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' requestBody: content: application/json: schema: type: object properties: - messageID: - type: string - providerID: - type: string - modelID: + title: type: string - required: - - messageID - - providerID - - modelID - /session/{id}/abort: - post: + size: + type: object + properties: + rows: + type: number + cols: + type: number + required: + - rows + - cols + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.pty.update({ + ... + }) + delete: + operationId: pty.remove + parameters: + - in: query + name: directory + schema: + type: string + - in: path + name: ptyID + schema: + type: string + required: true + summary: Remove PTY session + description: Remove and terminate a specific pseudo-terminal (PTY) session. responses: '200': - description: Aborted session + description: Session removed content: application/json: schema: type: boolean - operationId: session.abort + '404': + description: Not found + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.pty.remove({ + ... + }) + /pty/{ptyID}/connect: + get: + operationId: pty.connect parameters: + - in: query + name: directory + schema: + type: string - in: path - name: id + name: ptyID schema: type: string required: true - description: Abort a session - /session/{id}/share: - post: + summary: Connect to PTY session + description: + Establish a WebSocket connection to interact with a pseudo-terminal + (PTY) session in real-time. responses: '200': - description: Successfully shared session + description: Connected session content: application/json: schema: - $ref: '#/components/schemas/Session' - operationId: session.share + type: boolean + '404': + description: Not found + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.pty.connect({ + ... + }) + /config: + get: + operationId: config.get parameters: - - in: path - name: id + - in: query + name: directory schema: type: string - required: true - description: Share a session - delete: + summary: Get configuration + description: Retrieve the current OpenCode configuration settings and preferences. responses: '200': - description: Successfully unshared session + description: Get config info content: application/json: schema: - $ref: '#/components/schemas/Session' - operationId: session.unshare + $ref: '#/components/schemas/Config' + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.config.get({ + ... + }) + patch: + operationId: config.update parameters: - - in: path - name: id + - in: query + name: directory schema: type: string - required: true - description: Unshare the session - /session/{id}/summarize: - post: + summary: Update configuration + description: Update OpenCode configuration settings and preferences. responses: '200': - description: Summarized session + description: Successfully updated config content: application/json: schema: - type: boolean - operationId: session.summarize - parameters: - - in: path - name: id - schema: - type: string - description: Session ID - required: true - description: Summarize the session + $ref: '#/components/schemas/Config' + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' requestBody: content: application/json: schema: - type: object - properties: - providerID: - type: string - modelID: - type: string - required: - - providerID - - modelID - /session/{id}/message: + $ref: '#/components/schemas/Config' + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.config.update({ + ... + }) + /experimental/tool/ids: get: + operationId: tool.ids + parameters: + - in: query + name: directory + schema: + type: string + summary: List tool IDs + description: + Get a list of all available tool IDs, including both built-in tools + and dynamically registered tools. responses: '200': - description: List of messages + description: Tool IDs content: application/json: schema: - type: array - items: - type: object - properties: - info: - $ref: '#/components/schemas/Message' - parts: - type: array - items: - $ref: '#/components/schemas/Part' - required: - - info - - parts - operationId: session.messages + $ref: '#/components/schemas/ToolIDs' + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.tool.ids({ + ... + }) + /experimental/tool: + get: + operationId: tool.list parameters: - - in: path - name: id + - in: query + name: directory + schema: + type: string + - in: query + name: provider schema: type: string - description: Session ID required: true - description: List messages for a session - post: - responses: - '200': - description: Created message + - in: query + name: model + schema: + type: string + required: true + summary: List tools + description: + Get a list of available tools with their JSON schema parameters for + a specific provider and model combination. + responses: + '200': + description: Tools content: application/json: schema: - type: object - properties: - info: - $ref: '#/components/schemas/AssistantMessage' - parts: - type: array - items: - $ref: '#/components/schemas/Part' - required: - - info - - parts - operationId: session.chat + $ref: '#/components/schemas/ToolList' + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.tool.list({ + ... + }) + /instance/dispose: + post: + operationId: instance.dispose parameters: - - in: path - name: id + - in: query + name: directory schema: type: string - description: Session ID - required: true - description: Create and send a new message to a session - requestBody: - content: - application/json: - schema: - type: object - properties: - messageID: - type: string - pattern: ^msg - providerID: - type: string - modelID: - type: string - agent: - type: string - system: - type: string - tools: - type: object - additionalProperties: - type: boolean - parts: - type: array - items: - oneOf: - - $ref: '#/components/schemas/TextPartInput' - - $ref: '#/components/schemas/FilePartInput' - - $ref: '#/components/schemas/AgentPartInput' - discriminator: - propertyName: type - mapping: - text: '#/components/schemas/TextPartInput' - file: '#/components/schemas/FilePartInput' - agent: '#/components/schemas/AgentPartInput' - required: - - providerID - - modelID - - parts - /session/{id}/message/{messageID}: + summary: Dispose instance + description: + Clean up and dispose the current OpenCode instance, releasing all + resources. + responses: + '200': + description: Instance disposed + content: + application/json: + schema: + type: boolean + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.instance.dispose({ + ... + }) + /path: get: + operationId: path.get + parameters: + - in: query + name: directory + schema: + type: string + summary: Get paths + description: + Retrieve the current working directory and related path information + for the OpenCode instance. responses: '200': - description: Message + description: Path content: application/json: schema: - type: object - properties: - info: - $ref: '#/components/schemas/Message' - parts: - type: array - items: - $ref: '#/components/schemas/Part' - required: - - info - - parts - operationId: session.message + $ref: '#/components/schemas/Path' + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.path.get({ + ... + }) + /vcs: + get: + operationId: vcs.get parameters: - - in: path - name: id + - in: query + name: directory schema: type: string - description: Session ID - required: true - - in: path - name: messageID + summary: Get VCS info + description: + Retrieve version control system (VCS) information for the current + project, such as git branch. + responses: + '200': + description: VCS info + content: + application/json: + schema: + $ref: '#/components/schemas/VcsInfo' + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.vcs.get({ + ... + }) + /session: + get: + operationId: session.list + parameters: + - in: query + name: directory schema: type: string - description: Message ID - required: true - description: Get a message from a session - /session/{id}/shell: - post: + summary: List sessions + description: Get a list of all OpenCode sessions, sorted by most recently updated. responses: '200': - description: Created message + description: List of sessions content: application/json: schema: - $ref: '#/components/schemas/AssistantMessage' - operationId: session.shell + type: array + items: + $ref: '#/components/schemas/Session' + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.session.list({ + ... + }) + post: + operationId: session.create parameters: - - in: path - name: id + - in: query + name: directory schema: type: string - description: Session ID - required: true - description: Run a shell command + summary: Create session + description: + Create a new OpenCode session for interacting with AI assistants + and managing conversations. + responses: + '200': + description: Successfully created session + content: + application/json: + schema: + $ref: '#/components/schemas/Session' + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' requestBody: content: application/json: schema: type: object properties: - agent: + parentID: type: string - command: + pattern: ^ses.* + title: type: string - required: - - agent - - command - /session/{id}/revert: - post: + permission: + $ref: '#/components/schemas/PermissionRuleset' + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.session.create({ + ... + }) + /session/status: + get: + operationId: session.status + parameters: + - in: query + name: directory + schema: + type: string + summary: Get session status + description: + Retrieve the current status of all sessions, including active, + idle, and completed states. responses: '200': - description: Updated session + description: Get session status content: application/json: schema: - $ref: '#/components/schemas/Session' - operationId: session.revert + type: object + propertyNames: + type: string + additionalProperties: + $ref: '#/components/schemas/SessionStatus' + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.session.status({ + ... + }) + /session/{sessionID}: + get: + operationId: session.get parameters: + - in: query + name: directory + schema: + type: string - in: path - name: id + name: sessionID schema: type: string + pattern: ^ses.* required: true - description: Revert a message - requestBody: - content: - application/json: - schema: - type: object - properties: - messageID: - type: string - pattern: ^msg - partID: - type: string - pattern: ^prt - required: - - messageID - /session/{id}/unrevert: - post: + summary: Get session + description: Retrieve detailed information about a specific OpenCode session. + tags: + - Session responses: '200': - description: Updated session + description: Get session content: application/json: schema: $ref: '#/components/schemas/Session' - operationId: session.unrevert + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + '404': + description: Not found + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.session.get({ + ... + }) + delete: + operationId: session.delete parameters: + - in: query + name: directory + schema: + type: string - in: path - name: id + name: sessionID schema: type: string + pattern: ^ses.* required: true - description: Restore all reverted messages - /session/{id}/permissions/{permissionID}: - post: + summary: Delete session + description: Delete a session and permanently remove all associated data, + including messages and history. responses: '200': - description: Permission processed successfully + description: Successfully deleted session content: application/json: schema: type: boolean - operationId: postSessionByIdPermissionsByPermissionID + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + '404': + description: Not found + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.session.delete({ + ... + }) + patch: + operationId: session.update parameters: - - in: path - name: id + - in: query + name: directory schema: type: string - required: true - in: path - name: permissionID + name: sessionID schema: type: string required: true - description: Respond to a permission request + summary: Update session + description: + Update properties of an existing session, such as title or other + metadata. + responses: + '200': + description: Successfully updated session + content: + application/json: + schema: + $ref: '#/components/schemas/Session' + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + '404': + description: Not found + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' requestBody: content: application/json: schema: type: object properties: - response: + title: type: string - enum: - - once - - always - - reject - required: - - response - /config/providers: + time: + type: object + properties: + archived: + type: number + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.session.update({ + ... + }) + /session/{sessionID}/children: get: + operationId: session.children + parameters: + - in: query + name: directory + schema: + type: string + - in: path + name: sessionID + schema: + type: string + pattern: ^ses.* + required: true + summary: Get session children + tags: + - Session + description: + Retrieve all child sessions that were forked from the specified + parent session. responses: '200': - description: List of providers - content: - application/json: - schema: - type: object - properties: - providers: - type: array - items: - $ref: '#/components/schemas/Provider' - default: - type: object - additionalProperties: - type: string - required: - - providers - - default - operationId: config.providers - parameters: [] - description: List all providers - /find: - get: - responses: - '200': - description: Matches + description: List of children content: application/json: schema: type: array items: - type: object - properties: - path: - type: object - properties: - text: - type: string - required: - - text - lines: - type: object - properties: - text: - type: string - required: - - text - line_number: - type: number - absolute_offset: - type: number - submatches: - type: array - items: - type: object - properties: - match: - type: object - properties: - text: - type: string - required: - - text - start: - type: number - end: - type: number - required: - - match - - start - - end - required: - - path - - lines - - line_number - - absolute_offset - - submatches - operationId: find.text - parameters: - - in: query - name: pattern - schema: - type: string - required: true - description: Find text in files - /find/file: - get: - responses: - '200': - description: File paths + $ref: '#/components/schemas/Session' + '400': + description: Bad request content: application/json: schema: - type: array - items: - type: string - operationId: find.files + $ref: '#/components/schemas/BadRequestError' + '404': + description: Not found + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.session.children({ + ... + }) + /session/{sessionID}/todo: + get: + operationId: session.todo parameters: - in: query - name: query + name: directory + schema: + type: string + - in: path + name: sessionID schema: type: string required: true - description: Find files - /find/symbol: - get: + description: Session ID + summary: Get session todos + description: + Retrieve the todo list associated with a specific session, showing + tasks and action items. responses: '200': - description: Symbols + description: Todo list content: application/json: schema: type: array items: - $ref: '#/components/schemas/Symbol' - operationId: find.symbols - parameters: - - in: query - name: query - schema: - type: string - required: true - description: Find workspace symbols - /file: - get: - responses: - '200': - description: File content + $ref: '#/components/schemas/Todo' + '400': + description: Bad request content: application/json: schema: - type: object - properties: - type: - type: string - enum: - - raw - - patch - content: - type: string - required: - - type - - content - operationId: file.read + $ref: '#/components/schemas/BadRequestError' + '404': + description: Not found + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.session.todo({ + ... + }) + /session/{sessionID}/init: + post: + operationId: session.init parameters: - in: query - name: path + name: directory + schema: + type: string + - in: path + name: sessionID schema: type: string required: true - description: Read a file - /file/status: - get: + description: Session ID + summary: Initialize session + description: + Analyze the current application and create an AGENTS.md file with + project-specific agent configurations. responses: '200': - description: File status + description: '200' content: application/json: schema: - type: array - items: - $ref: '#/components/schemas/File' - operationId: file.status - parameters: [] - description: Get file status - /log: - post: - responses: - '200': - description: Log entry written successfully + type: boolean + '400': + description: Bad request content: application/json: schema: - type: boolean - operationId: app.log - parameters: [] - description: Write a log entry to the server logs + $ref: '#/components/schemas/BadRequestError' + '404': + description: Not found + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' requestBody: content: application/json: schema: type: object properties: - service: + modelID: type: string - description: Service name for the log entry - level: + providerID: type: string - enum: - - debug - - info - - error - - warn - description: Log level - message: + messageID: type: string - description: Log message - extra: - type: object - additionalProperties: {} - description: Additional metadata for the log entry + pattern: ^msg.* required: - - service - - level - - message - /agent: - get: - responses: - '200': - description: List of agents - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/Agent' - operationId: app.agents - parameters: [] - description: List all agents - /tui/append-prompt: + - modelID + - providerID + - messageID + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.session.init({ + ... + }) + /session/{sessionID}/fork: post: + operationId: session.fork + parameters: + - in: query + name: directory + schema: + type: string + - in: path + name: sessionID + schema: + type: string + pattern: ^ses.* + required: true + summary: Fork session + description: + Create a new session by forking an existing session at a specific + message point. responses: '200': - description: Prompt processed successfully + description: '200' content: application/json: schema: - type: boolean - operationId: tui.appendPrompt - parameters: [] - description: Append prompt to the TUI + $ref: '#/components/schemas/Session' requestBody: content: application/json: schema: type: object properties: - text: + messageID: type: string - required: - - text - /tui/open-help: - post: - responses: - '200': - description: Help dialog opened successfully - content: - application/json: - schema: - type: boolean - operationId: tui.openHelp - parameters: [] - description: Open the help dialog - /tui/open-sessions: + pattern: ^msg.* + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.session.fork({ + ... + }) + /session/{sessionID}/abort: post: + operationId: session.abort + parameters: + - in: query + name: directory + schema: + type: string + - in: path + name: sessionID + schema: + type: string + required: true + summary: Abort session + description: Abort an active session and stop any ongoing AI processing or + command execution. responses: '200': - description: Session dialog opened successfully + description: Aborted session content: application/json: schema: type: boolean - operationId: tui.openSessions - parameters: [] - description: Open the session dialog - /tui/open-themes: - post: - responses: - '200': - description: Theme dialog opened successfully + '400': + description: Bad request content: application/json: schema: - type: boolean - operationId: tui.openThemes - parameters: [] - description: Open the theme dialog - /tui/open-models: - post: - responses: - '200': - description: Model dialog opened successfully + $ref: '#/components/schemas/BadRequestError' + '404': + description: Not found content: application/json: schema: - type: boolean - operationId: tui.openModels - parameters: [] - description: Open the model dialog - /tui/submit-prompt: + $ref: '#/components/schemas/NotFoundError' + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.session.abort({ + ... + }) + /session/{sessionID}/share: post: + operationId: session.share + parameters: + - in: query + name: directory + schema: + type: string + - in: path + name: sessionID + schema: + type: string + required: true + summary: Share session + description: + Create a shareable link for a session, allowing others to view the + conversation. responses: '200': - description: Prompt submitted successfully + description: Successfully shared session content: application/json: schema: - type: boolean - operationId: tui.submitPrompt - parameters: [] - description: Submit the prompt - /tui/clear-prompt: - post: - responses: - '200': - description: Prompt cleared successfully + $ref: '#/components/schemas/Session' + '400': + description: Bad request content: application/json: schema: - type: boolean - operationId: tui.clearPrompt - parameters: [] - description: Clear the prompt - /tui/execute-command: - post: - responses: - '200': - description: Command executed successfully + $ref: '#/components/schemas/BadRequestError' + '404': + description: Not found + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.session.share({ + ... + }) + delete: + operationId: session.unshare + parameters: + - in: query + name: directory + schema: + type: string + - in: path + name: sessionID + schema: + type: string + pattern: ^ses.* + required: true + summary: Unshare session + description: Remove the shareable link for a session, making it private again. + responses: + '200': + description: Successfully unshared session + content: + application/json: + schema: + $ref: '#/components/schemas/Session' + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + '404': + description: Not found + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.session.unshare({ + ... + }) + /session/{sessionID}/diff: + get: + operationId: session.diff + parameters: + - in: query + name: directory + schema: + type: string + - in: path + name: sessionID + schema: + type: string + required: true + description: Session ID + - in: query + name: messageID + schema: + type: string + pattern: ^msg.* + summary: Get session diff + description: Get all file changes (diffs) made during this session. + responses: + '200': + description: List of diffs + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/FileDiff' + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + '404': + description: Not found + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.session.diff({ + ... + }) + /session/{sessionID}/summarize: + post: + operationId: session.summarize + parameters: + - in: query + name: directory + schema: + type: string + - in: path + name: sessionID + schema: + type: string + required: true + description: Session ID + summary: Summarize session + description: + Generate a concise summary of the session using AI compaction to + preserve key information. + responses: + '200': + description: Summarized session content: application/json: schema: type: boolean - operationId: tui.executeCommand - parameters: [] - description: Execute a TUI command (e.g. agent_cycle) + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + '404': + description: Not found + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' requestBody: content: application/json: schema: type: object properties: - command: + providerID: + type: string + modelID: type: string + auto: + default: false + type: boolean required: - - command - /tui/show-toast: + - providerID + - modelID + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.session.summarize({ + ... + }) + /session/{sessionID}/message: + get: + operationId: session.messages + parameters: + - in: query + name: directory + schema: + type: string + - in: path + name: sessionID + schema: + type: string + required: true + description: Session ID + - in: query + name: limit + schema: + type: number + summary: Get session messages + description: + Retrieve all messages in a session, including user prompts and AI + responses. + responses: + '200': + description: List of messages + content: + application/json: + schema: + type: array + items: + type: object + properties: + info: + $ref: '#/components/schemas/Message' + parts: + type: array + items: + $ref: '#/components/schemas/Part' + required: + - info + - parts + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + '404': + description: Not found + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.session.messages({ + ... + }) post: + operationId: session.prompt + parameters: + - in: query + name: directory + schema: + type: string + - in: path + name: sessionID + schema: + type: string + required: true + description: Session ID + summary: Send message + description: Create and send a new message to a session, streaming the AI response. responses: '200': - description: Toast notification shown successfully + description: Created message content: application/json: schema: - type: boolean - operationId: tui.showToast - parameters: [] - description: Show a toast notification in the TUI + type: object + properties: + info: + $ref: '#/components/schemas/AssistantMessage' + parts: + type: array + items: + $ref: '#/components/schemas/Part' + required: + - info + - parts + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + '404': + description: Not found + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' requestBody: content: application/json: schema: type: object properties: - title: + messageID: type: string - message: + pattern: ^msg.* + model: + type: object + properties: + providerID: + type: string + modelID: + type: string + required: + - providerID + - modelID + agent: + type: string + noReply: + type: boolean + tools: + description: + '@deprecated tools and permissions have been merged, you can set + permissions on the session itself now' + type: object + propertyNames: + type: string + additionalProperties: + type: boolean + system: type: string variant: type: string - enum: - - info - - success - - warning - - error + parts: + type: array + items: + anyOf: + - $ref: '#/components/schemas/TextPartInput' + - $ref: '#/components/schemas/FilePartInput' + - $ref: '#/components/schemas/AgentPartInput' + - $ref: '#/components/schemas/SubtaskPartInput' required: - - message - - variant - /auth/{id}: - put: + - parts + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.session.prompt({ + ... + }) + /session/{sessionID}/message/{messageID}: + get: + operationId: session.message + parameters: + - in: query + name: directory + schema: + type: string + - in: path + name: sessionID + schema: + type: string + required: true + description: Session ID + - in: path + name: messageID + schema: + type: string + required: true + description: Message ID + summary: Get message + description: Retrieve a specific message from a session by its message ID. responses: '200': - description: Successfully set authentication credentials + description: Message content: application/json: schema: - type: boolean + type: object + properties: + info: + $ref: '#/components/schemas/Message' + parts: + type: array + items: + $ref: '#/components/schemas/Part' + required: + - info + - parts '400': description: Bad request content: application/json: schema: - $ref: '#/components/schemas/Error' - operationId: auth.set + $ref: '#/components/schemas/BadRequestError' + '404': + description: Not found + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.session.message({ + ... + }) + /session/{sessionID}/message/{messageID}/part/{partID}: + delete: + operationId: part.delete parameters: + - in: query + name: directory + schema: + type: string - in: path - name: id + name: sessionID schema: type: string required: true - description: Set authentication credentials - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/Auth' -components: - schemas: - Event: - oneOf: - - $ref: '#/components/schemas/Event.installation.updated' - - $ref: '#/components/schemas/Event.lsp.client.diagnostics' - - $ref: '#/components/schemas/Event.message.updated' - - $ref: '#/components/schemas/Event.message.removed' - - $ref: '#/components/schemas/Event.message.part.updated' - - $ref: '#/components/schemas/Event.message.part.removed' - - $ref: '#/components/schemas/Event.storage.write' - - $ref: '#/components/schemas/Event.permission.updated' - - $ref: '#/components/schemas/Event.permission.replied' - - $ref: '#/components/schemas/Event.file.edited' - - $ref: '#/components/schemas/Event.session.updated' - - $ref: '#/components/schemas/Event.session.deleted' - - $ref: '#/components/schemas/Event.session.idle' - - $ref: '#/components/schemas/Event.session.error' - - $ref: '#/components/schemas/Event.server.connected' - - $ref: '#/components/schemas/Event.file.watcher.updated' - - $ref: '#/components/schemas/Event.ide.installed' - discriminator: - propertyName: type - mapping: - installation.updated: '#/components/schemas/Event.installation.updated' - lsp.client.diagnostics: '#/components/schemas/Event.lsp.client.diagnostics' - message.updated: '#/components/schemas/Event.message.updated' - message.removed: '#/components/schemas/Event.message.removed' - message.part.updated: '#/components/schemas/Event.message.part.updated' - message.part.removed: '#/components/schemas/Event.message.part.removed' - storage.write: '#/components/schemas/Event.storage.write' - permission.updated: '#/components/schemas/Event.permission.updated' - permission.replied: '#/components/schemas/Event.permission.replied' - file.edited: '#/components/schemas/Event.file.edited' - session.updated: '#/components/schemas/Event.session.updated' - session.deleted: '#/components/schemas/Event.session.deleted' - session.idle: '#/components/schemas/Event.session.idle' - session.error: '#/components/schemas/Event.session.error' - server.connected: '#/components/schemas/Event.server.connected' - file.watcher.updated: '#/components/schemas/Event.file.watcher.updated' - ide.installed: '#/components/schemas/Event.ide.installed' - Event.installation.updated: - type: object - properties: - type: - type: string - const: installation.updated + description: Session ID + - in: path + name: messageID + schema: + type: string + required: true + description: Message ID + - in: path + name: partID + schema: + type: string + required: true + description: Part ID + description: Delete a part from a message + responses: + '200': + description: Successfully deleted part + content: + application/json: + schema: + type: boolean + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + '404': + description: Not found + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.part.delete({ + ... + }) + patch: + operationId: part.update + parameters: + - in: query + name: directory + schema: + type: string + - in: path + name: sessionID + schema: + type: string + required: true + description: Session ID + - in: path + name: messageID + schema: + type: string + required: true + description: Message ID + - in: path + name: partID + schema: + type: string + required: true + description: Part ID + description: Update a part in a message + responses: + '200': + description: Successfully updated part + content: + application/json: + schema: + $ref: '#/components/schemas/Part' + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + '404': + description: Not found + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Part' + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.part.update({ + ... + }) + /session/{sessionID}/prompt_async: + post: + operationId: session.prompt_async + parameters: + - in: query + name: directory + schema: + type: string + - in: path + name: sessionID + schema: + type: string + required: true + description: Session ID + summary: Send async message + description: + Create and send a new message to a session asynchronously, starting + the session if needed and returning immediately. + responses: + '204': + description: Prompt accepted + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + '404': + description: Not found + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + requestBody: + content: + application/json: + schema: + type: object + properties: + messageID: + type: string + pattern: ^msg.* + model: + type: object + properties: + providerID: + type: string + modelID: + type: string + required: + - providerID + - modelID + agent: + type: string + noReply: + type: boolean + tools: + description: + '@deprecated tools and permissions have been merged, you can set + permissions on the session itself now' + type: object + propertyNames: + type: string + additionalProperties: + type: boolean + system: + type: string + variant: + type: string + parts: + type: array + items: + anyOf: + - $ref: '#/components/schemas/TextPartInput' + - $ref: '#/components/schemas/FilePartInput' + - $ref: '#/components/schemas/AgentPartInput' + - $ref: '#/components/schemas/SubtaskPartInput' + required: + - parts + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.session.prompt_async({ + ... + }) + /session/{sessionID}/command: + post: + operationId: session.command + parameters: + - in: query + name: directory + schema: + type: string + - in: path + name: sessionID + schema: + type: string + required: true + description: Session ID + summary: Send command + description: Send a new command to a session for execution by the AI assistant. + responses: + '200': + description: Created message + content: + application/json: + schema: + type: object + properties: + info: + $ref: '#/components/schemas/AssistantMessage' + parts: + type: array + items: + $ref: '#/components/schemas/Part' + required: + - info + - parts + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + '404': + description: Not found + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + requestBody: + content: + application/json: + schema: + type: object + properties: + messageID: + type: string + pattern: ^msg.* + agent: + type: string + model: + type: string + arguments: + type: string + command: + type: string + variant: + type: string + required: + - arguments + - command + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.session.command({ + ... + }) + /session/{sessionID}/shell: + post: + operationId: session.shell + parameters: + - in: query + name: directory + schema: + type: string + - in: path + name: sessionID + schema: + type: string + required: true + description: Session ID + summary: Run shell command + description: + Execute a shell command within the session context and return the + AI's response. + responses: + '200': + description: Created message + content: + application/json: + schema: + $ref: '#/components/schemas/AssistantMessage' + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + '404': + description: Not found + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + requestBody: + content: + application/json: + schema: + type: object + properties: + agent: + type: string + model: + type: object + properties: + providerID: + type: string + modelID: + type: string + required: + - providerID + - modelID + command: + type: string + required: + - agent + - command + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.session.shell({ + ... + }) + /session/{sessionID}/revert: + post: + operationId: session.revert + parameters: + - in: query + name: directory + schema: + type: string + - in: path + name: sessionID + schema: + type: string + required: true + summary: Revert message + description: + Revert a specific message in a session, undoing its effects and + restoring the previous state. + responses: + '200': + description: Updated session + content: + application/json: + schema: + $ref: '#/components/schemas/Session' + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + '404': + description: Not found + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + requestBody: + content: + application/json: + schema: + type: object + properties: + messageID: + type: string + pattern: ^msg.* + partID: + type: string + pattern: ^prt.* + required: + - messageID + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.session.revert({ + ... + }) + /session/{sessionID}/unrevert: + post: + operationId: session.unrevert + parameters: + - in: query + name: directory + schema: + type: string + - in: path + name: sessionID + schema: + type: string + required: true + summary: Restore reverted messages + description: Restore all previously reverted messages in a session. + responses: + '200': + description: Updated session + content: + application/json: + schema: + $ref: '#/components/schemas/Session' + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + '404': + description: Not found + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.session.unrevert({ + ... + }) + /session/{sessionID}/permissions/{permissionID}: + post: + operationId: permission.respond + parameters: + - in: query + name: directory + schema: + type: string + - in: path + name: sessionID + schema: + type: string + required: true + - in: path + name: permissionID + schema: + type: string + required: true + summary: Respond to permission + deprecated: true + description: Approve or deny a permission request from the AI assistant. + responses: + '200': + description: Permission processed successfully + content: + application/json: + schema: + type: boolean + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + '404': + description: Not found + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + requestBody: + content: + application/json: + schema: + type: object + properties: + response: + type: string + enum: + - once + - always + - reject + required: + - response + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.permission.respond({ + ... + }) + /permission/{requestID}/reply: + post: + operationId: permission.reply + parameters: + - in: query + name: directory + schema: + type: string + - in: path + name: requestID + schema: + type: string + required: true + summary: Respond to permission request + description: Approve or deny a permission request from the AI assistant. + responses: + '200': + description: Permission processed successfully + content: + application/json: + schema: + type: boolean + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + '404': + description: Not found + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + requestBody: + content: + application/json: + schema: + type: object + properties: + reply: + type: string + enum: + - once + - always + - reject + required: + - reply + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.permission.reply({ + ... + }) + /permission: + get: + operationId: permission.list + parameters: + - in: query + name: directory + schema: + type: string + summary: List pending permissions + description: Get all pending permission requests across all sessions. + responses: + '200': + description: List of pending permissions + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/PermissionRequest' + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.permission.list({ + ... + }) + /command: + get: + operationId: command.list + parameters: + - in: query + name: directory + schema: + type: string + summary: List commands + description: Get a list of all available commands in the OpenCode system. + responses: + '200': + description: List of commands + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Command' + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.command.list({ + ... + }) + /config/providers: + get: + operationId: config.providers + parameters: + - in: query + name: directory + schema: + type: string + summary: List config providers + description: Get a list of all configured AI providers and their default models. + responses: + '200': + description: List of providers + content: + application/json: + schema: + type: object + properties: + providers: + type: array + items: + $ref: '#/components/schemas/Provider' + default: + type: object + propertyNames: + type: string + additionalProperties: + type: string + required: + - providers + - default + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.config.providers({ + ... + }) + /provider: + get: + operationId: provider.list + parameters: + - in: query + name: directory + schema: + type: string + summary: List providers + description: + Get a list of all available AI providers, including both available + and connected ones. + responses: + '200': + description: List of providers + content: + application/json: + schema: + type: object + properties: + all: + type: array + items: + type: object + properties: + api: + type: string + name: + type: string + env: + type: array + items: + type: string + id: + type: string + npm: + type: string + models: + type: object + propertyNames: + type: string + additionalProperties: + type: object + properties: + id: + type: string + name: + type: string + family: + type: string + release_date: + type: string + attachment: + type: boolean + reasoning: + type: boolean + temperature: + type: boolean + tool_call: + type: boolean + interleaved: + anyOf: + - type: boolean + const: true + - type: object + properties: + field: + type: string + enum: + - reasoning_content + - reasoning_details + required: + - field + additionalProperties: false + cost: + type: object + properties: + input: + type: number + output: + type: number + cache_read: + type: number + cache_write: + type: number + context_over_200k: + type: object + properties: + input: + type: number + output: + type: number + cache_read: + type: number + cache_write: + type: number + required: + - input + - output + required: + - input + - output + limit: + type: object + properties: + context: + type: number + output: + type: number + required: + - context + - output + modalities: + type: object + properties: + input: + type: array + items: + type: string + enum: + - text + - audio + - image + - video + - pdf + output: + type: array + items: + type: string + enum: + - text + - audio + - image + - video + - pdf + required: + - input + - output + experimental: + type: boolean + status: + type: string + enum: + - alpha + - beta + - deprecated + options: + type: object + propertyNames: + type: string + additionalProperties: {} + headers: + type: object + propertyNames: + type: string + additionalProperties: + type: string + provider: + type: object + properties: + npm: + type: string + required: + - npm + variants: + type: object + propertyNames: + type: string + additionalProperties: + type: object + propertyNames: + type: string + additionalProperties: {} + required: + - id + - name + - release_date + - attachment + - reasoning + - temperature + - tool_call + - limit + - options + required: + - name + - env + - id + - models + default: + type: object + propertyNames: + type: string + additionalProperties: + type: string + connected: + type: array + items: + type: string + required: + - all + - default + - connected + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.provider.list({ + ... + }) + /provider/auth: + get: + operationId: provider.auth + parameters: + - in: query + name: directory + schema: + type: string + summary: Get provider auth methods + description: Retrieve available authentication methods for all AI providers. + responses: + '200': + description: Provider auth methods + content: + application/json: + schema: + type: object + propertyNames: + type: string + additionalProperties: + type: array + items: + $ref: '#/components/schemas/ProviderAuthMethod' + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.provider.auth({ + ... + }) + /provider/{providerID}/oauth/authorize: + post: + operationId: provider.oauth.authorize + parameters: + - in: query + name: directory + schema: + type: string + - in: path + name: providerID + schema: + type: string + required: true + description: Provider ID + summary: OAuth authorize + description: + Initiate OAuth authorization for a specific AI provider to get an + authorization URL. + responses: + '200': + description: Authorization URL and method + content: + application/json: + schema: + $ref: '#/components/schemas/ProviderAuthAuthorization' + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + requestBody: + content: + application/json: + schema: + type: object + properties: + method: + description: Auth method index + type: number + required: + - method + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.provider.oauth.authorize({ + ... + }) + /provider/{providerID}/oauth/callback: + post: + operationId: provider.oauth.callback + parameters: + - in: query + name: directory + schema: + type: string + - in: path + name: providerID + schema: + type: string + required: true + description: Provider ID + summary: OAuth callback + description: Handle the OAuth callback from a provider after user authorization. + responses: + '200': + description: OAuth callback processed successfully + content: + application/json: + schema: + type: boolean + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + requestBody: + content: + application/json: + schema: + type: object + properties: + method: + description: Auth method index + type: number + code: + description: OAuth authorization code + type: string + required: + - method + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.provider.oauth.callback({ + ... + }) + /find: + get: + operationId: find.text + parameters: + - in: query + name: directory + schema: + type: string + - in: query + name: pattern + schema: + type: string + required: true + summary: Find text + description: Search for text patterns across files in the project using ripgrep. + responses: + '200': + description: Matches + content: + application/json: + schema: + type: array + items: + type: object + properties: + path: + type: object + properties: + text: + type: string + required: + - text + lines: + type: object + properties: + text: + type: string + required: + - text + line_number: + type: number + absolute_offset: + type: number + submatches: + type: array + items: + type: object + properties: + match: + type: object + properties: + text: + type: string + required: + - text + start: + type: number + end: + type: number + required: + - match + - start + - end + required: + - path + - lines + - line_number + - absolute_offset + - submatches + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.find.text({ + ... + }) + /find/file: + get: + operationId: find.files + parameters: + - in: query + name: directory + schema: + type: string + - in: query + name: query + schema: + type: string + required: true + - in: query + name: dirs + schema: + type: string + enum: + - 'true' + - 'false' + - in: query + name: type + schema: + type: string + enum: + - file + - directory + - in: query + name: limit + schema: + type: integer + minimum: 1 + maximum: 200 + summary: Find files + description: + Search for files or directories by name or pattern in the project + directory. + responses: + '200': + description: File paths + content: + application/json: + schema: + type: array + items: + type: string + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.find.files({ + ... + }) + /find/symbol: + get: + operationId: find.symbols + parameters: + - in: query + name: directory + schema: + type: string + - in: query + name: query + schema: + type: string + required: true + summary: Find symbols + description: + Search for workspace symbols like functions, classes, and variables + using LSP. + responses: + '200': + description: Symbols + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Symbol' + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.find.symbols({ + ... + }) + /file: + get: + operationId: file.list + parameters: + - in: query + name: directory + schema: + type: string + - in: query + name: path + schema: + type: string + required: true + summary: List files + description: List files and directories in a specified path. + responses: + '200': + description: Files and directories + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/FileNode' + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.file.list({ + ... + }) + /file/content: + get: + operationId: file.read + parameters: + - in: query + name: directory + schema: + type: string + - in: query + name: path + schema: + type: string + required: true + summary: Read file + description: Read the content of a specified file. + responses: + '200': + description: File content + content: + application/json: + schema: + $ref: '#/components/schemas/FileContent' + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.file.read({ + ... + }) + /file/status: + get: + operationId: file.status + parameters: + - in: query + name: directory + schema: + type: string + summary: Get file status + description: Get the git status of all files in the project. + responses: + '200': + description: File status + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/File' + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.file.status({ + ... + }) + /log: + post: + operationId: app.log + parameters: + - in: query + name: directory + schema: + type: string + summary: Write log + description: Write a log entry to the server logs with specified level and metadata. + responses: + '200': + description: Log entry written successfully + content: + application/json: + schema: + type: boolean + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + requestBody: + content: + application/json: + schema: + type: object + properties: + service: + description: Service name for the log entry + type: string + level: + description: Log level + type: string + enum: + - debug + - info + - error + - warn + message: + description: Log message + type: string + extra: + description: Additional metadata for the log entry + type: object + propertyNames: + type: string + additionalProperties: {} + required: + - service + - level + - message + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.app.log({ + ... + }) + /agent: + get: + operationId: app.agents + parameters: + - in: query + name: directory + schema: + type: string + summary: List agents + description: Get a list of all available AI agents in the OpenCode system. + responses: + '200': + description: List of agents + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Agent' + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.app.agents({ + ... + }) + /mcp: + get: + operationId: mcp.status + parameters: + - in: query + name: directory + schema: + type: string + summary: Get MCP status + description: Get the status of all Model Context Protocol (MCP) servers. + responses: + '200': + description: MCP server status + content: + application/json: + schema: + type: object + propertyNames: + type: string + additionalProperties: + $ref: '#/components/schemas/MCPStatus' + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.mcp.status({ + ... + }) + post: + operationId: mcp.add + parameters: + - in: query + name: directory + schema: + type: string + summary: Add MCP server + description: Dynamically add a new Model Context Protocol (MCP) server to the system. + responses: + '200': + description: MCP server added successfully + content: + application/json: + schema: + type: object + propertyNames: + type: string + additionalProperties: + $ref: '#/components/schemas/MCPStatus' + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + requestBody: + content: + application/json: + schema: + type: object + properties: + name: + type: string + config: + anyOf: + - $ref: '#/components/schemas/McpLocalConfig' + - $ref: '#/components/schemas/McpRemoteConfig' + required: + - name + - config + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.mcp.add({ + ... + }) + /mcp/{name}/auth: + post: + operationId: mcp.auth.start + parameters: + - in: query + name: directory + schema: + type: string + - schema: + type: string + in: path + name: name + required: true + summary: Start MCP OAuth + description: + Start OAuth authentication flow for a Model Context Protocol (MCP) + server. + responses: + '200': + description: OAuth flow started + content: + application/json: + schema: + type: object + properties: + authorizationUrl: + description: URL to open in browser for authorization + type: string + required: + - authorizationUrl + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + '404': + description: Not found + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.mcp.auth.start({ + ... + }) + delete: + operationId: mcp.auth.remove + parameters: + - in: query + name: directory + schema: + type: string + - schema: + type: string + in: path + name: name + required: true + summary: Remove MCP OAuth + description: Remove OAuth credentials for an MCP server + responses: + '200': + description: OAuth credentials removed + content: + application/json: + schema: + type: object + properties: + success: + type: boolean + const: true + required: + - success + '404': + description: Not found + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.mcp.auth.remove({ + ... + }) + /mcp/{name}/auth/callback: + post: + operationId: mcp.auth.callback + parameters: + - in: query + name: directory + schema: + type: string + - schema: + type: string + in: path + name: name + required: true + summary: Complete MCP OAuth + description: + Complete OAuth authentication for a Model Context Protocol (MCP) + server using the authorization code. + responses: + '200': + description: OAuth authentication completed + content: + application/json: + schema: + $ref: '#/components/schemas/MCPStatus' + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + '404': + description: Not found + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + requestBody: + content: + application/json: + schema: + type: object + properties: + code: + description: Authorization code from OAuth callback + type: string + required: + - code + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.mcp.auth.callback({ + ... + }) + /mcp/{name}/auth/authenticate: + post: + operationId: mcp.auth.authenticate + parameters: + - in: query + name: directory + schema: + type: string + - schema: + type: string + in: path + name: name + required: true + summary: Authenticate MCP OAuth + description: Start OAuth flow and wait for callback (opens browser) + responses: + '200': + description: OAuth authentication completed + content: + application/json: + schema: + $ref: '#/components/schemas/MCPStatus' + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + '404': + description: Not found + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.mcp.auth.authenticate({ + ... + }) + /mcp/{name}/connect: + post: + operationId: mcp.connect + parameters: + - in: query + name: directory + schema: + type: string + - in: path + name: name + schema: + type: string + required: true + description: Connect an MCP server + responses: + '200': + description: MCP server connected successfully + content: + application/json: + schema: + type: boolean + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.mcp.connect({ + ... + }) + /mcp/{name}/disconnect: + post: + operationId: mcp.disconnect + parameters: + - in: query + name: directory + schema: + type: string + - in: path + name: name + schema: + type: string + required: true + description: Disconnect an MCP server + responses: + '200': + description: MCP server disconnected successfully + content: + application/json: + schema: + type: boolean + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.mcp.disconnect({ + ... + }) + /lsp: + get: + operationId: lsp.status + parameters: + - in: query + name: directory + schema: + type: string + summary: Get LSP status + description: Get LSP server status + responses: + '200': + description: LSP server status + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/LSPStatus' + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.lsp.status({ + ... + }) + /formatter: + get: + operationId: formatter.status + parameters: + - in: query + name: directory + schema: + type: string + summary: Get formatter status + description: Get formatter status + responses: + '200': + description: Formatter status + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/FormatterStatus' + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.formatter.status({ + ... + }) + /tui/append-prompt: + post: + operationId: tui.appendPrompt + parameters: + - in: query + name: directory + schema: + type: string + summary: Append TUI prompt + description: Append prompt to the TUI + responses: + '200': + description: Prompt processed successfully + content: + application/json: + schema: + type: boolean + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + requestBody: + content: + application/json: + schema: + type: object + properties: + text: + type: string + required: + - text + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.tui.appendPrompt({ + ... + }) + /tui/open-help: + post: + operationId: tui.openHelp + parameters: + - in: query + name: directory + schema: + type: string + summary: Open help dialog + description: Open the help dialog in the TUI to display user assistance information. + responses: + '200': + description: Help dialog opened successfully + content: + application/json: + schema: + type: boolean + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.tui.openHelp({ + ... + }) + /tui/open-sessions: + post: + operationId: tui.openSessions + parameters: + - in: query + name: directory + schema: + type: string + summary: Open sessions dialog + description: Open the session dialog + responses: + '200': + description: Session dialog opened successfully + content: + application/json: + schema: + type: boolean + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.tui.openSessions({ + ... + }) + /tui/open-themes: + post: + operationId: tui.openThemes + parameters: + - in: query + name: directory + schema: + type: string + summary: Open themes dialog + description: Open the theme dialog + responses: + '200': + description: Theme dialog opened successfully + content: + application/json: + schema: + type: boolean + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.tui.openThemes({ + ... + }) + /tui/open-models: + post: + operationId: tui.openModels + parameters: + - in: query + name: directory + schema: + type: string + summary: Open models dialog + description: Open the model dialog + responses: + '200': + description: Model dialog opened successfully + content: + application/json: + schema: + type: boolean + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.tui.openModels({ + ... + }) + /tui/submit-prompt: + post: + operationId: tui.submitPrompt + parameters: + - in: query + name: directory + schema: + type: string + summary: Submit TUI prompt + description: Submit the prompt + responses: + '200': + description: Prompt submitted successfully + content: + application/json: + schema: + type: boolean + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.tui.submitPrompt({ + ... + }) + /tui/clear-prompt: + post: + operationId: tui.clearPrompt + parameters: + - in: query + name: directory + schema: + type: string + summary: Clear TUI prompt + description: Clear the prompt + responses: + '200': + description: Prompt cleared successfully + content: + application/json: + schema: + type: boolean + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.tui.clearPrompt({ + ... + }) + /tui/execute-command: + post: + operationId: tui.executeCommand + parameters: + - in: query + name: directory + schema: + type: string + summary: Execute TUI command + description: Execute a TUI command (e.g. agent_cycle) + responses: + '200': + description: Command executed successfully + content: + application/json: + schema: + type: boolean + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + requestBody: + content: + application/json: + schema: + type: object + properties: + command: + type: string + required: + - command + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.tui.executeCommand({ + ... + }) + /tui/show-toast: + post: + operationId: tui.showToast + parameters: + - in: query + name: directory + schema: + type: string + summary: Show TUI toast + description: Show a toast notification in the TUI + responses: + '200': + description: Toast notification shown successfully + content: + application/json: + schema: + type: boolean + requestBody: + content: + application/json: + schema: + type: object + properties: + title: + type: string + message: + type: string + variant: + type: string + enum: + - info + - success + - warning + - error + duration: + description: Duration in milliseconds + default: 5000 + type: number + required: + - message + - variant + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.tui.showToast({ + ... + }) + /tui/publish: + post: + operationId: tui.publish + parameters: + - in: query + name: directory + schema: + type: string + summary: Publish TUI event + description: Publish a TUI event + responses: + '200': + description: Event published successfully + content: + application/json: + schema: + type: boolean + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + requestBody: + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/Event.tui.prompt.append' + - $ref: '#/components/schemas/Event.tui.command.execute' + - $ref: '#/components/schemas/Event.tui.toast.show' + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.tui.publish({ + ... + }) + /tui/control/next: + get: + operationId: tui.control.next + parameters: + - in: query + name: directory + schema: + type: string + summary: Get next TUI request + description: + Retrieve the next TUI (Terminal User Interface) request from the + queue for processing. + responses: + '200': + description: Next TUI request + content: + application/json: + schema: + type: object + properties: + path: + type: string + body: {} + required: + - path + - body + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.tui.control.next({ + ... + }) + /tui/control/response: + post: + operationId: tui.control.response + parameters: + - in: query + name: directory + schema: + type: string + summary: Submit TUI response + description: Submit a response to the TUI request queue to complete a pending request. + responses: + '200': + description: Response submitted successfully + content: + application/json: + schema: + type: boolean + requestBody: + content: + application/json: + schema: {} + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.tui.control.response({ + ... + }) + /auth/{providerID}: + put: + operationId: auth.set + parameters: + - in: query + name: directory + schema: + type: string + - in: path + name: providerID + schema: + type: string + required: true + summary: Set auth credentials + description: Set authentication credentials + responses: + '200': + description: Successfully set authentication credentials + content: + application/json: + schema: + type: boolean + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Auth' + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.auth.set({ + ... + }) + /event: + get: + operationId: event.subscribe + parameters: + - in: query + name: directory + schema: + type: string + summary: Subscribe to events + description: Get events + responses: + '200': + description: Event stream + content: + text/event-stream: + schema: + $ref: '#/components/schemas/Event' + x-codeSamples: + - lang: js + source: |- + import { createOpencodeClient } from "@opencode-ai/sdk + + const client = createOpencodeClient() + await client.event.subscribe({ + ... + }) +components: + schemas: + Event.installation.updated: + type: object + properties: + type: + type: string + const: installation.updated + properties: + type: object + properties: + version: + type: string + required: + - version + required: + - type + - properties + Event.installation.update-available: + type: object + properties: + type: + type: string + const: installation.update-available + properties: + type: object + properties: + version: + type: string + required: + - version + required: + - type + - properties + Project: + type: object + properties: + id: + type: string + worktree: + type: string + vcs: + type: string + const: git + name: + type: string + icon: + type: object + properties: + url: + type: string + color: + type: string + time: + type: object + properties: + created: + type: number + updated: + type: number + initialized: + type: number + required: + - created + - updated + required: + - id + - worktree + - time + Event.project.updated: + type: object + properties: + type: + type: string + const: project.updated + properties: + $ref: '#/components/schemas/Project' + required: + - type + - properties + Event.server.instance.disposed: + type: object + properties: + type: + type: string + const: server.instance.disposed + properties: + type: object + properties: + directory: + type: string + required: + - directory + required: + - type + - properties + Event.lsp.client.diagnostics: + type: object + properties: + type: + type: string + const: lsp.client.diagnostics + properties: + type: object + properties: + serverID: + type: string + path: + type: string + required: + - serverID + - path + required: + - type + - properties + Event.lsp.updated: + type: object + properties: + type: + type: string + const: lsp.updated + properties: + type: object + properties: {} + required: + - type + - properties + FileDiff: + type: object + properties: + file: + type: string + before: + type: string + after: + type: string + additions: + type: number + deletions: + type: number + required: + - file + - before + - after + - additions + - deletions + UserMessage: + type: object + properties: + id: + type: string + sessionID: + type: string + role: + type: string + const: user + time: + type: object + properties: + created: + type: number + required: + - created + summary: + type: object + properties: + title: + type: string + body: + type: string + diffs: + type: array + items: + $ref: '#/components/schemas/FileDiff' + required: + - diffs + agent: + type: string + model: + type: object + properties: + providerID: + type: string + modelID: + type: string + required: + - providerID + - modelID + system: + type: string + tools: + type: object + propertyNames: + type: string + additionalProperties: + type: boolean + variant: + type: string + required: + - id + - sessionID + - role + - time + - agent + - model + ProviderAuthError: + type: object + properties: + name: + type: string + const: ProviderAuthError + data: + type: object + properties: + providerID: + type: string + message: + type: string + required: + - providerID + - message + required: + - name + - data + UnknownError: + type: object + properties: + name: + type: string + const: UnknownError + data: + type: object + properties: + message: + type: string + required: + - message + required: + - name + - data + MessageOutputLengthError: + type: object + properties: + name: + type: string + const: MessageOutputLengthError + data: + type: object + properties: {} + required: + - name + - data + MessageAbortedError: + type: object + properties: + name: + type: string + const: MessageAbortedError + data: + type: object + properties: + message: + type: string + required: + - message + required: + - name + - data + APIError: + type: object + properties: + name: + type: string + const: APIError + data: + type: object + properties: + message: + type: string + statusCode: + type: number + isRetryable: + type: boolean + responseHeaders: + type: object + propertyNames: + type: string + additionalProperties: + type: string + responseBody: + type: string + metadata: + type: object + propertyNames: + type: string + additionalProperties: + type: string + required: + - message + - isRetryable + required: + - name + - data + AssistantMessage: + type: object + properties: + id: + type: string + sessionID: + type: string + role: + type: string + const: assistant + time: + type: object + properties: + created: + type: number + completed: + type: number + required: + - created + error: + anyOf: + - $ref: '#/components/schemas/ProviderAuthError' + - $ref: '#/components/schemas/UnknownError' + - $ref: '#/components/schemas/MessageOutputLengthError' + - $ref: '#/components/schemas/MessageAbortedError' + - $ref: '#/components/schemas/APIError' + parentID: + type: string + modelID: + type: string + providerID: + type: string + mode: + type: string + agent: + type: string + path: + type: object + properties: + cwd: + type: string + root: + type: string + required: + - cwd + - root + summary: + type: boolean + cost: + type: number + tokens: + type: object + properties: + input: + type: number + output: + type: number + reasoning: + type: number + cache: + type: object + properties: + read: + type: number + write: + type: number + required: + - read + - write + required: + - input + - output + - reasoning + - cache + finish: + type: string + required: + - id + - sessionID + - role + - time + - parentID + - modelID + - providerID + - mode + - agent + - path + - cost + - tokens + Message: + anyOf: + - $ref: '#/components/schemas/UserMessage' + - $ref: '#/components/schemas/AssistantMessage' + Event.message.updated: + type: object + properties: + type: + type: string + const: message.updated + properties: + type: object + properties: + info: + $ref: '#/components/schemas/Message' + required: + - info + required: + - type + - properties + Event.message.removed: + type: object + properties: + type: + type: string + const: message.removed + properties: + type: object + properties: + sessionID: + type: string + messageID: + type: string + required: + - sessionID + - messageID + required: + - type + - properties + TextPart: + type: object + properties: + id: + type: string + sessionID: + type: string + messageID: + type: string + type: + type: string + const: text + text: + type: string + synthetic: + type: boolean + ignored: + type: boolean + time: + type: object + properties: + start: + type: number + end: + type: number + required: + - start + metadata: + type: object + propertyNames: + type: string + additionalProperties: {} + required: + - id + - sessionID + - messageID + - type + - text + ReasoningPart: + type: object + properties: + id: + type: string + sessionID: + type: string + messageID: + type: string + type: + type: string + const: reasoning + text: + type: string + metadata: + type: object + propertyNames: + type: string + additionalProperties: {} + time: + type: object + properties: + start: + type: number + end: + type: number + required: + - start + required: + - id + - sessionID + - messageID + - type + - text + - time + FilePartSourceText: + type: object + properties: + value: + type: string + start: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + end: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + required: + - value + - start + - end + FileSource: + type: object + properties: + text: + $ref: '#/components/schemas/FilePartSourceText' + type: + type: string + const: file + path: + type: string + required: + - text + - type + - path + Range: + type: object + properties: + start: + type: object + properties: + line: + type: number + character: + type: number + required: + - line + - character + end: + type: object + properties: + line: + type: number + character: + type: number + required: + - line + - character + required: + - start + - end + SymbolSource: + type: object + properties: + text: + $ref: '#/components/schemas/FilePartSourceText' + type: + type: string + const: symbol + path: + type: string + range: + $ref: '#/components/schemas/Range' + name: + type: string + kind: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + required: + - text + - type + - path + - range + - name + - kind + FilePartSource: + anyOf: + - $ref: '#/components/schemas/FileSource' + - $ref: '#/components/schemas/SymbolSource' + FilePart: + type: object + properties: + id: + type: string + sessionID: + type: string + messageID: + type: string + type: + type: string + const: file + mime: + type: string + filename: + type: string + url: + type: string + source: + $ref: '#/components/schemas/FilePartSource' + required: + - id + - sessionID + - messageID + - type + - mime + - url + ToolStatePending: + type: object + properties: + status: + type: string + const: pending + input: + type: object + propertyNames: + type: string + additionalProperties: {} + raw: + type: string + required: + - status + - input + - raw + ToolStateRunning: + type: object + properties: + status: + type: string + const: running + input: + type: object + propertyNames: + type: string + additionalProperties: {} + title: + type: string + metadata: + type: object + propertyNames: + type: string + additionalProperties: {} + time: + type: object + properties: + start: + type: number + required: + - start + required: + - status + - input + - time + ToolStateCompleted: + type: object + properties: + status: + type: string + const: completed + input: + type: object + propertyNames: + type: string + additionalProperties: {} + output: + type: string + title: + type: string + metadata: + type: object + propertyNames: + type: string + additionalProperties: {} + time: + type: object + properties: + start: + type: number + end: + type: number + compacted: + type: number + required: + - start + - end + attachments: + type: array + items: + $ref: '#/components/schemas/FilePart' + required: + - status + - input + - output + - title + - metadata + - time + ToolStateError: + type: object + properties: + status: + type: string + const: error + input: + type: object + propertyNames: + type: string + additionalProperties: {} + error: + type: string + metadata: + type: object + propertyNames: + type: string + additionalProperties: {} + time: + type: object + properties: + start: + type: number + end: + type: number + required: + - start + - end + required: + - status + - input + - error + - time + ToolState: + anyOf: + - $ref: '#/components/schemas/ToolStatePending' + - $ref: '#/components/schemas/ToolStateRunning' + - $ref: '#/components/schemas/ToolStateCompleted' + - $ref: '#/components/schemas/ToolStateError' + ToolPart: + type: object + properties: + id: + type: string + sessionID: + type: string + messageID: + type: string + type: + type: string + const: tool + callID: + type: string + tool: + type: string + state: + $ref: '#/components/schemas/ToolState' + metadata: + type: object + propertyNames: + type: string + additionalProperties: {} + required: + - id + - sessionID + - messageID + - type + - callID + - tool + - state + StepStartPart: + type: object + properties: + id: + type: string + sessionID: + type: string + messageID: + type: string + type: + type: string + const: step-start + snapshot: + type: string + required: + - id + - sessionID + - messageID + - type + StepFinishPart: + type: object + properties: + id: + type: string + sessionID: + type: string + messageID: + type: string + type: + type: string + const: step-finish + reason: + type: string + snapshot: + type: string + cost: + type: number + tokens: + type: object + properties: + input: + type: number + output: + type: number + reasoning: + type: number + cache: + type: object + properties: + read: + type: number + write: + type: number + required: + - read + - write + required: + - input + - output + - reasoning + - cache + required: + - id + - sessionID + - messageID + - type + - reason + - cost + - tokens + SnapshotPart: + type: object + properties: + id: + type: string + sessionID: + type: string + messageID: + type: string + type: + type: string + const: snapshot + snapshot: + type: string + required: + - id + - sessionID + - messageID + - type + - snapshot + PatchPart: + type: object + properties: + id: + type: string + sessionID: + type: string + messageID: + type: string + type: + type: string + const: patch + hash: + type: string + files: + type: array + items: + type: string + required: + - id + - sessionID + - messageID + - type + - hash + - files + AgentPart: + type: object + properties: + id: + type: string + sessionID: + type: string + messageID: + type: string + type: + type: string + const: agent + name: + type: string + source: + type: object + properties: + value: + type: string + start: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + end: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + required: + - value + - start + - end + required: + - id + - sessionID + - messageID + - type + - name + RetryPart: + type: object + properties: + id: + type: string + sessionID: + type: string + messageID: + type: string + type: + type: string + const: retry + attempt: + type: number + error: + $ref: '#/components/schemas/APIError' + time: + type: object + properties: + created: + type: number + required: + - created + required: + - id + - sessionID + - messageID + - type + - attempt + - error + - time + CompactionPart: + type: object + properties: + id: + type: string + sessionID: + type: string + messageID: + type: string + type: + type: string + const: compaction + auto: + type: boolean + required: + - id + - sessionID + - messageID + - type + - auto + Part: + anyOf: + - $ref: '#/components/schemas/TextPart' + - type: object + properties: + id: + type: string + sessionID: + type: string + messageID: + type: string + type: + type: string + const: subtask + prompt: + type: string + description: + type: string + agent: + type: string + command: + type: string + required: + - id + - sessionID + - messageID + - type + - prompt + - description + - agent + - $ref: '#/components/schemas/ReasoningPart' + - $ref: '#/components/schemas/FilePart' + - $ref: '#/components/schemas/ToolPart' + - $ref: '#/components/schemas/StepStartPart' + - $ref: '#/components/schemas/StepFinishPart' + - $ref: '#/components/schemas/SnapshotPart' + - $ref: '#/components/schemas/PatchPart' + - $ref: '#/components/schemas/AgentPart' + - $ref: '#/components/schemas/RetryPart' + - $ref: '#/components/schemas/CompactionPart' + Event.message.part.updated: + type: object + properties: + type: + type: string + const: message.part.updated + properties: + type: object + properties: + part: + $ref: '#/components/schemas/Part' + delta: + type: string + required: + - part + required: + - type + - properties + Event.message.part.removed: + type: object + properties: + type: + type: string + const: message.part.removed properties: type: object properties: - version: + sessionID: + type: string + messageID: + type: string + partID: + type: string + required: + - sessionID + - messageID + - partID + required: + - type + - properties + PermissionRequest: + type: object + properties: + id: + type: string + pattern: ^per.* + sessionID: + type: string + pattern: ^ses.* + permission: + type: string + patterns: + type: array + items: + type: string + metadata: + type: object + propertyNames: + type: string + additionalProperties: {} + always: + type: array + items: + type: string + tool: + type: object + properties: + messageID: + type: string + callID: type: string required: - - version + - messageID + - callID + required: + - id + - sessionID + - permission + - patterns + - metadata + - always + Event.permission.asked: + type: object + properties: + type: + type: string + const: permission.asked + properties: + $ref: '#/components/schemas/PermissionRequest' required: - type - properties - Event.lsp.client.diagnostics: + Event.permission.replied: type: object properties: type: type: string - const: lsp.client.diagnostics + const: permission.replied properties: type: object properties: - serverID: + sessionID: type: string - path: + requestID: + type: string + reply: type: string + enum: + - once + - always + - reject required: - - serverID - - path + - sessionID + - requestID + - reply required: - type - properties - Event.message.updated: + SessionStatus: + anyOf: + - type: object + properties: + type: + type: string + const: idle + required: + - type + - type: object + properties: + type: + type: string + const: retry + attempt: + type: number + message: + type: string + next: + type: number + required: + - type + - attempt + - message + - next + - type: object + properties: + type: + type: string + const: busy + required: + - type + Event.session.status: type: object properties: type: type: string - const: message.updated + const: session.status properties: type: object properties: - info: - $ref: '#/components/schemas/Message' + sessionID: + type: string + status: + $ref: '#/components/schemas/SessionStatus' required: - - info + - sessionID + - status required: - type - properties - Message: - oneOf: - - $ref: '#/components/schemas/UserMessage' - - $ref: '#/components/schemas/AssistantMessage' - discriminator: - propertyName: role - mapping: - user: '#/components/schemas/UserMessage' - assistant: '#/components/schemas/AssistantMessage' - UserMessage: + Event.session.idle: type: object properties: - id: + type: type: string - sessionID: + const: session.idle + properties: + type: object + properties: + sessionID: + type: string + required: + - sessionID + required: + - type + - properties + Event.session.compacted: + type: object + properties: + type: type: string - role: + const: session.compacted + properties: + type: object + properties: + sessionID: + type: string + required: + - sessionID + required: + - type + - properties + Event.file.edited: + type: object + properties: + type: type: string - const: user - time: + const: file.edited + properties: type: object properties: - created: - type: number + file: + type: string required: - - created + - file required: - - id - - sessionID - - role - - time - AssistantMessage: + - type + - properties + Todo: type: object properties: + content: + description: Brief description of the task + type: string + status: + description: + 'Current status of the task: pending, in_progress, completed, + cancelled' + type: string + priority: + description: 'Priority level of the task: high, medium, low' + type: string id: + description: Unique identifier for the todo item type: string - sessionID: + required: + - content + - status + - priority + - id + Event.todo.updated: + type: object + properties: + type: type: string - role: + const: todo.updated + properties: + type: object + properties: + sessionID: + type: string + todos: + type: array + items: + $ref: '#/components/schemas/Todo' + required: + - sessionID + - todos + required: + - type + - properties + Event.tui.prompt.append: + type: object + properties: + type: type: string - const: assistant - time: + const: tui.prompt.append + properties: type: object properties: - created: - type: number - completed: + text: + type: string + required: + - text + required: + - type + - properties + Event.tui.command.execute: + type: object + properties: + type: + type: string + const: tui.command.execute + properties: + type: object + properties: + command: + anyOf: + - type: string + enum: + - session.list + - session.new + - session.share + - session.interrupt + - session.compact + - session.page.up + - session.page.down + - session.half.page.up + - session.half.page.down + - session.first + - session.last + - prompt.clear + - prompt.submit + - agent.cycle + - type: string + required: + - command + required: + - type + - properties + Event.tui.toast.show: + type: object + properties: + type: + type: string + const: tui.toast.show + properties: + type: object + properties: + title: + type: string + message: + type: string + variant: + type: string + enum: + - info + - success + - warning + - error + duration: + description: Duration in milliseconds + default: 5000 type: number required: - - created - error: - oneOf: - - $ref: '#/components/schemas/ProviderAuthError' - - $ref: '#/components/schemas/UnknownError' - - $ref: '#/components/schemas/MessageOutputLengthError' - - $ref: '#/components/schemas/MessageAbortedError' - discriminator: - propertyName: name - mapping: - ProviderAuthError: '#/components/schemas/ProviderAuthError' - UnknownError: '#/components/schemas/UnknownError' - MessageOutputLengthError: '#/components/schemas/MessageOutputLengthError' - MessageAbortedError: '#/components/schemas/MessageAbortedError' - system: - type: array - items: - type: string - modelID: + - message + - variant + required: + - type + - properties + Event.mcp.tools.changed: + type: object + properties: + type: type: string - providerID: + const: mcp.tools.changed + properties: + type: object + properties: + server: + type: string + required: + - server + required: + - type + - properties + Event.command.executed: + type: object + properties: + type: type: string - mode: + const: command.executed + properties: + type: object + properties: + name: + type: string + sessionID: + type: string + pattern: ^ses.* + arguments: + type: string + messageID: + type: string + pattern: ^msg.* + required: + - name + - sessionID + - arguments + - messageID + required: + - type + - properties + PermissionAction: + type: string + enum: + - allow + - deny + - ask + PermissionRule: + type: object + properties: + permission: type: string - path: + pattern: + type: string + action: + $ref: '#/components/schemas/PermissionAction' + required: + - permission + - pattern + - action + PermissionRuleset: + type: array + items: + $ref: '#/components/schemas/PermissionRule' + Session: + type: object + properties: + id: + type: string + pattern: ^ses.* + projectID: + type: string + directory: + type: string + parentID: + type: string + pattern: ^ses.* + summary: type: object properties: - cwd: - type: string - root: + additions: + type: number + deletions: + type: number + files: + type: number + diffs: + type: array + items: + $ref: '#/components/schemas/FileDiff' + required: + - additions + - deletions + - files + share: + type: object + properties: + url: type: string required: - - cwd - - root - summary: - type: boolean - cost: - type: number - tokens: + - url + title: + type: string + version: + type: string + time: type: object properties: - input: + created: type: number - output: + updated: type: number - reasoning: + compacting: + type: number + archived: type: number - cache: - type: object - properties: - read: - type: number - write: - type: number - required: - - read - - write required: - - input - - output - - reasoning - - cache + - created + - updated + permission: + $ref: '#/components/schemas/PermissionRuleset' + revert: + type: object + properties: + messageID: + type: string + partID: + type: string + snapshot: + type: string + diff: + type: string + required: + - messageID required: - id - - sessionID - - role + - projectID + - directory + - title + - version - time - - system - - modelID - - providerID - - mode - - path - - cost - - tokens - ProviderAuthError: + Event.session.created: type: object properties: - name: + type: type: string - const: ProviderAuthError - data: + const: session.created + properties: type: object properties: - providerID: - type: string - message: - type: string + info: + $ref: '#/components/schemas/Session' required: - - providerID - - message + - info required: - - name - - data - UnknownError: + - type + - properties + Event.session.updated: type: object properties: - name: + type: type: string - const: UnknownError - data: + const: session.updated + properties: type: object properties: - message: - type: string + info: + $ref: '#/components/schemas/Session' required: - - message + - info required: - - name - - data - MessageOutputLengthError: + - type + - properties + Event.session.deleted: type: object properties: - name: + type: type: string - const: MessageOutputLengthError - data: + const: session.deleted + properties: type: object + properties: + info: + $ref: '#/components/schemas/Session' + required: + - info required: - - name - - data - MessageAbortedError: + - type + - properties + Event.session.diff: type: object properties: - name: + type: type: string - const: MessageAbortedError - data: + const: session.diff + properties: type: object + properties: + sessionID: + type: string + diff: + type: array + items: + $ref: '#/components/schemas/FileDiff' + required: + - sessionID + - diff required: - - name - - data - Event.message.removed: + - type + - properties + Event.session.error: type: object properties: type: type: string - const: message.removed + const: session.error properties: type: object properties: sessionID: type: string - messageID: + error: + anyOf: + - $ref: '#/components/schemas/ProviderAuthError' + - $ref: '#/components/schemas/UnknownError' + - $ref: '#/components/schemas/MessageOutputLengthError' + - $ref: '#/components/schemas/MessageAbortedError' + - $ref: '#/components/schemas/APIError' + required: + - type + - properties + Event.file.watcher.updated: + type: object + properties: + type: + type: string + const: file.watcher.updated + properties: + type: object + properties: + file: type: string + event: + anyOf: + - type: string + const: add + - type: string + const: change + - type: string + const: unlink required: - - sessionID - - messageID + - file + - event required: - type - properties - Event.message.part.updated: + Event.vcs.branch.updated: type: object properties: type: type: string - const: message.part.updated + const: vcs.branch.updated properties: type: object properties: - part: - $ref: '#/components/schemas/Part' - required: - - part + branch: + type: string required: - type - properties - Part: - oneOf: - - $ref: '#/components/schemas/TextPart' - - $ref: '#/components/schemas/ReasoningPart' - - $ref: '#/components/schemas/FilePart' - - $ref: '#/components/schemas/ToolPart' - - $ref: '#/components/schemas/StepStartPart' - - $ref: '#/components/schemas/StepFinishPart' - - $ref: '#/components/schemas/SnapshotPart' - - $ref: '#/components/schemas/PatchPart' - - $ref: '#/components/schemas/AgentPart' - discriminator: - propertyName: type - mapping: - text: '#/components/schemas/TextPart' - reasoning: '#/components/schemas/ReasoningPart' - file: '#/components/schemas/FilePart' - tool: '#/components/schemas/ToolPart' - step-start: '#/components/schemas/StepStartPart' - step-finish: '#/components/schemas/StepFinishPart' - snapshot: '#/components/schemas/SnapshotPart' - patch: '#/components/schemas/PatchPart' - agent: '#/components/schemas/AgentPart' - TextPart: + Pty: type: object properties: id: type: string - sessionID: + pattern: ^pty.* + title: type: string - messageID: + command: type: string - type: + args: + type: array + items: + type: string + cwd: type: string - const: text - text: + status: type: string - synthetic: - type: boolean - time: + enum: + - running + - exited + pid: + type: number + required: + - id + - title + - command + - args + - cwd + - status + - pid + Event.pty.created: + type: object + properties: + type: + type: string + const: pty.created + properties: type: object properties: - start: - type: number - end: - type: number + info: + $ref: '#/components/schemas/Pty' required: - - start + - info required: - - id - - sessionID - - messageID - type - - text - ReasoningPart: + - properties + Event.pty.updated: type: object properties: - id: - type: string - sessionID: - type: string - messageID: - type: string type: type: string - const: reasoning - text: - type: string - metadata: + const: pty.updated + properties: type: object - additionalProperties: {} - time: + properties: + info: + $ref: '#/components/schemas/Pty' + required: + - info + required: + - type + - properties + Event.pty.exited: + type: object + properties: + type: + type: string + const: pty.exited + properties: type: object properties: - start: - type: number - end: + id: + type: string + pattern: ^pty.* + exitCode: type: number required: - - start + - id + - exitCode required: - - id - - sessionID - - messageID - type - - text - - time - FilePart: + - properties + Event.pty.deleted: type: object properties: - id: - type: string - sessionID: - type: string - messageID: - type: string type: type: string - const: file - mime: - type: string - filename: - type: string - url: - type: string - source: - $ref: '#/components/schemas/FilePartSource' + const: pty.deleted + properties: + type: object + properties: + id: + type: string + pattern: ^pty.* + required: + - id required: - - id - - sessionID - - messageID - type - - mime - - url - FilePartSource: - oneOf: - - $ref: '#/components/schemas/FileSource' - - $ref: '#/components/schemas/SymbolSource' - discriminator: - propertyName: type - mapping: - file: '#/components/schemas/FileSource' - symbol: '#/components/schemas/SymbolSource' - FileSource: + - properties + Event.server.connected: type: object properties: - text: - $ref: '#/components/schemas/FilePartSourceText' type: type: string - const: file - path: - type: string + const: server.connected + properties: + type: object + properties: {} required: - - text - type - - path - FilePartSourceText: + - properties + Event.global.disposed: type: object properties: - value: + type: type: string - start: - type: integer - end: - type: integer + const: global.disposed + properties: + type: object + properties: {} required: - - value - - start - - end - SymbolSource: + - type + - properties + Event: + anyOf: + - $ref: '#/components/schemas/Event.installation.updated' + - $ref: '#/components/schemas/Event.installation.update-available' + - $ref: '#/components/schemas/Event.project.updated' + - $ref: '#/components/schemas/Event.server.instance.disposed' + - $ref: '#/components/schemas/Event.lsp.client.diagnostics' + - $ref: '#/components/schemas/Event.lsp.updated' + - $ref: '#/components/schemas/Event.message.updated' + - $ref: '#/components/schemas/Event.message.removed' + - $ref: '#/components/schemas/Event.message.part.updated' + - $ref: '#/components/schemas/Event.message.part.removed' + - $ref: '#/components/schemas/Event.permission.asked' + - $ref: '#/components/schemas/Event.permission.replied' + - $ref: '#/components/schemas/Event.session.status' + - $ref: '#/components/schemas/Event.session.idle' + - $ref: '#/components/schemas/Event.session.compacted' + - $ref: '#/components/schemas/Event.file.edited' + - $ref: '#/components/schemas/Event.todo.updated' + - $ref: '#/components/schemas/Event.tui.prompt.append' + - $ref: '#/components/schemas/Event.tui.command.execute' + - $ref: '#/components/schemas/Event.tui.toast.show' + - $ref: '#/components/schemas/Event.mcp.tools.changed' + - $ref: '#/components/schemas/Event.command.executed' + - $ref: '#/components/schemas/Event.session.created' + - $ref: '#/components/schemas/Event.session.updated' + - $ref: '#/components/schemas/Event.session.deleted' + - $ref: '#/components/schemas/Event.session.diff' + - $ref: '#/components/schemas/Event.session.error' + - $ref: '#/components/schemas/Event.file.watcher.updated' + - $ref: '#/components/schemas/Event.vcs.branch.updated' + - $ref: '#/components/schemas/Event.pty.created' + - $ref: '#/components/schemas/Event.pty.updated' + - $ref: '#/components/schemas/Event.pty.exited' + - $ref: '#/components/schemas/Event.pty.deleted' + - $ref: '#/components/schemas/Event.server.connected' + - $ref: '#/components/schemas/Event.global.disposed' + GlobalEvent: type: object properties: - text: - $ref: '#/components/schemas/FilePartSourceText' - type: + directory: type: string - const: symbol - path: - type: string - range: - $ref: '#/components/schemas/Range' - name: - type: string - kind: - type: integer + payload: + $ref: '#/components/schemas/Event' required: - - text - - type - - path - - range - - name - - kind - Range: + - directory + - payload + BadRequestError: type: object properties: - start: - type: object - properties: - line: - type: number - character: - type: number - required: - - line - - character - end: + data: {} + errors: + type: array + items: + type: object + propertyNames: + type: string + additionalProperties: {} + success: + type: boolean + const: false + required: + - data + - errors + - success + NotFoundError: + type: object + properties: + name: + type: string + const: NotFoundError + data: type: object properties: - line: - type: number - character: - type: number + message: + type: string required: - - line - - character + - message required: - - start - - end - ToolPart: + - name + - data + KeybindsConfig: + description: Custom keybind configurations type: object properties: - id: + leader: + description: Leader key for keybind combinations + default: ctrl+x type: string - sessionID: + app_exit: + description: Exit the application + default: ctrl+c,ctrl+d,q type: string - messageID: + editor_open: + description: Open external editor + default: e type: string - type: + theme_list: + description: List available themes + default: t type: string - const: tool - callID: + sidebar_toggle: + description: Toggle sidebar + default: b type: string - tool: + scrollbar_toggle: + description: Toggle session scrollbar + default: none type: string - state: - $ref: '#/components/schemas/ToolState' - required: - - id - - sessionID - - messageID - - type - - callID - - tool - - state - ToolState: - oneOf: - - $ref: '#/components/schemas/ToolStatePending' - - $ref: '#/components/schemas/ToolStateRunning' - - $ref: '#/components/schemas/ToolStateCompleted' - - $ref: '#/components/schemas/ToolStateError' - discriminator: - propertyName: status - mapping: - pending: '#/components/schemas/ToolStatePending' - running: '#/components/schemas/ToolStateRunning' - completed: '#/components/schemas/ToolStateCompleted' - error: '#/components/schemas/ToolStateError' - ToolStatePending: - type: object - properties: - status: + username_toggle: + description: Toggle username visibility + default: none + type: string + status_view: + description: View status + default: s + type: string + session_export: + description: Export session to editor + default: x + type: string + session_new: + description: Create a new session + default: n + type: string + session_list: + description: List all sessions + default: l + type: string + session_timeline: + description: Show session timeline + default: g + type: string + session_fork: + description: Fork session from message + default: none + type: string + session_rename: + description: Rename session + default: none + type: string + session_share: + description: Share current session + default: none + type: string + session_unshare: + description: Unshare current session + default: none + type: string + session_interrupt: + description: Interrupt current session + default: escape + type: string + session_compact: + description: Compact the session + default: c + type: string + messages_page_up: + description: Scroll messages up by one page + default: pageup + type: string + messages_page_down: + description: Scroll messages down by one page + default: pagedown + type: string + messages_half_page_up: + description: Scroll messages up by half page + default: ctrl+alt+u + type: string + messages_half_page_down: + description: Scroll messages down by half page + default: ctrl+alt+d + type: string + messages_first: + description: Navigate to first message + default: ctrl+g,home + type: string + messages_last: + description: Navigate to last message + default: ctrl+alt+g,end + type: string + messages_next: + description: Navigate to next message + default: none + type: string + messages_previous: + description: Navigate to previous message + default: none + type: string + messages_last_user: + description: Navigate to last user message + default: none + type: string + messages_copy: + description: Copy message + default: y + type: string + messages_undo: + description: Undo message + default: u + type: string + messages_redo: + description: Redo message + default: r type: string - const: pending - required: - - status - ToolStateRunning: - type: object - properties: - status: + messages_toggle_conceal: + description: Toggle code block concealment in messages + default: h type: string - const: running - input: {} - title: + tool_details: + description: Toggle tool details visibility + default: none type: string - metadata: - type: object - additionalProperties: {} - time: - type: object - properties: - start: - type: number - required: - - start - required: - - status - - time - ToolStateCompleted: - type: object - properties: - status: + model_list: + description: List available models + default: m type: string - const: completed - input: - type: object - additionalProperties: {} - output: + model_cycle_recent: + description: Next recently used model + default: f2 type: string - title: + model_cycle_recent_reverse: + description: Previous recently used model + default: shift+f2 type: string - metadata: - type: object - additionalProperties: {} - time: - type: object - properties: - start: - type: number - end: - type: number - required: - - start - - end - required: - - status - - input - - output - - title - - metadata - - time - ToolStateError: - type: object - properties: - status: + model_cycle_favorite: + description: Next favorite model + default: none type: string - const: error - input: - type: object - additionalProperties: {} - error: + model_cycle_favorite_reverse: + description: Previous favorite model + default: none type: string - metadata: - type: object - additionalProperties: {} - time: - type: object - properties: - start: - type: number - end: - type: number - required: - - start - - end - required: - - status - - input - - error - - time - StepStartPart: - type: object - properties: - id: + command_list: + description: List available commands + default: ctrl+p type: string - sessionID: + agent_list: + description: List agents + default: a type: string - messageID: + agent_cycle: + description: Next agent + default: tab type: string - type: + agent_cycle_reverse: + description: Previous agent + default: shift+tab type: string - const: step-start - required: - - id - - sessionID - - messageID - - type - StepFinishPart: - type: object - properties: - id: + variant_cycle: + description: Cycle model variants + default: ctrl+t type: string - sessionID: + input_clear: + description: Clear input field + default: ctrl+c type: string - messageID: + input_paste: + description: Paste from clipboard + default: ctrl+v type: string - type: + input_submit: + description: Submit input + default: return type: string - const: step-finish - cost: - type: number - tokens: - type: object - properties: - input: - type: number - output: - type: number - reasoning: - type: number - cache: - type: object - properties: - read: - type: number - write: - type: number - required: - - read - - write - required: - - input - - output - - reasoning - - cache - required: - - id - - sessionID - - messageID - - type - - cost - - tokens - SnapshotPart: - type: object - properties: - id: + input_newline: + description: Insert newline in input + default: shift+return,ctrl+return,alt+return,ctrl+j type: string - sessionID: + input_move_left: + description: Move cursor left in input + default: left,ctrl+b type: string - messageID: + input_move_right: + description: Move cursor right in input + default: right,ctrl+f type: string - type: + input_move_up: + description: Move cursor up in input + default: up type: string - const: snapshot - snapshot: + input_move_down: + description: Move cursor down in input + default: down type: string - required: - - id - - sessionID - - messageID - - type - - snapshot - PatchPart: - type: object - properties: - id: + input_select_left: + description: Select left in input + default: shift+left type: string - sessionID: + input_select_right: + description: Select right in input + default: shift+right type: string - messageID: + input_select_up: + description: Select up in input + default: shift+up type: string - type: + input_select_down: + description: Select down in input + default: shift+down type: string - const: patch - hash: + input_line_home: + description: Move to start of line in input + default: ctrl+a type: string - files: - type: array - items: - type: string - required: - - id - - sessionID - - messageID - - type - - hash - - files - AgentPart: - type: object - properties: - id: + input_line_end: + description: Move to end of line in input + default: ctrl+e type: string - sessionID: + input_select_line_home: + description: Select to start of line in input + default: ctrl+shift+a type: string - messageID: + input_select_line_end: + description: Select to end of line in input + default: ctrl+shift+e type: string - type: + input_visual_line_home: + description: Move to start of visual line in input + default: alt+a type: string - const: agent - name: + input_visual_line_end: + description: Move to end of visual line in input + default: alt+e type: string - source: - type: object - properties: - value: - type: string - start: - type: integer - end: - type: integer - required: - - value - - start - - end - required: - - id - - sessionID - - messageID - - type - - name - Event.message.part.removed: - type: object - properties: - type: + input_select_visual_line_home: + description: Select to start of visual line in input + default: alt+shift+a type: string - const: message.part.removed - properties: - type: object - properties: - sessionID: - type: string - messageID: - type: string - partID: - type: string - required: - - sessionID - - messageID - - partID - required: - - type - - properties - Event.storage.write: - type: object - properties: - type: + input_select_visual_line_end: + description: Select to end of visual line in input + default: alt+shift+e + type: string + input_buffer_home: + description: Move to start of buffer in input + default: home + type: string + input_buffer_end: + description: Move to end of buffer in input + default: end type: string - const: storage.write - properties: - type: object - properties: - key: - type: string - content: {} - required: - - key - required: - - type - - properties - Event.permission.updated: - type: object - properties: - type: + input_select_buffer_home: + description: Select to start of buffer in input + default: shift+home type: string - const: permission.updated - properties: - $ref: '#/components/schemas/Permission' - required: - - type - - properties - Permission: - type: object - properties: - id: + input_select_buffer_end: + description: Select to end of buffer in input + default: shift+end type: string - type: + input_delete_line: + description: Delete line in input + default: ctrl+shift+d type: string - pattern: + input_delete_to_line_end: + description: Delete to end of line in input + default: ctrl+k type: string - sessionID: + input_delete_to_line_start: + description: Delete to start of line in input + default: ctrl+u type: string - messageID: + input_backspace: + description: Backspace in input + default: backspace,shift+backspace type: string - callID: + input_delete: + description: Delete character in input + default: ctrl+d,delete,shift+delete type: string - title: + input_undo: + description: Undo in input + default: ctrl+-,super+z type: string - metadata: - type: object - additionalProperties: {} - time: - type: object - properties: - created: - type: number - required: - - created - required: - - id - - type - - sessionID - - messageID - - title - - metadata - - time - Event.permission.replied: - type: object - properties: - type: + input_redo: + description: Redo in input + default: ctrl+.,super+shift+z type: string - const: permission.replied - properties: - type: object - properties: - sessionID: - type: string - permissionID: - type: string - response: - type: string - required: - - sessionID - - permissionID - - response - required: - - type - - properties - Event.file.edited: - type: object - properties: - type: + input_word_forward: + description: Move word forward in input + default: alt+f,alt+right,ctrl+right type: string - const: file.edited - properties: - type: object - properties: - file: - type: string - required: - - file - required: - - type - - properties - Event.session.updated: + input_word_backward: + description: Move word backward in input + default: alt+b,alt+left,ctrl+left + type: string + input_select_word_forward: + description: Select word forward in input + default: alt+shift+f,alt+shift+right + type: string + input_select_word_backward: + description: Select word backward in input + default: alt+shift+b,alt+shift+left + type: string + input_delete_word_forward: + description: Delete word forward in input + default: alt+d,alt+delete,ctrl+delete + type: string + input_delete_word_backward: + description: Delete word backward in input + default: ctrl+w,ctrl+backspace,alt+backspace + type: string + history_previous: + description: Previous history item + default: up + type: string + history_next: + description: Next history item + default: down + type: string + session_child_cycle: + description: Next child session + default: right + type: string + session_child_cycle_reverse: + description: Previous child session + default: left + type: string + session_parent: + description: Go to parent session + default: up + type: string + terminal_suspend: + description: Suspend terminal + default: ctrl+z + type: string + terminal_title_toggle: + description: Toggle terminal title + default: none + type: string + tips_toggle: + description: Toggle tips on home screen + default: h + type: string + additionalProperties: false + LogLevel: + description: Log level + type: string + enum: + - DEBUG + - INFO + - WARN + - ERROR + ServerConfig: + description: Server configuration for opencode serve and web commands type: object properties: - type: + port: + description: Port to listen on + type: integer + exclusiveMinimum: 0 + maximum: 9007199254740991 + hostname: + description: Hostname to listen on type: string - const: session.updated - properties: - type: object + mdns: + description: Enable mDNS service discovery + type: boolean + cors: + description: Additional domains to allow for CORS + type: array + items: + type: string + additionalProperties: false + PermissionActionConfig: + type: string + enum: + - ask + - allow + - deny + PermissionObjectConfig: + type: object + propertyNames: + type: string + additionalProperties: + $ref: '#/components/schemas/PermissionActionConfig' + PermissionRuleConfig: + anyOf: + - $ref: '#/components/schemas/PermissionActionConfig' + - $ref: '#/components/schemas/PermissionObjectConfig' + PermissionConfig: + anyOf: + - type: object properties: - info: - $ref: '#/components/schemas/Session' - required: - - info - required: - - type - - properties - Session: + read: + $ref: '#/components/schemas/PermissionRuleConfig' + edit: + $ref: '#/components/schemas/PermissionRuleConfig' + glob: + $ref: '#/components/schemas/PermissionRuleConfig' + grep: + $ref: '#/components/schemas/PermissionRuleConfig' + list: + $ref: '#/components/schemas/PermissionRuleConfig' + bash: + $ref: '#/components/schemas/PermissionRuleConfig' + task: + $ref: '#/components/schemas/PermissionRuleConfig' + external_directory: + $ref: '#/components/schemas/PermissionRuleConfig' + todowrite: + $ref: '#/components/schemas/PermissionActionConfig' + todoread: + $ref: '#/components/schemas/PermissionActionConfig' + webfetch: + $ref: '#/components/schemas/PermissionActionConfig' + websearch: + $ref: '#/components/schemas/PermissionActionConfig' + codesearch: + $ref: '#/components/schemas/PermissionActionConfig' + lsp: + $ref: '#/components/schemas/PermissionRuleConfig' + doom_loop: + $ref: '#/components/schemas/PermissionActionConfig' + additionalProperties: + $ref: '#/components/schemas/PermissionRuleConfig' + - $ref: '#/components/schemas/PermissionActionConfig' + AgentConfig: type: object properties: - id: + model: type: string - pattern: ^ses - parentID: + temperature: + type: number + top_p: + type: number + prompt: type: string - pattern: ^ses - share: + tools: + description: "@deprecated Use 'permission' field instead" type: object - properties: - url: - type: string - required: - - url - title: + propertyNames: + type: string + additionalProperties: + type: boolean + disable: + type: boolean + description: + description: Description of when to use the agent type: string - version: + mode: type: string - time: - type: object - properties: - created: - type: number - updated: - type: number - required: - - created - - updated - revert: + enum: + - subagent + - primary + - all + options: type: object - properties: - messageID: - type: string - partID: - type: string - snapshot: - type: string - diff: - type: string - required: - - messageID - required: - - id - - title - - version - - time - Event.session.deleted: - type: object - properties: - type: + propertyNames: + type: string + additionalProperties: {} + color: + description: 'Hex color code for the agent (e.g., #FF5733)' type: string - const: session.deleted - properties: - type: object - properties: - info: - $ref: '#/components/schemas/Session' - required: - - info - required: - - type - - properties - Event.session.idle: + pattern: ^#[0-9a-fA-F]{6}$ + steps: + description: + Maximum number of agentic iterations before forcing text-only + response + type: integer + exclusiveMinimum: 0 + maximum: 9007199254740991 + maxSteps: + description: "@deprecated Use 'steps' field instead." + type: integer + exclusiveMinimum: 0 + maximum: 9007199254740991 + permission: + $ref: '#/components/schemas/PermissionConfig' + additionalProperties: {} + ProviderConfig: type: object properties: - type: + api: type: string - const: session.idle - properties: + name: + type: string + env: + type: array + items: + type: string + id: + type: string + npm: + type: string + models: + type: object + propertyNames: + type: string + additionalProperties: + type: object + properties: + id: + type: string + name: + type: string + family: + type: string + release_date: + type: string + attachment: + type: boolean + reasoning: + type: boolean + temperature: + type: boolean + tool_call: + type: boolean + interleaved: + anyOf: + - type: boolean + const: true + - type: object + properties: + field: + type: string + enum: + - reasoning_content + - reasoning_details + required: + - field + additionalProperties: false + cost: + type: object + properties: + input: + type: number + output: + type: number + cache_read: + type: number + cache_write: + type: number + context_over_200k: + type: object + properties: + input: + type: number + output: + type: number + cache_read: + type: number + cache_write: + type: number + required: + - input + - output + required: + - input + - output + limit: + type: object + properties: + context: + type: number + output: + type: number + required: + - context + - output + modalities: + type: object + properties: + input: + type: array + items: + type: string + enum: + - text + - audio + - image + - video + - pdf + output: + type: array + items: + type: string + enum: + - text + - audio + - image + - video + - pdf + required: + - input + - output + experimental: + type: boolean + status: + type: string + enum: + - alpha + - beta + - deprecated + options: + type: object + propertyNames: + type: string + additionalProperties: {} + headers: + type: object + propertyNames: + type: string + additionalProperties: + type: string + provider: + type: object + properties: + npm: + type: string + required: + - npm + variants: + description: Variant-specific configuration + type: object + propertyNames: + type: string + additionalProperties: + type: object + properties: + disabled: + description: Disable this variant for the model + type: boolean + additionalProperties: {} + whitelist: + type: array + items: + type: string + blacklist: + type: array + items: + type: string + options: type: object properties: - sessionID: + apiKey: type: string - required: - - sessionID - required: - - type - - properties - Event.session.error: - type: object - properties: - type: - type: string - const: session.error - properties: - type: object - properties: - sessionID: + baseURL: type: string - error: - oneOf: - - $ref: '#/components/schemas/ProviderAuthError' - - $ref: '#/components/schemas/UnknownError' - - $ref: '#/components/schemas/MessageOutputLengthError' - - $ref: '#/components/schemas/MessageAbortedError' - discriminator: - propertyName: name - mapping: - ProviderAuthError: '#/components/schemas/ProviderAuthError' - UnknownError: '#/components/schemas/UnknownError' - MessageOutputLengthError: '#/components/schemas/MessageOutputLengthError' - MessageAbortedError: '#/components/schemas/MessageAbortedError' - required: - - type - - properties - Event.server.connected: + enterpriseUrl: + description: GitHub Enterprise URL for copilot authentication + type: string + setCacheKey: + description: Enable promptCacheKey for this provider (default false) + type: boolean + timeout: + description: + Timeout in milliseconds for requests to this provider. Default is + 300000 (5 minutes). Set to false to disable timeout. + anyOf: + - description: + Timeout in milliseconds for requests to this provider. Default is + 300000 (5 minutes). Set to false to disable timeout. + type: integer + exclusiveMinimum: 0 + maximum: 9007199254740991 + - description: Disable timeout for this provider entirely. + type: boolean + const: false + additionalProperties: {} + additionalProperties: false + McpLocalConfig: type: object properties: type: + description: Type of MCP server connection type: string - const: server.connected - properties: + const: local + command: + description: Command and arguments to run the MCP server + type: array + items: + type: string + environment: + description: Environment variables to set when running the MCP server type: object + propertyNames: + type: string + additionalProperties: + type: string + enabled: + description: Enable or disable the MCP server on startup + type: boolean + timeout: + description: + Timeout in ms for fetching tools from the MCP server. Defaults to + 5000 (5 seconds) if not specified. + type: integer + exclusiveMinimum: 0 + maximum: 9007199254740991 required: - type - - properties - Event.file.watcher.updated: + - command + additionalProperties: false + McpOAuthConfig: type: object properties: - type: + clientId: + description: + OAuth client ID. If not provided, dynamic client registration (RFC + 7591) will be attempted. type: string - const: file.watcher.updated - properties: - type: object - properties: - file: - type: string - event: - anyOf: - - type: string - const: rename - - type: string - const: change - required: - - file - - event - required: - - type - - properties - Event.ide.installed: + clientSecret: + description: OAuth client secret (if required by the authorization server) + type: string + scope: + description: OAuth scopes to request during authorization + type: string + additionalProperties: false + McpRemoteConfig: type: object properties: type: + description: Type of MCP server connection type: string - const: ide.installed - properties: - type: object - properties: - ide: - type: string - required: - - ide - required: - - type - - properties - App: - type: object - properties: - hostname: + const: remote + url: + description: URL of the remote MCP server type: string - git: + enabled: + description: Enable or disable the MCP server on startup type: boolean - path: - type: object - properties: - config: - type: string - data: - type: string - root: - type: string - cwd: - type: string - state: - type: string - required: - - config - - data - - root - - cwd - - state - time: + headers: + description: Headers to send with the request type: object - properties: - initialized: - type: number + propertyNames: + type: string + additionalProperties: + type: string + oauth: + description: + OAuth authentication configuration for the MCP server. Set to false + to disable OAuth auto-detection. + anyOf: + - $ref: '#/components/schemas/McpOAuthConfig' + - type: boolean + const: false + timeout: + description: + Timeout in ms for fetching tools from the MCP server. Defaults to + 5000 (5 seconds) if not specified. + type: integer + exclusiveMinimum: 0 + maximum: 9007199254740991 required: - - hostname - - git - - path - - time + - type + - url + additionalProperties: false + LayoutConfig: + description: '@deprecated Always uses stretch layout.' + type: string + enum: + - auto + - stretch Config: type: object properties: $schema: - type: string description: JSON schema reference for configuration validation - theme: type: string + theme: description: Theme name to use for the interface + type: string keybinds: $ref: '#/components/schemas/KeybindsConfig' - description: Custom keybind configurations + logLevel: + $ref: '#/components/schemas/LogLevel' tui: + description: TUI specific settings type: object properties: scroll_speed: - type: number - minimum: 1 - default: 2 description: TUI scroll speed - required: - - scroll_speed - description: TUI specific settings + type: number + minimum: 0.001 + scroll_acceleration: + description: Scroll acceleration settings + type: object + properties: + enabled: + description: Enable scroll acceleration + type: boolean + required: + - enabled + diff_style: + description: + "Control diff rendering style: 'auto' adapts to terminal width, + 'stacked' always shows single column" + type: string + enum: + - auto + - stacked + server: + $ref: '#/components/schemas/ServerConfig' + command: + description: Command configuration, see https://opencode.ai/docs/commands + type: object + propertyNames: + type: string + additionalProperties: + type: object + properties: + template: + type: string + description: + type: string + agent: + type: string + model: + type: string + subtask: + type: boolean + required: + - template + watcher: + type: object + properties: + ignore: + type: array + items: + type: string plugin: type: array items: @@ -2065,42 +6486,62 @@ components: snapshot: type: boolean share: + description: + Control sharing behavior:'manual' allows manual sharing via + commands, 'auto' enables automatic sharing, 'disabled' disables all + sharing type: string enum: - manual - auto - disabled - description: - Control sharing behavior:'manual' allows manual sharing via - commands, 'auto' enables automatic sharing, 'disabled' disables all - sharing autoshare: - type: boolean description: "@deprecated Use 'share' field instead. Share newly created sessions automatically" - autoupdate: type: boolean - description: Automatically update to the latest version + autoupdate: + description: + Automatically update to the latest version. Set to true to + auto-update, false to disable, or 'notify' to show update + notifications + anyOf: + - type: boolean + - type: string + const: notify disabled_providers: + description: Disable providers that are loaded automatically + type: array + items: + type: string + enabled_providers: + description: + When set, ONLY these providers will be enabled. All other providers + will be ignored type: array items: type: string - description: Disable providers that are loaded automatically model: - type: string description: Model to use in the format of provider/model, eg anthropic/claude-2 - small_model: type: string + small_model: description: Small model to use for tasks like title generation in the format of provider/model - username: type: string + default_agent: + description: + Default agent to use when none is specified. Must be a primary + agent. Falls back to 'build' if not set or if the specified agent is + invalid. + type: string + username: description: Custom username to display in conversations instead of system username + type: string mode: + description: '@deprecated Use `agent` field instead.' type: object properties: build: @@ -2109,204 +6550,139 @@ components: $ref: '#/components/schemas/AgentConfig' additionalProperties: $ref: '#/components/schemas/AgentConfig' - description: '@deprecated Use `agent` field instead.' agent: + description: Agent configuration, see https://opencode.ai/docs/agent type: object properties: plan: $ref: '#/components/schemas/AgentConfig' build: $ref: '#/components/schemas/AgentConfig' - general: - $ref: '#/components/schemas/AgentConfig' - additionalProperties: - $ref: '#/components/schemas/AgentConfig' - description: Agent configuration, see https://opencode.ai/docs/agent - provider: - type: object - additionalProperties: - type: object - properties: - api: - type: string - name: - type: string - env: - type: array - items: - type: string - id: - type: string - npm: - type: string - models: - type: object - additionalProperties: - type: object - properties: - id: - type: string - name: - type: string - release_date: - type: string - attachment: - type: boolean - reasoning: - type: boolean - temperature: - type: boolean - tool_call: - type: boolean - cost: - type: object - properties: - input: - type: number - output: - type: number - cache_read: - type: number - cache_write: - type: number - required: - - input - - output - limit: - type: object - properties: - context: - type: number - output: - type: number - required: - - context - - output - options: - type: object - additionalProperties: {} - options: - type: object - properties: - apiKey: - type: string - baseURL: - type: string - additionalProperties: {} - additionalProperties: false + general: + $ref: '#/components/schemas/AgentConfig' + explore: + $ref: '#/components/schemas/AgentConfig' + title: + $ref: '#/components/schemas/AgentConfig' + summary: + $ref: '#/components/schemas/AgentConfig' + compaction: + $ref: '#/components/schemas/AgentConfig' + additionalProperties: + $ref: '#/components/schemas/AgentConfig' + provider: description: Custom provider configurations and model overrides + type: object + propertyNames: + type: string + additionalProperties: + $ref: '#/components/schemas/ProviderConfig' mcp: + description: MCP (Model Context Protocol) server configurations type: object + propertyNames: + type: string additionalProperties: - oneOf: + anyOf: - $ref: '#/components/schemas/McpLocalConfig' - $ref: '#/components/schemas/McpRemoteConfig' - discriminator: - propertyName: type - mapping: - local: '#/components/schemas/McpLocalConfig' - remote: '#/components/schemas/McpRemoteConfig' - description: MCP (Model Context Protocol) server configurations formatter: - type: object - additionalProperties: - type: object - properties: - disabled: - type: boolean - command: - type: array - items: - type: string - environment: + anyOf: + - type: boolean + const: false + - type: object + propertyNames: + type: string + additionalProperties: type: object - additionalProperties: - type: string - extensions: - type: array - items: - type: string - lsp: - type: object - additionalProperties: - anyOf: - - type: object properties: disabled: type: boolean - const: true - required: - - disabled - - type: object - properties: command: type: array items: type: string + environment: + type: object + propertyNames: + type: string + additionalProperties: + type: string extensions: type: array items: type: string - disabled: - type: boolean - env: - type: object - additionalProperties: - type: string - initialization: - type: object - additionalProperties: {} - required: - - command + lsp: + anyOf: + - type: boolean + const: false + - type: object + propertyNames: + type: string + additionalProperties: + anyOf: + - type: object + properties: + disabled: + type: boolean + const: true + required: + - disabled + - type: object + properties: + command: + type: array + items: + type: string + extensions: + type: array + items: + type: string + disabled: + type: boolean + env: + type: object + propertyNames: + type: string + additionalProperties: + type: string + initialization: + type: object + propertyNames: + type: string + additionalProperties: {} + required: + - command instructions: + description: Additional instruction files or patterns to include type: array items: type: string - description: Additional instruction files or patterns to include layout: $ref: '#/components/schemas/LayoutConfig' - description: '@deprecated Always uses stretch layout.' permission: - type: object - properties: - edit: - anyOf: - - type: string - const: ask - - type: string - const: allow - - type: string - const: deny - bash: - anyOf: - - anyOf: - - type: string - const: ask - - type: string - const: allow - - type: string - const: deny - - type: object - additionalProperties: - anyOf: - - type: string - const: ask - - type: string - const: allow - - type: string - const: deny - webfetch: - anyOf: - - type: string - const: ask - - type: string - const: allow - - type: string - const: deny + $ref: '#/components/schemas/PermissionConfig' tools: type: object + propertyNames: + type: string additionalProperties: type: boolean + enterprise: + type: object + properties: + url: + description: Enterprise URL + type: string + compaction: + type: object + properties: + auto: + description: 'Enable automatic compaction when context is full (default: true)' + type: boolean + prune: + description: 'Enable pruning of old tool outputs (default: true)' + type: boolean experimental: type: object properties: @@ -2315,6 +6691,8 @@ components: properties: file_edited: type: object + propertyNames: + type: string additionalProperties: type: array items: @@ -2326,6 +6704,8 @@ components: type: string environment: type: object + propertyNames: + type: string additionalProperties: type: string required: @@ -2341,368 +6721,307 @@ components: type: string environment: type: object + propertyNames: + type: string additionalProperties: type: string required: - command + chatMaxRetries: + description: Number of retries for chat completions on failure + type: number + disable_paste_summary: + type: boolean + batch_tool: + description: Enable the batch tool + type: boolean + openTelemetry: + description: + Enable OpenTelemetry spans for AI SDK calls (using the + 'experimental_telemetry' flag) + type: boolean + primary_tools: + description: Tools that should only be available to primary agents. + type: array + items: + type: string + continue_loop_on_deny: + description: Continue the agent loop when a tool call is denied + type: boolean + mcp_timeout: + description: Timeout in milliseconds for model context protocol (MCP) requests + type: integer + exclusiveMinimum: 0 + maximum: 9007199254740991 additionalProperties: false - KeybindsConfig: + ToolIDs: + type: array + items: + type: string + ToolListItem: type: object properties: - leader: - type: string - default: ctrl+x - description: Leader key for keybind combinations - app_help: - type: string - default: h - description: Show help dialog - app_exit: - type: string - default: ctrl+c,q - description: Exit the application - editor_open: - type: string - default: e - description: Open external editor - theme_list: - type: string - default: t - description: List available themes - project_init: - type: string - default: i - description: Create/update AGENTS.md - tool_details: - type: string - default: d - description: Toggle tool details - thinking_blocks: - type: string - default: b - description: Toggle thinking blocks - session_export: - type: string - default: x - description: Export session to editor - session_new: - type: string - default: n - description: Create a new session - session_list: - type: string - default: l - description: List all sessions - session_timeline: - type: string - default: g - description: Show session timeline - session_share: - type: string - default: s - description: Share current session - session_unshare: - type: string - default: none - description: Unshare current session - session_interrupt: - type: string - default: esc - description: Interrupt current session - session_compact: - type: string - default: c - description: Compact the session - session_child_cycle: - type: string - default: ctrl+right - description: Cycle to next child session - session_child_cycle_reverse: - type: string - default: ctrl+left - description: Cycle to previous child session - messages_page_up: - type: string - default: pgup - description: Scroll messages up by one page - messages_page_down: - type: string - default: pgdown - description: Scroll messages down by one page - messages_half_page_up: - type: string - default: ctrl+alt+u - description: Scroll messages up by half page - messages_half_page_down: - type: string - default: ctrl+alt+d - description: Scroll messages down by half page - messages_first: - type: string - default: ctrl+g - description: Navigate to first message - messages_last: - type: string - default: ctrl+alt+g - description: Navigate to last message - messages_copy: + id: type: string - default: y - description: Copy message - messages_undo: + description: type: string - default: u - description: Undo message - messages_redo: + parameters: {} + required: + - id + - description + - parameters + ToolList: + type: array + items: + $ref: '#/components/schemas/ToolListItem' + Path: + type: object + properties: + home: type: string - default: r - description: Redo message - model_list: + state: type: string - default: m - description: List available models - model_cycle_recent: + config: type: string - default: f2 - description: Next recent model - model_cycle_recent_reverse: + worktree: type: string - default: shift+f2 - description: Previous recent model - agent_list: + directory: type: string - default: a - description: List agents - agent_cycle: + required: + - home + - state + - config + - worktree + - directory + VcsInfo: + type: object + properties: + branch: type: string - default: tab - description: Next agent - agent_cycle_reverse: + required: + - branch + TextPartInput: + type: object + properties: + id: type: string - default: shift+tab - description: Previous agent - input_clear: + type: type: string - default: ctrl+c - description: Clear input field - input_paste: + const: text + text: type: string - default: ctrl+v - description: Paste from clipboard - input_submit: + synthetic: + type: boolean + ignored: + type: boolean + time: + type: object + properties: + start: + type: number + end: + type: number + required: + - start + metadata: + type: object + propertyNames: + type: string + additionalProperties: {} + required: + - type + - text + FilePartInput: + type: object + properties: + id: type: string - default: enter - description: Submit input - input_newline: + type: type: string - default: shift+enter,ctrl+j - description: Insert newline in input - switch_mode: + const: file + mime: type: string - default: none - description: '@deprecated use agent_cycle. Next mode' - switch_mode_reverse: + filename: type: string - default: none - description: '@deprecated use agent_cycle_reverse. Previous mode' - switch_agent: + url: type: string - default: tab - description: '@deprecated use agent_cycle. Next agent' - switch_agent_reverse: + source: + $ref: '#/components/schemas/FilePartSource' + required: + - type + - mime + - url + AgentPartInput: + type: object + properties: + id: type: string - default: shift+tab - description: '@deprecated use agent_cycle_reverse. Previous agent' - file_list: + type: type: string - default: none - description: '@deprecated Currently not available. List files' - file_close: + const: agent + name: type: string - default: none - description: '@deprecated Close file' - file_search: + source: + type: object + properties: + value: + type: string + start: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + end: + type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 + required: + - value + - start + - end + required: + - type + - name + SubtaskPartInput: + type: object + properties: + id: type: string - default: none - description: '@deprecated Search file' - file_diff_toggle: + type: type: string - default: none - description: '@deprecated Split/unified diff' - messages_previous: + const: subtask + prompt: type: string - default: none - description: '@deprecated Navigate to previous message' - messages_next: + description: type: string - default: none - description: '@deprecated Navigate to next message' - messages_layout_toggle: + agent: type: string - default: none - description: '@deprecated Toggle layout' - messages_revert: + command: type: string - default: none - description: '@deprecated use messages_undo. Revert message' - required: - - leader - - app_help - - app_exit - - editor_open - - theme_list - - project_init - - tool_details - - thinking_blocks - - session_export - - session_new - - session_list - - session_timeline - - session_share - - session_unshare - - session_interrupt - - session_compact - - session_child_cycle - - session_child_cycle_reverse - - messages_page_up - - messages_page_down - - messages_half_page_up - - messages_half_page_down - - messages_first - - messages_last - - messages_copy - - messages_undo - - messages_redo - - model_list - - model_cycle_recent - - model_cycle_recent_reverse - - agent_list - - agent_cycle - - agent_cycle_reverse - - input_clear - - input_paste - - input_submit - - input_newline - - switch_mode - - switch_mode_reverse - - switch_agent - - switch_agent_reverse - - file_list - - file_close - - file_search - - file_diff_toggle - - messages_previous - - messages_next - - messages_layout_toggle - - messages_revert - additionalProperties: false - AgentConfig: + required: + - type + - prompt + - description + - agent + Command: type: object properties: - model: - type: string - temperature: - type: number - top_p: - type: number - prompt: + name: type: string - tools: - type: object - additionalProperties: - type: boolean - disable: - type: boolean description: type: string - description: Description of when to use the agent - mode: + agent: + type: string + model: + type: string + mcp: + type: boolean + template: anyOf: - type: string - const: subagent - type: string - const: primary - - type: string - const: all - permission: - type: object - properties: - edit: - anyOf: - - type: string - const: ask - - type: string - const: allow - - type: string - const: deny - bash: - anyOf: - - anyOf: - - type: string - const: ask - - type: string - const: allow - - type: string - const: deny - - type: object - additionalProperties: - anyOf: - - type: string - const: ask - - type: string - const: allow - - type: string - const: deny - webfetch: - anyOf: - - type: string - const: ask - - type: string - const: allow - - type: string - const: deny - additionalProperties: {} - Provider: - type: object - properties: - api: - type: string - name: - type: string - env: + subtask: + type: boolean + hints: type: array items: type: string - id: - type: string - npm: - type: string - models: - type: object - additionalProperties: - $ref: '#/components/schemas/Model' required: - name - - env - - id - - models + - template + - hints Model: type: object properties: id: type: string + providerID: + type: string + api: + type: object + properties: + id: + type: string + url: + type: string + npm: + type: string + required: + - id + - url + - npm name: type: string - release_date: + family: type: string - attachment: - type: boolean - reasoning: - type: boolean - temperature: - type: boolean - tool_call: - type: boolean + capabilities: + type: object + properties: + temperature: + type: boolean + reasoning: + type: boolean + attachment: + type: boolean + toolcall: + type: boolean + input: + type: object + properties: + text: + type: boolean + audio: + type: boolean + image: + type: boolean + video: + type: boolean + pdf: + type: boolean + required: + - text + - audio + - image + - video + - pdf + output: + type: object + properties: + text: + type: boolean + audio: + type: boolean + image: + type: boolean + video: + type: boolean + pdf: + type: boolean + required: + - text + - audio + - image + - video + - pdf + interleaved: + anyOf: + - type: boolean + - type: object + properties: + field: + type: string + enum: + - reasoning_content + - reasoning_details + required: + - field + required: + - temperature + - reasoning + - attachment + - toolcall + - input + - output + - interleaved cost: type: object properties: @@ -2710,13 +7029,41 @@ components: type: number output: type: number - cache_read: - type: number - cache_write: - type: number + cache: + type: object + properties: + read: + type: number + write: + type: number + required: + - read + - write + experimentalOver200K: + type: object + properties: + input: + type: number + output: + type: number + cache: + type: object + properties: + read: + type: number + write: + type: number + required: + - read + - write + required: + - input + - output + - cache required: - input - output + - cache limit: type: object properties: @@ -2725,151 +7072,118 @@ components: output: type: number required: - - context - - output - options: - type: object - additionalProperties: {} - required: - - id - - name - - release_date - - attachment - - reasoning - - temperature - - tool_call - - cost - - limit - - options - McpLocalConfig: - type: object - properties: - type: - type: string - const: local - description: Type of MCP server connection - command: - type: array - items: - type: string - description: Command and arguments to run the MCP server - environment: - type: object - additionalProperties: - type: string - description: Environment variables to set when running the MCP server - enabled: - type: boolean - description: Enable or disable the MCP server on startup - required: - - type - - command - additionalProperties: false - McpRemoteConfig: - type: object - properties: - type: - type: string - const: remote - description: Type of MCP server connection - url: - type: string - description: URL of the remote MCP server - enabled: - type: boolean - description: Enable or disable the MCP server on startup - headers: - type: object - additionalProperties: - type: string - description: Headers to send with the request - required: - - type - - url - additionalProperties: false - LayoutConfig: - type: string - enum: - - auto - - stretch - Error: - type: object - properties: - data: + - context + - output + status: + type: string + enum: + - alpha + - beta + - deprecated + - active + options: type: object + propertyNames: + type: string additionalProperties: {} + headers: + type: object + propertyNames: + type: string + additionalProperties: + type: string + release_date: + type: string + variants: + type: object + propertyNames: + type: string + additionalProperties: + type: object + propertyNames: + type: string + additionalProperties: {} required: - - data - TextPartInput: + - id + - providerID + - api + - name + - capabilities + - cost + - limit + - status + - options + - headers + - release_date + Provider: type: object properties: id: type: string - type: + name: type: string - const: text - text: + source: type: string - synthetic: - type: boolean - time: + enum: + - env + - config + - custom + - api + env: + type: array + items: + type: string + key: + type: string + options: type: object - properties: - start: - type: number - end: - type: number - required: - - start + propertyNames: + type: string + additionalProperties: {} + models: + type: object + propertyNames: + type: string + additionalProperties: + $ref: '#/components/schemas/Model' required: - - type - - text - FilePartInput: + - id + - name + - source + - env + - options + - models + ProviderAuthMethod: type: object properties: - id: - type: string type: + anyOf: + - type: string + const: oauth + - type: string + const: api + label: type: string - const: file - mime: - type: string - filename: - type: string - url: - type: string - source: - $ref: '#/components/schemas/FilePartSource' required: - type - - mime - - url - AgentPartInput: + - label + ProviderAuthAuthorization: type: object properties: - id: - type: string - type: + url: type: string - const: agent - name: + method: + anyOf: + - type: string + const: auto + - type: string + const: code + instructions: type: string - source: - type: object - properties: - value: - type: string - start: - type: integer - end: - type: integer - required: - - value - - start - - end required: - - type - - name + - url + - method + - instructions Symbol: type: object properties: @@ -2891,6 +7205,86 @@ components: - name - kind - location + FileNode: + type: object + properties: + name: + type: string + path: + type: string + absolute: + type: string + type: + type: string + enum: + - file + - directory + ignored: + type: boolean + required: + - name + - path + - absolute + - type + - ignored + FileContent: + type: object + properties: + type: + type: string + const: text + content: + type: string + diff: + type: string + patch: + type: object + properties: + oldFileName: + type: string + newFileName: + type: string + oldHeader: + type: string + newHeader: + type: string + hunks: + type: array + items: + type: object + properties: + oldStart: + type: number + oldLines: + type: number + newStart: + type: number + newLines: + type: number + lines: + type: array + items: + type: string + required: + - oldStart + - oldLines + - newStart + - newLines + - lines + index: + type: string + required: + - oldFileName + - newFileName + - hunks + encoding: + type: string + const: base64 + mimeType: + type: string + required: + - type + - content File: type: object properties: @@ -2898,8 +7292,12 @@ components: type: string added: type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 removed: type: integer + minimum: -9007199254740991 + maximum: 9007199254740991 status: type: string enum: @@ -2919,51 +7317,23 @@ components: description: type: string mode: - anyOf: - - type: string - const: subagent - - type: string - const: primary - - type: string - const: all - builtIn: + type: string + enum: + - subagent + - primary + - all + native: + type: boolean + hidden: type: boolean topP: type: number temperature: type: number + color: + type: string permission: - type: object - properties: - edit: - anyOf: - - type: string - const: ask - - type: string - const: allow - - type: string - const: deny - bash: - type: object - additionalProperties: - anyOf: - - type: string - const: ask - - type: string - const: allow - - type: string - const: deny - webfetch: - anyOf: - - type: string - const: ask - - type: string - const: allow - - type: string - const: deny - required: - - edit - - bash + $ref: '#/components/schemas/PermissionRuleset' model: type: object properties: @@ -2976,31 +7346,108 @@ components: - providerID prompt: type: string - tools: - type: object - additionalProperties: - type: boolean options: type: object + propertyNames: + type: string additionalProperties: {} + steps: + type: integer + exclusiveMinimum: 0 + maximum: 9007199254740991 required: - name - mode - - builtIn - permission - - tools - options - Auth: - oneOf: - - $ref: '#/components/schemas/OAuth' - - $ref: '#/components/schemas/ApiAuth' - - $ref: '#/components/schemas/WellKnownAuth' - discriminator: - propertyName: type - mapping: - oauth: '#/components/schemas/OAuth' - api: '#/components/schemas/ApiAuth' - wellknown: '#/components/schemas/WellKnownAuth' + MCPStatusConnected: + type: object + properties: + status: + type: string + const: connected + required: + - status + MCPStatusDisabled: + type: object + properties: + status: + type: string + const: disabled + required: + - status + MCPStatusFailed: + type: object + properties: + status: + type: string + const: failed + error: + type: string + required: + - status + - error + MCPStatusNeedsAuth: + type: object + properties: + status: + type: string + const: needs_auth + required: + - status + MCPStatusNeedsClientRegistration: + type: object + properties: + status: + type: string + const: needs_client_registration + error: + type: string + required: + - status + - error + MCPStatus: + anyOf: + - $ref: '#/components/schemas/MCPStatusConnected' + - $ref: '#/components/schemas/MCPStatusDisabled' + - $ref: '#/components/schemas/MCPStatusFailed' + - $ref: '#/components/schemas/MCPStatusNeedsAuth' + - $ref: '#/components/schemas/MCPStatusNeedsClientRegistration' + LSPStatus: + type: object + properties: + id: + type: string + name: + type: string + root: + type: string + status: + anyOf: + - type: string + const: connected + - type: string + const: error + required: + - id + - name + - root + - status + FormatterStatus: + type: object + properties: + name: + type: string + extensions: + type: array + items: + type: string + enabled: + type: boolean + required: + - name + - extensions + - enabled OAuth: type: object properties: @@ -3013,6 +7460,8 @@ components: type: string expires: type: number + enterpriseUrl: + type: string required: - type - refresh @@ -3043,3 +7492,8 @@ components: - type - key - token + Auth: + anyOf: + - $ref: '#/components/schemas/OAuth' + - $ref: '#/components/schemas/ApiAuth' + - $ref: '#/components/schemas/WellKnownAuth'