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