@opencode-ai/sdk 0.1.0-alpha.14 → 0.1.0-alpha.16
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.
- package/CHANGELOG.md +26 -0
- package/client.d.mts +17 -14
- package/client.d.mts.map +1 -1
- package/client.d.ts +17 -14
- package/client.d.ts.map +1 -1
- package/client.js +12 -9
- package/client.js.map +1 -1
- package/client.mjs +14 -11
- package/client.mjs.map +1 -1
- package/core/streaming.d.mts +5 -3
- package/core/streaming.d.mts.map +1 -1
- package/core/streaming.d.ts +5 -3
- package/core/streaming.d.ts.map +1 -1
- package/core/streaming.js +16 -10
- package/core/streaming.js.map +1 -1
- package/core/streaming.mjs +16 -10
- package/core/streaming.mjs.map +1 -1
- package/internal/parse.js +2 -2
- package/internal/parse.js.map +1 -1
- package/internal/parse.mjs +2 -2
- package/internal/parse.mjs.map +1 -1
- package/internal/request-options.d.mts +42 -0
- package/internal/request-options.d.mts.map +1 -1
- package/internal/request-options.d.ts +42 -0
- package/internal/request-options.d.ts.map +1 -1
- package/internal/request-options.js.map +1 -1
- package/internal/request-options.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/app.d.mts +49 -2
- package/resources/app.d.mts.map +1 -1
- package/resources/app.d.ts +49 -2
- package/resources/app.d.ts.map +1 -1
- package/resources/app.js +12 -0
- package/resources/app.js.map +1 -1
- package/resources/app.mjs +12 -0
- package/resources/app.mjs.map +1 -1
- package/resources/config.d.mts +120 -34
- package/resources/config.d.mts.map +1 -1
- package/resources/config.d.ts +120 -34
- package/resources/config.d.ts.map +1 -1
- package/resources/config.js.map +1 -1
- package/resources/config.mjs.map +1 -1
- package/resources/event.d.mts +14 -15
- package/resources/event.d.mts.map +1 -1
- package/resources/event.d.ts +14 -15
- package/resources/event.d.ts.map +1 -1
- package/resources/file.d.mts +10 -12
- package/resources/file.d.mts.map +1 -1
- package/resources/file.d.ts +10 -12
- package/resources/file.d.ts.map +1 -1
- package/resources/file.js +3 -3
- package/resources/file.js.map +1 -1
- package/resources/file.mjs +1 -1
- package/resources/file.mjs.map +1 -1
- package/resources/find.d.mts +48 -23
- package/resources/find.d.mts.map +1 -1
- package/resources/find.d.ts +48 -23
- package/resources/find.d.ts.map +1 -1
- package/resources/index.d.mts +4 -4
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +4 -4
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +2 -2
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +2 -2
- package/resources/index.mjs.map +1 -1
- package/resources/session.d.mts +169 -110
- package/resources/session.d.mts.map +1 -1
- package/resources/session.d.ts +169 -110
- package/resources/session.d.ts.map +1 -1
- package/resources/session.js.map +1 -1
- package/resources/session.mjs.map +1 -1
- package/resources/shared.d.mts +4 -0
- package/resources/shared.d.mts.map +1 -1
- package/resources/shared.d.ts +4 -0
- package/resources/shared.d.ts.map +1 -1
- package/src/client.ts +65 -32
- package/src/core/streaming.ts +22 -8
- package/src/internal/parse.ts +2 -2
- package/src/internal/request-options.ts +53 -0
- package/src/resources/app.ts +72 -3
- package/src/resources/config.ts +139 -34
- package/src/resources/event.ts +21 -19
- package/src/resources/file.ts +14 -15
- package/src/resources/find.ts +60 -22
- package/src/resources/index.ts +28 -9
- package/src/resources/session.ts +211 -122
- package/src/resources/shared.ts +6 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/src/resources/session.ts
CHANGED
|
@@ -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 SessionAPI from './session';
|
|
4
5
|
import * as Shared from './shared';
|
|
5
6
|
import { APIPromise } from '../core/api-promise';
|
|
6
7
|
import { RequestOptions } from '../internal/request-options';
|
|
@@ -38,7 +39,7 @@ export class SessionResource extends APIResource {
|
|
|
38
39
|
/**
|
|
39
40
|
* Create and send a new message to a session
|
|
40
41
|
*/
|
|
41
|
-
chat(id: string, body: SessionChatParams, options?: RequestOptions): APIPromise<
|
|
42
|
+
chat(id: string, body: SessionChatParams, options?: RequestOptions): APIPromise<AssistantMessage> {
|
|
42
43
|
return this._client.post(path`/session/${id}/message`, { body, ...options });
|
|
43
44
|
}
|
|
44
45
|
|
|
@@ -82,132 +83,108 @@ export class SessionResource extends APIResource {
|
|
|
82
83
|
}
|
|
83
84
|
}
|
|
84
85
|
|
|
85
|
-
export interface
|
|
86
|
-
|
|
86
|
+
export interface AssistantMessage {
|
|
87
|
+
id: string;
|
|
87
88
|
|
|
88
|
-
|
|
89
|
+
cost: number;
|
|
89
90
|
|
|
90
|
-
|
|
91
|
+
modelID: string;
|
|
91
92
|
|
|
92
|
-
|
|
93
|
-
}
|
|
93
|
+
path: AssistantMessage.Path;
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
id: string;
|
|
95
|
+
providerID: string;
|
|
97
96
|
|
|
98
|
-
|
|
97
|
+
role: 'assistant';
|
|
99
98
|
|
|
100
|
-
|
|
99
|
+
sessionID: string;
|
|
101
100
|
|
|
102
|
-
|
|
103
|
-
}
|
|
101
|
+
system: Array<string>;
|
|
104
102
|
|
|
105
|
-
|
|
106
|
-
export interface Metadata {
|
|
107
|
-
sessionID: string;
|
|
103
|
+
time: AssistantMessage.Time;
|
|
108
104
|
|
|
109
|
-
|
|
105
|
+
tokens: AssistantMessage.Tokens;
|
|
110
106
|
|
|
111
|
-
|
|
107
|
+
error?:
|
|
108
|
+
| Shared.ProviderAuthError
|
|
109
|
+
| Shared.UnknownError
|
|
110
|
+
| AssistantMessage.MessageOutputLengthError
|
|
111
|
+
| Shared.MessageAbortedError;
|
|
112
112
|
|
|
113
|
-
|
|
113
|
+
summary?: boolean;
|
|
114
|
+
}
|
|
114
115
|
|
|
115
|
-
|
|
116
|
+
export namespace AssistantMessage {
|
|
117
|
+
export interface Path {
|
|
118
|
+
cwd: string;
|
|
116
119
|
|
|
117
|
-
|
|
120
|
+
root: string;
|
|
118
121
|
}
|
|
119
122
|
|
|
120
|
-
export
|
|
121
|
-
|
|
122
|
-
created: number;
|
|
123
|
+
export interface Time {
|
|
124
|
+
created: number;
|
|
123
125
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
+
completed?: number;
|
|
127
|
+
}
|
|
126
128
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
+
export interface Tokens {
|
|
130
|
+
cache: Tokens.Cache;
|
|
129
131
|
|
|
130
|
-
|
|
132
|
+
input: number;
|
|
131
133
|
|
|
132
|
-
|
|
134
|
+
output: number;
|
|
133
135
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
+
reasoning: number;
|
|
137
|
+
}
|
|
136
138
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
139
|
+
export namespace Tokens {
|
|
140
|
+
export interface Cache {
|
|
141
|
+
read: number;
|
|
140
142
|
|
|
141
|
-
|
|
142
|
-
}
|
|
143
|
+
write: number;
|
|
143
144
|
}
|
|
145
|
+
}
|
|
144
146
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
modelID: string;
|
|
147
|
+
export interface MessageOutputLengthError {
|
|
148
|
+
data: unknown;
|
|
149
149
|
|
|
150
|
-
|
|
150
|
+
name: 'MessageOutputLengthError';
|
|
151
|
+
}
|
|
152
|
+
}
|
|
151
153
|
|
|
152
|
-
|
|
154
|
+
export interface FilePart {
|
|
155
|
+
id: string;
|
|
153
156
|
|
|
154
|
-
|
|
157
|
+
messageID: string;
|
|
155
158
|
|
|
156
|
-
|
|
159
|
+
mime: string;
|
|
157
160
|
|
|
158
|
-
|
|
159
|
-
}
|
|
161
|
+
sessionID: string;
|
|
160
162
|
|
|
161
|
-
|
|
162
|
-
export interface Path {
|
|
163
|
-
cwd: string;
|
|
163
|
+
type: 'file';
|
|
164
164
|
|
|
165
|
-
|
|
166
|
-
}
|
|
165
|
+
url: string;
|
|
167
166
|
|
|
168
|
-
|
|
169
|
-
|
|
167
|
+
filename?: string;
|
|
168
|
+
}
|
|
170
169
|
|
|
171
|
-
|
|
170
|
+
export type Message = UserMessage | AssistantMessage;
|
|
172
171
|
|
|
173
|
-
|
|
172
|
+
export type Part = TextPart | FilePart | ToolPart | StepStartPart | StepFinishPart | Part.UnionMember5;
|
|
174
173
|
|
|
175
|
-
|
|
176
|
-
|
|
174
|
+
export namespace Part {
|
|
175
|
+
export interface UnionMember5 {
|
|
176
|
+
id: string;
|
|
177
177
|
|
|
178
|
-
|
|
179
|
-
export interface Cache {
|
|
180
|
-
read: number;
|
|
178
|
+
messageID: string;
|
|
181
179
|
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
180
|
+
sessionID: string;
|
|
186
181
|
|
|
187
|
-
|
|
188
|
-
data: unknown;
|
|
182
|
+
snapshot: string;
|
|
189
183
|
|
|
190
|
-
|
|
191
|
-
}
|
|
184
|
+
type: 'snapshot';
|
|
192
185
|
}
|
|
193
186
|
}
|
|
194
187
|
|
|
195
|
-
export type MessagePart =
|
|
196
|
-
| TextPart
|
|
197
|
-
| ReasoningPart
|
|
198
|
-
| ToolInvocationPart
|
|
199
|
-
| SourceURLPart
|
|
200
|
-
| FilePart
|
|
201
|
-
| StepStartPart;
|
|
202
|
-
|
|
203
|
-
export interface ReasoningPart {
|
|
204
|
-
text: string;
|
|
205
|
-
|
|
206
|
-
type: 'reasoning';
|
|
207
|
-
|
|
208
|
-
providerMetadata?: { [key: string]: unknown };
|
|
209
|
-
}
|
|
210
|
-
|
|
211
188
|
export interface Session {
|
|
212
189
|
id: string;
|
|
213
190
|
|
|
@@ -244,70 +221,166 @@ export namespace Session {
|
|
|
244
221
|
}
|
|
245
222
|
}
|
|
246
223
|
|
|
247
|
-
export interface
|
|
248
|
-
|
|
224
|
+
export interface StepFinishPart {
|
|
225
|
+
id: string;
|
|
249
226
|
|
|
250
|
-
|
|
227
|
+
cost: number;
|
|
251
228
|
|
|
252
|
-
|
|
229
|
+
messageID: string;
|
|
253
230
|
|
|
254
|
-
|
|
231
|
+
sessionID: string;
|
|
255
232
|
|
|
256
|
-
|
|
233
|
+
tokens: StepFinishPart.Tokens;
|
|
234
|
+
|
|
235
|
+
type: 'step-finish';
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export namespace StepFinishPart {
|
|
239
|
+
export interface Tokens {
|
|
240
|
+
cache: Tokens.Cache;
|
|
241
|
+
|
|
242
|
+
input: number;
|
|
243
|
+
|
|
244
|
+
output: number;
|
|
245
|
+
|
|
246
|
+
reasoning: number;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
export namespace Tokens {
|
|
250
|
+
export interface Cache {
|
|
251
|
+
read: number;
|
|
252
|
+
|
|
253
|
+
write: number;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
257
256
|
}
|
|
258
257
|
|
|
259
258
|
export interface StepStartPart {
|
|
259
|
+
id: string;
|
|
260
|
+
|
|
261
|
+
messageID: string;
|
|
262
|
+
|
|
263
|
+
sessionID: string;
|
|
264
|
+
|
|
260
265
|
type: 'step-start';
|
|
261
266
|
}
|
|
262
267
|
|
|
263
268
|
export interface TextPart {
|
|
269
|
+
id: string;
|
|
270
|
+
|
|
271
|
+
messageID: string;
|
|
272
|
+
|
|
273
|
+
sessionID: string;
|
|
274
|
+
|
|
264
275
|
text: string;
|
|
265
276
|
|
|
266
277
|
type: 'text';
|
|
278
|
+
|
|
279
|
+
synthetic?: boolean;
|
|
280
|
+
|
|
281
|
+
time?: TextPart.Time;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
export namespace TextPart {
|
|
285
|
+
export interface Time {
|
|
286
|
+
start: number;
|
|
287
|
+
|
|
288
|
+
end?: number;
|
|
289
|
+
}
|
|
267
290
|
}
|
|
268
291
|
|
|
269
|
-
export interface
|
|
270
|
-
|
|
292
|
+
export interface ToolPart {
|
|
293
|
+
id: string;
|
|
294
|
+
|
|
295
|
+
callID: string;
|
|
271
296
|
|
|
272
|
-
|
|
297
|
+
messageID: string;
|
|
273
298
|
|
|
274
|
-
|
|
299
|
+
sessionID: string;
|
|
275
300
|
|
|
276
|
-
|
|
301
|
+
state: ToolStatePending | ToolStateRunning | ToolStateCompleted | ToolStateError;
|
|
277
302
|
|
|
278
|
-
|
|
303
|
+
tool: string;
|
|
304
|
+
|
|
305
|
+
type: 'tool';
|
|
279
306
|
}
|
|
280
307
|
|
|
281
|
-
export interface
|
|
282
|
-
|
|
308
|
+
export interface ToolStateCompleted {
|
|
309
|
+
input: { [key: string]: unknown };
|
|
310
|
+
|
|
311
|
+
metadata: { [key: string]: unknown };
|
|
312
|
+
|
|
313
|
+
output: string;
|
|
314
|
+
|
|
315
|
+
status: 'completed';
|
|
316
|
+
|
|
317
|
+
time: ToolStateCompleted.Time;
|
|
283
318
|
|
|
284
|
-
|
|
319
|
+
title: string;
|
|
285
320
|
}
|
|
286
321
|
|
|
287
|
-
export
|
|
288
|
-
|
|
322
|
+
export namespace ToolStateCompleted {
|
|
323
|
+
export interface Time {
|
|
324
|
+
end: number;
|
|
289
325
|
|
|
290
|
-
|
|
326
|
+
start: number;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
291
329
|
|
|
292
|
-
|
|
330
|
+
export interface ToolStateError {
|
|
331
|
+
error: string;
|
|
293
332
|
|
|
294
|
-
|
|
333
|
+
input: { [key: string]: unknown };
|
|
295
334
|
|
|
296
|
-
|
|
335
|
+
status: 'error';
|
|
336
|
+
|
|
337
|
+
time: ToolStateError.Time;
|
|
297
338
|
}
|
|
298
339
|
|
|
299
|
-
export
|
|
300
|
-
|
|
340
|
+
export namespace ToolStateError {
|
|
341
|
+
export interface Time {
|
|
342
|
+
end: number;
|
|
301
343
|
|
|
302
|
-
|
|
344
|
+
start: number;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
export interface ToolStatePending {
|
|
349
|
+
status: 'pending';
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
export interface ToolStateRunning {
|
|
353
|
+
status: 'running';
|
|
303
354
|
|
|
304
|
-
|
|
355
|
+
time: ToolStateRunning.Time;
|
|
305
356
|
|
|
306
|
-
|
|
357
|
+
input?: unknown;
|
|
307
358
|
|
|
308
|
-
|
|
359
|
+
metadata?: { [key: string]: unknown };
|
|
360
|
+
|
|
361
|
+
title?: string;
|
|
362
|
+
}
|
|
309
363
|
|
|
310
|
-
|
|
364
|
+
export namespace ToolStateRunning {
|
|
365
|
+
export interface Time {
|
|
366
|
+
start: number;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
export interface UserMessage {
|
|
371
|
+
id: string;
|
|
372
|
+
|
|
373
|
+
role: 'user';
|
|
374
|
+
|
|
375
|
+
sessionID: string;
|
|
376
|
+
|
|
377
|
+
time: UserMessage.Time;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
export namespace UserMessage {
|
|
381
|
+
export interface Time {
|
|
382
|
+
created: number;
|
|
383
|
+
}
|
|
311
384
|
}
|
|
312
385
|
|
|
313
386
|
export type SessionListResponse = Array<Session>;
|
|
@@ -318,19 +391,33 @@ export type SessionAbortResponse = boolean;
|
|
|
318
391
|
|
|
319
392
|
export type SessionInitResponse = boolean;
|
|
320
393
|
|
|
321
|
-
export type SessionMessagesResponse = Array<
|
|
394
|
+
export type SessionMessagesResponse = Array<SessionMessagesResponse.SessionMessagesResponseItem>;
|
|
395
|
+
|
|
396
|
+
export namespace SessionMessagesResponse {
|
|
397
|
+
export interface SessionMessagesResponseItem {
|
|
398
|
+
info: SessionAPI.Message;
|
|
399
|
+
|
|
400
|
+
parts: Array<SessionAPI.Part>;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
322
403
|
|
|
323
404
|
export type SessionSummarizeResponse = boolean;
|
|
324
405
|
|
|
325
406
|
export interface SessionChatParams {
|
|
407
|
+
messageID: string;
|
|
408
|
+
|
|
409
|
+
mode: string;
|
|
410
|
+
|
|
326
411
|
modelID: string;
|
|
327
412
|
|
|
328
|
-
parts: Array<
|
|
413
|
+
parts: Array<FilePart | TextPart>;
|
|
329
414
|
|
|
330
415
|
providerID: string;
|
|
331
416
|
}
|
|
332
417
|
|
|
333
418
|
export interface SessionInitParams {
|
|
419
|
+
messageID: string;
|
|
420
|
+
|
|
334
421
|
modelID: string;
|
|
335
422
|
|
|
336
423
|
providerID: string;
|
|
@@ -344,18 +431,20 @@ export interface SessionSummarizeParams {
|
|
|
344
431
|
|
|
345
432
|
export declare namespace SessionResource {
|
|
346
433
|
export {
|
|
434
|
+
type AssistantMessage as AssistantMessage,
|
|
347
435
|
type FilePart as FilePart,
|
|
348
436
|
type Message as Message,
|
|
349
|
-
type
|
|
350
|
-
type ReasoningPart as ReasoningPart,
|
|
437
|
+
type Part as Part,
|
|
351
438
|
type Session as Session,
|
|
352
|
-
type
|
|
439
|
+
type StepFinishPart as StepFinishPart,
|
|
353
440
|
type StepStartPart as StepStartPart,
|
|
354
441
|
type TextPart as TextPart,
|
|
355
|
-
type
|
|
356
|
-
type
|
|
357
|
-
type
|
|
358
|
-
type
|
|
442
|
+
type ToolPart as ToolPart,
|
|
443
|
+
type ToolStateCompleted as ToolStateCompleted,
|
|
444
|
+
type ToolStateError as ToolStateError,
|
|
445
|
+
type ToolStatePending as ToolStatePending,
|
|
446
|
+
type ToolStateRunning as ToolStateRunning,
|
|
447
|
+
type UserMessage as UserMessage,
|
|
359
448
|
type SessionListResponse as SessionListResponse,
|
|
360
449
|
type SessionDeleteResponse as SessionDeleteResponse,
|
|
361
450
|
type SessionAbortResponse as SessionAbortResponse,
|
package/src/resources/shared.ts
CHANGED
|
@@ -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.
|
|
1
|
+
export const VERSION = '0.1.0-alpha.16'; // x-release-please-version
|
package/version.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.1.0-alpha.
|
|
1
|
+
export declare const VERSION = "0.1.0-alpha.16";
|
|
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.
|
|
1
|
+
export declare const VERSION = "0.1.0-alpha.16";
|
|
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.
|
|
4
|
+
exports.VERSION = '0.1.0-alpha.16'; // 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.
|
|
1
|
+
export const VERSION = '0.1.0-alpha.16'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|