@omnicross/core 0.1.5 → 0.1.7

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 (231) 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 +8 -6
  6. package/dist/auth/GeminiCodeAssistProjectResolver.js +6 -4
  7. package/dist/{chunk-3Z5BQZFM.cjs → chunk-235MXAGX.cjs} +3 -1
  8. package/dist/{chunk-HRRYG2AX.js → chunk-23S5OPIO.js} +10 -1
  9. package/dist/chunk-25GXJCEZ.cjs +40 -0
  10. package/dist/chunk-2E42SAW3.cjs +323 -0
  11. package/dist/chunk-2JYRIADS.js +40 -0
  12. package/dist/chunk-2Z4XM3H5.cjs +44 -0
  13. package/dist/{chunk-BODMAL6G.js → chunk-32O35CIF.js} +271 -91
  14. package/dist/chunk-3SCOLIPT.cjs +63 -0
  15. package/dist/{chunk-SYQF7OIR.js → chunk-3WD4HTR2.js} +2 -0
  16. package/dist/{chunk-CGKLE6IW.cjs → chunk-4BB343BI.cjs} +1489 -520
  17. package/dist/{chunk-VACWOIRE.cjs → chunk-4VZX5F4T.cjs} +39 -15
  18. package/dist/{chunk-5ZQBEOMD.js → chunk-5NJLQ6T6.js} +46 -12
  19. package/dist/chunk-5RSZYQJH.cjs +62 -0
  20. package/dist/chunk-6QQG7YG3.cjs +153 -0
  21. package/dist/{chunk-IFXJ2BG7.js → chunk-7C7DET6S.js} +51 -6
  22. package/dist/{chunk-IK3KE3AU.js → chunk-DE2SRBFZ.js} +1 -1
  23. package/dist/{chunk-FH2P4OCD.js → chunk-E3COOKUP.js} +1240 -271
  24. package/dist/{chunk-UHGVBFU3.js → chunk-EBLFCNPY.js} +38 -14
  25. package/dist/chunk-FU7EAR73.js +62 -0
  26. package/dist/chunk-FXR6N3SR.js +323 -0
  27. package/dist/{chunk-SUEGJ75D.cjs → chunk-GDIXXKF2.cjs} +46 -12
  28. package/dist/chunk-GFIZ6LQI.js +170 -0
  29. package/dist/chunk-GL6XM527.js +61 -0
  30. package/dist/chunk-HVBBDBS3.cjs +350 -0
  31. package/dist/{chunk-46ZIFWYG.cjs → chunk-IIRPUVPH.cjs} +7 -1
  32. package/dist/chunk-J3QQ6JS5.cjs +170 -0
  33. package/dist/{chunk-JWVTXXPX.cjs → chunk-KBM2W6UY.cjs} +8 -4
  34. package/dist/chunk-LB6EBS6Y.js +69 -0
  35. package/dist/{chunk-IWQAX3CS.js → chunk-LVUCAWMK.js} +1 -1
  36. package/dist/chunk-MKF46GNZ.js +350 -0
  37. package/dist/{chunk-HYN75H6G.cjs → chunk-MUHWHQVM.cjs} +1 -1
  38. package/dist/chunk-MYYR3HZL.js +44 -0
  39. package/dist/{chunk-MFZ5437A.js → chunk-N5T4M4GU.js} +1 -1
  40. package/dist/{chunk-5ENKBSWO.js → chunk-N7OOJI5V.js} +88 -8
  41. package/dist/chunk-NKVZ6Z3Y.cjs +61 -0
  42. package/dist/chunk-OF3BECU2.cjs +69 -0
  43. package/dist/{chunk-SNYBEXLB.cjs → chunk-OJGQKHN5.cjs} +3 -1
  44. package/dist/{chunk-DDMRUL76.cjs → chunk-OKMJLEXX.cjs} +5 -5
  45. package/dist/chunk-OPRS4IQZ.js +153 -0
  46. package/dist/chunk-OTZC4TNH.cjs +79 -0
  47. package/dist/{chunk-3Q6Z6JTO.cjs → chunk-OVQBNVSV.cjs} +287 -107
  48. package/dist/{chunk-4XMYPW46.cjs → chunk-OXHNSZ53.cjs} +84 -44
  49. package/dist/{chunk-C6OV7GCC.js → chunk-PEGTIPB3.js} +52 -12
  50. package/dist/chunk-PO3XB56Z.js +79 -0
  51. package/dist/{chunk-D3TDKWRP.js → chunk-RJ5ZGNI3.js} +54 -5
  52. package/dist/{chunk-PG7PS2NN.cjs → chunk-RJUONLUQ.cjs} +59 -10
  53. package/dist/{chunk-BPKCU575.js → chunk-SOO562NM.js} +3 -1
  54. package/dist/{chunk-6QZGDLL4.js → chunk-TOVPMMHM.js} +5 -1
  55. package/dist/{chunk-K52THW2C.cjs → chunk-V4TXMEJS.cjs} +5 -5
  56. package/dist/{chunk-G2UTNSGU.js → chunk-WNKWAEUR.js} +7 -1
  57. package/dist/{chunk-UNWKG6EI.cjs → chunk-XPIOJQS2.cjs} +51 -6
  58. package/dist/chunk-XXFYLL7R.js +63 -0
  59. package/dist/{chunk-KFI44N2R.cjs → chunk-YNJNTCSQ.cjs} +10 -1
  60. package/dist/{chunk-VQY5W4YW.cjs → chunk-YWL7YZWS.cjs} +90 -10
  61. package/dist/completion/ApiKeyPoolService.cjs +12 -0
  62. package/dist/completion/ApiKeyPoolService.d.cts +6 -0
  63. package/dist/completion/ApiKeyPoolService.d.ts +6 -0
  64. package/dist/completion/ApiKeyPoolService.js +12 -0
  65. package/dist/completion/CompletionService.cjs +30 -24
  66. package/dist/completion/CompletionService.d.cts +3 -1
  67. package/dist/completion/CompletionService.d.ts +3 -1
  68. package/dist/completion/CompletionService.js +29 -23
  69. package/dist/completion.cjs +32 -26
  70. package/dist/completion.d.cts +3 -1
  71. package/dist/completion.d.ts +3 -1
  72. package/dist/completion.js +31 -25
  73. package/dist/index.cjs +56 -29
  74. package/dist/index.d.cts +8 -8
  75. package/dist/index.d.ts +8 -8
  76. package/dist/index.js +61 -34
  77. package/dist/{keyPolicy-Cp0FntZl.d.cts → keyPolicy-zdWTu3CQ.d.cts} +1 -1
  78. package/dist/{keyPolicy-Cp0FntZl.d.ts → keyPolicy-zdWTu3CQ.d.ts} +1 -1
  79. package/dist/outbound-api/auditCapture.cjs +2 -2
  80. package/dist/outbound-api/auditCapture.d.cts +3 -4
  81. package/dist/outbound-api/auditCapture.d.ts +3 -4
  82. package/dist/outbound-api/auditCapture.js +1 -1
  83. package/dist/outbound-api/quotaWarn.d.cts +1 -1
  84. package/dist/outbound-api/quotaWarn.d.ts +1 -1
  85. package/dist/outbound-api/routeResolver.cjs +2 -2
  86. package/dist/outbound-api/routeResolver.d.cts +5 -3
  87. package/dist/outbound-api/routeResolver.d.ts +5 -3
  88. package/dist/outbound-api/routeResolver.js +1 -1
  89. package/dist/outbound-api/subscriptionRegistryPort.d.cts +2 -0
  90. package/dist/outbound-api/subscriptionRegistryPort.d.ts +2 -0
  91. package/dist/outbound-api/types.d.cts +4 -2
  92. package/dist/outbound-api/types.d.ts +4 -2
  93. package/dist/outbound-api.cjs +52 -25
  94. package/dist/outbound-api.d.cts +131 -87
  95. package/dist/outbound-api.d.ts +131 -87
  96. package/dist/outbound-api.js +55 -28
  97. package/dist/pipeline/AccountAllowanceScheduling.cjs +15 -0
  98. package/dist/pipeline/AccountAllowanceScheduling.d.cts +91 -0
  99. package/dist/pipeline/AccountAllowanceScheduling.d.ts +91 -0
  100. package/dist/pipeline/AccountAllowanceScheduling.js +15 -0
  101. package/dist/pipeline/AccountAllowanceStore.cjs +20 -0
  102. package/dist/pipeline/AccountAllowanceStore.d.cts +77 -0
  103. package/dist/pipeline/AccountAllowanceStore.d.ts +77 -0
  104. package/dist/pipeline/AccountAllowanceStore.js +20 -0
  105. package/dist/pipeline/AccountRouteActivity.cjs +10 -0
  106. package/dist/pipeline/AccountRouteActivity.d.cts +61 -0
  107. package/dist/pipeline/AccountRouteActivity.d.ts +61 -0
  108. package/dist/pipeline/AccountRouteActivity.js +10 -0
  109. package/dist/pipeline/AuthSource.d.cts +11 -2
  110. package/dist/pipeline/AuthSource.d.ts +11 -2
  111. package/dist/pipeline/BoundAccountSelectionError.cjs +10 -0
  112. package/dist/pipeline/BoundAccountSelectionError.d.cts +28 -0
  113. package/dist/pipeline/BoundAccountSelectionError.d.ts +28 -0
  114. package/dist/pipeline/BoundAccountSelectionError.js +10 -0
  115. package/dist/pipeline/LlmConfigProviderAuth.d.cts +1 -0
  116. package/dist/pipeline/LlmConfigProviderAuth.d.ts +1 -0
  117. package/dist/pipeline/ServerOverloadCounter.cjs +16 -0
  118. package/dist/pipeline/ServerOverloadCounter.d.cts +77 -0
  119. package/dist/pipeline/ServerOverloadCounter.d.ts +77 -0
  120. package/dist/pipeline/ServerOverloadCounter.js +16 -0
  121. package/dist/pipeline/SubscriptionAccountHealth.cjs +6 -2
  122. package/dist/pipeline/SubscriptionAccountHealth.d.cts +65 -8
  123. package/dist/pipeline/SubscriptionAccountHealth.d.ts +65 -8
  124. package/dist/pipeline/SubscriptionAccountHealth.js +5 -1
  125. package/dist/pipeline/SubscriptionAuthSource.cjs +5 -2
  126. package/dist/pipeline/SubscriptionAuthSource.d.cts +1 -0
  127. package/dist/pipeline/SubscriptionAuthSource.d.ts +1 -0
  128. package/dist/pipeline/SubscriptionAuthSource.js +4 -1
  129. package/dist/pipeline/SubscriptionAuthStrategy.d.cts +8 -3
  130. package/dist/pipeline/SubscriptionAuthStrategy.d.ts +8 -3
  131. package/dist/pipeline/executeProviderCall.cjs +2 -2
  132. package/dist/pipeline/executeProviderCall.d.cts +8 -3
  133. package/dist/pipeline/executeProviderCall.d.ts +8 -3
  134. package/dist/pipeline/executeProviderCall.js +1 -1
  135. package/dist/pipeline/resolveProviderChain.d.cts +2 -3
  136. package/dist/pipeline/resolveProviderChain.d.ts +2 -3
  137. package/dist/pipeline/resolveSubscriptionChain.d.cts +1 -0
  138. package/dist/pipeline/resolveSubscriptionChain.d.ts +1 -0
  139. package/dist/pipeline/upstreamFetch.cjs +5 -3
  140. package/dist/pipeline/upstreamFetch.d.cts +35 -6
  141. package/dist/pipeline/upstreamFetch.d.ts +35 -6
  142. package/dist/pipeline/upstreamFetch.js +4 -2
  143. package/dist/pipeline/upstreamTrace.cjs +4 -2
  144. package/dist/pipeline/upstreamTrace.d.cts +22 -8
  145. package/dist/pipeline/upstreamTrace.d.ts +22 -8
  146. package/dist/pipeline/upstreamTrace.js +3 -1
  147. package/dist/ports/pricing-store.d.cts +4 -3
  148. package/dist/ports/pricing-store.d.ts +4 -3
  149. package/dist/ports.d.cts +4 -3
  150. package/dist/ports.d.ts +4 -3
  151. package/dist/provider-proxy/ProviderProxy.cjs +30 -24
  152. package/dist/provider-proxy/ProviderProxy.d.cts +2 -0
  153. package/dist/provider-proxy/ProviderProxy.d.ts +2 -0
  154. package/dist/provider-proxy/ProviderProxy.js +29 -23
  155. package/dist/provider-proxy/identity/codexCliHeaders.cjs +10 -0
  156. package/dist/provider-proxy/identity/codexCliHeaders.d.cts +45 -0
  157. package/dist/provider-proxy/identity/codexCliHeaders.d.ts +45 -0
  158. package/dist/provider-proxy/identity/codexCliHeaders.js +10 -0
  159. package/dist/provider-proxy/ingress/providerProxyShared.cjs +32 -24
  160. package/dist/provider-proxy/ingress/providerProxyShared.d.cts +44 -5
  161. package/dist/provider-proxy/ingress/providerProxyShared.d.ts +44 -5
  162. package/dist/provider-proxy/ingress/providerProxyShared.js +31 -23
  163. package/dist/provider-proxy/matchText.cjs +4 -2
  164. package/dist/provider-proxy/matchText.d.cts +39 -6
  165. package/dist/provider-proxy/matchText.d.ts +39 -6
  166. package/dist/provider-proxy/matchText.js +3 -1
  167. package/dist/provider-proxy/types.d.cts +35 -2
  168. package/dist/provider-proxy/types.d.ts +35 -2
  169. package/dist/provider-proxy.cjs +30 -24
  170. package/dist/provider-proxy.d.cts +2 -0
  171. package/dist/provider-proxy.d.ts +2 -0
  172. package/dist/provider-proxy.js +29 -23
  173. package/dist/{routeResolver-C4T7yClx.d.ts → routeResolver-BxOfunbm.d.ts} +1 -1
  174. package/dist/{routeResolver-CB3tvJKy.d.cts → routeResolver-D5OzD0iM.d.cts} +1 -1
  175. package/dist/transformer/TransformerChainExecutor.cjs +2 -2
  176. package/dist/transformer/TransformerChainExecutor.js +1 -1
  177. package/dist/transformer/transformers/AnthropicTransformer.cjs +3 -2
  178. package/dist/transformer/transformers/AnthropicTransformer.js +2 -1
  179. package/dist/transformer/transformers/GeminiCodeAssistTransformer.cjs +3 -3
  180. package/dist/transformer/transformers/GeminiCodeAssistTransformer.js +2 -2
  181. package/dist/transformer/transformers/GeminiTransformer.cjs +3 -3
  182. package/dist/transformer/transformers/GeminiTransformer.js +2 -2
  183. package/dist/transformer/transformers/OpenAIResponseTransformer.cjs +3 -2
  184. package/dist/transformer/transformers/OpenAIResponseTransformer.d.cts +1 -1
  185. package/dist/transformer/transformers/OpenAIResponseTransformer.d.ts +1 -1
  186. package/dist/transformer/transformers/OpenAIResponseTransformer.js +2 -1
  187. package/dist/transformer/transformers/OpenAITransformer.cjs +6 -0
  188. package/dist/transformer/transformers/OpenAITransformer.d.cts +68 -0
  189. package/dist/transformer/transformers/OpenAITransformer.d.ts +68 -0
  190. package/dist/transformer/transformers/OpenAITransformer.js +6 -0
  191. package/dist/transformer/transformers.cjs +9 -14
  192. package/dist/transformer/transformers.d.cts +12 -48
  193. package/dist/transformer/transformers.d.ts +12 -48
  194. package/dist/transformer/transformers.js +11 -16
  195. package/dist/transformer/types.d.cts +17 -0
  196. package/dist/transformer/types.d.ts +17 -0
  197. package/dist/transformer.cjs +12 -12
  198. package/dist/transformer.d.cts +1 -2
  199. package/dist/transformer.d.ts +1 -2
  200. package/dist/transformer.js +12 -12
  201. package/dist/{types-lgPYQuZS.d.ts → types-CqZD77rS.d.ts} +173 -7
  202. package/dist/{types-B8Arpxn0.d.cts → types-gjJ5lJ5n.d.cts} +173 -7
  203. package/dist/usage/pricing-engine.cjs +2 -2
  204. package/dist/usage/pricing-engine.d.cts +29 -1
  205. package/dist/usage/pricing-engine.d.ts +29 -1
  206. package/dist/usage/pricing-engine.js +1 -1
  207. package/dist/usage/usage-recorder.cjs +2 -2
  208. package/dist/usage/usage-recorder.d.cts +5 -1
  209. package/dist/usage/usage-recorder.d.ts +5 -1
  210. package/dist/usage/usage-recorder.js +1 -1
  211. package/dist/usage.cjs +3 -3
  212. package/dist/usage.js +2 -2
  213. package/package.json +1 -1
  214. package/dist/chunk-7FEBOPJO.cjs +0 -50
  215. package/dist/chunk-DWKQZ2SK.cjs +0 -254
  216. package/dist/chunk-IAXWICZU.js +0 -69
  217. package/dist/chunk-IB3FDI4O.js +0 -50
  218. package/dist/chunk-OQWKZCXP.js +0 -242
  219. package/dist/chunk-QWBWGODS.cjs +0 -69
  220. package/dist/chunk-YMFAJFQT.cjs +0 -173
  221. package/dist/chunk-ZCIQ3L3R.cjs +0 -242
  222. package/dist/chunk-ZJZAOKI7.js +0 -254
  223. package/dist/chunk-ZLX3KGXX.js +0 -173
  224. package/dist/transformer/transformers/OpenCodeGoTransformer.cjs +0 -6
  225. package/dist/transformer/transformers/OpenCodeGoTransformer.d.cts +0 -51
  226. package/dist/transformer/transformers/OpenCodeGoTransformer.d.ts +0 -51
  227. package/dist/transformer/transformers/OpenCodeGoTransformer.js +0 -6
  228. package/dist/transformer/transformers/ReasoningTransformer.cjs +0 -6
  229. package/dist/transformer/transformers/ReasoningTransformer.d.cts +0 -47
  230. package/dist/transformer/transformers/ReasoningTransformer.d.ts +0 -47
  231. package/dist/transformer/transformers/ReasoningTransformer.js +0 -6
@@ -9,7 +9,7 @@
9
9
 
10
10
 
11
11
 
12
- var _chunkSUEGJ75Dcjs = require('./chunk-SUEGJ75D.cjs');
12
+ var _chunkGDIXXKF2cjs = require('./chunk-GDIXXKF2.cjs');
13
13
 
14
14
 
15
15
 
@@ -21,4 +21,4 @@ var _chunkSUEGJ75Dcjs = require('./chunk-SUEGJ75D.cjs');
21
21
 
22
22
 
23
23
 
24
- exports.convertAnthropicRequestToOpenAI = _chunkSUEGJ75Dcjs.convertAnthropicRequestToOpenAI; exports.convertAnthropicStreamToOpenAI = _chunkSUEGJ75Dcjs.convertAnthropicStreamToOpenAI; exports.convertAnthropicToOpenAI = _chunkSUEGJ75Dcjs.convertAnthropicToOpenAI; exports.convertAnthropicToOpenAIWithThinking = _chunkSUEGJ75Dcjs.convertAnthropicToOpenAIWithThinking; exports.convertOpenAIResponseToAnthropic = _chunkSUEGJ75Dcjs.convertOpenAIResponseToAnthropic; exports.convertOpenAIStreamToAnthropic = _chunkSUEGJ75Dcjs.convertOpenAIStreamToAnthropic; exports.convertOpenAIToAnthropic = _chunkSUEGJ75Dcjs.convertOpenAIToAnthropic; exports.convertOpenAIToAnthropicWithThinking = _chunkSUEGJ75Dcjs.convertOpenAIToAnthropicWithThinking; exports.hasImageContent = _chunkSUEGJ75Dcjs.hasImageContent; exports.hasThinkingEnabled = _chunkSUEGJ75Dcjs.hasThinkingEnabled;
24
+ exports.convertAnthropicRequestToOpenAI = _chunkGDIXXKF2cjs.convertAnthropicRequestToOpenAI; exports.convertAnthropicStreamToOpenAI = _chunkGDIXXKF2cjs.convertAnthropicStreamToOpenAI; exports.convertAnthropicToOpenAI = _chunkGDIXXKF2cjs.convertAnthropicToOpenAI; exports.convertAnthropicToOpenAIWithThinking = _chunkGDIXXKF2cjs.convertAnthropicToOpenAIWithThinking; exports.convertOpenAIResponseToAnthropic = _chunkGDIXXKF2cjs.convertOpenAIResponseToAnthropic; exports.convertOpenAIStreamToAnthropic = _chunkGDIXXKF2cjs.convertOpenAIStreamToAnthropic; exports.convertOpenAIToAnthropic = _chunkGDIXXKF2cjs.convertOpenAIToAnthropic; exports.convertOpenAIToAnthropicWithThinking = _chunkGDIXXKF2cjs.convertOpenAIToAnthropicWithThinking; exports.hasImageContent = _chunkGDIXXKF2cjs.hasImageContent; exports.hasThinkingEnabled = _chunkGDIXXKF2cjs.hasThinkingEnabled;
@@ -9,7 +9,7 @@ import {
9
9
  convertOpenAIToAnthropicWithThinking,
10
10
  hasImageContent,
11
11
  hasThinkingEnabled
12
- } from "./chunk-5ZQBEOMD.js";
12
+ } from "./chunk-5NJLQ6T6.js";
13
13
  export {
14
14
  convertAnthropicRequestToOpenAI,
15
15
  convertAnthropicStreamToOpenAI,
@@ -174,9 +174,10 @@ declare class CompletionService {
174
174
  * Resolve effective max_tokens value with priority:
175
175
  * 1. Session settings (if provided)
176
176
  * 2. Global model parameters (if enabled)
177
- * 3. Model's maxTokens from provider config
178
- * 4. Discovered models cache (from API)
179
- * 5. undefined - let API use its default
177
+ * 3. undefined - let API use its default
178
+ *
179
+ * Provider and discovery maxTokens values are capability metadata, not
180
+ * implicit per-request output limits.
180
181
  */
181
182
  resolveEffectiveMaxTokens(providerId: string, modelId: string, sessionMaxTokens?: number): Promise<number | undefined>;
182
183
  /**
@@ -174,9 +174,10 @@ declare class CompletionService {
174
174
  * Resolve effective max_tokens value with priority:
175
175
  * 1. Session settings (if provided)
176
176
  * 2. Global model parameters (if enabled)
177
- * 3. Model's maxTokens from provider config
178
- * 4. Discovered models cache (from API)
179
- * 5. undefined - let API use its default
177
+ * 3. undefined - let API use its default
178
+ *
179
+ * Provider and discovery maxTokens values are capability metadata, not
180
+ * implicit per-request output limits.
180
181
  */
181
182
  resolveEffectiveMaxTokens(providerId: string, modelId: string, sessionMaxTokens?: number): Promise<number | undefined>;
182
183
  /**
@@ -1,12 +1,14 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;
2
2
 
3
3
 
4
- var _chunkDDMRUL76cjs = require('../chunk-DDMRUL76.cjs');
5
- require('../chunk-JWVTXXPX.cjs');
4
+ var _chunkOKMJLEXXcjs = require('../chunk-OKMJLEXX.cjs');
5
+ require('../chunk-KBM2W6UY.cjs');
6
6
 
7
7
 
8
- var _chunkPG7PS2NNcjs = require('../chunk-PG7PS2NN.cjs');
9
- require('../chunk-3Z5BQZFM.cjs');
8
+ var _chunkRJUONLUQcjs = require('../chunk-RJUONLUQ.cjs');
9
+ require('../chunk-235MXAGX.cjs');
10
+ require('../chunk-HVBBDBS3.cjs');
11
+ require('../chunk-NKVZ6Z3Y.cjs');
10
12
 
11
13
  // src/auth/GeminiCodeAssistProjectResolver.ts
12
14
  var FREE_TIER_ID = "free-tier";
@@ -26,7 +28,7 @@ var GeminiCodeAssistHandshakeError = class extends Error {
26
28
  var GeminiCodeAssistProjectResolver = (_class = class {
27
29
  // upstream-proxy: the Code Assist handshake is upstream egress → honor the
28
30
  // gemini proxy by default (still injectable for tests).
29
- constructor(fetchImpl = (url, init) => _chunkPG7PS2NNcjs.fetchUpstream.call(void 0, url, init, { providerId: "gemini" })) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);
31
+ constructor(fetchImpl = (url, init) => _chunkRJUONLUQcjs.fetchUpstream.call(void 0, url, init, { providerId: "gemini" })) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);
30
32
  this.fetchImpl = fetchImpl;
31
33
  }
32
34
 
@@ -60,7 +62,7 @@ var GeminiCodeAssistProjectResolver = (_class = class {
60
62
  return run;
61
63
  }
62
64
  codeAssistUrl(method) {
63
- return `${_chunkDDMRUL76cjs.resolveCodeAssistEndpoint.call(void 0, )}/${_chunkDDMRUL76cjs.resolveCodeAssistApiVersion.call(void 0, )}:${method}`;
65
+ return `${_chunkOKMJLEXXcjs.resolveCodeAssistEndpoint.call(void 0, )}/${_chunkOKMJLEXXcjs.resolveCodeAssistApiVersion.call(void 0, )}:${method}`;
64
66
  }
65
67
  /** Seed project id from env; reject a purely-numeric value (project NUMBER). */
66
68
  seedProjectId() {
@@ -1,12 +1,14 @@
1
1
  import {
2
2
  resolveCodeAssistApiVersion,
3
3
  resolveCodeAssistEndpoint
4
- } from "../chunk-MFZ5437A.js";
5
- import "../chunk-6QZGDLL4.js";
4
+ } from "../chunk-N5T4M4GU.js";
5
+ import "../chunk-TOVPMMHM.js";
6
6
  import {
7
7
  fetchUpstream
8
- } from "../chunk-D3TDKWRP.js";
9
- import "../chunk-SYQF7OIR.js";
8
+ } from "../chunk-RJ5ZGNI3.js";
9
+ import "../chunk-3WD4HTR2.js";
10
+ import "../chunk-MKF46GNZ.js";
11
+ import "../chunk-GL6XM527.js";
10
12
 
11
13
  // src/auth/GeminiCodeAssistProjectResolver.ts
12
14
  var FREE_TIER_ID = "free-tier";
@@ -2,6 +2,7 @@
2
2
  var _promises = require('fs/promises');
3
3
  var _path = require('path');
4
4
  var tracePath = null;
5
+ var REDACTED_BODY = "***REDACTED (credential exchange)***";
5
6
  var SECRET_HEADER_NAMES = /* @__PURE__ */ new Set([
6
7
  "authorization",
7
8
  "api-key",
@@ -49,4 +50,5 @@ function __resetUpstreamTraceForTests() {
49
50
 
50
51
 
51
52
 
52
- exports.setUpstreamTracePath = setUpstreamTracePath; exports.getUpstreamTracePath = getUpstreamTracePath; exports.redactHeaders = redactHeaders; exports.writeUpstreamTrace = writeUpstreamTrace; exports.__resetUpstreamTraceForTests = __resetUpstreamTraceForTests;
53
+
54
+ exports.REDACTED_BODY = REDACTED_BODY; exports.setUpstreamTracePath = setUpstreamTracePath; exports.getUpstreamTracePath = getUpstreamTracePath; exports.redactHeaders = redactHeaders; exports.writeUpstreamTrace = writeUpstreamTrace; exports.__resetUpstreamTraceForTests = __resetUpstreamTraceForTests;
@@ -1,6 +1,12 @@
1
1
  import {
2
2
  serializeError
3
3
  } from "./chunk-AVYJ4YBN.js";
4
+ import {
5
+ isAccountAllowanceExhaustedError
6
+ } from "./chunk-OPRS4IQZ.js";
7
+ import {
8
+ isBoundAccountSelectionError
9
+ } from "./chunk-2JYRIADS.js";
4
10
 
5
11
  // src/pipeline/SubscriptionAuthSource.ts
6
12
  function stripAuthHeaders(headers) {
@@ -34,9 +40,12 @@ var SubscriptionAuthSource = class {
34
40
  resolvedModel: hints.model,
35
41
  sessionKey: hints.sessionKey,
36
42
  reportSelection: hints.reportSelection,
37
- preferredAccountId: hints.preferredAccountId
43
+ preferredAccountId: hints.preferredAccountId,
44
+ preferredAccountGroup: hints.preferredAccountGroup,
45
+ boundAccountFallbackPolicy: hints.boundAccountFallbackPolicy
38
46
  });
39
47
  } catch (err) {
48
+ if (isAccountAllowanceExhaustedError(err) || isBoundAccountSelectionError(err)) throw err;
40
49
  console.warn("[SubscriptionAuthSource] authStrategy.applyHeaders threw:", serializeError(err));
41
50
  }
42
51
  }
@@ -0,0 +1,40 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); var _class;// src/pipeline/BoundAccountSelectionError.ts
2
+ var FAILURE_MESSAGES = {
3
+ unavailable: "Bound subscription account is unavailable",
4
+ "not-found": "Bound subscription account was not found",
5
+ disabled: "Bound subscription account is disabled",
6
+ unhealthy: "Bound subscription account is unhealthy",
7
+ "model-incompatible": "Bound subscription account cannot serve the requested model",
8
+ "allowance-paused": "Bound subscription account is paused by the allowance policy",
9
+ "empty-token": "Bound subscription account has no usable token"
10
+ };
11
+ function boundAccountSelectionMessage(reason) {
12
+ return FAILURE_MESSAGES[reason];
13
+ }
14
+ var BoundAccountSelectionError = (_class = class extends Error {
15
+ constructor(providerId, reason, resumeAt) {
16
+ super(boundAccountSelectionMessage(reason));_class.prototype.__init.call(this);;
17
+ this.providerId = providerId;
18
+ this.reason = reason;
19
+ this.resumeAt = resumeAt;
20
+ this.name = "BoundAccountSelectionError";
21
+ this.status = reason === "allowance-paused" ? 429 : 503;
22
+ }
23
+
24
+
25
+
26
+ __init() {this.code = "bound_account_unavailable"}
27
+
28
+ }, _class);
29
+ function isBoundAccountSelectionError(error) {
30
+ if (error instanceof BoundAccountSelectionError) return true;
31
+ if (!error || typeof error !== "object") return false;
32
+ const value = error;
33
+ return value.code === "bound_account_unavailable" && (value.status === 429 || value.status === 503) && typeof value.reason === "string" && Object.prototype.hasOwnProperty.call(FAILURE_MESSAGES, value.reason);
34
+ }
35
+
36
+
37
+
38
+
39
+
40
+ exports.boundAccountSelectionMessage = boundAccountSelectionMessage; exports.BoundAccountSelectionError = BoundAccountSelectionError; exports.isBoundAccountSelectionError = isBoundAccountSelectionError;
@@ -0,0 +1,323 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;// src/usage/pricing-engine.ts
2
+
3
+
4
+
5
+ var _pricingtypes = require('@omnicross/contracts/pricing-types');
6
+ var PricingEngine = (_class = class {
7
+ constructor(store, logger, options = {}) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);_class.prototype.__init5.call(this);
8
+ this.store = store;
9
+ this.logger = logger;
10
+ this.options = options;
11
+ }
12
+
13
+
14
+
15
+ __init() {this.cache = /* @__PURE__ */ new Map()}
16
+ /**
17
+ * Secondary index keyed by modelId alone. Used as a fallback when no exact
18
+ * (providerId, modelId) match exists — usage may be recorded under a
19
+ * runtime provider alias while pricing rows use the canonical provider id,
20
+ * so matching by model name lets the price still resolve. First
21
+ * non-wildcard entry per model wins.
22
+ */
23
+ __init2() {this.cacheByModel = /* @__PURE__ */ new Map()}
24
+ /**
25
+ * Last-resort fuzzy index: `[normalizedModelId, entry]` pairs over the same
26
+ * non-wildcard, non-openrouter rows as `cacheByModel`. Used when even the
27
+ * model-name fallback misses — e.g. usage recorded under a bare model id
28
+ * (`glm-5.2`) while the catalog only knows prefixed slugs
29
+ * (`cloudflare/@cf/zai-org/glm-5.2`). This is an ESTIMATE: the matched row
30
+ * may be an aggregate-route price rather than the direct-vendor rate.
31
+ */
32
+ __init3() {this.fuzzyEntries = []}
33
+ __init4() {this.cacheLoaded = false}
34
+ /** Coalesce manual and background refreshes to prevent a catalog stampede. */
35
+ __init5() {this.refreshInFlight = null}
36
+ // ===== Cache management =====
37
+ /** Lazy-load and cache the full pricing table. */
38
+ async ensureCache() {
39
+ if (this.cacheLoaded) return;
40
+ const rows = await this.store.getAll();
41
+ this.cache = new Map(rows.map((r) => [keyOf(r.providerId, r.modelId), r]));
42
+ this.cacheByModel = /* @__PURE__ */ new Map();
43
+ this.fuzzyEntries = [];
44
+ for (const r of rows) {
45
+ if (r.providerId === "*" || r.providerId === "openrouter" || r.source === "openrouter") continue;
46
+ if (!this.cacheByModel.has(r.modelId)) this.cacheByModel.set(r.modelId, r);
47
+ this.fuzzyEntries.push([normalizeModelId(r.modelId), r]);
48
+ }
49
+ this.cacheLoaded = true;
50
+ }
51
+ /** Force a cache refresh — call after any write. */
52
+ async invalidateCache() {
53
+ this.cacheLoaded = false;
54
+ await this.ensureCache();
55
+ }
56
+ // ===== Read API =====
57
+ async getAll() {
58
+ await this.ensureCache();
59
+ return Array.from(this.cache.values());
60
+ }
61
+ /**
62
+ * Look up a price for (provider, model). Resolution order:
63
+ * 1. exact (providerId, modelId)
64
+ * 2. wildcard provider ('*', modelId)
65
+ * 3. model name alone (any provider) — tolerates a runtime-alias vs
66
+ * canonical provider-id mismatch for the same model.
67
+ * 4. normalized fuzzy match (last resort) — matches a bare id like
68
+ * `glm-5.2` against prefixed catalog slugs like
69
+ * `cloudflare/@cf/zai-org/glm-5.2`. ESTIMATE only: the matched row may
70
+ * be an aggregate-route price, not the direct-vendor rate.
71
+ */
72
+ async getEntry(providerId, modelId) {
73
+ await this.ensureCache();
74
+ const exact = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(this.cache.get(keyOf(providerId, modelId)), () => ( this.cache.get(keyOf("*", modelId)))), () => ( this.cacheByModel.get(modelId))), () => ( null));
75
+ if (exact) return exact;
76
+ return this.fuzzyMatch(modelId);
77
+ }
78
+ /**
79
+ * Normalized substring match over the catalog's non-openrouter rows. Lowercases
80
+ * and strips all non-alphanumerics, then matches bidirectionally, preferring
81
+ * the shortest catalog key (tightest match) to reduce over-matching version
82
+ * variants. Returns null when nothing matches.
83
+ */
84
+ fuzzyMatch(modelId) {
85
+ const normQuery = normalizeModelId(modelId);
86
+ if (!normQuery) return null;
87
+ let best = null;
88
+ let bestLen = Infinity;
89
+ for (const [key, entry] of this.fuzzyEntries) {
90
+ if (!key || !key.includes(normQuery) && !normQuery.includes(key)) continue;
91
+ if (key.length < bestLen) {
92
+ best = entry;
93
+ bestLen = key.length;
94
+ }
95
+ }
96
+ return best;
97
+ }
98
+ // ===== Cost calculation =====
99
+ /**
100
+ * Compute the cost (and cache savings) for a single response.
101
+ *
102
+ * Cost formula (USD):
103
+ * cost = (input * inputPrice
104
+ * + output * outputPrice
105
+ * + cacheRead * (cacheReadPrice ?? inputPrice)
106
+ * + cacheWrite * (cacheWritePrice ?? inputPrice)
107
+ * ) / 1e6
108
+ *
109
+ * Cache savings:
110
+ * savings = cacheRead * (inputPrice - cacheReadPrice) / 1e6
111
+ * — clamped at 0 if cacheReadPrice is null or ≥ inputPrice.
112
+ */
113
+ async calculateCost(providerId, modelId, usage) {
114
+ const entry = await this.getEntry(providerId, modelId);
115
+ if (!entry) {
116
+ return { costUsd: 0, costSavedByCacheUsd: 0 };
117
+ }
118
+ const ip = entry.inputPricePer1m;
119
+ const op = entry.outputPricePer1m;
120
+ const crp = _nullishCoalesce(entry.cacheReadPricePer1m, () => ( ip));
121
+ const cwp = _nullishCoalesce(entry.cacheWritePricePer1m, () => ( ip));
122
+ const costUsd = (usage.inputTokens * ip + usage.outputTokens * op + usage.cacheReadTokens * crp + usage.cacheCreationTokens * cwp) / 1e6;
123
+ const savingsRate = entry.cacheReadPricePer1m == null ? 0 : Math.max(0, ip - crp);
124
+ const costSavedByCacheUsd = usage.cacheReadTokens * savingsRate / 1e6;
125
+ return { costUsd, costSavedByCacheUsd };
126
+ }
127
+ // ===== Manual upsert (used by inline editors) =====
128
+ async upsertManual(input) {
129
+ const updated = await this.store.upsert(
130
+ input,
131
+ /* asUserEdit */
132
+ true
133
+ );
134
+ this.cache.set(keyOf(updated.providerId, updated.modelId), updated);
135
+ if (updated.providerId !== "*" && updated.providerId !== "openrouter" && updated.source !== "openrouter") {
136
+ this.cacheByModel.set(updated.modelId, updated);
137
+ }
138
+ return updated;
139
+ }
140
+ // ===== Source refresh =====
141
+ async fetchLatestFromSource() {
142
+ if (this.refreshInFlight) return this.refreshInFlight;
143
+ const refresh = this.refreshSources();
144
+ this.refreshInFlight = refresh;
145
+ try {
146
+ return await refresh;
147
+ } finally {
148
+ if (this.refreshInFlight === refresh) this.refreshInFlight = null;
149
+ }
150
+ }
151
+ async refreshSources() {
152
+ const sourceUrl = _nullishCoalesce(this.options.sourceUrl, () => ( _pricingtypes.DEFAULT_LITELLM_PRICING_URL));
153
+ const openRouterSourceUrl = _nullishCoalesce(this.options.openRouterSourceUrl, () => ( _pricingtypes.DEFAULT_OPENROUTER_PRICING_URL));
154
+ const fetchImpl = _nullishCoalesce(this.options.fetchImpl, () => ( fetch));
155
+ const timeoutMs = _nullishCoalesce(this.options.fetchTimeoutMs, () => ( 1e4));
156
+ const fetchedAt = Date.now();
157
+ const [litellm, openrouter] = await Promise.all([
158
+ fetchCatalog(fetchImpl, sourceUrl, timeoutMs, parseLitellmJson),
159
+ fetchCatalog(fetchImpl, openRouterSourceUrl, timeoutMs, parseOpenRouterJson)
160
+ ]);
161
+ const sources = [
162
+ sourceResult("litellm", sourceUrl, litellm),
163
+ sourceResult("openrouter", openRouterSourceUrl, openrouter)
164
+ ];
165
+ for (const source of sources) {
166
+ if (source.status === "failed") {
167
+ this.logger.warn(`[PricingEngine] ${source.source} pricing-source fetch failed`, {
168
+ error: source.error
169
+ });
170
+ }
171
+ }
172
+ if (!litellm.ok && !openrouter.ok) {
173
+ throw new Error(
174
+ `Pricing-source fetch failed: LiteLLM (${litellm.error}); OpenRouter (${openrouter.error})`
175
+ );
176
+ }
177
+ const applied = [];
178
+ const conflicts = [];
179
+ if (litellm.ok) {
180
+ const result = await this.store.bulkApplyFromSource(litellm.entries, "litellm");
181
+ applied.push(...result.applied);
182
+ conflicts.push(
183
+ ...result.conflicts.map((c) => ({
184
+ providerId: c.current.providerId,
185
+ modelId: c.current.modelId,
186
+ current: c.current,
187
+ incoming: c.incoming
188
+ }))
189
+ );
190
+ sources[0].appliedCount = result.applied.length;
191
+ }
192
+ if (openrouter.ok) {
193
+ const current = new Map(
194
+ (await this.store.getAll()).map((row) => [keyOf(row.providerId, row.modelId), row])
195
+ );
196
+ const supplemental = openrouter.entries.filter((incoming) => {
197
+ const row = current.get(keyOf(incoming.providerId, incoming.modelId));
198
+ return !row || row.source === "openrouter" || row.source === "builtin";
199
+ });
200
+ const result = await this.store.bulkApplyFromSource(supplemental, "openrouter");
201
+ applied.push(...result.applied);
202
+ sources[1].appliedCount = result.applied.length;
203
+ }
204
+ if (applied.length > 0) await this.invalidateCache();
205
+ return {
206
+ applied,
207
+ conflicts,
208
+ fetchedAt,
209
+ sourceUrl,
210
+ sources
211
+ };
212
+ }
213
+ // ===== Conflict resolution =====
214
+ async resolveConflicts(decisions, pendingIncoming) {
215
+ const resolutions = [];
216
+ for (const d of decisions) {
217
+ const incoming = pendingIncoming.get(keyOf(d.providerId, d.modelId));
218
+ if (!incoming) continue;
219
+ resolutions.push({ incoming, action: d.action });
220
+ }
221
+ const result = await this.store.applyResolutions(resolutions);
222
+ await this.invalidateCache();
223
+ return result;
224
+ }
225
+ }, _class);
226
+ var keyOf = (providerId, modelId) => `${providerId}::${modelId}`;
227
+ var normalizeModelId = (modelId) => (_nullishCoalesce(modelId, () => ( ""))).toLowerCase().replace(/[^a-z0-9]/g, "");
228
+ var PROVIDER_ALIASES = {
229
+ vertex_ai: "gemini",
230
+ google: "gemini",
231
+ bedrock: "anthropic",
232
+ azure: "openai"
233
+ };
234
+ var parseLitellmJson = (json) => {
235
+ if (!json || typeof json !== "object" || Array.isArray(json)) {
236
+ throw new Error("invalid LiteLLM catalog shape");
237
+ }
238
+ const out = [];
239
+ for (const [modelId, entry] of Object.entries(json)) {
240
+ if (modelId === "sample_spec") continue;
241
+ if (!entry || typeof entry !== "object") continue;
242
+ if (entry.input_cost_per_token == null || entry.output_cost_per_token == null) {
243
+ continue;
244
+ }
245
+ const rawProvider = _nullishCoalesce(entry.litellm_provider, () => ( ""));
246
+ const providerId = _nullishCoalesce(PROVIDER_ALIASES[rawProvider], () => ( rawProvider));
247
+ if (!providerId) continue;
248
+ out.push({
249
+ providerId,
250
+ modelId,
251
+ inputPricePer1m: entry.input_cost_per_token * 1e6,
252
+ outputPricePer1m: entry.output_cost_per_token * 1e6,
253
+ cacheReadPricePer1m: entry.cache_read_input_token_cost != null ? entry.cache_read_input_token_cost * 1e6 : null,
254
+ cacheWritePricePer1m: entry.cache_creation_input_token_cost != null ? entry.cache_creation_input_token_cost * 1e6 : null
255
+ });
256
+ }
257
+ return out;
258
+ };
259
+ var parseOpenRouterJson = (json) => {
260
+ if (!json || !Array.isArray(json.data)) {
261
+ throw new Error("invalid OpenRouter catalog shape");
262
+ }
263
+ const out = [];
264
+ for (const model of json.data) {
265
+ const modelId = typeof _optionalChain([model, 'optionalAccess', _ => _.id]) === "string" ? model.id.trim() : "";
266
+ const input = parseUnitPrice(_optionalChain([model, 'optionalAccess', _2 => _2.pricing, 'optionalAccess', _3 => _3.prompt]));
267
+ const output = parseUnitPrice(_optionalChain([model, 'optionalAccess', _4 => _4.pricing, 'optionalAccess', _5 => _5.completion]));
268
+ if (!modelId || input === null || output === null) continue;
269
+ const cacheRead = parseUnitPrice(_optionalChain([model, 'access', _6 => _6.pricing, 'optionalAccess', _7 => _7.input_cache_read]));
270
+ const cacheWrite = parseUnitPrice(_optionalChain([model, 'access', _8 => _8.pricing, 'optionalAccess', _9 => _9.input_cache_write]));
271
+ out.push({
272
+ providerId: "openrouter",
273
+ modelId,
274
+ inputPricePer1m: input * 1e6,
275
+ outputPricePer1m: output * 1e6,
276
+ cacheReadPricePer1m: cacheRead === null ? null : cacheRead * 1e6,
277
+ cacheWritePricePer1m: cacheWrite === null ? null : cacheWrite * 1e6
278
+ });
279
+ }
280
+ return out;
281
+ };
282
+ function parseUnitPrice(value) {
283
+ if (value === "" || value === null || value === void 0) return null;
284
+ const parsed = typeof value === "number" ? value : Number(value);
285
+ return Number.isFinite(parsed) && parsed >= 0 ? parsed : null;
286
+ }
287
+ async function fetchCatalog(fetchImpl, url, timeoutMs, parse) {
288
+ const controller = new AbortController();
289
+ const timer = setTimeout(() => controller.abort(), timeoutMs);
290
+ _optionalChain([timer, 'access', _10 => _10.unref, 'optionalCall', _11 => _11()]);
291
+ try {
292
+ const response = await fetchImpl(url, { signal: controller.signal });
293
+ if (!response.ok) throw new Error(`status ${response.status}`);
294
+ const entries = parse(await response.json());
295
+ if (entries.length === 0) throw new Error("pricing catalog contained no usable entries");
296
+ return { ok: true, entries };
297
+ } catch (error) {
298
+ const message = controller.signal.aborted ? `timeout after ${timeoutMs}ms` : error instanceof Error ? error.message : String(error);
299
+ return { ok: false, error: message };
300
+ } finally {
301
+ clearTimeout(timer);
302
+ }
303
+ }
304
+ function sourceResult(source, sourceUrl, attempt) {
305
+ return attempt.ok ? {
306
+ source,
307
+ sourceUrl,
308
+ status: "applied",
309
+ parsedCount: attempt.entries.length,
310
+ appliedCount: 0
311
+ } : {
312
+ source,
313
+ sourceUrl,
314
+ status: "failed",
315
+ parsedCount: 0,
316
+ appliedCount: 0,
317
+ error: attempt.error
318
+ };
319
+ }
320
+
321
+
322
+
323
+ exports.PricingEngine = PricingEngine;
@@ -0,0 +1,40 @@
1
+ // src/pipeline/BoundAccountSelectionError.ts
2
+ var FAILURE_MESSAGES = {
3
+ unavailable: "Bound subscription account is unavailable",
4
+ "not-found": "Bound subscription account was not found",
5
+ disabled: "Bound subscription account is disabled",
6
+ unhealthy: "Bound subscription account is unhealthy",
7
+ "model-incompatible": "Bound subscription account cannot serve the requested model",
8
+ "allowance-paused": "Bound subscription account is paused by the allowance policy",
9
+ "empty-token": "Bound subscription account has no usable token"
10
+ };
11
+ function boundAccountSelectionMessage(reason) {
12
+ return FAILURE_MESSAGES[reason];
13
+ }
14
+ var BoundAccountSelectionError = class extends Error {
15
+ constructor(providerId, reason, resumeAt) {
16
+ super(boundAccountSelectionMessage(reason));
17
+ this.providerId = providerId;
18
+ this.reason = reason;
19
+ this.resumeAt = resumeAt;
20
+ this.name = "BoundAccountSelectionError";
21
+ this.status = reason === "allowance-paused" ? 429 : 503;
22
+ }
23
+ providerId;
24
+ reason;
25
+ resumeAt;
26
+ code = "bound_account_unavailable";
27
+ status;
28
+ };
29
+ function isBoundAccountSelectionError(error) {
30
+ if (error instanceof BoundAccountSelectionError) return true;
31
+ if (!error || typeof error !== "object") return false;
32
+ const value = error;
33
+ return value.code === "bound_account_unavailable" && (value.status === 429 || value.status === 503) && typeof value.reason === "string" && Object.prototype.hasOwnProperty.call(FAILURE_MESSAGES, value.reason);
34
+ }
35
+
36
+ export {
37
+ boundAccountSelectionMessage,
38
+ BoundAccountSelectionError,
39
+ isBoundAccountSelectionError
40
+ };
@@ -0,0 +1,44 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkOXHNSZ53cjs = require('./chunk-OXHNSZ53.cjs');
4
+
5
+
6
+ var _chunkV4TXMEJScjs = require('./chunk-V4TXMEJS.cjs');
7
+
8
+
9
+ var _chunkOVQBNVSVcjs = require('./chunk-OVQBNVSV.cjs');
10
+
11
+
12
+ var _chunkOF3BECU2cjs = require('./chunk-OF3BECU2.cjs');
13
+
14
+
15
+ var _chunkOKMJLEXXcjs = require('./chunk-OKMJLEXX.cjs');
16
+
17
+ // src/transformer/transformers/index.ts
18
+ var BuiltinTransformers = {
19
+ OpenAITransformer: _chunkOF3BECU2cjs.OpenAITransformer,
20
+ GeminiTransformer: _chunkV4TXMEJScjs.GeminiTransformer,
21
+ GeminiCodeAssistTransformer: _chunkOKMJLEXXcjs.GeminiCodeAssistTransformer,
22
+ AnthropicTransformer: _chunkOXHNSZ53cjs.AnthropicTransformer,
23
+ OpenAIResponseTransformer: _chunkOVQBNVSVcjs.OpenAIResponseTransformer
24
+ };
25
+ function getBuiltinTransformers() {
26
+ return BuiltinTransformers;
27
+ }
28
+ var BUILTIN_TRANSFORMER_NAMES = [
29
+ "openai",
30
+ "gemini",
31
+ "gemini-code-assist",
32
+ "anthropic",
33
+ "openai-response"
34
+ ];
35
+ async function registerBuiltinTransformers(service) {
36
+ await service.initialize(getBuiltinTransformers());
37
+ }
38
+
39
+
40
+
41
+
42
+
43
+
44
+ exports.BuiltinTransformers = BuiltinTransformers; exports.getBuiltinTransformers = getBuiltinTransformers; exports.BUILTIN_TRANSFORMER_NAMES = BUILTIN_TRANSFORMER_NAMES; exports.registerBuiltinTransformers = registerBuiltinTransformers;