@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
@@ -90,8 +90,6 @@ export interface AssistantMessage {
90
90
 
91
91
  modelID: string;
92
92
 
93
- parts: Array<AssistantMessagePart>;
94
-
95
93
  path: AssistantMessage.Path;
96
94
 
97
95
  providerID: string;
@@ -106,7 +104,11 @@ export interface AssistantMessage {
106
104
 
107
105
  tokens: AssistantMessage.Tokens;
108
106
 
109
- error?: Shared.ProviderAuthError | Shared.UnknownError | AssistantMessage.MessageOutputLengthError;
107
+ error?:
108
+ | Shared.ProviderAuthError
109
+ | Shared.UnknownError
110
+ | AssistantMessage.MessageOutputLengthError
111
+ | Shared.MessageAbortedError;
110
112
 
111
113
  summary?: boolean;
112
114
  }
@@ -149,11 +151,15 @@ export namespace AssistantMessage {
149
151
  }
150
152
  }
151
153
 
152
- export type AssistantMessagePart = TextPart | ToolPart | StepStartPart;
153
-
154
154
  export interface FilePart {
155
+ id: string;
156
+
157
+ messageID: string;
158
+
155
159
  mime: string;
156
160
 
161
+ sessionID: string;
162
+
157
163
  type: 'file';
158
164
 
159
165
  url: string;
@@ -161,27 +167,9 @@ export interface FilePart {
161
167
  filename?: string;
162
168
  }
163
169
 
164
- export type Message = Message.UserMessage | AssistantMessage;
170
+ export type Message = UserMessage | AssistantMessage;
165
171
 
166
- export namespace Message {
167
- export interface UserMessage {
168
- id: string;
169
-
170
- parts: Array<SessionAPI.UserMessagePart>;
171
-
172
- role: 'user';
173
-
174
- sessionID: string;
175
-
176
- time: UserMessage.Time;
177
- }
178
-
179
- export namespace UserMessage {
180
- export interface Time {
181
- created: number;
182
- }
183
- }
184
- }
172
+ export type Part = TextPart | FilePart | ToolPart | StepStartPart | StepFinishPart | SnapshotPart;
185
173
 
186
174
  export interface Session {
187
175
  id: string;
@@ -219,19 +207,95 @@ export namespace Session {
219
207
  }
220
208
  }
221
209
 
210
+ export interface SnapshotPart {
211
+ id: string;
212
+
213
+ messageID: string;
214
+
215
+ sessionID: string;
216
+
217
+ snapshot: string;
218
+
219
+ type: 'snapshot';
220
+ }
221
+
222
+ export interface StepFinishPart {
223
+ id: string;
224
+
225
+ cost: number;
226
+
227
+ messageID: string;
228
+
229
+ sessionID: string;
230
+
231
+ tokens: StepFinishPart.Tokens;
232
+
233
+ type: 'step-finish';
234
+ }
235
+
236
+ export namespace StepFinishPart {
237
+ export interface Tokens {
238
+ cache: Tokens.Cache;
239
+
240
+ input: number;
241
+
242
+ output: number;
243
+
244
+ reasoning: number;
245
+ }
246
+
247
+ export namespace Tokens {
248
+ export interface Cache {
249
+ read: number;
250
+
251
+ write: number;
252
+ }
253
+ }
254
+ }
255
+
222
256
  export interface StepStartPart {
257
+ id: string;
258
+
259
+ messageID: string;
260
+
261
+ sessionID: string;
262
+
223
263
  type: 'step-start';
224
264
  }
225
265
 
226
266
  export interface TextPart {
267
+ id: string;
268
+
269
+ messageID: string;
270
+
271
+ sessionID: string;
272
+
227
273
  text: string;
228
274
 
229
275
  type: 'text';
276
+
277
+ synthetic?: boolean;
278
+
279
+ time?: TextPart.Time;
280
+ }
281
+
282
+ export namespace TextPart {
283
+ export interface Time {
284
+ start: number;
285
+
286
+ end?: number;
287
+ }
230
288
  }
231
289
 
232
290
  export interface ToolPart {
233
291
  id: string;
234
292
 
293
+ callID: string;
294
+
295
+ messageID: string;
296
+
297
+ sessionID: string;
298
+
235
299
  state: ToolStatePending | ToolStateRunning | ToolStateCompleted | ToolStateError;
236
300
 
237
301
  tool: string;
@@ -240,6 +304,8 @@ export interface ToolPart {
240
304
  }
241
305
 
242
306
  export interface ToolStateCompleted {
307
+ input: { [key: string]: unknown };
308
+
243
309
  metadata: { [key: string]: unknown };
244
310
 
245
311
  output: string;
@@ -249,8 +315,6 @@ export interface ToolStateCompleted {
249
315
  time: ToolStateCompleted.Time;
250
316
 
251
317
  title: string;
252
-
253
- input?: unknown;
254
318
  }
255
319
 
256
320
  export namespace ToolStateCompleted {
@@ -264,11 +328,11 @@ export namespace ToolStateCompleted {
264
328
  export interface ToolStateError {
265
329
  error: string;
266
330
 
331
+ input: { [key: string]: unknown };
332
+
267
333
  status: 'error';
268
334
 
269
335
  time: ToolStateError.Time;
270
-
271
- input?: unknown;
272
336
  }
273
337
 
274
338
  export namespace ToolStateError {
@@ -301,7 +365,21 @@ export namespace ToolStateRunning {
301
365
  }
302
366
  }
303
367
 
304
- export type UserMessagePart = TextPart | FilePart;
368
+ export interface UserMessage {
369
+ id: string;
370
+
371
+ role: 'user';
372
+
373
+ sessionID: string;
374
+
375
+ time: UserMessage.Time;
376
+ }
377
+
378
+ export namespace UserMessage {
379
+ export interface Time {
380
+ created: number;
381
+ }
382
+ }
305
383
 
306
384
  export type SessionListResponse = Array<Session>;
307
385
 
@@ -311,19 +389,33 @@ export type SessionAbortResponse = boolean;
311
389
 
312
390
  export type SessionInitResponse = boolean;
313
391
 
314
- export type SessionMessagesResponse = Array<Message>;
392
+ export type SessionMessagesResponse = Array<SessionMessagesResponse.SessionMessagesResponseItem>;
393
+
394
+ export namespace SessionMessagesResponse {
395
+ export interface SessionMessagesResponseItem {
396
+ info: SessionAPI.Message;
397
+
398
+ parts: Array<SessionAPI.Part>;
399
+ }
400
+ }
315
401
 
316
402
  export type SessionSummarizeResponse = boolean;
317
403
 
318
404
  export interface SessionChatParams {
405
+ messageID: string;
406
+
407
+ mode: string;
408
+
319
409
  modelID: string;
320
410
 
321
- parts: Array<UserMessagePart>;
411
+ parts: Array<FilePart | TextPart>;
322
412
 
323
413
  providerID: string;
324
414
  }
325
415
 
326
416
  export interface SessionInitParams {
417
+ messageID: string;
418
+
327
419
  modelID: string;
328
420
 
329
421
  providerID: string;
@@ -338,10 +430,12 @@ export interface SessionSummarizeParams {
338
430
  export declare namespace SessionResource {
339
431
  export {
340
432
  type AssistantMessage as AssistantMessage,
341
- type AssistantMessagePart as AssistantMessagePart,
342
433
  type FilePart as FilePart,
343
434
  type Message as Message,
435
+ type Part as Part,
344
436
  type Session as Session,
437
+ type SnapshotPart as SnapshotPart,
438
+ type StepFinishPart as StepFinishPart,
345
439
  type StepStartPart as StepStartPart,
346
440
  type TextPart as TextPart,
347
441
  type ToolPart as ToolPart,
@@ -349,7 +443,7 @@ export declare namespace SessionResource {
349
443
  type ToolStateError as ToolStateError,
350
444
  type ToolStatePending as ToolStatePending,
351
445
  type ToolStateRunning as ToolStateRunning,
352
- type UserMessagePart as UserMessagePart,
446
+ type UserMessage as UserMessage,
353
447
  type SessionListResponse as SessionListResponse,
354
448
  type SessionDeleteResponse as SessionDeleteResponse,
355
449
  type SessionAbortResponse as SessionAbortResponse,
@@ -1,5 +1,11 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
+ export interface MessageAbortedError {
4
+ data: unknown;
5
+
6
+ name: 'MessageAbortedError';
7
+ }
8
+
3
9
  export interface ProviderAuthError {
4
10
  data: ProviderAuthError.Data;
5
11
 
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.1.0-alpha.15'; // x-release-please-version
1
+ export const VERSION = '0.1.0-alpha.17'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.1.0-alpha.15";
1
+ export declare const VERSION = "0.1.0-alpha.17";
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.15";
1
+ export declare const VERSION = "0.1.0-alpha.17";
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.15'; // x-release-please-version
4
+ exports.VERSION = '0.1.0-alpha.17'; // 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.15'; // x-release-please-version
1
+ export const VERSION = '0.1.0-alpha.17'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map