@tambo-ai/typescript-sdk 0.80.0 → 0.83.0

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 (132) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/README.md +1 -3
  3. package/bin/migration-config.json +66 -0
  4. package/client.d.mts +6 -0
  5. package/client.d.mts.map +1 -1
  6. package/client.d.ts +6 -0
  7. package/client.d.ts.map +1 -1
  8. package/client.js +6 -0
  9. package/client.js.map +1 -1
  10. package/client.mjs +6 -0
  11. package/client.mjs.map +1 -1
  12. package/lib/advance-stream.d.mts +2 -2
  13. package/lib/advance-stream.d.mts.map +1 -1
  14. package/lib/advance-stream.d.ts +2 -2
  15. package/lib/advance-stream.d.ts.map +1 -1
  16. package/lib/advance-stream.js.map +1 -1
  17. package/lib/advance-stream.mjs.map +1 -1
  18. package/package.json +1 -1
  19. package/resources/beta/beta.d.mts +2 -2
  20. package/resources/beta/beta.d.mts.map +1 -1
  21. package/resources/beta/beta.d.ts +2 -2
  22. package/resources/beta/beta.d.ts.map +1 -1
  23. package/resources/beta/beta.js.map +1 -1
  24. package/resources/beta/beta.mjs.map +1 -1
  25. package/resources/beta/index.d.mts +1 -1
  26. package/resources/beta/index.d.mts.map +1 -1
  27. package/resources/beta/index.d.ts +1 -1
  28. package/resources/beta/index.d.ts.map +1 -1
  29. package/resources/beta/index.js.map +1 -1
  30. package/resources/beta/index.mjs.map +1 -1
  31. package/resources/beta/threads/index.d.mts +1 -1
  32. package/resources/beta/threads/index.d.mts.map +1 -1
  33. package/resources/beta/threads/index.d.ts +1 -1
  34. package/resources/beta/threads/index.d.ts.map +1 -1
  35. package/resources/beta/threads/index.js.map +1 -1
  36. package/resources/beta/threads/index.mjs.map +1 -1
  37. package/resources/beta/threads/messages.d.mts +5 -2
  38. package/resources/beta/threads/messages.d.mts.map +1 -1
  39. package/resources/beta/threads/messages.d.ts +5 -2
  40. package/resources/beta/threads/messages.d.ts.map +1 -1
  41. package/resources/beta/threads/messages.js +4 -1
  42. package/resources/beta/threads/messages.js.map +1 -1
  43. package/resources/beta/threads/messages.mjs +4 -1
  44. package/resources/beta/threads/messages.mjs.map +1 -1
  45. package/resources/beta/threads/threads.d.mts +6 -135
  46. package/resources/beta/threads/threads.d.mts.map +1 -1
  47. package/resources/beta/threads/threads.d.ts +6 -135
  48. package/resources/beta/threads/threads.d.ts.map +1 -1
  49. package/resources/beta/threads/threads.js +6 -25
  50. package/resources/beta/threads/threads.js.map +1 -1
  51. package/resources/beta/threads/threads.mjs +6 -25
  52. package/resources/beta/threads/threads.mjs.map +1 -1
  53. package/resources/index.d.mts +2 -0
  54. package/resources/index.d.mts.map +1 -1
  55. package/resources/index.d.ts +2 -0
  56. package/resources/index.d.ts.map +1 -1
  57. package/resources/index.js +5 -1
  58. package/resources/index.js.map +1 -1
  59. package/resources/index.mjs +2 -0
  60. package/resources/index.mjs.map +1 -1
  61. package/resources/shared.d.mts +3 -0
  62. package/resources/shared.d.mts.map +1 -1
  63. package/resources/shared.d.ts +3 -0
  64. package/resources/shared.d.ts.map +1 -1
  65. package/resources/storage.d.mts +46 -0
  66. package/resources/storage.d.mts.map +1 -0
  67. package/resources/storage.d.ts +46 -0
  68. package/resources/storage.d.ts.map +1 -0
  69. package/resources/storage.js +24 -0
  70. package/resources/storage.js.map +1 -0
  71. package/resources/storage.mjs +20 -0
  72. package/resources/storage.mjs.map +1 -0
  73. package/resources/threads/index.d.mts +4 -0
  74. package/resources/threads/index.d.mts.map +1 -0
  75. package/resources/threads/index.d.ts +4 -0
  76. package/resources/threads/index.d.ts.map +1 -0
  77. package/resources/threads/index.js +11 -0
  78. package/resources/threads/index.js.map +1 -0
  79. package/resources/threads/index.mjs +5 -0
  80. package/resources/threads/index.mjs.map +1 -0
  81. package/resources/threads/messages.d.mts +113 -0
  82. package/resources/threads/messages.d.mts.map +1 -0
  83. package/resources/threads/messages.d.ts +113 -0
  84. package/resources/threads/messages.d.ts.map +1 -0
  85. package/resources/threads/messages.js +38 -0
  86. package/resources/threads/messages.js.map +1 -0
  87. package/resources/threads/messages.mjs +34 -0
  88. package/resources/threads/messages.mjs.map +1 -0
  89. package/resources/threads/runs.d.mts +277 -0
  90. package/resources/threads/runs.d.mts.map +1 -0
  91. package/resources/threads/runs.d.ts +277 -0
  92. package/resources/threads/runs.d.ts.map +1 -0
  93. package/resources/threads/runs.js +69 -0
  94. package/resources/threads/runs.js.map +1 -0
  95. package/resources/threads/runs.mjs +65 -0
  96. package/resources/threads/runs.mjs.map +1 -0
  97. package/resources/threads/threads.d.mts +391 -0
  98. package/resources/threads/threads.d.mts.map +1 -0
  99. package/resources/threads/threads.d.ts +391 -0
  100. package/resources/threads/threads.d.ts.map +1 -0
  101. package/resources/threads/threads.js +75 -0
  102. package/resources/threads/threads.js.map +1 -0
  103. package/resources/threads/threads.mjs +70 -0
  104. package/resources/threads/threads.mjs.map +1 -0
  105. package/resources/threads.d.mts +2 -0
  106. package/resources/threads.d.mts.map +1 -0
  107. package/resources/threads.d.ts +2 -0
  108. package/resources/threads.d.ts.map +1 -0
  109. package/resources/threads.js +6 -0
  110. package/resources/threads.js.map +1 -0
  111. package/resources/threads.mjs +3 -0
  112. package/resources/threads.mjs.map +1 -0
  113. package/src/client.ts +40 -0
  114. package/src/lib/advance-stream.ts +2 -2
  115. package/src/resources/beta/beta.ts +0 -2
  116. package/src/resources/beta/index.ts +0 -1
  117. package/src/resources/beta/threads/index.ts +0 -1
  118. package/src/resources/beta/threads/messages.ts +5 -2
  119. package/src/resources/beta/threads/threads.ts +6 -157
  120. package/src/resources/index.ts +15 -0
  121. package/src/resources/shared.ts +3 -0
  122. package/src/resources/storage.ts +59 -0
  123. package/src/resources/threads/index.ts +31 -0
  124. package/src/resources/threads/messages.ts +161 -0
  125. package/src/resources/threads/runs.ts +354 -0
  126. package/src/resources/threads/threads.ts +536 -0
  127. package/src/resources/threads.ts +3 -0
  128. package/src/version.ts +1 -1
  129. package/version.d.mts +1 -1
  130. package/version.d.ts +1 -1
  131. package/version.js +1 -1
  132. package/version.mjs +1 -1
@@ -0,0 +1,536 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import * as ThreadsAPI from './threads';
5
+ import * as Shared from '../shared';
6
+ import * as MessagesAPI from './messages';
7
+ import {
8
+ MessageGetParams,
9
+ MessageGetResponse,
10
+ MessageListParams,
11
+ MessageListResponse,
12
+ Messages,
13
+ } from './messages';
14
+ import * as RunsAPI from './runs';
15
+ import {
16
+ InputMessage,
17
+ RunCreateParams,
18
+ RunDeleteParams,
19
+ RunDeleteResponse,
20
+ RunRunParams,
21
+ Runs,
22
+ } from './runs';
23
+ import { APIPromise } from '../../core/api-promise';
24
+ import { buildHeaders } from '../../internal/headers';
25
+ import { RequestOptions } from '../../internal/request-options';
26
+ import { path } from '../../internal/utils/path';
27
+
28
+ export class Threads extends APIResource {
29
+ messages: MessagesAPI.Messages = new MessagesAPI.Messages(this._client);
30
+ runs: RunsAPI.Runs = new RunsAPI.Runs(this._client);
31
+
32
+ /**
33
+ * Create a new empty thread. Note: initialMessages is not supported yet; create
34
+ * the thread first, then add messages via runs/message endpoints.
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * const thread = await client.threads.create();
39
+ * ```
40
+ */
41
+ create(body: ThreadCreateParams, options?: RequestOptions): APIPromise<ThreadCreateResponse> {
42
+ return this._client.post('/v1/threads', { body, ...options });
43
+ }
44
+
45
+ /**
46
+ * Get a thread by ID with all its messages. The thread must belong to the
47
+ * authenticated project.
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * const thread = await client.threads.retrieve(
52
+ * 'thr_abc123xyz',
53
+ * );
54
+ * ```
55
+ */
56
+ retrieve(threadID: string, options?: RequestOptions): APIPromise<ThreadRetrieveResponse> {
57
+ return this._client.get(path`/v1/threads/${threadID}`, options);
58
+ }
59
+
60
+ /**
61
+ * List all threads for the authenticated project. Supports cursor-based pagination
62
+ * and filtering by context key.
63
+ *
64
+ * @example
65
+ * ```ts
66
+ * const threads = await client.threads.list();
67
+ * ```
68
+ */
69
+ list(
70
+ query: ThreadListParams | null | undefined = {},
71
+ options?: RequestOptions,
72
+ ): APIPromise<ThreadListResponse> {
73
+ return this._client.get('/v1/threads', { query, ...options });
74
+ }
75
+
76
+ /**
77
+ * Delete a thread and all its messages. This action cannot be undone.
78
+ *
79
+ * @example
80
+ * ```ts
81
+ * await client.threads.delete('thr_abc123xyz');
82
+ * ```
83
+ */
84
+ delete(threadID: string, options?: RequestOptions): APIPromise<void> {
85
+ return this._client.delete(path`/v1/threads/${threadID}`, {
86
+ ...options,
87
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
88
+ });
89
+ }
90
+ }
91
+
92
+ export interface ComponentContent {
93
+ /**
94
+ * Unique identifier for this component instance
95
+ */
96
+ id: string;
97
+
98
+ /**
99
+ * Name of the component to render
100
+ */
101
+ name: string;
102
+
103
+ /**
104
+ * Props to pass to the component
105
+ */
106
+ props: unknown;
107
+
108
+ /**
109
+ * Content block type identifier
110
+ */
111
+ type: 'component';
112
+
113
+ /**
114
+ * Current state of the component
115
+ */
116
+ state?: unknown;
117
+ }
118
+
119
+ export interface ResourceContent {
120
+ /**
121
+ * Resource data containing URI, text, or blob
122
+ */
123
+ resource: Shared.Resource;
124
+
125
+ /**
126
+ * Content block type identifier
127
+ */
128
+ type: 'resource';
129
+ }
130
+
131
+ export interface RunError {
132
+ /**
133
+ * Error message
134
+ */
135
+ message: string;
136
+
137
+ /**
138
+ * Error code
139
+ */
140
+ code?: string;
141
+ }
142
+
143
+ export interface TextContent {
144
+ /**
145
+ * The text content
146
+ */
147
+ text: string;
148
+
149
+ /**
150
+ * Content block type identifier
151
+ */
152
+ type: 'text';
153
+ }
154
+
155
+ export interface ToolResultContent {
156
+ /**
157
+ * Result content (text or resource blocks)
158
+ */
159
+ content: Array<TextContent | ResourceContent>;
160
+
161
+ /**
162
+ * ID of the tool call this result responds to
163
+ */
164
+ toolUseId: string;
165
+
166
+ /**
167
+ * Content block type identifier
168
+ */
169
+ type: 'tool_result';
170
+
171
+ /**
172
+ * Whether the tool call resulted in an error
173
+ */
174
+ isError?: boolean;
175
+ }
176
+
177
+ export interface ToolUseContent {
178
+ /**
179
+ * Unique identifier for this tool call
180
+ */
181
+ id: string;
182
+
183
+ /**
184
+ * Input arguments for the tool
185
+ */
186
+ input: unknown;
187
+
188
+ /**
189
+ * Name of the tool being called
190
+ */
191
+ name: string;
192
+
193
+ /**
194
+ * Content block type identifier
195
+ */
196
+ type: 'tool_use';
197
+ }
198
+
199
+ export interface ThreadCreateResponse {
200
+ /**
201
+ * Unique identifier for this thread
202
+ */
203
+ id: string;
204
+
205
+ /**
206
+ * When the thread was created (ISO 8601)
207
+ */
208
+ createdAt: string;
209
+
210
+ /**
211
+ * Project this thread belongs to
212
+ */
213
+ projectId: string;
214
+
215
+ /**
216
+ * Current run status: idle (no run), waiting (run started, awaiting content),
217
+ * streaming (receiving content)
218
+ */
219
+ runStatus: 'idle' | 'waiting' | 'streaming';
220
+
221
+ /**
222
+ * When the thread was last updated (ISO 8601)
223
+ */
224
+ updatedAt: string;
225
+
226
+ /**
227
+ * Optional context key for thread organization
228
+ */
229
+ contextKey?: string;
230
+
231
+ /**
232
+ * ID of the currently active run (when not idle)
233
+ */
234
+ currentRunId?: string;
235
+
236
+ /**
237
+ * ID of the last completed run. Required as previousRunId when continuing after
238
+ * tool calls.
239
+ */
240
+ lastCompletedRunId?: string;
241
+
242
+ /**
243
+ * Whether the last run was cancelled
244
+ */
245
+ lastRunCancelled?: boolean;
246
+
247
+ /**
248
+ * Error information from the last run
249
+ */
250
+ lastRunError?: RunError;
251
+
252
+ /**
253
+ * Additional metadata
254
+ */
255
+ metadata?: unknown;
256
+
257
+ /**
258
+ * Tool call IDs awaiting client-side results. If non-empty, next run must provide
259
+ * tool_result content with previousRunId set.
260
+ */
261
+ pendingToolCallIds?: Array<string>;
262
+
263
+ /**
264
+ * Human-readable status message (e.g., 'Fetching weather data...')
265
+ */
266
+ statusMessage?: string;
267
+ }
268
+
269
+ export interface ThreadRetrieveResponse {
270
+ /**
271
+ * Unique identifier for this thread
272
+ */
273
+ id: string;
274
+
275
+ /**
276
+ * When the thread was created (ISO 8601)
277
+ */
278
+ createdAt: string;
279
+
280
+ /**
281
+ * Messages in this thread
282
+ */
283
+ messages: Array<ThreadRetrieveResponse.Message>;
284
+
285
+ /**
286
+ * Project this thread belongs to
287
+ */
288
+ projectId: string;
289
+
290
+ /**
291
+ * Current run status: idle (no run), waiting (run started, awaiting content),
292
+ * streaming (receiving content)
293
+ */
294
+ runStatus: 'idle' | 'waiting' | 'streaming';
295
+
296
+ /**
297
+ * When the thread was last updated (ISO 8601)
298
+ */
299
+ updatedAt: string;
300
+
301
+ /**
302
+ * Optional context key for thread organization
303
+ */
304
+ contextKey?: string;
305
+
306
+ /**
307
+ * ID of the currently active run (when not idle)
308
+ */
309
+ currentRunId?: string;
310
+
311
+ /**
312
+ * ID of the last completed run. Required as previousRunId when continuing after
313
+ * tool calls.
314
+ */
315
+ lastCompletedRunId?: string;
316
+
317
+ /**
318
+ * Whether the last run was cancelled
319
+ */
320
+ lastRunCancelled?: boolean;
321
+
322
+ /**
323
+ * Error information from the last run
324
+ */
325
+ lastRunError?: RunError;
326
+
327
+ /**
328
+ * Additional metadata
329
+ */
330
+ metadata?: unknown;
331
+
332
+ /**
333
+ * Tool call IDs awaiting client-side results. If non-empty, next run must provide
334
+ * tool_result content with previousRunId set.
335
+ */
336
+ pendingToolCallIds?: Array<string>;
337
+
338
+ /**
339
+ * Human-readable status message (e.g., 'Fetching weather data...')
340
+ */
341
+ statusMessage?: string;
342
+ }
343
+
344
+ export namespace ThreadRetrieveResponse {
345
+ export interface Message {
346
+ /**
347
+ * Unique identifier for this message
348
+ */
349
+ id: string;
350
+
351
+ /**
352
+ * Content blocks in this message
353
+ */
354
+ content: Array<
355
+ | ThreadsAPI.TextContent
356
+ | ThreadsAPI.ResourceContent
357
+ | ThreadsAPI.ToolUseContent
358
+ | ThreadsAPI.ToolResultContent
359
+ | ThreadsAPI.ComponentContent
360
+ >;
361
+
362
+ /**
363
+ * Message role
364
+ */
365
+ role: 'user' | 'assistant' | 'system';
366
+
367
+ /**
368
+ * When the message was created (ISO 8601)
369
+ */
370
+ createdAt?: string;
371
+
372
+ /**
373
+ * Additional metadata
374
+ */
375
+ metadata?: unknown;
376
+ }
377
+ }
378
+
379
+ export interface ThreadListResponse {
380
+ /**
381
+ * Whether there are more results
382
+ */
383
+ hasMore: boolean;
384
+
385
+ /**
386
+ * List of threads
387
+ */
388
+ threads: Array<ThreadListResponse.Thread>;
389
+
390
+ /**
391
+ * Cursor for the next page of results
392
+ */
393
+ nextCursor?: string;
394
+ }
395
+
396
+ export namespace ThreadListResponse {
397
+ export interface Thread {
398
+ /**
399
+ * Unique identifier for this thread
400
+ */
401
+ id: string;
402
+
403
+ /**
404
+ * When the thread was created (ISO 8601)
405
+ */
406
+ createdAt: string;
407
+
408
+ /**
409
+ * Project this thread belongs to
410
+ */
411
+ projectId: string;
412
+
413
+ /**
414
+ * Current run status: idle (no run), waiting (run started, awaiting content),
415
+ * streaming (receiving content)
416
+ */
417
+ runStatus: 'idle' | 'waiting' | 'streaming';
418
+
419
+ /**
420
+ * When the thread was last updated (ISO 8601)
421
+ */
422
+ updatedAt: string;
423
+
424
+ /**
425
+ * Optional context key for thread organization
426
+ */
427
+ contextKey?: string;
428
+
429
+ /**
430
+ * ID of the currently active run (when not idle)
431
+ */
432
+ currentRunId?: string;
433
+
434
+ /**
435
+ * ID of the last completed run. Required as previousRunId when continuing after
436
+ * tool calls.
437
+ */
438
+ lastCompletedRunId?: string;
439
+
440
+ /**
441
+ * Whether the last run was cancelled
442
+ */
443
+ lastRunCancelled?: boolean;
444
+
445
+ /**
446
+ * Error information from the last run
447
+ */
448
+ lastRunError?: ThreadsAPI.RunError;
449
+
450
+ /**
451
+ * Additional metadata
452
+ */
453
+ metadata?: unknown;
454
+
455
+ /**
456
+ * Tool call IDs awaiting client-side results. If non-empty, next run must provide
457
+ * tool_result content with previousRunId set.
458
+ */
459
+ pendingToolCallIds?: Array<string>;
460
+
461
+ /**
462
+ * Human-readable status message (e.g., 'Fetching weather data...')
463
+ */
464
+ statusMessage?: string;
465
+ }
466
+ }
467
+
468
+ export interface ThreadCreateParams {
469
+ /**
470
+ * Optional context key for thread organization
471
+ */
472
+ contextKey?: string;
473
+
474
+ /**
475
+ * Initial messages to seed the thread with
476
+ */
477
+ initialMessages?: Array<RunsAPI.InputMessage>;
478
+
479
+ /**
480
+ * Additional metadata to attach to the thread
481
+ */
482
+ metadata?: unknown;
483
+ }
484
+
485
+ export interface ThreadListParams {
486
+ /**
487
+ * Filter by context key
488
+ */
489
+ contextKey?: string;
490
+
491
+ /**
492
+ * Cursor for pagination
493
+ */
494
+ cursor?: string;
495
+
496
+ /**
497
+ * Maximum number of threads to return
498
+ */
499
+ limit?: string;
500
+ }
501
+
502
+ Threads.Messages = Messages;
503
+ Threads.Runs = Runs;
504
+
505
+ export declare namespace Threads {
506
+ export {
507
+ type ComponentContent as ComponentContent,
508
+ type ResourceContent as ResourceContent,
509
+ type RunError as RunError,
510
+ type TextContent as TextContent,
511
+ type ToolResultContent as ToolResultContent,
512
+ type ToolUseContent as ToolUseContent,
513
+ type ThreadCreateResponse as ThreadCreateResponse,
514
+ type ThreadRetrieveResponse as ThreadRetrieveResponse,
515
+ type ThreadListResponse as ThreadListResponse,
516
+ type ThreadCreateParams as ThreadCreateParams,
517
+ type ThreadListParams as ThreadListParams,
518
+ };
519
+
520
+ export {
521
+ Messages as Messages,
522
+ type MessageListResponse as MessageListResponse,
523
+ type MessageGetResponse as MessageGetResponse,
524
+ type MessageListParams as MessageListParams,
525
+ type MessageGetParams as MessageGetParams,
526
+ };
527
+
528
+ export {
529
+ Runs as Runs,
530
+ type InputMessage as InputMessage,
531
+ type RunDeleteResponse as RunDeleteResponse,
532
+ type RunCreateParams as RunCreateParams,
533
+ type RunDeleteParams as RunDeleteParams,
534
+ type RunRunParams as RunRunParams,
535
+ };
536
+ }
@@ -0,0 +1,3 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export * from './threads/index';
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.80.0'; // x-release-please-version
1
+ export const VERSION = '0.83.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.80.0";
1
+ export declare const VERSION = "0.83.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.80.0";
1
+ export declare const VERSION = "0.83.0";
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.80.0'; // x-release-please-version
4
+ exports.VERSION = '0.83.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.80.0'; // x-release-please-version
1
+ export const VERSION = '0.83.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map