@opencode-ai/sdk 0.1.0-alpha.20 → 0.1.0-alpha.21

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 (66) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/LICENSE +4 -198
  3. package/client.d.mts +14 -11
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +14 -11
  6. package/client.d.ts.map +1 -1
  7. package/client.js +3 -0
  8. package/client.js.map +1 -1
  9. package/client.mjs +3 -0
  10. package/client.mjs.map +1 -1
  11. package/package.json +2 -2
  12. package/resources/app.d.mts +2 -5
  13. package/resources/app.d.mts.map +1 -1
  14. package/resources/app.d.ts +2 -5
  15. package/resources/app.d.ts.map +1 -1
  16. package/resources/config.d.mts +64 -17
  17. package/resources/config.d.mts.map +1 -1
  18. package/resources/config.d.ts +64 -17
  19. package/resources/config.d.ts.map +1 -1
  20. package/resources/config.js.map +1 -1
  21. package/resources/config.mjs.map +1 -1
  22. package/resources/event.d.mts +58 -39
  23. package/resources/event.d.mts.map +1 -1
  24. package/resources/event.d.ts +58 -39
  25. package/resources/event.d.ts.map +1 -1
  26. package/resources/find.d.mts +29 -27
  27. package/resources/find.d.mts.map +1 -1
  28. package/resources/find.d.ts +29 -27
  29. package/resources/find.d.ts.map +1 -1
  30. package/resources/index.d.mts +5 -4
  31. package/resources/index.d.mts.map +1 -1
  32. package/resources/index.d.ts +5 -4
  33. package/resources/index.d.ts.map +1 -1
  34. package/resources/index.js +3 -1
  35. package/resources/index.js.map +1 -1
  36. package/resources/index.mjs +1 -0
  37. package/resources/index.mjs.map +1 -1
  38. package/resources/session.d.mts +91 -6
  39. package/resources/session.d.mts.map +1 -1
  40. package/resources/session.d.ts +91 -6
  41. package/resources/session.d.ts.map +1 -1
  42. package/resources/session.js +12 -0
  43. package/resources/session.js.map +1 -1
  44. package/resources/session.mjs +12 -0
  45. package/resources/session.mjs.map +1 -1
  46. package/resources/tui.d.mts +22 -0
  47. package/resources/tui.d.mts.map +1 -0
  48. package/resources/tui.d.ts +22 -0
  49. package/resources/tui.d.ts.map +1 -0
  50. package/resources/tui.js +21 -0
  51. package/resources/tui.js.map +1 -0
  52. package/resources/tui.mjs +17 -0
  53. package/resources/tui.mjs.map +1 -0
  54. package/src/client.ts +27 -9
  55. package/src/resources/app.ts +2 -6
  56. package/src/resources/config.ts +78 -17
  57. package/src/resources/event.ts +81 -53
  58. package/src/resources/find.ts +39 -38
  59. package/src/resources/index.ts +13 -3
  60. package/src/resources/session.ts +155 -7
  61. package/src/resources/tui.ts +37 -0
  62. package/src/version.ts +1 -1
  63. package/version.d.mts +1 -1
  64. package/version.d.ts +1 -1
  65. package/version.js +1 -1
  66. package/version.mjs +1 -1
@@ -57,6 +57,13 @@ export class SessionResource extends APIResource {
57
57
  return this._client.get(path`/session/${id}/message`, options);
58
58
  }
59
59
 
60
+ /**
61
+ * Revert a message
62
+ */
63
+ revert(id: string, body: SessionRevertParams, options?: RequestOptions): APIPromise<Session> {
64
+ return this._client.post(path`/session/${id}/revert`, { body, ...options });
65
+ }
66
+
60
67
  /**
61
68
  * Share a session
62
69
  */
@@ -75,6 +82,13 @@ export class SessionResource extends APIResource {
75
82
  return this._client.post(path`/session/${id}/summarize`, { body, ...options });
76
83
  }
77
84
 
85
+ /**
86
+ * Restore all reverted messages
87
+ */
88
+ unrevert(id: string, options?: RequestOptions): APIPromise<Session> {
89
+ return this._client.post(path`/session/${id}/unrevert`, options);
90
+ }
91
+
78
92
  /**
79
93
  * Unshare the session
80
94
  */
@@ -88,6 +102,8 @@ export interface AssistantMessage {
88
102
 
89
103
  cost: number;
90
104
 
105
+ mode: string;
106
+
91
107
  modelID: string;
92
108
 
93
109
  path: AssistantMessage.Path;
@@ -165,11 +181,68 @@ export interface FilePart {
165
181
  url: string;
166
182
 
167
183
  filename?: string;
184
+
185
+ source?: FilePartSource;
186
+ }
187
+
188
+ export interface FilePartInput {
189
+ mime: string;
190
+
191
+ type: 'file';
192
+
193
+ url: string;
194
+
195
+ id?: string;
196
+
197
+ filename?: string;
198
+
199
+ source?: FilePartSource;
200
+ }
201
+
202
+ export type FilePartSource = FileSource | SymbolSource;
203
+
204
+ export interface FilePartSourceText {
205
+ end: number;
206
+
207
+ start: number;
208
+
209
+ value: string;
210
+ }
211
+
212
+ export interface FileSource {
213
+ path: string;
214
+
215
+ text: FilePartSourceText;
216
+
217
+ type: 'file';
168
218
  }
169
219
 
170
220
  export type Message = UserMessage | AssistantMessage;
171
221
 
172
- export type Part = TextPart | FilePart | ToolPart | StepStartPart | StepFinishPart | SnapshotPart;
222
+ export type Part =
223
+ | TextPart
224
+ | FilePart
225
+ | ToolPart
226
+ | StepStartPart
227
+ | StepFinishPart
228
+ | SnapshotPart
229
+ | Part.PatchPart;
230
+
231
+ export namespace Part {
232
+ export interface PatchPart {
233
+ id: string;
234
+
235
+ files: Array<string>;
236
+
237
+ hash: string;
238
+
239
+ messageID: string;
240
+
241
+ sessionID: string;
242
+
243
+ type: 'patch';
244
+ }
245
+ }
173
246
 
174
247
  export interface Session {
175
248
  id: string;
@@ -197,7 +270,9 @@ export namespace Session {
197
270
  export interface Revert {
198
271
  messageID: string;
199
272
 
200
- part: number;
273
+ diff?: string;
274
+
275
+ partID?: string;
201
276
 
202
277
  snapshot?: string;
203
278
  }
@@ -263,6 +338,42 @@ export interface StepStartPart {
263
338
  type: 'step-start';
264
339
  }
265
340
 
341
+ export interface SymbolSource {
342
+ kind: number;
343
+
344
+ name: string;
345
+
346
+ path: string;
347
+
348
+ range: SymbolSource.Range;
349
+
350
+ text: FilePartSourceText;
351
+
352
+ type: 'symbol';
353
+ }
354
+
355
+ export namespace SymbolSource {
356
+ export interface Range {
357
+ end: Range.End;
358
+
359
+ start: Range.Start;
360
+ }
361
+
362
+ export namespace Range {
363
+ export interface End {
364
+ character: number;
365
+
366
+ line: number;
367
+ }
368
+
369
+ export interface Start {
370
+ character: number;
371
+
372
+ line: number;
373
+ }
374
+ }
375
+ }
376
+
266
377
  export interface TextPart {
267
378
  id: string;
268
379
 
@@ -287,6 +398,26 @@ export namespace TextPart {
287
398
  }
288
399
  }
289
400
 
401
+ export interface TextPartInput {
402
+ text: string;
403
+
404
+ type: 'text';
405
+
406
+ id?: string;
407
+
408
+ synthetic?: boolean;
409
+
410
+ time?: TextPartInput.Time;
411
+ }
412
+
413
+ export namespace TextPartInput {
414
+ export interface Time {
415
+ start: number;
416
+
417
+ end?: number;
418
+ }
419
+ }
420
+
290
421
  export interface ToolPart {
291
422
  id: string;
292
423
 
@@ -402,15 +533,19 @@ export namespace SessionMessagesResponse {
402
533
  export type SessionSummarizeResponse = boolean;
403
534
 
404
535
  export interface SessionChatParams {
405
- messageID: string;
406
-
407
- mode: string;
408
-
409
536
  modelID: string;
410
537
 
411
- parts: Array<FilePart | TextPart>;
538
+ parts: Array<TextPartInput | FilePartInput>;
412
539
 
413
540
  providerID: string;
541
+
542
+ messageID?: string;
543
+
544
+ mode?: string;
545
+
546
+ system?: string;
547
+
548
+ tools?: { [key: string]: boolean };
414
549
  }
415
550
 
416
551
  export interface SessionInitParams {
@@ -421,6 +556,12 @@ export interface SessionInitParams {
421
556
  providerID: string;
422
557
  }
423
558
 
559
+ export interface SessionRevertParams {
560
+ messageID: string;
561
+
562
+ partID?: string;
563
+ }
564
+
424
565
  export interface SessionSummarizeParams {
425
566
  modelID: string;
426
567
 
@@ -431,13 +572,19 @@ export declare namespace SessionResource {
431
572
  export {
432
573
  type AssistantMessage as AssistantMessage,
433
574
  type FilePart as FilePart,
575
+ type FilePartInput as FilePartInput,
576
+ type FilePartSource as FilePartSource,
577
+ type FilePartSourceText as FilePartSourceText,
578
+ type FileSource as FileSource,
434
579
  type Message as Message,
435
580
  type Part as Part,
436
581
  type Session as Session,
437
582
  type SnapshotPart as SnapshotPart,
438
583
  type StepFinishPart as StepFinishPart,
439
584
  type StepStartPart as StepStartPart,
585
+ type SymbolSource as SymbolSource,
440
586
  type TextPart as TextPart,
587
+ type TextPartInput as TextPartInput,
441
588
  type ToolPart as ToolPart,
442
589
  type ToolStateCompleted as ToolStateCompleted,
443
590
  type ToolStateError as ToolStateError,
@@ -452,6 +599,7 @@ export declare namespace SessionResource {
452
599
  type SessionSummarizeResponse as SessionSummarizeResponse,
453
600
  type SessionChatParams as SessionChatParams,
454
601
  type SessionInitParams as SessionInitParams,
602
+ type SessionRevertParams as SessionRevertParams,
455
603
  type SessionSummarizeParams as SessionSummarizeParams,
456
604
  };
457
605
  }
@@ -0,0 +1,37 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import { APIPromise } from '../core/api-promise';
5
+ import { RequestOptions } from '../internal/request-options';
6
+
7
+ export class Tui extends APIResource {
8
+ /**
9
+ * Append prompt to the TUI
10
+ */
11
+ appendPrompt(body: TuiAppendPromptParams, options?: RequestOptions): APIPromise<TuiAppendPromptResponse> {
12
+ return this._client.post('/tui/append-prompt', { body, ...options });
13
+ }
14
+
15
+ /**
16
+ * Open the help dialog
17
+ */
18
+ openHelp(options?: RequestOptions): APIPromise<TuiOpenHelpResponse> {
19
+ return this._client.post('/tui/open-help', options);
20
+ }
21
+ }
22
+
23
+ export type TuiAppendPromptResponse = boolean;
24
+
25
+ export type TuiOpenHelpResponse = boolean;
26
+
27
+ export interface TuiAppendPromptParams {
28
+ text: string;
29
+ }
30
+
31
+ export declare namespace Tui {
32
+ export {
33
+ type TuiAppendPromptResponse as TuiAppendPromptResponse,
34
+ type TuiOpenHelpResponse as TuiOpenHelpResponse,
35
+ type TuiAppendPromptParams as TuiAppendPromptParams,
36
+ };
37
+ }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.1.0-alpha.20'; // x-release-please-version
1
+ export const VERSION = '0.1.0-alpha.21'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.1.0-alpha.20";
1
+ export declare const VERSION = "0.1.0-alpha.21";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.1.0-alpha.20";
1
+ export declare const VERSION = "0.1.0-alpha.21";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.1.0-alpha.20'; // x-release-please-version
4
+ exports.VERSION = '0.1.0-alpha.21'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.1.0-alpha.20'; // x-release-please-version
1
+ export const VERSION = '0.1.0-alpha.21'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map