@opencode-ai/sdk 1.4.1 → 1.4.3

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.
@@ -107,97 +107,79 @@ export type EventPermissionReplied = {
107
107
  reply: "once" | "always" | "reject";
108
108
  };
109
109
  };
110
- export type SessionStatus = {
111
- type: "idle";
112
- } | {
113
- type: "retry";
114
- attempt: number;
115
- message: string;
116
- next: number;
117
- } | {
118
- type: "busy";
110
+ export type SnapshotFileDiff = {
111
+ file: string;
112
+ patch: string;
113
+ additions: number;
114
+ deletions: number;
115
+ status?: "added" | "deleted" | "modified";
119
116
  };
120
- export type EventSessionStatus = {
121
- type: "session.status";
117
+ export type EventSessionDiff = {
118
+ type: "session.diff";
122
119
  properties: {
123
120
  sessionID: string;
124
- status: SessionStatus;
121
+ diff: Array<SnapshotFileDiff>;
125
122
  };
126
123
  };
127
- export type EventSessionIdle = {
128
- type: "session.idle";
129
- properties: {
130
- sessionID: string;
124
+ export type ProviderAuthError = {
125
+ name: "ProviderAuthError";
126
+ data: {
127
+ providerID: string;
128
+ message: string;
131
129
  };
132
130
  };
133
- export type QuestionOption = {
134
- /**
135
- * Display text (1-5 words, concise)
136
- */
137
- label: string;
138
- /**
139
- * Explanation of choice
140
- */
141
- description: string;
131
+ export type UnknownError = {
132
+ name: "UnknownError";
133
+ data: {
134
+ message: string;
135
+ };
142
136
  };
143
- export type QuestionInfo = {
144
- /**
145
- * Complete question
146
- */
147
- question: string;
148
- /**
149
- * Very short label (max 30 chars)
150
- */
151
- header: string;
152
- /**
153
- * Available choices
154
- */
155
- options: Array<QuestionOption>;
156
- /**
157
- * Allow selecting multiple choices
158
- */
159
- multiple?: boolean;
160
- /**
161
- * Allow typing a custom answer (default: true)
162
- */
163
- custom?: boolean;
137
+ export type MessageOutputLengthError = {
138
+ name: "MessageOutputLengthError";
139
+ data: {
140
+ [key: string]: unknown;
141
+ };
164
142
  };
165
- export type QuestionRequest = {
166
- id: string;
167
- sessionID: string;
168
- /**
169
- * Questions to ask
170
- */
171
- questions: Array<QuestionInfo>;
172
- tool?: {
173
- messageID: string;
174
- callID: string;
143
+ export type MessageAbortedError = {
144
+ name: "MessageAbortedError";
145
+ data: {
146
+ message: string;
175
147
  };
176
148
  };
177
- export type EventQuestionAsked = {
178
- type: "question.asked";
179
- properties: QuestionRequest;
149
+ export type StructuredOutputError = {
150
+ name: "StructuredOutputError";
151
+ data: {
152
+ message: string;
153
+ retries: number;
154
+ };
180
155
  };
181
- export type QuestionAnswer = Array<string>;
182
- export type EventQuestionReplied = {
183
- type: "question.replied";
184
- properties: {
185
- sessionID: string;
186
- requestID: string;
187
- answers: Array<QuestionAnswer>;
156
+ export type ContextOverflowError = {
157
+ name: "ContextOverflowError";
158
+ data: {
159
+ message: string;
160
+ responseBody?: string;
188
161
  };
189
162
  };
190
- export type EventQuestionRejected = {
191
- type: "question.rejected";
192
- properties: {
193
- sessionID: string;
194
- requestID: string;
163
+ export type ApiError = {
164
+ name: "APIError";
165
+ data: {
166
+ message: string;
167
+ statusCode?: number;
168
+ isRetryable: boolean;
169
+ responseHeaders?: {
170
+ [key: string]: string;
171
+ };
172
+ responseBody?: string;
173
+ metadata?: {
174
+ [key: string]: string;
175
+ };
195
176
  };
196
177
  };
197
- export type EventSessionCompacted = {
198
- type: "session.compacted";
178
+ export type EventSessionError = {
179
+ type: "session.error";
199
180
  properties: {
200
- sessionID: string;
181
+ sessionID?: string;
182
+ error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError | StructuredOutputError | ContextOverflowError | ApiError;
201
183
  };
202
184
  };
203
185
  export type EventFileEdited = {
@@ -213,25 +195,10 @@ export type EventFileWatcherUpdated = {
213
195
  event: "add" | "change" | "unlink";
214
196
  };
215
197
  };
216
- export type Todo = {
217
- /**
218
- * Brief description of the task
219
- */
220
- content: string;
221
- /**
222
- * Current status of the task: pending, in_progress, completed, cancelled
223
- */
224
- status: string;
225
- /**
226
- * Priority level of the task: high, medium, low
227
- */
228
- priority: string;
229
- };
230
- export type EventTodoUpdated = {
231
- type: "todo.updated";
198
+ export type EventVcsBranchUpdated = {
199
+ type: "vcs.branch.updated";
232
200
  properties: {
233
- sessionID: string;
234
- todos: Array<Todo>;
201
+ branch?: string;
235
202
  };
236
203
  };
237
204
  export type EventTuiPromptAppend = {
@@ -289,97 +256,130 @@ export type EventCommandExecuted = {
289
256
  messageID: string;
290
257
  };
291
258
  };
292
- export type SnapshotFileDiff = {
293
- file: string;
294
- patch: string;
295
- additions: number;
296
- deletions: number;
297
- status?: "added" | "deleted" | "modified";
298
- };
299
- export type EventSessionDiff = {
300
- type: "session.diff";
259
+ export type EventWorkspaceReady = {
260
+ type: "workspace.ready";
301
261
  properties: {
302
- sessionID: string;
303
- diff: Array<SnapshotFileDiff>;
262
+ name: string;
304
263
  };
305
264
  };
306
- export type ProviderAuthError = {
307
- name: "ProviderAuthError";
308
- data: {
309
- providerID: string;
265
+ export type EventWorkspaceFailed = {
266
+ type: "workspace.failed";
267
+ properties: {
310
268
  message: string;
311
269
  };
312
270
  };
313
- export type UnknownError = {
314
- name: "UnknownError";
315
- data: {
316
- message: string;
317
- };
271
+ export type QuestionOption = {
272
+ /**
273
+ * Display text (1-5 words, concise)
274
+ */
275
+ label: string;
276
+ /**
277
+ * Explanation of choice
278
+ */
279
+ description: string;
318
280
  };
319
- export type MessageOutputLengthError = {
320
- name: "MessageOutputLengthError";
321
- data: {
322
- [key: string]: unknown;
323
- };
281
+ export type QuestionInfo = {
282
+ /**
283
+ * Complete question
284
+ */
285
+ question: string;
286
+ /**
287
+ * Very short label (max 30 chars)
288
+ */
289
+ header: string;
290
+ /**
291
+ * Available choices
292
+ */
293
+ options: Array<QuestionOption>;
294
+ /**
295
+ * Allow selecting multiple choices
296
+ */
297
+ multiple?: boolean;
298
+ /**
299
+ * Allow typing a custom answer (default: true)
300
+ */
301
+ custom?: boolean;
324
302
  };
325
- export type MessageAbortedError = {
326
- name: "MessageAbortedError";
327
- data: {
328
- message: string;
303
+ export type QuestionRequest = {
304
+ id: string;
305
+ sessionID: string;
306
+ /**
307
+ * Questions to ask
308
+ */
309
+ questions: Array<QuestionInfo>;
310
+ tool?: {
311
+ messageID: string;
312
+ callID: string;
329
313
  };
330
314
  };
331
- export type StructuredOutputError = {
332
- name: "StructuredOutputError";
333
- data: {
334
- message: string;
335
- retries: number;
336
- };
315
+ export type EventQuestionAsked = {
316
+ type: "question.asked";
317
+ properties: QuestionRequest;
337
318
  };
338
- export type ContextOverflowError = {
339
- name: "ContextOverflowError";
340
- data: {
341
- message: string;
342
- responseBody?: string;
319
+ export type QuestionAnswer = Array<string>;
320
+ export type EventQuestionReplied = {
321
+ type: "question.replied";
322
+ properties: {
323
+ sessionID: string;
324
+ requestID: string;
325
+ answers: Array<QuestionAnswer>;
343
326
  };
344
327
  };
345
- export type ApiError = {
346
- name: "APIError";
347
- data: {
348
- message: string;
349
- statusCode?: number;
350
- isRetryable: boolean;
351
- responseHeaders?: {
352
- [key: string]: string;
353
- };
354
- responseBody?: string;
355
- metadata?: {
356
- [key: string]: string;
357
- };
328
+ export type EventQuestionRejected = {
329
+ type: "question.rejected";
330
+ properties: {
331
+ sessionID: string;
332
+ requestID: string;
358
333
  };
359
334
  };
360
- export type EventSessionError = {
361
- type: "session.error";
335
+ export type SessionStatus = {
336
+ type: "idle";
337
+ } | {
338
+ type: "retry";
339
+ attempt: number;
340
+ message: string;
341
+ next: number;
342
+ } | {
343
+ type: "busy";
344
+ };
345
+ export type EventSessionStatus = {
346
+ type: "session.status";
362
347
  properties: {
363
- sessionID?: string;
364
- error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError | StructuredOutputError | ContextOverflowError | ApiError;
348
+ sessionID: string;
349
+ status: SessionStatus;
365
350
  };
366
351
  };
367
- export type EventVcsBranchUpdated = {
368
- type: "vcs.branch.updated";
352
+ export type EventSessionIdle = {
353
+ type: "session.idle";
369
354
  properties: {
370
- branch?: string;
355
+ sessionID: string;
371
356
  };
372
357
  };
373
- export type EventWorkspaceReady = {
374
- type: "workspace.ready";
358
+ export type EventSessionCompacted = {
359
+ type: "session.compacted";
375
360
  properties: {
376
- name: string;
361
+ sessionID: string;
377
362
  };
378
363
  };
379
- export type EventWorkspaceFailed = {
380
- type: "workspace.failed";
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;
377
+ };
378
+ export type EventTodoUpdated = {
379
+ type: "todo.updated";
381
380
  properties: {
382
- message: string;
381
+ sessionID: string;
382
+ todos: Array<Todo>;
383
383
  };
384
384
  };
385
385
  export type Pty = {
@@ -816,7 +816,7 @@ export type EventSessionDeleted = {
816
816
  info: Session;
817
817
  };
818
818
  };
819
- export type Event = EventProjectUpdated | EventInstallationUpdated | EventInstallationUpdateAvailable | EventServerInstanceDisposed | EventServerConnected | EventGlobalDisposed | EventLspClientDiagnostics | EventLspUpdated | EventMessagePartDelta | EventPermissionAsked | EventPermissionReplied | EventSessionStatus | EventSessionIdle | EventQuestionAsked | EventQuestionReplied | EventQuestionRejected | EventSessionCompacted | EventFileEdited | EventFileWatcherUpdated | EventTodoUpdated | EventTuiPromptAppend | EventTuiCommandExecute | EventTuiToastShow | EventTuiSessionSelect | EventMcpToolsChanged | EventMcpBrowserOpenFailed | EventCommandExecuted | EventSessionDiff | EventSessionError | EventVcsBranchUpdated | EventWorkspaceReady | EventWorkspaceFailed | EventPtyCreated | EventPtyUpdated | EventPtyExited | EventPtyDeleted | EventWorktreeReady | EventWorktreeFailed | EventMessageUpdated | EventMessageRemoved | EventMessagePartUpdated | EventMessagePartRemoved | EventSessionCreated | EventSessionUpdated | EventSessionDeleted;
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
820
  export type GlobalEvent = {
821
821
  directory: string;
822
822
  payload: Event;
@@ -1141,6 +1141,10 @@ export type McpOAuthConfig = {
1141
1141
  * OAuth scopes to request during authorization
1142
1142
  */
1143
1143
  scope?: string;
1144
+ /**
1145
+ * OAuth redirect URI (default: http://127.0.0.1:19876/mcp/oauth/callback).
1146
+ */
1147
+ redirectUri?: string;
1144
1148
  };
1145
1149
  export type McpRemoteConfig = {
1146
1150
  /**
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.1",
4
+ "version": "1.4.3",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "scripts": {