@arcships/aimux 0.5.0 → 0.6.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 (305) hide show
  1. package/README.md +92 -0
  2. package/dist/error.d.ts +28 -137
  3. package/dist/error.js +71 -100
  4. package/dist/generated/ops.d.ts +75 -0
  5. package/dist/generated/ops.js +80 -0
  6. package/dist/generated/types.d.ts +5607 -0
  7. package/dist/{types/CallOptions.js → generated/types.js} +1 -0
  8. package/dist/index.d.ts +144 -211
  9. package/dist/index.js +314 -344
  10. package/dist/native.d.ts +29 -1
  11. package/dist/native.js +99 -29
  12. package/dist/types.d.ts +1 -144
  13. package/dist/types.js +0 -3
  14. package/index.d.ts +21 -545
  15. package/index.js +57 -112
  16. package/package.json +16 -13
  17. package/dist/types/AiMuxError.d.ts +0 -66
  18. package/dist/types/AiMuxError.js +0 -2
  19. package/dist/types/ApiCallError.d.ts +0 -75
  20. package/dist/types/ApiCallError.js +0 -2
  21. package/dist/types/AspectRatio.d.ts +0 -11
  22. package/dist/types/AspectRatio.js +0 -3
  23. package/dist/types/AudioChunk.d.ts +0 -8
  24. package/dist/types/AudioChunk.js +0 -3
  25. package/dist/types/AudioData.d.ts +0 -11
  26. package/dist/types/AudioData.js +0 -3
  27. package/dist/types/AudioInput.d.ts +0 -8
  28. package/dist/types/AudioInput.js +0 -3
  29. package/dist/types/BreakKind.d.ts +0 -1
  30. package/dist/types/BreakKind.js +0 -3
  31. package/dist/types/CallOptions.d.ts +0 -117
  32. package/dist/types/CatalogueSource.d.ts +0 -4
  33. package/dist/types/CatalogueSource.js +0 -3
  34. package/dist/types/ChatCompletion.d.ts +0 -16
  35. package/dist/types/ChatCompletion.js +0 -2
  36. package/dist/types/ChatCompletionChoice.d.ts +0 -8
  37. package/dist/types/ChatCompletionChoice.js +0 -2
  38. package/dist/types/ChatCompletionChunk.d.ts +0 -15
  39. package/dist/types/ChatCompletionChunk.js +0 -2
  40. package/dist/types/ChatCompletionChunkChoice.d.ts +0 -8
  41. package/dist/types/ChatCompletionChunkChoice.js +0 -2
  42. package/dist/types/ChatCompletionChunkFunction.d.ts +0 -4
  43. package/dist/types/ChatCompletionChunkFunction.js +0 -3
  44. package/dist/types/ChatCompletionChunkToolCall.d.ts +0 -7
  45. package/dist/types/ChatCompletionChunkToolCall.js +0 -2
  46. package/dist/types/ChatCompletionDelta.d.ts +0 -7
  47. package/dist/types/ChatCompletionDelta.js +0 -2
  48. package/dist/types/ChatCompletionFunction.d.ts +0 -4
  49. package/dist/types/ChatCompletionFunction.js +0 -3
  50. package/dist/types/ChatCompletionMessage.d.ts +0 -9
  51. package/dist/types/ChatCompletionMessage.js +0 -2
  52. package/dist/types/ChatCompletionToolCall.d.ts +0 -6
  53. package/dist/types/ChatCompletionToolCall.js +0 -2
  54. package/dist/types/ChatCompletionUsage.d.ts +0 -9
  55. package/dist/types/ChatCompletionUsage.js +0 -2
  56. package/dist/types/CompletionTokensDetails.d.ts +0 -3
  57. package/dist/types/CompletionTokensDetails.js +0 -3
  58. package/dist/types/ContentPart.d.ts +0 -112
  59. package/dist/types/ContentPart.js +0 -2
  60. package/dist/types/EmbeddingCallOptions.d.ts +0 -33
  61. package/dist/types/EmbeddingCallOptions.js +0 -2
  62. package/dist/types/EmbeddingResponse.d.ts +0 -16
  63. package/dist/types/EmbeddingResponse.js +0 -2
  64. package/dist/types/EmbeddingResult.d.ts +0 -33
  65. package/dist/types/EmbeddingResult.js +0 -2
  66. package/dist/types/EmbeddingUsage.d.ts +0 -9
  67. package/dist/types/EmbeddingUsage.js +0 -3
  68. package/dist/types/FileBytes.d.ts +0 -12
  69. package/dist/types/FileBytes.js +0 -3
  70. package/dist/types/FileData.d.ts +0 -25
  71. package/dist/types/FileData.js +0 -2
  72. package/dist/types/FilePart.d.ts +0 -8
  73. package/dist/types/FilePart.js +0 -2
  74. package/dist/types/Fingerprint.d.ts +0 -21
  75. package/dist/types/Fingerprint.js +0 -3
  76. package/dist/types/FinishReason.d.ts +0 -14
  77. package/dist/types/FinishReason.js +0 -2
  78. package/dist/types/FinishReasonUnified.d.ts +0 -4
  79. package/dist/types/FinishReasonUnified.js +0 -3
  80. package/dist/types/FunctionTool.d.ts +0 -35
  81. package/dist/types/FunctionTool.js +0 -2
  82. package/dist/types/GenerateContent.d.ts +0 -88
  83. package/dist/types/GenerateContent.js +0 -2
  84. package/dist/types/GenerateObjectResult.d.ts +0 -48
  85. package/dist/types/GenerateObjectResult.js +0 -2
  86. package/dist/types/GenerateResult.d.ts +0 -45
  87. package/dist/types/GenerateResult.js +0 -2
  88. package/dist/types/GenerateTextOptions.d.ts +0 -62
  89. package/dist/types/GenerateTextOptions.js +0 -2
  90. package/dist/types/GenerateTextResult.d.ts +0 -81
  91. package/dist/types/GenerateTextResult.js +0 -2
  92. package/dist/types/HttpExchange.d.ts +0 -34
  93. package/dist/types/HttpExchange.js +0 -2
  94. package/dist/types/HttpRecord.d.ts +0 -12
  95. package/dist/types/HttpRecord.js +0 -3
  96. package/dist/types/ImageCallOptions.d.ts +0 -63
  97. package/dist/types/ImageCallOptions.js +0 -2
  98. package/dist/types/ImageFile.d.ts +0 -25
  99. package/dist/types/ImageFile.js +0 -2
  100. package/dist/types/ImageFileData.d.ts +0 -8
  101. package/dist/types/ImageFileData.js +0 -3
  102. package/dist/types/ImageOutputs.d.ts +0 -14
  103. package/dist/types/ImageOutputs.js +0 -3
  104. package/dist/types/ImageResponse.d.ts +0 -19
  105. package/dist/types/ImageResponse.js +0 -3
  106. package/dist/types/ImageResult.d.ts +0 -34
  107. package/dist/types/ImageResult.js +0 -2
  108. package/dist/types/ImageUsage.d.ts +0 -19
  109. package/dist/types/ImageUsage.js +0 -3
  110. package/dist/types/InputAudioFormat.d.ts +0 -13
  111. package/dist/types/InputAudioFormat.js +0 -3
  112. package/dist/types/InputRecord.d.ts +0 -16
  113. package/dist/types/InputRecord.js +0 -2
  114. package/dist/types/LanguageModelPromptMessage.d.ts +0 -20
  115. package/dist/types/LanguageModelPromptMessage.js +0 -2
  116. package/dist/types/MessageContent.d.ts +0 -5
  117. package/dist/types/MessageContent.js +0 -2
  118. package/dist/types/Modality.d.ts +0 -4
  119. package/dist/types/Modality.js +0 -3
  120. package/dist/types/ModelCapabilities.d.ts +0 -21
  121. package/dist/types/ModelCapabilities.js +0 -3
  122. package/dist/types/ModelCost.d.ts +0 -10
  123. package/dist/types/ModelCost.js +0 -3
  124. package/dist/types/ModelId.d.ts +0 -7
  125. package/dist/types/ModelId.js +0 -3
  126. package/dist/types/ModelLimits.d.ts +0 -17
  127. package/dist/types/ModelLimits.js +0 -3
  128. package/dist/types/ModelMessage.d.ts +0 -9
  129. package/dist/types/ModelMessage.js +0 -2
  130. package/dist/types/ModelModalities.d.ts +0 -8
  131. package/dist/types/ModelModalities.js +0 -2
  132. package/dist/types/ModelPrompt.d.ts +0 -7
  133. package/dist/types/ModelPrompt.js +0 -2
  134. package/dist/types/ModelSpec.d.ts +0 -33
  135. package/dist/types/ModelSpec.js +0 -2
  136. package/dist/types/ModelType.d.ts +0 -4
  137. package/dist/types/ModelType.js +0 -3
  138. package/dist/types/OutcomeRecord.d.ts +0 -19
  139. package/dist/types/OutcomeRecord.js +0 -2
  140. package/dist/types/OutcomeStatus.d.ts +0 -4
  141. package/dist/types/OutcomeStatus.js +0 -3
  142. package/dist/types/PrefixBreak.d.ts +0 -11
  143. package/dist/types/PrefixBreak.js +0 -2
  144. package/dist/types/PromptTokensDetails.d.ts +0 -4
  145. package/dist/types/PromptTokensDetails.js +0 -3
  146. package/dist/types/ProviderAuditSpec.d.ts +0 -33
  147. package/dist/types/ProviderAuditSpec.js +0 -2
  148. package/dist/types/ProviderFamily.d.ts +0 -5
  149. package/dist/types/ProviderFamily.js +0 -3
  150. package/dist/types/ProviderName.d.ts +0 -258
  151. package/dist/types/ProviderName.js +0 -262
  152. package/dist/types/ProviderRecord.d.ts +0 -30
  153. package/dist/types/ProviderRecord.js +0 -2
  154. package/dist/types/ProviderTool.d.ts +0 -24
  155. package/dist/types/ProviderTool.js +0 -2
  156. package/dist/types/RawToolCall.d.ts +0 -16
  157. package/dist/types/RawToolCall.js +0 -2
  158. package/dist/types/ReasoningEffort.d.ts +0 -7
  159. package/dist/types/ReasoningEffort.js +0 -3
  160. package/dist/types/ReasoningMode.d.ts +0 -4
  161. package/dist/types/ReasoningMode.js +0 -3
  162. package/dist/types/ReasoningPart.d.ts +0 -9
  163. package/dist/types/ReasoningPart.js +0 -3
  164. package/dist/types/ReasoningSpec.d.ts +0 -39
  165. package/dist/types/ReasoningSpec.js +0 -2
  166. package/dist/types/ReasoningVisibility.d.ts +0 -4
  167. package/dist/types/ReasoningVisibility.js +0 -3
  168. package/dist/types/Recording.d.ts +0 -56
  169. package/dist/types/Recording.js +0 -2
  170. package/dist/types/RequestCacheHints.d.ts +0 -9
  171. package/dist/types/RequestCacheHints.js +0 -3
  172. package/dist/types/RequestInfo.d.ts +0 -12
  173. package/dist/types/RequestInfo.js +0 -2
  174. package/dist/types/RerankingCallOptions.d.ts +0 -42
  175. package/dist/types/RerankingCallOptions.js +0 -2
  176. package/dist/types/RerankingDocuments.d.ts +0 -15
  177. package/dist/types/RerankingDocuments.js +0 -2
  178. package/dist/types/RerankingRank.d.ts +0 -13
  179. package/dist/types/RerankingRank.js +0 -3
  180. package/dist/types/RerankingResponse.d.ts +0 -28
  181. package/dist/types/RerankingResponse.js +0 -2
  182. package/dist/types/RerankingResult.d.ts +0 -31
  183. package/dist/types/RerankingResult.js +0 -2
  184. package/dist/types/ResponseFormat.d.ts +0 -11
  185. package/dist/types/ResponseFormat.js +0 -2
  186. package/dist/types/ResponseInfo.d.ts +0 -30
  187. package/dist/types/ResponseInfo.js +0 -2
  188. package/dist/types/ResponseMetadata.d.ts +0 -8
  189. package/dist/types/ResponseMetadata.js +0 -3
  190. package/dist/types/ResponseRecord.d.ts +0 -13
  191. package/dist/types/ResponseRecord.js +0 -3
  192. package/dist/types/RetryError.d.ts +0 -9
  193. package/dist/types/RetryError.js +0 -2
  194. package/dist/types/RetryErrorReason.d.ts +0 -4
  195. package/dist/types/RetryErrorReason.js +0 -3
  196. package/dist/types/Role.d.ts +0 -4
  197. package/dist/types/Role.js +0 -3
  198. package/dist/types/RuntimeModel.d.ts +0 -22
  199. package/dist/types/RuntimeModel.js +0 -3
  200. package/dist/types/SearchCallOptions.d.ts +0 -55
  201. package/dist/types/SearchCallOptions.js +0 -2
  202. package/dist/types/SearchResponse.d.ts +0 -16
  203. package/dist/types/SearchResponse.js +0 -2
  204. package/dist/types/SearchResult.d.ts +0 -32
  205. package/dist/types/SearchResult.js +0 -2
  206. package/dist/types/SearchResultItem.d.ts +0 -33
  207. package/dist/types/SearchResultItem.js +0 -2
  208. package/dist/types/SessionCall.d.ts +0 -20
  209. package/dist/types/SessionCall.js +0 -3
  210. package/dist/types/SessionChainView.d.ts +0 -10
  211. package/dist/types/SessionChainView.js +0 -2
  212. package/dist/types/SessionSource.d.ts +0 -4
  213. package/dist/types/SessionSource.js +0 -3
  214. package/dist/types/SessionStepStat.d.ts +0 -27
  215. package/dist/types/SessionStepStat.js +0 -2
  216. package/dist/types/SessionView.d.ts +0 -16
  217. package/dist/types/SessionView.js +0 -2
  218. package/dist/types/Size.d.ts +0 -11
  219. package/dist/types/Size.js +0 -3
  220. package/dist/types/SourcePart.d.ts +0 -9
  221. package/dist/types/SourcePart.js +0 -3
  222. package/dist/types/SpeechCallOptions.d.ts +0 -56
  223. package/dist/types/SpeechCallOptions.js +0 -2
  224. package/dist/types/SpeechRequest.d.ts +0 -10
  225. package/dist/types/SpeechRequest.js +0 -2
  226. package/dist/types/SpeechResponse.d.ts +0 -24
  227. package/dist/types/SpeechResponse.js +0 -2
  228. package/dist/types/SpeechResult.d.ts +0 -34
  229. package/dist/types/SpeechResult.js +0 -2
  230. package/dist/types/StreamPart.d.ts +0 -173
  231. package/dist/types/StreamPart.js +0 -2
  232. package/dist/types/StreamTextResultAggregated.d.ts +0 -74
  233. package/dist/types/StreamTextResultAggregated.js +0 -2
  234. package/dist/types/TimeoutConfiguration.d.ts +0 -32
  235. package/dist/types/TimeoutConfiguration.js +0 -3
  236. package/dist/types/TimingRecord.d.ts +0 -7
  237. package/dist/types/TimingRecord.js +0 -3
  238. package/dist/types/TokenUsage.d.ts +0 -29
  239. package/dist/types/TokenUsage.js +0 -3
  240. package/dist/types/Tool.d.ts +0 -12
  241. package/dist/types/Tool.js +0 -2
  242. package/dist/types/ToolCall.d.ts +0 -48
  243. package/dist/types/ToolCall.js +0 -2
  244. package/dist/types/ToolCallRepairReply.d.ts +0 -19
  245. package/dist/types/ToolCallRepairReply.js +0 -2
  246. package/dist/types/ToolChoice.d.ts +0 -12
  247. package/dist/types/ToolChoice.js +0 -3
  248. package/dist/types/ToolResult.d.ts +0 -22
  249. package/dist/types/ToolResult.js +0 -2
  250. package/dist/types/TraceFilter.d.ts +0 -9
  251. package/dist/types/TraceFilter.js +0 -3
  252. package/dist/types/TraceRecord.d.ts +0 -54
  253. package/dist/types/TraceRecord.js +0 -2
  254. package/dist/types/TraceStats.d.ts +0 -20
  255. package/dist/types/TraceStats.js +0 -3
  256. package/dist/types/TranscriptionCallOptions.d.ts +0 -38
  257. package/dist/types/TranscriptionCallOptions.js +0 -2
  258. package/dist/types/TranscriptionRequest.d.ts +0 -9
  259. package/dist/types/TranscriptionRequest.js +0 -3
  260. package/dist/types/TranscriptionResponse.d.ts +0 -24
  261. package/dist/types/TranscriptionResponse.js +0 -2
  262. package/dist/types/TranscriptionResult.d.ts +0 -46
  263. package/dist/types/TranscriptionResult.js +0 -2
  264. package/dist/types/TranscriptionSegment.d.ts +0 -17
  265. package/dist/types/TranscriptionSegment.js +0 -3
  266. package/dist/types/TranscriptionStreamPart.d.ts +0 -70
  267. package/dist/types/TranscriptionStreamPart.js +0 -2
  268. package/dist/types/UploadFileCallOptions.d.ts +0 -27
  269. package/dist/types/UploadFileCallOptions.js +0 -2
  270. package/dist/types/UploadFileData.d.ts +0 -17
  271. package/dist/types/UploadFileData.js +0 -2
  272. package/dist/types/UploadFileResult.d.ts +0 -35
  273. package/dist/types/UploadFileResult.js +0 -2
  274. package/dist/types/Usage.d.ts +0 -13
  275. package/dist/types/Usage.js +0 -2
  276. package/dist/types/UsageSnapshot.d.ts +0 -18
  277. package/dist/types/UsageSnapshot.js +0 -2
  278. package/dist/types/Verdict.d.ts +0 -23
  279. package/dist/types/Verdict.js +0 -2
  280. package/dist/types/VerdictConfidence.d.ts +0 -4
  281. package/dist/types/VerdictConfidence.js +0 -3
  282. package/dist/types/VerdictKind.d.ts +0 -4
  283. package/dist/types/VerdictKind.js +0 -3
  284. package/dist/types/VideoCallOptions.d.ts +0 -84
  285. package/dist/types/VideoCallOptions.js +0 -2
  286. package/dist/types/VideoData.d.ts +0 -22
  287. package/dist/types/VideoData.js +0 -3
  288. package/dist/types/VideoFile.d.ts +0 -29
  289. package/dist/types/VideoFile.js +0 -2
  290. package/dist/types/VideoFileData.d.ts +0 -8
  291. package/dist/types/VideoFileData.js +0 -3
  292. package/dist/types/VideoFrameImage.d.ts +0 -17
  293. package/dist/types/VideoFrameImage.js +0 -2
  294. package/dist/types/VideoFrameType.d.ts +0 -6
  295. package/dist/types/VideoFrameType.js +0 -3
  296. package/dist/types/VideoPollOptions.d.ts +0 -13
  297. package/dist/types/VideoPollOptions.js +0 -3
  298. package/dist/types/VideoResponse.d.ts +0 -19
  299. package/dist/types/VideoResponse.js +0 -3
  300. package/dist/types/VideoResult.d.ts +0 -29
  301. package/dist/types/VideoResult.js +0 -2
  302. package/dist/types/Warning.d.ts +0 -23
  303. package/dist/types/Warning.js +0 -3
  304. package/dist/types/serde_json/JsonValue.d.ts +0 -3
  305. package/dist/types/serde_json/JsonValue.js +0 -3
@@ -1,173 +0,0 @@
1
- import type { AiMuxError } from "./AiMuxError";
2
- import type { FileData } from "./FileData";
3
- import type { FinishReason } from "./FinishReason";
4
- import type { Usage } from "./Usage";
5
- import type { Warning } from "./Warning";
6
- import type { JsonValue } from "./serde_json/JsonValue";
7
- /**
8
- * A single chunk in the stream returned by `do_stream`.
9
- */
10
- export type StreamPart = {
11
- "TextStart": {
12
- id: string;
13
- provider_metadata?: JsonValue | null;
14
- };
15
- } | {
16
- "TextDelta": {
17
- id: string;
18
- delta: string;
19
- provider_metadata?: JsonValue | null;
20
- };
21
- } | {
22
- "TextEnd": {
23
- id: string;
24
- provider_metadata?: JsonValue | null;
25
- };
26
- } | {
27
- "StreamStart": {
28
- warnings: Array<Warning>;
29
- };
30
- } | {
31
- "Finish": {
32
- finish_reason: FinishReason;
33
- usage: Usage;
34
- provider_metadata: JsonValue | null;
35
- };
36
- } | {
37
- "Error": {
38
- error: AiMuxError;
39
- };
40
- } | {
41
- "ToolInputStart": {
42
- id: string;
43
- tool_name: string;
44
- /**
45
- * Whether the tool call will be executed by the provider.
46
- */
47
- provider_executed?: boolean | null;
48
- /**
49
- * Whether the tool is dynamic (defined at runtime, e.g. MCP tools).
50
- */
51
- dynamic?: boolean | null;
52
- /**
53
- * Optional title for the tool call.
54
- */
55
- title?: string | null;
56
- provider_metadata?: JsonValue | null;
57
- };
58
- } | {
59
- "ToolInputDelta": {
60
- id: string;
61
- delta: string;
62
- provider_metadata?: JsonValue | null;
63
- };
64
- } | {
65
- "ToolInputEnd": {
66
- id: string;
67
- provider_metadata?: JsonValue | null;
68
- };
69
- } | {
70
- "ToolCall": {
71
- tool_call_id: string;
72
- tool_name: string;
73
- /**
74
- * Serialized argument text in a `Value::String` from `do_stream`;
75
- * parsed input after `stream_text`.
76
- */
77
- input: JsonValue;
78
- /**
79
- * Whether the tool call will be executed by the provider.
80
- */
81
- provider_executed?: boolean | null;
82
- /**
83
- * Whether the tool is dynamic (defined at runtime, e.g. MCP tools).
84
- */
85
- dynamic?: boolean | null;
86
- /**
87
- * Provider-assigned thought signature (e.g. Google Gemini
88
- * `thoughtSignature`). Must be echoed back verbatim on the follow-up
89
- * turn when the tool result is sent.
90
- */
91
- thought_signature?: string | null;
92
- /**
93
- * Set by Core when the call remains invalid after optional repair.
94
- */
95
- invalid?: boolean | null;
96
- /**
97
- * Typed lookup, parsing, schema, or repair failure.
98
- */
99
- error?: AiMuxError | null;
100
- provider_metadata?: JsonValue | null;
101
- };
102
- } | {
103
- "ToolResult": {
104
- tool_call_id: string;
105
- tool_name: string;
106
- result: JsonValue;
107
- /**
108
- * Whether the result is an error or error message.
109
- */
110
- is_error?: boolean | null;
111
- /**
112
- * Whether the result is preliminary (replaces prior, e.g. image previews).
113
- */
114
- preliminary?: boolean | null;
115
- /**
116
- * Whether the tool is dynamic (defined at runtime, e.g. MCP tools).
117
- */
118
- dynamic?: boolean | null;
119
- /**
120
- * Additional provider-specific metadata for the tool result.
121
- */
122
- provider_metadata?: JsonValue | null;
123
- };
124
- } | {
125
- "File": {
126
- data: FileData;
127
- media_type: string;
128
- provider_metadata?: JsonValue | null;
129
- };
130
- } | {
131
- "ReasoningStart": {
132
- id: string;
133
- /**
134
- * Provider-specific metadata (e.g. xAI `itemId`).
135
- */
136
- provider_metadata: JsonValue | null;
137
- };
138
- } | {
139
- "ReasoningDelta": {
140
- id: string;
141
- delta: string;
142
- /**
143
- * Provider-specific metadata (e.g. xAI `itemId`).
144
- */
145
- provider_metadata: JsonValue | null;
146
- };
147
- } | {
148
- "ReasoningEnd": {
149
- id: string;
150
- /**
151
- * Provider-specific metadata (e.g. xAI `itemId`, `reasoningEncryptedContent`).
152
- */
153
- provider_metadata: JsonValue | null;
154
- };
155
- } | {
156
- "ResponseMetadata": {
157
- id: string | null;
158
- timestamp: string | null;
159
- model_id: string | null;
160
- };
161
- } | {
162
- "Source": {
163
- id: string;
164
- source_type: string;
165
- url: string | null;
166
- title: string | null;
167
- provider_metadata?: JsonValue | null;
168
- };
169
- } | {
170
- "Raw": {
171
- raw_value: JsonValue;
172
- };
173
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,74 +0,0 @@
1
- import type { FilePart } from "./FilePart";
2
- import type { FinishReason } from "./FinishReason";
3
- import type { ModelMessage } from "./ModelMessage";
4
- import type { ReasoningPart } from "./ReasoningPart";
5
- import type { ResponseMetadata } from "./ResponseMetadata";
6
- import type { SourcePart } from "./SourcePart";
7
- import type { ToolCall } from "./ToolCall";
8
- import type { Usage } from "./Usage";
9
- import type { Warning } from "./Warning";
10
- import type { JsonValue } from "./serde_json/JsonValue";
11
- /**
12
- * Aggregated result of `stream_text().consume()` (M11). Mirrors
13
- * `GenerateTextResult`'s user-facing fields (without `raw`, since streaming
14
- * has no `GenerateResult` equivalent).
15
- */
16
- export type StreamTextResultAggregated = {
17
- /**
18
- * The generated text (concatenated `TextDelta`).
19
- */
20
- text: string;
21
- /**
22
- * Reasoning / thinking segments.
23
- */
24
- reasoning: Array<ReasoningPart>;
25
- /**
26
- * Concatenated reasoning text.
27
- */
28
- reasoning_text: string;
29
- /**
30
- * Tool calls requested by the model.
31
- */
32
- tool_calls: Array<ToolCall>;
33
- /**
34
- * Sources / citations.
35
- */
36
- sources: Array<SourcePart>;
37
- /**
38
- * Files generated by the model.
39
- */
40
- files: Array<FilePart>;
41
- /**
42
- * Why generation stopped.
43
- */
44
- finish_reason: FinishReason;
45
- /**
46
- * Raw provider-specific finish reason string.
47
- */
48
- raw_finish_reason: string | null;
49
- /**
50
- * Token usage.
51
- */
52
- usage: Usage;
53
- /**
54
- * Total token usage across all steps. In single-step mode (aimux's
55
- * default), `total_usage` equals `usage`. Provided for AI SDK parity.
56
- */
57
- total_usage: Usage;
58
- /**
59
- * Warnings from the provider.
60
- */
61
- warnings: Array<Warning>;
62
- /**
63
- * Provider-specific metadata from the Finish chunk.
64
- */
65
- provider_metadata: JsonValue | null;
66
- /**
67
- * Response metadata (id, timestamp, model_id) if emitted by the stream.
68
- */
69
- response: ResponseMetadata | null;
70
- /**
71
- * Assistant messages ready to append for the next turn.
72
- */
73
- response_messages: Array<ModelMessage>;
74
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,32 +0,0 @@
1
- /**
2
- * Per-call timeout configuration.
3
- *
4
- * Aligned with V4 `LanguageModelV4CallOptions.timeout`
5
- * (`TimeoutConfiguration`). All values are milliseconds; `None` disables the
6
- * corresponding limit. A `total` timeout also covers retry backoff and the
7
- * whole streamed response.
8
- */
9
- export type TimeoutConfiguration = {
10
- /**
11
- * Overall timeout for the entire call (including retries and, for
12
- * streaming, the whole stream), in milliseconds.
13
- */
14
- total_ms: number | null;
15
- /**
16
- * Timeout for one generation step, including that step's attempts and
17
- * retry backoff, in milliseconds. Aimux currently has one step.
18
- */
19
- step_ms: number | null;
20
- /**
21
- * Timeout waiting for the first stream chunk (streaming only).
22
- *
23
- * Counted from operation start, so it also bounds stream establishment
24
- * and any retries before the first semantic output: it is the
25
- * user-perceived time-to-first-output budget, not a per-attempt timer.
26
- */
27
- first_chunk_ms: number | null;
28
- /**
29
- * Maximum idle time between consecutive stream chunks (streaming only).
30
- */
31
- chunk_ms: number | null;
32
- };
@@ -1,3 +0,0 @@
1
- "use strict";
2
- // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
3
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,7 +0,0 @@
1
- export type TimingRecord = {
2
- /**
3
- * ms 级延迟,TS 用 number(远小于 2^53,避免 bigint)。
4
- */
5
- latency_ms: number;
6
- ttfb_ms: number | null;
7
- };
@@ -1,3 +0,0 @@
1
- "use strict";
2
- // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
3
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,29 +0,0 @@
1
- /**
2
- * Token usage detail (with cache breakdown).
3
- */
4
- export type TokenUsage = {
5
- /**
6
- * Total tokens.
7
- */
8
- total: number | null;
9
- /**
10
- * Tokens that were not served from cache.
11
- */
12
- no_cache: number | null;
13
- /**
14
- * Tokens served from cache (read).
15
- */
16
- cache_read: number | null;
17
- /**
18
- * Tokens written to cache.
19
- */
20
- cache_write: number | null;
21
- /**
22
- * Text (non-reasoning) tokens (output side).
23
- */
24
- text: number | null;
25
- /**
26
- * Reasoning tokens (output side).
27
- */
28
- reasoning: number | null;
29
- };
@@ -1,3 +0,0 @@
1
- "use strict";
2
- // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
3
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,12 +0,0 @@
1
- import type { FunctionTool } from "./FunctionTool";
2
- import type { ProviderTool } from "./ProviderTool";
3
- /**
4
- * A tool that can be either a user-defined function tool or a
5
- * provider-defined tool. Mirrors the V4
6
- * `Array<LanguageModelV4FunctionTool | LanguageModelV4ProviderTool>`.
7
- */
8
- export type Tool = {
9
- "type": "function";
10
- } & FunctionTool | {
11
- "type": "provider";
12
- } & ProviderTool;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,48 +0,0 @@
1
- import type { AiMuxError } from "./AiMuxError";
2
- import type { JsonValue } from "./serde_json/JsonValue";
3
- /**
4
- * A tool call requested by the model.
5
- */
6
- export type ToolCall = {
7
- /**
8
- * Provider-assigned call id.
9
- */
10
- tool_call_id: string;
11
- /**
12
- * Tool name.
13
- */
14
- tool_name: string;
15
- /**
16
- * Parsed arguments, or the original string when `invalid` is true and the
17
- * provider input was not valid JSON.
18
- */
19
- input: JsonValue;
20
- /**
21
- * Whether the tool call will be executed by the provider.
22
- */
23
- provider_executed?: boolean | null;
24
- /**
25
- * Whether the tool is dynamic (defined at runtime, e.g. MCP tools).
26
- */
27
- dynamic?: boolean | null;
28
- /**
29
- * Provider-assigned thought signature (e.g. Google Gemini
30
- * `thoughtSignature`). Must be echoed back verbatim on the follow-up turn
31
- * when the tool result is sent; thinking models reject the request
32
- * otherwise.
33
- */
34
- thought_signature?: string | null;
35
- /**
36
- * Additional provider-specific metadata associated with this call.
37
- */
38
- provider_metadata?: JsonValue | null;
39
- /**
40
- * Set when lookup, JSON parsing, or schema validation still failed after
41
- * the optional repair attempt.
42
- */
43
- invalid?: boolean | null;
44
- /**
45
- * Typed failure associated with an invalid tool call.
46
- */
47
- error?: AiMuxError | null;
48
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,19 +0,0 @@
1
- import type { RawToolCall } from "./RawToolCall";
2
- /**
3
- * A host's answer to one tool-call repair request.
4
- *
5
- * The bindings cannot carry a [`ToolCallRepair`] closure, so a host instead
6
- * reads the invalid call off the result, repairs it in its own language, and
7
- * hands the answer back as this value. Wire shape:
8
- * `{"type":"repaired","tool_call":{…}}`, `{"type":"unchanged"}`, or
9
- * `{"type":"failed","message":"…"}`.
10
- */
11
- export type ToolCallRepairReply = {
12
- "type": "repaired";
13
- tool_call: RawToolCall;
14
- } | {
15
- "type": "unchanged";
16
- } | {
17
- "type": "failed";
18
- message: string;
19
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,12 +0,0 @@
1
- /**
2
- * How the model should choose tools.
3
- *
4
- * Wire format aligns with Vercel AI SDK `toolChoice`:
5
- * `"auto" | "none" | "required" | { "type": "tool", "toolName": "..." }`.
6
- * This is a mixed tagged/untagged shape (unit variants as bare strings,
7
- * `Tool` variant as a tagged object), so serde is implemented by hand.
8
- */
9
- export type ToolChoice = "auto" | "none" | "required" | {
10
- type: "tool";
11
- toolName: string;
12
- };
@@ -1,3 +0,0 @@
1
- "use strict";
2
- // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
3
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,22 +0,0 @@
1
- import type { JsonValue } from "./serde_json/JsonValue";
2
- /**
3
- * The result of executing a tool call, to be sent back to the model.
4
- */
5
- export type ToolResult = {
6
- /**
7
- * Must match the corresponding `ToolCall::tool_call_id`.
8
- */
9
- tool_call_id: string;
10
- /**
11
- * The tool's output (usually a JSON-serializable value or plain text).
12
- */
13
- result: JsonValue;
14
- /**
15
- * Whether the result is an error or error message.
16
- */
17
- is_error?: boolean | null;
18
- /**
19
- * Whether the result is preliminary (replaces prior, e.g. image previews).
20
- */
21
- preliminary?: boolean | null;
22
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,9 +0,0 @@
1
- /**
2
- * Query filter (RFC-0015 §5.3).
3
- */
4
- export type TraceFilter = {
5
- provider: string | null;
6
- model: string | null;
7
- session_id: string | null;
8
- since_unix_ms: bigint | null;
9
- };
@@ -1,3 +0,0 @@
1
- "use strict";
2
- // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
3
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,54 +0,0 @@
1
- import type { Fingerprint } from "./Fingerprint";
2
- import type { RequestCacheHints } from "./RequestCacheHints";
3
- import type { UsageSnapshot } from "./UsageSnapshot";
4
- import type { Verdict } from "./Verdict";
5
- /**
6
- * One probed call. Plaintext never persists — fingerprints only.
7
- */
8
- export type TraceRecord = {
9
- provider: string;
10
- model: string;
11
- request_id: string | null;
12
- /**
13
- * From `CallOptions.session_id` (RFC-0024) — explicit first, inference
14
- * fallback; may also be the layer's default session.
15
- */
16
- session_id: string | null;
17
- /**
18
- * Call-level unique id (association key for Recording / replay,
19
- * RFC-0023).
20
- */
21
- call_id: string;
22
- /**
23
- * When the call was sent (epoch ms).
24
- */
25
- sent_at_unix_ms: number;
26
- /**
27
- * Client-side LCP token upper bound (block upper bound, byte-proxy
28
- * len/4). `None` when no history matched. Consumed by `TraceStats`
29
- * aggregation.
30
- */
31
- lcp_token_upper?: bigint | null;
32
- /**
33
- * Time to first streamed token (ms). Non-streaming: `None`.
34
- */
35
- ttft_ms: number | null;
36
- fingerprint: Fingerprint;
37
- usage: UsageSnapshot;
38
- /**
39
- * Response-side cache headers (e.g. `x-openrouter-cache-status`).
40
- */
41
- response_cache_headers?: {
42
- [key in string]: string;
43
- } | null;
44
- request_cache_hints?: RequestCacheHints | null;
45
- /**
46
- * Audit verdict (`None` when no auditor is attached — the default).
47
- */
48
- verdict?: Verdict | null;
49
- /**
50
- * Error string when the call failed (still recorded: failures are part
51
- * of the session).
52
- */
53
- error?: string | null;
54
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,20 +0,0 @@
1
- /**
2
- * Aggregated statistics (RFC-0015 §5.2 — the two hit rates are reported
3
- * side by side, never merged into a single number).
4
- */
5
- export type TraceStats = {
6
- provider: string;
7
- model: string;
8
- requests: bigint;
9
- input_tokens_total: bigint;
10
- claimed_cache_read_total: bigint;
11
- claimed_cache_write_total: bigint;
12
- reported_hit_rate: number | null;
13
- client_upper_bound_hit_rate: number | null;
14
- verdict_counts: {
15
- [key in string]: bigint;
16
- };
17
- ttft_p50_ms: bigint | null;
18
- ttft_p95_ms: bigint | null;
19
- errors: bigint;
20
- };
@@ -1,3 +0,0 @@
1
- "use strict";
2
- // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
3
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,38 +0,0 @@
1
- import type { AudioInput } from "./AudioInput";
2
- import type { TimeoutConfiguration } from "./TimeoutConfiguration";
3
- import type { JsonValue } from "./serde_json/JsonValue";
4
- /**
5
- * Options passed to [`TranscriptionModel::do_generate`].
6
- *
7
- * Aligned with V4 `TranscriptionModelV4CallOptions`.
8
- */
9
- export type TranscriptionCallOptions = {
10
- /**
11
- * Audio data to transcribe (raw bytes or a base64-encoded string).
12
- */
13
- audio: AudioInput;
14
- /**
15
- * The IANA media type of the audio data, e.g. `"audio/mp3"`.
16
- */
17
- media_type: string;
18
- /**
19
- * Additional provider-specific options, keyed by provider name.
20
- */
21
- provider_options: {
22
- [key in string]: JsonValue;
23
- } | null;
24
- /**
25
- * Per-call retry override. `None` uses the model default.
26
- */
27
- max_retries: number | null;
28
- /**
29
- * Per-call operation timeout.
30
- */
31
- timeout: TimeoutConfiguration | null;
32
- /**
33
- * Additional HTTP headers to send with the request.
34
- */
35
- headers: {
36
- [key in string]: string;
37
- } | null;
38
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,9 +0,0 @@
1
- /**
2
- * Optional request information for a transcription call.
3
- */
4
- export type TranscriptionRequest = {
5
- /**
6
- * Raw request HTTP body that was sent (JSON stringified).
7
- */
8
- body: string | null;
9
- };
@@ -1,3 +0,0 @@
1
- "use strict";
2
- // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
3
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,24 +0,0 @@
1
- import type { JsonValue } from "./serde_json/JsonValue";
2
- /**
3
- * Response information for a transcription call.
4
- */
5
- export type TranscriptionResponse = {
6
- /**
7
- * Timestamp for the start of the generated response (ISO 8601 string).
8
- */
9
- timestamp: string | null;
10
- /**
11
- * The ID of the model that was used to generate the response.
12
- */
13
- model_id: string | null;
14
- /**
15
- * Response headers.
16
- */
17
- headers: {
18
- [key in string]: string;
19
- } | null;
20
- /**
21
- * Response body (opaque JSON).
22
- */
23
- body: JsonValue | null;
24
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });