feat(core): allow external workspace creation (#26212)

This commit is contained in:
James Long
2026-05-08 11:09:12 -04:00
committed by GitHub
parent c36ab3f935
commit c818c9dcb6
21 changed files with 2039 additions and 145 deletions

View File

@@ -36,6 +36,7 @@ import type {
ExperimentalWorkspaceRemoveErrors,
ExperimentalWorkspaceRemoveResponses,
ExperimentalWorkspaceStatusResponses,
ExperimentalWorkspaceSyncListResponses,
ExperimentalWorkspaceWarpErrors,
ExperimentalWorkspaceWarpResponses,
FileListResponses,
@@ -949,6 +950,36 @@ export class Workspace extends HeyApiClient {
})
}
/**
* Sync workspace list
*
* Register missing workspaces returned by workspace adapters.
*/
public syncList<ThrowOnError extends boolean = false>(
parameters?: {
directory?: string
workspace?: string
},
options?: Options<never, ThrowOnError>,
) {
const params = buildClientParams(
[parameters],
[
{
args: [
{ in: "query", key: "directory" },
{ in: "query", key: "workspace" },
],
},
],
)
return (options?.client ?? this.client).post<ExperimentalWorkspaceSyncListResponses, unknown, ThrowOnError>({
url: "/experimental/workspace/sync-list",
...options,
...params,
})
}
/**
* Workspace status
*

View File

@@ -1755,6 +1755,7 @@ export type Workspace = {
directory: string | null
extra: unknown | null
projectID: string
timeUsed: number | "NaN" | "Infinity" | "-Infinity" | "Infinity" | "-Infinity" | "NaN"
}
export type WorkspaceWarpError = {
@@ -6706,6 +6707,26 @@ export type ExperimentalWorkspaceCreateResponses = {
export type ExperimentalWorkspaceCreateResponse =
ExperimentalWorkspaceCreateResponses[keyof ExperimentalWorkspaceCreateResponses]
export type ExperimentalWorkspaceSyncListData = {
body?: never
path?: never
query?: {
directory?: string
workspace?: string
}
url: "/experimental/workspace/sync-list"
}
export type ExperimentalWorkspaceSyncListResponses = {
/**
* Workspace list synced
*/
204: void
}
export type ExperimentalWorkspaceSyncListResponse =
ExperimentalWorkspaceSyncListResponses[keyof ExperimentalWorkspaceSyncListResponses]
export type ExperimentalWorkspaceStatusData = {
body?: never
path?: never

View File

@@ -8417,6 +8417,43 @@
]
}
},
"/experimental/workspace/sync-list": {
"post": {
"tags": ["workspace"],
"operationId": "experimental.workspace.syncList",
"parameters": [
{
"name": "directory",
"in": "query",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "workspace",
"in": "query",
"required": false,
"schema": {
"type": "string"
}
}
],
"responses": {
"204": {
"description": "Workspace list synced"
}
},
"description": "Register missing workspaces returned by workspace adapters.",
"summary": "Sync workspace list",
"x-codeSamples": [
{
"lang": "js",
"source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.experimental.workspace.syncList({\n ...\n})"
}
]
}
},
"/experimental/workspace/status": {
"get": {
"tags": ["workspace"],
@@ -13672,9 +13709,32 @@
},
"projectID": {
"type": "string"
},
"timeUsed": {
"anyOf": [
{
"type": "number"
},
{
"type": "string",
"enum": ["NaN"]
},
{
"type": "string",
"enum": ["Infinity"]
},
{
"type": "string",
"enum": ["-Infinity"]
},
{
"type": "string",
"enum": ["Infinity", "-Infinity", "NaN"]
}
]
}
},
"required": ["id", "type", "name", "branch", "directory", "extra", "projectID"],
"required": ["id", "type", "name", "branch", "directory", "extra", "projectID", "timeUsed"],
"additionalProperties": false
},
"WorkspaceWarpError": {