diff options
| author | James Long <[email protected]> | 2026-04-10 13:03:20 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-04-10 13:03:20 -0400 |
| commit | 180ded6a27c49c0f95c8af5ff17ccacaa54eceab (patch) | |
| tree | 9ef4812c57b8a7e4f2d156ba144a4c69bf29b370 /packages/sdk | |
| parent | bf601628db3c187478ff853fe33b91cec652355e (diff) | |
| download | opencode-180ded6a27c49c0f95c8af5ff17ccacaa54eceab.tar.gz opencode-180ded6a27c49c0f95c8af5ff17ccacaa54eceab.zip | |
rector(core,tui): handle workspace state in project context, add workspace status, improve ui (#21896)
Diffstat (limited to 'packages/sdk')
| -rw-r--r-- | packages/sdk/js/src/v2/gen/sdk.gen.ts | 31 | ||||
| -rw-r--r-- | packages/sdk/js/src/v2/gen/types.gen.ts | 34 | ||||
| -rw-r--r-- | packages/sdk/openapi.json | 88 |
3 files changed, 153 insertions, 0 deletions
diff --git a/packages/sdk/js/src/v2/gen/sdk.gen.ts b/packages/sdk/js/src/v2/gen/sdk.gen.ts index b2e37db59..d06a504d6 100644 --- a/packages/sdk/js/src/v2/gen/sdk.gen.ts +++ b/packages/sdk/js/src/v2/gen/sdk.gen.ts @@ -34,6 +34,7 @@ import type { ExperimentalWorkspaceListResponses, ExperimentalWorkspaceRemoveErrors, ExperimentalWorkspaceRemoveResponses, + ExperimentalWorkspaceStatusResponses, FileListResponses, FilePartInput, FilePartSource, @@ -1164,6 +1165,36 @@ export class Workspace extends HeyApiClient { } /** + * Workspace status + * + * Get connection status for workspaces in the current project. + */ + public status<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).get<ExperimentalWorkspaceStatusResponses, unknown, ThrowOnError>({ + url: "/experimental/workspace/status", + ...options, + ...params, + }) + } + + /** * Remove workspace * * Remove an existing workspace. diff --git a/packages/sdk/js/src/v2/gen/types.gen.ts b/packages/sdk/js/src/v2/gen/types.gen.ts index 823c452f9..c1a77bfe8 100644 --- a/packages/sdk/js/src/v2/gen/types.gen.ts +++ b/packages/sdk/js/src/v2/gen/types.gen.ts @@ -330,6 +330,15 @@ export type EventWorkspaceFailed = { } } +export type EventWorkspaceStatus = { + type: "workspace.status" + properties: { + workspaceID: string + status: "connected" | "connecting" | "disconnected" | "error" + error?: string + } +} + export type QuestionOption = { /** * Display text (1-5 words, concise) @@ -988,6 +997,7 @@ export type Event = | EventCommandExecuted | EventWorkspaceReady | EventWorkspaceFailed + | EventWorkspaceStatus | EventQuestionAsked | EventQuestionReplied | EventQuestionRejected @@ -2857,6 +2867,30 @@ export type ExperimentalWorkspaceCreateResponses = { 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: { diff --git a/packages/sdk/openapi.json b/packages/sdk/openapi.json index 40361c280..deece485e 100644 --- a/packages/sdk/openapi.json +++ b/packages/sdk/openapi.json @@ -1656,6 +1656,64 @@ ] } }, + "/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", @@ -7966,6 +8024,33 @@ }, "required": ["type", "properties"] }, + "Event.workspace.status": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "workspace.status" + }, + "properties": { + "type": "object", + "properties": { + "workspaceID": { + "type": "string", + "pattern": "^wrk.*" + }, + "status": { + "type": "string", + "enum": ["connected", "connecting", "disconnected", "error"] + }, + "error": { + "type": "string" + } + }, + "required": ["workspaceID", "status"] + } + }, + "required": ["type", "properties"] + }, "QuestionOption": { "type": "object", "properties": { @@ -9859,6 +9944,9 @@ "$ref": "#/components/schemas/Event.workspace.failed" }, { + "$ref": "#/components/schemas/Event.workspace.status" + }, + { "$ref": "#/components/schemas/Event.question.asked" }, { |
