@opencode-ai/sdk 0.9.6 → 0.9.8

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.
@@ -1,5 +1,5 @@
1
1
  import type { Options as ClientOptions, TDataShape, Client } from "./client/index.js";
2
- import type { ProjectListData, ProjectListResponses, ProjectCurrentData, ProjectCurrentResponses, EventSubscribeData, EventSubscribeResponses, ConfigGetData, ConfigGetResponses, ToolRegisterData, ToolRegisterResponses, ToolRegisterErrors, ToolIdsData, ToolIdsResponses, ToolIdsErrors, ToolListData, ToolListResponses, ToolListErrors, PathGetData, PathGetResponses, SessionListData, SessionListResponses, SessionCreateData, SessionCreateResponses, SessionCreateErrors, SessionDeleteData, SessionDeleteResponses, SessionGetData, SessionGetResponses, SessionUpdateData, SessionUpdateResponses, SessionChildrenData, SessionChildrenResponses, SessionInitData, SessionInitResponses, SessionAbortData, SessionAbortResponses, SessionUnshareData, SessionUnshareResponses, SessionShareData, SessionShareResponses, SessionSummarizeData, SessionSummarizeResponses, SessionMessagesData, SessionMessagesResponses, SessionPromptData, SessionPromptResponses, SessionMessageData, SessionMessageResponses, SessionCommandData, SessionCommandResponses, SessionShellData, SessionShellResponses, SessionRevertData, SessionRevertResponses, SessionUnrevertData, SessionUnrevertResponses, PostSessionIdPermissionsPermissionIdData, PostSessionIdPermissionsPermissionIdResponses, CommandListData, CommandListResponses, ConfigProvidersData, ConfigProvidersResponses, FindTextData, FindTextResponses, FindFilesData, FindFilesResponses, FindSymbolsData, FindSymbolsResponses, FileListData, FileListResponses, FileReadData, FileReadResponses, FileStatusData, FileStatusResponses, AppLogData, AppLogResponses, AppAgentsData, AppAgentsResponses, TuiAppendPromptData, TuiAppendPromptResponses, TuiOpenHelpData, TuiOpenHelpResponses, TuiOpenSessionsData, TuiOpenSessionsResponses, TuiOpenThemesData, TuiOpenThemesResponses, TuiOpenModelsData, TuiOpenModelsResponses, TuiSubmitPromptData, TuiSubmitPromptResponses, TuiClearPromptData, TuiClearPromptResponses, TuiExecuteCommandData, TuiExecuteCommandResponses, TuiShowToastData, TuiShowToastResponses, AuthSetData, AuthSetResponses, AuthSetErrors } from "./types.gen.js";
2
+ import type { ProjectListData, ProjectListResponses, ProjectCurrentData, ProjectCurrentResponses, ConfigGetData, ConfigGetResponses, ToolRegisterData, ToolRegisterResponses, ToolRegisterErrors, ToolIdsData, ToolIdsResponses, ToolIdsErrors, ToolListData, ToolListResponses, ToolListErrors, PathGetData, PathGetResponses, SessionListData, SessionListResponses, SessionCreateData, SessionCreateResponses, SessionCreateErrors, SessionDeleteData, SessionDeleteResponses, SessionGetData, SessionGetResponses, SessionUpdateData, SessionUpdateResponses, SessionChildrenData, SessionChildrenResponses, SessionInitData, SessionInitResponses, SessionAbortData, SessionAbortResponses, SessionUnshareData, SessionUnshareResponses, SessionShareData, SessionShareResponses, SessionSummarizeData, SessionSummarizeResponses, SessionMessagesData, SessionMessagesResponses, SessionPromptData, SessionPromptResponses, SessionMessageData, SessionMessageResponses, SessionCommandData, SessionCommandResponses, SessionShellData, SessionShellResponses, SessionRevertData, SessionRevertResponses, SessionUnrevertData, SessionUnrevertResponses, PostSessionIdPermissionsPermissionIdData, PostSessionIdPermissionsPermissionIdResponses, CommandListData, CommandListResponses, ConfigProvidersData, ConfigProvidersResponses, FindTextData, FindTextResponses, FindFilesData, FindFilesResponses, FindSymbolsData, FindSymbolsResponses, FileListData, FileListResponses, FileReadData, FileReadResponses, FileStatusData, FileStatusResponses, AppLogData, AppLogResponses, AppAgentsData, AppAgentsResponses, TuiAppendPromptData, TuiAppendPromptResponses, TuiOpenHelpData, TuiOpenHelpResponses, TuiOpenSessionsData, TuiOpenSessionsResponses, TuiOpenThemesData, TuiOpenThemesResponses, TuiOpenModelsData, TuiOpenModelsResponses, TuiSubmitPromptData, TuiSubmitPromptResponses, TuiClearPromptData, TuiClearPromptResponses, TuiExecuteCommandData, TuiExecuteCommandResponses, TuiShowToastData, TuiShowToastResponses, AuthSetData, AuthSetResponses, AuthSetErrors, EventSubscribeData, EventSubscribeResponses } from "./types.gen.js";
3
3
  export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = ClientOptions<TData, ThrowOnError> & {
4
4
  /**
5
5
  * You can provide a client instance returned by `createClient()` instead of
@@ -29,12 +29,6 @@ declare class Project extends _HeyApiClient {
29
29
  */
30
30
  current<ThrowOnError extends boolean = false>(options?: Options<ProjectCurrentData, ThrowOnError>): import("./client/types.gen.js").RequestResult<ProjectCurrentResponses, unknown, ThrowOnError, "fields">;
31
31
  }
32
- declare class Event extends _HeyApiClient {
33
- /**
34
- * Get events
35
- */
36
- subscribe<ThrowOnError extends boolean = false>(options?: Options<EventSubscribeData, ThrowOnError>): Promise<import("./core/serverSentEvents.gen.js").ServerSentEventsResult<EventSubscribeResponses, unknown>>;
37
- }
38
32
  declare class Config extends _HeyApiClient {
39
33
  /**
40
34
  * Get config info
@@ -227,13 +221,18 @@ declare class Auth extends _HeyApiClient {
227
221
  */
228
222
  set<ThrowOnError extends boolean = false>(options: Options<AuthSetData, ThrowOnError>): import("./client/types.gen.js").RequestResult<AuthSetResponses, AuthSetErrors, ThrowOnError, "fields">;
229
223
  }
224
+ declare class Event extends _HeyApiClient {
225
+ /**
226
+ * Get events
227
+ */
228
+ subscribe<ThrowOnError extends boolean = false>(options?: Options<EventSubscribeData, ThrowOnError>): Promise<import("./core/serverSentEvents.gen.js").ServerSentEventsResult<EventSubscribeResponses, unknown>>;
229
+ }
230
230
  export declare class OpencodeClient extends _HeyApiClient {
231
231
  /**
232
232
  * Respond to a permission request
233
233
  */
234
234
  postSessionIdPermissionsPermissionId<ThrowOnError extends boolean = false>(options: Options<PostSessionIdPermissionsPermissionIdData, ThrowOnError>): import("./client/types.gen.js").RequestResult<PostSessionIdPermissionsPermissionIdResponses, unknown, ThrowOnError, "fields">;
235
235
  project: Project;
236
- event: Event;
237
236
  config: Config;
238
237
  tool: Tool;
239
238
  path: Path;
@@ -244,5 +243,6 @@ export declare class OpencodeClient extends _HeyApiClient {
244
243
  app: App;
245
244
  tui: Tui;
246
245
  auth: Auth;
246
+ event: Event;
247
247
  }
248
248
  export {};
@@ -28,17 +28,6 @@ class Project extends _HeyApiClient {
28
28
  });
29
29
  }
30
30
  }
31
- class Event extends _HeyApiClient {
32
- /**
33
- * Get events
34
- */
35
- subscribe(options) {
36
- return (options?.client ?? this._client).get.sse({
37
- url: "/event",
38
- ...options,
39
- });
40
- }
41
- }
42
31
  class Config extends _HeyApiClient {
43
32
  /**
44
33
  * Get config info
@@ -502,6 +491,17 @@ class Auth extends _HeyApiClient {
502
491
  });
503
492
  }
504
493
  }
494
+ class Event extends _HeyApiClient {
495
+ /**
496
+ * Get events
497
+ */
498
+ subscribe(options) {
499
+ return (options?.client ?? this._client).get.sse({
500
+ url: "/event",
501
+ ...options,
502
+ });
503
+ }
504
+ }
505
505
  export class OpencodeClient extends _HeyApiClient {
506
506
  /**
507
507
  * Respond to a permission request
@@ -517,7 +517,6 @@ export class OpencodeClient extends _HeyApiClient {
517
517
  });
518
518
  }
519
519
  project = new Project({ client: this._client });
520
- event = new Event({ client: this._client });
521
520
  config = new Config({ client: this._client });
522
521
  tool = new Tool({ client: this._client });
523
522
  path = new Path({ client: this._client });
@@ -528,4 +527,5 @@ export class OpencodeClient extends _HeyApiClient {
528
527
  app = new App({ client: this._client });
529
528
  tui = new Tui({ client: this._client });
530
529
  auth = new Auth({ client: this._client });
530
+ event = new Event({ client: this._client });
531
531
  }
@@ -7,371 +7,6 @@ export type Project = {
7
7
  initialized?: number;
8
8
  };
9
9
  };
10
- export type EventInstallationUpdated = {
11
- type: "installation.updated";
12
- properties: {
13
- version: string;
14
- };
15
- };
16
- export type EventLspClientDiagnostics = {
17
- type: "lsp.client.diagnostics";
18
- properties: {
19
- serverID: string;
20
- path: string;
21
- };
22
- };
23
- export type UserMessage = {
24
- id: string;
25
- sessionID: string;
26
- role: "user";
27
- time: {
28
- created: number;
29
- };
30
- };
31
- export type ProviderAuthError = {
32
- name: "ProviderAuthError";
33
- data: {
34
- providerID: string;
35
- message: string;
36
- };
37
- };
38
- export type UnknownError = {
39
- name: "UnknownError";
40
- data: {
41
- message: string;
42
- };
43
- };
44
- export type MessageOutputLengthError = {
45
- name: "MessageOutputLengthError";
46
- data: {
47
- [key: string]: unknown;
48
- };
49
- };
50
- export type MessageAbortedError = {
51
- name: "MessageAbortedError";
52
- data: {
53
- message: string;
54
- };
55
- };
56
- export type AssistantMessage = {
57
- id: string;
58
- sessionID: string;
59
- role: "assistant";
60
- time: {
61
- created: number;
62
- completed?: number;
63
- };
64
- error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError;
65
- system: Array<string>;
66
- modelID: string;
67
- providerID: string;
68
- mode: string;
69
- path: {
70
- cwd: string;
71
- root: string;
72
- };
73
- summary?: boolean;
74
- cost: number;
75
- tokens: {
76
- input: number;
77
- output: number;
78
- reasoning: number;
79
- cache: {
80
- read: number;
81
- write: number;
82
- };
83
- };
84
- };
85
- export type Message = UserMessage | AssistantMessage;
86
- export type EventMessageUpdated = {
87
- type: "message.updated";
88
- properties: {
89
- info: Message;
90
- };
91
- };
92
- export type EventMessageRemoved = {
93
- type: "message.removed";
94
- properties: {
95
- sessionID: string;
96
- messageID: string;
97
- };
98
- };
99
- export type TextPart = {
100
- id: string;
101
- sessionID: string;
102
- messageID: string;
103
- type: "text";
104
- text: string;
105
- synthetic?: boolean;
106
- time?: {
107
- start: number;
108
- end?: number;
109
- };
110
- };
111
- export type ReasoningPart = {
112
- id: string;
113
- sessionID: string;
114
- messageID: string;
115
- type: "reasoning";
116
- text: string;
117
- metadata?: {
118
- [key: string]: unknown;
119
- };
120
- time: {
121
- start: number;
122
- end?: number;
123
- };
124
- };
125
- export type FilePartSourceText = {
126
- value: string;
127
- start: number;
128
- end: number;
129
- };
130
- export type FileSource = {
131
- text: FilePartSourceText;
132
- type: "file";
133
- path: string;
134
- };
135
- export type Range = {
136
- start: {
137
- line: number;
138
- character: number;
139
- };
140
- end: {
141
- line: number;
142
- character: number;
143
- };
144
- };
145
- export type SymbolSource = {
146
- text: FilePartSourceText;
147
- type: "symbol";
148
- path: string;
149
- range: Range;
150
- name: string;
151
- kind: number;
152
- };
153
- export type FilePartSource = FileSource | SymbolSource;
154
- export type FilePart = {
155
- id: string;
156
- sessionID: string;
157
- messageID: string;
158
- type: "file";
159
- mime: string;
160
- filename?: string;
161
- url: string;
162
- source?: FilePartSource;
163
- };
164
- export type ToolStatePending = {
165
- status: "pending";
166
- };
167
- export type ToolStateRunning = {
168
- status: "running";
169
- input: unknown;
170
- title?: string;
171
- metadata?: {
172
- [key: string]: unknown;
173
- };
174
- time: {
175
- start: number;
176
- };
177
- };
178
- export type ToolStateCompleted = {
179
- status: "completed";
180
- input: {
181
- [key: string]: unknown;
182
- };
183
- output: string;
184
- title: string;
185
- metadata: {
186
- [key: string]: unknown;
187
- };
188
- time: {
189
- start: number;
190
- end: number;
191
- compacted?: number;
192
- };
193
- };
194
- export type ToolStateError = {
195
- status: "error";
196
- input: {
197
- [key: string]: unknown;
198
- };
199
- error: string;
200
- metadata?: {
201
- [key: string]: unknown;
202
- };
203
- time: {
204
- start: number;
205
- end: number;
206
- };
207
- };
208
- export type ToolState = ToolStatePending | ToolStateRunning | ToolStateCompleted | ToolStateError;
209
- export type ToolPart = {
210
- id: string;
211
- sessionID: string;
212
- messageID: string;
213
- type: "tool";
214
- callID: string;
215
- tool: string;
216
- state: ToolState;
217
- };
218
- export type StepStartPart = {
219
- id: string;
220
- sessionID: string;
221
- messageID: string;
222
- type: "step-start";
223
- };
224
- export type StepFinishPart = {
225
- id: string;
226
- sessionID: string;
227
- messageID: string;
228
- type: "step-finish";
229
- cost: number;
230
- tokens: {
231
- input: number;
232
- output: number;
233
- reasoning: number;
234
- cache: {
235
- read: number;
236
- write: number;
237
- };
238
- };
239
- };
240
- export type SnapshotPart = {
241
- id: string;
242
- sessionID: string;
243
- messageID: string;
244
- type: "snapshot";
245
- snapshot: string;
246
- };
247
- export type PatchPart = {
248
- id: string;
249
- sessionID: string;
250
- messageID: string;
251
- type: "patch";
252
- hash: string;
253
- files: Array<string>;
254
- };
255
- export type AgentPart = {
256
- id: string;
257
- sessionID: string;
258
- messageID: string;
259
- type: "agent";
260
- name: string;
261
- source?: {
262
- value: string;
263
- start: number;
264
- end: number;
265
- };
266
- };
267
- export type Part = TextPart | ReasoningPart | FilePart | ToolPart | StepStartPart | StepFinishPart | SnapshotPart | PatchPart | AgentPart;
268
- export type EventMessagePartUpdated = {
269
- type: "message.part.updated";
270
- properties: {
271
- part: Part;
272
- };
273
- };
274
- export type EventMessagePartRemoved = {
275
- type: "message.part.removed";
276
- properties: {
277
- sessionID: string;
278
- messageID: string;
279
- partID: string;
280
- };
281
- };
282
- export type EventSessionCompacted = {
283
- type: "session.compacted";
284
- properties: {
285
- sessionID: string;
286
- };
287
- };
288
- export type Permission = {
289
- id: string;
290
- type: string;
291
- pattern?: string | Array<string>;
292
- sessionID: string;
293
- messageID: string;
294
- callID?: string;
295
- title: string;
296
- metadata: {
297
- [key: string]: unknown;
298
- };
299
- time: {
300
- created: number;
301
- };
302
- };
303
- export type EventPermissionUpdated = {
304
- type: "permission.updated";
305
- properties: Permission;
306
- };
307
- export type EventPermissionReplied = {
308
- type: "permission.replied";
309
- properties: {
310
- sessionID: string;
311
- permissionID: string;
312
- response: string;
313
- };
314
- };
315
- export type EventFileEdited = {
316
- type: "file.edited";
317
- properties: {
318
- file: string;
319
- };
320
- };
321
- export type EventSessionIdle = {
322
- type: "session.idle";
323
- properties: {
324
- sessionID: string;
325
- };
326
- };
327
- export type Session = {
328
- id: string;
329
- projectID: string;
330
- directory: string;
331
- parentID?: string;
332
- share?: {
333
- url: string;
334
- };
335
- title: string;
336
- version: string;
337
- time: {
338
- created: number;
339
- updated: number;
340
- compacting?: number;
341
- };
342
- revert?: {
343
- messageID: string;
344
- partID?: string;
345
- snapshot?: string;
346
- diff?: string;
347
- };
348
- };
349
- export type EventSessionUpdated = {
350
- type: "session.updated";
351
- properties: {
352
- info: Session;
353
- };
354
- };
355
- export type EventSessionDeleted = {
356
- type: "session.deleted";
357
- properties: {
358
- info: Session;
359
- };
360
- };
361
- export type EventSessionError = {
362
- type: "session.error";
363
- properties: {
364
- sessionID?: string;
365
- error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError;
366
- };
367
- };
368
- export type EventServerConnected = {
369
- type: "server.connected";
370
- properties: {
371
- [key: string]: unknown;
372
- };
373
- };
374
- export type Event = EventInstallationUpdated | EventLspClientDiagnostics | EventMessageUpdated | EventMessageRemoved | EventMessagePartUpdated | EventMessagePartRemoved | EventSessionCompacted | EventPermissionUpdated | EventPermissionReplied | EventFileEdited | EventSessionIdle | EventSessionUpdated | EventSessionDeleted | EventSessionError | EventServerConnected;
375
10
  /**
376
11
  * Custom keybind configurations
377
12
  */
@@ -844,44 +479,298 @@ export type Config = {
844
479
  disable_paste_summary?: boolean;
845
480
  };
846
481
  };
847
- export type _Error = {
848
- data: {
482
+ export type _Error = {
483
+ data: {
484
+ [key: string]: unknown;
485
+ };
486
+ };
487
+ export type HttpParamSpec = {
488
+ type: "string" | "number" | "boolean" | "array";
489
+ description?: string;
490
+ optional?: boolean;
491
+ items?: "string" | "number" | "boolean";
492
+ };
493
+ export type HttpToolRegistration = {
494
+ id: string;
495
+ description: string;
496
+ parameters: {
497
+ type: "object";
498
+ properties: {
499
+ [key: string]: HttpParamSpec;
500
+ };
501
+ };
502
+ callbackUrl: string;
503
+ headers?: {
504
+ [key: string]: string;
505
+ };
506
+ };
507
+ export type ToolIds = Array<string>;
508
+ export type ToolListItem = {
509
+ id: string;
510
+ description: string;
511
+ parameters: unknown;
512
+ };
513
+ export type ToolList = Array<ToolListItem>;
514
+ export type Path = {
515
+ state: string;
516
+ config: string;
517
+ worktree: string;
518
+ directory: string;
519
+ };
520
+ export type Session = {
521
+ id: string;
522
+ projectID: string;
523
+ directory: string;
524
+ parentID?: string;
525
+ share?: {
526
+ url: string;
527
+ };
528
+ title: string;
529
+ version: string;
530
+ time: {
531
+ created: number;
532
+ updated: number;
533
+ compacting?: number;
534
+ };
535
+ revert?: {
536
+ messageID: string;
537
+ partID?: string;
538
+ snapshot?: string;
539
+ diff?: string;
540
+ };
541
+ };
542
+ export type UserMessage = {
543
+ id: string;
544
+ sessionID: string;
545
+ role: "user";
546
+ time: {
547
+ created: number;
548
+ };
549
+ };
550
+ export type ProviderAuthError = {
551
+ name: "ProviderAuthError";
552
+ data: {
553
+ providerID: string;
554
+ message: string;
555
+ };
556
+ };
557
+ export type UnknownError = {
558
+ name: "UnknownError";
559
+ data: {
560
+ message: string;
561
+ };
562
+ };
563
+ export type MessageOutputLengthError = {
564
+ name: "MessageOutputLengthError";
565
+ data: {
566
+ [key: string]: unknown;
567
+ };
568
+ };
569
+ export type MessageAbortedError = {
570
+ name: "MessageAbortedError";
571
+ data: {
572
+ message: string;
573
+ };
574
+ };
575
+ export type AssistantMessage = {
576
+ id: string;
577
+ sessionID: string;
578
+ role: "assistant";
579
+ time: {
580
+ created: number;
581
+ completed?: number;
582
+ };
583
+ error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError;
584
+ system: Array<string>;
585
+ modelID: string;
586
+ providerID: string;
587
+ mode: string;
588
+ path: {
589
+ cwd: string;
590
+ root: string;
591
+ };
592
+ summary?: boolean;
593
+ cost: number;
594
+ tokens: {
595
+ input: number;
596
+ output: number;
597
+ reasoning: number;
598
+ cache: {
599
+ read: number;
600
+ write: number;
601
+ };
602
+ };
603
+ };
604
+ export type Message = UserMessage | AssistantMessage;
605
+ export type TextPart = {
606
+ id: string;
607
+ sessionID: string;
608
+ messageID: string;
609
+ type: "text";
610
+ text: string;
611
+ synthetic?: boolean;
612
+ time?: {
613
+ start: number;
614
+ end?: number;
615
+ };
616
+ };
617
+ export type ReasoningPart = {
618
+ id: string;
619
+ sessionID: string;
620
+ messageID: string;
621
+ type: "reasoning";
622
+ text: string;
623
+ metadata?: {
624
+ [key: string]: unknown;
625
+ };
626
+ time: {
627
+ start: number;
628
+ end?: number;
629
+ };
630
+ };
631
+ export type FilePartSourceText = {
632
+ value: string;
633
+ start: number;
634
+ end: number;
635
+ };
636
+ export type FileSource = {
637
+ text: FilePartSourceText;
638
+ type: "file";
639
+ path: string;
640
+ };
641
+ export type Range = {
642
+ start: {
643
+ line: number;
644
+ character: number;
645
+ };
646
+ end: {
647
+ line: number;
648
+ character: number;
649
+ };
650
+ };
651
+ export type SymbolSource = {
652
+ text: FilePartSourceText;
653
+ type: "symbol";
654
+ path: string;
655
+ range: Range;
656
+ name: string;
657
+ kind: number;
658
+ };
659
+ export type FilePartSource = FileSource | SymbolSource;
660
+ export type FilePart = {
661
+ id: string;
662
+ sessionID: string;
663
+ messageID: string;
664
+ type: "file";
665
+ mime: string;
666
+ filename?: string;
667
+ url: string;
668
+ source?: FilePartSource;
669
+ };
670
+ export type ToolStatePending = {
671
+ status: "pending";
672
+ };
673
+ export type ToolStateRunning = {
674
+ status: "running";
675
+ input: unknown;
676
+ title?: string;
677
+ metadata?: {
678
+ [key: string]: unknown;
679
+ };
680
+ time: {
681
+ start: number;
682
+ };
683
+ };
684
+ export type ToolStateCompleted = {
685
+ status: "completed";
686
+ input: {
849
687
  [key: string]: unknown;
850
688
  };
689
+ output: string;
690
+ title: string;
691
+ metadata: {
692
+ [key: string]: unknown;
693
+ };
694
+ time: {
695
+ start: number;
696
+ end: number;
697
+ compacted?: number;
698
+ };
851
699
  };
852
- export type HttpParamSpec = {
853
- type: "string" | "number" | "boolean" | "array";
854
- description?: string;
855
- optional?: boolean;
856
- items?: "string" | "number" | "boolean";
700
+ export type ToolStateError = {
701
+ status: "error";
702
+ input: {
703
+ [key: string]: unknown;
704
+ };
705
+ error: string;
706
+ metadata?: {
707
+ [key: string]: unknown;
708
+ };
709
+ time: {
710
+ start: number;
711
+ end: number;
712
+ };
857
713
  };
858
- export type HttpToolRegistration = {
714
+ export type ToolState = ToolStatePending | ToolStateRunning | ToolStateCompleted | ToolStateError;
715
+ export type ToolPart = {
859
716
  id: string;
860
- description: string;
861
- parameters: {
862
- type: "object";
863
- properties: {
864
- [key: string]: HttpParamSpec;
717
+ sessionID: string;
718
+ messageID: string;
719
+ type: "tool";
720
+ callID: string;
721
+ tool: string;
722
+ state: ToolState;
723
+ };
724
+ export type StepStartPart = {
725
+ id: string;
726
+ sessionID: string;
727
+ messageID: string;
728
+ type: "step-start";
729
+ };
730
+ export type StepFinishPart = {
731
+ id: string;
732
+ sessionID: string;
733
+ messageID: string;
734
+ type: "step-finish";
735
+ cost: number;
736
+ tokens: {
737
+ input: number;
738
+ output: number;
739
+ reasoning: number;
740
+ cache: {
741
+ read: number;
742
+ write: number;
865
743
  };
866
744
  };
867
- callbackUrl: string;
868
- headers?: {
869
- [key: string]: string;
870
- };
871
745
  };
872
- export type ToolIds = Array<string>;
873
- export type ToolListItem = {
746
+ export type SnapshotPart = {
874
747
  id: string;
875
- description: string;
876
- parameters: unknown;
748
+ sessionID: string;
749
+ messageID: string;
750
+ type: "snapshot";
751
+ snapshot: string;
877
752
  };
878
- export type ToolList = Array<ToolListItem>;
879
- export type Path = {
880
- state: string;
881
- config: string;
882
- worktree: string;
883
- directory: string;
753
+ export type PatchPart = {
754
+ id: string;
755
+ sessionID: string;
756
+ messageID: string;
757
+ type: "patch";
758
+ hash: string;
759
+ files: Array<string>;
884
760
  };
761
+ export type AgentPart = {
762
+ id: string;
763
+ sessionID: string;
764
+ messageID: string;
765
+ type: "agent";
766
+ name: string;
767
+ source?: {
768
+ value: string;
769
+ start: number;
770
+ end: number;
771
+ };
772
+ };
773
+ export type Part = TextPart | ReasoningPart | FilePart | ToolPart | StepStartPart | StepFinishPart | SnapshotPart | PatchPart | AgentPart;
885
774
  export type TextPartInput = {
886
775
  id?: string;
887
776
  type: "text";
@@ -1035,6 +924,130 @@ export type WellKnownAuth = {
1035
924
  token: string;
1036
925
  };
1037
926
  export type Auth = OAuth | ApiAuth | WellKnownAuth;
927
+ export type EventInstallationUpdated = {
928
+ type: "installation.updated";
929
+ properties: {
930
+ version: string;
931
+ };
932
+ };
933
+ export type EventLspClientDiagnostics = {
934
+ type: "lsp.client.diagnostics";
935
+ properties: {
936
+ serverID: string;
937
+ path: string;
938
+ };
939
+ };
940
+ export type EventMessageUpdated = {
941
+ type: "message.updated";
942
+ properties: {
943
+ info: Message;
944
+ };
945
+ };
946
+ export type EventMessageRemoved = {
947
+ type: "message.removed";
948
+ properties: {
949
+ sessionID: string;
950
+ messageID: string;
951
+ };
952
+ };
953
+ export type EventMessagePartUpdated = {
954
+ type: "message.part.updated";
955
+ properties: {
956
+ part: Part;
957
+ };
958
+ };
959
+ export type EventMessagePartRemoved = {
960
+ type: "message.part.removed";
961
+ properties: {
962
+ sessionID: string;
963
+ messageID: string;
964
+ partID: string;
965
+ };
966
+ };
967
+ export type EventSessionCompacted = {
968
+ type: "session.compacted";
969
+ properties: {
970
+ sessionID: string;
971
+ };
972
+ };
973
+ export type Permission = {
974
+ id: string;
975
+ type: string;
976
+ pattern?: string | Array<string>;
977
+ sessionID: string;
978
+ messageID: string;
979
+ callID?: string;
980
+ title: string;
981
+ metadata: {
982
+ [key: string]: unknown;
983
+ };
984
+ time: {
985
+ created: number;
986
+ };
987
+ };
988
+ export type EventPermissionUpdated = {
989
+ type: "permission.updated";
990
+ properties: Permission;
991
+ };
992
+ export type EventPermissionReplied = {
993
+ type: "permission.replied";
994
+ properties: {
995
+ sessionID: string;
996
+ permissionID: string;
997
+ response: string;
998
+ };
999
+ };
1000
+ export type EventFileEdited = {
1001
+ type: "file.edited";
1002
+ properties: {
1003
+ file: string;
1004
+ };
1005
+ };
1006
+ export type EventSessionIdle = {
1007
+ type: "session.idle";
1008
+ properties: {
1009
+ sessionID: string;
1010
+ };
1011
+ };
1012
+ export type EventSessionUpdated = {
1013
+ type: "session.updated";
1014
+ properties: {
1015
+ info: Session;
1016
+ };
1017
+ };
1018
+ export type EventSessionDeleted = {
1019
+ type: "session.deleted";
1020
+ properties: {
1021
+ info: Session;
1022
+ };
1023
+ };
1024
+ export type EventSessionError = {
1025
+ type: "session.error";
1026
+ properties: {
1027
+ sessionID?: string;
1028
+ error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError;
1029
+ };
1030
+ };
1031
+ export type EventServerConnected = {
1032
+ type: "server.connected";
1033
+ properties: {
1034
+ [key: string]: unknown;
1035
+ };
1036
+ };
1037
+ export type EventFileWatcherUpdated = {
1038
+ type: "file.watcher.updated";
1039
+ properties: {
1040
+ file: string;
1041
+ event: "add" | "change" | "unlink";
1042
+ };
1043
+ };
1044
+ export type EventIdeInstalled = {
1045
+ type: "ide.installed";
1046
+ properties: {
1047
+ ide: string;
1048
+ };
1049
+ };
1050
+ export type Event = EventInstallationUpdated | EventLspClientDiagnostics | EventMessageUpdated | EventMessageRemoved | EventMessagePartUpdated | EventMessagePartRemoved | EventSessionCompacted | EventPermissionUpdated | EventPermissionReplied | EventFileEdited | EventSessionIdle | EventSessionUpdated | EventSessionDeleted | EventSessionError | EventServerConnected | EventFileWatcherUpdated | EventIdeInstalled;
1038
1051
  export type ProjectListData = {
1039
1052
  body?: never;
1040
1053
  path?: never;
@@ -1065,21 +1078,6 @@ export type ProjectCurrentResponses = {
1065
1078
  200: Project;
1066
1079
  };
1067
1080
  export type ProjectCurrentResponse = ProjectCurrentResponses[keyof ProjectCurrentResponses];
1068
- export type EventSubscribeData = {
1069
- body?: never;
1070
- path?: never;
1071
- query?: {
1072
- directory?: string;
1073
- };
1074
- url: "/event";
1075
- };
1076
- export type EventSubscribeResponses = {
1077
- /**
1078
- * Event stream
1079
- */
1080
- 200: Event;
1081
- };
1082
- export type EventSubscribeResponse = EventSubscribeResponses[keyof EventSubscribeResponses];
1083
1081
  export type ConfigGetData = {
1084
1082
  body?: never;
1085
1083
  path?: never;
@@ -1942,6 +1940,21 @@ export type AuthSetResponses = {
1942
1940
  200: boolean;
1943
1941
  };
1944
1942
  export type AuthSetResponse = AuthSetResponses[keyof AuthSetResponses];
1943
+ export type EventSubscribeData = {
1944
+ body?: never;
1945
+ path?: never;
1946
+ query?: {
1947
+ directory?: string;
1948
+ };
1949
+ url: "/event";
1950
+ };
1951
+ export type EventSubscribeResponses = {
1952
+ /**
1953
+ * Event stream
1954
+ */
1955
+ 200: Event;
1956
+ };
1957
+ export type EventSubscribeResponse = EventSubscribeResponses[keyof EventSubscribeResponses];
1945
1958
  export type ClientOptions = {
1946
1959
  baseUrl: `${string}://${string}` | (string & {});
1947
1960
  };
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": "0.9.6",
4
+ "version": "0.9.8",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "typecheck": "tsc --noEmit"