@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,312 @@
1
+ import { APIResource } from "../../core/resource.mjs";
2
+ import * as ThreadsAPI from "./threads.mjs";
3
+ import * as MessagesAPI from "./messages.mjs";
4
+ import { MessageGetParams, MessageGetResponse, MessageListParams, MessageListResponse, Messages } from "./messages.mjs";
5
+ import * as RunsAPI from "./runs.mjs";
6
+ import { InputMessage, RunCreateParams, RunDeleteParams, RunDeleteResponse, RunRunParams, Runs } from "./runs.mjs";
7
+ import { APIPromise } from "../../core/api-promise.mjs";
8
+ import { RequestOptions } from "../../internal/request-options.mjs";
9
+ export declare class Threads extends APIResource {
10
+ messages: MessagesAPI.Messages;
11
+ runs: RunsAPI.Runs;
12
+ /**
13
+ * Create a new empty thread. Note: initialMessages is not supported yet; create
14
+ * the thread first, then add messages via runs/message endpoints.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * const thread = await client.threads.create();
19
+ * ```
20
+ */
21
+ create(body: ThreadCreateParams, options?: RequestOptions): APIPromise<ThreadCreateResponse>;
22
+ /**
23
+ * Get a thread by ID with all its messages. The thread must belong to the
24
+ * authenticated project.
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * const thread = await client.threads.retrieve(
29
+ * 'thr_abc123xyz',
30
+ * );
31
+ * ```
32
+ */
33
+ retrieve(threadID: string, options?: RequestOptions): APIPromise<ThreadRetrieveResponse>;
34
+ /**
35
+ * List all threads for the authenticated project. Supports cursor-based pagination
36
+ * and filtering by context key.
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * const threads = await client.threads.list();
41
+ * ```
42
+ */
43
+ list(query?: ThreadListParams | null | undefined, options?: RequestOptions): APIPromise<ThreadListResponse>;
44
+ /**
45
+ * Delete a thread and all its messages. This action cannot be undone.
46
+ *
47
+ * @example
48
+ * ```ts
49
+ * await client.threads.delete('thr_abc123xyz');
50
+ * ```
51
+ */
52
+ delete(threadID: string, options?: RequestOptions): APIPromise<void>;
53
+ }
54
+ export interface RunError {
55
+ /**
56
+ * Error message
57
+ */
58
+ message: string;
59
+ /**
60
+ * Error code
61
+ */
62
+ code?: string;
63
+ }
64
+ export interface ThreadCreateResponse {
65
+ /**
66
+ * Unique identifier for this thread
67
+ */
68
+ id: string;
69
+ /**
70
+ * When the thread was created (ISO 8601)
71
+ */
72
+ createdAt: string;
73
+ /**
74
+ * Project this thread belongs to
75
+ */
76
+ projectId: string;
77
+ /**
78
+ * Current run status: idle (no run), waiting (run started, awaiting content),
79
+ * streaming (receiving content)
80
+ */
81
+ runStatus: 'idle' | 'waiting' | 'streaming';
82
+ /**
83
+ * When the thread was last updated (ISO 8601)
84
+ */
85
+ updatedAt: string;
86
+ /**
87
+ * Optional context key for thread organization
88
+ */
89
+ contextKey?: string;
90
+ /**
91
+ * ID of the currently active run (when not idle)
92
+ */
93
+ currentRunId?: string;
94
+ /**
95
+ * ID of the last completed run. Required as previousRunId when continuing after
96
+ * tool calls.
97
+ */
98
+ lastCompletedRunId?: string;
99
+ /**
100
+ * Whether the last run was cancelled
101
+ */
102
+ lastRunCancelled?: boolean;
103
+ /**
104
+ * Error information from the last run
105
+ */
106
+ lastRunError?: RunError;
107
+ /**
108
+ * Additional metadata
109
+ */
110
+ metadata?: unknown;
111
+ /**
112
+ * Tool call IDs awaiting client-side results. If non-empty, next run must provide
113
+ * tool_result content with previousRunId set.
114
+ */
115
+ pendingToolCallIds?: Array<string>;
116
+ /**
117
+ * Human-readable status message (e.g., 'Fetching weather data...')
118
+ */
119
+ statusMessage?: string;
120
+ }
121
+ export interface ThreadRetrieveResponse {
122
+ /**
123
+ * Unique identifier for this thread
124
+ */
125
+ id: string;
126
+ /**
127
+ * When the thread was created (ISO 8601)
128
+ */
129
+ createdAt: string;
130
+ /**
131
+ * Messages in this thread
132
+ */
133
+ messages: Array<ThreadRetrieveResponse.Message>;
134
+ /**
135
+ * Project this thread belongs to
136
+ */
137
+ projectId: string;
138
+ /**
139
+ * Current run status: idle (no run), waiting (run started, awaiting content),
140
+ * streaming (receiving content)
141
+ */
142
+ runStatus: 'idle' | 'waiting' | 'streaming';
143
+ /**
144
+ * When the thread was last updated (ISO 8601)
145
+ */
146
+ updatedAt: string;
147
+ /**
148
+ * Optional context key for thread organization
149
+ */
150
+ contextKey?: string;
151
+ /**
152
+ * ID of the currently active run (when not idle)
153
+ */
154
+ currentRunId?: string;
155
+ /**
156
+ * ID of the last completed run. Required as previousRunId when continuing after
157
+ * tool calls.
158
+ */
159
+ lastCompletedRunId?: string;
160
+ /**
161
+ * Whether the last run was cancelled
162
+ */
163
+ lastRunCancelled?: boolean;
164
+ /**
165
+ * Error information from the last run
166
+ */
167
+ lastRunError?: RunError;
168
+ /**
169
+ * Additional metadata
170
+ */
171
+ metadata?: unknown;
172
+ /**
173
+ * Tool call IDs awaiting client-side results. If non-empty, next run must provide
174
+ * tool_result content with previousRunId set.
175
+ */
176
+ pendingToolCallIds?: Array<string>;
177
+ /**
178
+ * Human-readable status message (e.g., 'Fetching weather data...')
179
+ */
180
+ statusMessage?: string;
181
+ }
182
+ export declare namespace ThreadRetrieveResponse {
183
+ interface Message {
184
+ /**
185
+ * Unique identifier for this message
186
+ */
187
+ id: string;
188
+ /**
189
+ * Content blocks in this message
190
+ */
191
+ content: Array<unknown>;
192
+ /**
193
+ * Message role
194
+ */
195
+ role: 'user' | 'assistant' | 'system';
196
+ /**
197
+ * When the message was created (ISO 8601)
198
+ */
199
+ createdAt?: string;
200
+ /**
201
+ * Additional metadata
202
+ */
203
+ metadata?: unknown;
204
+ }
205
+ }
206
+ export interface ThreadListResponse {
207
+ /**
208
+ * Whether there are more results
209
+ */
210
+ hasMore: boolean;
211
+ /**
212
+ * List of threads
213
+ */
214
+ threads: Array<ThreadListResponse.Thread>;
215
+ /**
216
+ * Cursor for the next page of results
217
+ */
218
+ nextCursor?: string;
219
+ }
220
+ export declare namespace ThreadListResponse {
221
+ interface Thread {
222
+ /**
223
+ * Unique identifier for this thread
224
+ */
225
+ id: string;
226
+ /**
227
+ * When the thread was created (ISO 8601)
228
+ */
229
+ createdAt: string;
230
+ /**
231
+ * Project this thread belongs to
232
+ */
233
+ projectId: string;
234
+ /**
235
+ * Current run status: idle (no run), waiting (run started, awaiting content),
236
+ * streaming (receiving content)
237
+ */
238
+ runStatus: 'idle' | 'waiting' | 'streaming';
239
+ /**
240
+ * When the thread was last updated (ISO 8601)
241
+ */
242
+ updatedAt: string;
243
+ /**
244
+ * Optional context key for thread organization
245
+ */
246
+ contextKey?: string;
247
+ /**
248
+ * ID of the currently active run (when not idle)
249
+ */
250
+ currentRunId?: string;
251
+ /**
252
+ * ID of the last completed run. Required as previousRunId when continuing after
253
+ * tool calls.
254
+ */
255
+ lastCompletedRunId?: string;
256
+ /**
257
+ * Whether the last run was cancelled
258
+ */
259
+ lastRunCancelled?: boolean;
260
+ /**
261
+ * Error information from the last run
262
+ */
263
+ lastRunError?: ThreadsAPI.RunError;
264
+ /**
265
+ * Additional metadata
266
+ */
267
+ metadata?: unknown;
268
+ /**
269
+ * Tool call IDs awaiting client-side results. If non-empty, next run must provide
270
+ * tool_result content with previousRunId set.
271
+ */
272
+ pendingToolCallIds?: Array<string>;
273
+ /**
274
+ * Human-readable status message (e.g., 'Fetching weather data...')
275
+ */
276
+ statusMessage?: string;
277
+ }
278
+ }
279
+ export interface ThreadCreateParams {
280
+ /**
281
+ * Optional context key for thread organization
282
+ */
283
+ contextKey?: string;
284
+ /**
285
+ * Initial messages to seed the thread with
286
+ */
287
+ initialMessages?: Array<RunsAPI.InputMessage>;
288
+ /**
289
+ * Additional metadata to attach to the thread
290
+ */
291
+ metadata?: unknown;
292
+ }
293
+ export interface ThreadListParams {
294
+ /**
295
+ * Filter by context key
296
+ */
297
+ contextKey?: string;
298
+ /**
299
+ * Cursor for pagination
300
+ */
301
+ cursor?: string;
302
+ /**
303
+ * Maximum number of threads to return
304
+ */
305
+ limit?: string;
306
+ }
307
+ export declare namespace Threads {
308
+ export { type RunError as RunError, type ThreadCreateResponse as ThreadCreateResponse, type ThreadRetrieveResponse as ThreadRetrieveResponse, type ThreadListResponse as ThreadListResponse, type ThreadCreateParams as ThreadCreateParams, type ThreadListParams as ThreadListParams, };
309
+ export { Messages as Messages, type MessageListResponse as MessageListResponse, type MessageGetResponse as MessageGetResponse, type MessageListParams as MessageListParams, type MessageGetParams as MessageGetParams, };
310
+ export { Runs as Runs, type InputMessage as InputMessage, type RunDeleteResponse as RunDeleteResponse, type RunCreateParams as RunCreateParams, type RunDeleteParams as RunDeleteParams, type RunRunParams as RunRunParams, };
311
+ }
312
+ //# sourceMappingURL=threads.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"threads.d.mts","sourceRoot":"","sources":["../../src/resources/threads/threads.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,UAAU;OACf,KAAK,WAAW;OAChB,EACL,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,QAAQ,EACT;OACM,KAAK,OAAO;OACZ,EACL,YAAY,EACZ,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,IAAI,EACL;OACM,EAAE,UAAU,EAAE;OAEd,EAAE,cAAc,EAAE;AAGzB,qBAAa,OAAQ,SAAQ,WAAW;IACtC,QAAQ,EAAE,WAAW,CAAC,QAAQ,CAA0C;IACxE,IAAI,EAAE,OAAO,CAAC,IAAI,CAAkC;IAEpD;;;;;;;;OAQG;IACH,MAAM,CAAC,IAAI,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,oBAAoB,CAAC;IAI5F;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,sBAAsB,CAAC;IAIxF;;;;;;;;OAQG;IACH,IAAI,CACF,KAAK,GAAE,gBAAgB,GAAG,IAAI,GAAG,SAAc,EAC/C,OAAO,CAAC,EAAE,cAAc,GACv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KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,iBAAiB,IAAI,iBAAiB,EAC3C,KAAK,gBAAgB,IAAI,gBAAgB,GAC1C,CAAC;IAEF,OAAO,EACL,IAAI,IAAI,IAAI,EACZ,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,312 @@
1
+ import { APIResource } from "../../core/resource.js";
2
+ import * as ThreadsAPI from "./threads.js";
3
+ import * as MessagesAPI from "./messages.js";
4
+ import { MessageGetParams, MessageGetResponse, MessageListParams, MessageListResponse, Messages } from "./messages.js";
5
+ import * as RunsAPI from "./runs.js";
6
+ import { InputMessage, RunCreateParams, RunDeleteParams, RunDeleteResponse, RunRunParams, Runs } from "./runs.js";
7
+ import { APIPromise } from "../../core/api-promise.js";
8
+ import { RequestOptions } from "../../internal/request-options.js";
9
+ export declare class Threads extends APIResource {
10
+ messages: MessagesAPI.Messages;
11
+ runs: RunsAPI.Runs;
12
+ /**
13
+ * Create a new empty thread. Note: initialMessages is not supported yet; create
14
+ * the thread first, then add messages via runs/message endpoints.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * const thread = await client.threads.create();
19
+ * ```
20
+ */
21
+ create(body: ThreadCreateParams, options?: RequestOptions): APIPromise<ThreadCreateResponse>;
22
+ /**
23
+ * Get a thread by ID with all its messages. The thread must belong to the
24
+ * authenticated project.
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * const thread = await client.threads.retrieve(
29
+ * 'thr_abc123xyz',
30
+ * );
31
+ * ```
32
+ */
33
+ retrieve(threadID: string, options?: RequestOptions): APIPromise<ThreadRetrieveResponse>;
34
+ /**
35
+ * List all threads for the authenticated project. Supports cursor-based pagination
36
+ * and filtering by context key.
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * const threads = await client.threads.list();
41
+ * ```
42
+ */
43
+ list(query?: ThreadListParams | null | undefined, options?: RequestOptions): APIPromise<ThreadListResponse>;
44
+ /**
45
+ * Delete a thread and all its messages. This action cannot be undone.
46
+ *
47
+ * @example
48
+ * ```ts
49
+ * await client.threads.delete('thr_abc123xyz');
50
+ * ```
51
+ */
52
+ delete(threadID: string, options?: RequestOptions): APIPromise<void>;
53
+ }
54
+ export interface RunError {
55
+ /**
56
+ * Error message
57
+ */
58
+ message: string;
59
+ /**
60
+ * Error code
61
+ */
62
+ code?: string;
63
+ }
64
+ export interface ThreadCreateResponse {
65
+ /**
66
+ * Unique identifier for this thread
67
+ */
68
+ id: string;
69
+ /**
70
+ * When the thread was created (ISO 8601)
71
+ */
72
+ createdAt: string;
73
+ /**
74
+ * Project this thread belongs to
75
+ */
76
+ projectId: string;
77
+ /**
78
+ * Current run status: idle (no run), waiting (run started, awaiting content),
79
+ * streaming (receiving content)
80
+ */
81
+ runStatus: 'idle' | 'waiting' | 'streaming';
82
+ /**
83
+ * When the thread was last updated (ISO 8601)
84
+ */
85
+ updatedAt: string;
86
+ /**
87
+ * Optional context key for thread organization
88
+ */
89
+ contextKey?: string;
90
+ /**
91
+ * ID of the currently active run (when not idle)
92
+ */
93
+ currentRunId?: string;
94
+ /**
95
+ * ID of the last completed run. Required as previousRunId when continuing after
96
+ * tool calls.
97
+ */
98
+ lastCompletedRunId?: string;
99
+ /**
100
+ * Whether the last run was cancelled
101
+ */
102
+ lastRunCancelled?: boolean;
103
+ /**
104
+ * Error information from the last run
105
+ */
106
+ lastRunError?: RunError;
107
+ /**
108
+ * Additional metadata
109
+ */
110
+ metadata?: unknown;
111
+ /**
112
+ * Tool call IDs awaiting client-side results. If non-empty, next run must provide
113
+ * tool_result content with previousRunId set.
114
+ */
115
+ pendingToolCallIds?: Array<string>;
116
+ /**
117
+ * Human-readable status message (e.g., 'Fetching weather data...')
118
+ */
119
+ statusMessage?: string;
120
+ }
121
+ export interface ThreadRetrieveResponse {
122
+ /**
123
+ * Unique identifier for this thread
124
+ */
125
+ id: string;
126
+ /**
127
+ * When the thread was created (ISO 8601)
128
+ */
129
+ createdAt: string;
130
+ /**
131
+ * Messages in this thread
132
+ */
133
+ messages: Array<ThreadRetrieveResponse.Message>;
134
+ /**
135
+ * Project this thread belongs to
136
+ */
137
+ projectId: string;
138
+ /**
139
+ * Current run status: idle (no run), waiting (run started, awaiting content),
140
+ * streaming (receiving content)
141
+ */
142
+ runStatus: 'idle' | 'waiting' | 'streaming';
143
+ /**
144
+ * When the thread was last updated (ISO 8601)
145
+ */
146
+ updatedAt: string;
147
+ /**
148
+ * Optional context key for thread organization
149
+ */
150
+ contextKey?: string;
151
+ /**
152
+ * ID of the currently active run (when not idle)
153
+ */
154
+ currentRunId?: string;
155
+ /**
156
+ * ID of the last completed run. Required as previousRunId when continuing after
157
+ * tool calls.
158
+ */
159
+ lastCompletedRunId?: string;
160
+ /**
161
+ * Whether the last run was cancelled
162
+ */
163
+ lastRunCancelled?: boolean;
164
+ /**
165
+ * Error information from the last run
166
+ */
167
+ lastRunError?: RunError;
168
+ /**
169
+ * Additional metadata
170
+ */
171
+ metadata?: unknown;
172
+ /**
173
+ * Tool call IDs awaiting client-side results. If non-empty, next run must provide
174
+ * tool_result content with previousRunId set.
175
+ */
176
+ pendingToolCallIds?: Array<string>;
177
+ /**
178
+ * Human-readable status message (e.g., 'Fetching weather data...')
179
+ */
180
+ statusMessage?: string;
181
+ }
182
+ export declare namespace ThreadRetrieveResponse {
183
+ interface Message {
184
+ /**
185
+ * Unique identifier for this message
186
+ */
187
+ id: string;
188
+ /**
189
+ * Content blocks in this message
190
+ */
191
+ content: Array<unknown>;
192
+ /**
193
+ * Message role
194
+ */
195
+ role: 'user' | 'assistant' | 'system';
196
+ /**
197
+ * When the message was created (ISO 8601)
198
+ */
199
+ createdAt?: string;
200
+ /**
201
+ * Additional metadata
202
+ */
203
+ metadata?: unknown;
204
+ }
205
+ }
206
+ export interface ThreadListResponse {
207
+ /**
208
+ * Whether there are more results
209
+ */
210
+ hasMore: boolean;
211
+ /**
212
+ * List of threads
213
+ */
214
+ threads: Array<ThreadListResponse.Thread>;
215
+ /**
216
+ * Cursor for the next page of results
217
+ */
218
+ nextCursor?: string;
219
+ }
220
+ export declare namespace ThreadListResponse {
221
+ interface Thread {
222
+ /**
223
+ * Unique identifier for this thread
224
+ */
225
+ id: string;
226
+ /**
227
+ * When the thread was created (ISO 8601)
228
+ */
229
+ createdAt: string;
230
+ /**
231
+ * Project this thread belongs to
232
+ */
233
+ projectId: string;
234
+ /**
235
+ * Current run status: idle (no run), waiting (run started, awaiting content),
236
+ * streaming (receiving content)
237
+ */
238
+ runStatus: 'idle' | 'waiting' | 'streaming';
239
+ /**
240
+ * When the thread was last updated (ISO 8601)
241
+ */
242
+ updatedAt: string;
243
+ /**
244
+ * Optional context key for thread organization
245
+ */
246
+ contextKey?: string;
247
+ /**
248
+ * ID of the currently active run (when not idle)
249
+ */
250
+ currentRunId?: string;
251
+ /**
252
+ * ID of the last completed run. Required as previousRunId when continuing after
253
+ * tool calls.
254
+ */
255
+ lastCompletedRunId?: string;
256
+ /**
257
+ * Whether the last run was cancelled
258
+ */
259
+ lastRunCancelled?: boolean;
260
+ /**
261
+ * Error information from the last run
262
+ */
263
+ lastRunError?: ThreadsAPI.RunError;
264
+ /**
265
+ * Additional metadata
266
+ */
267
+ metadata?: unknown;
268
+ /**
269
+ * Tool call IDs awaiting client-side results. If non-empty, next run must provide
270
+ * tool_result content with previousRunId set.
271
+ */
272
+ pendingToolCallIds?: Array<string>;
273
+ /**
274
+ * Human-readable status message (e.g., 'Fetching weather data...')
275
+ */
276
+ statusMessage?: string;
277
+ }
278
+ }
279
+ export interface ThreadCreateParams {
280
+ /**
281
+ * Optional context key for thread organization
282
+ */
283
+ contextKey?: string;
284
+ /**
285
+ * Initial messages to seed the thread with
286
+ */
287
+ initialMessages?: Array<RunsAPI.InputMessage>;
288
+ /**
289
+ * Additional metadata to attach to the thread
290
+ */
291
+ metadata?: unknown;
292
+ }
293
+ export interface ThreadListParams {
294
+ /**
295
+ * Filter by context key
296
+ */
297
+ contextKey?: string;
298
+ /**
299
+ * Cursor for pagination
300
+ */
301
+ cursor?: string;
302
+ /**
303
+ * Maximum number of threads to return
304
+ */
305
+ limit?: string;
306
+ }
307
+ export declare namespace Threads {
308
+ export { type RunError as RunError, type ThreadCreateResponse as ThreadCreateResponse, type ThreadRetrieveResponse as ThreadRetrieveResponse, type ThreadListResponse as ThreadListResponse, type ThreadCreateParams as ThreadCreateParams, type ThreadListParams as ThreadListParams, };
309
+ export { Messages as Messages, type MessageListResponse as MessageListResponse, type MessageGetResponse as MessageGetResponse, type MessageListParams as MessageListParams, type MessageGetParams as MessageGetParams, };
310
+ export { Runs as Runs, type InputMessage as InputMessage, type RunDeleteResponse as RunDeleteResponse, type RunCreateParams as RunCreateParams, type RunDeleteParams as RunDeleteParams, type RunRunParams as RunRunParams, };
311
+ }
312
+ //# sourceMappingURL=threads.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"threads.d.ts","sourceRoot":"","sources":["../../src/resources/threads/threads.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,UAAU;OACf,KAAK,WAAW;OAChB,EACL,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,QAAQ,EACT;OACM,KAAK,OAAO;OACZ,EACL,YAAY,EACZ,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,IAAI,EACL;OACM,EAAE,UAAU,EAAE;OAEd,EAAE,cAAc,EAAE;AAGzB,qBAAa,OAAQ,SAAQ,WAAW;IACtC,QAAQ,EAAE,WAAW,CAAC,QAAQ,CAA0C;IACxE,IAAI,EAAE,OAAO,CAAC,IAAI,CAAkC;IAEpD;;;;;;;;OAQG;IACH,MAAM,CAAC,IAAI,EAAE,kBAAkB,EAAE,OAAO,C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