@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,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,4 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export {};
@@ -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,4 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export {};
@@ -0,0 +1,22 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Chrt from "../index.mjs";
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,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
+ import * as Chrt from "../index.mjs";
5
+ export interface ChrtGptConversationListRes {
6
+ items: Chrt.ChrtGptConversation1[];
7
+ total_count: number;
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
+ import * as Chrt from "../index.mjs";
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,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 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,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export const ChrtGptConversationSortByEnum = {
5
+ UpdatedAt: "updated_at",
6
+ CreatedAt: "created_at",
7
+ };
@@ -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
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export const ChrtGptConversationTitleSourceEnum1 = {
5
+ Fallback: "fallback",
6
+ Ai: "ai",
7
+ User: "user",
8
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export interface ChrtGptConversationsDeleteManyRes {
5
+ /** The requested conversations this call deleted; skipped IDs are left out. */
6
+ deleted_conversation_ids: string[];
7
+ }
@@ -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
+ /**
5
+ * Last event of a failed stream.
6
+ */
7
+ export interface ChrtGptErrorEvent {
8
+ message: 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,28 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Chrt from "../index.mjs";
5
+ export type ChrtGptEvent = Chrt.ChrtGptEvent.Completed | Chrt.ChrtGptEvent.Error_ | Chrt.ChrtGptEvent.Started | Chrt.ChrtGptEvent.TextDelta | Chrt.ChrtGptEvent.ToolCalled | Chrt.ChrtGptEvent.ToolOutput | Chrt.ChrtGptEvent.WebSearch;
6
+ export declare namespace ChrtGptEvent {
7
+ interface Completed extends Chrt.ChrtGptCompletedEvent {
8
+ type: "completed";
9
+ }
10
+ interface Error_ extends Chrt.ChrtGptErrorEvent {
11
+ type: "error";
12
+ }
13
+ interface Started extends Chrt.ChrtGptStartedEvent {
14
+ type: "started";
15
+ }
16
+ interface TextDelta extends Chrt.ChrtGptTextDeltaEvent {
17
+ type: "text_delta";
18
+ }
19
+ interface ToolCalled extends Chrt.ChrtGptToolCalledEvent {
20
+ type: "tool_called";
21
+ }
22
+ interface ToolOutput extends Chrt.ChrtGptToolOutputEvent {
23
+ type: "tool_output";
24
+ }
25
+ interface WebSearch extends Chrt.ChrtGptWebSearchEvent {
26
+ type: "web_search";
27
+ }
28
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export {};
@@ -0,0 +1,22 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Chrt from "../index.mjs";
5
+ export type ChrtGptHistoryItem = Chrt.ChrtGptHistoryItem.AssistantMessage | Chrt.ChrtGptHistoryItem.ToolCalled | Chrt.ChrtGptHistoryItem.ToolOutput | Chrt.ChrtGptHistoryItem.UserMessage | Chrt.ChrtGptHistoryItem.WebSearch;
6
+ export declare namespace ChrtGptHistoryItem {
7
+ interface AssistantMessage extends Chrt.ChrtGptAssistantMessageItem {
8
+ type: "assistant_message";
9
+ }
10
+ interface ToolCalled extends Chrt.ChrtGptToolCalledEvent {
11
+ type: "tool_called";
12
+ }
13
+ interface ToolOutput extends Chrt.ChrtGptToolOutputEvent {
14
+ type: "tool_output";
15
+ }
16
+ interface UserMessage extends Chrt.ChrtGptUserMessageItem {
17
+ type: "user_message";
18
+ }
19
+ interface WebSearch extends Chrt.ChrtGptWebSearchEvent {
20
+ type: "web_search";
21
+ }
22
+ }
@@ -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,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,23 @@ 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 "./ChrtGptConversationTitleSourceEnum1.mjs";
214
+ export * from "./ChrtGptConversationsDeleteManyRes.mjs";
215
+ export * from "./ChrtGptErrorEvent.mjs";
216
+ export * from "./ChrtGptEvent.mjs";
217
+ export * from "./ChrtGptHistoryItem.mjs";
218
+ export * from "./ChrtGptStartedEvent.mjs";
219
+ export * from "./ChrtGptTextDeltaEvent.mjs";
220
+ export * from "./ChrtGptToolCalledEvent.mjs";
221
+ export * from "./ChrtGptToolOutputEvent.mjs";
222
+ export * from "./ChrtGptUserMessageItem.mjs";
223
+ export * from "./ChrtGptWebSearchEvent.mjs";
208
224
  export * from "./ChrtGroundProviderRates1.mjs";
209
225
  export * from "./ChrtGroundProviderRatesListRes.mjs";
210
226
  export * from "./ChrtGroundProviderRatesSortByEnum.mjs";
@@ -204,7 +204,23 @@ 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 "./ChrtGptConversationTitleSourceEnum1.mjs";
214
+ export * from "./ChrtGptConversationsDeleteManyRes.mjs";
215
+ export * from "./ChrtGptErrorEvent.mjs";
216
+ export * from "./ChrtGptEvent.mjs";
217
+ export * from "./ChrtGptHistoryItem.mjs";
218
+ export * from "./ChrtGptStartedEvent.mjs";
219
+ export * from "./ChrtGptTextDeltaEvent.mjs";
220
+ export * from "./ChrtGptToolCalledEvent.mjs";
221
+ export * from "./ChrtGptToolOutputEvent.mjs";
222
+ export * from "./ChrtGptUserMessageItem.mjs";
223
+ export * from "./ChrtGptWebSearchEvent.mjs";
208
224
  export * from "./ChrtGroundProviderRates1.mjs";
209
225
  export * from "./ChrtGroundProviderRatesListRes.mjs";
210
226
  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.1027.0";
@@ -1 +1 @@
1
- export const SDK_VERSION = "1.1025.0";
1
+ export const SDK_VERSION = "1.1027.0";