diff --git a/packages/opencode/src/cli/cmd/tui/component/dialog-session-list.tsx b/packages/opencode/src/cli/cmd/tui/component/dialog-session-list.tsx
index a521e07b1d..e8dbaee394 100644
--- a/packages/opencode/src/cli/cmd/tui/component/dialog-session-list.tsx
+++ b/packages/opencode/src/cli/cmd/tui/component/dialog-session-list.tsx
@@ -12,11 +12,7 @@ import { Flag } from "@opencode-ai/core/flag/flag"
import { DialogSessionRename } from "./dialog-session-rename"
import { createDebouncedSignal } from "../util/signal"
import { useToast } from "../ui/toast"
-import {
- openWorkspaceSelect,
- type WorkspaceSelection,
- warpWorkspaceSession,
-} from "./dialog-workspace-create"
+import { openWorkspaceSelect, type WorkspaceSelection, warpWorkspaceSession } from "./dialog-workspace-create"
import { Spinner } from "./spinner"
import { errorMessage } from "@/util/error"
import { DialogSessionDeleteFailed } from "./dialog-session-delete-failed"
diff --git a/packages/opencode/src/cli/cmd/tui/component/dialog-workspace-create.tsx b/packages/opencode/src/cli/cmd/tui/component/dialog-workspace-create.tsx
index 31955dcf31..d7e212ab15 100644
--- a/packages/opencode/src/cli/cmd/tui/component/dialog-workspace-create.tsx
+++ b/packages/opencode/src/cli/cmd/tui/component/dialog-workspace-create.tsx
@@ -166,7 +166,9 @@ export async function confirmWorkspaceFileChanges(input: {
sourceWorkspaceID?: string
}) {
const status = await input.sdk.client.vcs.status({ workspace: input.sourceWorkspaceID }).catch(() => undefined)
- const fileChangeChoice = status?.data?.length ? await DialogWorkspaceFileChanges.show(input.dialog, status.data) : "no"
+ const fileChangeChoice = status?.data?.length
+ ? await DialogWorkspaceFileChanges.show(input.dialog, status.data)
+ : "no"
if (!fileChangeChoice) return
return fileChangeChoice === "yes"
}
@@ -262,7 +264,9 @@ export function DialogWorkspaceSelect(props: {
return
}
- dialog.replace(() => )
+ dialog.replace(() => (
+
+ ))
}}
/>
)
diff --git a/packages/sdk/openapi.json b/packages/sdk/openapi.json
index 477145f017..04c34e2dc1 100644
--- a/packages/sdk/openapi.json
+++ b/packages/sdk/openapi.json
@@ -1897,6 +1897,54 @@
]
}
},
+ "/vcs/status": {
+ "get": {
+ "tags": ["instance"],
+ "operationId": "vcs.status",
+ "parameters": [
+ {
+ "name": "directory",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "workspace",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "VCS status",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/VcsFileStatus"
+ },
+ "description": "VCS status"
+ }
+ }
+ }
+ }
+ },
+ "description": "Retrieve changed files in the current working tree without patches.",
+ "summary": "Get VCS status",
+ "x-codeSamples": [
+ {
+ "lang": "js",
+ "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.vcs.status({\n ...\n})"
+ }
+ ]
+ }
+ },
"/vcs/diff": {
"get": {
"tags": ["instance"],
@@ -1954,6 +2002,128 @@
]
}
},
+ "/vcs/diff/raw": {
+ "get": {
+ "tags": ["instance"],
+ "operationId": "vcs.diff.raw",
+ "parameters": [
+ {
+ "name": "directory",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "workspace",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Raw VCS diff",
+ "content": {
+ "text/x-diff; charset=utf-8": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ },
+ "description": "Retrieve a raw patch for current uncommitted changes.",
+ "summary": "Get raw VCS diff",
+ "x-codeSamples": [
+ {
+ "lang": "js",
+ "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.vcs.diff.raw({\n ...\n})"
+ }
+ ]
+ }
+ },
+ "/vcs/apply": {
+ "post": {
+ "tags": ["instance"],
+ "operationId": "vcs.apply",
+ "parameters": [
+ {
+ "name": "directory",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "workspace",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "VCS patch applied",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "applied": {
+ "type": "boolean"
+ }
+ },
+ "required": ["applied"],
+ "additionalProperties": false,
+ "description": "VCS patch applied"
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "VcsApplyError",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/VcsApplyError"
+ }
+ }
+ }
+ }
+ },
+ "description": "Apply a raw patch to the current working tree.",
+ "summary": "Apply VCS patch",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "patch": {
+ "type": "string"
+ }
+ },
+ "required": ["patch"],
+ "additionalProperties": false
+ }
+ }
+ }
+ },
+ "x-codeSamples": [
+ {
+ "lang": "js",
+ "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.vcs.apply({\n ...\n})"
+ }
+ ]
+ }
+ },
"/command": {
"get": {
"tags": ["instance"],
@@ -8396,11 +8566,18 @@
"description": "Session warped"
},
"400": {
- "description": "Bad request",
+ "description": "WorkspaceWarpError | VcsApplyError",
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/BadRequestError"
+ "anyOf": [
+ {
+ "$ref": "#/components/schemas/WorkspaceWarpError"
+ },
+ {
+ "$ref": "#/components/schemas/VcsApplyError"
+ }
+ ]
}
}
}
@@ -8426,6 +8603,9 @@
},
"sessionID": {
"type": "string"
+ },
+ "copyChanges": {
+ "type": "boolean"
}
},
"required": ["id", "sessionID"],
@@ -12665,6 +12845,28 @@
},
"additionalProperties": false
},
+ "VcsFileStatus": {
+ "type": "object",
+ "properties": {
+ "file": {
+ "type": "string"
+ },
+ "additions": {
+ "type": "integer",
+ "minimum": 0
+ },
+ "deletions": {
+ "type": "integer",
+ "minimum": 0
+ },
+ "status": {
+ "type": "string",
+ "enum": ["added", "deleted", "modified"]
+ }
+ },
+ "required": ["file", "additions", "deletions", "status"],
+ "additionalProperties": false
+ },
"VcsFileDiff": {
"type": "object",
"properties": {
@@ -12690,6 +12892,31 @@
"required": ["file", "patch", "additions", "deletions"],
"additionalProperties": false
},
+ "VcsApplyError": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "enum": ["VcsApplyError"]
+ },
+ "data": {
+ "type": "object",
+ "properties": {
+ "message": {
+ "type": "string"
+ },
+ "reason": {
+ "type": "string",
+ "enum": ["non-git", "not-clean"]
+ }
+ },
+ "required": ["message", "reason"],
+ "additionalProperties": false
+ }
+ },
+ "required": ["name", "data"],
+ "additionalProperties": false
+ },
"Command": {
"type": "object",
"properties": {
@@ -13431,6 +13658,27 @@
"required": ["id", "type", "name", "branch", "directory", "extra", "projectID"],
"additionalProperties": false
},
+ "WorkspaceWarpError": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "enum": ["WorkspaceWarpError"]
+ },
+ "data": {
+ "type": "object",
+ "properties": {
+ "message": {
+ "type": "string"
+ }
+ },
+ "required": ["message"],
+ "additionalProperties": false
+ }
+ },
+ "required": ["name", "data"],
+ "additionalProperties": false
+ },
"SyncEventMessageUpdated": {
"type": "object",
"properties": {