@omnicross/core 0.1.4 → 0.1.6

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 (204) hide show
  1. package/dist/ApiConverter.cjs +2 -2
  2. package/dist/ApiConverter.js +1 -1
  3. package/dist/{CompletionService-DdWaAxq0.d.ts → CompletionService-C3BX0Ovy.d.ts} +4 -3
  4. package/dist/{CompletionService-D3a47vdU.d.cts → CompletionService-kNA17cfI.d.cts} +4 -3
  5. package/dist/auth/GeminiCodeAssistProjectResolver.cjs +7 -5
  6. package/dist/auth/GeminiCodeAssistProjectResolver.js +5 -3
  7. package/dist/{chunk-HRRYG2AX.js → chunk-23S5OPIO.js} +10 -1
  8. package/dist/chunk-25GXJCEZ.cjs +40 -0
  9. package/dist/chunk-2JYRIADS.js +40 -0
  10. package/dist/chunk-3Z5BQZFM.cjs +52 -0
  11. package/dist/{chunk-4VAVYUZS.cjs → chunk-4VLRHHFE.cjs} +82 -40
  12. package/dist/{chunk-VACWOIRE.cjs → chunk-4VZX5F4T.cjs} +39 -15
  13. package/dist/{chunk-FTQ7IQUC.js → chunk-6CL5HTPQ.js} +52 -10
  14. package/dist/chunk-6QQG7YG3.cjs +153 -0
  15. package/dist/{chunk-SU2GCLAC.cjs → chunk-6VUQPOV3.cjs} +359 -60
  16. package/dist/chunk-7AK7B36B.cjs +44 -0
  17. package/dist/{chunk-5ZQBEOMD.js → chunk-AT7B7SOZ.js} +25 -2
  18. package/dist/{chunk-IK3KE3AU.js → chunk-DE2SRBFZ.js} +1 -1
  19. package/dist/chunk-DLXZEZWO.cjs +285 -0
  20. package/dist/{chunk-UHGVBFU3.js → chunk-EBLFCNPY.js} +38 -14
  21. package/dist/chunk-EJLH6NFT.cjs +166 -0
  22. package/dist/chunk-HVBBDBS3.cjs +350 -0
  23. package/dist/{chunk-7Y47UCF2.js → chunk-IFXJ2BG7.js} +5 -38
  24. package/dist/{chunk-46ZIFWYG.cjs → chunk-IIRPUVPH.cjs} +7 -1
  25. package/dist/{chunk-YGXJGRFI.cjs → chunk-KBM2W6UY.cjs} +111 -24
  26. package/dist/{chunk-OCEUVQHW.cjs → chunk-KCVJWJST.cjs} +73 -3
  27. package/dist/chunk-LB6EBS6Y.js +69 -0
  28. package/dist/{chunk-C7PSERMH.js → chunk-LVUCAWMK.js} +1 -1
  29. package/dist/chunk-MKF46GNZ.js +350 -0
  30. package/dist/{chunk-HYN75H6G.cjs → chunk-MUHWHQVM.cjs} +1 -1
  31. package/dist/{chunk-Z7Y2NPHY.js → chunk-N5T4M4GU.js} +1 -1
  32. package/dist/{chunk-TIER4SUC.js → chunk-OEWZUX4G.js} +346 -47
  33. package/dist/chunk-OF3BECU2.cjs +69 -0
  34. package/dist/{chunk-RSJ3TWJQ.cjs → chunk-OKMJLEXX.cjs} +5 -5
  35. package/dist/chunk-OPRS4IQZ.js +153 -0
  36. package/dist/{chunk-XK5CIRMQ.js → chunk-SIZQQD6T.js} +72 -2
  37. package/dist/{chunk-DKPXN34V.cjs → chunk-SQYVORNP.cjs} +1334 -510
  38. package/dist/chunk-SYQF7OIR.js +52 -0
  39. package/dist/{chunk-S4WBV25P.js → chunk-TOVPMMHM.js} +111 -24
  40. package/dist/{chunk-QYTT6GE3.js → chunk-UDCC7EMR.js} +1093 -269
  41. package/dist/{chunk-E3UCVHLP.cjs → chunk-UNWKG6EI.cjs} +5 -38
  42. package/dist/{chunk-ZLX3KGXX.js → chunk-UX7VWA46.js} +135 -23
  43. package/dist/{chunk-7YN22L2H.cjs → chunk-V4TXMEJS.cjs} +5 -5
  44. package/dist/chunk-VRFBB5DB.js +44 -0
  45. package/dist/chunk-WB6PH56J.js +166 -0
  46. package/dist/{chunk-G2UTNSGU.js → chunk-WNKWAEUR.js} +7 -1
  47. package/dist/{chunk-SUEGJ75D.cjs → chunk-WYTEQ4Q5.cjs} +25 -2
  48. package/dist/{chunk-5ENKBSWO.js → chunk-YJVHCHQX.js} +42 -6
  49. package/dist/{chunk-VQY5W4YW.cjs → chunk-YK57NMIF.cjs} +44 -8
  50. package/dist/{chunk-KFI44N2R.cjs → chunk-YNJNTCSQ.cjs} +10 -1
  51. package/dist/completion/ApiKeyPoolService.cjs +12 -0
  52. package/dist/completion/ApiKeyPoolService.d.cts +6 -0
  53. package/dist/completion/ApiKeyPoolService.d.ts +6 -0
  54. package/dist/completion/ApiKeyPoolService.js +12 -0
  55. package/dist/completion/CompletionService.cjs +27 -24
  56. package/dist/completion/CompletionService.d.cts +2 -1
  57. package/dist/completion/CompletionService.d.ts +2 -1
  58. package/dist/completion/CompletionService.js +26 -23
  59. package/dist/completion.cjs +27 -24
  60. package/dist/completion.d.cts +2 -1
  61. package/dist/completion.d.ts +2 -1
  62. package/dist/completion.js +26 -23
  63. package/dist/index.cjs +53 -29
  64. package/dist/index.d.cts +8 -8
  65. package/dist/index.d.ts +8 -8
  66. package/dist/index.js +56 -32
  67. package/dist/{keyPolicy-Cp0FntZl.d.cts → keyPolicy-zdWTu3CQ.d.cts} +1 -1
  68. package/dist/{keyPolicy-Cp0FntZl.d.ts → keyPolicy-zdWTu3CQ.d.ts} +1 -1
  69. package/dist/outbound-api/auditCapture.cjs +2 -2
  70. package/dist/outbound-api/auditCapture.d.cts +5 -3
  71. package/dist/outbound-api/auditCapture.d.ts +5 -3
  72. package/dist/outbound-api/auditCapture.js +1 -1
  73. package/dist/outbound-api/quotaWarn.d.cts +1 -1
  74. package/dist/outbound-api/quotaWarn.d.ts +1 -1
  75. package/dist/outbound-api/routeResolver.cjs +2 -2
  76. package/dist/outbound-api/routeResolver.d.cts +4 -3
  77. package/dist/outbound-api/routeResolver.d.ts +4 -3
  78. package/dist/outbound-api/routeResolver.js +1 -1
  79. package/dist/outbound-api/subscriptionRegistryPort.d.cts +1 -0
  80. package/dist/outbound-api/subscriptionRegistryPort.d.ts +1 -0
  81. package/dist/outbound-api/types.d.cts +3 -2
  82. package/dist/outbound-api/types.d.ts +3 -2
  83. package/dist/outbound-api.cjs +49 -25
  84. package/dist/outbound-api.d.cts +127 -85
  85. package/dist/outbound-api.d.ts +127 -85
  86. package/dist/outbound-api.js +52 -28
  87. package/dist/pipeline/AccountAllowanceScheduling.cjs +15 -0
  88. package/dist/pipeline/AccountAllowanceScheduling.d.cts +90 -0
  89. package/dist/pipeline/AccountAllowanceScheduling.d.ts +90 -0
  90. package/dist/pipeline/AccountAllowanceScheduling.js +15 -0
  91. package/dist/pipeline/AccountAllowanceStore.cjs +20 -0
  92. package/dist/pipeline/AccountAllowanceStore.d.cts +77 -0
  93. package/dist/pipeline/AccountAllowanceStore.d.ts +77 -0
  94. package/dist/pipeline/AccountAllowanceStore.js +20 -0
  95. package/dist/pipeline/AuthSource.d.cts +11 -2
  96. package/dist/pipeline/AuthSource.d.ts +11 -2
  97. package/dist/pipeline/BoundAccountSelectionError.cjs +10 -0
  98. package/dist/pipeline/BoundAccountSelectionError.d.cts +28 -0
  99. package/dist/pipeline/BoundAccountSelectionError.d.ts +28 -0
  100. package/dist/pipeline/BoundAccountSelectionError.js +10 -0
  101. package/dist/pipeline/LlmConfigProviderAuth.d.cts +1 -0
  102. package/dist/pipeline/LlmConfigProviderAuth.d.ts +1 -0
  103. package/dist/pipeline/SubscriptionAccountHealth.cjs +4 -2
  104. package/dist/pipeline/SubscriptionAccountHealth.d.cts +34 -6
  105. package/dist/pipeline/SubscriptionAccountHealth.d.ts +34 -6
  106. package/dist/pipeline/SubscriptionAccountHealth.js +3 -1
  107. package/dist/pipeline/SubscriptionAuthSource.cjs +5 -2
  108. package/dist/pipeline/SubscriptionAuthSource.d.cts +1 -0
  109. package/dist/pipeline/SubscriptionAuthSource.d.ts +1 -0
  110. package/dist/pipeline/SubscriptionAuthSource.js +4 -1
  111. package/dist/pipeline/SubscriptionAuthStrategy.d.cts +8 -3
  112. package/dist/pipeline/SubscriptionAuthStrategy.d.ts +8 -3
  113. package/dist/pipeline/executeProviderCall.cjs +2 -2
  114. package/dist/pipeline/executeProviderCall.d.cts +8 -3
  115. package/dist/pipeline/executeProviderCall.d.ts +8 -3
  116. package/dist/pipeline/executeProviderCall.js +1 -1
  117. package/dist/pipeline/resolveProviderChain.d.cts +2 -3
  118. package/dist/pipeline/resolveProviderChain.d.ts +2 -3
  119. package/dist/pipeline/resolveSubscriptionChain.d.cts +1 -0
  120. package/dist/pipeline/resolveSubscriptionChain.d.ts +1 -0
  121. package/dist/pipeline/upstreamFetch.cjs +4 -2
  122. package/dist/pipeline/upstreamFetch.d.cts +6 -0
  123. package/dist/pipeline/upstreamFetch.d.ts +6 -0
  124. package/dist/pipeline/upstreamFetch.js +3 -1
  125. package/dist/pipeline/upstreamTrace.cjs +14 -0
  126. package/dist/pipeline/upstreamTrace.d.cts +85 -0
  127. package/dist/pipeline/upstreamTrace.d.ts +85 -0
  128. package/dist/pipeline/upstreamTrace.js +14 -0
  129. package/dist/ports/pricing-store.d.cts +4 -3
  130. package/dist/ports/pricing-store.d.ts +4 -3
  131. package/dist/ports.d.cts +4 -3
  132. package/dist/ports.d.ts +4 -3
  133. package/dist/provider-proxy/ProviderProxy.cjs +27 -24
  134. package/dist/provider-proxy/ProviderProxy.d.cts +1 -0
  135. package/dist/provider-proxy/ProviderProxy.d.ts +1 -0
  136. package/dist/provider-proxy/ProviderProxy.js +26 -23
  137. package/dist/provider-proxy/ingress/providerProxyShared.cjs +31 -24
  138. package/dist/provider-proxy/ingress/providerProxyShared.d.cts +50 -5
  139. package/dist/provider-proxy/ingress/providerProxyShared.d.ts +50 -5
  140. package/dist/provider-proxy/ingress/providerProxyShared.js +30 -23
  141. package/dist/provider-proxy/matchText.cjs +4 -2
  142. package/dist/provider-proxy/matchText.d.cts +41 -6
  143. package/dist/provider-proxy/matchText.d.ts +41 -6
  144. package/dist/provider-proxy/matchText.js +3 -1
  145. package/dist/provider-proxy/types.d.cts +30 -2
  146. package/dist/provider-proxy/types.d.ts +30 -2
  147. package/dist/provider-proxy.cjs +27 -24
  148. package/dist/provider-proxy.d.cts +1 -0
  149. package/dist/provider-proxy.d.ts +1 -0
  150. package/dist/provider-proxy.js +26 -23
  151. package/dist/{routeResolver-C4T7yClx.d.ts → routeResolver-CHTv_Bs5.d.ts} +1 -1
  152. package/dist/{routeResolver-CB3tvJKy.d.cts → routeResolver-kepxnfcC.d.cts} +1 -1
  153. package/dist/transformer/TransformerChainExecutor.cjs +2 -2
  154. package/dist/transformer/TransformerChainExecutor.js +1 -1
  155. package/dist/transformer/transformers/AnthropicTransformer.cjs +2 -2
  156. package/dist/transformer/transformers/AnthropicTransformer.js +1 -1
  157. package/dist/transformer/transformers/GeminiCodeAssistTransformer.cjs +3 -3
  158. package/dist/transformer/transformers/GeminiCodeAssistTransformer.js +2 -2
  159. package/dist/transformer/transformers/GeminiTransformer.cjs +3 -3
  160. package/dist/transformer/transformers/GeminiTransformer.js +2 -2
  161. package/dist/transformer/transformers/OpenAIResponseTransformer.cjs +2 -2
  162. package/dist/transformer/transformers/OpenAIResponseTransformer.d.cts +1 -1
  163. package/dist/transformer/transformers/OpenAIResponseTransformer.d.ts +1 -1
  164. package/dist/transformer/transformers/OpenAIResponseTransformer.js +1 -1
  165. package/dist/transformer/transformers/OpenAITransformer.cjs +6 -0
  166. package/dist/transformer/transformers/OpenAITransformer.d.cts +68 -0
  167. package/dist/transformer/transformers/OpenAITransformer.d.ts +68 -0
  168. package/dist/transformer/transformers/OpenAITransformer.js +6 -0
  169. package/dist/transformer/transformers.cjs +8 -14
  170. package/dist/transformer/transformers.d.cts +12 -48
  171. package/dist/transformer/transformers.d.ts +12 -48
  172. package/dist/transformer/transformers.js +11 -17
  173. package/dist/transformer/types.d.cts +17 -0
  174. package/dist/transformer/types.d.ts +17 -0
  175. package/dist/transformer.cjs +11 -12
  176. package/dist/transformer.d.cts +1 -2
  177. package/dist/transformer.d.ts +1 -2
  178. package/dist/transformer.js +11 -12
  179. package/dist/{types-B8Arpxn0.d.cts → types-H3wGZSOo.d.cts} +134 -7
  180. package/dist/{types-lgPYQuZS.d.ts → types-hsoKrVQS.d.ts} +134 -7
  181. package/dist/usage/pricing-engine.cjs +2 -2
  182. package/dist/usage/pricing-engine.d.cts +9 -1
  183. package/dist/usage/pricing-engine.d.ts +9 -1
  184. package/dist/usage/pricing-engine.js +1 -1
  185. package/dist/usage.cjs +2 -2
  186. package/dist/usage.js +1 -1
  187. package/package.json +1 -1
  188. package/dist/chunk-C72S6TTV.cjs +0 -49
  189. package/dist/chunk-DWKQZ2SK.cjs +0 -254
  190. package/dist/chunk-IAXWICZU.js +0 -69
  191. package/dist/chunk-QWBWGODS.cjs +0 -69
  192. package/dist/chunk-RGTR7CIO.cjs +0 -235
  193. package/dist/chunk-VPBAUQ2M.js +0 -235
  194. package/dist/chunk-YMFAJFQT.cjs +0 -173
  195. package/dist/chunk-Z7LUNECE.js +0 -49
  196. package/dist/chunk-ZJZAOKI7.js +0 -254
  197. package/dist/transformer/transformers/OpenCodeGoTransformer.cjs +0 -6
  198. package/dist/transformer/transformers/OpenCodeGoTransformer.d.cts +0 -51
  199. package/dist/transformer/transformers/OpenCodeGoTransformer.d.ts +0 -51
  200. package/dist/transformer/transformers/OpenCodeGoTransformer.js +0 -6
  201. package/dist/transformer/transformers/ReasoningTransformer.cjs +0 -6
  202. package/dist/transformer/transformers/ReasoningTransformer.d.cts +0 -47
  203. package/dist/transformer/transformers/ReasoningTransformer.d.ts +0 -47
  204. package/dist/transformer/transformers/ReasoningTransformer.js +0 -6
@@ -1,254 +0,0 @@
1
- // src/transformer/transformers/ReasoningTransformer.ts
2
- import {
3
- buildAnthropicThinking,
4
- buildQwenThinkingConfig,
5
- calculateThinkingBudget,
6
- getOpenAIReasoningEffort
7
- } from "@omnicross/contracts/thinking-config";
8
- var ReasoningTransformer = class {
9
- static TransformerName = "reasoning";
10
- name = "reasoning";
11
- logger;
12
- enabled;
13
- constructor(options) {
14
- this.enabled = options?.enable !== false;
15
- }
16
- /**
17
- * Transform request: convert reasoning config to thinking parameters
18
- * Uses model-specific budget calculation based on effort level
19
- */
20
- async transformRequestIn(request, provider, _context) {
21
- const extendedRequest = request;
22
- const modelId = request.model;
23
- if (!this.enabled) {
24
- extendedRequest.thinking = {
25
- type: "disabled",
26
- budget_tokens: -1
27
- };
28
- extendedRequest.enable_thinking = false;
29
- return extendedRequest;
30
- }
31
- if (request.reasoning) {
32
- const effortLevel = request.reasoning.effort || "none";
33
- const userMaxTokens = request.reasoning.max_tokens || request.max_tokens;
34
- const calculatedBudget = calculateThinkingBudget(modelId, effortLevel, userMaxTokens);
35
- const providerName = provider.name?.toLowerCase() || "";
36
- if (providerName === "anthropic" || providerName.includes("claude")) {
37
- const thinkingConfig = buildAnthropicThinking(modelId, effortLevel, userMaxTokens);
38
- if (thinkingConfig) {
39
- extendedRequest.thinking = thinkingConfig;
40
- } else {
41
- extendedRequest.thinking = {
42
- type: "disabled"
43
- };
44
- }
45
- } else if (providerName === "openai" || modelId.match(/^o[134]/i)) {
46
- const reasoningEffort = getOpenAIReasoningEffort(effortLevel);
47
- if (reasoningEffort) {
48
- extendedRequest.reasoning_effort = reasoningEffort;
49
- }
50
- extendedRequest.thinking = {
51
- type: effortLevel === "none" ? "disabled" : "enabled",
52
- budget_tokens: calculatedBudget
53
- };
54
- } else if (providerName === "deepseek" && modelId?.startsWith("deepseek-v4")) {
55
- extendedRequest.thinking = {
56
- type: effortLevel === "none" ? "disabled" : "enabled",
57
- budget_tokens: calculatedBudget
58
- };
59
- if (effortLevel !== "none") {
60
- extendedRequest.reasoning_effort = effortLevel === "high" ? "max" : "high";
61
- }
62
- } else if (providerName === "deepseek" || providerName === "qwen" || providerName === "alibaba") {
63
- const qwenConfig = buildQwenThinkingConfig(effortLevel, userMaxTokens);
64
- extendedRequest.enable_thinking = qwenConfig.enable_thinking;
65
- if (qwenConfig.thinking_budget) {
66
- extendedRequest.thinking_budget = qwenConfig.thinking_budget;
67
- }
68
- extendedRequest.thinking = {
69
- type: qwenConfig.enable_thinking ? "enabled" : "disabled",
70
- budget_tokens: calculatedBudget
71
- };
72
- } else {
73
- extendedRequest.thinking = {
74
- type: effortLevel === "none" ? "disabled" : "enabled",
75
- budget_tokens: calculatedBudget
76
- };
77
- extendedRequest.enable_thinking = effortLevel !== "none";
78
- }
79
- this.logger?.debug(`[ReasoningTransformer] Model: ${modelId}, Effort: ${effortLevel}, Budget: ${calculatedBudget}`);
80
- }
81
- return extendedRequest;
82
- }
83
- /**
84
- * Transform response: convert reasoning_content to thinking blocks
85
- */
86
- async transformResponseOut(response, _context) {
87
- if (!this.enabled) return response;
88
- const contentType = response.headers.get("Content-Type") ?? "";
89
- if (contentType.includes("application/json")) {
90
- return this.handleJsonResponse(response);
91
- } else if (contentType.includes("stream") || contentType.includes("text/event-stream")) {
92
- return this.handleStreamResponse(response);
93
- }
94
- return response;
95
- }
96
- /**
97
- * Handle JSON (non-streaming) response
98
- */
99
- async handleJsonResponse(response) {
100
- const jsonResponse = await response.json();
101
- if (jsonResponse.choices?.[0]?.message?.reasoning_content) {
102
- jsonResponse.thinking = {
103
- content: jsonResponse.choices[0].message.reasoning_content
104
- };
105
- delete jsonResponse.choices[0].message.reasoning_content;
106
- }
107
- return new Response(JSON.stringify(jsonResponse), {
108
- status: response.status,
109
- statusText: response.statusText,
110
- headers: response.headers
111
- });
112
- }
113
- /**
114
- * Handle streaming response - convert reasoning_content to thinking blocks
115
- */
116
- handleStreamResponse(response) {
117
- if (!response.body) {
118
- return response;
119
- }
120
- const decoder = new TextDecoder();
121
- const encoder = new TextEncoder();
122
- let reasoningContent = "";
123
- let isReasoningComplete = false;
124
- let buffer = "";
125
- const stream = new ReadableStream({
126
- start: async (controller) => {
127
- const reader = response.body.getReader();
128
- const processLine = (line) => {
129
- this.logger?.debug("Processing reasoning line:", line);
130
- if (line.startsWith("data: ") && line.trim() !== "data: [DONE]") {
131
- try {
132
- const data = JSON.parse(line.slice(6));
133
- if (data.choices?.[0]?.delta?.reasoning_content) {
134
- reasoningContent += data.choices[0].delta.reasoning_content;
135
- const thinkingChunk = {
136
- ...data,
137
- choices: [
138
- {
139
- ...data.choices[0],
140
- delta: {
141
- ...data.choices[0].delta,
142
- thinking: {
143
- content: data.choices[0].delta.reasoning_content
144
- }
145
- }
146
- }
147
- ]
148
- };
149
- delete thinkingChunk.choices[0].delta.reasoning_content;
150
- const thinkingLine = `data: ${JSON.stringify(thinkingChunk)}
151
-
152
- `;
153
- controller.enqueue(encoder.encode(thinkingLine));
154
- return;
155
- }
156
- if ((data.choices?.[0]?.delta?.content || data.choices?.[0]?.delta?.tool_calls) && reasoningContent && !isReasoningComplete) {
157
- isReasoningComplete = true;
158
- const signature = Date.now().toString();
159
- const thinkingChunk = {
160
- ...data,
161
- choices: [
162
- {
163
- ...data.choices[0],
164
- delta: {
165
- ...data.choices[0].delta,
166
- content: null,
167
- thinking: {
168
- signature
169
- }
170
- }
171
- }
172
- ]
173
- };
174
- delete thinkingChunk.choices[0].delta.reasoning_content;
175
- const thinkingLine = `data: ${JSON.stringify(thinkingChunk)}
176
-
177
- `;
178
- controller.enqueue(encoder.encode(thinkingLine));
179
- }
180
- if (data.choices?.[0]?.delta?.reasoning_content) {
181
- delete data.choices[0].delta.reasoning_content;
182
- }
183
- if (data.choices?.[0]?.delta && Object.keys(data.choices[0].delta).length > 0) {
184
- if (isReasoningComplete) {
185
- data.choices[0].index++;
186
- }
187
- const modifiedLine = `data: ${JSON.stringify(data)}
188
-
189
- `;
190
- controller.enqueue(encoder.encode(modifiedLine));
191
- }
192
- } catch (_e) {
193
- controller.enqueue(encoder.encode(line + "\n"));
194
- }
195
- } else {
196
- controller.enqueue(encoder.encode(line + "\n"));
197
- }
198
- };
199
- try {
200
- while (true) {
201
- const { done, value } = await reader.read();
202
- if (done) {
203
- if (buffer.trim()) {
204
- const lines2 = buffer.split("\n");
205
- for (const line of lines2) {
206
- if (line.trim()) {
207
- controller.enqueue(encoder.encode(line + "\n"));
208
- }
209
- }
210
- }
211
- break;
212
- }
213
- const chunk = decoder.decode(value, { stream: true });
214
- buffer += chunk;
215
- const lines = buffer.split("\n");
216
- buffer = lines.pop() || "";
217
- for (const line of lines) {
218
- if (!line.trim()) continue;
219
- try {
220
- processLine(line);
221
- } catch (error) {
222
- this.logger?.error("Error processing reasoning stream line:", error);
223
- controller.enqueue(encoder.encode(line + "\n"));
224
- }
225
- }
226
- }
227
- } catch (error) {
228
- this.logger?.error("Reasoning stream error:", error);
229
- controller.error(error);
230
- } finally {
231
- try {
232
- reader.releaseLock();
233
- } catch (e) {
234
- this.logger?.error("Error releasing reader lock:", e);
235
- }
236
- controller.close();
237
- }
238
- }
239
- });
240
- return new Response(stream, {
241
- status: response.status,
242
- statusText: response.statusText,
243
- headers: new Headers({
244
- "Content-Type": "text/event-stream",
245
- "Cache-Control": "no-cache",
246
- Connection: "keep-alive"
247
- })
248
- });
249
- }
250
- };
251
-
252
- export {
253
- ReasoningTransformer
254
- };
@@ -1,6 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _chunkC72S6TTVcjs = require('../../chunk-C72S6TTV.cjs');
4
-
5
-
6
- exports.OpenCodeGoTransformer = _chunkC72S6TTVcjs.OpenCodeGoTransformer;
@@ -1,51 +0,0 @@
1
- import { Transformer, TransformerLogger, LLMProvider, TransformerContext, UnifiedChatRequest } from '../types.cjs';
2
-
3
- /**
4
- * OpenCodeGoTransformer — minimal request/response normalizer for OpenCodeGo's
5
- * OpenAI-shape `/v1/chat/completions` upstream.
6
- *
7
- * The internal `UnifiedChatRequest` is already OpenAI-shape, so most of the
8
- * conversion work happens upstream of this transformer (AnthropicTransformer
9
- * decodes the SDK's Anthropic body to Unified at the chain's endpoint). This
10
- * transformer's job is to:
11
- *
12
- * - Drop `meta` (internal routing metadata) before serializing.
13
- * - Normalize `messages[].content` from `Array<MessageContent>` to a plain
14
- * string when it's a single text block — some OpenCodeGo models reject
15
- * the array form.
16
- * - Drop fields the upstream rejects (e.g. `reasoning` when the model
17
- * isn't a thinking model).
18
- *
19
- * **MiniMax models route to the Anthropic-shape `/v1/messages` upstream
20
- * BYPASSING this transformer entirely** — see the dispatch proxy's
21
- * subscription branch and `model-shape.ts`.
22
- *
23
- * @module transformer/transformers/OpenCodeGoTransformer
24
- */
25
-
26
- declare class OpenCodeGoTransformer implements Transformer {
27
- static TransformerName: string;
28
- name: string;
29
- endPoint: string;
30
- logger?: TransformerLogger;
31
- auth(request: unknown, _provider: LLMProvider, _context: TransformerContext): Promise<{
32
- body: unknown;
33
- config: {
34
- headers: Record<string, string | undefined>;
35
- };
36
- }>;
37
- /**
38
- * Unified → OpenAI Chat Completions.
39
- * Unified IS chat completions shape; this is mostly stripping `meta` and
40
- * normalizing string-content single-block messages.
41
- */
42
- transformRequestIn(request: UnifiedChatRequest, _provider: LLMProvider, _context: TransformerContext): Promise<Record<string, unknown>>;
43
- /**
44
- * OpenAI Chat Completions response → Unified.
45
- * The upstream's response shape already matches Unified — pass through.
46
- * The endpoint AnthropicTransformer re-encodes to Anthropic for the SDK.
47
- */
48
- transformResponseOut(response: Response, _context: TransformerContext): Promise<Response>;
49
- }
50
-
51
- export { OpenCodeGoTransformer };
@@ -1,51 +0,0 @@
1
- import { Transformer, TransformerLogger, LLMProvider, TransformerContext, UnifiedChatRequest } from '../types.js';
2
-
3
- /**
4
- * OpenCodeGoTransformer — minimal request/response normalizer for OpenCodeGo's
5
- * OpenAI-shape `/v1/chat/completions` upstream.
6
- *
7
- * The internal `UnifiedChatRequest` is already OpenAI-shape, so most of the
8
- * conversion work happens upstream of this transformer (AnthropicTransformer
9
- * decodes the SDK's Anthropic body to Unified at the chain's endpoint). This
10
- * transformer's job is to:
11
- *
12
- * - Drop `meta` (internal routing metadata) before serializing.
13
- * - Normalize `messages[].content` from `Array<MessageContent>` to a plain
14
- * string when it's a single text block — some OpenCodeGo models reject
15
- * the array form.
16
- * - Drop fields the upstream rejects (e.g. `reasoning` when the model
17
- * isn't a thinking model).
18
- *
19
- * **MiniMax models route to the Anthropic-shape `/v1/messages` upstream
20
- * BYPASSING this transformer entirely** — see the dispatch proxy's
21
- * subscription branch and `model-shape.ts`.
22
- *
23
- * @module transformer/transformers/OpenCodeGoTransformer
24
- */
25
-
26
- declare class OpenCodeGoTransformer implements Transformer {
27
- static TransformerName: string;
28
- name: string;
29
- endPoint: string;
30
- logger?: TransformerLogger;
31
- auth(request: unknown, _provider: LLMProvider, _context: TransformerContext): Promise<{
32
- body: unknown;
33
- config: {
34
- headers: Record<string, string | undefined>;
35
- };
36
- }>;
37
- /**
38
- * Unified → OpenAI Chat Completions.
39
- * Unified IS chat completions shape; this is mostly stripping `meta` and
40
- * normalizing string-content single-block messages.
41
- */
42
- transformRequestIn(request: UnifiedChatRequest, _provider: LLMProvider, _context: TransformerContext): Promise<Record<string, unknown>>;
43
- /**
44
- * OpenAI Chat Completions response → Unified.
45
- * The upstream's response shape already matches Unified — pass through.
46
- * The endpoint AnthropicTransformer re-encodes to Anthropic for the SDK.
47
- */
48
- transformResponseOut(response: Response, _context: TransformerContext): Promise<Response>;
49
- }
50
-
51
- export { OpenCodeGoTransformer };
@@ -1,6 +0,0 @@
1
- import {
2
- OpenCodeGoTransformer
3
- } from "../../chunk-Z7LUNECE.js";
4
- export {
5
- OpenCodeGoTransformer
6
- };
@@ -1,6 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _chunkDWKQZ2SKcjs = require('../../chunk-DWKQZ2SK.cjs');
4
-
5
-
6
- exports.ReasoningTransformer = _chunkDWKQZ2SKcjs.ReasoningTransformer;
@@ -1,47 +0,0 @@
1
- import { Transformer, TransformerLogger, TransformerOptions, UnifiedChatRequest, LLMProvider, TransformerContext } from '../types.cjs';
2
-
3
- /**
4
- * ReasoningTransformer - Transformer for reasoning/thinking mode support
5
- *
6
- * Handles:
7
- * - Converting reasoning config to thinking API parameters
8
- * - Converting reasoning_content in responses to thinking blocks
9
- * - Calculating thinking budget based on model and effort level
10
- *
11
- * @module transformer/transformers/ReasoningTransformer
12
- */
13
-
14
- /**
15
- * ReasoningTransformer handles reasoning/thinking mode for compatible models
16
- *
17
- * Features:
18
- * - Converts reasoning config to thinking API parameters
19
- * - Can be enabled/disabled via options
20
- * - Converts reasoning_content in stream responses to thinking blocks
21
- */
22
- declare class ReasoningTransformer implements Transformer {
23
- static TransformerName: string;
24
- name: string;
25
- logger?: TransformerLogger;
26
- private enabled;
27
- constructor(options?: TransformerOptions);
28
- /**
29
- * Transform request: convert reasoning config to thinking parameters
30
- * Uses model-specific budget calculation based on effort level
31
- */
32
- transformRequestIn(request: UnifiedChatRequest, provider: LLMProvider, _context: TransformerContext): Promise<Record<string, unknown>>;
33
- /**
34
- * Transform response: convert reasoning_content to thinking blocks
35
- */
36
- transformResponseOut(response: Response, _context: TransformerContext): Promise<Response>;
37
- /**
38
- * Handle JSON (non-streaming) response
39
- */
40
- private handleJsonResponse;
41
- /**
42
- * Handle streaming response - convert reasoning_content to thinking blocks
43
- */
44
- private handleStreamResponse;
45
- }
46
-
47
- export { ReasoningTransformer };
@@ -1,47 +0,0 @@
1
- import { Transformer, TransformerLogger, TransformerOptions, UnifiedChatRequest, LLMProvider, TransformerContext } from '../types.js';
2
-
3
- /**
4
- * ReasoningTransformer - Transformer for reasoning/thinking mode support
5
- *
6
- * Handles:
7
- * - Converting reasoning config to thinking API parameters
8
- * - Converting reasoning_content in responses to thinking blocks
9
- * - Calculating thinking budget based on model and effort level
10
- *
11
- * @module transformer/transformers/ReasoningTransformer
12
- */
13
-
14
- /**
15
- * ReasoningTransformer handles reasoning/thinking mode for compatible models
16
- *
17
- * Features:
18
- * - Converts reasoning config to thinking API parameters
19
- * - Can be enabled/disabled via options
20
- * - Converts reasoning_content in stream responses to thinking blocks
21
- */
22
- declare class ReasoningTransformer implements Transformer {
23
- static TransformerName: string;
24
- name: string;
25
- logger?: TransformerLogger;
26
- private enabled;
27
- constructor(options?: TransformerOptions);
28
- /**
29
- * Transform request: convert reasoning config to thinking parameters
30
- * Uses model-specific budget calculation based on effort level
31
- */
32
- transformRequestIn(request: UnifiedChatRequest, provider: LLMProvider, _context: TransformerContext): Promise<Record<string, unknown>>;
33
- /**
34
- * Transform response: convert reasoning_content to thinking blocks
35
- */
36
- transformResponseOut(response: Response, _context: TransformerContext): Promise<Response>;
37
- /**
38
- * Handle JSON (non-streaming) response
39
- */
40
- private handleJsonResponse;
41
- /**
42
- * Handle streaming response - convert reasoning_content to thinking blocks
43
- */
44
- private handleStreamResponse;
45
- }
46
-
47
- export { ReasoningTransformer };
@@ -1,6 +0,0 @@
1
- import {
2
- ReasoningTransformer
3
- } from "../../chunk-ZJZAOKI7.js";
4
- export {
5
- ReasoningTransformer
6
- };