@opencode-ai/sdk 0.1.0-alpha.15 → 0.1.0-alpha.17

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.
Files changed (71) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +9 -27
  3. package/client.d.mts +15 -14
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +15 -14
  6. package/client.d.ts.map +1 -1
  7. package/client.js +12 -9
  8. package/client.js.map +1 -1
  9. package/client.mjs +14 -11
  10. package/client.mjs.map +1 -1
  11. package/package.json +1 -1
  12. package/resources/app.d.mts +49 -2
  13. package/resources/app.d.mts.map +1 -1
  14. package/resources/app.d.ts +49 -2
  15. package/resources/app.d.ts.map +1 -1
  16. package/resources/app.js +12 -0
  17. package/resources/app.js.map +1 -1
  18. package/resources/app.mjs +12 -0
  19. package/resources/app.mjs.map +1 -1
  20. package/resources/config.d.mts +120 -34
  21. package/resources/config.d.mts.map +1 -1
  22. package/resources/config.d.ts +120 -34
  23. package/resources/config.d.ts.map +1 -1
  24. package/resources/config.js.map +1 -1
  25. package/resources/config.mjs.map +1 -1
  26. package/resources/event.d.mts +14 -15
  27. package/resources/event.d.mts.map +1 -1
  28. package/resources/event.d.ts +14 -15
  29. package/resources/event.d.ts.map +1 -1
  30. package/resources/file.d.mts +10 -12
  31. package/resources/file.d.mts.map +1 -1
  32. package/resources/file.d.ts +10 -12
  33. package/resources/file.d.ts.map +1 -1
  34. package/resources/file.js +3 -3
  35. package/resources/file.js.map +1 -1
  36. package/resources/file.mjs +1 -1
  37. package/resources/file.mjs.map +1 -1
  38. package/resources/find.d.mts +48 -23
  39. package/resources/find.d.mts.map +1 -1
  40. package/resources/find.d.ts +48 -23
  41. package/resources/find.d.ts.map +1 -1
  42. package/resources/index.d.mts +4 -4
  43. package/resources/index.d.mts.map +1 -1
  44. package/resources/index.d.ts +4 -4
  45. package/resources/index.d.ts.map +1 -1
  46. package/resources/index.js +2 -2
  47. package/resources/index.js.map +1 -1
  48. package/resources/index.mjs +2 -2
  49. package/resources/index.mjs.map +1 -1
  50. package/resources/session.d.mts +81 -24
  51. package/resources/session.d.mts.map +1 -1
  52. package/resources/session.d.ts +81 -24
  53. package/resources/session.d.ts.map +1 -1
  54. package/resources/shared.d.mts +4 -0
  55. package/resources/shared.d.mts.map +1 -1
  56. package/resources/shared.d.ts +4 -0
  57. package/resources/shared.d.ts.map +1 -1
  58. package/src/client.ts +53 -22
  59. package/src/resources/app.ts +72 -3
  60. package/src/resources/config.ts +139 -34
  61. package/src/resources/event.ts +21 -19
  62. package/src/resources/file.ts +14 -15
  63. package/src/resources/find.ts +60 -22
  64. package/src/resources/index.ts +23 -4
  65. package/src/resources/session.ts +128 -34
  66. package/src/resources/shared.ts +6 -0
  67. package/src/version.ts +1 -1
  68. package/version.d.mts +1 -1
  69. package/version.d.ts +1 -1
  70. package/version.js +1 -1
  71. package/version.mjs +1 -1
@@ -1,6 +1,7 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import { APIResource } from '../core/resource';
4
+ import * as AppAPI from './app';
4
5
  import { APIPromise } from '../core/api-promise';
5
6
  import { RequestOptions } from '../internal/request-options';
6
7
 
@@ -27,7 +28,8 @@ export interface Config {
27
28
  $schema?: string;
28
29
 
29
30
  /**
30
- * Share newly created sessions automatically
31
+ * @deprecated Use 'share' field instead. Share newly created sessions
32
+ * automatically
31
33
  */
32
34
  autoshare?: boolean;
33
35
 
@@ -53,11 +55,18 @@ export interface Config {
53
55
  */
54
56
  keybinds?: Keybinds;
55
57
 
58
+ /**
59
+ * Minimum log level to write to log files
60
+ */
61
+ log_level?: AppAPI.LogLevel;
62
+
56
63
  /**
57
64
  * MCP (Model Context Protocol) server configurations
58
65
  */
59
66
  mcp?: { [key: string]: McpLocal | McpRemote };
60
67
 
68
+ mode?: Config.Mode;
69
+
61
70
  /**
62
71
  * Model to use in the format of provider/model, eg anthropic/claude-2
63
72
  */
@@ -68,10 +77,21 @@ export interface Config {
68
77
  */
69
78
  provider?: { [key: string]: Config.Provider };
70
79
 
80
+ /**
81
+ * Control sharing behavior: 'auto' enables automatic sharing, 'disabled' disables
82
+ * all sharing
83
+ */
84
+ share?: 'auto' | 'disabled';
85
+
71
86
  /**
72
87
  * Theme name to use for the interface
73
88
  */
74
89
  theme?: string;
90
+
91
+ /**
92
+ * Custom username to display in conversations instead of system username
93
+ */
94
+ username?: string;
75
95
  }
76
96
 
77
97
  export namespace Config {
@@ -101,6 +121,56 @@ export namespace Config {
101
121
  }
102
122
  }
103
123
 
124
+ export interface Mode {
125
+ build?: Mode.Build;
126
+
127
+ plan?: Mode.Plan;
128
+
129
+ [k: string]: Mode.ModeConfig | undefined;
130
+ }
131
+
132
+ export namespace Mode {
133
+ export interface Build {
134
+ model?: string;
135
+
136
+ prompt?: string;
137
+
138
+ tools?: { [key: string]: boolean };
139
+ }
140
+
141
+ export interface Plan {
142
+ model?: string;
143
+
144
+ prompt?: string;
145
+
146
+ tools?: { [key: string]: boolean };
147
+ }
148
+
149
+ export interface ModeConfig {
150
+ model?: string;
151
+
152
+ prompt?: string;
153
+
154
+ tools?: { [key: string]: boolean };
155
+ }
156
+ }
157
+
158
+ export interface ModeConfig {
159
+ model?: string;
160
+
161
+ prompt?: string;
162
+
163
+ tools?: { [key: string]: boolean };
164
+ }
165
+
166
+ export interface ModeConfig {
167
+ model?: string;
168
+
169
+ prompt?: string;
170
+
171
+ tools?: { [key: string]: boolean };
172
+ }
173
+
104
174
  export interface Provider {
105
175
  models: { [key: string]: Provider.Models };
106
176
 
@@ -164,137 +234,172 @@ export interface Keybinds {
164
234
  /**
165
235
  * Exit the application
166
236
  */
167
- app_exit?: string;
237
+ app_exit: string;
238
+
239
+ /**
240
+ * Show help dialog
241
+ */
242
+ app_help: string;
168
243
 
169
244
  /**
170
245
  * Open external editor
171
246
  */
172
- editor_open?: string;
247
+ editor_open: string;
173
248
 
174
249
  /**
175
- * Show help dialog
250
+ * Close file
176
251
  */
177
- help?: string;
252
+ file_close: string;
178
253
 
179
254
  /**
180
- * Navigate to next history item
255
+ * Split/unified diff
181
256
  */
182
- history_next?: string;
257
+ file_diff_toggle: string;
183
258
 
184
259
  /**
185
- * Navigate to previous history item
260
+ * List files
186
261
  */
187
- history_previous?: string;
262
+ file_list: string;
263
+
264
+ /**
265
+ * Search file
266
+ */
267
+ file_search: string;
188
268
 
189
269
  /**
190
270
  * Clear input field
191
271
  */
192
- input_clear?: string;
272
+ input_clear: string;
193
273
 
194
274
  /**
195
275
  * Insert newline in input
196
276
  */
197
- input_newline?: string;
277
+ input_newline: string;
198
278
 
199
279
  /**
200
280
  * Paste from clipboard
201
281
  */
202
- input_paste?: string;
282
+ input_paste: string;
203
283
 
204
284
  /**
205
285
  * Submit input
206
286
  */
207
- input_submit?: string;
287
+ input_submit: string;
208
288
 
209
289
  /**
210
290
  * Leader key for keybind combinations
211
291
  */
212
- leader?: string;
292
+ leader: string;
293
+
294
+ /**
295
+ * Copy message
296
+ */
297
+ messages_copy: string;
213
298
 
214
299
  /**
215
300
  * Navigate to first message
216
301
  */
217
- messages_first?: string;
302
+ messages_first: string;
218
303
 
219
304
  /**
220
305
  * Scroll messages down by half page
221
306
  */
222
- messages_half_page_down?: string;
307
+ messages_half_page_down: string;
223
308
 
224
309
  /**
225
310
  * Scroll messages up by half page
226
311
  */
227
- messages_half_page_up?: string;
312
+ messages_half_page_up: string;
228
313
 
229
314
  /**
230
315
  * Navigate to last message
231
316
  */
232
- messages_last?: string;
317
+ messages_last: string;
318
+
319
+ /**
320
+ * Toggle layout
321
+ */
322
+ messages_layout_toggle: string;
233
323
 
234
324
  /**
235
325
  * Navigate to next message
236
326
  */
237
- messages_next?: string;
327
+ messages_next: string;
238
328
 
239
329
  /**
240
330
  * Scroll messages down by one page
241
331
  */
242
- messages_page_down?: string;
332
+ messages_page_down: string;
243
333
 
244
334
  /**
245
335
  * Scroll messages up by one page
246
336
  */
247
- messages_page_up?: string;
337
+ messages_page_up: string;
248
338
 
249
339
  /**
250
340
  * Navigate to previous message
251
341
  */
252
- messages_previous?: string;
342
+ messages_previous: string;
343
+
344
+ /**
345
+ * Revert message
346
+ */
347
+ messages_revert: string;
253
348
 
254
349
  /**
255
350
  * List available models
256
351
  */
257
- model_list?: string;
352
+ model_list: string;
258
353
 
259
354
  /**
260
- * Initialize project configuration
355
+ * Create/update AGENTS.md
261
356
  */
262
- project_init?: string;
357
+ project_init: string;
263
358
 
264
359
  /**
265
- * Toggle compact mode for session
360
+ * Compact the session
266
361
  */
267
- session_compact?: string;
362
+ session_compact: string;
268
363
 
269
364
  /**
270
365
  * Interrupt current session
271
366
  */
272
- session_interrupt?: string;
367
+ session_interrupt: string;
273
368
 
274
369
  /**
275
370
  * List all sessions
276
371
  */
277
- session_list?: string;
372
+ session_list: string;
278
373
 
279
374
  /**
280
375
  * Create a new session
281
376
  */
282
- session_new?: string;
377
+ session_new: string;
283
378
 
284
379
  /**
285
380
  * Share current session
286
381
  */
287
- session_share?: string;
382
+ session_share: string;
383
+
384
+ /**
385
+ * Unshare current session
386
+ */
387
+ session_unshare: string;
388
+
389
+ /**
390
+ * Switch mode
391
+ */
392
+ switch_mode: string;
288
393
 
289
394
  /**
290
395
  * List available themes
291
396
  */
292
- theme_list?: string;
397
+ theme_list: string;
293
398
 
294
399
  /**
295
- * Show tool details
400
+ * Toggle tool details
296
401
  */
297
- tool_details?: string;
402
+ tool_details: string;
298
403
  }
299
404
 
300
405
  export interface McpLocal {
@@ -21,10 +21,10 @@ export type EventListResponse =
21
21
  | EventListResponse.EventPermissionUpdated
22
22
  | EventListResponse.EventFileEdited
23
23
  | EventListResponse.EventInstallationUpdated
24
- | EventListResponse.EventStorageWrite
25
24
  | EventListResponse.EventMessageUpdated
26
25
  | EventListResponse.EventMessageRemoved
27
26
  | EventListResponse.EventMessagePartUpdated
27
+ | EventListResponse.EventStorageWrite
28
28
  | EventListResponse.EventSessionUpdated
29
29
  | EventListResponse.EventSessionDeleted
30
30
  | EventListResponse.EventSessionIdle
@@ -96,20 +96,6 @@ export namespace EventListResponse {
96
96
  }
97
97
  }
98
98
 
99
- export interface EventStorageWrite {
100
- properties: EventStorageWrite.Properties;
101
-
102
- type: 'storage.write';
103
- }
104
-
105
- export namespace EventStorageWrite {
106
- export interface Properties {
107
- key: string;
108
-
109
- content?: unknown;
110
- }
111
- }
112
-
113
99
  export interface EventMessageUpdated {
114
100
  properties: EventMessageUpdated.Properties;
115
101
 
@@ -144,11 +130,21 @@ export namespace EventListResponse {
144
130
 
145
131
  export namespace EventMessagePartUpdated {
146
132
  export interface Properties {
147
- messageID: string;
133
+ part: SessionAPI.Part;
134
+ }
135
+ }
148
136
 
149
- part: SessionAPI.AssistantMessagePart;
137
+ export interface EventStorageWrite {
138
+ properties: EventStorageWrite.Properties;
150
139
 
151
- sessionID: string;
140
+ type: 'storage.write';
141
+ }
142
+
143
+ export namespace EventStorageWrite {
144
+ export interface Properties {
145
+ key: string;
146
+
147
+ content?: unknown;
152
148
  }
153
149
  }
154
150
 
@@ -196,7 +192,13 @@ export namespace EventListResponse {
196
192
 
197
193
  export namespace EventSessionError {
198
194
  export interface Properties {
199
- error?: Shared.ProviderAuthError | Shared.UnknownError | Properties.MessageOutputLengthError;
195
+ error?:
196
+ | Shared.ProviderAuthError
197
+ | Shared.UnknownError
198
+ | Properties.MessageOutputLengthError
199
+ | Shared.MessageAbortedError;
200
+
201
+ sessionID?: string;
200
202
  }
201
203
 
202
204
  export namespace Properties {
@@ -4,7 +4,7 @@ import { APIResource } from '../core/resource';
4
4
  import { APIPromise } from '../core/api-promise';
5
5
  import { RequestOptions } from '../internal/request-options';
6
6
 
7
- export class File extends APIResource {
7
+ export class FileResource extends APIResource {
8
8
  /**
9
9
  * Read a file
10
10
  */
@@ -20,32 +20,31 @@ export class File extends APIResource {
20
20
  }
21
21
  }
22
22
 
23
- export interface FileReadResponse {
24
- content: string;
25
-
26
- type: 'raw' | 'patch';
27
- }
23
+ export interface File {
24
+ added: number;
28
25
 
29
- export type FileStatusResponse = Array<FileStatusResponse.FileStatusResponseItem>;
26
+ path: string;
30
27
 
31
- export namespace FileStatusResponse {
32
- export interface FileStatusResponseItem {
33
- added: number;
28
+ removed: number;
34
29
 
35
- file: string;
30
+ status: 'added' | 'deleted' | 'modified';
31
+ }
36
32
 
37
- removed: number;
33
+ export interface FileReadResponse {
34
+ content: string;
38
35
 
39
- status: 'added' | 'deleted' | 'modified';
40
- }
36
+ type: 'raw' | 'patch';
41
37
  }
42
38
 
39
+ export type FileStatusResponse = Array<File>;
40
+
43
41
  export interface FileReadParams {
44
42
  path: string;
45
43
  }
46
44
 
47
- export declare namespace File {
45
+ export declare namespace FileResource {
48
46
  export {
47
+ type File as File,
49
48
  type FileReadResponse as FileReadResponse,
50
49
  type FileStatusResponse as FileStatusResponse,
51
50
  type FileReadParams as FileReadParams,
@@ -27,50 +27,86 @@ export class Find extends APIResource {
27
27
  }
28
28
  }
29
29
 
30
- export type FindFilesResponse = Array<string>;
30
+ export interface Match {
31
+ absolute_offset: number;
32
+
33
+ line_number: number;
34
+
35
+ lines: Match.Lines;
31
36
 
32
- export type FindSymbolsResponse = Array<unknown>;
37
+ path: Match.Path;
33
38
 
34
- export type FindTextResponse = Array<FindTextResponse.FindTextResponseItem>;
39
+ submatches: Array<Match.Submatch>;
40
+ }
35
41
 
36
- export namespace FindTextResponse {
37
- export interface FindTextResponseItem {
38
- absolute_offset: number;
42
+ export namespace Match {
43
+ export interface Lines {
44
+ text: string;
45
+ }
39
46
 
40
- line_number: number;
47
+ export interface Path {
48
+ text: string;
49
+ }
41
50
 
42
- lines: FindTextResponseItem.Lines;
51
+ export interface Submatch {
52
+ end: number;
43
53
 
44
- path: FindTextResponseItem.Path;
54
+ match: Submatch.Match;
45
55
 
46
- submatches: Array<FindTextResponseItem.Submatch>;
56
+ start: number;
47
57
  }
48
58
 
49
- export namespace FindTextResponseItem {
50
- export interface Lines {
59
+ export namespace Submatch {
60
+ export interface Match {
51
61
  text: string;
52
62
  }
63
+ }
64
+ }
53
65
 
54
- export interface Path {
55
- text: string;
56
- }
66
+ export interface Symbol {
67
+ kind: number;
68
+
69
+ location: Symbol.Location;
57
70
 
58
- export interface Submatch {
59
- end: number;
71
+ name: string;
72
+ }
60
73
 
61
- match: Submatch.Match;
74
+ export namespace Symbol {
75
+ export interface Location {
76
+ range: Location.Range;
62
77
 
63
- start: number;
78
+ uri: string;
79
+ }
80
+
81
+ export namespace Location {
82
+ export interface Range {
83
+ end: Range.End;
84
+
85
+ start: Range.Start;
64
86
  }
65
87
 
66
- export namespace Submatch {
67
- export interface Match {
68
- text: string;
88
+ export namespace Range {
89
+ export interface End {
90
+ character: number;
91
+
92
+ line: number;
93
+ }
94
+
95
+ export interface Start {
96
+ character: number;
97
+
98
+ line: number;
69
99
  }
70
100
  }
71
101
  }
72
102
  }
73
103
 
104
+ export type FindFilesResponse = Array<string>;
105
+
106
+ export type FindSymbolsResponse = Array<Symbol>;
107
+
108
+ export type FindTextResponse = Array<Match>;
109
+
74
110
  export interface FindFilesParams {
75
111
  query: string;
76
112
  }
@@ -85,6 +121,8 @@ export interface FindTextParams {
85
121
 
86
122
  export declare namespace Find {
87
123
  export {
124
+ type Match as Match,
125
+ type Symbol as Symbol,
88
126
  type FindFilesResponse as FindFilesResponse,
89
127
  type FindSymbolsResponse as FindSymbolsResponse,
90
128
  type FindTextResponse as FindTextResponse,
@@ -1,7 +1,16 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  export * from './shared';
4
- export { AppResource, type App, type AppInitResponse } from './app';
4
+ export {
5
+ AppResource,
6
+ type App,
7
+ type LogLevel,
8
+ type Mode,
9
+ type AppInitResponse,
10
+ type AppLogResponse,
11
+ type AppModesResponse,
12
+ type AppLogParams,
13
+ } from './app';
5
14
  export {
6
15
  ConfigResource,
7
16
  type Config,
@@ -13,9 +22,17 @@ export {
13
22
  type ConfigProvidersResponse,
14
23
  } from './config';
15
24
  export { Event, type EventListResponse } from './event';
16
- export { File, type FileReadResponse, type FileStatusResponse, type FileReadParams } from './file';
25
+ export {
26
+ FileResource,
27
+ type File,
28
+ type FileReadResponse,
29
+ type FileStatusResponse,
30
+ type FileReadParams,
31
+ } from './file';
17
32
  export {
18
33
  Find,
34
+ type Match,
35
+ type Symbol,
19
36
  type FindFilesResponse,
20
37
  type FindSymbolsResponse,
21
38
  type FindTextResponse,
@@ -26,10 +43,12 @@ export {
26
43
  export {
27
44
  SessionResource,
28
45
  type AssistantMessage,
29
- type AssistantMessagePart,
30
46
  type FilePart,
31
47
  type Message,
48
+ type Part,
32
49
  type Session,
50
+ type SnapshotPart,
51
+ type StepFinishPart,
33
52
  type StepStartPart,
34
53
  type TextPart,
35
54
  type ToolPart,
@@ -37,7 +56,7 @@ export {
37
56
  type ToolStateError,
38
57
  type ToolStatePending,
39
58
  type ToolStateRunning,
40
- type UserMessagePart,
59
+ type UserMessage,
41
60
  type SessionListResponse,
42
61
  type SessionDeleteResponse,
43
62
  type SessionAbortResponse,