@tambo-ai/typescript-sdk 0.85.0 → 0.87.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 (54) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/bin/migration-config.json +37 -0
  3. package/client.d.mts +2 -2
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +2 -2
  6. package/client.d.ts.map +1 -1
  7. package/client.js.map +1 -1
  8. package/client.mjs.map +1 -1
  9. package/package.json +1 -1
  10. package/resources/index.d.mts +1 -1
  11. package/resources/index.d.mts.map +1 -1
  12. package/resources/index.d.ts +1 -1
  13. package/resources/index.d.ts.map +1 -1
  14. package/resources/index.js.map +1 -1
  15. package/resources/index.mjs.map +1 -1
  16. package/resources/threads/index.d.mts +2 -1
  17. package/resources/threads/index.d.mts.map +1 -1
  18. package/resources/threads/index.d.ts +2 -1
  19. package/resources/threads/index.d.ts.map +1 -1
  20. package/resources/threads/index.js +3 -1
  21. package/resources/threads/index.js.map +1 -1
  22. package/resources/threads/index.mjs +1 -0
  23. package/resources/threads/index.mjs.map +1 -1
  24. package/resources/threads/runs.d.mts +12 -4
  25. package/resources/threads/runs.d.mts.map +1 -1
  26. package/resources/threads/runs.d.ts +12 -4
  27. package/resources/threads/runs.d.ts.map +1 -1
  28. package/resources/threads/state.d.mts +62 -0
  29. package/resources/threads/state.d.mts.map +1 -0
  30. package/resources/threads/state.d.ts +62 -0
  31. package/resources/threads/state.d.ts.map +1 -0
  32. package/resources/threads/state.js +29 -0
  33. package/resources/threads/state.js.map +1 -0
  34. package/resources/threads/state.mjs +25 -0
  35. package/resources/threads/state.mjs.map +1 -0
  36. package/resources/threads/threads.d.mts +32 -22
  37. package/resources/threads/threads.d.mts.map +1 -1
  38. package/resources/threads/threads.d.ts +32 -22
  39. package/resources/threads/threads.d.ts.map +1 -1
  40. package/resources/threads/threads.js +7 -3
  41. package/resources/threads/threads.js.map +1 -1
  42. package/resources/threads/threads.mjs +7 -3
  43. package/resources/threads/threads.mjs.map +1 -1
  44. package/src/client.ts +2 -0
  45. package/src/resources/index.ts +1 -0
  46. package/src/resources/threads/index.ts +2 -0
  47. package/src/resources/threads/runs.ts +15 -5
  48. package/src/resources/threads/state.ts +87 -0
  49. package/src/resources/threads/threads.ts +48 -26
  50. package/src/version.ts +1 -1
  51. package/version.d.mts +1 -1
  52. package/version.d.ts +1 -1
  53. package/version.js +1 -1
  54. package/version.mjs +1 -1
@@ -17,6 +17,7 @@ export {
17
17
  type RunDeleteParams,
18
18
  type RunRunParams,
19
19
  } from './runs';
20
+ export { State, type StateUpdateStateResponse, type StateUpdateStateParams } from './state';
20
21
  export {
21
22
  Threads,
22
23
  type ComponentContent,
@@ -29,5 +30,6 @@ export {
29
30
  type ThreadRetrieveResponse,
30
31
  type ThreadListResponse,
31
32
  type ThreadCreateParams,
33
+ type ThreadRetrieveParams,
32
34
  type ThreadListParams,
33
35
  } from './threads';
@@ -188,6 +188,11 @@ export interface RunCreateParams {
188
188
  * Client-side tools the model can call
189
189
  */
190
190
  tools?: Array<RunCreateParams.Tool>;
191
+
192
+ /**
193
+ * Optional user key for thread organization
194
+ */
195
+ userKey?: string;
191
196
  }
192
197
 
193
198
  export namespace RunCreateParams {
@@ -217,11 +222,6 @@ export namespace RunCreateParams {
217
222
  * Thread configuration
218
223
  */
219
224
  export interface Thread {
220
- /**
221
- * Optional context key for thread organization
222
- */
223
- contextKey?: string;
224
-
225
225
  /**
226
226
  * Initial messages to seed the thread with
227
227
  */
@@ -231,6 +231,11 @@ export namespace RunCreateParams {
231
231
  * Additional metadata to attach to the thread
232
232
  */
233
233
  metadata?: unknown;
234
+
235
+ /**
236
+ * Optional user key for thread organization
237
+ */
238
+ userKey?: string;
234
239
  }
235
240
 
236
241
  export interface Name {
@@ -318,6 +323,11 @@ export interface RunRunParams {
318
323
  * Client-side tools the model can call
319
324
  */
320
325
  tools?: Array<RunRunParams.Tool>;
326
+
327
+ /**
328
+ * Optional user key for thread organization
329
+ */
330
+ userKey?: string;
321
331
  }
322
332
 
323
333
  export namespace RunRunParams {
@@ -0,0 +1,87 @@
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
+ import { path } from '../../internal/utils/path';
7
+
8
+ export class State extends APIResource {
9
+ /**
10
+ * Update the state of a component in a thread. Supports both full replacement and
11
+ * JSON Patch operations. Thread must not have an active run.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * const response = await client.threads.state.updateState(
16
+ * 'comp_xyz789abc',
17
+ * { threadId: 'thr_abc123xyz' },
18
+ * );
19
+ * ```
20
+ */
21
+ updateState(
22
+ componentID: string,
23
+ params: StateUpdateStateParams,
24
+ options?: RequestOptions,
25
+ ): APIPromise<StateUpdateStateResponse> {
26
+ const { threadId, ...body } = params;
27
+ return this._client.post(path`/v1/threads/${threadId}/components/${componentID}/state`, {
28
+ body,
29
+ ...options,
30
+ });
31
+ }
32
+ }
33
+
34
+ export interface StateUpdateStateResponse {
35
+ /**
36
+ * New complete state of the component
37
+ */
38
+ state: unknown;
39
+ }
40
+
41
+ export interface StateUpdateStateParams {
42
+ /**
43
+ * Path param: Thread ID
44
+ */
45
+ threadId: string;
46
+
47
+ /**
48
+ * Body param: JSON Patch operations to apply to current state
49
+ */
50
+ patch?: Array<StateUpdateStateParams.Patch>;
51
+
52
+ /**
53
+ * Body param: Full replacement state object
54
+ */
55
+ state?: unknown;
56
+ }
57
+
58
+ export namespace StateUpdateStateParams {
59
+ export interface Patch {
60
+ /**
61
+ * Operation type
62
+ */
63
+ op: 'add' | 'remove' | 'replace' | 'move' | 'copy' | 'test';
64
+
65
+ /**
66
+ * JSON Pointer path to the target location
67
+ */
68
+ path: string;
69
+
70
+ /**
71
+ * Source path for move and copy operations
72
+ */
73
+ from?: string;
74
+
75
+ /**
76
+ * Value to add, replace, or test (required for add, replace, test)
77
+ */
78
+ value?: unknown;
79
+ }
80
+ }
81
+
82
+ export declare namespace State {
83
+ export {
84
+ type StateUpdateStateResponse as StateUpdateStateResponse,
85
+ type StateUpdateStateParams as StateUpdateStateParams,
86
+ };
87
+ }
@@ -22,12 +22,15 @@ import {
22
22
  RunRunResponse,
23
23
  Runs,
24
24
  } from './runs';
25
+ import * as StateAPI from './state';
26
+ import { State, StateUpdateStateParams, StateUpdateStateResponse } from './state';
25
27
  import { APIPromise } from '../../core/api-promise';
26
28
  import { buildHeaders } from '../../internal/headers';
27
29
  import { RequestOptions } from '../../internal/request-options';
28
30
  import { path } from '../../internal/utils/path';
29
31
 
30
32
  export class Threads extends APIResource {
33
+ state: StateAPI.State = new StateAPI.State(this._client);
31
34
  messages: MessagesAPI.Messages = new MessagesAPI.Messages(this._client);
32
35
  runs: RunsAPI.Runs = new RunsAPI.Runs(this._client);
33
36
 
@@ -55,13 +58,17 @@ export class Threads extends APIResource {
55
58
  * );
56
59
  * ```
57
60
  */
58
- retrieve(threadID: string, options?: RequestOptions): APIPromise<ThreadRetrieveResponse> {
59
- return this._client.get(path`/v1/threads/${threadID}`, options);
61
+ retrieve(
62
+ threadID: string,
63
+ query: ThreadRetrieveParams | null | undefined = {},
64
+ options?: RequestOptions,
65
+ ): APIPromise<ThreadRetrieveResponse> {
66
+ return this._client.get(path`/v1/threads/${threadID}`, { query, ...options });
60
67
  }
61
68
 
62
69
  /**
63
70
  * List all threads for the authenticated project. Supports cursor-based pagination
64
- * and filtering by context key.
71
+ * and filtering by user key.
65
72
  *
66
73
  * @example
67
74
  * ```ts
@@ -220,11 +227,6 @@ export interface ThreadCreateResponse {
220
227
  */
221
228
  updatedAt: string;
222
229
 
223
- /**
224
- * Optional context key for thread organization
225
- */
226
- contextKey?: string;
227
-
228
230
  /**
229
231
  * ID of the currently active run (when not idle)
230
232
  */
@@ -261,6 +263,11 @@ export interface ThreadCreateResponse {
261
263
  * Human-readable status message (e.g., 'Fetching weather data...')
262
264
  */
263
265
  statusMessage?: string;
266
+
267
+ /**
268
+ * Optional user key for thread organization
269
+ */
270
+ userKey?: string;
264
271
  }
265
272
 
266
273
  export interface ThreadRetrieveResponse {
@@ -290,11 +297,6 @@ export interface ThreadRetrieveResponse {
290
297
  */
291
298
  updatedAt: string;
292
299
 
293
- /**
294
- * Optional context key for thread organization
295
- */
296
- contextKey?: string;
297
-
298
300
  /**
299
301
  * ID of the currently active run (when not idle)
300
302
  */
@@ -331,6 +333,11 @@ export interface ThreadRetrieveResponse {
331
333
  * Human-readable status message (e.g., 'Fetching weather data...')
332
334
  */
333
335
  statusMessage?: string;
336
+
337
+ /**
338
+ * Optional user key for thread organization
339
+ */
340
+ userKey?: string;
334
341
  }
335
342
 
336
343
  export namespace ThreadRetrieveResponse {
@@ -408,11 +415,6 @@ export namespace ThreadListResponse {
408
415
  */
409
416
  updatedAt: string;
410
417
 
411
- /**
412
- * Optional context key for thread organization
413
- */
414
- contextKey?: string;
415
-
416
418
  /**
417
419
  * ID of the currently active run (when not idle)
418
420
  */
@@ -449,15 +451,15 @@ export namespace ThreadListResponse {
449
451
  * Human-readable status message (e.g., 'Fetching weather data...')
450
452
  */
451
453
  statusMessage?: string;
454
+
455
+ /**
456
+ * Optional user key for thread organization
457
+ */
458
+ userKey?: string;
452
459
  }
453
460
  }
454
461
 
455
462
  export interface ThreadCreateParams {
456
- /**
457
- * Optional context key for thread organization
458
- */
459
- contextKey?: string;
460
-
461
463
  /**
462
464
  * Initial messages to seed the thread with
463
465
  */
@@ -467,14 +469,21 @@ export interface ThreadCreateParams {
467
469
  * Additional metadata to attach to the thread
468
470
  */
469
471
  metadata?: unknown;
472
+
473
+ /**
474
+ * Optional user key for thread organization
475
+ */
476
+ userKey?: string;
470
477
  }
471
478
 
472
- export interface ThreadListParams {
479
+ export interface ThreadRetrieveParams {
473
480
  /**
474
- * Filter by context key
481
+ * Optional user key for thread organization
475
482
  */
476
- contextKey?: string;
483
+ userKey?: string;
484
+ }
477
485
 
486
+ export interface ThreadListParams {
478
487
  /**
479
488
  * Cursor for pagination
480
489
  */
@@ -484,8 +493,14 @@ export interface ThreadListParams {
484
493
  * Maximum number of threads to return
485
494
  */
486
495
  limit?: string;
496
+
497
+ /**
498
+ * Filter by user key
499
+ */
500
+ userKey?: string;
487
501
  }
488
502
 
503
+ Threads.State = State;
489
504
  Threads.Messages = Messages;
490
505
  Threads.Runs = Runs;
491
506
 
@@ -501,9 +516,16 @@ export declare namespace Threads {
501
516
  type ThreadRetrieveResponse as ThreadRetrieveResponse,
502
517
  type ThreadListResponse as ThreadListResponse,
503
518
  type ThreadCreateParams as ThreadCreateParams,
519
+ type ThreadRetrieveParams as ThreadRetrieveParams,
504
520
  type ThreadListParams as ThreadListParams,
505
521
  };
506
522
 
523
+ export {
524
+ State as State,
525
+ type StateUpdateStateResponse as StateUpdateStateResponse,
526
+ type StateUpdateStateParams as StateUpdateStateParams,
527
+ };
528
+
507
529
  export {
508
530
  Messages as Messages,
509
531
  type MessageListResponse as MessageListResponse,
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.85.0'; // x-release-please-version
1
+ export const VERSION = '0.87.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.85.0";
1
+ export declare const VERSION = "0.87.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.85.0";
1
+ export declare const VERSION = "0.87.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.85.0'; // x-release-please-version
4
+ exports.VERSION = '0.87.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.85.0'; // x-release-please-version
1
+ export const VERSION = '0.87.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map