summaryrefslogtreecommitdiffhomepage
path: root/packages/sdk
diff options
context:
space:
mode:
Diffstat (limited to 'packages/sdk')
-rw-r--r--packages/sdk/js/package.json2
-rw-r--r--packages/sdk/js/src/v2/gen/sdk.gen.ts253
-rw-r--r--packages/sdk/js/src/v2/gen/types.gen.ts191
-rw-r--r--packages/sdk/openapi.json409
4 files changed, 427 insertions, 428 deletions
diff --git a/packages/sdk/js/package.json b/packages/sdk/js/package.json
index ffbdf2198..e83fa7c86 100644
--- a/packages/sdk/js/package.json
+++ b/packages/sdk/js/package.json
@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/package.json",
"name": "@opencode-ai/sdk",
- "version": "1.2.15",
+ "version": "1.2.17",
"type": "module",
"license": "MIT",
"scripts": {
diff --git a/packages/sdk/js/src/v2/gen/sdk.gen.ts b/packages/sdk/js/src/v2/gen/sdk.gen.ts
index 49ebc8473..1c1b31e46 100644
--- a/packages/sdk/js/src/v2/gen/sdk.gen.ts
+++ b/packages/sdk/js/src/v2/gen/sdk.gen.ts
@@ -862,17 +862,16 @@ export class Tool extends HeyApiClient {
}
}
-export class Worktree extends HeyApiClient {
+export class Workspace extends HeyApiClient {
/**
- * Remove worktree
+ * List workspaces
*
- * Remove a git worktree and delete its branch.
+ * List all workspaces.
*/
- public remove<ThrowOnError extends boolean = false>(
+ public list<ThrowOnError extends boolean = false>(
parameters?: {
directory?: string
workspace?: string
- worktreeRemoveInput?: WorktreeRemoveInput
},
options?: Options<never, ThrowOnError>,
) {
@@ -883,32 +882,30 @@ export class Worktree extends HeyApiClient {
args: [
{ in: "query", key: "directory" },
{ in: "query", key: "workspace" },
- { key: "worktreeRemoveInput", map: "body" },
],
},
],
)
- return (options?.client ?? this.client).delete<WorktreeRemoveResponses, WorktreeRemoveErrors, ThrowOnError>({
- url: "/experimental/worktree",
+ return (options?.client ?? this.client).get<ExperimentalWorkspaceListResponses, unknown, ThrowOnError>({
+ url: "/experimental/workspace",
...options,
...params,
- headers: {
- "Content-Type": "application/json",
- ...options?.headers,
- ...params.headers,
- },
})
}
/**
- * List worktrees
+ * Create workspace
*
- * List all sandbox worktrees for the current project.
+ * Create a workspace for the current project.
*/
- public list<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>,
) {
@@ -919,27 +916,40 @@ export class Worktree 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).get<WorktreeListResponses, unknown, ThrowOnError>({
- url: "/experimental/worktree",
+ return (options?.client ?? this.client).post<
+ ExperimentalWorkspaceCreateResponses,
+ ExperimentalWorkspaceCreateErrors,
+ ThrowOnError
+ >({
+ url: "/experimental/workspace",
...options,
...params,
+ headers: {
+ "Content-Type": "application/json",
+ ...options?.headers,
+ ...params.headers,
+ },
})
}
/**
- * Create worktree
+ * Remove workspace
*
- * Create a new git worktree for the current project and run any configured startup scripts.
+ * Remove an existing workspace.
*/
- public create<ThrowOnError extends boolean = false>(
- parameters?: {
+ public remove<ThrowOnError extends boolean = false>(
+ parameters: {
+ id: string
directory?: string
workspace?: string
- worktreeCreateInput?: WorktreeCreateInput
},
options?: Options<never, ThrowOnError>,
) {
@@ -948,35 +958,41 @@ export class Worktree extends HeyApiClient {
[
{
args: [
+ { in: "path", key: "id" },
{ in: "query", key: "directory" },
{ in: "query", key: "workspace" },
- { key: "worktreeCreateInput", map: "body" },
],
},
],
)
- return (options?.client ?? this.client).post<WorktreeCreateResponses, WorktreeCreateErrors, ThrowOnError>({
- url: "/experimental/worktree",
+ return (options?.client ?? this.client).delete<
+ ExperimentalWorkspaceRemoveResponses,
+ ExperimentalWorkspaceRemoveErrors,
+ ThrowOnError
+ >({
+ url: "/experimental/workspace/{id}",
...options,
...params,
- headers: {
- "Content-Type": "application/json",
- ...options?.headers,
- ...params.headers,
- },
})
}
+}
+export class Session extends HeyApiClient {
/**
- * Reset worktree
+ * List sessions
*
- * Reset a worktree branch to the primary default branch.
+ * Get a list of all OpenCode sessions across projects, sorted by most recently updated. Archived sessions are excluded by default.
*/
- public reset<ThrowOnError extends boolean = false>(
+ public list<ThrowOnError extends boolean = false>(
parameters?: {
directory?: string
workspace?: string
- worktreeResetInput?: WorktreeResetInput
+ roots?: boolean
+ start?: number
+ cursor?: number
+ search?: string
+ limit?: number
+ archived?: boolean
},
options?: Options<never, ThrowOnError>,
) {
@@ -987,33 +1003,32 @@ export class Worktree extends HeyApiClient {
args: [
{ in: "query", key: "directory" },
{ in: "query", key: "workspace" },
- { key: "worktreeResetInput", map: "body" },
+ { 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).post<WorktreeResetResponses, WorktreeResetErrors, ThrowOnError>({
- url: "/experimental/worktree/reset",
+ return (options?.client ?? this.client).get<ExperimentalSessionListResponses, unknown, ThrowOnError>({
+ url: "/experimental/session",
...options,
...params,
- headers: {
- "Content-Type": "application/json",
- ...options?.headers,
- ...params.headers,
- },
})
}
}
-export class Workspace extends HeyApiClient {
+export class Resource extends HeyApiClient {
/**
- * Remove workspace
+ * Get MCP resources
*
- * Remove an existing workspace.
+ * Get all available MCP resources from connected servers. Optionally filter by name.
*/
- public remove<ThrowOnError extends boolean = false>(
- parameters: {
- id: string
+ public list<ThrowOnError extends boolean = false>(
+ parameters?: {
directory?: string
workspace?: string
},
@@ -1024,39 +1039,48 @@ 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<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 _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 Worktree extends HeyApiClient {
/**
- * Create workspace
+ * Remove worktree
*
- * Create a workspace for the current project.
+ * Remove a git worktree and delete its branch.
*/
- public create<ThrowOnError extends boolean = false>(
- parameters: {
- id: string
+ public remove<ThrowOnError extends boolean = false>(
+ parameters?: {
directory?: string
workspace?: string
- branch?: string | null
- config?: {
- directory: string
- type: "worktree"
- }
+ worktreeRemoveInput?: WorktreeRemoveInput
},
options?: Options<never, ThrowOnError>,
) {
@@ -1065,21 +1089,15 @@ export class Workspace extends HeyApiClient {
[
{
args: [
- { in: "path", key: "id" },
{ in: "query", key: "directory" },
{ in: "query", key: "workspace" },
- { in: "body", key: "branch" },
- { in: "body", key: "config" },
+ { key: "worktreeRemoveInput", map: "body" },
],
},
],
)
- return (options?.client ?? this.client).post<
- ExperimentalWorkspaceCreateResponses,
- ExperimentalWorkspaceCreateErrors,
- ThrowOnError
- >({
- url: "/experimental/workspace/{id}",
+ return (options?.client ?? this.client).delete<WorktreeRemoveResponses, WorktreeRemoveErrors, ThrowOnError>({
+ url: "/experimental/worktree",
...options,
...params,
headers: {
@@ -1091,9 +1109,9 @@ export class Workspace extends HeyApiClient {
}
/**
- * List workspaces
+ * List worktrees
*
- * List all workspaces.
+ * List all sandbox worktrees for the current project.
*/
public list<ThrowOnError extends boolean = false>(
parameters?: {
@@ -1113,30 +1131,23 @@ export class Workspace extends HeyApiClient {
},
],
)
- return (options?.client ?? this.client).get<ExperimentalWorkspaceListResponses, unknown, ThrowOnError>({
- url: "/experimental/workspace",
+ return (options?.client ?? this.client).get<WorktreeListResponses, unknown, ThrowOnError>({
+ url: "/experimental/worktree",
...options,
...params,
})
}
-}
-export class Session extends HeyApiClient {
/**
- * List sessions
+ * Create worktree
*
- * Get a list of all OpenCode sessions across projects, sorted by most recently updated. Archived sessions are excluded by default.
+ * Create a new git worktree for the current project and run any configured startup scripts.
*/
- public list<ThrowOnError extends boolean = false>(
+ public create<ThrowOnError extends boolean = false>(
parameters?: {
directory?: string
workspace?: string
- roots?: boolean
- start?: number
- cursor?: number
- search?: string
- limit?: number
- archived?: boolean
+ worktreeCreateInput?: WorktreeCreateInput
},
options?: Options<never, ThrowOnError>,
) {
@@ -1147,34 +1158,33 @@ 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: "worktreeCreateInput", map: "body" },
],
},
],
)
- return (options?.client ?? this.client).get<ExperimentalSessionListResponses, unknown, ThrowOnError>({
- url: "/experimental/session",
+ return (options?.client ?? this.client).post<WorktreeCreateResponses, WorktreeCreateErrors, ThrowOnError>({
+ url: "/experimental/worktree",
...options,
...params,
+ headers: {
+ "Content-Type": "application/json",
+ ...options?.headers,
+ ...params.headers,
+ },
})
}
-}
-export class Resource extends HeyApiClient {
/**
- * Get MCP resources
+ * Reset worktree
*
- * Get all available MCP resources from connected servers. Optionally filter by name.
+ * Reset a worktree branch to the primary default branch.
*/
- public list<ThrowOnError extends boolean = false>(
+ public reset<ThrowOnError extends boolean = false>(
parameters?: {
directory?: string
workspace?: string
+ worktreeResetInput?: WorktreeResetInput
},
options?: Options<never, ThrowOnError>,
) {
@@ -1185,35 +1195,24 @@ export class Resource extends HeyApiClient {
args: [
{ in: "query", key: "directory" },
{ in: "query", key: "workspace" },
+ { key: "worktreeResetInput", map: "body" },
],
},
],
)
- return (options?.client ?? this.client).get<ExperimentalResourceListResponses, unknown, ThrowOnError>({
- url: "/experimental/resource",
+ return (options?.client ?? this.client).post<WorktreeResetResponses, WorktreeResetErrors, ThrowOnError>({
+ url: "/experimental/worktree/reset",
...options,
...params,
+ headers: {
+ "Content-Type": "application/json",
+ ...options?.headers,
+ ...params.headers,
+ },
})
}
}
-export class Experimental extends HeyApiClient {
- 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 Session2 extends HeyApiClient {
/**
* List sessions
@@ -3898,16 +3897,16 @@ export class OpencodeClient extends HeyApiClient {
return (this._tool ??= new Tool({ client: this.client }))
}
- private _worktree?: Worktree
- get worktree(): Worktree {
- return (this._worktree ??= new Worktree({ client: this.client }))
- }
-
private _experimental?: Experimental
get experimental(): Experimental {
return (this._experimental ??= new Experimental({ client: this.client }))
}
+ private _worktree?: Worktree
+ get worktree(): Worktree {
+ return (this._worktree ??= new Worktree({ client: this.client }))
+ }
+
private _session?: Session2
get session(): Session2 {
return (this._session ??= new Session2({ 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 69d105610..afb2224a7 100644
--- a/packages/sdk/js/src/v2/gen/types.gen.ts
+++ b/packages/sdk/js/src/v2/gen/types.gen.ts
@@ -889,21 +889,6 @@ export type EventVcsBranchUpdated = {
}
}
-export type EventWorktreeReady = {
- type: "worktree.ready"
- properties: {
- name: string
- branch: string
- }
-}
-
-export type EventWorktreeFailed = {
- type: "worktree.failed"
- properties: {
- message: string
- }
-}
-
export type EventWorkspaceReady = {
type: "workspace.ready"
properties: {
@@ -957,6 +942,21 @@ export type EventPtyDeleted = {
}
}
+export type EventWorktreeReady = {
+ type: "worktree.ready"
+ properties: {
+ name: string
+ branch: string
+ }
+}
+
+export type EventWorktreeFailed = {
+ type: "worktree.failed"
+ properties: {
+ message: string
+ }
+}
+
export type Event =
| EventInstallationUpdated
| EventInstallationUpdateAvailable
@@ -995,14 +995,14 @@ export type Event =
| EventSessionDiff
| EventSessionError
| EventVcsBranchUpdated
- | EventWorktreeReady
- | EventWorktreeFailed
| EventWorkspaceReady
| EventWorkspaceFailed
| EventPtyCreated
| EventPtyUpdated
| EventPtyExited
| EventPtyDeleted
+ | EventWorktreeReady
+ | EventWorktreeFailed
export type GlobalEvent = {
directory: string
@@ -1631,6 +1631,16 @@ export type ToolListItem = {
export type ToolList = Array<ToolListItem>
+export type Workspace = {
+ id: string
+ type: string
+ branch: string | null
+ name: string | null
+ directory: string | null
+ extra: unknown | null
+ projectID: string
+}
+
export type Worktree = {
name: string
branch: string
@@ -1645,16 +1655,6 @@ export type WorktreeCreateInput = {
startCommand?: string
}
-export type Workspace = {
- id: string
- branch: string | null
- projectID: string
- config: {
- directory: string
- type: "worktree"
- }
-}
-
export type WorktreeRemoveInput = {
directory: string
}
@@ -2444,80 +2444,60 @@ export type ToolListResponses = {
export type ToolListResponse = ToolListResponses[keyof ToolListResponses]
-export type WorktreeRemoveData = {
- body?: WorktreeRemoveInput
- path?: never
- query?: {
- directory?: string
- workspace?: string
- }
- url: "/experimental/worktree"
-}
-
-export type WorktreeRemoveErrors = {
- /**
- * Bad request
- */
- 400: BadRequestError
-}
-
-export type WorktreeRemoveError = WorktreeRemoveErrors[keyof WorktreeRemoveErrors]
-
-export type WorktreeRemoveResponses = {
- /**
- * Worktree removed
- */
- 200: boolean
-}
-
-export type WorktreeRemoveResponse = WorktreeRemoveResponses[keyof WorktreeRemoveResponses]
-
-export type WorktreeListData = {
+export type ExperimentalWorkspaceListData = {
body?: never
path?: never
query?: {
directory?: string
workspace?: string
}
- url: "/experimental/worktree"
+ url: "/experimental/workspace"
}
-export type WorktreeListResponses = {
+export type ExperimentalWorkspaceListResponses = {
/**
- * List of worktree directories
+ * Workspaces
*/
- 200: Array<string>
+ 200: Array<Workspace>
}
-export type WorktreeListResponse = WorktreeListResponses[keyof WorktreeListResponses]
+export type ExperimentalWorkspaceListResponse =
+ ExperimentalWorkspaceListResponses[keyof ExperimentalWorkspaceListResponses]
-export type WorktreeCreateData = {
- body?: WorktreeCreateInput
+export type ExperimentalWorkspaceCreateData = {
+ body?: {
+ id?: string
+ type: string
+ branch: string | null
+ extra: unknown | null
+ }
path?: never
query?: {
directory?: string
workspace?: string
}
- url: "/experimental/worktree"
+ url: "/experimental/workspace"
}
-export type WorktreeCreateErrors = {
+export type ExperimentalWorkspaceCreateErrors = {
/**
* Bad request
*/
400: BadRequestError
}
-export type WorktreeCreateError = WorktreeCreateErrors[keyof WorktreeCreateErrors]
+export type ExperimentalWorkspaceCreateError =
+ ExperimentalWorkspaceCreateErrors[keyof ExperimentalWorkspaceCreateErrors]
-export type WorktreeCreateResponses = {
+export type ExperimentalWorkspaceCreateResponses = {
/**
- * Worktree created
+ * Workspace created
*/
- 200: Worktree
+ 200: Workspace
}
-export type WorktreeCreateResponse = WorktreeCreateResponses[keyof WorktreeCreateResponses]
+export type ExperimentalWorkspaceCreateResponse =
+ ExperimentalWorkspaceCreateResponses[keyof ExperimentalWorkspaceCreateResponses]
export type ExperimentalWorkspaceRemoveData = {
body?: never
@@ -2551,63 +2531,80 @@ export type ExperimentalWorkspaceRemoveResponses = {
export type ExperimentalWorkspaceRemoveResponse =
ExperimentalWorkspaceRemoveResponses[keyof ExperimentalWorkspaceRemoveResponses]
-export type ExperimentalWorkspaceCreateData = {
- body?: {
- branch: string | null
- config: {
- directory: string
- type: "worktree"
- }
- }
- path: {
- id: string
- }
+export type WorktreeRemoveData = {
+ body?: WorktreeRemoveInput
+ path?: never
query?: {
directory?: string
workspace?: string
}
- url: "/experimental/workspace/{id}"
+ url: "/experimental/worktree"
}
-export type ExperimentalWorkspaceCreateErrors = {
+export type WorktreeRemoveErrors = {
/**
* Bad request
*/
400: BadRequestError
}
-export type ExperimentalWorkspaceCreateError =
- ExperimentalWorkspaceCreateErrors[keyof ExperimentalWorkspaceCreateErrors]
+export type WorktreeRemoveError = WorktreeRemoveErrors[keyof WorktreeRemoveErrors]
-export type ExperimentalWorkspaceCreateResponses = {
+export type WorktreeRemoveResponses = {
/**
- * Workspace created
+ * Worktree removed
*/
- 200: Workspace
+ 200: boolean
}
-export type ExperimentalWorkspaceCreateResponse =
- ExperimentalWorkspaceCreateResponses[keyof ExperimentalWorkspaceCreateResponses]
+export type WorktreeRemoveResponse = WorktreeRemoveResponses[keyof WorktreeRemoveResponses]
-export type ExperimentalWorkspaceListData = {
+export type WorktreeListData = {
body?: never
path?: never
query?: {
directory?: string
workspace?: string
}
- url: "/experimental/workspace"
+ url: "/experimental/worktree"
}
-export type ExperimentalWorkspaceListResponses = {
+export type WorktreeListResponses = {
/**
- * Workspaces
+ * List of worktree directories
*/
- 200: Array<Workspace>
+ 200: Array<string>
}
-export type ExperimentalWorkspaceListResponse =
- ExperimentalWorkspaceListResponses[keyof ExperimentalWorkspaceListResponses]
+export type WorktreeListResponse = WorktreeListResponses[keyof WorktreeListResponses]
+
+export type WorktreeCreateData = {
+ body?: WorktreeCreateInput
+ path?: never
+ query?: {
+ directory?: string
+ workspace?: string
+ }
+ url: "/experimental/worktree"
+}
+
+export type WorktreeCreateErrors = {
+ /**
+ * Bad request
+ */
+ 400: BadRequestError
+}
+
+export type WorktreeCreateError = WorktreeCreateErrors[keyof WorktreeCreateErrors]
+
+export type WorktreeCreateResponses = {
+ /**
+ * Worktree created
+ */
+ 200: Worktree
+}
+
+export type WorktreeCreateResponse = WorktreeCreateResponses[keyof WorktreeCreateResponses]
export type WorktreeResetData = {
body?: WorktreeResetInput
diff --git a/packages/sdk/openapi.json b/packages/sdk/openapi.json
index 8f03cb92c..7db79bcbe 100644
--- a/packages/sdk/openapi.json
+++ b/packages/sdk/openapi.json
@@ -1108,9 +1108,9 @@
]
}
},
- "/experimental/worktree": {
+ "/experimental/workspace": {
"post": {
- "operationId": "worktree.create",
+ "operationId": "experimental.workspace.create",
"parameters": [
{
"in": "query",
@@ -1127,15 +1127,15 @@
}
}
],
- "summary": "Create worktree",
- "description": "Create a new git worktree for the current project and run any configured startup scripts.",
+ "summary": "Create workspace",
+ "description": "Create a workspace for the current project.",
"responses": {
"200": {
- "description": "Worktree created",
+ "description": "Workspace created",
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/Worktree"
+ "$ref": "#/components/schemas/Workspace"
}
}
}
@@ -1155,7 +1155,35 @@
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/WorktreeCreateInput"
+ "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"]
}
}
}
@@ -1163,12 +1191,12 @@
"x-codeSamples": [
{
"lang": "js",
- "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.worktree.create({\n ...\n})"
+ "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.experimental.workspace.create({\n ...\n})"
}
]
},
"get": {
- "operationId": "worktree.list",
+ "operationId": "experimental.workspace.list",
"parameters": [
{
"in": "query",
@@ -1185,17 +1213,17 @@
}
}
],
- "summary": "List worktrees",
- "description": "List all sandbox worktrees for the current project.",
+ "summary": "List workspaces",
+ "description": "List all workspaces.",
"responses": {
"200": {
- "description": "List of worktree directories",
+ "description": "Workspaces",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
- "type": "string"
+ "$ref": "#/components/schemas/Workspace"
}
}
}
@@ -1205,12 +1233,14 @@
"x-codeSamples": [
{
"lang": "js",
- "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.worktree.list({\n ...\n})"
+ "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.experimental.workspace.list({\n ...\n})"
}
]
- },
+ }
+ },
+ "/experimental/workspace/{id}": {
"delete": {
- "operationId": "worktree.remove",
+ "operationId": "experimental.workspace.remove",
"parameters": [
{
"in": "query",
@@ -1225,17 +1255,26 @@
"schema": {
"type": "string"
}
+ },
+ {
+ "in": "path",
+ "name": "id",
+ "schema": {
+ "type": "string",
+ "pattern": "^wrk.*"
+ },
+ "required": true
}
],
- "summary": "Remove worktree",
- "description": "Remove a git worktree and delete its branch.",
+ "summary": "Remove workspace",
+ "description": "Remove an existing workspace.",
"responses": {
"200": {
- "description": "Worktree removed",
+ "description": "Workspace removed",
"content": {
"application/json": {
"schema": {
- "type": "boolean"
+ "$ref": "#/components/schemas/Workspace"
}
}
}
@@ -1251,26 +1290,17 @@
}
}
},
- "requestBody": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/WorktreeRemoveInput"
- }
- }
- }
- },
"x-codeSamples": [
{
"lang": "js",
- "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.worktree.remove({\n ...\n})"
+ "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.experimental.workspace.remove({\n ...\n})"
}
]
}
},
- "/experimental/workspace/{id}": {
+ "/experimental/worktree": {
"post": {
- "operationId": "experimental.workspace.create",
+ "operationId": "worktree.create",
"parameters": [
{
"in": "query",
@@ -1285,26 +1315,17 @@
"schema": {
"type": "string"
}
- },
- {
- "in": "path",
- "name": "id",
- "schema": {
- "type": "string",
- "pattern": "^wrk.*"
- },
- "required": true
}
],
- "summary": "Create workspace",
- "description": "Create a workspace for the current project.",
+ "summary": "Create worktree",
+ "description": "Create a new git worktree for the current project and run any configured startup scripts.",
"responses": {
"200": {
- "description": "Workspace created",
+ "description": "Worktree created",
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/Workspace"
+ "$ref": "#/components/schemas/Worktree"
}
}
}
@@ -1324,37 +1345,7 @@
"content": {
"application/json": {
"schema": {
- "type": "object",
- "properties": {
- "branch": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
- },
- "config": {
- "anyOf": [
- {
- "type": "object",
- "properties": {
- "directory": {
- "type": "string"
- },
- "type": {
- "type": "string",
- "const": "worktree"
- }
- },
- "required": ["directory", "type"]
- }
- ]
- }
- },
- "required": ["branch", "config"]
+ "$ref": "#/components/schemas/WorktreeCreateInput"
}
}
}
@@ -1362,12 +1353,12 @@
"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.worktree.create({\n ...\n})"
}
]
},
- "delete": {
- "operationId": "experimental.workspace.remove",
+ "get": {
+ "operationId": "worktree.list",
"parameters": [
{
"in": "query",
@@ -1382,36 +1373,20 @@
"schema": {
"type": "string"
}
- },
- {
- "in": "path",
- "name": "id",
- "schema": {
- "type": "string",
- "pattern": "^wrk.*"
- },
- "required": true
}
],
- "summary": "Remove workspace",
- "description": "Remove an existing workspace.",
+ "summary": "List worktrees",
+ "description": "List all sandbox worktrees for the current project.",
"responses": {
"200": {
- "description": "Workspace removed",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Workspace"
- }
- }
- }
- },
- "400": {
- "description": "Bad request",
+ "description": "List of worktree directories",
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/BadRequestError"
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
}
}
}
@@ -1420,14 +1395,12 @@
"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.worktree.list({\n ...\n})"
}
]
- }
- },
- "/experimental/workspace": {
- "get": {
- "operationId": "experimental.workspace.list",
+ },
+ "delete": {
+ "operationId": "worktree.remove",
"parameters": [
{
"in": "query",
@@ -1444,27 +1417,43 @@
}
}
],
- "summary": "List workspaces",
- "description": "List all workspaces.",
+ "summary": "Remove worktree",
+ "description": "Remove a git worktree and delete its branch.",
"responses": {
"200": {
- "description": "Workspaces",
+ "description": "Worktree removed",
"content": {
"application/json": {
"schema": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/Workspace"
- }
+ "type": "boolean"
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "Bad request",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/BadRequestError"
}
}
}
}
},
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/WorktreeRemoveInput"
+ }
+ }
+ }
+ },
"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.worktree.remove({\n ...\n})"
}
]
}
@@ -9280,47 +9269,6 @@
},
"required": ["type", "properties"]
},
- "Event.worktree.ready": {
- "type": "object",
- "properties": {
- "type": {
- "type": "string",
- "const": "worktree.ready"
- },
- "properties": {
- "type": "object",
- "properties": {
- "name": {
- "type": "string"
- },
- "branch": {
- "type": "string"
- }
- },
- "required": ["name", "branch"]
- }
- },
- "required": ["type", "properties"]
- },
- "Event.worktree.failed": {
- "type": "object",
- "properties": {
- "type": {
- "type": "string",
- "const": "worktree.failed"
- },
- "properties": {
- "type": "object",
- "properties": {
- "message": {
- "type": "string"
- }
- },
- "required": ["message"]
- }
- },
- "required": ["type", "properties"]
- },
"Event.workspace.ready": {
"type": "object",
"properties": {
@@ -9472,6 +9420,47 @@
},
"required": ["type", "properties"]
},
+ "Event.worktree.ready": {
+ "type": "object",
+ "properties": {
+ "type": {
+ "type": "string",
+ "const": "worktree.ready"
+ },
+ "properties": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "branch": {
+ "type": "string"
+ }
+ },
+ "required": ["name", "branch"]
+ }
+ },
+ "required": ["type", "properties"]
+ },
+ "Event.worktree.failed": {
+ "type": "object",
+ "properties": {
+ "type": {
+ "type": "string",
+ "const": "worktree.failed"
+ },
+ "properties": {
+ "type": "object",
+ "properties": {
+ "message": {
+ "type": "string"
+ }
+ },
+ "required": ["message"]
+ }
+ },
+ "required": ["type", "properties"]
+ },
"Event": {
"anyOf": [
{
@@ -9586,12 +9575,6 @@
"$ref": "#/components/schemas/Event.vcs.branch.updated"
},
{
- "$ref": "#/components/schemas/Event.worktree.ready"
- },
- {
- "$ref": "#/components/schemas/Event.worktree.failed"
- },
- {
"$ref": "#/components/schemas/Event.workspace.ready"
},
{
@@ -9608,6 +9591,12 @@
},
{
"$ref": "#/components/schemas/Event.pty.deleted"
+ },
+ {
+ "$ref": "#/components/schemas/Event.worktree.ready"
+ },
+ {
+ "$ref": "#/components/schemas/Event.worktree.failed"
}
]
},
@@ -11001,6 +10990,60 @@
"$ref": "#/components/schemas/ToolListItem"
}
},
+ "Workspace": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string",
+ "pattern": "^wrk.*"
+ },
+ "type": {
+ "type": "string"
+ },
+ "branch": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "name": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "directory": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "extra": {
+ "anyOf": [
+ {},
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "projectID": {
+ "type": "string"
+ }
+ },
+ "required": ["id", "type", "branch", "name", "directory", "extra", "projectID"]
+ },
"Worktree": {
"type": "object",
"properties": {
@@ -11028,46 +11071,6 @@
}
}
},
- "Workspace": {
- "type": "object",
- "properties": {
- "id": {
- "type": "string",
- "pattern": "^wrk.*"
- },
- "branch": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ]
- },
- "projectID": {
- "type": "string"
- },
- "config": {
- "anyOf": [
- {
- "type": "object",
- "properties": {
- "directory": {
- "type": "string"
- },
- "type": {
- "type": "string",
- "const": "worktree"
- }
- },
- "required": ["directory", "type"]
- }
- ]
- }
- },
- "required": ["id", "branch", "projectID", "config"]
- },
"WorktreeRemoveInput": {
"type": "object",
"properties": {