@tambo-ai/typescript-sdk 0.80.0 → 0.82.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 +56 -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 +112 -0
  82. package/resources/threads/messages.d.mts.map +1 -0
  83. package/resources/threads/messages.d.ts +112 -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 +270 -0
  90. package/resources/threads/runs.d.mts.map +1 -0
  91. package/resources/threads/runs.d.ts +270 -0
  92. package/resources/threads/runs.d.ts.map +1 -0
  93. package/resources/threads/runs.js +63 -0
  94. package/resources/threads/runs.js.map +1 -0
  95. package/resources/threads/runs.mjs +59 -0
  96. package/resources/threads/runs.mjs.map +1 -0
  97. package/resources/threads/threads.d.mts +312 -0
  98. package/resources/threads/threads.d.mts.map +1 -0
  99. package/resources/threads/threads.d.ts +312 -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 +30 -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 +10 -0
  121. package/src/resources/shared.ts +3 -0
  122. package/src/resources/storage.ts +59 -0
  123. package/src/resources/threads/index.ts +26 -0
  124. package/src/resources/threads/messages.ts +148 -0
  125. package/src/resources/threads/runs.ts +347 -0
  126. package/src/resources/threads/threads.ts +429 -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,429 @@
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 MessagesAPI from './messages';
6
+ import {
7
+ MessageGetParams,
8
+ MessageGetResponse,
9
+ MessageListParams,
10
+ MessageListResponse,
11
+ Messages,
12
+ } from './messages';
13
+ import * as RunsAPI from './runs';
14
+ import {
15
+ InputMessage,
16
+ RunCreateParams,
17
+ RunDeleteParams,
18
+ RunDeleteResponse,
19
+ RunRunParams,
20
+ Runs,
21
+ } from './runs';
22
+ import { APIPromise } from '../../core/api-promise';
23
+ import { buildHeaders } from '../../internal/headers';
24
+ import { RequestOptions } from '../../internal/request-options';
25
+ import { path } from '../../internal/utils/path';
26
+
27
+ export class Threads extends APIResource {
28
+ messages: MessagesAPI.Messages = new MessagesAPI.Messages(this._client);
29
+ runs: RunsAPI.Runs = new RunsAPI.Runs(this._client);
30
+
31
+ /**
32
+ * Create a new empty thread. Note: initialMessages is not supported yet; create
33
+ * the thread first, then add messages via runs/message endpoints.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * const thread = await client.threads.create();
38
+ * ```
39
+ */
40
+ create(body: ThreadCreateParams, options?: RequestOptions): APIPromise<ThreadCreateResponse> {
41
+ return this._client.post('/v1/threads', { body, ...options });
42
+ }
43
+
44
+ /**
45
+ * Get a thread by ID with all its messages. The thread must belong to the
46
+ * authenticated project.
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * const thread = await client.threads.retrieve(
51
+ * 'thr_abc123xyz',
52
+ * );
53
+ * ```
54
+ */
55
+ retrieve(threadID: string, options?: RequestOptions): APIPromise<ThreadRetrieveResponse> {
56
+ return this._client.get(path`/v1/threads/${threadID}`, options);
57
+ }
58
+
59
+ /**
60
+ * List all threads for the authenticated project. Supports cursor-based pagination
61
+ * and filtering by context key.
62
+ *
63
+ * @example
64
+ * ```ts
65
+ * const threads = await client.threads.list();
66
+ * ```
67
+ */
68
+ list(
69
+ query: ThreadListParams | null | undefined = {},
70
+ options?: RequestOptions,
71
+ ): APIPromise<ThreadListResponse> {
72
+ return this._client.get('/v1/threads', { query, ...options });
73
+ }
74
+
75
+ /**
76
+ * Delete a thread and all its messages. This action cannot be undone.
77
+ *
78
+ * @example
79
+ * ```ts
80
+ * await client.threads.delete('thr_abc123xyz');
81
+ * ```
82
+ */
83
+ delete(threadID: string, options?: RequestOptions): APIPromise<void> {
84
+ return this._client.delete(path`/v1/threads/${threadID}`, {
85
+ ...options,
86
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
87
+ });
88
+ }
89
+ }
90
+
91
+ export interface RunError {
92
+ /**
93
+ * Error message
94
+ */
95
+ message: string;
96
+
97
+ /**
98
+ * Error code
99
+ */
100
+ code?: string;
101
+ }
102
+
103
+ export interface ThreadCreateResponse {
104
+ /**
105
+ * Unique identifier for this thread
106
+ */
107
+ id: string;
108
+
109
+ /**
110
+ * When the thread was created (ISO 8601)
111
+ */
112
+ createdAt: string;
113
+
114
+ /**
115
+ * Project this thread belongs to
116
+ */
117
+ projectId: string;
118
+
119
+ /**
120
+ * Current run status: idle (no run), waiting (run started, awaiting content),
121
+ * streaming (receiving content)
122
+ */
123
+ runStatus: 'idle' | 'waiting' | 'streaming';
124
+
125
+ /**
126
+ * When the thread was last updated (ISO 8601)
127
+ */
128
+ updatedAt: string;
129
+
130
+ /**
131
+ * Optional context key for thread organization
132
+ */
133
+ contextKey?: string;
134
+
135
+ /**
136
+ * ID of the currently active run (when not idle)
137
+ */
138
+ currentRunId?: string;
139
+
140
+ /**
141
+ * ID of the last completed run. Required as previousRunId when continuing after
142
+ * tool calls.
143
+ */
144
+ lastCompletedRunId?: string;
145
+
146
+ /**
147
+ * Whether the last run was cancelled
148
+ */
149
+ lastRunCancelled?: boolean;
150
+
151
+ /**
152
+ * Error information from the last run
153
+ */
154
+ lastRunError?: RunError;
155
+
156
+ /**
157
+ * Additional metadata
158
+ */
159
+ metadata?: unknown;
160
+
161
+ /**
162
+ * Tool call IDs awaiting client-side results. If non-empty, next run must provide
163
+ * tool_result content with previousRunId set.
164
+ */
165
+ pendingToolCallIds?: Array<string>;
166
+
167
+ /**
168
+ * Human-readable status message (e.g., 'Fetching weather data...')
169
+ */
170
+ statusMessage?: string;
171
+ }
172
+
173
+ export interface ThreadRetrieveResponse {
174
+ /**
175
+ * Unique identifier for this thread
176
+ */
177
+ id: string;
178
+
179
+ /**
180
+ * When the thread was created (ISO 8601)
181
+ */
182
+ createdAt: string;
183
+
184
+ /**
185
+ * Messages in this thread
186
+ */
187
+ messages: Array<ThreadRetrieveResponse.Message>;
188
+
189
+ /**
190
+ * Project this thread belongs to
191
+ */
192
+ projectId: string;
193
+
194
+ /**
195
+ * Current run status: idle (no run), waiting (run started, awaiting content),
196
+ * streaming (receiving content)
197
+ */
198
+ runStatus: 'idle' | 'waiting' | 'streaming';
199
+
200
+ /**
201
+ * When the thread was last updated (ISO 8601)
202
+ */
203
+ updatedAt: string;
204
+
205
+ /**
206
+ * Optional context key for thread organization
207
+ */
208
+ contextKey?: string;
209
+
210
+ /**
211
+ * ID of the currently active run (when not idle)
212
+ */
213
+ currentRunId?: string;
214
+
215
+ /**
216
+ * ID of the last completed run. Required as previousRunId when continuing after
217
+ * tool calls.
218
+ */
219
+ lastCompletedRunId?: string;
220
+
221
+ /**
222
+ * Whether the last run was cancelled
223
+ */
224
+ lastRunCancelled?: boolean;
225
+
226
+ /**
227
+ * Error information from the last run
228
+ */
229
+ lastRunError?: RunError;
230
+
231
+ /**
232
+ * Additional metadata
233
+ */
234
+ metadata?: unknown;
235
+
236
+ /**
237
+ * Tool call IDs awaiting client-side results. If non-empty, next run must provide
238
+ * tool_result content with previousRunId set.
239
+ */
240
+ pendingToolCallIds?: Array<string>;
241
+
242
+ /**
243
+ * Human-readable status message (e.g., 'Fetching weather data...')
244
+ */
245
+ statusMessage?: string;
246
+ }
247
+
248
+ export namespace ThreadRetrieveResponse {
249
+ export interface Message {
250
+ /**
251
+ * Unique identifier for this message
252
+ */
253
+ id: string;
254
+
255
+ /**
256
+ * Content blocks in this message
257
+ */
258
+ content: Array<unknown>;
259
+
260
+ /**
261
+ * Message role
262
+ */
263
+ role: 'user' | 'assistant' | 'system';
264
+
265
+ /**
266
+ * When the message was created (ISO 8601)
267
+ */
268
+ createdAt?: string;
269
+
270
+ /**
271
+ * Additional metadata
272
+ */
273
+ metadata?: unknown;
274
+ }
275
+ }
276
+
277
+ export interface ThreadListResponse {
278
+ /**
279
+ * Whether there are more results
280
+ */
281
+ hasMore: boolean;
282
+
283
+ /**
284
+ * List of threads
285
+ */
286
+ threads: Array<ThreadListResponse.Thread>;
287
+
288
+ /**
289
+ * Cursor for the next page of results
290
+ */
291
+ nextCursor?: string;
292
+ }
293
+
294
+ export namespace ThreadListResponse {
295
+ export interface Thread {
296
+ /**
297
+ * Unique identifier for this thread
298
+ */
299
+ id: string;
300
+
301
+ /**
302
+ * When the thread was created (ISO 8601)
303
+ */
304
+ createdAt: string;
305
+
306
+ /**
307
+ * Project this thread belongs to
308
+ */
309
+ projectId: string;
310
+
311
+ /**
312
+ * Current run status: idle (no run), waiting (run started, awaiting content),
313
+ * streaming (receiving content)
314
+ */
315
+ runStatus: 'idle' | 'waiting' | 'streaming';
316
+
317
+ /**
318
+ * When the thread was last updated (ISO 8601)
319
+ */
320
+ updatedAt: string;
321
+
322
+ /**
323
+ * Optional context key for thread organization
324
+ */
325
+ contextKey?: string;
326
+
327
+ /**
328
+ * ID of the currently active run (when not idle)
329
+ */
330
+ currentRunId?: string;
331
+
332
+ /**
333
+ * ID of the last completed run. Required as previousRunId when continuing after
334
+ * tool calls.
335
+ */
336
+ lastCompletedRunId?: string;
337
+
338
+ /**
339
+ * Whether the last run was cancelled
340
+ */
341
+ lastRunCancelled?: boolean;
342
+
343
+ /**
344
+ * Error information from the last run
345
+ */
346
+ lastRunError?: ThreadsAPI.RunError;
347
+
348
+ /**
349
+ * Additional metadata
350
+ */
351
+ metadata?: unknown;
352
+
353
+ /**
354
+ * Tool call IDs awaiting client-side results. If non-empty, next run must provide
355
+ * tool_result content with previousRunId set.
356
+ */
357
+ pendingToolCallIds?: Array<string>;
358
+
359
+ /**
360
+ * Human-readable status message (e.g., 'Fetching weather data...')
361
+ */
362
+ statusMessage?: string;
363
+ }
364
+ }
365
+
366
+ export interface ThreadCreateParams {
367
+ /**
368
+ * Optional context key for thread organization
369
+ */
370
+ contextKey?: string;
371
+
372
+ /**
373
+ * Initial messages to seed the thread with
374
+ */
375
+ initialMessages?: Array<RunsAPI.InputMessage>;
376
+
377
+ /**
378
+ * Additional metadata to attach to the thread
379
+ */
380
+ metadata?: unknown;
381
+ }
382
+
383
+ export interface ThreadListParams {
384
+ /**
385
+ * Filter by context key
386
+ */
387
+ contextKey?: string;
388
+
389
+ /**
390
+ * Cursor for pagination
391
+ */
392
+ cursor?: string;
393
+
394
+ /**
395
+ * Maximum number of threads to return
396
+ */
397
+ limit?: string;
398
+ }
399
+
400
+ Threads.Messages = Messages;
401
+ Threads.Runs = Runs;
402
+
403
+ export declare namespace Threads {
404
+ export {
405
+ type RunError as RunError,
406
+ type ThreadCreateResponse as ThreadCreateResponse,
407
+ type ThreadRetrieveResponse as ThreadRetrieveResponse,
408
+ type ThreadListResponse as ThreadListResponse,
409
+ type ThreadCreateParams as ThreadCreateParams,
410
+ type ThreadListParams as ThreadListParams,
411
+ };
412
+
413
+ export {
414
+ Messages as Messages,
415
+ type MessageListResponse as MessageListResponse,
416
+ type MessageGetResponse as MessageGetResponse,
417
+ type MessageListParams as MessageListParams,
418
+ type MessageGetParams as MessageGetParams,
419
+ };
420
+
421
+ export {
422
+ Runs as Runs,
423
+ type InputMessage as InputMessage,
424
+ type RunDeleteResponse as RunDeleteResponse,
425
+ type RunCreateParams as RunCreateParams,
426
+ type RunDeleteParams as RunDeleteParams,
427
+ type RunRunParams as RunRunParams,
428
+ };
429
+ }
@@ -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.82.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.82.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.82.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.82.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.82.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map