summaryrefslogtreecommitdiffhomepage
path: root/packages/sdk
diff options
context:
space:
mode:
authorJames Long <[email protected]>2026-04-17 13:30:09 -0400
committerGitHub <[email protected]>2026-04-17 13:30:09 -0400
commita8c78fc005a9a1cff3622a68f65b1df550cb2ccc (patch)
tree3abdb0692252d762fb5081c767a80aad4440f83d /packages/sdk
parentfcb473ff64f0767461c27db8942ce41df3e115d3 (diff)
downloadopencode-a8c78fc005a9a1cff3622a68f65b1df550cb2ccc.tar.gz
opencode-a8c78fc005a9a1cff3622a68f65b1df550cb2ccc.zip
fix(core): add historical sync on workspace connect (#23121)
Diffstat (limited to 'packages/sdk')
-rw-r--r--packages/sdk/js/src/v2/gen/sdk.gen.ts33
-rw-r--r--packages/sdk/js/src/v2/gen/types.gen.ts19
-rw-r--r--packages/sdk/openapi.json43
3 files changed, 93 insertions, 2 deletions
diff --git a/packages/sdk/js/src/v2/gen/sdk.gen.ts b/packages/sdk/js/src/v2/gen/sdk.gen.ts
index f484147a4..6248eb8e4 100644
--- a/packages/sdk/js/src/v2/gen/sdk.gen.ts
+++ b/packages/sdk/js/src/v2/gen/sdk.gen.ts
@@ -163,6 +163,7 @@ import type {
SyncHistoryListResponses,
SyncReplayErrors,
SyncReplayResponses,
+ SyncStartResponses,
TextPartInput,
ToolIdsErrors,
ToolIdsResponses,
@@ -3038,7 +3039,7 @@ export class History extends HeyApiClient {
},
],
)
- return (options?.client ?? this.client).get<SyncHistoryListResponses, SyncHistoryListErrors, ThrowOnError>({
+ return (options?.client ?? this.client).post<SyncHistoryListResponses, SyncHistoryListErrors, ThrowOnError>({
url: "/sync/history",
...options,
...params,
@@ -3053,6 +3054,36 @@ export class History extends HeyApiClient {
export class Sync extends HeyApiClient {
/**
+ * Start workspace sync
+ *
+ * Start sync loops for workspaces in the current project that have active sessions.
+ */
+ public start<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<SyncStartResponses, unknown, ThrowOnError>({
+ url: "/sync/start",
+ ...options,
+ ...params,
+ })
+ }
+
+ /**
* Replay sync events
*
* Validate and replay a complete sync event history.
diff --git a/packages/sdk/js/src/v2/gen/types.gen.ts b/packages/sdk/js/src/v2/gen/types.gen.ts
index 460c2bcdf..5698cba54 100644
--- a/packages/sdk/js/src/v2/gen/types.gen.ts
+++ b/packages/sdk/js/src/v2/gen/types.gen.ts
@@ -4502,6 +4502,25 @@ export type ProviderOauthCallbackResponses = {
export type ProviderOauthCallbackResponse = ProviderOauthCallbackResponses[keyof ProviderOauthCallbackResponses]
+export type SyncStartData = {
+ body?: never
+ path?: never
+ query?: {
+ directory?: string
+ workspace?: string
+ }
+ url: "/sync/start"
+}
+
+export type SyncStartResponses = {
+ /**
+ * Workspace sync started
+ */
+ 200: boolean
+}
+
+export type SyncStartResponse = SyncStartResponses[keyof SyncStartResponses]
+
export type SyncReplayData = {
body?: {
directory: string
diff --git a/packages/sdk/openapi.json b/packages/sdk/openapi.json
index 7bdf025bb..3b811f2fa 100644
--- a/packages/sdk/openapi.json
+++ b/packages/sdk/openapi.json
@@ -5224,6 +5224,47 @@
]
}
},
+ "/sync/start": {
+ "post": {
+ "operationId": "sync.start",
+ "parameters": [
+ {
+ "in": "query",
+ "name": "directory",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "in": "query",
+ "name": "workspace",
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "summary": "Start workspace sync",
+ "description": "Start sync loops for workspaces in the current project that have active sessions.",
+ "responses": {
+ "200": {
+ "description": "Workspace sync started",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "boolean"
+ }
+ }
+ }
+ }
+ },
+ "x-codeSamples": [
+ {
+ "lang": "js",
+ "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.sync.start({\n ...\n})"
+ }
+ ]
+ }
+ },
"/sync/replay": {
"post": {
"operationId": "sync.replay",
@@ -5328,7 +5369,7 @@
}
},
"/sync/history": {
- "get": {
+ "post": {
"operationId": "sync.history.list",
"parameters": [
{