@opencode-ai/sdk 1.4.3 → 1.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/v2/client.js CHANGED
@@ -66,6 +66,11 @@ export function createOpencodeClient(config) {
66
66
  directory: config?.directory,
67
67
  workspace: config?.experimental_workspaceID,
68
68
  }));
69
- const result = new OpencodeClient({ client });
70
- return result;
69
+ client.interceptors.response.use((response) => {
70
+ const contentType = response.headers.get("content-type");
71
+ if (contentType === "text/html")
72
+ throw new Error("Request is not supported by this version of OpenCode Server (Server responded with text/html)");
73
+ return response;
74
+ });
75
+ return new OpencodeClient({ client });
71
76
  }
@@ -1,5 +1,5 @@
1
1
  import { type Client, type Options as Options2, type TDataShape } from "./client/index.js";
2
- import type { AgentPartInput, AppAgentsResponses, AppLogErrors, AppLogResponses, AppSkillsResponses, Auth as Auth3, AuthRemoveErrors, AuthRemoveResponses, AuthSetErrors, AuthSetResponses, CommandListResponses, Config as Config3, ConfigGetResponses, ConfigProvidersResponses, ConfigUpdateErrors, ConfigUpdateResponses, EventSubscribeResponses, EventTuiCommandExecute, EventTuiPromptAppend, EventTuiSessionSelect, EventTuiToastShow, ExperimentalConsoleGetResponses, ExperimentalConsoleListOrgsResponses, ExperimentalConsoleSwitchOrgResponses, ExperimentalResourceListResponses, ExperimentalSessionListResponses, ExperimentalWorkspaceCreateErrors, ExperimentalWorkspaceCreateResponses, ExperimentalWorkspaceListResponses, ExperimentalWorkspaceRemoveErrors, ExperimentalWorkspaceRemoveResponses, FileListResponses, FilePartInput, FilePartSource, FileReadResponses, FileStatusResponses, FindFilesResponses, FindSymbolsResponses, FindTextResponses, FormatterStatusResponses, GlobalConfigGetResponses, GlobalConfigUpdateErrors, GlobalConfigUpdateResponses, GlobalDisposeResponses, GlobalEventResponses, GlobalHealthResponses, GlobalSyncEventSubscribeResponses, GlobalUpgradeErrors, GlobalUpgradeResponses, InstanceDisposeResponses, LspStatusResponses, McpAddErrors, McpAddResponses, McpAuthAuthenticateErrors, McpAuthAuthenticateResponses, McpAuthCallbackErrors, McpAuthCallbackResponses, McpAuthRemoveErrors, McpAuthRemoveResponses, McpAuthStartErrors, McpAuthStartResponses, McpConnectResponses, McpDisconnectResponses, McpLocalConfig, McpRemoteConfig, McpStatusResponses, OutputFormat, Part as Part2, PartDeleteErrors, PartDeleteResponses, PartUpdateErrors, PartUpdateResponses, PathGetResponses, PermissionListResponses, PermissionReplyErrors, PermissionReplyResponses, PermissionRespondErrors, PermissionRespondResponses, PermissionRuleset, ProjectCurrentResponses, ProjectInitGitResponses, ProjectListResponses, ProjectUpdateErrors, ProjectUpdateResponses, ProviderAuthResponses, ProviderListResponses, ProviderOauthAuthorizeErrors, ProviderOauthAuthorizeResponses, ProviderOauthCallbackErrors, ProviderOauthCallbackResponses, PtyConnectErrors, PtyConnectResponses, PtyCreateErrors, PtyCreateResponses, PtyGetErrors, PtyGetResponses, PtyListResponses, PtyRemoveErrors, PtyRemoveResponses, PtyUpdateErrors, PtyUpdateResponses, QuestionAnswer, QuestionListResponses, QuestionRejectErrors, QuestionRejectResponses, QuestionReplyErrors, QuestionReplyResponses, SessionAbortErrors, SessionAbortResponses, SessionChildrenErrors, SessionChildrenResponses, SessionCommandErrors, SessionCommandResponses, SessionCreateErrors, SessionCreateResponses, SessionDeleteErrors, SessionDeleteMessageErrors, SessionDeleteMessageResponses, SessionDeleteResponses, SessionDiffResponses, SessionForkResponses, SessionGetErrors, SessionGetResponses, SessionInitErrors, SessionInitResponses, SessionListResponses, SessionMessageErrors, SessionMessageResponses, SessionMessagesErrors, SessionMessagesResponses, SessionPromptAsyncErrors, SessionPromptAsyncResponses, SessionPromptErrors, SessionPromptResponses, SessionRevertErrors, SessionRevertResponses, SessionShareErrors, SessionShareResponses, SessionShellErrors, SessionShellResponses, SessionStatusErrors, SessionStatusResponses, SessionSummarizeErrors, SessionSummarizeResponses, SessionTodoErrors, SessionTodoResponses, SessionUnrevertErrors, SessionUnrevertResponses, SessionUnshareErrors, SessionUnshareResponses, SessionUpdateErrors, SessionUpdateResponses, SubtaskPartInput, TextPartInput, ToolIdsErrors, ToolIdsResponses, ToolListErrors, ToolListResponses, TuiAppendPromptErrors, TuiAppendPromptResponses, TuiClearPromptResponses, TuiControlNextResponses, TuiControlResponseResponses, TuiExecuteCommandErrors, TuiExecuteCommandResponses, TuiOpenHelpResponses, TuiOpenModelsResponses, TuiOpenSessionsResponses, TuiOpenThemesResponses, TuiPublishErrors, TuiPublishResponses, TuiSelectSessionErrors, TuiSelectSessionResponses, TuiShowToastResponses, TuiSubmitPromptResponses, VcsDiffResponses, VcsGetResponses, WorktreeCreateErrors, WorktreeCreateInput, WorktreeCreateResponses, WorktreeListResponses, WorktreeRemoveErrors, WorktreeRemoveInput, WorktreeRemoveResponses, WorktreeResetErrors, WorktreeResetInput, WorktreeResetResponses } from "./types.gen.js";
2
+ import type { AgentPartInput, AppAgentsResponses, AppLogErrors, AppLogResponses, AppSkillsResponses, Auth as Auth3, AuthRemoveErrors, AuthRemoveResponses, AuthSetErrors, AuthSetResponses, CommandListResponses, Config as Config3, ConfigGetResponses, ConfigProvidersResponses, ConfigUpdateErrors, ConfigUpdateResponses, EventSubscribeResponses, EventTuiCommandExecute, EventTuiPromptAppend, EventTuiSessionSelect, EventTuiToastShow, ExperimentalConsoleGetResponses, ExperimentalConsoleListOrgsResponses, ExperimentalConsoleSwitchOrgResponses, ExperimentalResourceListResponses, ExperimentalSessionListResponses, ExperimentalWorkspaceAdaptorListResponses, ExperimentalWorkspaceCreateErrors, ExperimentalWorkspaceCreateResponses, ExperimentalWorkspaceListResponses, ExperimentalWorkspaceRemoveErrors, ExperimentalWorkspaceRemoveResponses, ExperimentalWorkspaceStatusResponses, FileListResponses, FilePartInput, FilePartSource, FileReadResponses, FileStatusResponses, FindFilesResponses, FindSymbolsResponses, FindTextResponses, FormatterStatusResponses, GlobalConfigGetResponses, GlobalConfigUpdateErrors, GlobalConfigUpdateResponses, GlobalDisposeResponses, GlobalEventResponses, GlobalHealthResponses, GlobalUpgradeErrors, GlobalUpgradeResponses, InstanceDisposeResponses, LspStatusResponses, McpAddErrors, McpAddResponses, McpAuthAuthenticateErrors, McpAuthAuthenticateResponses, McpAuthCallbackErrors, McpAuthCallbackResponses, McpAuthRemoveErrors, McpAuthRemoveResponses, McpAuthStartErrors, McpAuthStartResponses, McpConnectResponses, McpDisconnectResponses, McpLocalConfig, McpRemoteConfig, McpStatusResponses, OutputFormat, Part as Part2, PartDeleteErrors, PartDeleteResponses, PartUpdateErrors, PartUpdateResponses, PathGetResponses, PermissionListResponses, PermissionReplyErrors, PermissionReplyResponses, PermissionRespondErrors, PermissionRespondResponses, PermissionRuleset, ProjectCurrentResponses, ProjectInitGitResponses, ProjectListResponses, ProjectUpdateErrors, ProjectUpdateResponses, ProviderAuthResponses, ProviderListResponses, ProviderOauthAuthorizeErrors, ProviderOauthAuthorizeResponses, ProviderOauthCallbackErrors, ProviderOauthCallbackResponses, PtyConnectErrors, PtyConnectResponses, PtyCreateErrors, PtyCreateResponses, PtyGetErrors, PtyGetResponses, PtyListResponses, PtyRemoveErrors, PtyRemoveResponses, PtyUpdateErrors, PtyUpdateResponses, QuestionAnswer, QuestionListResponses, QuestionRejectErrors, QuestionRejectResponses, QuestionReplyErrors, QuestionReplyResponses, SessionAbortErrors, SessionAbortResponses, SessionChildrenErrors, SessionChildrenResponses, SessionCommandErrors, SessionCommandResponses, SessionCreateErrors, SessionCreateResponses, SessionDeleteErrors, SessionDeleteMessageErrors, SessionDeleteMessageResponses, SessionDeleteResponses, SessionDiffResponses, SessionForkResponses, SessionGetErrors, SessionGetResponses, SessionInitErrors, SessionInitResponses, SessionListResponses, SessionMessageErrors, SessionMessageResponses, SessionMessagesErrors, SessionMessagesResponses, SessionPromptAsyncErrors, SessionPromptAsyncResponses, SessionPromptErrors, SessionPromptResponses, SessionRevertErrors, SessionRevertResponses, SessionShareErrors, SessionShareResponses, SessionShellErrors, SessionShellResponses, SessionStatusErrors, SessionStatusResponses, SessionSummarizeErrors, SessionSummarizeResponses, SessionTodoErrors, SessionTodoResponses, SessionUnrevertErrors, SessionUnrevertResponses, SessionUnshareErrors, SessionUnshareResponses, SessionUpdateErrors, SessionUpdateResponses, SubtaskPartInput, TextPartInput, ToolIdsErrors, ToolIdsResponses, ToolListErrors, ToolListResponses, TuiAppendPromptErrors, TuiAppendPromptResponses, TuiClearPromptResponses, TuiControlNextResponses, TuiControlResponseResponses, TuiExecuteCommandErrors, TuiExecuteCommandResponses, TuiOpenHelpResponses, TuiOpenModelsResponses, TuiOpenSessionsResponses, TuiOpenThemesResponses, TuiPublishErrors, TuiPublishResponses, TuiSelectSessionErrors, TuiSelectSessionResponses, TuiShowToastResponses, TuiSubmitPromptResponses, VcsDiffResponses, VcsGetResponses, WorktreeCreateErrors, WorktreeCreateInput, WorktreeCreateResponses, WorktreeListResponses, WorktreeRemoveErrors, WorktreeRemoveInput, WorktreeRemoveResponses, WorktreeResetErrors, WorktreeResetInput, WorktreeResetResponses } from "./types.gen.js";
3
3
  export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = Options2<TData, ThrowOnError> & {
4
4
  /**
5
5
  * You can provide a client instance returned by `createClient()` instead of
@@ -25,14 +25,6 @@ declare class HeyApiRegistry<T> {
25
25
  get(key?: string): T;
26
26
  set(value: T, key?: string): void;
27
27
  }
28
- export declare class SyncEvent extends HeyApiClient {
29
- /**
30
- * Subscribe to global sync events
31
- *
32
- * Get global sync events
33
- */
34
- subscribe<ThrowOnError extends boolean = false>(options?: Options<never, ThrowOnError>): Promise<import("./core/serverSentEvents.gen.js").ServerSentEventsResult<GlobalSyncEventSubscribeResponses, unknown>>;
35
- }
36
28
  export declare class Config extends HeyApiClient {
37
29
  /**
38
30
  * Get global configuration
@@ -76,8 +68,6 @@ export declare class Global extends HeyApiClient {
76
68
  upgrade<ThrowOnError extends boolean = false>(parameters?: {
77
69
  target?: string;
78
70
  }, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<GlobalUpgradeResponses, GlobalUpgradeErrors, ThrowOnError, "fields">;
79
- private _syncEvent?;
80
- get syncEvent(): SyncEvent;
81
71
  private _config?;
82
72
  get config(): Config;
83
73
  }
@@ -319,6 +309,17 @@ export declare class Console extends HeyApiClient {
319
309
  orgID?: string;
320
310
  }, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<ExperimentalConsoleSwitchOrgResponses, unknown, ThrowOnError, "fields">;
321
311
  }
312
+ export declare class Adaptor extends HeyApiClient {
313
+ /**
314
+ * List workspace adaptors
315
+ *
316
+ * List all available workspace adaptors for the current project.
317
+ */
318
+ list<ThrowOnError extends boolean = false>(parameters?: {
319
+ directory?: string;
320
+ workspace?: string;
321
+ }, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<ExperimentalWorkspaceAdaptorListResponses, unknown, ThrowOnError, "fields">;
322
+ }
322
323
  export declare class Workspace extends HeyApiClient {
323
324
  /**
324
325
  * List workspaces
@@ -342,6 +343,15 @@ export declare class Workspace extends HeyApiClient {
342
343
  branch?: string | null;
343
344
  extra?: unknown | null;
344
345
  }, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<ExperimentalWorkspaceCreateResponses, ExperimentalWorkspaceCreateErrors, ThrowOnError, "fields">;
346
+ /**
347
+ * Workspace status
348
+ *
349
+ * Get connection status for workspaces in the current project.
350
+ */
351
+ status<ThrowOnError extends boolean = false>(parameters?: {
352
+ directory?: string;
353
+ workspace?: string;
354
+ }, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<ExperimentalWorkspaceStatusResponses, unknown, ThrowOnError, "fields">;
345
355
  /**
346
356
  * Remove workspace
347
357
  *
@@ -352,6 +362,8 @@ export declare class Workspace extends HeyApiClient {
352
362
  directory?: string;
353
363
  workspace?: string;
354
364
  }, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<ExperimentalWorkspaceRemoveResponses, ExperimentalWorkspaceRemoveErrors, ThrowOnError, "fields">;
365
+ private _adaptor?;
366
+ get adaptor(): Adaptor;
355
367
  }
356
368
  export declare class Session extends HeyApiClient {
357
369
  /**
@@ -520,6 +532,7 @@ export declare class Session2 extends HeyApiClient {
520
532
  directory?: string;
521
533
  workspace?: string;
522
534
  title?: string;
535
+ permission?: PermissionRuleset;
523
536
  time?: {
524
537
  archived?: number;
525
538
  };
@@ -21,19 +21,6 @@ class HeyApiRegistry {
21
21
  this.instances.set(key ?? this.defaultKey, value);
22
22
  }
23
23
  }
24
- export class SyncEvent extends HeyApiClient {
25
- /**
26
- * Subscribe to global sync events
27
- *
28
- * Get global sync events
29
- */
30
- subscribe(options) {
31
- return (options?.client ?? this.client).sse.get({
32
- url: "/global/sync-event",
33
- ...options,
34
- });
35
- }
36
- }
37
24
  export class Config extends HeyApiClient {
38
25
  /**
39
26
  * Get global configuration
@@ -117,10 +104,6 @@ export class Global extends HeyApiClient {
117
104
  },
118
105
  });
119
106
  }
120
- _syncEvent;
121
- get syncEvent() {
122
- return (this._syncEvent ??= new SyncEvent({ client: this.client }));
123
- }
124
107
  _config;
125
108
  get config() {
126
109
  return (this._config ??= new Config({ client: this.client }));
@@ -608,6 +591,28 @@ export class Console extends HeyApiClient {
608
591
  });
609
592
  }
610
593
  }
594
+ export class Adaptor extends HeyApiClient {
595
+ /**
596
+ * List workspace adaptors
597
+ *
598
+ * List all available workspace adaptors for the current project.
599
+ */
600
+ list(parameters, options) {
601
+ const params = buildClientParams([parameters], [
602
+ {
603
+ args: [
604
+ { in: "query", key: "directory" },
605
+ { in: "query", key: "workspace" },
606
+ ],
607
+ },
608
+ ]);
609
+ return (options?.client ?? this.client).get({
610
+ url: "/experimental/workspace/adaptor",
611
+ ...options,
612
+ ...params,
613
+ });
614
+ }
615
+ }
611
616
  export class Workspace extends HeyApiClient {
612
617
  /**
613
618
  * List workspaces
@@ -658,6 +663,26 @@ export class Workspace extends HeyApiClient {
658
663
  },
659
664
  });
660
665
  }
666
+ /**
667
+ * Workspace status
668
+ *
669
+ * Get connection status for workspaces in the current project.
670
+ */
671
+ status(parameters, options) {
672
+ const params = buildClientParams([parameters], [
673
+ {
674
+ args: [
675
+ { in: "query", key: "directory" },
676
+ { in: "query", key: "workspace" },
677
+ ],
678
+ },
679
+ ]);
680
+ return (options?.client ?? this.client).get({
681
+ url: "/experimental/workspace/status",
682
+ ...options,
683
+ ...params,
684
+ });
685
+ }
661
686
  /**
662
687
  * Remove workspace
663
688
  *
@@ -679,6 +704,10 @@ export class Workspace extends HeyApiClient {
679
704
  ...params,
680
705
  });
681
706
  }
707
+ _adaptor;
708
+ get adaptor() {
709
+ return (this._adaptor ??= new Adaptor({ client: this.client }));
710
+ }
682
711
  }
683
712
  export class Session extends HeyApiClient {
684
713
  /**
@@ -1021,6 +1050,7 @@ export class Session2 extends HeyApiClient {
1021
1050
  { in: "query", key: "directory" },
1022
1051
  { in: "query", key: "workspace" },
1023
1052
  { in: "body", key: "title" },
1053
+ { in: "body", key: "permission" },
1024
1054
  { in: "body", key: "time" },
1025
1055
  ],
1026
1056
  },
@@ -28,6 +28,12 @@ export type EventProjectUpdated = {
28
28
  type: "project.updated";
29
29
  properties: Project;
30
30
  };
31
+ export type EventServerInstanceDisposed = {
32
+ type: "server.instance.disposed";
33
+ properties: {
34
+ directory: string;
35
+ };
36
+ };
31
37
  export type EventInstallationUpdated = {
32
38
  type: "installation.updated";
33
39
  properties: {
@@ -40,12 +46,6 @@ export type EventInstallationUpdateAvailable = {
40
46
  version: string;
41
47
  };
42
48
  };
43
- export type EventServerInstanceDisposed = {
44
- type: "server.instance.disposed";
45
- properties: {
46
- directory: string;
47
- };
48
- };
49
49
  export type EventServerConnected = {
50
50
  type: "server.connected";
51
51
  properties: {
@@ -58,6 +58,19 @@ export type EventGlobalDisposed = {
58
58
  [key: string]: unknown;
59
59
  };
60
60
  };
61
+ export type EventFileEdited = {
62
+ type: "file.edited";
63
+ properties: {
64
+ file: string;
65
+ };
66
+ };
67
+ export type EventFileWatcherUpdated = {
68
+ type: "file.watcher.updated";
69
+ properties: {
70
+ file: string;
71
+ event: "add" | "change" | "unlink";
72
+ };
73
+ };
61
74
  export type EventLspClientDiagnostics = {
62
75
  type: "lsp.client.diagnostics";
63
76
  properties: {
@@ -182,92 +195,6 @@ export type EventSessionError = {
182
195
  error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError | StructuredOutputError | ContextOverflowError | ApiError;
183
196
  };
184
197
  };
185
- export type EventFileEdited = {
186
- type: "file.edited";
187
- properties: {
188
- file: string;
189
- };
190
- };
191
- export type EventFileWatcherUpdated = {
192
- type: "file.watcher.updated";
193
- properties: {
194
- file: string;
195
- event: "add" | "change" | "unlink";
196
- };
197
- };
198
- export type EventVcsBranchUpdated = {
199
- type: "vcs.branch.updated";
200
- properties: {
201
- branch?: string;
202
- };
203
- };
204
- export type EventTuiPromptAppend = {
205
- type: "tui.prompt.append";
206
- properties: {
207
- text: string;
208
- };
209
- };
210
- export type EventTuiCommandExecute = {
211
- type: "tui.command.execute";
212
- properties: {
213
- command: "session.list" | "session.new" | "session.share" | "session.interrupt" | "session.compact" | "session.page.up" | "session.page.down" | "session.line.up" | "session.line.down" | "session.half.page.up" | "session.half.page.down" | "session.first" | "session.last" | "prompt.clear" | "prompt.submit" | "agent.cycle" | string;
214
- };
215
- };
216
- export type EventTuiToastShow = {
217
- type: "tui.toast.show";
218
- properties: {
219
- title?: string;
220
- message: string;
221
- variant: "info" | "success" | "warning" | "error";
222
- /**
223
- * Duration in milliseconds
224
- */
225
- duration?: number;
226
- };
227
- };
228
- export type EventTuiSessionSelect = {
229
- type: "tui.session.select";
230
- properties: {
231
- /**
232
- * Session ID to navigate to
233
- */
234
- sessionID: string;
235
- };
236
- };
237
- export type EventMcpToolsChanged = {
238
- type: "mcp.tools.changed";
239
- properties: {
240
- server: string;
241
- };
242
- };
243
- export type EventMcpBrowserOpenFailed = {
244
- type: "mcp.browser.open.failed";
245
- properties: {
246
- mcpName: string;
247
- url: string;
248
- };
249
- };
250
- export type EventCommandExecuted = {
251
- type: "command.executed";
252
- properties: {
253
- name: string;
254
- sessionID: string;
255
- arguments: string;
256
- messageID: string;
257
- };
258
- };
259
- export type EventWorkspaceReady = {
260
- type: "workspace.ready";
261
- properties: {
262
- name: string;
263
- };
264
- };
265
- export type EventWorkspaceFailed = {
266
- type: "workspace.failed";
267
- properties: {
268
- message: string;
269
- };
270
- };
271
198
  export type QuestionOption = {
272
199
  /**
273
200
  * Display text (1-5 words, concise)
@@ -300,6 +227,10 @@ export type QuestionInfo = {
300
227
  */
301
228
  custom?: boolean;
302
229
  };
230
+ export type QuestionTool = {
231
+ messageID: string;
232
+ callID: string;
233
+ };
303
234
  export type QuestionRequest = {
304
235
  id: string;
305
236
  sessionID: string;
@@ -307,29 +238,49 @@ export type QuestionRequest = {
307
238
  * Questions to ask
308
239
  */
309
240
  questions: Array<QuestionInfo>;
310
- tool?: {
311
- messageID: string;
312
- callID: string;
313
- };
241
+ tool?: QuestionTool;
314
242
  };
315
243
  export type EventQuestionAsked = {
316
244
  type: "question.asked";
317
245
  properties: QuestionRequest;
318
246
  };
319
247
  export type QuestionAnswer = Array<string>;
248
+ export type QuestionReplied = {
249
+ sessionID: string;
250
+ requestID: string;
251
+ answers: Array<QuestionAnswer>;
252
+ };
320
253
  export type EventQuestionReplied = {
321
254
  type: "question.replied";
322
- properties: {
323
- sessionID: string;
324
- requestID: string;
325
- answers: Array<QuestionAnswer>;
326
- };
255
+ properties: QuestionReplied;
256
+ };
257
+ export type QuestionRejected = {
258
+ sessionID: string;
259
+ requestID: string;
327
260
  };
328
261
  export type EventQuestionRejected = {
329
262
  type: "question.rejected";
263
+ properties: QuestionRejected;
264
+ };
265
+ export type Todo = {
266
+ /**
267
+ * Brief description of the task
268
+ */
269
+ content: string;
270
+ /**
271
+ * Current status of the task: pending, in_progress, completed, cancelled
272
+ */
273
+ status: string;
274
+ /**
275
+ * Priority level of the task: high, medium, low
276
+ */
277
+ priority: string;
278
+ };
279
+ export type EventTodoUpdated = {
280
+ type: "todo.updated";
330
281
  properties: {
331
282
  sessionID: string;
332
- requestID: string;
283
+ todos: Array<Todo>;
333
284
  };
334
285
  };
335
286
  export type SessionStatus = {
@@ -361,25 +312,78 @@ export type EventSessionCompacted = {
361
312
  sessionID: string;
362
313
  };
363
314
  };
364
- export type Todo = {
365
- /**
366
- * Brief description of the task
367
- */
368
- content: string;
369
- /**
370
- * Current status of the task: pending, in_progress, completed, cancelled
371
- */
372
- status: string;
373
- /**
374
- * Priority level of the task: high, medium, low
375
- */
376
- priority: string;
315
+ export type EventTuiPromptAppend = {
316
+ type: "tui.prompt.append";
317
+ properties: {
318
+ text: string;
319
+ };
377
320
  };
378
- export type EventTodoUpdated = {
379
- type: "todo.updated";
321
+ export type EventTuiCommandExecute = {
322
+ type: "tui.command.execute";
323
+ properties: {
324
+ command: "session.list" | "session.new" | "session.share" | "session.interrupt" | "session.compact" | "session.page.up" | "session.page.down" | "session.line.up" | "session.line.down" | "session.half.page.up" | "session.half.page.down" | "session.first" | "session.last" | "prompt.clear" | "prompt.submit" | "agent.cycle" | string;
325
+ };
326
+ };
327
+ export type EventTuiToastShow = {
328
+ type: "tui.toast.show";
380
329
  properties: {
330
+ title?: string;
331
+ message: string;
332
+ variant: "info" | "success" | "warning" | "error";
333
+ /**
334
+ * Duration in milliseconds
335
+ */
336
+ duration?: number;
337
+ };
338
+ };
339
+ export type EventTuiSessionSelect = {
340
+ type: "tui.session.select";
341
+ properties: {
342
+ /**
343
+ * Session ID to navigate to
344
+ */
381
345
  sessionID: string;
382
- todos: Array<Todo>;
346
+ };
347
+ };
348
+ export type EventMcpToolsChanged = {
349
+ type: "mcp.tools.changed";
350
+ properties: {
351
+ server: string;
352
+ };
353
+ };
354
+ export type EventMcpBrowserOpenFailed = {
355
+ type: "mcp.browser.open.failed";
356
+ properties: {
357
+ mcpName: string;
358
+ url: string;
359
+ };
360
+ };
361
+ export type EventCommandExecuted = {
362
+ type: "command.executed";
363
+ properties: {
364
+ name: string;
365
+ sessionID: string;
366
+ arguments: string;
367
+ messageID: string;
368
+ };
369
+ };
370
+ export type EventVcsBranchUpdated = {
371
+ type: "vcs.branch.updated";
372
+ properties: {
373
+ branch?: string;
374
+ };
375
+ };
376
+ export type EventWorktreeReady = {
377
+ type: "worktree.ready";
378
+ properties: {
379
+ name: string;
380
+ branch: string;
381
+ };
382
+ };
383
+ export type EventWorktreeFailed = {
384
+ type: "worktree.failed";
385
+ properties: {
386
+ message: string;
383
387
  };
384
388
  };
385
389
  export type Pty = {
@@ -416,19 +420,26 @@ export type EventPtyDeleted = {
416
420
  id: string;
417
421
  };
418
422
  };
419
- export type EventWorktreeReady = {
420
- type: "worktree.ready";
423
+ export type EventWorkspaceReady = {
424
+ type: "workspace.ready";
421
425
  properties: {
422
426
  name: string;
423
- branch: string;
424
427
  };
425
428
  };
426
- export type EventWorktreeFailed = {
427
- type: "worktree.failed";
429
+ export type EventWorkspaceFailed = {
430
+ type: "workspace.failed";
428
431
  properties: {
429
432
  message: string;
430
433
  };
431
434
  };
435
+ export type EventWorkspaceStatus = {
436
+ type: "workspace.status";
437
+ properties: {
438
+ workspaceID: string;
439
+ status: "connected" | "connecting" | "disconnected" | "error";
440
+ error?: string;
441
+ };
442
+ };
432
443
  export type OutputFormatText = {
433
444
  type: "text";
434
445
  };
@@ -816,30 +827,34 @@ export type EventSessionDeleted = {
816
827
  info: Session;
817
828
  };
818
829
  };
819
- export type Event = EventProjectUpdated | EventInstallationUpdated | EventInstallationUpdateAvailable | EventServerInstanceDisposed | EventServerConnected | EventGlobalDisposed | EventLspClientDiagnostics | EventLspUpdated | EventMessagePartDelta | EventPermissionAsked | EventPermissionReplied | EventSessionDiff | EventSessionError | EventFileEdited | EventFileWatcherUpdated | EventVcsBranchUpdated | EventTuiPromptAppend | EventTuiCommandExecute | EventTuiToastShow | EventTuiSessionSelect | EventMcpToolsChanged | EventMcpBrowserOpenFailed | EventCommandExecuted | EventWorkspaceReady | EventWorkspaceFailed | EventQuestionAsked | EventQuestionReplied | EventQuestionRejected | EventSessionStatus | EventSessionIdle | EventSessionCompacted | EventTodoUpdated | EventPtyCreated | EventPtyUpdated | EventPtyExited | EventPtyDeleted | EventWorktreeReady | EventWorktreeFailed | EventMessageUpdated | EventMessageRemoved | EventMessagePartUpdated | EventMessagePartRemoved | EventSessionCreated | EventSessionUpdated | EventSessionDeleted;
820
- export type GlobalEvent = {
821
- directory: string;
822
- payload: Event;
823
- };
824
830
  export type SyncEventMessageUpdated = {
825
- type: "message.updated.1";
826
- aggregate: "sessionID";
831
+ type: "sync";
832
+ name: "message.updated.1";
833
+ id: string;
834
+ seq: number;
835
+ aggregateID: "sessionID";
827
836
  data: {
828
837
  sessionID: string;
829
838
  info: Message;
830
839
  };
831
840
  };
832
841
  export type SyncEventMessageRemoved = {
833
- type: "message.removed.1";
834
- aggregate: "sessionID";
842
+ type: "sync";
843
+ name: "message.removed.1";
844
+ id: string;
845
+ seq: number;
846
+ aggregateID: "sessionID";
835
847
  data: {
836
848
  sessionID: string;
837
849
  messageID: string;
838
850
  };
839
851
  };
840
852
  export type SyncEventMessagePartUpdated = {
841
- type: "message.part.updated.1";
842
- aggregate: "sessionID";
853
+ type: "sync";
854
+ name: "message.part.updated.1";
855
+ id: string;
856
+ seq: number;
857
+ aggregateID: "sessionID";
843
858
  data: {
844
859
  sessionID: string;
845
860
  part: Part;
@@ -847,8 +862,11 @@ export type SyncEventMessagePartUpdated = {
847
862
  };
848
863
  };
849
864
  export type SyncEventMessagePartRemoved = {
850
- type: "message.part.removed.1";
851
- aggregate: "sessionID";
865
+ type: "sync";
866
+ name: "message.part.removed.1";
867
+ id: string;
868
+ seq: number;
869
+ aggregateID: "sessionID";
852
870
  data: {
853
871
  sessionID: string;
854
872
  messageID: string;
@@ -856,16 +874,22 @@ export type SyncEventMessagePartRemoved = {
856
874
  };
857
875
  };
858
876
  export type SyncEventSessionCreated = {
859
- type: "session.created.1";
860
- aggregate: "sessionID";
877
+ type: "sync";
878
+ name: "session.created.1";
879
+ id: string;
880
+ seq: number;
881
+ aggregateID: "sessionID";
861
882
  data: {
862
883
  sessionID: string;
863
884
  info: Session;
864
885
  };
865
886
  };
866
887
  export type SyncEventSessionUpdated = {
867
- type: "session.updated.1";
868
- aggregate: "sessionID";
888
+ type: "sync";
889
+ name: "session.updated.1";
890
+ id: string;
891
+ seq: number;
892
+ aggregateID: "sessionID";
869
893
  data: {
870
894
  sessionID: string;
871
895
  info: {
@@ -903,15 +927,21 @@ export type SyncEventSessionUpdated = {
903
927
  };
904
928
  };
905
929
  export type SyncEventSessionDeleted = {
906
- type: "session.deleted.1";
907
- aggregate: "sessionID";
930
+ type: "sync";
931
+ name: "session.deleted.1";
932
+ id: string;
933
+ seq: number;
934
+ aggregateID: "sessionID";
908
935
  data: {
909
936
  sessionID: string;
910
937
  info: Session;
911
938
  };
912
939
  };
913
- export type SyncEvent = {
914
- payload: SyncEvent;
940
+ export type GlobalEvent = {
941
+ directory: string;
942
+ project?: string;
943
+ workspace?: string;
944
+ payload: EventProjectUpdated | EventServerInstanceDisposed | EventInstallationUpdated | EventInstallationUpdateAvailable | EventServerConnected | EventGlobalDisposed | EventFileEdited | EventFileWatcherUpdated | EventLspClientDiagnostics | EventLspUpdated | EventMessagePartDelta | EventPermissionAsked | EventPermissionReplied | EventSessionDiff | EventSessionError | EventQuestionAsked | EventQuestionReplied | EventQuestionRejected | EventTodoUpdated | EventSessionStatus | EventSessionIdle | EventSessionCompacted | EventTuiPromptAppend | EventTuiCommandExecute | EventTuiToastShow | EventTuiSessionSelect | EventMcpToolsChanged | EventMcpBrowserOpenFailed | EventCommandExecuted | EventVcsBranchUpdated | EventWorktreeReady | EventWorktreeFailed | EventPtyCreated | EventPtyUpdated | EventPtyExited | EventPtyDeleted | EventWorkspaceReady | EventWorkspaceFailed | EventWorkspaceStatus | EventMessageUpdated | EventMessageRemoved | EventMessagePartUpdated | EventMessagePartRemoved | EventSessionCreated | EventSessionUpdated | EventSessionDeleted | SyncEventMessageUpdated | SyncEventMessageRemoved | SyncEventMessagePartUpdated | SyncEventMessagePartRemoved | SyncEventSessionCreated | SyncEventSessionUpdated | SyncEventSessionDeleted;
915
945
  };
916
946
  /**
917
947
  * Log level
@@ -1497,8 +1527,8 @@ export type ToolList = Array<ToolListItem>;
1497
1527
  export type Workspace = {
1498
1528
  id: string;
1499
1529
  type: string;
1530
+ name: string;
1500
1531
  branch: string | null;
1501
- name: string | null;
1502
1532
  directory: string | null;
1503
1533
  extra: unknown | null;
1504
1534
  projectID: string;
@@ -1686,6 +1716,7 @@ export type File = {
1686
1716
  removed: number;
1687
1717
  status: "added" | "deleted" | "modified";
1688
1718
  };
1719
+ export type Event = EventProjectUpdated | EventServerInstanceDisposed | EventInstallationUpdated | EventInstallationUpdateAvailable | EventServerConnected | EventGlobalDisposed | EventFileEdited | EventFileWatcherUpdated | EventLspClientDiagnostics | EventLspUpdated | EventMessagePartDelta | EventPermissionAsked | EventPermissionReplied | EventSessionDiff | EventSessionError | EventQuestionAsked | EventQuestionReplied | EventQuestionRejected | EventTodoUpdated | EventSessionStatus | EventSessionIdle | EventSessionCompacted | EventTuiPromptAppend | EventTuiCommandExecute | EventTuiToastShow | EventTuiSessionSelect | EventMcpToolsChanged | EventMcpBrowserOpenFailed | EventCommandExecuted | EventVcsBranchUpdated | EventWorktreeReady | EventWorktreeFailed | EventPtyCreated | EventPtyUpdated | EventPtyExited | EventPtyDeleted | EventWorkspaceReady | EventWorkspaceFailed | EventWorkspaceStatus | EventMessageUpdated | EventMessageRemoved | EventMessagePartUpdated | EventMessagePartRemoved | EventSessionCreated | EventSessionUpdated | EventSessionDeleted;
1689
1720
  export type McpStatusConnected = {
1690
1721
  status: "connected";
1691
1722
  };
@@ -1793,19 +1824,6 @@ export type GlobalEventResponses = {
1793
1824
  200: GlobalEvent;
1794
1825
  };
1795
1826
  export type GlobalEventResponse = GlobalEventResponses[keyof GlobalEventResponses];
1796
- export type GlobalSyncEventSubscribeData = {
1797
- body?: never;
1798
- path?: never;
1799
- query?: never;
1800
- url: "/global/sync-event";
1801
- };
1802
- export type GlobalSyncEventSubscribeResponses = {
1803
- /**
1804
- * Event stream
1805
- */
1806
- 200: SyncEvent;
1807
- };
1808
- export type GlobalSyncEventSubscribeResponse = GlobalSyncEventSubscribeResponses[keyof GlobalSyncEventSubscribeResponses];
1809
1827
  export type GlobalConfigGetData = {
1810
1828
  body?: never;
1811
1829
  path?: never;
@@ -2381,6 +2399,26 @@ export type ToolListResponses = {
2381
2399
  200: ToolList;
2382
2400
  };
2383
2401
  export type ToolListResponse = ToolListResponses[keyof ToolListResponses];
2402
+ export type ExperimentalWorkspaceAdaptorListData = {
2403
+ body?: never;
2404
+ path?: never;
2405
+ query?: {
2406
+ directory?: string;
2407
+ workspace?: string;
2408
+ };
2409
+ url: "/experimental/workspace/adaptor";
2410
+ };
2411
+ export type ExperimentalWorkspaceAdaptorListResponses = {
2412
+ /**
2413
+ * Workspace adaptors
2414
+ */
2415
+ 200: Array<{
2416
+ type: string;
2417
+ name: string;
2418
+ description: string;
2419
+ }>;
2420
+ };
2421
+ export type ExperimentalWorkspaceAdaptorListResponse = ExperimentalWorkspaceAdaptorListResponses[keyof ExperimentalWorkspaceAdaptorListResponses];
2384
2422
  export type ExperimentalWorkspaceListData = {
2385
2423
  body?: never;
2386
2424
  path?: never;
@@ -2425,6 +2463,26 @@ export type ExperimentalWorkspaceCreateResponses = {
2425
2463
  200: Workspace;
2426
2464
  };
2427
2465
  export type ExperimentalWorkspaceCreateResponse = ExperimentalWorkspaceCreateResponses[keyof ExperimentalWorkspaceCreateResponses];
2466
+ export type ExperimentalWorkspaceStatusData = {
2467
+ body?: never;
2468
+ path?: never;
2469
+ query?: {
2470
+ directory?: string;
2471
+ workspace?: string;
2472
+ };
2473
+ url: "/experimental/workspace/status";
2474
+ };
2475
+ export type ExperimentalWorkspaceStatusResponses = {
2476
+ /**
2477
+ * Workspace status
2478
+ */
2479
+ 200: Array<{
2480
+ workspaceID: string;
2481
+ status: "connected" | "connecting" | "disconnected" | "error";
2482
+ error?: string;
2483
+ }>;
2484
+ };
2485
+ export type ExperimentalWorkspaceStatusResponse = ExperimentalWorkspaceStatusResponses[keyof ExperimentalWorkspaceStatusResponses];
2428
2486
  export type ExperimentalWorkspaceRemoveData = {
2429
2487
  body?: never;
2430
2488
  path: {
@@ -2745,6 +2803,7 @@ export type SessionGetResponse = SessionGetResponses[keyof SessionGetResponses];
2745
2803
  export type SessionUpdateData = {
2746
2804
  body?: {
2747
2805
  title?: string;
2806
+ permission?: PermissionRuleset;
2748
2807
  time?: {
2749
2808
  archived?: number;
2750
2809
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@opencode-ai/sdk",
4
- "version": "1.4.3",
4
+ "version": "1.4.6",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "scripts": {