From 7605acff650db0d41d80429b662b5c0725d89675 Mon Sep 17 00:00:00 2001 From: James Long Date: Fri, 17 Apr 2026 02:06:20 -0400 Subject: refactor(core): move server routes around to clarify workspacing (#23031) --- packages/sdk/js/src/v2/gen/sdk.gen.ts | 602 +++++++-------- packages/sdk/js/src/v2/gen/types.gen.ts | 362 ++++----- packages/sdk/openapi.json | 1258 +++++++++++++++---------------- 3 files changed, 1111 insertions(+), 1111 deletions(-) (limited to 'packages/sdk') diff --git a/packages/sdk/js/src/v2/gen/sdk.gen.ts b/packages/sdk/js/src/v2/gen/sdk.gen.ts index d7bf43f50..f484147a4 100644 --- a/packages/sdk/js/src/v2/gen/sdk.gen.ts +++ b/packages/sdk/js/src/v2/gen/sdk.gen.ts @@ -510,11 +510,11 @@ export class App extends HeyApiClient { } } -export class Project extends HeyApiClient { +export class Adaptor extends HeyApiClient { /** - * List all projects + * List workspace adaptors * - * Get a list of projects that have been opened with OpenCode. + * List all available workspace adaptors for the current project. */ public list( parameters?: { @@ -534,19 +534,21 @@ export class Project extends HeyApiClient { }, ], ) - return (options?.client ?? this.client).get({ - url: "/project", + return (options?.client ?? this.client).get({ + url: "/experimental/workspace/adaptor", ...options, ...params, }) } +} +export class Workspace extends HeyApiClient { /** - * Get current project + * List workspaces * - * Retrieve the currently active project that OpenCode is working with. + * List all workspaces. */ - public current( + public list( parameters?: { directory?: string workspace?: string @@ -564,22 +566,26 @@ export class Project extends HeyApiClient { }, ], ) - return (options?.client ?? this.client).get({ - url: "/project/current", + return (options?.client ?? this.client).get({ + url: "/experimental/workspace", ...options, ...params, }) } /** - * Initialize git repository + * Create workspace * - * Create a git repository for the current project and return the refreshed project info. + * Create a workspace for the current project. */ - public initGit( + public create( parameters?: { directory?: string workspace?: string + id?: string + type?: string + branch?: string | null + extra?: unknown | null }, options?: Options, ) { @@ -590,39 +596,39 @@ export class Project extends HeyApiClient { args: [ { in: "query", key: "directory" }, { in: "query", key: "workspace" }, + { in: "body", key: "id" }, + { in: "body", key: "type" }, + { in: "body", key: "branch" }, + { in: "body", key: "extra" }, ], }, ], ) - return (options?.client ?? this.client).post({ - url: "/project/git/init", + return (options?.client ?? this.client).post< + ExperimentalWorkspaceCreateResponses, + ExperimentalWorkspaceCreateErrors, + ThrowOnError + >({ + url: "/experimental/workspace", ...options, ...params, + headers: { + "Content-Type": "application/json", + ...options?.headers, + ...params.headers, + }, }) } /** - * Update project + * Workspace status * - * Update project properties such as name, icon, and commands. + * Get connection status for workspaces in the current project. */ - public update( - parameters: { - projectID: string + public status( + parameters?: { directory?: string workspace?: string - name?: string - icon?: { - url?: string - override?: string - color?: string - } - commands?: { - /** - * Startup script to run when creating a new workspace (worktree) - */ - start?: string - } }, options?: Options, ) { @@ -631,37 +637,27 @@ export class Project extends HeyApiClient { [ { args: [ - { in: "path", key: "projectID" }, { in: "query", key: "directory" }, { in: "query", key: "workspace" }, - { in: "body", key: "name" }, - { in: "body", key: "icon" }, - { in: "body", key: "commands" }, ], }, ], ) - return (options?.client ?? this.client).patch({ - url: "/project/{projectID}", + return (options?.client ?? this.client).get({ + url: "/experimental/workspace/status", ...options, ...params, - headers: { - "Content-Type": "application/json", - ...options?.headers, - ...params.headers, - }, }) } -} -export class Pty extends HeyApiClient { /** - * List PTY sessions + * Remove workspace * - * Get a list of all active pseudo-terminal (PTY) sessions managed by OpenCode. + * Remove an existing workspace. */ - public list( - parameters?: { + public remove( + parameters: { + id: string directory?: string workspace?: string }, @@ -672,35 +668,35 @@ export class Pty extends HeyApiClient { [ { args: [ + { in: "path", key: "id" }, { in: "query", key: "directory" }, { in: "query", key: "workspace" }, ], }, ], ) - return (options?.client ?? this.client).get({ - url: "/pty", + return (options?.client ?? this.client).delete< + ExperimentalWorkspaceRemoveResponses, + ExperimentalWorkspaceRemoveErrors, + ThrowOnError + >({ + url: "/experimental/workspace/{id}", ...options, ...params, }) } /** - * Create PTY session + * Restore session into workspace * - * Create a new pseudo-terminal (PTY) session for running shell commands and processes. + * Replay a session's sync events into the target workspace in batches. */ - public create( - parameters?: { + public sessionRestore( + parameters: { + id: string directory?: string workspace?: string - command?: string - args?: Array - cwd?: string - title?: string - env?: { - [key: string]: string - } + sessionID?: string }, options?: Options, ) { @@ -709,19 +705,20 @@ export class Pty extends HeyApiClient { [ { args: [ + { in: "path", key: "id" }, { in: "query", key: "directory" }, { in: "query", key: "workspace" }, - { in: "body", key: "command" }, - { in: "body", key: "args" }, - { in: "body", key: "cwd" }, - { in: "body", key: "title" }, - { in: "body", key: "env" }, + { in: "body", key: "sessionID" }, ], }, ], ) - return (options?.client ?? this.client).post({ - url: "/pty", + return (options?.client ?? this.client).post< + ExperimentalWorkspaceSessionRestoreResponses, + ExperimentalWorkspaceSessionRestoreErrors, + ThrowOnError + >({ + url: "/experimental/workspace/{id}/session-restore", ...options, ...params, headers: { @@ -732,14 +729,20 @@ export class Pty extends HeyApiClient { }) } + private _adaptor?: Adaptor + get adaptor(): Adaptor { + return (this._adaptor ??= new Adaptor({ client: this.client })) + } +} + +export class Console extends HeyApiClient { /** - * Remove PTY session + * Get active Console provider metadata * - * Remove and terminate a specific pseudo-terminal (PTY) session. + * Get the active Console org name and the set of provider IDs managed by that Console org. */ - public remove( - parameters: { - ptyID: string + public get( + parameters?: { directory?: string workspace?: string }, @@ -750,28 +753,26 @@ export class Pty extends HeyApiClient { [ { args: [ - { in: "path", key: "ptyID" }, { in: "query", key: "directory" }, { in: "query", key: "workspace" }, ], }, ], ) - return (options?.client ?? this.client).delete({ - url: "/pty/{ptyID}", + return (options?.client ?? this.client).get({ + url: "/experimental/console", ...options, ...params, }) } /** - * Get PTY session + * List switchable Console orgs * - * Retrieve detailed information about a specific pseudo-terminal (PTY) session. + * Get the available Console orgs across logged-in accounts, including the current active org. */ - public get( - parameters: { - ptyID: string + public listOrgs( + parameters?: { directory?: string workspace?: string }, @@ -782,35 +783,30 @@ export class Pty extends HeyApiClient { [ { args: [ - { in: "path", key: "ptyID" }, { in: "query", key: "directory" }, { in: "query", key: "workspace" }, ], }, ], ) - return (options?.client ?? this.client).get({ - url: "/pty/{ptyID}", + return (options?.client ?? this.client).get({ + url: "/experimental/console/orgs", ...options, ...params, }) } /** - * Update PTY session + * Switch active Console org * - * Update properties of an existing pseudo-terminal (PTY) session. + * Persist a new active Console account/org selection for the current local OpenCode state. */ - public update( - parameters: { - ptyID: string + public switchOrg( + parameters?: { directory?: string workspace?: string - title?: string - size?: { - rows: number - cols: number - } + accountID?: string + orgID?: string }, options?: Options, ) { @@ -819,17 +815,16 @@ export class Pty extends HeyApiClient { [ { args: [ - { in: "path", key: "ptyID" }, { in: "query", key: "directory" }, { in: "query", key: "workspace" }, - { in: "body", key: "title" }, - { in: "body", key: "size" }, + { in: "body", key: "accountID" }, + { in: "body", key: "orgID" }, ], }, ], ) - return (options?.client ?? this.client).put({ - url: "/pty/{ptyID}", + return (options?.client ?? this.client).post({ + url: "/experimental/console/switch", ...options, ...params, headers: { @@ -839,17 +834,24 @@ export class Pty extends HeyApiClient { }, }) } +} +export class Session extends HeyApiClient { /** - * Connect to PTY session + * List sessions * - * Establish a WebSocket connection to interact with a pseudo-terminal (PTY) session in real-time. + * Get a list of all OpenCode sessions across projects, sorted by most recently updated. Archived sessions are excluded by default. */ - public connect( - parameters: { - ptyID: string + public list( + parameters?: { directory?: string workspace?: string + roots?: boolean + start?: number + cursor?: number + search?: string + limit?: number + archived?: boolean }, options?: Options, ) { @@ -858,28 +860,33 @@ export class Pty extends HeyApiClient { [ { args: [ - { in: "path", key: "ptyID" }, { in: "query", key: "directory" }, { in: "query", key: "workspace" }, + { in: "query", key: "roots" }, + { in: "query", key: "start" }, + { in: "query", key: "cursor" }, + { in: "query", key: "search" }, + { in: "query", key: "limit" }, + { in: "query", key: "archived" }, ], }, ], ) - return (options?.client ?? this.client).get({ - url: "/pty/{ptyID}/connect", + return (options?.client ?? this.client).get({ + url: "/experimental/session", ...options, ...params, }) } } -export class Config2 extends HeyApiClient { +export class Resource extends HeyApiClient { /** - * Get configuration + * Get MCP resources * - * Retrieve the current OpenCode configuration settings and preferences. + * Get all available MCP resources from connected servers. Optionally filter by name. */ - public get( + public list( parameters?: { directory?: string workspace?: string @@ -897,23 +904,46 @@ export class Config2 extends HeyApiClient { }, ], ) - return (options?.client ?? this.client).get({ - url: "/config", + return (options?.client ?? this.client).get({ + url: "/experimental/resource", ...options, ...params, }) } +} +export class Experimental extends HeyApiClient { + private _workspace?: Workspace + get workspace(): Workspace { + return (this._workspace ??= new Workspace({ client: this.client })) + } + + private _console?: Console + get console(): Console { + return (this._console ??= new Console({ client: this.client })) + } + + private _session?: Session + get session(): Session { + return (this._session ??= new Session({ client: this.client })) + } + + private _resource?: Resource + get resource(): Resource { + return (this._resource ??= new Resource({ client: this.client })) + } +} + +export class Project extends HeyApiClient { /** - * Update configuration + * List all projects * - * Update OpenCode configuration settings and preferences. + * Get a list of projects that have been opened with OpenCode. */ - public update( + public list( parameters?: { directory?: string workspace?: string - config?: Config3 }, options?: Options, ) { @@ -924,29 +954,23 @@ export class Config2 extends HeyApiClient { args: [ { in: "query", key: "directory" }, { in: "query", key: "workspace" }, - { key: "config", map: "body" }, ], }, ], ) - return (options?.client ?? this.client).patch({ - url: "/config", + return (options?.client ?? this.client).get({ + url: "/project", ...options, ...params, - headers: { - "Content-Type": "application/json", - ...options?.headers, - ...params.headers, - }, }) } /** - * List config providers + * Get current project * - * Get a list of all configured AI providers and their default models. + * Retrieve the currently active project that OpenCode is working with. */ - public providers( + public current( parameters?: { directory?: string workspace?: string @@ -964,21 +988,19 @@ export class Config2 extends HeyApiClient { }, ], ) - return (options?.client ?? this.client).get({ - url: "/config/providers", + return (options?.client ?? this.client).get({ + url: "/project/current", ...options, ...params, }) } -} -export class Console extends HeyApiClient { /** - * Get active Console provider metadata + * Initialize git repository * - * Get the active Console org name and the set of provider IDs managed by that Console org. + * Create a git repository for the current project and return the refreshed project info. */ - public get( + public initGit( parameters?: { directory?: string workspace?: string @@ -996,19 +1018,73 @@ export class Console extends HeyApiClient { }, ], ) - return (options?.client ?? this.client).get({ - url: "/experimental/console", + return (options?.client ?? this.client).post({ + url: "/project/git/init", + ...options, + ...params, + }) + } + + /** + * Update project + * + * Update project properties such as name, icon, and commands. + */ + public update( + parameters: { + projectID: string + directory?: string + workspace?: string + name?: string + icon?: { + url?: string + override?: string + color?: string + } + commands?: { + /** + * Startup script to run when creating a new workspace (worktree) + */ + start?: string + } + }, + options?: Options, + ) { + const params = buildClientParams( + [parameters], + [ + { + args: [ + { in: "path", key: "projectID" }, + { in: "query", key: "directory" }, + { in: "query", key: "workspace" }, + { in: "body", key: "name" }, + { in: "body", key: "icon" }, + { in: "body", key: "commands" }, + ], + }, + ], + ) + return (options?.client ?? this.client).patch({ + url: "/project/{projectID}", ...options, ...params, + headers: { + "Content-Type": "application/json", + ...options?.headers, + ...params.headers, + }, }) } +} +export class Pty extends HeyApiClient { /** - * List switchable Console orgs + * List PTY sessions * - * Get the available Console orgs across logged-in accounts, including the current active org. + * Get a list of all active pseudo-terminal (PTY) sessions managed by OpenCode. */ - public listOrgs( + public list( parameters?: { directory?: string workspace?: string @@ -1026,24 +1102,29 @@ export class Console extends HeyApiClient { }, ], ) - return (options?.client ?? this.client).get({ - url: "/experimental/console/orgs", + return (options?.client ?? this.client).get({ + url: "/pty", ...options, ...params, }) } /** - * Switch active Console org + * Create PTY session * - * Persist a new active Console account/org selection for the current local OpenCode state. + * Create a new pseudo-terminal (PTY) session for running shell commands and processes. */ - public switchOrg( + public create( parameters?: { directory?: string workspace?: string - accountID?: string - orgID?: string + command?: string + args?: Array + cwd?: string + title?: string + env?: { + [key: string]: string + } }, options?: Options, ) { @@ -1054,14 +1135,17 @@ export class Console extends HeyApiClient { args: [ { in: "query", key: "directory" }, { in: "query", key: "workspace" }, - { in: "body", key: "accountID" }, - { in: "body", key: "orgID" }, + { in: "body", key: "command" }, + { in: "body", key: "args" }, + { in: "body", key: "cwd" }, + { in: "body", key: "title" }, + { in: "body", key: "env" }, ], }, ], ) - return (options?.client ?? this.client).post({ - url: "/experimental/console/switch", + return (options?.client ?? this.client).post({ + url: "/pty", ...options, ...params, headers: { @@ -1071,16 +1155,15 @@ export class Console extends HeyApiClient { }, }) } -} -export class Adaptor extends HeyApiClient { /** - * List workspace adaptors + * Remove PTY session * - * List all available workspace adaptors for the current project. + * Remove and terminate a specific pseudo-terminal (PTY) session. */ - public list( - parameters?: { + public remove( + parameters: { + ptyID: string directory?: string workspace?: string }, @@ -1091,28 +1174,28 @@ export class Adaptor extends HeyApiClient { [ { args: [ + { in: "path", key: "ptyID" }, { in: "query", key: "directory" }, { in: "query", key: "workspace" }, ], }, ], ) - return (options?.client ?? this.client).get({ - url: "/experimental/workspace/adaptor", + return (options?.client ?? this.client).delete({ + url: "/pty/{ptyID}", ...options, ...params, }) } -} -export class Workspace extends HeyApiClient { /** - * List workspaces + * Get PTY session * - * List all workspaces. + * Retrieve detailed information about a specific pseudo-terminal (PTY) session. */ - public list( - parameters?: { + public get( + parameters: { + ptyID: string directory?: string workspace?: string }, @@ -1123,32 +1206,35 @@ export class Workspace extends HeyApiClient { [ { args: [ + { in: "path", key: "ptyID" }, { in: "query", key: "directory" }, { in: "query", key: "workspace" }, ], }, ], ) - return (options?.client ?? this.client).get({ - url: "/experimental/workspace", + return (options?.client ?? this.client).get({ + url: "/pty/{ptyID}", ...options, ...params, }) } /** - * Create workspace + * Update PTY session * - * Create a workspace for the current project. + * Update properties of an existing pseudo-terminal (PTY) session. */ - public create( - parameters?: { + public update( + parameters: { + ptyID: string directory?: string workspace?: string - id?: string - type?: string - branch?: string | null - extra?: unknown | null + title?: string + size?: { + rows: number + cols: number + } }, options?: Options, ) { @@ -1157,22 +1243,17 @@ export class Workspace extends HeyApiClient { [ { args: [ + { in: "path", key: "ptyID" }, { in: "query", key: "directory" }, { in: "query", key: "workspace" }, - { in: "body", key: "id" }, - { in: "body", key: "type" }, - { in: "body", key: "branch" }, - { in: "body", key: "extra" }, + { in: "body", key: "title" }, + { in: "body", key: "size" }, ], }, ], ) - return (options?.client ?? this.client).post< - ExperimentalWorkspaceCreateResponses, - ExperimentalWorkspaceCreateErrors, - ThrowOnError - >({ - url: "/experimental/workspace", + return (options?.client ?? this.client).put({ + url: "/pty/{ptyID}", ...options, ...params, headers: { @@ -1184,12 +1265,13 @@ export class Workspace extends HeyApiClient { } /** - * Workspace status + * Connect to PTY session * - * Get connection status for workspaces in the current project. + * Establish a WebSocket connection to interact with a pseudo-terminal (PTY) session in real-time. */ - public status( - parameters?: { + public connect( + parameters: { + ptyID: string directory?: string workspace?: string }, @@ -1200,27 +1282,29 @@ export class Workspace extends HeyApiClient { [ { args: [ + { in: "path", key: "ptyID" }, { in: "query", key: "directory" }, { in: "query", key: "workspace" }, ], }, ], ) - return (options?.client ?? this.client).get({ - url: "/experimental/workspace/status", + return (options?.client ?? this.client).get({ + url: "/pty/{ptyID}/connect", ...options, ...params, }) } +} +export class Config2 extends HeyApiClient { /** - * Remove workspace + * Get configuration * - * Remove an existing workspace. + * Retrieve the current OpenCode configuration settings and preferences. */ - public remove( - parameters: { - id: string + public get( + parameters?: { directory?: string workspace?: string }, @@ -1231,35 +1315,29 @@ export class Workspace extends HeyApiClient { [ { args: [ - { in: "path", key: "id" }, { in: "query", key: "directory" }, { in: "query", key: "workspace" }, ], }, ], ) - return (options?.client ?? this.client).delete< - ExperimentalWorkspaceRemoveResponses, - ExperimentalWorkspaceRemoveErrors, - ThrowOnError - >({ - url: "/experimental/workspace/{id}", + return (options?.client ?? this.client).get({ + url: "/config", ...options, ...params, }) } /** - * Restore session into workspace + * Update configuration * - * Replay a session's sync events into the target workspace in batches. + * Update OpenCode configuration settings and preferences. */ - public sessionRestore( - parameters: { - id: string + public update( + parameters?: { directory?: string workspace?: string - sessionID?: string + config?: Config3 }, options?: Options, ) { @@ -1268,20 +1346,15 @@ export class Workspace extends HeyApiClient { [ { args: [ - { in: "path", key: "id" }, { in: "query", key: "directory" }, { in: "query", key: "workspace" }, - { in: "body", key: "sessionID" }, + { key: "config", map: "body" }, ], }, ], ) - return (options?.client ?? this.client).post< - ExperimentalWorkspaceSessionRestoreResponses, - ExperimentalWorkspaceSessionRestoreErrors, - ThrowOnError - >({ - url: "/experimental/workspace/{id}/session-restore", + return (options?.client ?? this.client).patch({ + url: "/config", ...options, ...params, headers: { @@ -1292,63 +1365,12 @@ export class Workspace extends HeyApiClient { }) } - private _adaptor?: Adaptor - get adaptor(): Adaptor { - return (this._adaptor ??= new Adaptor({ client: this.client })) - } -} - -export class Session extends HeyApiClient { - /** - * List sessions - * - * Get a list of all OpenCode sessions across projects, sorted by most recently updated. Archived sessions are excluded by default. - */ - public list( - parameters?: { - directory?: string - workspace?: string - roots?: boolean - start?: number - cursor?: number - search?: string - limit?: number - archived?: boolean - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "query", key: "directory" }, - { in: "query", key: "workspace" }, - { in: "query", key: "roots" }, - { in: "query", key: "start" }, - { in: "query", key: "cursor" }, - { in: "query", key: "search" }, - { in: "query", key: "limit" }, - { in: "query", key: "archived" }, - ], - }, - ], - ) - return (options?.client ?? this.client).get({ - url: "/experimental/session", - ...options, - ...params, - }) - } -} - -export class Resource extends HeyApiClient { /** - * Get MCP resources + * List config providers * - * Get all available MCP resources from connected servers. Optionally filter by name. + * Get a list of all configured AI providers and their default models. */ - public list( + public providers( parameters?: { directory?: string workspace?: string @@ -1366,36 +1388,14 @@ export class Resource extends HeyApiClient { }, ], ) - return (options?.client ?? this.client).get({ - url: "/experimental/resource", + return (options?.client ?? this.client).get({ + url: "/config/providers", ...options, ...params, }) } } -export class Experimental extends HeyApiClient { - private _console?: Console - get console(): Console { - return (this._console ??= new Console({ client: this.client })) - } - - private _workspace?: Workspace - get workspace(): Workspace { - return (this._workspace ??= new Workspace({ client: this.client })) - } - - private _session?: Session - get session(): Session { - return (this._session ??= new Session({ client: this.client })) - } - - private _resource?: Resource - get resource(): Resource { - return (this._resource ??= new Resource({ client: this.client })) - } -} - export class Tool extends HeyApiClient { /** * List tool IDs @@ -4314,6 +4314,11 @@ export class OpencodeClient extends HeyApiClient { return (this._app ??= new App({ client: this.client })) } + private _experimental?: Experimental + get experimental(): Experimental { + return (this._experimental ??= new Experimental({ client: this.client })) + } + private _project?: Project get project(): Project { return (this._project ??= new Project({ client: this.client })) @@ -4329,11 +4334,6 @@ export class OpencodeClient extends HeyApiClient { return (this._config ??= new Config2({ client: this.client })) } - private _experimental?: Experimental - get experimental(): Experimental { - return (this._experimental ??= new Experimental({ client: this.client })) - } - private _tool?: Tool get tool(): Tool { return (this._tool ??= new Tool({ client: this.client })) diff --git a/packages/sdk/js/src/v2/gen/types.gen.ts b/packages/sdk/js/src/v2/gen/types.gen.ts index 25c3cfa66..839dae8b2 100644 --- a/packages/sdk/js/src/v2/gen/types.gen.ts +++ b/packages/sdk/js/src/v2/gen/types.gen.ts @@ -1706,6 +1706,16 @@ export type WellKnownAuth = { export type Auth = OAuth | ApiAuth | WellKnownAuth +export type Workspace = { + id: string + type: string + name: string + branch: string | null + directory: string | null + extra: unknown | null + projectID: string +} + export type NotFoundError = { name: "NotFoundError" data: { @@ -1808,16 +1818,6 @@ export type ToolListItem = { export type ToolList = Array -export type Workspace = { - id: string - type: string - name: string - branch: string | null - directory: string | null - extra: unknown | null - projectID: string -} - export type Worktree = { name: string branch: string @@ -2394,6 +2394,177 @@ export type AppLogResponses = { export type AppLogResponse = AppLogResponses[keyof AppLogResponses] +export type ExperimentalWorkspaceAdaptorListData = { + body?: never + path?: never + query?: { + directory?: string + workspace?: string + } + url: "/experimental/workspace/adaptor" +} + +export type ExperimentalWorkspaceAdaptorListResponses = { + /** + * Workspace adaptors + */ + 200: Array<{ + type: string + name: string + description: string + }> +} + +export type ExperimentalWorkspaceAdaptorListResponse = + ExperimentalWorkspaceAdaptorListResponses[keyof ExperimentalWorkspaceAdaptorListResponses] + +export type ExperimentalWorkspaceListData = { + body?: never + path?: never + query?: { + directory?: string + workspace?: string + } + url: "/experimental/workspace" +} + +export type ExperimentalWorkspaceListResponses = { + /** + * Workspaces + */ + 200: Array +} + +export type ExperimentalWorkspaceListResponse = + ExperimentalWorkspaceListResponses[keyof ExperimentalWorkspaceListResponses] + +export type ExperimentalWorkspaceCreateData = { + body?: { + id?: string + type: string + branch: string | null + extra: unknown | null + } + path?: never + query?: { + directory?: string + workspace?: string + } + url: "/experimental/workspace" +} + +export type ExperimentalWorkspaceCreateErrors = { + /** + * Bad request + */ + 400: BadRequestError +} + +export type ExperimentalWorkspaceCreateError = + ExperimentalWorkspaceCreateErrors[keyof ExperimentalWorkspaceCreateErrors] + +export type ExperimentalWorkspaceCreateResponses = { + /** + * Workspace created + */ + 200: Workspace +} + +export type ExperimentalWorkspaceCreateResponse = + ExperimentalWorkspaceCreateResponses[keyof ExperimentalWorkspaceCreateResponses] + +export type ExperimentalWorkspaceStatusData = { + body?: never + path?: never + query?: { + directory?: string + workspace?: string + } + url: "/experimental/workspace/status" +} + +export type ExperimentalWorkspaceStatusResponses = { + /** + * Workspace status + */ + 200: Array<{ + workspaceID: string + status: "connected" | "connecting" | "disconnected" | "error" + error?: string + }> +} + +export type ExperimentalWorkspaceStatusResponse = + ExperimentalWorkspaceStatusResponses[keyof ExperimentalWorkspaceStatusResponses] + +export type ExperimentalWorkspaceRemoveData = { + body?: never + path: { + id: string + } + query?: { + directory?: string + workspace?: string + } + url: "/experimental/workspace/{id}" +} + +export type ExperimentalWorkspaceRemoveErrors = { + /** + * Bad request + */ + 400: BadRequestError +} + +export type ExperimentalWorkspaceRemoveError = + ExperimentalWorkspaceRemoveErrors[keyof ExperimentalWorkspaceRemoveErrors] + +export type ExperimentalWorkspaceRemoveResponses = { + /** + * Workspace removed + */ + 200: Workspace +} + +export type ExperimentalWorkspaceRemoveResponse = + ExperimentalWorkspaceRemoveResponses[keyof ExperimentalWorkspaceRemoveResponses] + +export type ExperimentalWorkspaceSessionRestoreData = { + body?: { + sessionID: string + } + path: { + id: string + } + query?: { + directory?: string + workspace?: string + } + url: "/experimental/workspace/{id}/session-restore" +} + +export type ExperimentalWorkspaceSessionRestoreErrors = { + /** + * Bad request + */ + 400: BadRequestError +} + +export type ExperimentalWorkspaceSessionRestoreError = + ExperimentalWorkspaceSessionRestoreErrors[keyof ExperimentalWorkspaceSessionRestoreErrors] + +export type ExperimentalWorkspaceSessionRestoreResponses = { + /** + * Session replay started + */ + 200: { + total: number + } +} + +export type ExperimentalWorkspaceSessionRestoreResponse = + ExperimentalWorkspaceSessionRestoreResponses[keyof ExperimentalWorkspaceSessionRestoreResponses] + export type ProjectListData = { body?: never path?: never @@ -2883,177 +3054,6 @@ export type ToolListResponses = { export type ToolListResponse = ToolListResponses[keyof ToolListResponses] -export type ExperimentalWorkspaceAdaptorListData = { - body?: never - path?: never - query?: { - directory?: string - workspace?: string - } - url: "/experimental/workspace/adaptor" -} - -export type ExperimentalWorkspaceAdaptorListResponses = { - /** - * Workspace adaptors - */ - 200: Array<{ - type: string - name: string - description: string - }> -} - -export type ExperimentalWorkspaceAdaptorListResponse = - ExperimentalWorkspaceAdaptorListResponses[keyof ExperimentalWorkspaceAdaptorListResponses] - -export type ExperimentalWorkspaceListData = { - body?: never - path?: never - query?: { - directory?: string - workspace?: string - } - url: "/experimental/workspace" -} - -export type ExperimentalWorkspaceListResponses = { - /** - * Workspaces - */ - 200: Array -} - -export type ExperimentalWorkspaceListResponse = - ExperimentalWorkspaceListResponses[keyof ExperimentalWorkspaceListResponses] - -export type ExperimentalWorkspaceCreateData = { - body?: { - id?: string - type: string - branch: string | null - extra: unknown | null - } - path?: never - query?: { - directory?: string - workspace?: string - } - url: "/experimental/workspace" -} - -export type ExperimentalWorkspaceCreateErrors = { - /** - * Bad request - */ - 400: BadRequestError -} - -export type ExperimentalWorkspaceCreateError = - ExperimentalWorkspaceCreateErrors[keyof ExperimentalWorkspaceCreateErrors] - -export type ExperimentalWorkspaceCreateResponses = { - /** - * Workspace created - */ - 200: Workspace -} - -export type ExperimentalWorkspaceCreateResponse = - ExperimentalWorkspaceCreateResponses[keyof ExperimentalWorkspaceCreateResponses] - -export type ExperimentalWorkspaceStatusData = { - body?: never - path?: never - query?: { - directory?: string - workspace?: string - } - url: "/experimental/workspace/status" -} - -export type ExperimentalWorkspaceStatusResponses = { - /** - * Workspace status - */ - 200: Array<{ - workspaceID: string - status: "connected" | "connecting" | "disconnected" | "error" - error?: string - }> -} - -export type ExperimentalWorkspaceStatusResponse = - ExperimentalWorkspaceStatusResponses[keyof ExperimentalWorkspaceStatusResponses] - -export type ExperimentalWorkspaceRemoveData = { - body?: never - path: { - id: string - } - query?: { - directory?: string - workspace?: string - } - url: "/experimental/workspace/{id}" -} - -export type ExperimentalWorkspaceRemoveErrors = { - /** - * Bad request - */ - 400: BadRequestError -} - -export type ExperimentalWorkspaceRemoveError = - ExperimentalWorkspaceRemoveErrors[keyof ExperimentalWorkspaceRemoveErrors] - -export type ExperimentalWorkspaceRemoveResponses = { - /** - * Workspace removed - */ - 200: Workspace -} - -export type ExperimentalWorkspaceRemoveResponse = - ExperimentalWorkspaceRemoveResponses[keyof ExperimentalWorkspaceRemoveResponses] - -export type ExperimentalWorkspaceSessionRestoreData = { - body?: { - sessionID: string - } - path: { - id: string - } - query?: { - directory?: string - workspace?: string - } - url: "/experimental/workspace/{id}/session-restore" -} - -export type ExperimentalWorkspaceSessionRestoreErrors = { - /** - * Bad request - */ - 400: BadRequestError -} - -export type ExperimentalWorkspaceSessionRestoreError = - ExperimentalWorkspaceSessionRestoreErrors[keyof ExperimentalWorkspaceSessionRestoreErrors] - -export type ExperimentalWorkspaceSessionRestoreResponses = { - /** - * Session replay started - */ - 200: { - total: number - } -} - -export type ExperimentalWorkspaceSessionRestoreResponse = - ExperimentalWorkspaceSessionRestoreResponses[keyof ExperimentalWorkspaceSessionRestoreResponses] - export type WorktreeRemoveData = { body?: WorktreeRemoveInput path?: never diff --git a/packages/sdk/openapi.json b/packages/sdk/openapi.json index 9193b11ad..cf14026ea 100644 --- a/packages/sdk/openapi.json +++ b/packages/sdk/openapi.json @@ -415,9 +415,9 @@ ] } }, - "/project": { + "/experimental/workspace/adaptor": { "get": { - "operationId": "project.list", + "operationId": "experimental.workspace.adaptor.list", "parameters": [ { "in": "query", @@ -434,17 +434,29 @@ } } ], - "summary": "List all projects", - "description": "Get a list of projects that have been opened with OpenCode.", + "summary": "List workspace adaptors", + "description": "List all available workspace adaptors for the current project.", "responses": { "200": { - "description": "List of projects", + "description": "Workspace adaptors", "content": { "application/json": { "schema": { "type": "array", "items": { - "$ref": "#/components/schemas/Project" + "type": "object", + "properties": { + "type": { + "type": "string" + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + } + }, + "required": ["type", "name", "description"] } } } @@ -454,14 +466,14 @@ "x-codeSamples": [ { "lang": "js", - "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.project.list({\n ...\n})" + "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.experimental.workspace.adaptor.list({\n ...\n})" } ] } }, - "/project/current": { - "get": { - "operationId": "project.current", + "/experimental/workspace": { + "post": { + "operationId": "experimental.workspace.create", "parameters": [ { "in": "query", @@ -478,31 +490,76 @@ } } ], - "summary": "Get current project", - "description": "Retrieve the currently active project that OpenCode is working with.", + "summary": "Create workspace", + "description": "Create a workspace for the current project.", "responses": { "200": { - "description": "Current project information", + "description": "Workspace created", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Project" + "$ref": "#/components/schemas/Workspace" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BadRequestError" } } } } }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "id": { + "type": "string", + "pattern": "^wrk.*" + }, + "type": { + "type": "string" + }, + "branch": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "extra": { + "anyOf": [ + {}, + { + "type": "null" + } + ] + } + }, + "required": ["type", "branch", "extra"] + } + } + } + }, "x-codeSamples": [ { "lang": "js", - "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.project.current({\n ...\n})" + "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.experimental.workspace.create({\n ...\n})" } ] - } - }, - "/project/git/init": { - "post": { - "operationId": "project.initGit", + }, + "get": { + "operationId": "experimental.workspace.list", "parameters": [ { "in": "query", @@ -519,15 +576,18 @@ } } ], - "summary": "Initialize git repository", - "description": "Create a git repository for the current project and return the refreshed project info.", + "summary": "List workspaces", + "description": "List all workspaces.", "responses": { "200": { - "description": "Project information after git initialization", + "description": "Workspaces", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Project" + "type": "array", + "items": { + "$ref": "#/components/schemas/Workspace" + } } } } @@ -536,14 +596,14 @@ "x-codeSamples": [ { "lang": "js", - "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.project.initGit({\n ...\n})" + "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.experimental.workspace.list({\n ...\n})" } ] } }, - "/project/{projectID}": { - "patch": { - "operationId": "project.update", + "/experimental/workspace/status": { + "get": { + "operationId": "experimental.workspace.status", "parameters": [ { "in": "query", @@ -558,81 +618,33 @@ "schema": { "type": "string" } - }, - { - "in": "path", - "name": "projectID", - "schema": { - "type": "string" - }, - "required": true } ], - "summary": "Update project", - "description": "Update project properties such as name, icon, and commands.", + "summary": "Workspace status", + "description": "Get connection status for workspaces in the current project.", "responses": { "200": { - "description": "Updated project information", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Project" - } - } - } - }, - "400": { - "description": "Bad request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/BadRequestError" - } - } - } - }, - "404": { - "description": "Not found", + "description": "Workspace status", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/NotFoundError" - } - } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "icon": { + "type": "array", + "items": { "type": "object", "properties": { - "url": { - "type": "string" + "workspaceID": { + "type": "string", + "pattern": "^wrk.*" }, - "override": { - "type": "string" + "status": { + "type": "string", + "enum": ["connected", "connecting", "disconnected", "error"] }, - "color": { - "type": "string" - } - } - }, - "commands": { - "type": "object", - "properties": { - "start": { - "description": "Startup script to run when creating a new workspace (worktree)", + "error": { "type": "string" } - } + }, + "required": ["workspaceID", "status"] } } } @@ -642,14 +654,14 @@ "x-codeSamples": [ { "lang": "js", - "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.project.update({\n ...\n})" + "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.experimental.workspace.status({\n ...\n})" } ] } }, - "/pty": { - "get": { - "operationId": "pty.list", + "/experimental/workspace/{id}": { + "delete": { + "operationId": "experimental.workspace.remove", "parameters": [ { "in": "query", @@ -664,20 +676,36 @@ "schema": { "type": "string" } + }, + { + "in": "path", + "name": "id", + "schema": { + "type": "string", + "pattern": "^wrk.*" + }, + "required": true } ], - "summary": "List PTY sessions", - "description": "Get a list of all active pseudo-terminal (PTY) sessions managed by OpenCode.", + "summary": "Remove workspace", + "description": "Remove an existing workspace.", "responses": { "200": { - "description": "List of sessions", + "description": "Workspace removed", "content": { "application/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Pty" - } + "$ref": "#/components/schemas/Workspace" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BadRequestError" } } } @@ -686,12 +714,14 @@ "x-codeSamples": [ { "lang": "js", - "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.pty.list({\n ...\n})" + "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.experimental.workspace.remove({\n ...\n})" } ] - }, + } + }, + "/experimental/workspace/{id}/session-restore": { "post": { - "operationId": "pty.create", + "operationId": "experimental.workspace.sessionRestore", "parameters": [ { "in": "query", @@ -706,19 +736,36 @@ "schema": { "type": "string" } + }, + { + "in": "path", + "name": "id", + "schema": { + "type": "string", + "pattern": "^wrk.*" + }, + "required": true } ], - "summary": "Create PTY session", - "description": "Create a new pseudo-terminal (PTY) session for running shell commands and processes.", + "summary": "Restore session into workspace", + "description": "Replay a session's sync events into the target workspace in batches.", "responses": { "200": { - "description": "Created session", + "description": "Session replay started", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Pty" - } - } + "type": "object", + "properties": { + "total": { + "type": "integer", + "minimum": 0, + "maximum": 9007199254740991 + } + }, + "required": ["total"] + } + } } }, "400": { @@ -738,31 +785,12 @@ "schema": { "type": "object", "properties": { - "command": { - "type": "string" - }, - "args": { - "type": "array", - "items": { - "type": "string" - } - }, - "cwd": { - "type": "string" - }, - "title": { - "type": "string" - }, - "env": { - "type": "object", - "propertyNames": { - "type": "string" - }, - "additionalProperties": { - "type": "string" - } + "sessionID": { + "type": "string", + "pattern": "^ses.*" } - } + }, + "required": ["sessionID"] } } } @@ -770,14 +798,14 @@ "x-codeSamples": [ { "lang": "js", - "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.pty.create({\n ...\n})" + "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.experimental.workspace.sessionRestore({\n ...\n})" } ] } }, - "/pty/{ptyID}": { + "/project": { "get": { - "operationId": "pty.get", + "operationId": "project.list", "parameters": [ { "in": "query", @@ -792,36 +820,20 @@ "schema": { "type": "string" } - }, - { - "in": "path", - "name": "ptyID", - "schema": { - "type": "string", - "pattern": "^pty.*" - }, - "required": true } ], - "summary": "Get PTY session", - "description": "Retrieve detailed information about a specific pseudo-terminal (PTY) session.", + "summary": "List all projects", + "description": "Get a list of projects that have been opened with OpenCode.", "responses": { "200": { - "description": "Session info", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Pty" - } - } - } - }, - "404": { - "description": "Not found", + "description": "List of projects", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/NotFoundError" + "type": "array", + "items": { + "$ref": "#/components/schemas/Project" + } } } } @@ -830,12 +842,14 @@ "x-codeSamples": [ { "lang": "js", - "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.pty.get({\n ...\n})" + "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.project.list({\n ...\n})" } ] - }, - "put": { - "operationId": "pty.update", + } + }, + "/project/current": { + "get": { + "operationId": "project.current", "parameters": [ { "in": "query", @@ -850,62 +864,17 @@ "schema": { "type": "string" } - }, - { - "in": "path", - "name": "ptyID", - "schema": { - "type": "string", - "pattern": "^pty.*" - }, - "required": true } ], - "summary": "Update PTY session", - "description": "Update properties of an existing pseudo-terminal (PTY) session.", + "summary": "Get current project", + "description": "Retrieve the currently active project that OpenCode is working with.", "responses": { "200": { - "description": "Updated session", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Pty" - } - } - } - }, - "400": { - "description": "Bad request", + "description": "Current project information", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BadRequestError" - } - } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "title": { - "type": "string" - }, - "size": { - "type": "object", - "properties": { - "rows": { - "type": "number" - }, - "cols": { - "type": "number" - } - }, - "required": ["rows", "cols"] - } + "$ref": "#/components/schemas/Project" } } } @@ -914,12 +883,14 @@ "x-codeSamples": [ { "lang": "js", - "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.pty.update({\n ...\n})" + "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.project.current({\n ...\n})" } ] - }, - "delete": { - "operationId": "pty.remove", + } + }, + "/project/git/init": { + "post": { + "operationId": "project.initGit", "parameters": [ { "in": "query", @@ -934,36 +905,17 @@ "schema": { "type": "string" } - }, - { - "in": "path", - "name": "ptyID", - "schema": { - "type": "string", - "pattern": "^pty.*" - }, - "required": true } ], - "summary": "Remove PTY session", - "description": "Remove and terminate a specific pseudo-terminal (PTY) session.", + "summary": "Initialize git repository", + "description": "Create a git repository for the current project and return the refreshed project info.", "responses": { "200": { - "description": "Session removed", - "content": { - "application/json": { - "schema": { - "type": "boolean" - } - } - } - }, - "404": { - "description": "Not found", + "description": "Project information after git initialization", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/NotFoundError" + "$ref": "#/components/schemas/Project" } } } @@ -972,14 +924,14 @@ "x-codeSamples": [ { "lang": "js", - "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.pty.remove({\n ...\n})" + "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.project.initGit({\n ...\n})" } ] } }, - "/pty/{ptyID}/connect": { - "get": { - "operationId": "pty.connect", + "/project/{projectID}": { + "patch": { + "operationId": "project.update", "parameters": [ { "in": "query", @@ -997,23 +949,32 @@ }, { "in": "path", - "name": "ptyID", + "name": "projectID", "schema": { - "type": "string", - "pattern": "^pty.*" + "type": "string" }, "required": true } ], - "summary": "Connect to PTY session", - "description": "Establish a WebSocket connection to interact with a pseudo-terminal (PTY) session in real-time.", + "summary": "Update project", + "description": "Update project properties such as name, icon, and commands.", "responses": { "200": { - "description": "Connected session", + "description": "Updated project information", "content": { "application/json": { "schema": { - "type": "boolean" + "$ref": "#/components/schemas/Project" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BadRequestError" } } } @@ -1029,17 +990,54 @@ } } }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "icon": { + "type": "object", + "properties": { + "url": { + "type": "string" + }, + "override": { + "type": "string" + }, + "color": { + "type": "string" + } + } + }, + "commands": { + "type": "object", + "properties": { + "start": { + "description": "Startup script to run when creating a new workspace (worktree)", + "type": "string" + } + } + } + } + } + } + } + }, "x-codeSamples": [ { "lang": "js", - "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.pty.connect({\n ...\n})" + "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.project.update({\n ...\n})" } ] } }, - "/config": { + "/pty": { "get": { - "operationId": "config.get", + "operationId": "pty.list", "parameters": [ { "in": "query", @@ -1056,15 +1054,18 @@ } } ], - "summary": "Get configuration", - "description": "Retrieve the current OpenCode configuration settings and preferences.", + "summary": "List PTY sessions", + "description": "Get a list of all active pseudo-terminal (PTY) sessions managed by OpenCode.", "responses": { "200": { - "description": "Get config info", + "description": "List of sessions", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Config" + "type": "array", + "items": { + "$ref": "#/components/schemas/Pty" + } } } } @@ -1073,12 +1074,12 @@ "x-codeSamples": [ { "lang": "js", - "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.config.get({\n ...\n})" + "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.pty.list({\n ...\n})" } ] }, - "patch": { - "operationId": "config.update", + "post": { + "operationId": "pty.create", "parameters": [ { "in": "query", @@ -1095,15 +1096,15 @@ } } ], - "summary": "Update configuration", - "description": "Update OpenCode configuration settings and preferences.", + "summary": "Create PTY session", + "description": "Create a new pseudo-terminal (PTY) session for running shell commands and processes.", "responses": { "200": { - "description": "Successfully updated config", + "description": "Created session", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Config" + "$ref": "#/components/schemas/Pty" } } } @@ -1123,7 +1124,33 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Config" + "type": "object", + "properties": { + "command": { + "type": "string" + }, + "args": { + "type": "array", + "items": { + "type": "string" + } + }, + "cwd": { + "type": "string" + }, + "title": { + "type": "string" + }, + "env": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "string" + } + } + } } } } @@ -1131,14 +1158,14 @@ "x-codeSamples": [ { "lang": "js", - "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.config.update({\n ...\n})" + "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.pty.create({\n ...\n})" } ] } }, - "/config/providers": { + "/pty/{ptyID}": { "get": { - "operationId": "config.providers", + "operationId": "pty.get", "parameters": [ { "in": "query", @@ -1153,35 +1180,36 @@ "schema": { "type": "string" } + }, + { + "in": "path", + "name": "ptyID", + "schema": { + "type": "string", + "pattern": "^pty.*" + }, + "required": true } ], - "summary": "List config providers", - "description": "Get a list of all configured AI providers and their default models.", + "summary": "Get PTY session", + "description": "Retrieve detailed information about a specific pseudo-terminal (PTY) session.", "responses": { "200": { - "description": "List of providers", + "description": "Session info", "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"] + "$ref": "#/components/schemas/Pty" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NotFoundError" } } } @@ -1190,14 +1218,12 @@ "x-codeSamples": [ { "lang": "js", - "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.config.providers({\n ...\n})" + "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.pty.get({\n ...\n})" } ] - } - }, - "/experimental/console": { - "get": { - "operationId": "experimental.console.get", + }, + "put": { + "operationId": "pty.update", "parameters": [ { "in": "query", @@ -1212,34 +1238,62 @@ "schema": { "type": "string" } + }, + { + "in": "path", + "name": "ptyID", + "schema": { + "type": "string", + "pattern": "^pty.*" + }, + "required": true } ], - "summary": "Get active Console provider metadata", - "description": "Get the active Console org name and the set of provider IDs managed by that Console org.", + "summary": "Update PTY session", + "description": "Update properties of an existing pseudo-terminal (PTY) session.", "responses": { "200": { - "description": "Active Console provider metadata", + "description": "Updated session", "content": { "application/json": { "schema": { - "type": "object", - "properties": { - "consoleManagedProviders": { - "type": "array", - "items": { - "type": "string" + "$ref": "#/components/schemas/Pty" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BadRequestError" + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "title": { + "type": "string" + }, + "size": { + "type": "object", + "properties": { + "rows": { + "type": "number" + }, + "cols": { + "type": "number" } }, - "activeOrgName": { - "type": "string" - }, - "switchableOrgCount": { - "type": "integer", - "minimum": 0, - "maximum": 9007199254740991 - } - }, - "required": ["consoleManagedProviders", "switchableOrgCount"] + "required": ["rows", "cols"] + } } } } @@ -1248,14 +1302,12 @@ "x-codeSamples": [ { "lang": "js", - "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.experimental.console.get({\n ...\n})" + "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.pty.update({\n ...\n})" } ] - } - }, - "/experimental/console/orgs": { - "get": { - "operationId": "experimental.console.listOrgs", + }, + "delete": { + "operationId": "pty.remove", "parameters": [ { "in": "query", @@ -1270,47 +1322,36 @@ "schema": { "type": "string" } + }, + { + "in": "path", + "name": "ptyID", + "schema": { + "type": "string", + "pattern": "^pty.*" + }, + "required": true } ], - "summary": "List switchable Console orgs", - "description": "Get the available Console orgs across logged-in accounts, including the current active org.", + "summary": "Remove PTY session", + "description": "Remove and terminate a specific pseudo-terminal (PTY) session.", "responses": { "200": { - "description": "Switchable Console orgs", + "description": "Session removed", "content": { "application/json": { "schema": { - "type": "object", - "properties": { - "orgs": { - "type": "array", - "items": { - "type": "object", - "properties": { - "accountID": { - "type": "string" - }, - "accountEmail": { - "type": "string" - }, - "accountUrl": { - "type": "string" - }, - "orgID": { - "type": "string" - }, - "orgName": { - "type": "string" - }, - "active": { - "type": "boolean" - } - }, - "required": ["accountID", "accountEmail", "accountUrl", "orgID", "orgName", "active"] - } - } - }, - "required": ["orgs"] + "type": "boolean" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NotFoundError" } } } @@ -1319,14 +1360,14 @@ "x-codeSamples": [ { "lang": "js", - "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.experimental.console.listOrgs({\n ...\n})" + "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.pty.remove({\n ...\n})" } ] } }, - "/experimental/console/switch": { - "post": { - "operationId": "experimental.console.switchOrg", + "/pty/{ptyID}/connect": { + "get": { + "operationId": "pty.connect", "parameters": [ { "in": "query", @@ -1341,13 +1382,22 @@ "schema": { "type": "string" } + }, + { + "in": "path", + "name": "ptyID", + "schema": { + "type": "string", + "pattern": "^pty.*" + }, + "required": true } ], - "summary": "Switch active Console org", - "description": "Persist a new active Console account/org selection for the current local OpenCode state.", + "summary": "Connect to PTY session", + "description": "Establish a WebSocket connection to interact with a pseudo-terminal (PTY) session in real-time.", "responses": { "200": { - "description": "Switch success", + "description": "Connected session", "content": { "application/json": { "schema": { @@ -1355,22 +1405,14 @@ } } } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "accountID": { - "type": "string" - }, - "orgID": { - "type": "string" - } - }, - "required": ["accountID", "orgID"] + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NotFoundError" + } } } } @@ -1378,14 +1420,14 @@ "x-codeSamples": [ { "lang": "js", - "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.experimental.console.switchOrg({\n ...\n})" + "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.pty.connect({\n ...\n})" } ] } }, - "/experimental/tool/ids": { + "/config": { "get": { - "operationId": "tool.ids", + "operationId": "config.get", "parameters": [ { "in": "query", @@ -1402,25 +1444,15 @@ } } ], - "summary": "List tool IDs", - "description": "Get a list of all available tool IDs, including both built-in tools and dynamically registered tools.", + "summary": "Get configuration", + "description": "Retrieve the current OpenCode configuration settings and preferences.", "responses": { "200": { - "description": "Tool IDs", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ToolIDs" - } - } - } - }, - "400": { - "description": "Bad request", + "description": "Get config info", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BadRequestError" + "$ref": "#/components/schemas/Config" } } } @@ -1429,14 +1461,12 @@ "x-codeSamples": [ { "lang": "js", - "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.tool.ids({\n ...\n})" + "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.config.get({\n ...\n})" } ] - } - }, - "/experimental/tool": { - "get": { - "operationId": "tool.list", + }, + "patch": { + "operationId": "config.update", "parameters": [ { "in": "query", @@ -1451,33 +1481,17 @@ "schema": { "type": "string" } - }, - { - "in": "query", - "name": "provider", - "schema": { - "type": "string" - }, - "required": true - }, - { - "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.", + "summary": "Update configuration", + "description": "Update OpenCode configuration settings and preferences.", "responses": { "200": { - "description": "Tools", + "description": "Successfully updated config", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ToolList" + "$ref": "#/components/schemas/Config" } } } @@ -1493,17 +1507,26 @@ } } }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Config" + } + } + } + }, "x-codeSamples": [ { "lang": "js", - "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.tool.list({\n ...\n})" + "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.config.update({\n ...\n})" } ] } }, - "/experimental/workspace/adaptor": { + "/config/providers": { "get": { - "operationId": "experimental.workspace.adaptor.list", + "operationId": "config.providers", "parameters": [ { "in": "query", @@ -1520,30 +1543,33 @@ } } ], - "summary": "List workspace adaptors", - "description": "List all available workspace adaptors for the current project.", + "summary": "List config providers", + "description": "Get a list of all configured AI providers and their default models.", "responses": { "200": { - "description": "Workspace adaptors", + "description": "List of providers", "content": { "application/json": { "schema": { - "type": "array", - "items": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "name": { + "type": "object", + "properties": { + "providers": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Provider" + } + }, + "default": { + "type": "object", + "propertyNames": { "type": "string" }, - "description": { + "additionalProperties": { "type": "string" } - }, - "required": ["type", "name", "description"] - } + } + }, + "required": ["providers", "default"] } } } @@ -1552,14 +1578,14 @@ "x-codeSamples": [ { "lang": "js", - "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.experimental.workspace.adaptor.list({\n ...\n})" + "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.config.providers({\n ...\n})" } ] } }, - "/experimental/workspace": { - "post": { - "operationId": "experimental.workspace.create", + "/experimental/console": { + "get": { + "operationId": "experimental.console.get", "parameters": [ { "in": "query", @@ -1576,63 +1602,33 @@ } } ], - "summary": "Create workspace", - "description": "Create a workspace for the current project.", + "summary": "Get active Console provider metadata", + "description": "Get the active Console org name and the set of provider IDs managed by that Console org.", "responses": { "200": { - "description": "Workspace created", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Workspace" - } - } - } - }, - "400": { - "description": "Bad request", + "description": "Active Console provider metadata", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BadRequestError" - } - } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "id": { - "type": "string", - "pattern": "^wrk.*" - }, - "type": { - "type": "string" - }, - "branch": { - "anyOf": [ - { + "type": "object", + "properties": { + "consoleManagedProviders": { + "type": "array", + "items": { "type": "string" - }, - { - "type": "null" } - ] + }, + "activeOrgName": { + "type": "string" + }, + "switchableOrgCount": { + "type": "integer", + "minimum": 0, + "maximum": 9007199254740991 + } }, - "extra": { - "anyOf": [ - {}, - { - "type": "null" - } - ] - } - }, - "required": ["type", "branch", "extra"] + "required": ["consoleManagedProviders", "switchableOrgCount"] + } } } } @@ -1640,12 +1636,14 @@ "x-codeSamples": [ { "lang": "js", - "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.experimental.workspace.create({\n ...\n})" + "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.experimental.console.get({\n ...\n})" } ] - }, + } + }, + "/experimental/console/orgs": { "get": { - "operationId": "experimental.workspace.list", + "operationId": "experimental.console.listOrgs", "parameters": [ { "in": "query", @@ -1662,18 +1660,45 @@ } } ], - "summary": "List workspaces", - "description": "List all workspaces.", + "summary": "List switchable Console orgs", + "description": "Get the available Console orgs across logged-in accounts, including the current active org.", "responses": { "200": { - "description": "Workspaces", + "description": "Switchable Console orgs", "content": { "application/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Workspace" - } + "type": "object", + "properties": { + "orgs": { + "type": "array", + "items": { + "type": "object", + "properties": { + "accountID": { + "type": "string" + }, + "accountEmail": { + "type": "string" + }, + "accountUrl": { + "type": "string" + }, + "orgID": { + "type": "string" + }, + "orgName": { + "type": "string" + }, + "active": { + "type": "boolean" + } + }, + "required": ["accountID", "accountEmail", "accountUrl", "orgID", "orgName", "active"] + } + } + }, + "required": ["orgs"] } } } @@ -1682,14 +1707,14 @@ "x-codeSamples": [ { "lang": "js", - "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.experimental.workspace.list({\n ...\n})" + "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.experimental.console.listOrgs({\n ...\n})" } ] } }, - "/experimental/workspace/status": { - "get": { - "operationId": "experimental.workspace.status", + "/experimental/console/switch": { + "post": { + "operationId": "experimental.console.switchOrg", "parameters": [ { "in": "query", @@ -1706,48 +1731,49 @@ } } ], - "summary": "Workspace status", - "description": "Get connection status for workspaces in the current project.", + "summary": "Switch active Console org", + "description": "Persist a new active Console account/org selection for the current local OpenCode state.", "responses": { "200": { - "description": "Workspace status", + "description": "Switch success", "content": { "application/json": { "schema": { - "type": "array", - "items": { - "type": "object", - "properties": { - "workspaceID": { - "type": "string", - "pattern": "^wrk.*" - }, - "status": { - "type": "string", - "enum": ["connected", "connecting", "disconnected", "error"] - }, - "error": { - "type": "string" - } - }, - "required": ["workspaceID", "status"] - } + "type": "boolean" } } } } }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "accountID": { + "type": "string" + }, + "orgID": { + "type": "string" + } + }, + "required": ["accountID", "orgID"] + } + } + } + }, "x-codeSamples": [ { "lang": "js", - "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.experimental.workspace.status({\n ...\n})" + "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.experimental.console.switchOrg({\n ...\n})" } ] } }, - "/experimental/workspace/{id}": { - "delete": { - "operationId": "experimental.workspace.remove", + "/experimental/tool/ids": { + "get": { + "operationId": "tool.ids", "parameters": [ { "in": "query", @@ -1762,26 +1788,17 @@ "schema": { "type": "string" } - }, - { - "in": "path", - "name": "id", - "schema": { - "type": "string", - "pattern": "^wrk.*" - }, - "required": true } ], - "summary": "Remove workspace", - "description": "Remove an existing workspace.", + "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": "Workspace removed", + "description": "Tool IDs", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Workspace" + "$ref": "#/components/schemas/ToolIDs" } } } @@ -1800,14 +1817,14 @@ "x-codeSamples": [ { "lang": "js", - "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.experimental.workspace.remove({\n ...\n})" + "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.tool.ids({\n ...\n})" } ] } }, - "/experimental/workspace/{id}/session-restore": { - "post": { - "operationId": "experimental.workspace.sessionRestore", + "/experimental/tool": { + "get": { + "operationId": "tool.list", "parameters": [ { "in": "query", @@ -1824,32 +1841,31 @@ } }, { - "in": "path", - "name": "id", + "in": "query", + "name": "provider", "schema": { - "type": "string", - "pattern": "^wrk.*" + "type": "string" + }, + "required": true + }, + { + "in": "query", + "name": "model", + "schema": { + "type": "string" }, "required": true } ], - "summary": "Restore session into workspace", - "description": "Replay a session's sync events into the target workspace in batches.", + "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": "Session replay started", + "description": "Tools", "content": { "application/json": { "schema": { - "type": "object", - "properties": { - "total": { - "type": "integer", - "minimum": 0, - "maximum": 9007199254740991 - } - }, - "required": ["total"] + "$ref": "#/components/schemas/ToolList" } } } @@ -1865,26 +1881,10 @@ } } }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "sessionID": { - "type": "string", - "pattern": "^ses.*" - } - }, - "required": ["sessionID"] - } - } - } - }, "x-codeSamples": [ { "lang": "js", - "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.experimental.workspace.sessionRestore({\n ...\n})" + "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.tool.list({\n ...\n})" } ] } @@ -12003,6 +12003,53 @@ } ] }, + "Workspace": { + "type": "object", + "properties": { + "id": { + "type": "string", + "pattern": "^wrk.*" + }, + "type": { + "type": "string" + }, + "name": { + "type": "string" + }, + "branch": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "directory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "extra": { + "anyOf": [ + {}, + { + "type": "null" + } + ] + }, + "projectID": { + "type": "string" + } + }, + "required": ["id", "type", "name", "branch", "directory", "extra", "projectID"] + }, "NotFoundError": { "type": "object", "properties": { @@ -12309,53 +12356,6 @@ "$ref": "#/components/schemas/ToolListItem" } }, - "Workspace": { - "type": "object", - "properties": { - "id": { - "type": "string", - "pattern": "^wrk.*" - }, - "type": { - "type": "string" - }, - "name": { - "type": "string" - }, - "branch": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - }, - "directory": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - }, - "extra": { - "anyOf": [ - {}, - { - "type": "null" - } - ] - }, - "projectID": { - "type": "string" - } - }, - "required": ["id", "type", "name", "branch", "directory", "extra", "projectID"] - }, "Worktree": { "type": "object", "properties": { -- cgit v1.2.3