@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,75 @@
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.Threads = void 0;
5
+ const tslib_1 = require("../../internal/tslib.js");
6
+ const resource_1 = require("../../core/resource.js");
7
+ const MessagesAPI = tslib_1.__importStar(require("./messages.js"));
8
+ const messages_1 = require("./messages.js");
9
+ const RunsAPI = tslib_1.__importStar(require("./runs.js"));
10
+ const runs_1 = require("./runs.js");
11
+ const headers_1 = require("../../internal/headers.js");
12
+ const path_1 = require("../../internal/utils/path.js");
13
+ class Threads extends resource_1.APIResource {
14
+ constructor() {
15
+ super(...arguments);
16
+ this.messages = new MessagesAPI.Messages(this._client);
17
+ this.runs = new RunsAPI.Runs(this._client);
18
+ }
19
+ /**
20
+ * Create a new empty thread. Note: initialMessages is not supported yet; create
21
+ * the thread first, then add messages via runs/message endpoints.
22
+ *
23
+ * @example
24
+ * ```ts
25
+ * const thread = await client.threads.create();
26
+ * ```
27
+ */
28
+ create(body, options) {
29
+ return this._client.post('/v1/threads', { body, ...options });
30
+ }
31
+ /**
32
+ * Get a thread by ID with all its messages. The thread must belong to the
33
+ * authenticated project.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * const thread = await client.threads.retrieve(
38
+ * 'thr_abc123xyz',
39
+ * );
40
+ * ```
41
+ */
42
+ retrieve(threadID, options) {
43
+ return this._client.get((0, path_1.path) `/v1/threads/${threadID}`, options);
44
+ }
45
+ /**
46
+ * List all threads for the authenticated project. Supports cursor-based pagination
47
+ * and filtering by context key.
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * const threads = await client.threads.list();
52
+ * ```
53
+ */
54
+ list(query = {}, options) {
55
+ return this._client.get('/v1/threads', { query, ...options });
56
+ }
57
+ /**
58
+ * Delete a thread and all its messages. This action cannot be undone.
59
+ *
60
+ * @example
61
+ * ```ts
62
+ * await client.threads.delete('thr_abc123xyz');
63
+ * ```
64
+ */
65
+ delete(threadID, options) {
66
+ return this._client.delete((0, path_1.path) `/v1/threads/${threadID}`, {
67
+ ...options,
68
+ headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
69
+ });
70
+ }
71
+ }
72
+ exports.Threads = Threads;
73
+ Threads.Messages = messages_1.Messages;
74
+ Threads.Runs = runs_1.Runs;
75
+ //# sourceMappingURL=threads.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"threads.js","sourceRoot":"","sources":["../../src/resources/threads/threads.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,qDAAkD;AAElD,mEAA0C;AAC1C,4CAMoB;AACpB,2DAAkC;AAClC,oCAOgB;AAEhB,uDAAsD;AAEtD,uDAAiD;AAEjD,MAAa,OAAQ,SAAQ,sBAAW;IAAxC;;QACE,aAAQ,GAAyB,IAAI,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxE,SAAI,GAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IA4DtD,CAAC;IA1DC;;;;;;;;OAQG;IACH,MAAM,CAAC,IAAwB,EAAE,OAAwB;QACvD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAChE,CAAC;IAED;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,QAAgB,EAAE,OAAwB;QACjD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,eAAe,QAAQ,EAAE,EAAE,OAAO,CAAC,CAAC;IAClE,CAAC;IAED;;;;;;;;OAQG;IACH,IAAI,CACF,QAA6C,EAAE,EAC/C,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAChE,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,QAAgB,EAAE,OAAwB;QAC/C,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAA,WAAI,EAAA,eAAe,QAAQ,EAAE,EAAE;YACxD,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;AA9DD,0BA8DC;AAuTD,OAAO,CAAC,QAAQ,GAAG,mBAAQ,CAAC;AAC5B,OAAO,CAAC,IAAI,GAAG,WAAI,CAAC"}
@@ -0,0 +1,70 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ import { APIResource } from "../../core/resource.mjs";
3
+ import * as MessagesAPI from "./messages.mjs";
4
+ import { Messages, } from "./messages.mjs";
5
+ import * as RunsAPI from "./runs.mjs";
6
+ import { Runs, } from "./runs.mjs";
7
+ import { buildHeaders } from "../../internal/headers.mjs";
8
+ import { path } from "../../internal/utils/path.mjs";
9
+ export class Threads extends APIResource {
10
+ constructor() {
11
+ super(...arguments);
12
+ this.messages = new MessagesAPI.Messages(this._client);
13
+ this.runs = new RunsAPI.Runs(this._client);
14
+ }
15
+ /**
16
+ * Create a new empty thread. Note: initialMessages is not supported yet; create
17
+ * the thread first, then add messages via runs/message endpoints.
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * const thread = await client.threads.create();
22
+ * ```
23
+ */
24
+ create(body, options) {
25
+ return this._client.post('/v1/threads', { body, ...options });
26
+ }
27
+ /**
28
+ * Get a thread by ID with all its messages. The thread must belong to the
29
+ * authenticated project.
30
+ *
31
+ * @example
32
+ * ```ts
33
+ * const thread = await client.threads.retrieve(
34
+ * 'thr_abc123xyz',
35
+ * );
36
+ * ```
37
+ */
38
+ retrieve(threadID, options) {
39
+ return this._client.get(path `/v1/threads/${threadID}`, options);
40
+ }
41
+ /**
42
+ * List all threads for the authenticated project. Supports cursor-based pagination
43
+ * and filtering by context key.
44
+ *
45
+ * @example
46
+ * ```ts
47
+ * const threads = await client.threads.list();
48
+ * ```
49
+ */
50
+ list(query = {}, options) {
51
+ return this._client.get('/v1/threads', { query, ...options });
52
+ }
53
+ /**
54
+ * Delete a thread and all its messages. This action cannot be undone.
55
+ *
56
+ * @example
57
+ * ```ts
58
+ * await client.threads.delete('thr_abc123xyz');
59
+ * ```
60
+ */
61
+ delete(threadID, options) {
62
+ return this._client.delete(path `/v1/threads/${threadID}`, {
63
+ ...options,
64
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
65
+ });
66
+ }
67
+ }
68
+ Threads.Messages = Messages;
69
+ Threads.Runs = Runs;
70
+ //# sourceMappingURL=threads.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"threads.mjs","sourceRoot":"","sources":["../../src/resources/threads/threads.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAEf,KAAK,WAAW;OAChB,EAKL,QAAQ,GACT;OACM,KAAK,OAAO;OACZ,EAML,IAAI,GACL;OAEM,EAAE,YAAY,EAAE;OAEhB,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,OAAQ,SAAQ,WAAW;IAAxC;;QACE,aAAQ,GAAyB,IAAI,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxE,SAAI,GAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IA4DtD,CAAC;IA1DC;;;;;;;;OAQG;IACH,MAAM,CAAC,IAAwB,EAAE,OAAwB;QACvD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAChE,CAAC;IAED;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,QAAgB,EAAE,OAAwB;QACjD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,eAAe,QAAQ,EAAE,EAAE,OAAO,CAAC,CAAC;IAClE,CAAC;IAED;;;;;;;;OAQG;IACH,IAAI,CACF,QAA6C,EAAE,EAC/C,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAChE,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,QAAgB,EAAE,OAAwB;QAC/C,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAA,eAAe,QAAQ,EAAE,EAAE;YACxD,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;AAuTD,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAC5B,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./threads/index.mjs";
2
+ //# sourceMappingURL=threads.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"threads.d.mts","sourceRoot":"","sources":["../src/resources/threads.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export * from "./threads/index.js";
2
+ //# sourceMappingURL=threads.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"threads.d.ts","sourceRoot":"","sources":["../src/resources/threads.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
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
+ const tslib_1 = require("../internal/tslib.js");
5
+ tslib_1.__exportStar(require("./threads/index.js"), exports);
6
+ //# sourceMappingURL=threads.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"threads.js","sourceRoot":"","sources":["../src/resources/threads.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,6DAAgC"}
@@ -0,0 +1,3 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ export * from "./threads/index.mjs";
3
+ //# sourceMappingURL=threads.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"threads.mjs","sourceRoot":"","sources":["../src/resources/threads.ts"],"names":[],"mappings":"AAAA,sFAAsF"}
package/src/client.ts CHANGED
@@ -18,7 +18,17 @@ import { AbstractPage, type OffsetAndLimitParams, OffsetAndLimitResponse } from
18
18
  import * as Uploads from './core/uploads';
19
19
  import * as API from './resources/index';
20
20
  import { APIPromise } from './core/api-promise';
21
+ import { Storage, StoragePresignParams, StoragePresignResponse } from './resources/storage';
21
22
  import { Beta } from './resources/beta/beta';
23
+ import {
24
+ RunError,
25
+ ThreadCreateParams,
26
+ ThreadCreateResponse,
27
+ ThreadListParams,
28
+ ThreadListResponse,
29
+ ThreadRetrieveResponse,
30
+ Threads,
31
+ } from './resources/threads/threads';
22
32
  import { type Fetch } from './internal/builtin-types';
23
33
  import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
24
34
  import { FinalRequestOptions, RequestOptions } from './internal/request-options';
@@ -795,9 +805,13 @@ export class TamboAI {
795
805
  static toFile = Uploads.toFile;
796
806
 
797
807
  beta: API.Beta = new API.Beta(this);
808
+ storage: API.Storage = new API.Storage(this);
809
+ threads: API.Threads = new API.Threads(this);
798
810
  }
799
811
 
800
812
  TamboAI.Beta = Beta;
813
+ TamboAI.Storage = Storage;
814
+ TamboAI.Threads = Threads;
801
815
 
802
816
  export declare namespace TamboAI {
803
817
  export type RequestOptions = Opts.RequestOptions;
@@ -810,6 +824,22 @@ export declare namespace TamboAI {
810
824
 
811
825
  export { Beta as Beta };
812
826
 
827
+ export {
828
+ Storage as Storage,
829
+ type StoragePresignResponse as StoragePresignResponse,
830
+ type StoragePresignParams as StoragePresignParams,
831
+ };
832
+
833
+ export {
834
+ Threads as Threads,
835
+ type RunError as RunError,
836
+ type ThreadCreateResponse as ThreadCreateResponse,
837
+ type ThreadRetrieveResponse as ThreadRetrieveResponse,
838
+ type ThreadListResponse as ThreadListResponse,
839
+ type ThreadCreateParams as ThreadCreateParams,
840
+ type ThreadListParams as ThreadListParams,
841
+ };
842
+
813
843
  export type AvailableComponent = API.AvailableComponent;
814
844
  export type ComponentContextToolMetadata = API.ComponentContextToolMetadata;
815
845
  export type Resource = API.Resource;
@@ -1,11 +1,11 @@
1
1
  import { type TamboAI } from '../client';
2
2
  import { APIPromise } from '../core/api-promise';
3
3
  import { RequestOptions } from '../internal/request-options';
4
- import { ThreadAdvanceParams, ThreadAdvanceResponse } from '../resources/beta';
4
+ import { ThreadAdvanceByIDParams, ThreadAdvanceResponse } from '../resources/beta';
5
5
 
6
6
  export async function advanceStream(
7
7
  client: TamboAI,
8
- body: ThreadAdvanceParams,
8
+ body: ThreadAdvanceByIDParams,
9
9
  threadId?: string,
10
10
  options?: RequestOptions,
11
11
  ): Promise<AsyncIterable<ThreadAdvanceResponse>> {
@@ -27,7 +27,6 @@ import {
27
27
  Thread,
28
28
  ThreadAdvanceByIDParams,
29
29
  ThreadAdvanceByIDResponse,
30
- ThreadAdvanceParams,
31
30
  ThreadAdvanceResponse,
32
31
  ThreadCreateParams,
33
32
  ThreadGenerateNameParams,
@@ -78,7 +77,6 @@ export declare namespace Beta {
78
77
  type ThreadRetrieveParams as ThreadRetrieveParams,
79
78
  type ThreadUpdateParams as ThreadUpdateParams,
80
79
  type ThreadListParams as ThreadListParams,
81
- type ThreadAdvanceParams as ThreadAdvanceParams,
82
80
  type ThreadAdvanceByIDParams as ThreadAdvanceByIDParams,
83
81
  type ThreadGenerateNameParams as ThreadGenerateNameParams,
84
82
  };
@@ -29,7 +29,6 @@ export {
29
29
  type ThreadRetrieveParams,
30
30
  type ThreadUpdateParams,
31
31
  type ThreadListParams,
32
- type ThreadAdvanceParams,
33
32
  type ThreadAdvanceByIDParams,
34
33
  type ThreadGenerateNameParams,
35
34
  type ThreadsOffsetAndLimit,
@@ -31,7 +31,6 @@ export {
31
31
  type ThreadRetrieveParams,
32
32
  type ThreadUpdateParams,
33
33
  type ThreadListParams,
34
- type ThreadAdvanceParams,
35
34
  type ThreadAdvanceByIDParams,
36
35
  type ThreadGenerateNameParams,
37
36
  type ThreadsOffsetAndLimit,
@@ -59,7 +59,10 @@ export class Messages extends APIResource {
59
59
  * const threadMessage =
60
60
  * await client.beta.threads.messages.updateComponentState(
61
61
  * 'msg_123.456',
62
- * { id: 'thr_123.456', state: { foo: 'bar' } },
62
+ * {
63
+ * id: 'thr_123.456',
64
+ * state: { foo: 'bar' },
65
+ * },
63
66
  * );
64
67
  * ```
65
68
  */
@@ -150,7 +153,7 @@ export interface MessageUpdateComponentStateParams {
150
153
  id: string;
151
154
 
152
155
  /**
153
- * Body param:
156
+ * Body param
154
157
  */
155
158
  state: { [key: string]: unknown };
156
159
  }
@@ -107,37 +107,18 @@ export class Threads extends APIResource {
107
107
  }
108
108
 
109
109
  /**
110
- * Creates a new thread and advances it
110
+ * This endpoint has been deprecated. Use POST /advancestream instead.
111
111
  *
112
- * @example
113
- * ```ts
114
- * const response = await client.beta.threads.advance({
115
- * messageToAppend: {
116
- * content: [{ type: 'text' }],
117
- * role: 'user',
118
- * },
119
- * });
120
- * ```
112
+ * @deprecated
121
113
  */
122
- advance(body: ThreadAdvanceParams, options?: RequestOptions): APIPromise<ThreadAdvanceResponse> {
123
- return this._client.post('/threads/advance', { body, ...options });
114
+ advance(options?: RequestOptions): APIPromise<ThreadAdvanceResponse> {
115
+ return this._client.post('/threads/advance', options);
124
116
  }
125
117
 
126
118
  /**
127
- * Generates the response message for an existing thread
119
+ * This endpoint has been deprecated. Use POST /:id/advancestream instead.
128
120
  *
129
- * @example
130
- * ```ts
131
- * const response = await client.beta.threads.advanceByID(
132
- * 'thr_123.456',
133
- * {
134
- * messageToAppend: {
135
- * content: [{ type: 'text' }],
136
- * role: 'user',
137
- * },
138
- * },
139
- * );
140
- * ```
121
+ * @deprecated
141
122
  */
142
123
  advanceByID(
143
124
  id: string,
@@ -498,137 +479,6 @@ export interface ThreadListParams extends OffsetAndLimitParams {
498
479
  contextKey?: string;
499
480
  }
500
481
 
501
- export interface ThreadAdvanceParams {
502
- messageToAppend: ThreadAdvanceParams.MessageToAppend;
503
-
504
- availableComponents?: Array<Shared.AvailableComponent>;
505
-
506
- clientTools?: Array<Shared.ComponentContextToolMetadata>;
507
-
508
- /**
509
- * Unique user identifier for the thread
510
- */
511
- contextKey?: string;
512
-
513
- forceToolChoice?: string;
514
-
515
- /**
516
- * Initial messages to include when creating a new thread
517
- */
518
- initialMessages?: Array<ThreadAdvanceParams.InitialMessage>;
519
-
520
- /**
521
- * Tool call counts
522
- */
523
- toolCallCounts?: { [key: string]: number };
524
- }
525
-
526
- export namespace ThreadAdvanceParams {
527
- export interface MessageToAppend {
528
- content: Array<ThreadsAPI.ChatCompletionContentPart>;
529
-
530
- role: 'user' | 'assistant' | 'system' | 'tool';
531
-
532
- /**
533
- * @deprecated No longer used - instead set role and the tool call information
534
- */
535
- actionType?: 'tool_call' | 'tool_response';
536
-
537
- /**
538
- * Additional context to provide to the AI beyond the user query, such as the info
539
- * about the current page the user is visiting.
540
- */
541
- additionalContext?: { [key: string]: unknown };
542
-
543
- component?: ThreadsAPI.ComponentDecisionV2;
544
-
545
- /**
546
- * The initial state of the component
547
- */
548
- componentState?: { [key: string]: unknown };
549
-
550
- error?: string;
551
-
552
- /**
553
- * Whether the message has been cancelled
554
- */
555
- isCancelled?: boolean;
556
-
557
- metadata?: { [key: string]: unknown };
558
-
559
- /**
560
- * Reasoning text from the LLM, if the model supports it.
561
- */
562
- reasoning?: Array<string>;
563
-
564
- /**
565
- * Duration of reasoning in milliseconds
566
- */
567
- reasoningDurationMS?: number;
568
-
569
- tool_call_id?: string;
570
-
571
- toolCallRequest?: Shared.ToolCallRequest;
572
-
573
- /**
574
- * @deprecated Put the response in the content instead
575
- */
576
- toolResponse?: unknown;
577
- }
578
-
579
- export interface InitialMessage {
580
- content: Array<ThreadsAPI.ChatCompletionContentPart>;
581
-
582
- role: 'user' | 'assistant' | 'system' | 'tool';
583
-
584
- /**
585
- * @deprecated No longer used - instead set role and the tool call information
586
- */
587
- actionType?: 'tool_call' | 'tool_response';
588
-
589
- /**
590
- * Additional context to provide to the AI beyond the user query, such as the info
591
- * about the current page the user is visiting.
592
- */
593
- additionalContext?: { [key: string]: unknown };
594
-
595
- component?: ThreadsAPI.ComponentDecisionV2;
596
-
597
- /**
598
- * The initial state of the component
599
- */
600
- componentState?: { [key: string]: unknown };
601
-
602
- error?: string;
603
-
604
- /**
605
- * Whether the message has been cancelled
606
- */
607
- isCancelled?: boolean;
608
-
609
- metadata?: { [key: string]: unknown };
610
-
611
- /**
612
- * Reasoning text from the LLM, if the model supports it.
613
- */
614
- reasoning?: Array<string>;
615
-
616
- /**
617
- * Duration of reasoning in milliseconds
618
- */
619
- reasoningDurationMS?: number;
620
-
621
- tool_call_id?: string;
622
-
623
- toolCallRequest?: Shared.ToolCallRequest;
624
-
625
- /**
626
- * @deprecated Put the response in the content instead
627
- */
628
- toolResponse?: unknown;
629
- }
630
- }
631
-
632
482
  export interface ThreadAdvanceByIDParams {
633
483
  messageToAppend: ThreadAdvanceByIDParams.MessageToAppend;
634
484
 
@@ -784,7 +634,6 @@ export declare namespace Threads {
784
634
  type ThreadRetrieveParams as ThreadRetrieveParams,
785
635
  type ThreadUpdateParams as ThreadUpdateParams,
786
636
  type ThreadListParams as ThreadListParams,
787
- type ThreadAdvanceParams as ThreadAdvanceParams,
788
637
  type ThreadAdvanceByIDParams as ThreadAdvanceByIDParams,
789
638
  type ThreadGenerateNameParams as ThreadGenerateNameParams,
790
639
  };
@@ -2,3 +2,13 @@
2
2
 
3
3
  export * from './shared';
4
4
  export { Beta } from './beta/beta';
5
+ export { Storage, type StoragePresignResponse, type StoragePresignParams } from './storage';
6
+ export {
7
+ Threads,
8
+ type RunError,
9
+ type ThreadCreateResponse,
10
+ type ThreadRetrieveResponse,
11
+ type ThreadListResponse,
12
+ type ThreadCreateParams,
13
+ type ThreadListParams,
14
+ } from './threads/threads';
@@ -7,6 +7,9 @@ export interface AvailableComponent {
7
7
 
8
8
  name: string;
9
9
 
10
+ /**
11
+ * JSON Schema for the component's props
12
+ */
10
13
  props: { [key: string]: unknown };
11
14
  }
12
15
 
@@ -0,0 +1,59 @@
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
+
7
+ export class Storage extends APIResource {
8
+ /**
9
+ * Returns a presigned URL that allows direct file upload to S3. The client should
10
+ * PUT the file directly to the returned uploadUrl.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const response = await client.storage.presign({
15
+ * contentType: 'application/pdf',
16
+ * size: 1024000,
17
+ * });
18
+ * ```
19
+ */
20
+ presign(body: StoragePresignParams, options?: RequestOptions): APIPromise<StoragePresignResponse> {
21
+ return this._client.post('/storage/presign', { body, ...options });
22
+ }
23
+ }
24
+
25
+ export interface StoragePresignResponse {
26
+ /**
27
+ * The attachment URI to reference this file in messages
28
+ */
29
+ attachmentUri: string;
30
+
31
+ /**
32
+ * Time in seconds until the presigned URL expires
33
+ */
34
+ expiresIn: number;
35
+
36
+ /**
37
+ * The presigned URL to PUT the file directly to S3
38
+ */
39
+ uploadUrl: string;
40
+ }
41
+
42
+ export interface StoragePresignParams {
43
+ /**
44
+ * The MIME type of the file
45
+ */
46
+ contentType: string;
47
+
48
+ /**
49
+ * The file size in bytes (max 10MB)
50
+ */
51
+ size: number;
52
+ }
53
+
54
+ export declare namespace Storage {
55
+ export {
56
+ type StoragePresignResponse as StoragePresignResponse,
57
+ type StoragePresignParams as StoragePresignParams,
58
+ };
59
+ }
@@ -0,0 +1,26 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export {
4
+ Messages,
5
+ type MessageListResponse,
6
+ type MessageGetResponse,
7
+ type MessageListParams,
8
+ type MessageGetParams,
9
+ } from './messages';
10
+ export {
11
+ Runs,
12
+ type InputMessage,
13
+ type RunDeleteResponse,
14
+ type RunCreateParams,
15
+ type RunDeleteParams,
16
+ type RunRunParams,
17
+ } from './runs';
18
+ export {
19
+ Threads,
20
+ type RunError,
21
+ type ThreadCreateResponse,
22
+ type ThreadRetrieveResponse,
23
+ type ThreadListResponse,
24
+ type ThreadCreateParams,
25
+ type ThreadListParams,
26
+ } from './threads';