@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,148 @@
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 Messages extends APIResource {
9
+ /**
10
+ * List messages in a thread. Supports cursor-based pagination and ordering.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const messages = await client.threads.messages.list(
15
+ * 'thr_abc123xyz',
16
+ * );
17
+ * ```
18
+ */
19
+ list(
20
+ threadID: string,
21
+ query: MessageListParams | null | undefined = {},
22
+ options?: RequestOptions,
23
+ ): APIPromise<MessageListResponse> {
24
+ return this._client.get(path`/v1/threads/${threadID}/messages`, { query, ...options });
25
+ }
26
+
27
+ /**
28
+ * Get a specific message by ID from a thread.
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * const message = await client.threads.messages.get(
33
+ * 'msg_xyz789abc',
34
+ * { threadId: 'thr_abc123xyz' },
35
+ * );
36
+ * ```
37
+ */
38
+ get(messageID: string, params: MessageGetParams, options?: RequestOptions): APIPromise<MessageGetResponse> {
39
+ const { threadId } = params;
40
+ return this._client.get(path`/v1/threads/${threadId}/messages/${messageID}`, options);
41
+ }
42
+ }
43
+
44
+ export interface MessageListResponse {
45
+ /**
46
+ * Whether there are more results
47
+ */
48
+ hasMore: boolean;
49
+
50
+ /**
51
+ * List of messages in the thread
52
+ */
53
+ messages: Array<MessageListResponse.Message>;
54
+
55
+ /**
56
+ * Cursor for the next page of results
57
+ */
58
+ nextCursor?: string;
59
+ }
60
+
61
+ export namespace MessageListResponse {
62
+ export interface Message {
63
+ /**
64
+ * Unique identifier for this message
65
+ */
66
+ id: string;
67
+
68
+ /**
69
+ * Content blocks in this message
70
+ */
71
+ content: Array<unknown>;
72
+
73
+ /**
74
+ * Message role
75
+ */
76
+ role: 'user' | 'assistant' | 'system';
77
+
78
+ /**
79
+ * When the message was created (ISO 8601)
80
+ */
81
+ createdAt?: string;
82
+
83
+ /**
84
+ * Additional metadata
85
+ */
86
+ metadata?: unknown;
87
+ }
88
+ }
89
+
90
+ export interface MessageGetResponse {
91
+ /**
92
+ * Unique identifier for this message
93
+ */
94
+ id: string;
95
+
96
+ /**
97
+ * Content blocks in this message
98
+ */
99
+ content: Array<unknown>;
100
+
101
+ /**
102
+ * Message role
103
+ */
104
+ role: 'user' | 'assistant' | 'system';
105
+
106
+ /**
107
+ * When the message was created (ISO 8601)
108
+ */
109
+ createdAt?: string;
110
+
111
+ /**
112
+ * Additional metadata
113
+ */
114
+ metadata?: unknown;
115
+ }
116
+
117
+ export interface MessageListParams {
118
+ /**
119
+ * Cursor for pagination
120
+ */
121
+ cursor?: string;
122
+
123
+ /**
124
+ * Maximum number of messages to return
125
+ */
126
+ limit?: string;
127
+
128
+ /**
129
+ * Sort order: 'asc' for oldest first, 'desc' for newest first
130
+ */
131
+ order?: 'asc' | 'desc';
132
+ }
133
+
134
+ export interface MessageGetParams {
135
+ /**
136
+ * Thread ID
137
+ */
138
+ threadId: string;
139
+ }
140
+
141
+ export declare namespace Messages {
142
+ export {
143
+ type MessageListResponse as MessageListResponse,
144
+ type MessageGetResponse as MessageGetResponse,
145
+ type MessageListParams as MessageListParams,
146
+ type MessageGetParams as MessageGetParams,
147
+ };
148
+ }
@@ -0,0 +1,347 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import * as RunsAPI from './runs';
5
+ import { APIPromise } from '../../core/api-promise';
6
+ import { buildHeaders } from '../../internal/headers';
7
+ import { RequestOptions } from '../../internal/request-options';
8
+ import { path } from '../../internal/utils/path';
9
+
10
+ export class Runs extends APIResource {
11
+ /**
12
+ * Creates a new thread and immediately starts a streaming run. Returns an SSE
13
+ * stream of AG-UI events.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * await client.threads.runs.create({
18
+ * message: { content: [{}], role: 'user' },
19
+ * });
20
+ * ```
21
+ */
22
+ create(body: RunCreateParams, options?: RequestOptions): APIPromise<void> {
23
+ return this._client.post('/v1/threads/runs', {
24
+ body,
25
+ ...options,
26
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
27
+ });
28
+ }
29
+
30
+ /**
31
+ * Explicitly cancel a running run. Note: closing the SSE connection also cancels
32
+ * the run.
33
+ *
34
+ * @example
35
+ * ```ts
36
+ * const run = await client.threads.runs.delete(
37
+ * 'run_xyz789abc',
38
+ * { threadId: 'thr_abc123xyz' },
39
+ * );
40
+ * ```
41
+ */
42
+ delete(runID: string, params: RunDeleteParams, options?: RequestOptions): APIPromise<RunDeleteResponse> {
43
+ const { threadId } = params;
44
+ return this._client.delete(path`/v1/threads/${threadId}/runs/${runID}`, options);
45
+ }
46
+
47
+ /**
48
+ * Starts a streaming run on an existing thread. Returns an SSE stream of AG-UI
49
+ * events.
50
+ *
51
+ * @example
52
+ * ```ts
53
+ * await client.threads.runs.run('thr_abc123xyz', {
54
+ * message: { content: [{}], role: 'user' },
55
+ * });
56
+ * ```
57
+ */
58
+ run(threadID: string, body: RunRunParams, options?: RequestOptions): APIPromise<void> {
59
+ return this._client.post(path`/v1/threads/${threadID}/runs`, {
60
+ body,
61
+ ...options,
62
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
63
+ });
64
+ }
65
+ }
66
+
67
+ export interface InputMessage {
68
+ /**
69
+ * Content blocks (text, resource, or tool_result)
70
+ */
71
+ content: Array<unknown>;
72
+
73
+ /**
74
+ * Message role - must be 'user' for input messages
75
+ */
76
+ role: 'user';
77
+
78
+ /**
79
+ * Additional metadata to attach to the message
80
+ */
81
+ metadata?: unknown;
82
+ }
83
+
84
+ export interface RunDeleteResponse {
85
+ /**
86
+ * The run ID that was cancelled
87
+ */
88
+ runId: string;
89
+
90
+ /**
91
+ * New status after cancellation (always 'cancelled')
92
+ */
93
+ status: 'cancelled';
94
+ }
95
+
96
+ export interface RunCreateParams {
97
+ /**
98
+ * The user's message
99
+ */
100
+ message: InputMessage;
101
+
102
+ /**
103
+ * Available UI components the model can render
104
+ */
105
+ availableComponents?: Array<RunCreateParams.AvailableComponent>;
106
+
107
+ /**
108
+ * Maximum tokens to generate
109
+ */
110
+ maxTokens?: number;
111
+
112
+ /**
113
+ * Override the default model
114
+ */
115
+ model?: string;
116
+
117
+ /**
118
+ * ID of the previous run. Required when continuing a thread that already has
119
+ * messages.
120
+ */
121
+ previousRunId?: string;
122
+
123
+ /**
124
+ * Metadata for the run
125
+ */
126
+ runMetadata?: unknown;
127
+
128
+ /**
129
+ * Temperature for generation (0-2)
130
+ */
131
+ temperature?: number;
132
+
133
+ /**
134
+ * Thread configuration
135
+ */
136
+ thread?: RunCreateParams.Thread;
137
+
138
+ /**
139
+ * Metadata for the thread
140
+ */
141
+ threadMetadata?: unknown;
142
+
143
+ /**
144
+ * How the model should use tools
145
+ */
146
+ toolChoice?: 'auto' | 'required' | 'none' | RunCreateParams.Name;
147
+
148
+ /**
149
+ * Client-side tools the model can call
150
+ */
151
+ tools?: Array<RunCreateParams.Tool>;
152
+ }
153
+
154
+ export namespace RunCreateParams {
155
+ export interface AvailableComponent {
156
+ /**
157
+ * Description of what this component displays
158
+ */
159
+ description: string;
160
+
161
+ /**
162
+ * Component name (e.g., 'StockChart')
163
+ */
164
+ name: string;
165
+
166
+ /**
167
+ * JSON Schema for component props
168
+ */
169
+ propsSchema: unknown;
170
+
171
+ /**
172
+ * Optional JSON Schema for component state
173
+ */
174
+ stateSchema?: unknown;
175
+ }
176
+
177
+ /**
178
+ * Thread configuration
179
+ */
180
+ export interface Thread {
181
+ /**
182
+ * Optional context key for thread organization
183
+ */
184
+ contextKey?: string;
185
+
186
+ /**
187
+ * Initial messages to seed the thread with
188
+ */
189
+ initialMessages?: Array<RunsAPI.InputMessage>;
190
+
191
+ /**
192
+ * Additional metadata to attach to the thread
193
+ */
194
+ metadata?: unknown;
195
+ }
196
+
197
+ export interface Name {
198
+ name?: string;
199
+ }
200
+
201
+ export interface Tool {
202
+ /**
203
+ * Description of what the tool does
204
+ */
205
+ description: string;
206
+
207
+ /**
208
+ * JSON Schema for the tool's input parameters
209
+ */
210
+ inputSchema: unknown;
211
+
212
+ /**
213
+ * Unique tool name (a-z, A-Z, 0-9, \_, -)
214
+ */
215
+ name: string;
216
+
217
+ /**
218
+ * Optional JSON Schema for structured output
219
+ */
220
+ outputSchema?: unknown;
221
+
222
+ /**
223
+ * Enable strict schema validation (OpenAI feature)
224
+ */
225
+ strict?: boolean;
226
+ }
227
+ }
228
+
229
+ export interface RunDeleteParams {
230
+ /**
231
+ * Thread ID
232
+ */
233
+ threadId: string;
234
+ }
235
+
236
+ export interface RunRunParams {
237
+ /**
238
+ * The user's message
239
+ */
240
+ message: InputMessage;
241
+
242
+ /**
243
+ * Available UI components the model can render
244
+ */
245
+ availableComponents?: Array<RunRunParams.AvailableComponent>;
246
+
247
+ /**
248
+ * Maximum tokens to generate
249
+ */
250
+ maxTokens?: number;
251
+
252
+ /**
253
+ * Override the default model
254
+ */
255
+ model?: string;
256
+
257
+ /**
258
+ * ID of the previous run. Required when continuing a thread that already has
259
+ * messages.
260
+ */
261
+ previousRunId?: string;
262
+
263
+ /**
264
+ * Metadata for the run
265
+ */
266
+ runMetadata?: unknown;
267
+
268
+ /**
269
+ * Temperature for generation (0-2)
270
+ */
271
+ temperature?: number;
272
+
273
+ /**
274
+ * How the model should use tools
275
+ */
276
+ toolChoice?: 'auto' | 'required' | 'none' | RunRunParams.Name;
277
+
278
+ /**
279
+ * Client-side tools the model can call
280
+ */
281
+ tools?: Array<RunRunParams.Tool>;
282
+ }
283
+
284
+ export namespace RunRunParams {
285
+ export interface AvailableComponent {
286
+ /**
287
+ * Description of what this component displays
288
+ */
289
+ description: string;
290
+
291
+ /**
292
+ * Component name (e.g., 'StockChart')
293
+ */
294
+ name: string;
295
+
296
+ /**
297
+ * JSON Schema for component props
298
+ */
299
+ propsSchema: unknown;
300
+
301
+ /**
302
+ * Optional JSON Schema for component state
303
+ */
304
+ stateSchema?: unknown;
305
+ }
306
+
307
+ export interface Name {
308
+ name?: string;
309
+ }
310
+
311
+ export interface Tool {
312
+ /**
313
+ * Description of what the tool does
314
+ */
315
+ description: string;
316
+
317
+ /**
318
+ * JSON Schema for the tool's input parameters
319
+ */
320
+ inputSchema: unknown;
321
+
322
+ /**
323
+ * Unique tool name (a-z, A-Z, 0-9, \_, -)
324
+ */
325
+ name: string;
326
+
327
+ /**
328
+ * Optional JSON Schema for structured output
329
+ */
330
+ outputSchema?: unknown;
331
+
332
+ /**
333
+ * Enable strict schema validation (OpenAI feature)
334
+ */
335
+ strict?: boolean;
336
+ }
337
+ }
338
+
339
+ export declare namespace Runs {
340
+ export {
341
+ type InputMessage as InputMessage,
342
+ type RunDeleteResponse as RunDeleteResponse,
343
+ type RunCreateParams as RunCreateParams,
344
+ type RunDeleteParams as RunDeleteParams,
345
+ type RunRunParams as RunRunParams,
346
+ };
347
+ }