@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,277 @@
1
+ import { APIResource } from "../../core/resource.js";
2
+ import * as RunsAPI from "./runs.js";
3
+ import * as ThreadsAPI from "./threads.js";
4
+ import { APIPromise } from "../../core/api-promise.js";
5
+ import { RequestOptions } from "../../internal/request-options.js";
6
+ export declare class Runs extends APIResource {
7
+ /**
8
+ * Creates a new thread and immediately starts a streaming run. Returns an SSE
9
+ * stream of AG-UI events.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * await client.threads.runs.create({
14
+ * message: {
15
+ * content: [{ text: 'Hello, world!', type: 'text' }],
16
+ * role: 'user',
17
+ * },
18
+ * });
19
+ * ```
20
+ */
21
+ create(body: RunCreateParams, options?: RequestOptions): APIPromise<void>;
22
+ /**
23
+ * Explicitly cancel a running run. Note: closing the SSE connection also cancels
24
+ * the run.
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * const run = await client.threads.runs.delete(
29
+ * 'run_xyz789abc',
30
+ * { threadId: 'thr_abc123xyz' },
31
+ * );
32
+ * ```
33
+ */
34
+ delete(runID: string, params: RunDeleteParams, options?: RequestOptions): APIPromise<RunDeleteResponse>;
35
+ /**
36
+ * Starts a streaming run on an existing thread. Returns an SSE stream of AG-UI
37
+ * events.
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * await client.threads.runs.run('thr_abc123xyz', {
42
+ * message: {
43
+ * content: [{ text: 'Hello, world!', type: 'text' }],
44
+ * role: 'user',
45
+ * },
46
+ * });
47
+ * ```
48
+ */
49
+ run(threadID: string, body: RunRunParams, options?: RequestOptions): APIPromise<void>;
50
+ }
51
+ export interface InputMessage {
52
+ /**
53
+ * Content blocks (text, resource, or tool_result)
54
+ */
55
+ content: Array<ThreadsAPI.TextContent | ThreadsAPI.ResourceContent | ThreadsAPI.ToolResultContent>;
56
+ /**
57
+ * Message role - must be 'user' for input messages
58
+ */
59
+ role: 'user';
60
+ /**
61
+ * Additional metadata to attach to the message
62
+ */
63
+ metadata?: unknown;
64
+ }
65
+ export interface RunDeleteResponse {
66
+ /**
67
+ * The run ID that was cancelled
68
+ */
69
+ runId: string;
70
+ /**
71
+ * New status after cancellation (always 'cancelled')
72
+ */
73
+ status: 'cancelled';
74
+ }
75
+ export interface RunCreateParams {
76
+ /**
77
+ * The user's message
78
+ */
79
+ message: InputMessage;
80
+ /**
81
+ * Available UI components the model can render
82
+ */
83
+ availableComponents?: Array<RunCreateParams.AvailableComponent>;
84
+ /**
85
+ * Maximum tokens to generate
86
+ */
87
+ maxTokens?: number;
88
+ /**
89
+ * Override the default model
90
+ */
91
+ model?: string;
92
+ /**
93
+ * ID of the previous run. Required when continuing a thread that already has
94
+ * messages.
95
+ */
96
+ previousRunId?: string;
97
+ /**
98
+ * Metadata for the run
99
+ */
100
+ runMetadata?: unknown;
101
+ /**
102
+ * Temperature for generation (0-2)
103
+ */
104
+ temperature?: number;
105
+ /**
106
+ * Thread configuration
107
+ */
108
+ thread?: RunCreateParams.Thread;
109
+ /**
110
+ * Metadata for the thread
111
+ */
112
+ threadMetadata?: unknown;
113
+ /**
114
+ * How the model should use tools
115
+ */
116
+ toolChoice?: 'auto' | 'required' | 'none' | RunCreateParams.Name;
117
+ /**
118
+ * Client-side tools the model can call
119
+ */
120
+ tools?: Array<RunCreateParams.Tool>;
121
+ }
122
+ export declare namespace RunCreateParams {
123
+ interface AvailableComponent {
124
+ /**
125
+ * Description of what this component displays
126
+ */
127
+ description: string;
128
+ /**
129
+ * Component name (e.g., 'StockChart')
130
+ */
131
+ name: string;
132
+ /**
133
+ * JSON Schema for component props
134
+ */
135
+ propsSchema: unknown;
136
+ /**
137
+ * Optional JSON Schema for component state
138
+ */
139
+ stateSchema?: unknown;
140
+ }
141
+ /**
142
+ * Thread configuration
143
+ */
144
+ interface Thread {
145
+ /**
146
+ * Optional context key for thread organization
147
+ */
148
+ contextKey?: string;
149
+ /**
150
+ * Initial messages to seed the thread with
151
+ */
152
+ initialMessages?: Array<RunsAPI.InputMessage>;
153
+ /**
154
+ * Additional metadata to attach to the thread
155
+ */
156
+ metadata?: unknown;
157
+ }
158
+ interface Name {
159
+ name?: string;
160
+ }
161
+ interface Tool {
162
+ /**
163
+ * Description of what the tool does
164
+ */
165
+ description: string;
166
+ /**
167
+ * JSON Schema for the tool's input parameters
168
+ */
169
+ inputSchema: unknown;
170
+ /**
171
+ * Unique tool name (a-z, A-Z, 0-9, \_, -)
172
+ */
173
+ name: string;
174
+ /**
175
+ * Optional JSON Schema for structured output
176
+ */
177
+ outputSchema?: unknown;
178
+ /**
179
+ * Enable strict schema validation (OpenAI feature)
180
+ */
181
+ strict?: boolean;
182
+ }
183
+ }
184
+ export interface RunDeleteParams {
185
+ /**
186
+ * Thread ID
187
+ */
188
+ threadId: string;
189
+ }
190
+ export interface RunRunParams {
191
+ /**
192
+ * The user's message
193
+ */
194
+ message: InputMessage;
195
+ /**
196
+ * Available UI components the model can render
197
+ */
198
+ availableComponents?: Array<RunRunParams.AvailableComponent>;
199
+ /**
200
+ * Maximum tokens to generate
201
+ */
202
+ maxTokens?: number;
203
+ /**
204
+ * Override the default model
205
+ */
206
+ model?: string;
207
+ /**
208
+ * ID of the previous run. Required when continuing a thread that already has
209
+ * messages.
210
+ */
211
+ previousRunId?: string;
212
+ /**
213
+ * Metadata for the run
214
+ */
215
+ runMetadata?: unknown;
216
+ /**
217
+ * Temperature for generation (0-2)
218
+ */
219
+ temperature?: number;
220
+ /**
221
+ * How the model should use tools
222
+ */
223
+ toolChoice?: 'auto' | 'required' | 'none' | RunRunParams.Name;
224
+ /**
225
+ * Client-side tools the model can call
226
+ */
227
+ tools?: Array<RunRunParams.Tool>;
228
+ }
229
+ export declare namespace RunRunParams {
230
+ interface AvailableComponent {
231
+ /**
232
+ * Description of what this component displays
233
+ */
234
+ description: string;
235
+ /**
236
+ * Component name (e.g., 'StockChart')
237
+ */
238
+ name: string;
239
+ /**
240
+ * JSON Schema for component props
241
+ */
242
+ propsSchema: unknown;
243
+ /**
244
+ * Optional JSON Schema for component state
245
+ */
246
+ stateSchema?: unknown;
247
+ }
248
+ interface Name {
249
+ name?: string;
250
+ }
251
+ interface Tool {
252
+ /**
253
+ * Description of what the tool does
254
+ */
255
+ description: string;
256
+ /**
257
+ * JSON Schema for the tool's input parameters
258
+ */
259
+ inputSchema: unknown;
260
+ /**
261
+ * Unique tool name (a-z, A-Z, 0-9, \_, -)
262
+ */
263
+ name: string;
264
+ /**
265
+ * Optional JSON Schema for structured output
266
+ */
267
+ outputSchema?: unknown;
268
+ /**
269
+ * Enable strict schema validation (OpenAI feature)
270
+ */
271
+ strict?: boolean;
272
+ }
273
+ }
274
+ export declare namespace Runs {
275
+ export { type InputMessage as InputMessage, type RunDeleteResponse as RunDeleteResponse, type RunCreateParams as RunCreateParams, type RunDeleteParams as RunDeleteParams, type RunRunParams as RunRunParams, };
276
+ }
277
+ //# sourceMappingURL=runs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runs.d.ts","sourceRoot":"","sources":["../../src/resources/threads/runs.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,OAAO;OACZ,KAAK,UAAU;OACf,EAAE,UAAU,EAAE;OAEd,EAAE,cAAc,EAAE;AAGzB,qBAAa,IAAK,SAAQ,WAAW;IACnC;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,IAAI,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;IAQzE;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,iBAAiB,CAAC;IAKvG;;;;;;;;;;;;;OAaG;IACH,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;CAOtF;AAED,M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B,YAAY,CAAC;IAC5B,UAAiB,kBAAkB;QACjC;;WAEG;QACH,WAAW,EAAE,MAAM,CAAC;QAEpB;;WAEG;QACH,IAAI,EAAE,MAAM,CAAC;QAEb;;WAEG;QACH,WAAW,EAAE,OAAO,CAAC;QAErB;;WAEG;QACH,WAAW,CAAC,EAAE,OAAO,CAAC;KACvB;IAED,UAAiB,IAAI;QACnB,IAAI,CAAC,EAAE,MAAM,CAAC;KACf;IAED,UAAiB,IAAI;QACnB;;WAEG;QACH,WAAW,EAAE,MAAM,CAAC;QAEpB;;WAEG;QACH,WAAW,EAAE,OAAO,CAAC;QAErB;;WAEG;QACH,IAAI,EAAE,MAAM,CAAC;QAEb;;WAEG;QACH,YAAY,CAAC,EAAE,OAAO,CAAC;QAEvB;;WAEG;QACH,MAAM,CAAC,EAAE,OAAO,CAAC;KAClB;CACF;AAED,MAAM,CAAC,OAAO,WAAW,IAAI,CAAC;IAC5B,OAAO,EACL,KAAK,YAAY,IAAI,YAAY,EACjC,KAAK,iBAAiB,IAAI,iBAAiB,EAC3C,KAAK,eAAe,IAAI,eAAe,EACvC,KAAK,eAAe,IAAI,eAAe,EACvC,KAAK,YAAY,IAAI,YAAY,GAClC,CAAC;CACH"}
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Runs = void 0;
5
+ const resource_1 = require("../../core/resource.js");
6
+ const headers_1 = require("../../internal/headers.js");
7
+ const path_1 = require("../../internal/utils/path.js");
8
+ class Runs extends resource_1.APIResource {
9
+ /**
10
+ * Creates a new thread and immediately starts a streaming run. Returns an SSE
11
+ * stream of AG-UI events.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * await client.threads.runs.create({
16
+ * message: {
17
+ * content: [{ text: 'Hello, world!', type: 'text' }],
18
+ * role: 'user',
19
+ * },
20
+ * });
21
+ * ```
22
+ */
23
+ create(body, options) {
24
+ return this._client.post('/v1/threads/runs', {
25
+ body,
26
+ ...options,
27
+ headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
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, params, options) {
43
+ const { threadId } = params;
44
+ return this._client.delete((0, path_1.path) `/v1/threads/${threadId}/runs/${runID}`, options);
45
+ }
46
+ /**
47
+ * Starts a streaming run on an existing thread. Returns an SSE stream of AG-UI
48
+ * events.
49
+ *
50
+ * @example
51
+ * ```ts
52
+ * await client.threads.runs.run('thr_abc123xyz', {
53
+ * message: {
54
+ * content: [{ text: 'Hello, world!', type: 'text' }],
55
+ * role: 'user',
56
+ * },
57
+ * });
58
+ * ```
59
+ */
60
+ run(threadID, body, options) {
61
+ return this._client.post((0, path_1.path) `/v1/threads/${threadID}/runs`, {
62
+ body,
63
+ ...options,
64
+ headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
65
+ });
66
+ }
67
+ }
68
+ exports.Runs = Runs;
69
+ //# sourceMappingURL=runs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runs.js","sourceRoot":"","sources":["../../src/resources/threads/runs.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,qDAAkD;AAIlD,uDAAsD;AAEtD,uDAAiD;AAEjD,MAAa,IAAK,SAAQ,sBAAW;IACnC;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,IAAqB,EAAE,OAAwB;QACpD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,EAAE;YAC3C,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,KAAa,EAAE,MAAuB,EAAE,OAAwB;QACrE,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;QAC5B,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAA,WAAI,EAAA,eAAe,QAAQ,SAAS,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;IACnF,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,GAAG,CAAC,QAAgB,EAAE,IAAkB,EAAE,OAAwB;QAChE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,eAAe,QAAQ,OAAO,EAAE;YAC3D,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;CACF;AA7DD,oBA6DC"}
@@ -0,0 +1,65 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ import { APIResource } from "../../core/resource.mjs";
3
+ import { buildHeaders } from "../../internal/headers.mjs";
4
+ import { path } from "../../internal/utils/path.mjs";
5
+ export class Runs extends APIResource {
6
+ /**
7
+ * Creates a new thread and immediately starts a streaming run. Returns an SSE
8
+ * stream of AG-UI events.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * await client.threads.runs.create({
13
+ * message: {
14
+ * content: [{ text: 'Hello, world!', type: 'text' }],
15
+ * role: 'user',
16
+ * },
17
+ * });
18
+ * ```
19
+ */
20
+ create(body, options) {
21
+ return this._client.post('/v1/threads/runs', {
22
+ body,
23
+ ...options,
24
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
25
+ });
26
+ }
27
+ /**
28
+ * Explicitly cancel a running run. Note: closing the SSE connection also cancels
29
+ * the run.
30
+ *
31
+ * @example
32
+ * ```ts
33
+ * const run = await client.threads.runs.delete(
34
+ * 'run_xyz789abc',
35
+ * { threadId: 'thr_abc123xyz' },
36
+ * );
37
+ * ```
38
+ */
39
+ delete(runID, params, options) {
40
+ const { threadId } = params;
41
+ return this._client.delete(path `/v1/threads/${threadId}/runs/${runID}`, options);
42
+ }
43
+ /**
44
+ * Starts a streaming run on an existing thread. Returns an SSE stream of AG-UI
45
+ * events.
46
+ *
47
+ * @example
48
+ * ```ts
49
+ * await client.threads.runs.run('thr_abc123xyz', {
50
+ * message: {
51
+ * content: [{ text: 'Hello, world!', type: 'text' }],
52
+ * role: 'user',
53
+ * },
54
+ * });
55
+ * ```
56
+ */
57
+ run(threadID, body, options) {
58
+ return this._client.post(path `/v1/threads/${threadID}/runs`, {
59
+ body,
60
+ ...options,
61
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
62
+ });
63
+ }
64
+ }
65
+ //# sourceMappingURL=runs.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runs.mjs","sourceRoot":"","sources":["../../src/resources/threads/runs.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAIf,EAAE,YAAY,EAAE;OAEhB,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,IAAK,SAAQ,WAAW;IACnC;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,IAAqB,EAAE,OAAwB;QACpD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,EAAE;YAC3C,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,KAAa,EAAE,MAAuB,EAAE,OAAwB;QACrE,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;QAC5B,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAA,eAAe,QAAQ,SAAS,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;IACnF,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,GAAG,CAAC,QAAgB,EAAE,IAAkB,EAAE,OAAwB;QAChE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,eAAe,QAAQ,OAAO,EAAE;YAC3D,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;CACF"}