@chrt-inc/typescript-sdk 1.1025.0 → 1.1026.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 (131) 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/{ChrtGptMessageReq.d.ts → ChrtGptReq.d.ts} +1 -1
  6. package/dist/cjs/api/resources/chrtGpt/client/requests/index.d.ts +1 -1
  7. package/dist/cjs/api/resources/chrtGpt/index.d.ts +1 -0
  8. package/dist/cjs/api/resources/chrtGpt/index.js +1 -0
  9. package/dist/cjs/api/resources/chrtGpt/resources/conversations/client/Client.d.ts +65 -0
  10. package/dist/cjs/api/resources/chrtGpt/resources/conversations/client/Client.js +205 -0
  11. package/dist/cjs/api/resources/chrtGpt/resources/conversations/client/index.d.ts +2 -0
  12. package/dist/cjs/api/resources/chrtGpt/resources/conversations/client/index.js +17 -0
  13. package/dist/cjs/api/resources/chrtGpt/resources/conversations/client/requests/ConversationsListV1Request.d.ts +21 -0
  14. package/dist/cjs/api/resources/chrtGpt/resources/conversations/client/requests/index.d.ts +1 -0
  15. package/dist/cjs/api/resources/chrtGpt/resources/conversations/client/requests/index.js +2 -0
  16. package/dist/cjs/api/resources/chrtGpt/resources/conversations/index.d.ts +1 -0
  17. package/dist/cjs/api/resources/chrtGpt/resources/conversations/index.js +17 -0
  18. package/dist/cjs/api/resources/chrtGpt/resources/index.d.ts +2 -0
  19. package/dist/cjs/api/resources/chrtGpt/resources/index.js +41 -0
  20. package/dist/cjs/api/resources/shipping/resources/taskArtifacts/resources/s3Object/client/Client.d.ts +1 -0
  21. package/dist/cjs/api/resources/shipping/resources/taskArtifacts/resources/s3Object/client/Client.js +1 -0
  22. package/dist/cjs/api/types/ChrtGptAssistantMessageItem.d.ts +8 -0
  23. package/dist/cjs/api/types/ChrtGptAssistantMessageItem.js +5 -0
  24. package/dist/cjs/api/types/ChrtGptCompletedEvent.d.ts +11 -0
  25. package/dist/cjs/api/types/ChrtGptCompletedEvent.js +5 -0
  26. package/dist/cjs/api/types/ChrtGptConversation1.d.ts +14 -0
  27. package/dist/cjs/api/types/ChrtGptConversation1.js +5 -0
  28. package/dist/cjs/api/types/ChrtGptConversationListRes.d.ts +8 -0
  29. package/dist/cjs/api/types/ChrtGptConversationListRes.js +5 -0
  30. package/dist/cjs/api/types/ChrtGptConversationRes.d.ts +9 -0
  31. package/dist/cjs/api/types/ChrtGptConversationRes.js +5 -0
  32. package/dist/cjs/api/types/ChrtGptConversationSortByEnum.d.ts +8 -0
  33. package/dist/cjs/api/types/ChrtGptConversationSortByEnum.js +10 -0
  34. package/dist/cjs/api/types/ChrtGptErrorEvent.d.ts +9 -0
  35. package/dist/cjs/api/types/ChrtGptErrorEvent.js +5 -0
  36. package/dist/cjs/api/types/ChrtGptEvent.d.ts +31 -0
  37. package/dist/cjs/api/types/ChrtGptEvent.js +5 -0
  38. package/dist/cjs/api/types/ChrtGptHistoryItem.d.ts +22 -0
  39. package/dist/cjs/api/types/ChrtGptHistoryItem.js +5 -0
  40. package/dist/{esm/api/types/ChrtGptMessageRes.d.mts → cjs/api/types/ChrtGptStartedEvent.d.ts} +4 -2
  41. package/dist/cjs/api/types/ChrtGptStartedEvent.js +5 -0
  42. package/dist/cjs/api/types/ChrtGptTextDeltaEvent.d.ts +8 -0
  43. package/dist/cjs/api/types/ChrtGptTextDeltaEvent.js +5 -0
  44. package/dist/cjs/api/types/ChrtGptTitleEvent.d.ts +11 -0
  45. package/dist/cjs/api/types/ChrtGptTitleEvent.js +5 -0
  46. package/dist/cjs/api/types/ChrtGptToolCalledEvent.d.ts +12 -0
  47. package/dist/cjs/api/types/ChrtGptToolCalledEvent.js +5 -0
  48. package/dist/cjs/api/types/ChrtGptToolOutputEvent.d.ts +9 -0
  49. package/dist/cjs/api/types/ChrtGptToolOutputEvent.js +5 -0
  50. package/dist/cjs/api/types/ChrtGptUserMessageItem.d.ts +6 -0
  51. package/dist/cjs/api/types/ChrtGptUserMessageItem.js +5 -0
  52. package/dist/cjs/api/types/ChrtGptWebSearchEvent.d.ts +18 -0
  53. package/dist/cjs/api/types/ChrtGptWebSearchEvent.js +5 -0
  54. package/dist/cjs/api/types/index.d.ts +16 -1
  55. package/dist/cjs/api/types/index.js +16 -1
  56. package/dist/cjs/core/index.d.ts +1 -0
  57. package/dist/cjs/core/index.js +1 -0
  58. package/dist/cjs/core/stream/Stream.d.ts +46 -0
  59. package/dist/cjs/core/stream/Stream.js +169 -0
  60. package/dist/cjs/core/stream/index.d.ts +1 -0
  61. package/dist/cjs/core/stream/index.js +5 -0
  62. package/dist/cjs/version.d.ts +1 -1
  63. package/dist/cjs/version.js +1 -1
  64. package/dist/esm/Client.mjs +2 -2
  65. package/dist/esm/api/resources/chrtGpt/client/Client.d.mts +6 -13
  66. package/dist/esm/api/resources/chrtGpt/client/Client.mjs +24 -17
  67. package/dist/esm/api/resources/chrtGpt/client/requests/{ChrtGptMessageReq.d.mts → ChrtGptReq.d.mts} +1 -1
  68. package/dist/esm/api/resources/chrtGpt/client/requests/index.d.mts +1 -1
  69. package/dist/esm/api/resources/chrtGpt/index.d.mts +1 -0
  70. package/dist/esm/api/resources/chrtGpt/index.mjs +1 -0
  71. package/dist/esm/api/resources/chrtGpt/resources/conversations/client/Client.d.mts +65 -0
  72. package/dist/esm/api/resources/chrtGpt/resources/conversations/client/Client.mjs +168 -0
  73. package/dist/esm/api/resources/chrtGpt/resources/conversations/client/index.d.mts +2 -0
  74. package/dist/esm/api/resources/chrtGpt/resources/conversations/client/index.mjs +1 -0
  75. package/dist/esm/api/resources/chrtGpt/resources/conversations/client/requests/ConversationsListV1Request.d.mts +21 -0
  76. package/dist/esm/api/resources/chrtGpt/resources/conversations/client/requests/index.d.mts +1 -0
  77. package/dist/esm/api/resources/chrtGpt/resources/conversations/client/requests/index.mjs +1 -0
  78. package/dist/esm/api/resources/chrtGpt/resources/conversations/index.d.mts +1 -0
  79. package/dist/esm/api/resources/chrtGpt/resources/conversations/index.mjs +1 -0
  80. package/dist/esm/api/resources/chrtGpt/resources/index.d.mts +2 -0
  81. package/dist/esm/api/resources/chrtGpt/resources/index.mjs +2 -0
  82. package/dist/esm/api/resources/shipping/resources/taskArtifacts/resources/s3Object/client/Client.d.mts +1 -0
  83. package/dist/esm/api/resources/shipping/resources/taskArtifacts/resources/s3Object/client/Client.mjs +1 -0
  84. package/dist/esm/api/types/ChrtGptAssistantMessageItem.d.mts +8 -0
  85. package/dist/esm/api/types/ChrtGptAssistantMessageItem.mjs +4 -0
  86. package/dist/esm/api/types/ChrtGptCompletedEvent.d.mts +11 -0
  87. package/dist/esm/api/types/ChrtGptCompletedEvent.mjs +4 -0
  88. package/dist/esm/api/types/ChrtGptConversation1.d.mts +14 -0
  89. package/dist/esm/api/types/ChrtGptConversation1.mjs +4 -0
  90. package/dist/esm/api/types/ChrtGptConversationListRes.d.mts +8 -0
  91. package/dist/esm/api/types/ChrtGptConversationListRes.mjs +4 -0
  92. package/dist/esm/api/types/ChrtGptConversationRes.d.mts +9 -0
  93. package/dist/esm/api/types/ChrtGptConversationRes.mjs +4 -0
  94. package/dist/esm/api/types/ChrtGptConversationSortByEnum.d.mts +8 -0
  95. package/dist/esm/api/types/ChrtGptConversationSortByEnum.mjs +7 -0
  96. package/dist/esm/api/types/ChrtGptErrorEvent.d.mts +9 -0
  97. package/dist/esm/api/types/ChrtGptErrorEvent.mjs +4 -0
  98. package/dist/esm/api/types/ChrtGptEvent.d.mts +31 -0
  99. package/dist/esm/api/types/ChrtGptEvent.mjs +4 -0
  100. package/dist/esm/api/types/ChrtGptHistoryItem.d.mts +22 -0
  101. package/dist/esm/api/types/ChrtGptHistoryItem.mjs +4 -0
  102. package/dist/{cjs/api/types/ChrtGptMessageRes.d.ts → esm/api/types/ChrtGptStartedEvent.d.mts} +4 -2
  103. package/dist/esm/api/types/ChrtGptStartedEvent.mjs +4 -0
  104. package/dist/esm/api/types/ChrtGptTextDeltaEvent.d.mts +8 -0
  105. package/dist/esm/api/types/ChrtGptTextDeltaEvent.mjs +4 -0
  106. package/dist/esm/api/types/ChrtGptTitleEvent.d.mts +11 -0
  107. package/dist/esm/api/types/ChrtGptTitleEvent.mjs +4 -0
  108. package/dist/esm/api/types/ChrtGptToolCalledEvent.d.mts +12 -0
  109. package/dist/esm/api/types/ChrtGptToolCalledEvent.mjs +4 -0
  110. package/dist/esm/api/types/ChrtGptToolOutputEvent.d.mts +9 -0
  111. package/dist/esm/api/types/ChrtGptToolOutputEvent.mjs +4 -0
  112. package/dist/esm/api/types/ChrtGptUserMessageItem.d.mts +6 -0
  113. package/dist/esm/api/types/ChrtGptUserMessageItem.mjs +4 -0
  114. package/dist/esm/api/types/ChrtGptWebSearchEvent.d.mts +18 -0
  115. package/dist/esm/api/types/ChrtGptWebSearchEvent.mjs +4 -0
  116. package/dist/esm/api/types/index.d.mts +16 -1
  117. package/dist/esm/api/types/index.mjs +16 -1
  118. package/dist/esm/core/index.d.mts +1 -0
  119. package/dist/esm/core/index.mjs +1 -0
  120. package/dist/esm/core/stream/Stream.d.mts +46 -0
  121. package/dist/esm/core/stream/Stream.mjs +164 -0
  122. package/dist/esm/core/stream/index.d.mts +1 -0
  123. package/dist/esm/core/stream/index.mjs +1 -0
  124. package/dist/esm/version.d.mts +1 -1
  125. package/dist/esm/version.mjs +1 -1
  126. package/package.json +1 -1
  127. package/reference.md +141 -4
  128. /package/dist/cjs/api/resources/chrtGpt/client/requests/{ChrtGptMessageReq.js → ChrtGptReq.js} +0 -0
  129. /package/dist/cjs/api/{types/ChrtGptMessageRes.js → resources/chrtGpt/resources/conversations/client/requests/ConversationsListV1Request.js} +0 -0
  130. /package/dist/esm/api/resources/chrtGpt/client/requests/{ChrtGptMessageReq.mjs → ChrtGptReq.mjs} +0 -0
  131. /package/dist/esm/api/{types/ChrtGptMessageRes.mjs → resources/chrtGpt/resources/conversations/client/requests/ConversationsListV1Request.mjs} +0 -0
@@ -0,0 +1,4 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export {};
@@ -1,7 +1,9 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
- export interface ChrtGptMessageRes {
4
+ /**
5
+ * First event of every stream.
6
+ */
7
+ export interface ChrtGptStartedEvent {
5
8
  conversation_id: string;
6
- response_text: string;
7
9
  }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export {};
@@ -0,0 +1,8 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export interface ChrtGptTextDeltaEvent {
5
+ delta: string;
6
+ /** The assistant message this delta belongs to; a turn can have several. */
7
+ item_id: string;
8
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export {};
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * Sent once, on a new conversation's first turn, right before completed or error.
6
+ */
7
+ export interface ChrtGptTitleEvent {
8
+ conversation_id: string;
9
+ /** The conversation's saved title. */
10
+ title: string;
11
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export {};
@@ -0,0 +1,12 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * ChrtGPT called a chrt-mcp tool; its tool_output event follows.
6
+ */
7
+ export interface ChrtGptToolCalledEvent {
8
+ /** JSON-encoded tool arguments. */
9
+ arguments: string;
10
+ call_id: string;
11
+ name: string;
12
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export {};
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export interface ChrtGptToolOutputEvent {
5
+ /** The call_id of the tool_called event. */
6
+ call_id: string;
7
+ /** Text of the tool result: the tool's JSON output or an error message. */
8
+ output: string;
9
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export {};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export interface ChrtGptUserMessageItem {
5
+ text: string;
6
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export {};
@@ -0,0 +1,18 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Chrt from "../index.mjs";
5
+ /**
6
+ * OpenAI ran a web search for ChrtGPT; it has no tool_output event.
7
+ */
8
+ export interface ChrtGptWebSearchEvent {
9
+ action: ChrtGptWebSearchEvent.Action;
10
+ item_id: string;
11
+ /** What was searched for, on the web or within a page. OpenAI omits it on some searches. */
12
+ queries: string[];
13
+ /** The page opened or searched within. */
14
+ url?: string | null;
15
+ }
16
+ export declare namespace ChrtGptWebSearchEvent {
17
+ type Action = Chrt.ChrtGroundProviderTaskActionEnum1 | Chrt.CargoOnFlightTaskActionEnum1 | Chrt.OnboardCourierTaskActionEnum1;
18
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export {};
@@ -204,7 +204,22 @@ export * from "./ChampFlightStatus1.mjs";
204
204
  export * from "./ChampFlightStatusEvent1.mjs";
205
205
  export * from "./ChampOriginAndDestination.mjs";
206
206
  export * from "./ChampQuantity.mjs";
207
- export * from "./ChrtGptMessageRes.mjs";
207
+ export * from "./ChrtGptAssistantMessageItem.mjs";
208
+ export * from "./ChrtGptCompletedEvent.mjs";
209
+ export * from "./ChrtGptConversation1.mjs";
210
+ export * from "./ChrtGptConversationListRes.mjs";
211
+ export * from "./ChrtGptConversationRes.mjs";
212
+ export * from "./ChrtGptConversationSortByEnum.mjs";
213
+ export * from "./ChrtGptErrorEvent.mjs";
214
+ export * from "./ChrtGptEvent.mjs";
215
+ export * from "./ChrtGptHistoryItem.mjs";
216
+ export * from "./ChrtGptStartedEvent.mjs";
217
+ export * from "./ChrtGptTextDeltaEvent.mjs";
218
+ export * from "./ChrtGptTitleEvent.mjs";
219
+ export * from "./ChrtGptToolCalledEvent.mjs";
220
+ export * from "./ChrtGptToolOutputEvent.mjs";
221
+ export * from "./ChrtGptUserMessageItem.mjs";
222
+ export * from "./ChrtGptWebSearchEvent.mjs";
208
223
  export * from "./ChrtGroundProviderRates1.mjs";
209
224
  export * from "./ChrtGroundProviderRatesListRes.mjs";
210
225
  export * from "./ChrtGroundProviderRatesSortByEnum.mjs";
@@ -204,7 +204,22 @@ export * from "./ChampFlightStatus1.mjs";
204
204
  export * from "./ChampFlightStatusEvent1.mjs";
205
205
  export * from "./ChampOriginAndDestination.mjs";
206
206
  export * from "./ChampQuantity.mjs";
207
- export * from "./ChrtGptMessageRes.mjs";
207
+ export * from "./ChrtGptAssistantMessageItem.mjs";
208
+ export * from "./ChrtGptCompletedEvent.mjs";
209
+ export * from "./ChrtGptConversation1.mjs";
210
+ export * from "./ChrtGptConversationListRes.mjs";
211
+ export * from "./ChrtGptConversationRes.mjs";
212
+ export * from "./ChrtGptConversationSortByEnum.mjs";
213
+ export * from "./ChrtGptErrorEvent.mjs";
214
+ export * from "./ChrtGptEvent.mjs";
215
+ export * from "./ChrtGptHistoryItem.mjs";
216
+ export * from "./ChrtGptStartedEvent.mjs";
217
+ export * from "./ChrtGptTextDeltaEvent.mjs";
218
+ export * from "./ChrtGptTitleEvent.mjs";
219
+ export * from "./ChrtGptToolCalledEvent.mjs";
220
+ export * from "./ChrtGptToolOutputEvent.mjs";
221
+ export * from "./ChrtGptUserMessageItem.mjs";
222
+ export * from "./ChrtGptWebSearchEvent.mjs";
208
223
  export * from "./ChrtGroundProviderRates1.mjs";
209
224
  export * from "./ChrtGroundProviderRatesListRes.mjs";
210
225
  export * from "./ChrtGroundProviderRatesSortByEnum.mjs";
@@ -3,5 +3,6 @@ export * from "./runtime/index.mjs";
3
3
  export * as url from "./url/index.mjs";
4
4
  export * from "./auth/index.mjs";
5
5
  export * from "./base64.mjs";
6
+ export * from "./stream/index.mjs";
6
7
  export * from "./form-data-utils/index.mjs";
7
8
  export * as file from "./file/index.mjs";
@@ -3,5 +3,6 @@ export * from "./runtime/index.mjs";
3
3
  export * as url from "./url/index.mjs";
4
4
  export * from "./auth/index.mjs";
5
5
  export * from "./base64.mjs";
6
+ export * from "./stream/index.mjs";
6
7
  export * from "./form-data-utils/index.mjs";
7
8
  export * as file from "./file/index.mjs";
@@ -0,0 +1,46 @@
1
+ export declare namespace Stream {
2
+ interface Args {
3
+ /**
4
+ * The HTTP response stream to read from.
5
+ */
6
+ stream: ReadableStream;
7
+ /**
8
+ * The event shape to use for parsing the stream data.
9
+ */
10
+ eventShape: JsonEvent | SseEvent;
11
+ /**
12
+ * An abort signal to stop the stream.
13
+ */
14
+ signal?: AbortSignal;
15
+ }
16
+ interface JsonEvent {
17
+ type: "json";
18
+ messageTerminator: string;
19
+ }
20
+ interface SseEvent {
21
+ type: "sse";
22
+ streamTerminator?: string;
23
+ }
24
+ }
25
+ export declare class Stream<T> implements AsyncIterable<T> {
26
+ private stream;
27
+ private parse;
28
+ /**
29
+ * The prefix to use for each message. For example,
30
+ * for SSE, the prefix is "data: ".
31
+ */
32
+ private prefix;
33
+ private messageTerminator;
34
+ private streamTerminator;
35
+ private controller;
36
+ constructor({ stream, parse, eventShape, signal }: Stream.Args & {
37
+ parse: (val: unknown) => Promise<T>;
38
+ });
39
+ private iterMessages;
40
+ [Symbol.asyncIterator](): AsyncIterator<T, void, unknown>;
41
+ private decodeChunk;
42
+ }
43
+ /**
44
+ * Browser polyfill for ReadableStream
45
+ */
46
+ export declare function readableStreamAsyncIterable<T>(stream: any): AsyncIterableIterator<T>;
@@ -0,0 +1,164 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __asyncValues = (this && this.__asyncValues) || function (o) {
11
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
12
+ var m = o[Symbol.asyncIterator], i;
13
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
14
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
15
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
16
+ };
17
+ var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
18
+ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
19
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
20
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
21
+ return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
22
+ function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
23
+ function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
24
+ function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
25
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
26
+ function fulfill(value) { resume("next", value); }
27
+ function reject(value) { resume("throw", value); }
28
+ function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
29
+ };
30
+ import { RUNTIME } from "../runtime/index.mjs";
31
+ const DATA_PREFIX = "data:";
32
+ export class Stream {
33
+ constructor({ stream, parse, eventShape, signal }) {
34
+ this.controller = new AbortController();
35
+ this.stream = stream;
36
+ this.parse = parse;
37
+ if (eventShape.type === "sse") {
38
+ this.prefix = DATA_PREFIX;
39
+ this.messageTerminator = "\n";
40
+ this.streamTerminator = eventShape.streamTerminator;
41
+ }
42
+ else {
43
+ this.messageTerminator = eventShape.messageTerminator;
44
+ }
45
+ signal === null || signal === void 0 ? void 0 : signal.addEventListener("abort", () => this.controller.abort());
46
+ }
47
+ iterMessages() {
48
+ return __asyncGenerator(this, arguments, function* iterMessages_1() {
49
+ var _a, e_1, _b, _c;
50
+ this.controller.signal;
51
+ const stream = readableStreamAsyncIterable(this.stream);
52
+ let buf = "";
53
+ let prefixSeen = false;
54
+ try {
55
+ for (var _d = true, stream_1 = __asyncValues(stream), stream_1_1; stream_1_1 = yield __await(stream_1.next()), _a = stream_1_1.done, !_a; _d = true) {
56
+ _c = stream_1_1.value;
57
+ _d = false;
58
+ const chunk = _c;
59
+ buf += this.decodeChunk(chunk);
60
+ let terminatorIndex;
61
+ while ((terminatorIndex = buf.indexOf(this.messageTerminator)) >= 0) {
62
+ let line = buf.slice(0, terminatorIndex + 1);
63
+ buf = buf.slice(terminatorIndex + this.messageTerminator.length);
64
+ if (!line.trim()) {
65
+ continue;
66
+ }
67
+ if (!prefixSeen && this.prefix != null) {
68
+ const prefixIndex = line.indexOf(this.prefix);
69
+ if (prefixIndex === -1) {
70
+ continue;
71
+ }
72
+ prefixSeen = true;
73
+ line = line.slice(prefixIndex + this.prefix.length);
74
+ }
75
+ if (this.streamTerminator != null && line.includes(this.streamTerminator)) {
76
+ return yield __await(void 0);
77
+ }
78
+ const message = yield __await(this.parse(JSON.parse(line)));
79
+ yield yield __await(message);
80
+ prefixSeen = false;
81
+ }
82
+ }
83
+ }
84
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
85
+ finally {
86
+ try {
87
+ if (!_d && !_a && (_b = stream_1.return)) yield __await(_b.call(stream_1));
88
+ }
89
+ finally { if (e_1) throw e_1.error; }
90
+ }
91
+ });
92
+ }
93
+ [Symbol.asyncIterator]() {
94
+ return __asyncGenerator(this, arguments, function* _a() {
95
+ var _b, e_2, _c, _d;
96
+ try {
97
+ for (var _e = true, _f = __asyncValues(this.iterMessages()), _g; _g = yield __await(_f.next()), _b = _g.done, !_b; _e = true) {
98
+ _d = _g.value;
99
+ _e = false;
100
+ const message = _d;
101
+ yield yield __await(message);
102
+ }
103
+ }
104
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
105
+ finally {
106
+ try {
107
+ if (!_e && !_b && (_c = _f.return)) yield __await(_c.call(_f));
108
+ }
109
+ finally { if (e_2) throw e_2.error; }
110
+ }
111
+ });
112
+ }
113
+ decodeChunk(chunk) {
114
+ let decoded = "";
115
+ // If TextDecoder is present, use it
116
+ if (typeof TextDecoder !== "undefined") {
117
+ const decoder = new TextDecoder("utf8");
118
+ decoded += decoder.decode(chunk);
119
+ }
120
+ // Buffer is present in Node.js environment
121
+ else if (RUNTIME.type === "node" && typeof chunk !== "undefined") {
122
+ decoded += Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
123
+ }
124
+ return decoded;
125
+ }
126
+ }
127
+ /**
128
+ * Browser polyfill for ReadableStream
129
+ */
130
+ // biome-ignore lint/suspicious/noExplicitAny: allow explicit any
131
+ export function readableStreamAsyncIterable(stream) {
132
+ if (stream[Symbol.asyncIterator]) {
133
+ return stream;
134
+ }
135
+ const reader = stream.getReader();
136
+ return {
137
+ next() {
138
+ return __awaiter(this, void 0, void 0, function* () {
139
+ try {
140
+ const result = yield reader.read();
141
+ if (result === null || result === void 0 ? void 0 : result.done) {
142
+ reader.releaseLock();
143
+ } // release lock when stream becomes closed
144
+ return result;
145
+ }
146
+ catch (e) {
147
+ reader.releaseLock(); // release lock when stream becomes errored
148
+ throw e;
149
+ }
150
+ });
151
+ },
152
+ return() {
153
+ return __awaiter(this, void 0, void 0, function* () {
154
+ const cancelPromise = reader.cancel();
155
+ reader.releaseLock();
156
+ yield cancelPromise;
157
+ return { done: true, value: undefined };
158
+ });
159
+ },
160
+ [Symbol.asyncIterator]() {
161
+ return this;
162
+ },
163
+ };
164
+ }
@@ -0,0 +1 @@
1
+ export { Stream } from "./Stream.mjs";
@@ -0,0 +1 @@
1
+ export { Stream } from "./Stream.mjs";
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "1.1025.0";
1
+ export declare const SDK_VERSION = "1.1026.0";
@@ -1 +1 @@
1
- export const SDK_VERSION = "1.1025.0";
1
+ export const SDK_VERSION = "1.1026.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chrt-inc/typescript-sdk",
3
- "version": "1.1025.0",
3
+ "version": "1.1026.0",
4
4
  "private": false,
5
5
  "repository": "github:chrt-inc/typescript-sdk",
6
6
  "type": "commonjs",
package/reference.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## ChrtGpt
4
4
 
5
- <details><summary><code>client.chrtGpt.<a href="/src/api/resources/chrtGpt/client/Client.ts">messageV1</a>({ ...params }) -> Chrt.ChrtGptMessageRes</code></summary>
5
+ <details><summary><code>client.chrtGpt.<a href="/src/api/resources/chrtGpt/client/Client.ts">postV1</a>({ ...params }) -> core.Stream&lt;Chrt.ChrtGptEvent&gt;</code></summary>
6
6
  <dl>
7
7
  <dd>
8
8
 
@@ -14,7 +14,7 @@
14
14
  <dl>
15
15
  <dd>
16
16
 
17
- Sends a message to ChrtGPT and returns its reply, starting a new conversation when no conversation_id is given. | authz: allowed_org_types=[shipper, provider], min_org_role=operator | (ChrtGPTMessageReq) -> (ChrtGPTMessageRes)
17
+ Sends a message to ChrtGPT and streams its reply, starting and titling a new conversation when no conversation_id is given. | authz: allowed_org_types=[shipper, provider], min_org_role=operator | (ChrtGPTReq) -> (stream[ChrtGPTEvent])
18
18
 
19
19
  </dd>
20
20
  </dl>
@@ -30,9 +30,12 @@ Sends a message to ChrtGPT and returns its reply, starting a new conversation wh
30
30
  <dd>
31
31
 
32
32
  ```typescript
33
- await client.chrtGpt.messageV1({
33
+ const response = await client.chrtGpt.postV1({
34
34
  message: "message",
35
35
  });
36
+ for await (const item of response) {
37
+ console.log(item);
38
+ }
36
39
  ```
37
40
 
38
41
  </dd>
@@ -48,7 +51,7 @@ await client.chrtGpt.messageV1({
48
51
  <dl>
49
52
  <dd>
50
53
 
51
- **request:** `Chrt.ChrtGptMessageReq`
54
+ **request:** `Chrt.ChrtGptReq`
52
55
 
53
56
  </dd>
54
57
  </dl>
@@ -5198,6 +5201,139 @@ await client.cargoOnFlightIntegrations.cargoai.searchV1("cargo_on_flight_booking
5198
5201
  </dl>
5199
5202
  </details>
5200
5203
 
5204
+ ## ChrtGpt Conversations
5205
+
5206
+ <details><summary><code>client.chrtGpt.conversations.<a href="/src/api/resources/chrtGpt/resources/conversations/client/Client.ts">listV1</a>({ ...params }) -> Chrt.ChrtGptConversationListRes</code></summary>
5207
+ <dl>
5208
+ <dd>
5209
+
5210
+ #### 📝 Description
5211
+
5212
+ <dl>
5213
+ <dd>
5214
+
5215
+ <dl>
5216
+ <dd>
5217
+
5218
+ Lists the caller's ChrtGPT conversations, most recently active first by default. | authz: allowed_org_types=[shipper, provider], min_org_role=operator | () -> (ChrtGPTConversationListRes)
5219
+
5220
+ </dd>
5221
+ </dl>
5222
+ </dd>
5223
+ </dl>
5224
+
5225
+ #### 🔌 Usage
5226
+
5227
+ <dl>
5228
+ <dd>
5229
+
5230
+ <dl>
5231
+ <dd>
5232
+
5233
+ ```typescript
5234
+ await client.chrtGpt.conversations.listV1({
5235
+ sort_by: "updated_at",
5236
+ sort_order: "asc",
5237
+ page: 1,
5238
+ page_size: 1,
5239
+ });
5240
+ ```
5241
+
5242
+ </dd>
5243
+ </dl>
5244
+ </dd>
5245
+ </dl>
5246
+
5247
+ #### ⚙️ Parameters
5248
+
5249
+ <dl>
5250
+ <dd>
5251
+
5252
+ <dl>
5253
+ <dd>
5254
+
5255
+ **request:** `Chrt.chrtGpt.ConversationsListV1Request`
5256
+
5257
+ </dd>
5258
+ </dl>
5259
+
5260
+ <dl>
5261
+ <dd>
5262
+
5263
+ **requestOptions:** `Conversations.RequestOptions`
5264
+
5265
+ </dd>
5266
+ </dl>
5267
+ </dd>
5268
+ </dl>
5269
+
5270
+ </dd>
5271
+ </dl>
5272
+ </details>
5273
+
5274
+ <details><summary><code>client.chrtGpt.conversations.<a href="/src/api/resources/chrtGpt/resources/conversations/client/Client.ts">getV1</a>(conversationId) -> Chrt.ChrtGptConversationRes</code></summary>
5275
+ <dl>
5276
+ <dd>
5277
+
5278
+ #### 📝 Description
5279
+
5280
+ <dl>
5281
+ <dd>
5282
+
5283
+ <dl>
5284
+ <dd>
5285
+
5286
+ 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)
5287
+
5288
+ </dd>
5289
+ </dl>
5290
+ </dd>
5291
+ </dl>
5292
+
5293
+ #### 🔌 Usage
5294
+
5295
+ <dl>
5296
+ <dd>
5297
+
5298
+ <dl>
5299
+ <dd>
5300
+
5301
+ ```typescript
5302
+ await client.chrtGpt.conversations.getV1("conversation_id");
5303
+ ```
5304
+
5305
+ </dd>
5306
+ </dl>
5307
+ </dd>
5308
+ </dl>
5309
+
5310
+ #### ⚙️ Parameters
5311
+
5312
+ <dl>
5313
+ <dd>
5314
+
5315
+ <dl>
5316
+ <dd>
5317
+
5318
+ **conversationId:** `string`
5319
+
5320
+ </dd>
5321
+ </dl>
5322
+
5323
+ <dl>
5324
+ <dd>
5325
+
5326
+ **requestOptions:** `Conversations.RequestOptions`
5327
+
5328
+ </dd>
5329
+ </dl>
5330
+ </dd>
5331
+ </dl>
5332
+
5333
+ </dd>
5334
+ </dl>
5335
+ </details>
5336
+
5201
5337
  ## Integrations AirWaybills
5202
5338
 
5203
5339
  <details><summary><code>client.integrations.airWaybills.<a href="/src/api/resources/integrations/resources/airWaybills/client/Client.ts">confirmationsV1</a>(taskGroupId) -> Chrt.ChampConfirmationReceipt1[]</code></summary>
@@ -27119,6 +27255,7 @@ await client.shipping.taskArtifacts.s3Object.writeAiImageDescriptionV1("task_art
27119
27255
  location_identifiers: ["location_identifiers"],
27120
27256
  model: "gpt-6-astra",
27121
27257
  package_appearance: "package_appearance",
27258
+ package_count: undefined,
27122
27259
  package_types: ["package_types"],
27123
27260
  proof_notes: ["proof_notes"],
27124
27261
  readable_package_text: ["readable_package_text"],