summaryrefslogtreecommitdiffhomepage
path: root/packages/sdk
diff options
context:
space:
mode:
authorJames Long <[email protected]>2026-04-17 02:06:20 -0400
committerGitHub <[email protected]>2026-04-17 02:06:20 -0400
commit7605acff650db0d41d80429b662b5c0725d89675 (patch)
treeb16d017a0f5380224f1cce2a6169492a37efda0d /packages/sdk
parente7f8f7fa3bceab49b1606de72d969be63c3e8785 (diff)
downloadopencode-7605acff650db0d41d80429b662b5c0725d89675.tar.gz
opencode-7605acff650db0d41d80429b662b5c0725d89675.zip
refactor(core): move server routes around to clarify workspacing (#23031)
Diffstat (limited to 'packages/sdk')
-rw-r--r--packages/sdk/js/src/v2/gen/sdk.gen.ts580
-rw-r--r--packages/sdk/js/src/v2/gen/types.gen.ts362
-rw-r--r--packages/sdk/openapi.json870
3 files changed, 906 insertions, 906 deletions
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<ThrowOnError extends boolean = false>(
parameters?: {
@@ -534,19 +534,21 @@ export class Project extends HeyApiClient {
},
],
)
- return (options?.client ?? this.client).get<ProjectListResponses, unknown, ThrowOnError>({
- url: "/project",
+ return (options?.client ?? this.client).get<ExperimentalWorkspaceAdaptorListResponses, unknown, ThrowOnError>({
+ 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<ThrowOnError extends boolean = false>(
+ public list<ThrowOnError extends boolean = false>(
parameters?: {
directory?: string
workspace?: string
@@ -564,22 +566,26 @@ export class Project extends HeyApiClient {
},
],
)
- return (options?.client ?? this.client).get<ProjectCurrentResponses, unknown, ThrowOnError>({
- url: "/project/current",
+ return (options?.client ?? this.client).get<ExperimentalWorkspaceListResponses, unknown, ThrowOnError>({
+ 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<ThrowOnError extends boolean = false>(
+ public create<ThrowOnError extends boolean = false>(
parameters?: {
directory?: string
workspace?: string
+ id?: string
+ type?: string
+ branch?: string | null
+ extra?: unknown | null
},
options?: Options<never, ThrowOnError>,
) {
@@ -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<ProjectInitGitResponses, unknown, ThrowOnError>({
- 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<ThrowOnError extends boolean = false>(
- parameters: {
- projectID: string
+ public status<ThrowOnError extends boolean = false>(
+ 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<never, ThrowOnError>,
) {
@@ -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<ProjectUpdateResponses, ProjectUpdateErrors, ThrowOnError>({
- url: "/project/{projectID}",
+ return (options?.client ?? this.client).get<ExperimentalWorkspaceStatusResponses, unknown, ThrowOnError>({
+ 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<ThrowOnError extends boolean = false>(
- parameters?: {
+ public remove<ThrowOnError extends boolean = false>(
+ 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<PtyListResponses, unknown, ThrowOnError>({
- 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<ThrowOnError extends boolean = false>(
- parameters?: {
+ public sessionRestore<ThrowOnError extends boolean = false>(
+ parameters: {
+ id: string
directory?: string
workspace?: string
- command?: string
- args?: Array<string>
- cwd?: string
- title?: string
- env?: {
- [key: string]: string
- }
+ sessionID?: string
},
options?: Options<never, ThrowOnError>,
) {
@@ -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<PtyCreateResponses, PtyCreateErrors, ThrowOnError>({
- 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<ThrowOnError extends boolean = false>(
- parameters: {
- ptyID: string
+ public get<ThrowOnError extends boolean = false>(
+ 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<PtyRemoveResponses, PtyRemoveErrors, ThrowOnError>({
- url: "/pty/{ptyID}",
+ return (options?.client ?? this.client).get<ExperimentalConsoleGetResponses, unknown, ThrowOnError>({
+ 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<ThrowOnError extends boolean = false>(
- parameters: {
- ptyID: string
+ public listOrgs<ThrowOnError extends boolean = false>(
+ 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<PtyGetResponses, PtyGetErrors, ThrowOnError>({
- url: "/pty/{ptyID}",
+ return (options?.client ?? this.client).get<ExperimentalConsoleListOrgsResponses, unknown, ThrowOnError>({
+ 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<ThrowOnError extends boolean = false>(
- parameters: {
- ptyID: string
+ public switchOrg<ThrowOnError extends boolean = false>(
+ parameters?: {
directory?: string
workspace?: string
- title?: string
- size?: {
- rows: number
- cols: number
- }
+ accountID?: string
+ orgID?: string
},
options?: Options<never, ThrowOnError>,
) {
@@ -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<PtyUpdateResponses, PtyUpdateErrors, ThrowOnError>({
- url: "/pty/{ptyID}",
+ return (options?.client ?? this.client).post<ExperimentalConsoleSwitchOrgResponses, unknown, ThrowOnError>({
+ 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<ThrowOnError extends boolean = false>(
- parameters: {
- ptyID: string
+ public list<ThrowOnError extends boolean = false>(
+ parameters?: {
directory?: string
workspace?: string
+ roots?: boolean
+ start?: number
+ cursor?: number
+ search?: string
+ limit?: number
+ archived?: boolean
},
options?: Options<never, ThrowOnError>,
) {
@@ -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<PtyConnectResponses, PtyConnectErrors, ThrowOnError>({
- url: "/pty/{ptyID}/connect",
+ return (options?.client ?? this.client).get<ExperimentalSessionListResponses, unknown, ThrowOnError>({
+ 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<ThrowOnError extends boolean = false>(
+ public list<ThrowOnError extends boolean = false>(
parameters?: {
directory?: string
workspace?: string
@@ -897,23 +904,46 @@ export class Config2 extends HeyApiClient {
},
],
)
- return (options?.client ?? this.client).get<ConfigGetResponses, unknown, ThrowOnError>({
- url: "/config",
+ return (options?.client ?? this.client).get<ExperimentalResourceListResponses, unknown, ThrowOnError>({
+ 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<ThrowOnError extends boolean = false>(
+ public list<ThrowOnError extends boolean = false>(
parameters?: {
directory?: string
workspace?: string
- config?: Config3
},
options?: Options<never, ThrowOnError>,
) {
@@ -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<ConfigUpdateResponses, ConfigUpdateErrors, ThrowOnError>({
- url: "/config",
+ return (options?.client ?? this.client).get<ProjectListResponses, unknown, ThrowOnError>({
+ 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<ThrowOnError extends boolean = false>(
+ public current<ThrowOnError extends boolean = false>(
parameters?: {
directory?: string
workspace?: string
@@ -964,21 +988,19 @@ export class Config2 extends HeyApiClient {
},
],
)
- return (options?.client ?? this.client).get<ConfigProvidersResponses, unknown, ThrowOnError>({
- url: "/config/providers",
+ return (options?.client ?? this.client).get<ProjectCurrentResponses, unknown, ThrowOnError>({
+ 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<ThrowOnError extends boolean = false>(
+ public initGit<ThrowOnError extends boolean = false>(
parameters?: {
directory?: string
workspace?: string
@@ -996,22 +1018,35 @@ export class Console extends HeyApiClient {
},
],
)
- return (options?.client ?? this.client).get<ExperimentalConsoleGetResponses, unknown, ThrowOnError>({
- url: "/experimental/console",
+ return (options?.client ?? this.client).post<ProjectInitGitResponses, unknown, ThrowOnError>({
+ url: "/project/git/init",
...options,
...params,
})
}
/**
- * List switchable Console orgs
+ * Update project
*
- * Get the available Console orgs across logged-in accounts, including the current active org.
+ * Update project properties such as name, icon, and commands.
*/
- public listOrgs<ThrowOnError extends boolean = false>(
- parameters?: {
+ public update<ThrowOnError extends boolean = false>(
+ 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<never, ThrowOnError>,
) {
@@ -1020,30 +1055,39 @@ export class Console 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).get<ExperimentalConsoleListOrgsResponses, unknown, ThrowOnError>({
- url: "/experimental/console/orgs",
+ return (options?.client ?? this.client).patch<ProjectUpdateResponses, ProjectUpdateErrors, ThrowOnError>({
+ url: "/project/{projectID}",
...options,
...params,
+ headers: {
+ "Content-Type": "application/json",
+ ...options?.headers,
+ ...params.headers,
+ },
})
}
+}
+export class Pty extends HeyApiClient {
/**
- * Switch active Console org
+ * List PTY sessions
*
- * Persist a new active Console account/org selection for the current local OpenCode state.
+ * Get a list of all active pseudo-terminal (PTY) sessions managed by OpenCode.
*/
- public switchOrg<ThrowOnError extends boolean = false>(
+ public list<ThrowOnError extends boolean = false>(
parameters?: {
directory?: string
workspace?: string
- accountID?: string
- orgID?: string
},
options?: Options<never, ThrowOnError>,
) {
@@ -1054,35 +1098,33 @@ export class Console extends HeyApiClient {
args: [
{ in: "query", key: "directory" },
{ in: "query", key: "workspace" },
- { in: "body", key: "accountID" },
- { in: "body", key: "orgID" },
],
},
],
)
- return (options?.client ?? this.client).post<ExperimentalConsoleSwitchOrgResponses, unknown, ThrowOnError>({
- url: "/experimental/console/switch",
+ return (options?.client ?? this.client).get<PtyListResponses, unknown, ThrowOnError>({
+ url: "/pty",
...options,
...params,
- headers: {
- "Content-Type": "application/json",
- ...options?.headers,
- ...params.headers,
- },
})
}
-}
-export class Adaptor extends HeyApiClient {
/**
- * List workspace adaptors
+ * Create PTY session
*
- * List all available workspace adaptors for the current project.
+ * Create a new pseudo-terminal (PTY) session for running shell commands and processes.
*/
- public list<ThrowOnError extends boolean = false>(
+ public create<ThrowOnError extends boolean = false>(
parameters?: {
directory?: string
workspace?: string
+ command?: string
+ args?: Array<string>
+ cwd?: string
+ title?: string
+ env?: {
+ [key: string]: string
+ }
},
options?: Options<never, ThrowOnError>,
) {
@@ -1093,26 +1135,35 @@ export class Adaptor extends HeyApiClient {
args: [
{ 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" },
],
},
],
)
- return (options?.client ?? this.client).get<ExperimentalWorkspaceAdaptorListResponses, unknown, ThrowOnError>({
- url: "/experimental/workspace/adaptor",
+ return (options?.client ?? this.client).post<PtyCreateResponses, PtyCreateErrors, ThrowOnError>({
+ url: "/pty",
...options,
...params,
+ headers: {
+ "Content-Type": "application/json",
+ ...options?.headers,
+ ...params.headers,
+ },
})
}
-}
-export class Workspace extends HeyApiClient {
/**
- * List workspaces
+ * Remove PTY session
*
- * List all workspaces.
+ * Remove and terminate a specific pseudo-terminal (PTY) session.
*/
- public list<ThrowOnError extends boolean = false>(
- parameters?: {
+ public remove<ThrowOnError extends boolean = false>(
+ parameters: {
+ ptyID: string
directory?: string
workspace?: string
},
@@ -1123,32 +1174,30 @@ export class Workspace extends HeyApiClient {
[
{
args: [
+ { in: "path", key: "ptyID" },
{ in: "query", key: "directory" },
{ in: "query", key: "workspace" },
],
},
],
)
- return (options?.client ?? this.client).get<ExperimentalWorkspaceListResponses, unknown, ThrowOnError>({
- url: "/experimental/workspace",
+ return (options?.client ?? this.client).delete<PtyRemoveResponses, PtyRemoveErrors, ThrowOnError>({
+ url: "/pty/{ptyID}",
...options,
...params,
})
}
/**
- * Create workspace
+ * Get PTY session
*
- * Create a workspace for the current project.
+ * Retrieve detailed information about a specific pseudo-terminal (PTY) session.
*/
- public create<ThrowOnError extends boolean = false>(
- parameters?: {
+ public get<ThrowOnError extends boolean = false>(
+ parameters: {
+ ptyID: string
directory?: string
workspace?: string
- id?: string
- type?: string
- branch?: string | null
- extra?: unknown | null
},
options?: Options<never, ThrowOnError>,
) {
@@ -1157,41 +1206,35 @@ 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" },
],
},
],
)
- return (options?.client ?? this.client).post<
- ExperimentalWorkspaceCreateResponses,
- ExperimentalWorkspaceCreateErrors,
- ThrowOnError
- >({
- url: "/experimental/workspace",
+ return (options?.client ?? this.client).get<PtyGetResponses, PtyGetErrors, ThrowOnError>({
+ url: "/pty/{ptyID}",
...options,
...params,
- headers: {
- "Content-Type": "application/json",
- ...options?.headers,
- ...params.headers,
- },
})
}
/**
- * Workspace status
+ * Update PTY session
*
- * Get connection status for workspaces in the current project.
+ * Update properties of an existing pseudo-terminal (PTY) session.
*/
- public status<ThrowOnError extends boolean = false>(
- parameters?: {
+ public update<ThrowOnError extends boolean = false>(
+ parameters: {
+ ptyID: string
directory?: string
workspace?: string
+ title?: string
+ size?: {
+ rows: number
+ cols: number
+ }
},
options?: Options<never, ThrowOnError>,
) {
@@ -1200,27 +1243,35 @@ export class Workspace extends HeyApiClient {
[
{
args: [
+ { in: "path", key: "ptyID" },
{ in: "query", key: "directory" },
{ in: "query", key: "workspace" },
+ { in: "body", key: "title" },
+ { in: "body", key: "size" },
],
},
],
)
- return (options?.client ?? this.client).get<ExperimentalWorkspaceStatusResponses, unknown, ThrowOnError>({
- url: "/experimental/workspace/status",
+ return (options?.client ?? this.client).put<PtyUpdateResponses, PtyUpdateErrors, ThrowOnError>({
+ url: "/pty/{ptyID}",
...options,
...params,
+ headers: {
+ "Content-Type": "application/json",
+ ...options?.headers,
+ ...params.headers,
+ },
})
}
/**
- * Remove workspace
+ * Connect to PTY session
*
- * Remove an existing workspace.
+ * Establish a WebSocket connection to interact with a pseudo-terminal (PTY) session in real-time.
*/
- public remove<ThrowOnError extends boolean = false>(
+ public connect<ThrowOnError extends boolean = false>(
parameters: {
- id: string
+ ptyID: string
directory?: string
workspace?: string
},
@@ -1231,35 +1282,31 @@ export class Workspace extends HeyApiClient {
[
{
args: [
- { in: "path", key: "id" },
+ { in: "path", key: "ptyID" },
{ 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<PtyConnectResponses, PtyConnectErrors, ThrowOnError>({
+ url: "/pty/{ptyID}/connect",
...options,
...params,
})
}
+}
+export class Config2 extends HeyApiClient {
/**
- * Restore session into workspace
+ * Get configuration
*
- * Replay a session's sync events into the target workspace in batches.
+ * Retrieve the current OpenCode configuration settings and preferences.
*/
- public sessionRestore<ThrowOnError extends boolean = false>(
- parameters: {
- id: string
+ public get<ThrowOnError extends boolean = false>(
+ parameters?: {
directory?: string
workspace?: string
- sessionID?: string
},
options?: Options<never, ThrowOnError>,
) {
@@ -1268,52 +1315,29 @@ export class Workspace extends HeyApiClient {
[
{
args: [
- { in: "path", key: "id" },
{ in: "query", key: "directory" },
{ in: "query", key: "workspace" },
- { in: "body", key: "sessionID" },
],
},
],
)
- return (options?.client ?? this.client).post<
- ExperimentalWorkspaceSessionRestoreResponses,
- ExperimentalWorkspaceSessionRestoreErrors,
- ThrowOnError
- >({
- url: "/experimental/workspace/{id}/session-restore",
+ return (options?.client ?? this.client).get<ConfigGetResponses, unknown, ThrowOnError>({
+ url: "/config",
...options,
...params,
- headers: {
- "Content-Type": "application/json",
- ...options?.headers,
- ...params.headers,
- },
})
}
- private _adaptor?: Adaptor
- get adaptor(): Adaptor {
- return (this._adaptor ??= new Adaptor({ client: this.client }))
- }
-}
-
-export class Session extends HeyApiClient {
/**
- * List sessions
+ * Update configuration
*
- * Get a list of all OpenCode sessions across projects, sorted by most recently updated. Archived sessions are excluded by default.
+ * Update OpenCode configuration settings and preferences.
*/
- public list<ThrowOnError extends boolean = false>(
+ public update<ThrowOnError extends boolean = false>(
parameters?: {
directory?: string
workspace?: string
- roots?: boolean
- start?: number
- cursor?: number
- search?: string
- limit?: number
- archived?: boolean
+ config?: Config3
},
options?: Options<never, ThrowOnError>,
) {
@@ -1324,31 +1348,29 @@ export class Session extends HeyApiClient {
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" },
+ { key: "config", map: "body" },
],
},
],
)
- return (options?.client ?? this.client).get<ExperimentalSessionListResponses, unknown, ThrowOnError>({
- url: "/experimental/session",
+ return (options?.client ?? this.client).patch<ConfigUpdateResponses, ConfigUpdateErrors, ThrowOnError>({
+ url: "/config",
...options,
...params,
+ headers: {
+ "Content-Type": "application/json",
+ ...options?.headers,
+ ...params.headers,
+ },
})
}
-}
-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<ThrowOnError extends boolean = false>(
+ public providers<ThrowOnError extends boolean = false>(
parameters?: {
directory?: string
workspace?: string
@@ -1366,36 +1388,14 @@ export class Resource extends HeyApiClient {
},
],
)
- return (options?.client ?? this.client).get<ExperimentalResourceListResponses, unknown, ThrowOnError>({
- url: "/experimental/resource",
+ return (options?.client ?? this.client).get<ConfigProvidersResponses, unknown, ThrowOnError>({
+ 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<ToolListItem>
-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<Workspace>
+}
+
+export type ExperimentalWorkspaceListResponse =
+ ExperimentalWorkspaceListResponses[keyof ExperimentalWorkspaceListResponses]
+
+export type ExperimentalWorkspaceCreateData = {
+ body?: {
+ id?: string
+ type: string
+ branch: string | null
+ extra: unknown | null
+ }
+ path?: never
+ query?: {
+ directory?: string
+ workspace?: string
+ }
+ url: "/experimental/workspace"
+}
+
+export type ExperimentalWorkspaceCreateErrors = {
+ /**
+ * Bad request
+ */
+ 400: BadRequestError
+}
+
+export type ExperimentalWorkspaceCreateError =
+ ExperimentalWorkspaceCreateErrors[keyof ExperimentalWorkspaceCreateErrors]
+
+export type ExperimentalWorkspaceCreateResponses = {
+ /**
+ * Workspace created
+ */
+ 200: Workspace
+}
+
+export type ExperimentalWorkspaceCreateResponse =
+ ExperimentalWorkspaceCreateResponses[keyof ExperimentalWorkspaceCreateResponses]
+
+export type 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<Workspace>
-}
-
-export type ExperimentalWorkspaceListResponse =
- ExperimentalWorkspaceListResponses[keyof ExperimentalWorkspaceListResponses]
-
-export type ExperimentalWorkspaceCreateData = {
- body?: {
- id?: string
- type: string
- branch: string | null
- extra: unknown | null
- }
- path?: never
- query?: {
- directory?: string
- workspace?: string
- }
- url: "/experimental/workspace"
-}
-
-export type ExperimentalWorkspaceCreateErrors = {
- /**
- * Bad request
- */
- 400: BadRequestError
-}
-
-export type ExperimentalWorkspaceCreateError =
- ExperimentalWorkspaceCreateErrors[keyof ExperimentalWorkspaceCreateErrors]
-
-export type ExperimentalWorkspaceCreateResponses = {
- /**
- * Workspace created
- */
- 200: Workspace
-}
-
-export type ExperimentalWorkspaceCreateResponse =
- ExperimentalWorkspaceCreateResponses[keyof ExperimentalWorkspaceCreateResponses]
-
-export type 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,6 +415,394 @@
]
}
},
+ "/experimental/workspace/adaptor": {
+ "get": {
+ "operationId": "experimental.workspace.adaptor.list",
+ "parameters": [
+ {
+ "in": "query",
+ "name": "directory",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "in": "query",
+ "name": "workspace",
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "summary": "List workspace adaptors",
+ "description": "List all available workspace adaptors for the current project.",
+ "responses": {
+ "200": {
+ "description": "Workspace adaptors",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "type": {
+ "type": "string"
+ },
+ "name": {
+ "type": "string"
+ },
+ "description": {
+ "type": "string"
+ }
+ },
+ "required": ["type", "name", "description"]
+ }
+ }
+ }
+ }
+ }
+ },
+ "x-codeSamples": [
+ {
+ "lang": "js",
+ "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.experimental.workspace.adaptor.list({\n ...\n})"
+ }
+ ]
+ }
+ },
+ "/experimental/workspace": {
+ "post": {
+ "operationId": "experimental.workspace.create",
+ "parameters": [
+ {
+ "in": "query",
+ "name": "directory",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "in": "query",
+ "name": "workspace",
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "summary": "Create workspace",
+ "description": "Create a workspace for the current project.",
+ "responses": {
+ "200": {
+ "description": "Workspace created",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$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.experimental.workspace.create({\n ...\n})"
+ }
+ ]
+ },
+ "get": {
+ "operationId": "experimental.workspace.list",
+ "parameters": [
+ {
+ "in": "query",
+ "name": "directory",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "in": "query",
+ "name": "workspace",
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "summary": "List workspaces",
+ "description": "List all workspaces.",
+ "responses": {
+ "200": {
+ "description": "Workspaces",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/Workspace"
+ }
+ }
+ }
+ }
+ }
+ },
+ "x-codeSamples": [
+ {
+ "lang": "js",
+ "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.experimental.workspace.list({\n ...\n})"
+ }
+ ]
+ }
+ },
+ "/experimental/workspace/status": {
+ "get": {
+ "operationId": "experimental.workspace.status",
+ "parameters": [
+ {
+ "in": "query",
+ "name": "directory",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "in": "query",
+ "name": "workspace",
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "summary": "Workspace status",
+ "description": "Get connection status for workspaces in the current project.",
+ "responses": {
+ "200": {
+ "description": "Workspace status",
+ "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"]
+ }
+ }
+ }
+ }
+ }
+ },
+ "x-codeSamples": [
+ {
+ "lang": "js",
+ "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.experimental.workspace.status({\n ...\n})"
+ }
+ ]
+ }
+ },
+ "/experimental/workspace/{id}": {
+ "delete": {
+ "operationId": "experimental.workspace.remove",
+ "parameters": [
+ {
+ "in": "query",
+ "name": "directory",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "in": "query",
+ "name": "workspace",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "in": "path",
+ "name": "id",
+ "schema": {
+ "type": "string",
+ "pattern": "^wrk.*"
+ },
+ "required": true
+ }
+ ],
+ "summary": "Remove workspace",
+ "description": "Remove an existing workspace.",
+ "responses": {
+ "200": {
+ "description": "Workspace removed",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Workspace"
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "Bad request",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/BadRequestError"
+ }
+ }
+ }
+ }
+ },
+ "x-codeSamples": [
+ {
+ "lang": "js",
+ "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": "experimental.workspace.sessionRestore",
+ "parameters": [
+ {
+ "in": "query",
+ "name": "directory",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "in": "query",
+ "name": "workspace",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "in": "path",
+ "name": "id",
+ "schema": {
+ "type": "string",
+ "pattern": "^wrk.*"
+ },
+ "required": true
+ }
+ ],
+ "summary": "Restore session into workspace",
+ "description": "Replay a session's sync events into the target workspace in batches.",
+ "responses": {
+ "200": {
+ "description": "Session replay started",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "total": {
+ "type": "integer",
+ "minimum": 0,
+ "maximum": 9007199254740991
+ }
+ },
+ "required": ["total"]
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "Bad request",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/BadRequestError"
+ }
+ }
+ }
+ }
+ },
+ "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})"
+ }
+ ]
+ }
+ },
"/project": {
"get": {
"operationId": "project.list",
@@ -1501,394 +1889,6 @@
]
}
},
- "/experimental/workspace/adaptor": {
- "get": {
- "operationId": "experimental.workspace.adaptor.list",
- "parameters": [
- {
- "in": "query",
- "name": "directory",
- "schema": {
- "type": "string"
- }
- },
- {
- "in": "query",
- "name": "workspace",
- "schema": {
- "type": "string"
- }
- }
- ],
- "summary": "List workspace adaptors",
- "description": "List all available workspace adaptors for the current project.",
- "responses": {
- "200": {
- "description": "Workspace adaptors",
- "content": {
- "application/json": {
- "schema": {
- "type": "array",
- "items": {
- "type": "object",
- "properties": {
- "type": {
- "type": "string"
- },
- "name": {
- "type": "string"
- },
- "description": {
- "type": "string"
- }
- },
- "required": ["type", "name", "description"]
- }
- }
- }
- }
- }
- },
- "x-codeSamples": [
- {
- "lang": "js",
- "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.experimental.workspace.adaptor.list({\n ...\n})"
- }
- ]
- }
- },
- "/experimental/workspace": {
- "post": {
- "operationId": "experimental.workspace.create",
- "parameters": [
- {
- "in": "query",
- "name": "directory",
- "schema": {
- "type": "string"
- }
- },
- {
- "in": "query",
- "name": "workspace",
- "schema": {
- "type": "string"
- }
- }
- ],
- "summary": "Create workspace",
- "description": "Create a workspace for the current project.",
- "responses": {
- "200": {
- "description": "Workspace created",
- "content": {
- "application/json": {
- "schema": {
- "$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.experimental.workspace.create({\n ...\n})"
- }
- ]
- },
- "get": {
- "operationId": "experimental.workspace.list",
- "parameters": [
- {
- "in": "query",
- "name": "directory",
- "schema": {
- "type": "string"
- }
- },
- {
- "in": "query",
- "name": "workspace",
- "schema": {
- "type": "string"
- }
- }
- ],
- "summary": "List workspaces",
- "description": "List all workspaces.",
- "responses": {
- "200": {
- "description": "Workspaces",
- "content": {
- "application/json": {
- "schema": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/Workspace"
- }
- }
- }
- }
- }
- },
- "x-codeSamples": [
- {
- "lang": "js",
- "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.experimental.workspace.list({\n ...\n})"
- }
- ]
- }
- },
- "/experimental/workspace/status": {
- "get": {
- "operationId": "experimental.workspace.status",
- "parameters": [
- {
- "in": "query",
- "name": "directory",
- "schema": {
- "type": "string"
- }
- },
- {
- "in": "query",
- "name": "workspace",
- "schema": {
- "type": "string"
- }
- }
- ],
- "summary": "Workspace status",
- "description": "Get connection status for workspaces in the current project.",
- "responses": {
- "200": {
- "description": "Workspace status",
- "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"]
- }
- }
- }
- }
- }
- },
- "x-codeSamples": [
- {
- "lang": "js",
- "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.experimental.workspace.status({\n ...\n})"
- }
- ]
- }
- },
- "/experimental/workspace/{id}": {
- "delete": {
- "operationId": "experimental.workspace.remove",
- "parameters": [
- {
- "in": "query",
- "name": "directory",
- "schema": {
- "type": "string"
- }
- },
- {
- "in": "query",
- "name": "workspace",
- "schema": {
- "type": "string"
- }
- },
- {
- "in": "path",
- "name": "id",
- "schema": {
- "type": "string",
- "pattern": "^wrk.*"
- },
- "required": true
- }
- ],
- "summary": "Remove workspace",
- "description": "Remove an existing workspace.",
- "responses": {
- "200": {
- "description": "Workspace removed",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Workspace"
- }
- }
- }
- },
- "400": {
- "description": "Bad request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/BadRequestError"
- }
- }
- }
- }
- },
- "x-codeSamples": [
- {
- "lang": "js",
- "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": "experimental.workspace.sessionRestore",
- "parameters": [
- {
- "in": "query",
- "name": "directory",
- "schema": {
- "type": "string"
- }
- },
- {
- "in": "query",
- "name": "workspace",
- "schema": {
- "type": "string"
- }
- },
- {
- "in": "path",
- "name": "id",
- "schema": {
- "type": "string",
- "pattern": "^wrk.*"
- },
- "required": true
- }
- ],
- "summary": "Restore session into workspace",
- "description": "Replay a session's sync events into the target workspace in batches.",
- "responses": {
- "200": {
- "description": "Session replay started",
- "content": {
- "application/json": {
- "schema": {
- "type": "object",
- "properties": {
- "total": {
- "type": "integer",
- "minimum": 0,
- "maximum": 9007199254740991
- }
- },
- "required": ["total"]
- }
- }
- }
- },
- "400": {
- "description": "Bad request",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/BadRequestError"
- }
- }
- }
- }
- },
- "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})"
- }
- ]
- }
- },
"/experimental/worktree": {
"post": {
"operationId": "worktree.create",
@@ -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": {