@chrt-inc/typescript-sdk 1.1025.0 → 1.1027.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 (145) hide show
  1. package/README.md +12 -9
  2. package/dist/cjs/Client.js +2 -2
  3. package/dist/cjs/api/resources/chrtGpt/client/Client.d.ts +6 -13
  4. package/dist/cjs/api/resources/chrtGpt/client/Client.js +24 -17
  5. package/dist/cjs/api/resources/chrtGpt/client/requests/ChrtGptReq.d.ts +38 -0
  6. package/dist/cjs/api/resources/chrtGpt/client/requests/ChrtGptReq.js +19 -0
  7. package/dist/cjs/api/resources/chrtGpt/client/requests/index.d.ts +1 -1
  8. package/dist/cjs/api/resources/chrtGpt/index.d.ts +1 -0
  9. package/dist/cjs/api/resources/chrtGpt/index.js +1 -0
  10. package/dist/cjs/api/resources/chrtGpt/resources/conversations/client/Client.d.ts +96 -0
  11. package/dist/cjs/api/resources/chrtGpt/resources/conversations/client/Client.js +337 -0
  12. package/dist/cjs/api/resources/chrtGpt/resources/conversations/client/index.d.ts +2 -0
  13. package/dist/cjs/api/resources/chrtGpt/resources/conversations/client/index.js +17 -0
  14. package/dist/cjs/api/resources/chrtGpt/resources/conversations/client/requests/ChrtGptConversationsDeleteManyReq.d.ts +13 -0
  15. package/dist/cjs/api/resources/chrtGpt/resources/conversations/client/requests/ChrtGptConversationsUpdateTitleReq.d.ts +12 -0
  16. package/dist/cjs/api/resources/chrtGpt/resources/conversations/client/requests/ConversationsListV1Request.d.ts +21 -0
  17. package/dist/cjs/api/resources/chrtGpt/resources/conversations/client/requests/ConversationsListV1Request.js +5 -0
  18. package/dist/cjs/api/resources/chrtGpt/resources/conversations/client/requests/index.d.ts +3 -0
  19. package/dist/cjs/api/resources/chrtGpt/resources/conversations/client/requests/index.js +2 -0
  20. package/dist/cjs/api/resources/chrtGpt/resources/conversations/index.d.ts +1 -0
  21. package/dist/cjs/api/resources/chrtGpt/resources/conversations/index.js +17 -0
  22. package/dist/cjs/api/resources/chrtGpt/resources/index.d.ts +2 -0
  23. package/dist/cjs/api/resources/chrtGpt/resources/index.js +41 -0
  24. package/dist/cjs/api/resources/shipping/resources/taskArtifacts/resources/s3Object/client/Client.d.ts +1 -0
  25. package/dist/cjs/api/resources/shipping/resources/taskArtifacts/resources/s3Object/client/Client.js +1 -0
  26. package/dist/cjs/api/types/ChrtGptAssistantMessageItem.d.ts +8 -0
  27. package/dist/cjs/api/types/ChrtGptAssistantMessageItem.js +5 -0
  28. package/dist/cjs/api/types/ChrtGptCompletedEvent.d.ts +15 -0
  29. package/dist/cjs/api/types/ChrtGptCompletedEvent.js +5 -0
  30. package/dist/cjs/api/types/ChrtGptConversation1.d.ts +22 -0
  31. package/dist/cjs/api/types/ChrtGptConversation1.js +5 -0
  32. package/dist/cjs/api/types/ChrtGptConversationListRes.d.ts +8 -0
  33. package/dist/cjs/api/types/ChrtGptConversationListRes.js +5 -0
  34. package/dist/cjs/api/types/ChrtGptConversationRes.d.ts +11 -0
  35. package/dist/cjs/api/types/ChrtGptConversationRes.js +5 -0
  36. package/dist/cjs/api/types/ChrtGptConversationSortByEnum.d.ts +8 -0
  37. package/dist/cjs/api/types/ChrtGptConversationSortByEnum.js +10 -0
  38. package/dist/cjs/api/types/ChrtGptConversationTitleSourceEnum1.d.ts +9 -0
  39. package/dist/cjs/api/types/ChrtGptConversationTitleSourceEnum1.js +11 -0
  40. package/dist/cjs/api/types/ChrtGptConversationsDeleteManyRes.d.ts +7 -0
  41. package/dist/cjs/api/types/ChrtGptConversationsDeleteManyRes.js +5 -0
  42. package/dist/cjs/api/types/ChrtGptErrorEvent.d.ts +9 -0
  43. package/dist/cjs/api/types/ChrtGptErrorEvent.js +5 -0
  44. package/dist/cjs/api/types/ChrtGptEvent.d.ts +28 -0
  45. package/dist/cjs/api/types/ChrtGptEvent.js +5 -0
  46. package/dist/cjs/api/types/ChrtGptHistoryItem.d.ts +22 -0
  47. package/dist/cjs/api/types/ChrtGptHistoryItem.js +5 -0
  48. package/dist/{esm/api/types/ChrtGptMessageRes.d.mts → cjs/api/types/ChrtGptStartedEvent.d.ts} +4 -2
  49. package/dist/cjs/api/types/ChrtGptStartedEvent.js +5 -0
  50. package/dist/cjs/api/types/ChrtGptTextDeltaEvent.d.ts +8 -0
  51. package/dist/cjs/api/types/ChrtGptTextDeltaEvent.js +5 -0
  52. package/dist/cjs/api/types/ChrtGptToolCalledEvent.d.ts +12 -0
  53. package/dist/cjs/api/types/ChrtGptToolCalledEvent.js +5 -0
  54. package/dist/cjs/api/types/ChrtGptToolOutputEvent.d.ts +9 -0
  55. package/dist/cjs/api/types/ChrtGptToolOutputEvent.js +5 -0
  56. package/dist/cjs/api/types/ChrtGptUserMessageItem.d.ts +6 -0
  57. package/dist/cjs/api/types/ChrtGptUserMessageItem.js +5 -0
  58. package/dist/cjs/api/types/ChrtGptWebSearchEvent.d.ts +18 -0
  59. package/dist/cjs/api/types/ChrtGptWebSearchEvent.js +5 -0
  60. package/dist/cjs/api/types/index.d.ts +17 -1
  61. package/dist/cjs/api/types/index.js +17 -1
  62. package/dist/cjs/core/index.d.ts +1 -0
  63. package/dist/cjs/core/index.js +1 -0
  64. package/dist/cjs/core/stream/Stream.d.ts +46 -0
  65. package/dist/cjs/core/stream/Stream.js +169 -0
  66. package/dist/cjs/core/stream/index.d.ts +1 -0
  67. package/dist/cjs/core/stream/index.js +5 -0
  68. package/dist/cjs/version.d.ts +1 -1
  69. package/dist/cjs/version.js +1 -1
  70. package/dist/esm/Client.mjs +2 -2
  71. package/dist/esm/api/resources/chrtGpt/client/Client.d.mts +6 -13
  72. package/dist/esm/api/resources/chrtGpt/client/Client.mjs +24 -17
  73. package/dist/esm/api/resources/chrtGpt/client/requests/ChrtGptReq.d.mts +38 -0
  74. package/dist/esm/api/resources/chrtGpt/client/requests/ChrtGptReq.mjs +16 -0
  75. package/dist/esm/api/resources/chrtGpt/client/requests/index.d.mts +1 -1
  76. package/dist/esm/api/resources/chrtGpt/index.d.mts +1 -0
  77. package/dist/esm/api/resources/chrtGpt/index.mjs +1 -0
  78. package/dist/esm/api/resources/chrtGpt/resources/conversations/client/Client.d.mts +96 -0
  79. package/dist/esm/api/resources/chrtGpt/resources/conversations/client/Client.mjs +300 -0
  80. package/dist/esm/api/resources/chrtGpt/resources/conversations/client/index.d.mts +2 -0
  81. package/dist/esm/api/resources/chrtGpt/resources/conversations/client/index.mjs +1 -0
  82. package/dist/esm/api/resources/chrtGpt/resources/conversations/client/requests/ChrtGptConversationsDeleteManyReq.d.mts +13 -0
  83. package/dist/esm/api/resources/chrtGpt/resources/conversations/client/requests/ChrtGptConversationsUpdateTitleReq.d.mts +12 -0
  84. package/dist/esm/api/resources/chrtGpt/resources/conversations/client/requests/ConversationsListV1Request.d.mts +21 -0
  85. package/dist/esm/api/resources/chrtGpt/resources/conversations/client/requests/ConversationsListV1Request.mjs +4 -0
  86. package/dist/esm/api/resources/chrtGpt/resources/conversations/client/requests/index.d.mts +3 -0
  87. package/dist/esm/api/resources/chrtGpt/resources/conversations/client/requests/index.mjs +1 -0
  88. package/dist/esm/api/resources/chrtGpt/resources/conversations/index.d.mts +1 -0
  89. package/dist/esm/api/resources/chrtGpt/resources/conversations/index.mjs +1 -0
  90. package/dist/esm/api/resources/chrtGpt/resources/index.d.mts +2 -0
  91. package/dist/esm/api/resources/chrtGpt/resources/index.mjs +2 -0
  92. package/dist/esm/api/resources/shipping/resources/taskArtifacts/resources/s3Object/client/Client.d.mts +1 -0
  93. package/dist/esm/api/resources/shipping/resources/taskArtifacts/resources/s3Object/client/Client.mjs +1 -0
  94. package/dist/esm/api/types/ChrtGptAssistantMessageItem.d.mts +8 -0
  95. package/dist/esm/api/types/ChrtGptAssistantMessageItem.mjs +4 -0
  96. package/dist/esm/api/types/ChrtGptCompletedEvent.d.mts +15 -0
  97. package/dist/esm/api/types/ChrtGptCompletedEvent.mjs +4 -0
  98. package/dist/esm/api/types/ChrtGptConversation1.d.mts +22 -0
  99. package/dist/esm/api/types/ChrtGptConversation1.mjs +4 -0
  100. package/dist/esm/api/types/ChrtGptConversationListRes.d.mts +8 -0
  101. package/dist/esm/api/types/ChrtGptConversationListRes.mjs +4 -0
  102. package/dist/esm/api/types/ChrtGptConversationRes.d.mts +11 -0
  103. package/dist/esm/api/types/ChrtGptConversationRes.mjs +4 -0
  104. package/dist/esm/api/types/ChrtGptConversationSortByEnum.d.mts +8 -0
  105. package/dist/esm/api/types/ChrtGptConversationSortByEnum.mjs +7 -0
  106. package/dist/esm/api/types/ChrtGptConversationTitleSourceEnum1.d.mts +9 -0
  107. package/dist/esm/api/types/ChrtGptConversationTitleSourceEnum1.mjs +8 -0
  108. package/dist/esm/api/types/ChrtGptConversationsDeleteManyRes.d.mts +7 -0
  109. package/dist/esm/api/types/ChrtGptConversationsDeleteManyRes.mjs +4 -0
  110. package/dist/esm/api/types/ChrtGptErrorEvent.d.mts +9 -0
  111. package/dist/esm/api/types/ChrtGptErrorEvent.mjs +4 -0
  112. package/dist/esm/api/types/ChrtGptEvent.d.mts +28 -0
  113. package/dist/esm/api/types/ChrtGptEvent.mjs +4 -0
  114. package/dist/esm/api/types/ChrtGptHistoryItem.d.mts +22 -0
  115. package/dist/esm/api/types/ChrtGptHistoryItem.mjs +4 -0
  116. package/dist/{cjs/api/types/ChrtGptMessageRes.d.ts → esm/api/types/ChrtGptStartedEvent.d.mts} +4 -2
  117. package/dist/esm/api/types/ChrtGptStartedEvent.mjs +4 -0
  118. package/dist/esm/api/types/ChrtGptTextDeltaEvent.d.mts +8 -0
  119. package/dist/esm/api/types/ChrtGptTextDeltaEvent.mjs +4 -0
  120. package/dist/esm/api/types/ChrtGptToolCalledEvent.d.mts +12 -0
  121. package/dist/esm/api/types/ChrtGptToolCalledEvent.mjs +4 -0
  122. package/dist/esm/api/types/ChrtGptToolOutputEvent.d.mts +9 -0
  123. package/dist/esm/api/types/ChrtGptToolOutputEvent.mjs +4 -0
  124. package/dist/esm/api/types/ChrtGptUserMessageItem.d.mts +6 -0
  125. package/dist/esm/api/types/ChrtGptUserMessageItem.mjs +4 -0
  126. package/dist/esm/api/types/ChrtGptWebSearchEvent.d.mts +18 -0
  127. package/dist/esm/api/types/ChrtGptWebSearchEvent.mjs +4 -0
  128. package/dist/esm/api/types/index.d.mts +17 -1
  129. package/dist/esm/api/types/index.mjs +17 -1
  130. package/dist/esm/core/index.d.mts +1 -0
  131. package/dist/esm/core/index.mjs +1 -0
  132. package/dist/esm/core/stream/Stream.d.mts +46 -0
  133. package/dist/esm/core/stream/Stream.mjs +164 -0
  134. package/dist/esm/core/stream/index.d.mts +1 -0
  135. package/dist/esm/core/stream/index.mjs +1 -0
  136. package/dist/esm/version.d.mts +1 -1
  137. package/dist/esm/version.mjs +1 -1
  138. package/package.json +1 -1
  139. package/reference.md +279 -4
  140. package/dist/cjs/api/resources/chrtGpt/client/requests/ChrtGptMessageReq.d.ts +0 -14
  141. package/dist/esm/api/resources/chrtGpt/client/requests/ChrtGptMessageReq.d.mts +0 -14
  142. /package/dist/cjs/api/resources/chrtGpt/{client/requests/ChrtGptMessageReq.js → resources/conversations/client/requests/ChrtGptConversationsDeleteManyReq.js} +0 -0
  143. /package/dist/cjs/api/{types/ChrtGptMessageRes.js → resources/chrtGpt/resources/conversations/client/requests/ChrtGptConversationsUpdateTitleReq.js} +0 -0
  144. /package/dist/esm/api/resources/chrtGpt/{client/requests/ChrtGptMessageReq.mjs → resources/conversations/client/requests/ChrtGptConversationsDeleteManyReq.mjs} +0 -0
  145. /package/dist/esm/api/{types/ChrtGptMessageRes.mjs → resources/chrtGpt/resources/conversations/client/requests/ChrtGptConversationsUpdateTitleReq.mjs} +0 -0
@@ -0,0 +1,337 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
39
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
40
+ return new (P || (P = Promise))(function (resolve, reject) {
41
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
42
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
43
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
44
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
45
+ });
46
+ };
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ exports.Conversations = void 0;
49
+ const environments = __importStar(require("../../../../../../environments.js"));
50
+ const core = __importStar(require("../../../../../../core/index.js"));
51
+ const Chrt = __importStar(require("../../../../../index.js"));
52
+ const headers_js_1 = require("../../../../../../core/headers.js");
53
+ const errors = __importStar(require("../../../../../../errors/index.js"));
54
+ class Conversations {
55
+ constructor(_options = {}) {
56
+ this._options = _options;
57
+ }
58
+ /**
59
+ * Permanently deletes the caller's ChrtGPT conversations and their history, skipping IDs that don't exist or aren't the caller's. | authz: allowed_org_types=[shipper, provider], min_org_role=operator | (ChrtGPTConversationsDeleteManyReq) -> (ChrtGPTConversationsDeleteManyRes)
60
+ *
61
+ * @param {Chrt.chrtGpt.ChrtGptConversationsDeleteManyReq} request
62
+ * @param {Conversations.RequestOptions} requestOptions - Request-specific configuration.
63
+ *
64
+ * @throws {@link Chrt.UnprocessableEntityError}
65
+ *
66
+ * @example
67
+ * await client.chrtGpt.conversations.deleteManyV1({
68
+ * conversation_ids: ["conversation_ids"]
69
+ * })
70
+ */
71
+ deleteManyV1(request, requestOptions) {
72
+ return core.HttpResponsePromise.fromPromise(this.__deleteManyV1(request, requestOptions));
73
+ }
74
+ __deleteManyV1(request, requestOptions) {
75
+ return __awaiter(this, void 0, void 0, function* () {
76
+ var _a, _b, _c, _d;
77
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
78
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
79
+ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.ChrtEnvironment.Local, "chrt_gpt/conversations/delete_many/v1"),
80
+ method: "DELETE",
81
+ headers: _headers,
82
+ contentType: "application/json",
83
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
84
+ requestType: "json",
85
+ body: request,
86
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
87
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
88
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
89
+ });
90
+ if (_response.ok) {
91
+ return {
92
+ data: _response.body,
93
+ rawResponse: _response.rawResponse,
94
+ };
95
+ }
96
+ if (_response.error.reason === "status-code") {
97
+ switch (_response.error.statusCode) {
98
+ case 422:
99
+ throw new Chrt.UnprocessableEntityError(_response.error.body, _response.rawResponse);
100
+ default:
101
+ throw new errors.ChrtError({
102
+ statusCode: _response.error.statusCode,
103
+ body: _response.error.body,
104
+ rawResponse: _response.rawResponse,
105
+ });
106
+ }
107
+ }
108
+ switch (_response.error.reason) {
109
+ case "non-json":
110
+ throw new errors.ChrtError({
111
+ statusCode: _response.error.statusCode,
112
+ body: _response.error.rawBody,
113
+ rawResponse: _response.rawResponse,
114
+ });
115
+ case "timeout":
116
+ throw new errors.ChrtTimeoutError("Timeout exceeded when calling DELETE /chrt_gpt/conversations/delete_many/v1.");
117
+ case "unknown":
118
+ throw new errors.ChrtError({
119
+ message: _response.error.errorMessage,
120
+ rawResponse: _response.rawResponse,
121
+ });
122
+ }
123
+ });
124
+ }
125
+ /**
126
+ * Lists the caller's ChrtGPT conversations, most recently active first by default. | authz: allowed_org_types=[shipper, provider], min_org_role=operator | () -> (ChrtGPTConversationListRes)
127
+ *
128
+ * @param {Chrt.chrtGpt.ConversationsListV1Request} request
129
+ * @param {Conversations.RequestOptions} requestOptions - Request-specific configuration.
130
+ *
131
+ * @throws {@link Chrt.UnprocessableEntityError}
132
+ *
133
+ * @example
134
+ * await client.chrtGpt.conversations.listV1({
135
+ * sort_by: "updated_at",
136
+ * sort_order: "asc",
137
+ * page: 1,
138
+ * page_size: 1
139
+ * })
140
+ */
141
+ listV1(request = {}, requestOptions) {
142
+ return core.HttpResponsePromise.fromPromise(this.__listV1(request, requestOptions));
143
+ }
144
+ __listV1() {
145
+ return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
146
+ var _a, _b, _c, _d, _e, _f;
147
+ const { sort_by: sortBy, sort_order: sortOrder, page, page_size: pageSize } = request;
148
+ const _queryParams = {};
149
+ if (sortBy !== undefined) {
150
+ _queryParams["sort_by"] = sortBy;
151
+ }
152
+ if (sortOrder !== undefined) {
153
+ _queryParams["sort_order"] = sortOrder;
154
+ }
155
+ if (page !== undefined) {
156
+ _queryParams["page"] = (_a = page === null || page === void 0 ? void 0 : page.toString()) !== null && _a !== void 0 ? _a : null;
157
+ }
158
+ if (pageSize !== undefined) {
159
+ _queryParams["page_size"] = (_b = pageSize === null || pageSize === void 0 ? void 0 : pageSize.toString()) !== null && _b !== void 0 ? _b : null;
160
+ }
161
+ let _headers = (0, headers_js_1.mergeHeaders)((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
162
+ const _response = yield ((_d = this._options.fetcher) !== null && _d !== void 0 ? _d : core.fetcher)({
163
+ url: core.url.join((_f = (_e = (yield core.Supplier.get(this._options.baseUrl))) !== null && _e !== void 0 ? _e : (yield core.Supplier.get(this._options.environment))) !== null && _f !== void 0 ? _f : environments.ChrtEnvironment.Local, "chrt_gpt/conversations/list/v1"),
164
+ method: "GET",
165
+ headers: _headers,
166
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
167
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
168
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
169
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
170
+ });
171
+ if (_response.ok) {
172
+ return { data: _response.body, rawResponse: _response.rawResponse };
173
+ }
174
+ if (_response.error.reason === "status-code") {
175
+ switch (_response.error.statusCode) {
176
+ case 422:
177
+ throw new Chrt.UnprocessableEntityError(_response.error.body, _response.rawResponse);
178
+ default:
179
+ throw new errors.ChrtError({
180
+ statusCode: _response.error.statusCode,
181
+ body: _response.error.body,
182
+ rawResponse: _response.rawResponse,
183
+ });
184
+ }
185
+ }
186
+ switch (_response.error.reason) {
187
+ case "non-json":
188
+ throw new errors.ChrtError({
189
+ statusCode: _response.error.statusCode,
190
+ body: _response.error.rawBody,
191
+ rawResponse: _response.rawResponse,
192
+ });
193
+ case "timeout":
194
+ throw new errors.ChrtTimeoutError("Timeout exceeded when calling GET /chrt_gpt/conversations/list/v1.");
195
+ case "unknown":
196
+ throw new errors.ChrtError({
197
+ message: _response.error.errorMessage,
198
+ rawResponse: _response.rawResponse,
199
+ });
200
+ }
201
+ });
202
+ }
203
+ /**
204
+ * Renames one of the caller's ChrtGPT conversations; ChrtGPT never retitles it after that. | authz: allowed_org_types=[shipper, provider], min_org_role=operator | (ChrtGPTConversationsUpdateTitleReq) -> (ChrtGPTConversation1)
205
+ *
206
+ * @param {string} conversationId
207
+ * @param {Chrt.chrtGpt.ChrtGptConversationsUpdateTitleReq} request
208
+ * @param {Conversations.RequestOptions} requestOptions - Request-specific configuration.
209
+ *
210
+ * @throws {@link Chrt.UnprocessableEntityError}
211
+ *
212
+ * @example
213
+ * await client.chrtGpt.conversations.updateTitleV1("conversation_id", {
214
+ * title: "title"
215
+ * })
216
+ */
217
+ updateTitleV1(conversationId, request, requestOptions) {
218
+ return core.HttpResponsePromise.fromPromise(this.__updateTitleV1(conversationId, request, requestOptions));
219
+ }
220
+ __updateTitleV1(conversationId, request, requestOptions) {
221
+ return __awaiter(this, void 0, void 0, function* () {
222
+ var _a, _b, _c, _d;
223
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
224
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
225
+ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.ChrtEnvironment.Local, `chrt_gpt/conversations/update_title/v1/${encodeURIComponent(conversationId)}`),
226
+ method: "PATCH",
227
+ headers: _headers,
228
+ contentType: "application/json",
229
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
230
+ requestType: "json",
231
+ body: request,
232
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
233
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
234
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
235
+ });
236
+ if (_response.ok) {
237
+ return { data: _response.body, rawResponse: _response.rawResponse };
238
+ }
239
+ if (_response.error.reason === "status-code") {
240
+ switch (_response.error.statusCode) {
241
+ case 422:
242
+ throw new Chrt.UnprocessableEntityError(_response.error.body, _response.rawResponse);
243
+ default:
244
+ throw new errors.ChrtError({
245
+ statusCode: _response.error.statusCode,
246
+ body: _response.error.body,
247
+ rawResponse: _response.rawResponse,
248
+ });
249
+ }
250
+ }
251
+ switch (_response.error.reason) {
252
+ case "non-json":
253
+ throw new errors.ChrtError({
254
+ statusCode: _response.error.statusCode,
255
+ body: _response.error.rawBody,
256
+ rawResponse: _response.rawResponse,
257
+ });
258
+ case "timeout":
259
+ throw new errors.ChrtTimeoutError("Timeout exceeded when calling PATCH /chrt_gpt/conversations/update_title/v1/{conversation_id}.");
260
+ case "unknown":
261
+ throw new errors.ChrtError({
262
+ message: _response.error.errorMessage,
263
+ rawResponse: _response.rawResponse,
264
+ });
265
+ }
266
+ });
267
+ }
268
+ /**
269
+ * Gets one of the caller's ChrtGPT conversations with its history of messages, tool calls, and web searches. | authz: allowed_org_types=[shipper, provider], min_org_role=operator | () -> (ChrtGPTConversationRes)
270
+ *
271
+ * @param {string} conversationId
272
+ * @param {Conversations.RequestOptions} requestOptions - Request-specific configuration.
273
+ *
274
+ * @throws {@link Chrt.UnprocessableEntityError}
275
+ *
276
+ * @example
277
+ * await client.chrtGpt.conversations.getV1("conversation_id")
278
+ */
279
+ getV1(conversationId, requestOptions) {
280
+ return core.HttpResponsePromise.fromPromise(this.__getV1(conversationId, requestOptions));
281
+ }
282
+ __getV1(conversationId, requestOptions) {
283
+ return __awaiter(this, void 0, void 0, function* () {
284
+ var _a, _b, _c, _d;
285
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
286
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
287
+ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.ChrtEnvironment.Local, `chrt_gpt/conversations/v1/${encodeURIComponent(conversationId)}`),
288
+ method: "GET",
289
+ headers: _headers,
290
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
291
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
292
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
293
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
294
+ });
295
+ if (_response.ok) {
296
+ return { data: _response.body, rawResponse: _response.rawResponse };
297
+ }
298
+ if (_response.error.reason === "status-code") {
299
+ switch (_response.error.statusCode) {
300
+ case 422:
301
+ throw new Chrt.UnprocessableEntityError(_response.error.body, _response.rawResponse);
302
+ default:
303
+ throw new errors.ChrtError({
304
+ statusCode: _response.error.statusCode,
305
+ body: _response.error.body,
306
+ rawResponse: _response.rawResponse,
307
+ });
308
+ }
309
+ }
310
+ switch (_response.error.reason) {
311
+ case "non-json":
312
+ throw new errors.ChrtError({
313
+ statusCode: _response.error.statusCode,
314
+ body: _response.error.rawBody,
315
+ rawResponse: _response.rawResponse,
316
+ });
317
+ case "timeout":
318
+ throw new errors.ChrtTimeoutError("Timeout exceeded when calling GET /chrt_gpt/conversations/v1/{conversation_id}.");
319
+ case "unknown":
320
+ throw new errors.ChrtError({
321
+ message: _response.error.errorMessage,
322
+ rawResponse: _response.rawResponse,
323
+ });
324
+ }
325
+ });
326
+ }
327
+ _getAuthorizationHeader() {
328
+ return __awaiter(this, void 0, void 0, function* () {
329
+ const bearer = yield core.Supplier.get(this._options.token);
330
+ if (bearer != null) {
331
+ return `Bearer ${bearer}`;
332
+ }
333
+ return undefined;
334
+ });
335
+ }
336
+ }
337
+ exports.Conversations = Conversations;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ export * from "./requests/index.js";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./requests/index.js"), exports);
@@ -0,0 +1,13 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * @example
6
+ * {
7
+ * conversation_ids: ["conversation_ids"]
8
+ * }
9
+ */
10
+ export interface ChrtGptConversationsDeleteManyReq {
11
+ /** IDs that don't exist or aren't the caller's are skipped. */
12
+ conversation_ids: string[];
13
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * @example
6
+ * {
7
+ * title: "title"
8
+ * }
9
+ */
10
+ export interface ChrtGptConversationsUpdateTitleReq {
11
+ title: string;
12
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Chrt from "../../../../../../index.js";
5
+ /**
6
+ * @example
7
+ * {
8
+ * sort_by: "updated_at",
9
+ * sort_order: "asc",
10
+ * page: 1,
11
+ * page_size: 1
12
+ * }
13
+ */
14
+ export interface ConversationsListV1Request {
15
+ /** Field to sort by */
16
+ sort_by?: Chrt.ChrtGptConversationSortByEnum | null;
17
+ /** Sort order (asc or desc) */
18
+ sort_order?: Chrt.SortOrderEnum | null;
19
+ page?: number | null;
20
+ page_size?: number | null;
21
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ export { type ChrtGptConversationsDeleteManyReq } from "./ChrtGptConversationsDeleteManyReq.js";
2
+ export { type ConversationsListV1Request } from "./ConversationsListV1Request.js";
3
+ export { type ChrtGptConversationsUpdateTitleReq } from "./ChrtGptConversationsUpdateTitleReq.js";
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export * from "./client/index.js";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./client/index.js"), exports);
@@ -0,0 +1,2 @@
1
+ export * as conversations from "./conversations/index.js";
2
+ export * from "./conversations/client/requests/index.js";
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
36
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.conversations = void 0;
40
+ exports.conversations = __importStar(require("./conversations/index.js"));
41
+ __exportStar(require("./conversations/client/requests/index.js"), exports);
@@ -65,6 +65,7 @@ export declare class S3Object {
65
65
  * location_identifiers: ["location_identifiers"],
66
66
  * model: "gpt-6-astra",
67
67
  * package_appearance: "package_appearance",
68
+ * package_count: undefined,
68
69
  * package_types: ["package_types"],
69
70
  * proof_notes: ["proof_notes"],
70
71
  * readable_package_text: ["readable_package_text"],
@@ -142,6 +142,7 @@ class S3Object {
142
142
  * location_identifiers: ["location_identifiers"],
143
143
  * model: "gpt-6-astra",
144
144
  * package_appearance: "package_appearance",
145
+ * package_count: undefined,
145
146
  * package_types: ["package_types"],
146
147
  * proof_notes: ["proof_notes"],
147
148
  * readable_package_text: ["readable_package_text"],
@@ -0,0 +1,8 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export interface ChrtGptAssistantMessageItem {
5
+ /** Matches the item_id of the text_delta events that streamed it. */
6
+ item_id: string;
7
+ text: string;
8
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,15 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * Last event of a successful stream.
6
+ */
7
+ export interface ChrtGptCompletedEvent {
8
+ /** When context_tokens passes this, ChrtGPT compacts older turns and context_tokens drops. */
9
+ context_limit_tokens: number;
10
+ /** Tokens of context ChrtGPT carries into the next turn. On a turn that compacted, this is the size before compaction, so it can exceed context_limit_tokens once. */
11
+ context_tokens: number;
12
+ conversation_id: string;
13
+ /** The turn's final message. Earlier messages in the turn only arrive as text deltas. */
14
+ response_text: string;
15
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,22 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Chrt from "../index.js";
5
+ export interface ChrtGptConversation1 {
6
+ _id: string;
7
+ awb_numbers?: string[];
8
+ context_tokens?: number | null;
9
+ created_at: string;
10
+ off_chrt_reference_ids?: string[];
11
+ order_short_ids?: string[];
12
+ /** Must be a string starting with `org_` */
13
+ org_id: string;
14
+ schema_version: number;
15
+ summarized_turn_count?: number;
16
+ summary?: string | null;
17
+ title: string;
18
+ title_source: Chrt.ChrtGptConversationTitleSourceEnum1;
19
+ updated_at: string;
20
+ /** Must be a string starting with `user_` */
21
+ user_id: string;
22
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Chrt from "../index.js";
5
+ export interface ChrtGptConversationListRes {
6
+ items: Chrt.ChrtGptConversation1[];
7
+ total_count: number;
8
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Chrt from "../index.js";
5
+ export interface ChrtGptConversationRes {
6
+ /** The limit for conversation.context_tokens, as on the completed event. */
7
+ context_limit_tokens: number;
8
+ conversation: Chrt.ChrtGptConversation1;
9
+ /** The conversation's history, oldest first. Reasoning and compaction items are omitted. */
10
+ items: Chrt.ChrtGptHistoryItem[];
11
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export type ChrtGptConversationSortByEnum = "updated_at" | "created_at";
5
+ export declare const ChrtGptConversationSortByEnum: {
6
+ readonly UpdatedAt: "updated_at";
7
+ readonly CreatedAt: "created_at";
8
+ };
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ChrtGptConversationSortByEnum = void 0;
7
+ exports.ChrtGptConversationSortByEnum = {
8
+ UpdatedAt: "updated_at",
9
+ CreatedAt: "created_at",
10
+ };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export type ChrtGptConversationTitleSourceEnum1 = "fallback" | "ai" | "user";
5
+ export declare const ChrtGptConversationTitleSourceEnum1: {
6
+ readonly Fallback: "fallback";
7
+ readonly Ai: "ai";
8
+ readonly User: "user";
9
+ };