@omnicross/core 0.3.1 → 0.4.1

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 (61) hide show
  1. package/dist/auth/GeminiCodeAssistProjectResolver.cjs +5 -5
  2. package/dist/auth/GeminiCodeAssistProjectResolver.js +3 -3
  3. package/dist/{chunk-FHXDUHVE.cjs → chunk-2T6D7LWE.cjs} +1 -1
  4. package/dist/{chunk-ZAPN7XA6.cjs → chunk-3XVDFRCQ.cjs} +2 -2
  5. package/dist/{chunk-N5Q5PBV5.js → chunk-5DJSOFEP.js} +1 -1
  6. package/dist/{chunk-4VVCXVB7.js → chunk-5GXOYVLB.js} +17 -1
  7. package/dist/{chunk-STENJNJU.js → chunk-5TEWZN5J.js} +6 -6
  8. package/dist/{chunk-T55Z77BR.cjs → chunk-BKXC4XM6.cjs} +3 -3
  9. package/dist/{chunk-YVBHFVTF.js → chunk-C3NPMQTK.js} +2 -2
  10. package/dist/{chunk-VXRTQZF2.cjs → chunk-DKBXDV5U.cjs} +18 -2
  11. package/dist/{chunk-HOMUGKHR.js → chunk-GTDQCW3H.js} +29 -2
  12. package/dist/{chunk-T2VIZQT4.js → chunk-HDXSPXIN.js} +1 -1
  13. package/dist/{chunk-2C3TTBS7.js → chunk-PAXJGABW.js} +1 -1
  14. package/dist/{chunk-NJS2DZE6.js → chunk-PF7YQBKX.js} +1 -1
  15. package/dist/{chunk-EY3S7NJ3.cjs → chunk-QEOV6Y4E.cjs} +58 -58
  16. package/dist/{chunk-NRYLPGQB.js → chunk-QRXOLINS.js} +3 -1
  17. package/dist/{chunk-XGVPGH7V.cjs → chunk-TX3AEV6H.cjs} +2 -2
  18. package/dist/{chunk-OIKREZVQ.cjs → chunk-TX4UCSOP.cjs} +30 -3
  19. package/dist/{chunk-AKIOOFY3.cjs → chunk-YEVWA4C7.cjs} +3 -1
  20. package/dist/{chunk-RS773ZL3.cjs → chunk-ZSA44G7J.cjs} +3 -3
  21. package/dist/completion/CompletionService.cjs +10 -10
  22. package/dist/completion/CompletionService.js +9 -9
  23. package/dist/completion.cjs +16 -10
  24. package/dist/completion.d.cts +22 -1
  25. package/dist/completion.d.ts +22 -1
  26. package/dist/completion.js +16 -10
  27. package/dist/index.cjs +16 -10
  28. package/dist/index.d.cts +1 -1
  29. package/dist/index.d.ts +1 -1
  30. package/dist/index.js +16 -10
  31. package/dist/outbound-api/routeResolver.cjs +2 -2
  32. package/dist/outbound-api/routeResolver.js +1 -1
  33. package/dist/outbound-api.cjs +10 -10
  34. package/dist/outbound-api.js +9 -9
  35. package/dist/pipeline/AccountAllowanceScheduling.cjs +3 -3
  36. package/dist/pipeline/AccountAllowanceScheduling.js +2 -2
  37. package/dist/pipeline/AccountAllowanceStore.cjs +2 -2
  38. package/dist/pipeline/AccountAllowanceStore.js +1 -1
  39. package/dist/pipeline/LlmConfigProviderAuth.cjs +2 -2
  40. package/dist/pipeline/LlmConfigProviderAuth.js +1 -1
  41. package/dist/pipeline/SubscriptionAuthSource.cjs +4 -4
  42. package/dist/pipeline/SubscriptionAuthSource.js +3 -3
  43. package/dist/pipeline/upstreamFetch.cjs +3 -3
  44. package/dist/pipeline/upstreamFetch.js +2 -2
  45. package/dist/provider-proxy/ProviderProxy.cjs +10 -10
  46. package/dist/provider-proxy/ProviderProxy.js +9 -9
  47. package/dist/provider-proxy/ingress/providerProxyShared.cjs +10 -10
  48. package/dist/provider-proxy/ingress/providerProxyShared.js +9 -9
  49. package/dist/provider-proxy.cjs +10 -10
  50. package/dist/provider-proxy.js +9 -9
  51. package/dist/transformer/transformers/GeminiCodeAssistTransformer.cjs +6 -2
  52. package/dist/transformer/transformers/GeminiCodeAssistTransformer.d.cts +9 -1
  53. package/dist/transformer/transformers/GeminiCodeAssistTransformer.d.ts +9 -1
  54. package/dist/transformer/transformers/GeminiCodeAssistTransformer.js +5 -1
  55. package/dist/transformer/transformers.cjs +13 -3
  56. package/dist/transformer/transformers.d.cts +1 -0
  57. package/dist/transformer/transformers.d.ts +1 -0
  58. package/dist/transformer/transformers.js +14 -4
  59. package/dist/transformer.cjs +3 -3
  60. package/dist/transformer.js +2 -2
  61. package/package.json +2 -2
@@ -62,7 +62,7 @@ var _chunkKQBLZMP6cjs = require('./chunk-KQBLZMP6.cjs');
62
62
 
63
63
 
64
64
 
65
- var _chunkOIKREZVQcjs = require('./chunk-OIKREZVQ.cjs');
65
+ var _chunkTX4UCSOPcjs = require('./chunk-TX4UCSOP.cjs');
66
66
 
67
67
 
68
68
  var _chunkQXD4MV2Xcjs = require('./chunk-QXD4MV2X.cjs');
@@ -78,13 +78,13 @@ var _chunkOTZC4TNHcjs = require('./chunk-OTZC4TNH.cjs');
78
78
  var _chunk7LRTPNFLcjs = require('./chunk-7LRTPNFL.cjs');
79
79
 
80
80
 
81
- var _chunkXGVPGH7Vcjs = require('./chunk-XGVPGH7V.cjs');
81
+ var _chunkTX3AEV6Hcjs = require('./chunk-TX3AEV6H.cjs');
82
82
 
83
83
 
84
84
  var _chunkSVNDB62Dcjs = require('./chunk-SVNDB62D.cjs');
85
85
 
86
86
 
87
- var _chunkT55Z77BRcjs = require('./chunk-T55Z77BR.cjs');
87
+ var _chunkBKXC4XM6cjs = require('./chunk-BKXC4XM6.cjs');
88
88
 
89
89
 
90
90
 
@@ -109,7 +109,7 @@ var _chunk4YINUUKQcjs = require('./chunk-4YINUUKQ.cjs');
109
109
 
110
110
 
111
111
 
112
- var _chunkAKIOOFY3cjs = require('./chunk-AKIOOFY3.cjs');
112
+ var _chunkYEVWA4C7cjs = require('./chunk-YEVWA4C7.cjs');
113
113
 
114
114
 
115
115
  var _chunkQBZJ7P2Tcjs = require('./chunk-QBZJ7P2T.cjs');
@@ -137,10 +137,10 @@ var _chunkGDIXXKF2cjs = require('./chunk-GDIXXKF2.cjs');
137
137
  var _chunkIUL4VWNUcjs = require('./chunk-IUL4VWNU.cjs');
138
138
 
139
139
 
140
- var _chunkRS773ZL3cjs = require('./chunk-RS773ZL3.cjs');
140
+ var _chunkZSA44G7Jcjs = require('./chunk-ZSA44G7J.cjs');
141
141
 
142
142
 
143
- var _chunkFHXDUHVEcjs = require('./chunk-FHXDUHVE.cjs');
143
+ var _chunk2T6D7LWEcjs = require('./chunk-2T6D7LWE.cjs');
144
144
 
145
145
 
146
146
  var _chunkNKVZ6Z3Ycjs = require('./chunk-NKVZ6Z3Y.cjs');
@@ -1545,7 +1545,7 @@ async function buildSubscriptionPlan(res, route, deps, anthropicBody, routeModel
1545
1545
  function buildSubscriptionIterationPlan(profile, route, deps, resolvedModel, isStream, scenario, sessionKey) {
1546
1546
  const upstreamUrl = _optionalChain([profile, 'access', _103 => _103.resolveUpstreamUrl, 'optionalCall', _104 => _104(resolvedModel, route.subscriptionConfig)]);
1547
1547
  if (!upstreamUrl) return null;
1548
- const auth = _nullishCoalesce(route.auth, () => ( new (0, _chunkXGVPGH7Vcjs.SubscriptionAuthSource)(profile)));
1548
+ const auth = _nullishCoalesce(route.auth, () => ( new (0, _chunkTX3AEV6Hcjs.SubscriptionAuthSource)(profile)));
1549
1549
  const sameFormat = profile.mode === "pass-through" || upstreamUrl.endsWith("/v1/messages");
1550
1550
  const overrideNames = _optionalChain([profile, 'access', _105 => _105.resolveProviderTransformerNames, 'optionalCall', _106 => _106(
1551
1551
  resolvedModel,
@@ -1669,7 +1669,7 @@ async function runPipeline(anthropicBody, plan, reportSelection, signal) {
1669
1669
  },
1670
1670
  fetchFn: (url, headers, body) => {
1671
1671
  console.info(`[ProviderProxy:anthropic] -> ${url} model=${resolvedModel} stream=${isStream}`);
1672
- return _chunkRS773ZL3cjs.fetchUpstream.call(void 0,
1672
+ return _chunkZSA44G7Jcjs.fetchUpstream.call(void 0,
1673
1673
  url,
1674
1674
  { method: "POST", headers, body: JSON.stringify(body), signal },
1675
1675
  {
@@ -1739,7 +1739,7 @@ async function runSubscriptionSameFormatFetch(rawBody, plan, reportSelection, op
1739
1739
  `[ProviderProxy:anthropic] (subscription same-format) -> ${_nullishCoalesce(urlOverride, () => ( plan.upstreamUrl))} model=${outboundModel} stream=${plan.isStream}`
1740
1740
  );
1741
1741
  let activityRecordId;
1742
- const response = await _chunkRS773ZL3cjs.fetchUpstream.call(void 0,
1742
+ const response = await _chunkZSA44G7Jcjs.fetchUpstream.call(void 0,
1743
1743
  _nullishCoalesce(urlOverride, () => ( plan.upstreamUrl)),
1744
1744
  { method: "POST", headers, body: outboundBody, signal: options.signal },
1745
1745
  {
@@ -2338,7 +2338,7 @@ function parseCodexUsageLimitErrorPayload(bodyText) {
2338
2338
  }
2339
2339
  }
2340
2340
  function deadlineFromAllowanceSnapshot(accountId, now) {
2341
- const snapshot = _chunkFHXDUHVEcjs.getSharedAccountAllowanceStore.call(void 0, ).get(PROVIDER_ID, accountId, now);
2341
+ const snapshot = _chunk2T6D7LWEcjs.getSharedAccountAllowanceStore.call(void 0, ).get(PROVIDER_ID, accountId, now);
2342
2342
  if (!snapshot) return void 0;
2343
2343
  const candidates = snapshot.windows.filter(
2344
2344
  (w) => typeof w.usedPercent === "number" && w.usedPercent >= QUOTA_EXHAUSTED_PERCENT && typeof w.resetsAt === "string"
@@ -2763,7 +2763,7 @@ async function buildByoPlan(route, deps, resolved, resolvedModel, isStream, affi
2763
2763
  }
2764
2764
  const selectedKeyId = _nullishCoalesce(preferredKeyId, () => ( (route.sessionId && typeof _optionalChain([deps, 'access', _144 => _144.apiKeyPool, 'optionalAccess', _145 => _145.getKeyIdForSession]) === "function" ? _nullishCoalesce(deps.apiKeyPool.getKeyIdForSession(providerId, route.sessionId), () => ( void 0)) : void 0)));
2765
2765
  const credential = selectedKeyId ? { kind: "byo-key", id: selectedKeyId } : { kind: "provider-key", id: providerId };
2766
- const auth = affinityKeyId ? new (0, _chunkOIKREZVQcjs.LlmConfigProviderAuth)({ provider, apiKey, apiKeyPool: null, providerId, sessionId: route.sessionId }) : _nullishCoalesce(route.auth, () => ( new (0, _chunkOIKREZVQcjs.LlmConfigProviderAuth)({
2766
+ const auth = affinityKeyId ? new (0, _chunkTX4UCSOPcjs.LlmConfigProviderAuth)({ provider, apiKey, apiKeyPool: null, providerId, sessionId: route.sessionId }) : _nullishCoalesce(route.auth, () => ( new (0, _chunkTX4UCSOPcjs.LlmConfigProviderAuth)({
2767
2767
  provider,
2768
2768
  apiKey,
2769
2769
  apiKeyPool: _nullishCoalesce(deps.apiKeyPool, () => ( null)),
@@ -2802,7 +2802,7 @@ async function buildSubscriptionPlan2(route, deps, resolved, resolvedModel, isSt
2802
2802
  const profile = route.subscriptionProfile;
2803
2803
  const upstreamUrl = resolved.upstreamUrl;
2804
2804
  const affinityAccountId = _optionalChain([affinity, 'optionalAccess', _148 => _148.credential, 'access', _149 => _149.kind]) === "subscription-account" ? affinity.credential.id : void 0;
2805
- const auth = _nullishCoalesce(route.auth, () => ( new (0, _chunkXGVPGH7Vcjs.SubscriptionAuthSource)(profile)));
2805
+ const auth = _nullishCoalesce(route.auth, () => ( new (0, _chunkTX3AEV6Hcjs.SubscriptionAuthSource)(profile)));
2806
2806
  const chain = resolved.profile === "native" ? { providerTransformers: [], modelTransformers: [] } : _chunkNYUNU75Acjs.resolveSubscriptionChain.call(void 0,
2807
2807
  profile,
2808
2808
  deps.llmConfig.getTransformerService(),
@@ -2907,7 +2907,7 @@ async function runNative(body, plan, operation, signal) {
2907
2907
  decorateCodexHeaders(headers, plan);
2908
2908
  const url = operation === "compact" ? deriveResponsesCompactUrl(plan.upstreamUrl) : plan.upstreamUrl;
2909
2909
  let activityRecordId;
2910
- const response = await _chunkRS773ZL3cjs.fetchUpstream.call(void 0,
2910
+ const response = await _chunkZSA44G7Jcjs.fetchUpstream.call(void 0,
2911
2911
  url,
2912
2912
  { method: "POST", headers, body: JSON.stringify(body), signal },
2913
2913
  {
@@ -2955,7 +2955,7 @@ async function runReduced(body, plan, signal) {
2955
2955
  decorateCodexHeaders(headers, plan);
2956
2956
  return headers;
2957
2957
  },
2958
- fetchFn: (url, headers, requestBody) => _chunkRS773ZL3cjs.fetchUpstream.call(void 0,
2958
+ fetchFn: (url, headers, requestBody) => _chunkZSA44G7Jcjs.fetchUpstream.call(void 0,
2959
2959
  url,
2960
2960
  { method: "POST", headers, body: JSON.stringify(requestBody), signal },
2961
2961
  {
@@ -3747,7 +3747,7 @@ async function handleOpenAIResponsesRequest(res, rawBody, route, deps, requestHe
3747
3747
  }
3748
3748
  const errMsg = _chunkSVNDB62Dcjs.serializeError.call(void 0, err);
3749
3749
  console.error("[ProviderProxy:responses] Pipeline error:", errMsg);
3750
- writeError(res, _chunkT55Z77BRcjs.isAccountAllowanceExhaustedError.call(void 0, err) ? 429 : 502, errMsg);
3750
+ writeError(res, _chunkBKXC4XM6cjs.isAccountAllowanceExhaustedError.call(void 0, err) ? 429 : 502, errMsg);
3751
3751
  }
3752
3752
  return;
3753
3753
  }
@@ -4156,7 +4156,7 @@ async function handleAnthropicMessagesByo(res, rawBody, route, deps, options = {
4156
4156
  }
4157
4157
  const errMsg = _chunkSVNDB62Dcjs.serializeError.call(void 0, err);
4158
4158
  console.error("[ProviderProxy:anthropic] Pipeline error:", errMsg);
4159
- writeError(res, _chunkT55Z77BRcjs.isAccountAllowanceExhaustedError.call(void 0, err) ? 429 : 502, errMsg);
4159
+ writeError(res, _chunkBKXC4XM6cjs.isAccountAllowanceExhaustedError.call(void 0, err) ? 429 : 502, errMsg);
4160
4160
  }
4161
4161
  }
4162
4162
  async function buildByoPlan2(res, route, deps, resolvedModel, isStream) {
@@ -4182,7 +4182,7 @@ async function buildByoPlan2(res, route, deps, resolvedModel, isStream) {
4182
4182
  writeError(res, 502, "API key not configured");
4183
4183
  return null;
4184
4184
  }
4185
- const auth = _nullishCoalesce(route.auth, () => ( new (0, _chunkOIKREZVQcjs.LlmConfigProviderAuth)({
4185
+ const auth = _nullishCoalesce(route.auth, () => ( new (0, _chunkTX4UCSOPcjs.LlmConfigProviderAuth)({
4186
4186
  provider,
4187
4187
  apiKey,
4188
4188
  apiKeyPool: _nullishCoalesce(deps.apiKeyPool, () => ( null)),
@@ -4220,7 +4220,7 @@ async function runSameFormatFetch(bodyToSend, plan, options, keyOverride, urlOve
4220
4220
  throw new Error("[ProviderProxy:anthropic] same-format BYO path requires a provider row");
4221
4221
  }
4222
4222
  const effectiveKey = _nullishCoalesce(_nullishCoalesce(keyOverride, () => ( apiKey)), () => ( ""));
4223
- const headers = _chunkOIKREZVQcjs.getProviderHeaders.call(void 0, provider, effectiveKey);
4223
+ const headers = _chunkTX4UCSOPcjs.getProviderHeaders.call(void 0, provider, effectiveKey);
4224
4224
  const callerBeta = _optionalChain([options, 'access', _209 => _209.callerAnthropicBeta, 'optionalAccess', _210 => _210.trim, 'call', _211 => _211()]);
4225
4225
  if (callerBeta) {
4226
4226
  const existing = _nullishCoalesce(headers["anthropic-beta"], () => ( headers["Anthropic-Beta"]));
@@ -4237,7 +4237,7 @@ async function runSameFormatFetch(bodyToSend, plan, options, keyOverride, urlOve
4237
4237
  headers["anthropic-version"] = callerVersion || DEFAULT_ANTHROPIC_VERSION;
4238
4238
  const url = _nullishCoalesce(urlOverride, () => ( _chunkA2YMUCBTcjs.buildProviderApiUrl.call(void 0, provider, { model: resolvedModel, stream: isStream })));
4239
4239
  console.info(`[ProviderProxy:anthropic] (same-format) -> ${url} model=${resolvedModel} stream=${isStream}`);
4240
- const response = await _chunkRS773ZL3cjs.fetchUpstream.call(void 0,
4240
+ const response = await _chunkZSA44G7Jcjs.fetchUpstream.call(void 0,
4241
4241
  url,
4242
4242
  { method: "POST", headers, body: bodyToSend, signal: options.signal },
4243
4243
  { providerId: "byo" }
@@ -4429,7 +4429,7 @@ async function handleAnthropicCountTokens(res, rawBody, route, deps, options = {
4429
4429
  }
4430
4430
  const errMsg = _chunkSVNDB62Dcjs.serializeError.call(void 0, err);
4431
4431
  console.error("[ProviderProxy:anthropic] count_tokens error:", errMsg);
4432
- writeError(res, _chunkT55Z77BRcjs.isAccountAllowanceExhaustedError.call(void 0, err) ? 429 : 502, errMsg);
4432
+ writeError(res, _chunkBKXC4XM6cjs.isAccountAllowanceExhaustedError.call(void 0, err) ? 429 : 502, errMsg);
4433
4433
  }
4434
4434
  }
4435
4435
  function writeCountTokensEstimate(res, body, budgetMs) {
@@ -4758,7 +4758,7 @@ async function buildByoPlan3(res, route, deps, resolvedModel, isStream) {
4758
4758
  writeError(res, 502, "API key not configured");
4759
4759
  return null;
4760
4760
  }
4761
- const auth = _nullishCoalesce(route.auth, () => ( new (0, _chunkOIKREZVQcjs.LlmConfigProviderAuth)({
4761
+ const auth = _nullishCoalesce(route.auth, () => ( new (0, _chunkTX4UCSOPcjs.LlmConfigProviderAuth)({
4762
4762
  provider,
4763
4763
  apiKey,
4764
4764
  apiKeyPool: _nullishCoalesce(deps.apiKeyPool, () => ( null)),
@@ -4809,7 +4809,7 @@ async function runPipeline2(geminiBody, plan) {
4809
4809
  },
4810
4810
  fetchFn: (url, headers, body) => {
4811
4811
  console.log(`[ProviderProxy:gemini] -> ${url} model=${resolvedModel} stream=${isStream}`);
4812
- return _chunkRS773ZL3cjs.fetchUpstream.call(void 0,
4812
+ return _chunkZSA44G7Jcjs.fetchUpstream.call(void 0,
4813
4813
  url,
4814
4814
  { method: "POST", headers, body: JSON.stringify(body) },
4815
4815
  { providerId: "byo" }
@@ -4945,7 +4945,7 @@ async function handleOpenAIChatRequest(res, rawBody, route, deps) {
4945
4945
  }
4946
4946
  const errMsg = _chunkSVNDB62Dcjs.serializeError.call(void 0, err);
4947
4947
  console.error("[ProviderProxy:chat] Pipeline error:", errMsg);
4948
- writeError(res, _chunkT55Z77BRcjs.isAccountAllowanceExhaustedError.call(void 0, err) ? 429 : 502, errMsg);
4948
+ writeError(res, _chunkBKXC4XM6cjs.isAccountAllowanceExhaustedError.call(void 0, err) ? 429 : 502, errMsg);
4949
4949
  }
4950
4950
  }
4951
4951
  async function buildByoPlan4(res, route, deps, resolvedModel, isStream) {
@@ -4971,7 +4971,7 @@ async function buildByoPlan4(res, route, deps, resolvedModel, isStream) {
4971
4971
  writeError(res, 502, "API key not configured");
4972
4972
  return null;
4973
4973
  }
4974
- const auth = _nullishCoalesce(route.auth, () => ( new (0, _chunkOIKREZVQcjs.LlmConfigProviderAuth)({
4974
+ const auth = _nullishCoalesce(route.auth, () => ( new (0, _chunkTX4UCSOPcjs.LlmConfigProviderAuth)({
4975
4975
  provider,
4976
4976
  apiKey,
4977
4977
  apiKeyPool: _nullishCoalesce(deps.apiKeyPool, () => ( null)),
@@ -5019,7 +5019,7 @@ async function buildSubscriptionPlan3(res, route, deps, resolvedModel, isStream)
5019
5019
  writeError(res, 502, "Subscription profile is missing resolveUpstreamUrl");
5020
5020
  return null;
5021
5021
  }
5022
- const auth = _nullishCoalesce(route.auth, () => ( new (0, _chunkXGVPGH7Vcjs.SubscriptionAuthSource)(profile)));
5022
+ const auth = _nullishCoalesce(route.auth, () => ( new (0, _chunkTX3AEV6Hcjs.SubscriptionAuthSource)(profile)));
5023
5023
  const chain = _chunkNYUNU75Acjs.resolveSubscriptionChain.call(void 0,
5024
5024
  profile,
5025
5025
  deps.llmConfig.getTransformerService(),
@@ -5079,7 +5079,7 @@ async function runPipeline3(chatBody, plan) {
5079
5079
  },
5080
5080
  fetchFn: (url, headers, body) => {
5081
5081
  console.log(`[ProviderProxy:chat] -> ${url} model=${resolvedModel} stream=${isStream}`);
5082
- return _chunkRS773ZL3cjs.fetchUpstream.call(void 0,
5082
+ return _chunkZSA44G7Jcjs.fetchUpstream.call(void 0,
5083
5083
  url,
5084
5084
  { method: "POST", headers, body: JSON.stringify(body) },
5085
5085
  { providerId: plan.proxyProviderId, accountId: proxyAccountId }
@@ -5878,9 +5878,9 @@ function routeCanServe(binding, requestedModel, role) {
5878
5878
  if (_optionalChain([binding, 'access', _298 => _298.modelMappings, 'optionalAccess', _299 => _299.length])) {
5879
5879
  return nonBlank(resolveGatewayModelMapping(binding.modelMappings, requestedModel));
5880
5880
  }
5881
- if (_chunkAKIOOFY3cjs.isKindMappedEndpoint.call(void 0, binding.endpoint)) {
5881
+ if (_chunkYEVWA4C7cjs.isKindMappedEndpoint.call(void 0, binding.endpoint)) {
5882
5882
  const map = _nullishCoalesce(binding.modelMap, () => ( {}));
5883
- const kind = _chunkAKIOOFY3cjs.detectModelKind.call(void 0, binding.endpoint, requestedModel);
5883
+ const kind = _chunkYEVWA4C7cjs.detectModelKind.call(void 0, binding.endpoint, requestedModel);
5884
5884
  if (kind && nonBlank(map[kind])) return true;
5885
5885
  if (binding.endpoint === "messages") {
5886
5886
  return MESSAGE_FALLBACK_KINDS.some((candidate) => nonBlank(map[candidate]));
@@ -5888,7 +5888,7 @@ function routeCanServe(binding, requestedModel, role) {
5888
5888
  return nonBlank(map.codex);
5889
5889
  }
5890
5890
  if (binding.endpoint === "chat" && binding.dispatchMode === "prefix") {
5891
- return _chunkAKIOOFY3cjs.resolvePrefixTarget.call(void 0, binding.prefixTargets, requestedModel) !== null;
5891
+ return _chunkYEVWA4C7cjs.resolvePrefixTarget.call(void 0, binding.prefixTargets, requestedModel) !== null;
5892
5892
  }
5893
5893
  if (binding.endpoint === "chat") {
5894
5894
  if (!requestedModel) return false;
@@ -5926,9 +5926,9 @@ function targetPrefixRefs(target, refs) {
5926
5926
  function applySingleModel(config, binding, targetModel) {
5927
5927
  const ref = targetRef(binding.target, targetModel);
5928
5928
  if (!ref) return;
5929
- if (_chunkAKIOOFY3cjs.isKindMappedEndpoint.call(void 0, binding.endpoint)) {
5929
+ if (_chunkYEVWA4C7cjs.isKindMappedEndpoint.call(void 0, binding.endpoint)) {
5930
5930
  config.modelMap = Object.fromEntries(
5931
- _chunkAKIOOFY3cjs.modelKindsForEndpoint.call(void 0, binding.endpoint).map((kind) => [kind, ref])
5931
+ _chunkYEVWA4C7cjs.modelKindsForEndpoint.call(void 0, binding.endpoint).map((kind) => [kind, ref])
5932
5932
  );
5933
5933
  } else if (binding.endpoint === "chat") {
5934
5934
  config.models = [ref];
@@ -5948,7 +5948,7 @@ function gatewayBindingToEndpointConfig(binding, requestedModel) {
5948
5948
  const dynamicModel = binding.modelMode === "passthrough" ? requestedModel : resolveGatewayModelMapping(binding.modelMappings, requestedModel);
5949
5949
  if (usesGenericModelHandling) {
5950
5950
  if (nonBlank(dynamicModel)) applySingleModel(config, binding, dynamicModel);
5951
- } else if (_chunkAKIOOFY3cjs.isKindMappedEndpoint.call(void 0, binding.endpoint)) {
5951
+ } else if (_chunkYEVWA4C7cjs.isKindMappedEndpoint.call(void 0, binding.endpoint)) {
5952
5952
  config.modelMap = Object.fromEntries(
5953
5953
  Object.entries(_nullishCoalesce(binding.modelMap, () => ( {}))).map(([kind, ref]) => [kind, targetRef(target, ref)])
5954
5954
  );
@@ -6047,7 +6047,7 @@ var RouteLeaseTargetResolver = class {
6047
6047
  await this.preflightTarget(request);
6048
6048
  const binding = syntheticBinding(request);
6049
6049
  const config = gatewayBindingToEndpointConfig(binding, request.model);
6050
- const result = await _chunkAKIOOFY3cjs.resolveRoute.call(void 0, {
6050
+ const result = await _chunkYEVWA4C7cjs.resolveRoute.call(void 0, {
6051
6051
  config,
6052
6052
  ingressFormat: runtime.ingressFormat,
6053
6053
  llmConfig: this.llmConfig,
@@ -8217,11 +8217,11 @@ function normalizeQueueSegments(raw) {
8217
8217
  var ALL_ENDPOINTS = ["chat", "responses", "messages", "gemini"];
8218
8218
  function blankModelMap(endpoint) {
8219
8219
  const modelMap = {};
8220
- for (const kind of _chunkAKIOOFY3cjs.modelKindsForEndpoint.call(void 0, endpoint)) modelMap[kind] = "";
8220
+ for (const kind of _chunkYEVWA4C7cjs.modelKindsForEndpoint.call(void 0, endpoint)) modelMap[kind] = "";
8221
8221
  return modelMap;
8222
8222
  }
8223
8223
  function defaultEndpointConfig(endpoint) {
8224
- if (_chunkAKIOOFY3cjs.isKindMappedEndpoint.call(void 0, endpoint)) {
8224
+ if (_chunkYEVWA4C7cjs.isKindMappedEndpoint.call(void 0, endpoint)) {
8225
8225
  return { endpoint, modelMap: blankModelMap(endpoint), useSubscription: false };
8226
8226
  }
8227
8227
  if (endpoint === "chat") {
@@ -8251,10 +8251,10 @@ function normalizeEndpointConfig(e) {
8251
8251
  const boundAccountFallbackPolicy = boundAccountId ? e.boundAccountFallbackPolicy === "pool" ? "pool" : "strict" : void 0;
8252
8252
  const boundKeyId = typeof e.boundKeyId === "string" && e.boundKeyId.trim() !== "" ? e.boundKeyId : void 0;
8253
8253
  let config;
8254
- if (_chunkAKIOOFY3cjs.isKindMappedEndpoint.call(void 0, endpoint)) {
8254
+ if (_chunkYEVWA4C7cjs.isKindMappedEndpoint.call(void 0, endpoint)) {
8255
8255
  const rawMap = e.modelMap && typeof e.modelMap === "object" ? e.modelMap : {};
8256
8256
  const modelMap = {};
8257
- for (const kind of _chunkAKIOOFY3cjs.modelKindsForEndpoint.call(void 0, endpoint)) {
8257
+ for (const kind of _chunkYEVWA4C7cjs.modelKindsForEndpoint.call(void 0, endpoint)) {
8258
8258
  const v = rawMap[kind];
8259
8259
  modelMap[kind] = typeof v === "string" ? v : "";
8260
8260
  }
@@ -9740,7 +9740,7 @@ async function writeModelsListAnthropic(res, llmConfig, config, apiKeyId, allowe
9740
9740
  );
9741
9741
  };
9742
9742
  const viaLabel = (name, ref) => {
9743
- const modelId = ref ? _optionalChain([_chunkAKIOOFY3cjs.parseModelRef.call(void 0, ref), 'optionalAccess', _479 => _479.modelId]) : void 0;
9743
+ const modelId = ref ? _optionalChain([_chunkYEVWA4C7cjs.parseModelRef.call(void 0, ref), 'optionalAccess', _479 => _479.modelId]) : void 0;
9744
9744
  return modelId ? `${name} (via ${modelId})` : void 0;
9745
9745
  };
9746
9746
  for (const binding of candidateGatewayBindings(config.bindings, apiKeyId, "messages")) {
@@ -9792,7 +9792,7 @@ function handleOauthUsageProxy(res, config, apiKeyId) {
9792
9792
  writeJsonError(res, 404, "No Claude subscription route is bound to this key");
9793
9793
  return;
9794
9794
  }
9795
- const snapshots = _chunkFHXDUHVEcjs.getSharedAccountAllowanceStore.call(void 0, ).list({ providerId: "claude" });
9795
+ const snapshots = _chunk2T6D7LWEcjs.getSharedAccountAllowanceStore.call(void 0, ).list({ providerId: "claude" });
9796
9796
  const preferredAccountId = claudeBinding.target.kind === "account" ? claudeBinding.target.accountId : void 0;
9797
9797
  const snapshot = _nullishCoalesce(_nullishCoalesce((preferredAccountId !== void 0 ? snapshots.find((s) => s.accountId === preferredAccountId) : void 0), () => ( snapshots.find((s) => s.windows.some((w) => w.state === "fresh")))), () => ( snapshots[0]));
9798
9798
  const body = {};
@@ -9842,7 +9842,7 @@ async function writeModelsList(res, llmConfig, config, apiKeyId, allowedEndpoint
9842
9842
  if (endpointConfig.backgroundModel) refs.push(endpointConfig.backgroundModel);
9843
9843
  }
9844
9844
  modelIds.push(
9845
- ...refs.map((ref) => _optionalChain([_chunkAKIOOFY3cjs.parseModelRef.call(void 0, ref), 'optionalAccess', _494 => _494.modelId])).filter((modelId) => modelId !== void 0)
9845
+ ...refs.map((ref) => _optionalChain([_chunkYEVWA4C7cjs.parseModelRef.call(void 0, ref), 'optionalAccess', _494 => _494.modelId])).filter((modelId) => modelId !== void 0)
9846
9846
  );
9847
9847
  }
9848
9848
  }
@@ -10093,7 +10093,7 @@ async function handleOutboundRequest(req, res, deps, config, rateLimiter, serial
10093
10093
  res.once("close", release2);
10094
10094
  }
10095
10095
  try {
10096
- const ingressFormat = _chunkAKIOOFY3cjs.endpointToIngressFormat.call(void 0, endpoint);
10096
+ const ingressFormat = _chunkYEVWA4C7cjs.endpointToIngressFormat.call(void 0, endpoint);
10097
10097
  const rawBody = await readBody3(req);
10098
10098
  let parsedBody = {};
10099
10099
  try {
@@ -10113,8 +10113,8 @@ async function handleOutboundRequest(req, res, deps, config, rateLimiter, serial
10113
10113
  const urlModel = extractGeminiModelFromUrl(req.url);
10114
10114
  if (urlModel) parsedBody["model"] = urlModel;
10115
10115
  }
10116
- const requestedModel = _chunkAKIOOFY3cjs.extractRequestedModel.call(void 0, ingressFormat, parsedBody);
10117
- const role = _chunkAKIOOFY3cjs.isKindMappedEndpoint.call(void 0, endpoint) || endpoint === "chat" ? void 0 : _chunkAKIOOFY3cjs.detectRequestRole.call(void 0, ingressFormat, parsedBody, {
10116
+ const requestedModel = _chunkYEVWA4C7cjs.extractRequestedModel.call(void 0, ingressFormat, parsedBody);
10117
+ const role = _chunkYEVWA4C7cjs.isKindMappedEndpoint.call(void 0, endpoint) || endpoint === "chat" ? void 0 : _chunkYEVWA4C7cjs.detectRequestRole.call(void 0, ingressFormat, parsedBody, {
10118
10118
  // Role detection precedes the route pick (the pick consumes the
10119
10119
  // role), so the hint is the union across the candidate routes.
10120
10120
  backgroundModelIds: candidateBackgroundModelIds(config.bindings, verified.id, endpoint)
@@ -10134,7 +10134,7 @@ async function handleOutboundRequest(req, res, deps, config, rateLimiter, serial
10134
10134
  const bindingAffinitySuffix = `:${bindingResolution.binding.id}`;
10135
10135
  const sessionId = deps.proxyDeps.apiKeyPool ? `outbound:${verified.id}${bindingAffinitySuffix}` : null;
10136
10136
  const hostedImageGenerationAllowed = verified.allowedEndpoints.includes("images");
10137
- const resolved = _chunkAKIOOFY3cjs.isKindMappedEndpoint.call(void 0, endpoint) || endpoint === "chat" ? await _chunkAKIOOFY3cjs.resolveRoute.call(void 0, {
10137
+ const resolved = _chunkYEVWA4C7cjs.isKindMappedEndpoint.call(void 0, endpoint) || endpoint === "chat" ? await _chunkYEVWA4C7cjs.resolveRoute.call(void 0, {
10138
10138
  config: effectiveEndpointConfig,
10139
10139
  ingressFormat,
10140
10140
  llmConfig: deps.llmConfig,
@@ -10146,7 +10146,7 @@ async function handleOutboundRequest(req, res, deps, config, rateLimiter, serial
10146
10146
  // Attribution: stamp the verified named-key id onto the route.
10147
10147
  apiKeyId: verified.id,
10148
10148
  hostedImageGenerationAllowed
10149
- }) : await _chunkAKIOOFY3cjs.resolveRoute.call(void 0, {
10149
+ }) : await _chunkYEVWA4C7cjs.resolveRoute.call(void 0, {
10150
10150
  config: effectiveEndpointConfig,
10151
10151
  role,
10152
10152
  ingressFormat,
@@ -10243,7 +10243,7 @@ async function handleOutboundRequest(req, res, deps, config, rateLimiter, serial
10243
10243
  else console.error("[OutboundApi] dispatch error:", message);
10244
10244
  _chunkUIBD2YY5cjs.emitWebhookEvent.call(void 0, { kind: "server.error", at: Date.now(), message });
10245
10245
  if (audit) audit.error = message;
10246
- writeJsonError(res, _chunkT55Z77BRcjs.isAccountAllowanceExhaustedError.call(void 0, err) ? 429 : 502, message);
10246
+ writeJsonError(res, _chunkBKXC4XM6cjs.isAccountAllowanceExhaustedError.call(void 0, err) ? 429 : 502, message);
10247
10247
  } finally {
10248
10248
  routeMap.removeRoute(token);
10249
10249
  if (releaseSerial) releaseSerial();
@@ -10867,7 +10867,7 @@ async function callOpenAICompletion(provider, apiKey, options, logger) {
10867
10867
  request.reasoning_effort = effort;
10868
10868
  }
10869
10869
  const apiUrl = _chunkA2YMUCBTcjs.buildProviderApiUrl.call(void 0, provider, { model: options.model, stream: false });
10870
- const headers = _chunkOIKREZVQcjs.getProviderHeaders.call(void 0, provider, apiKey);
10870
+ const headers = _chunkTX4UCSOPcjs.getProviderHeaders.call(void 0, provider, apiKey);
10871
10871
  logger.info("Calling OpenAI completion API", { url: apiUrl, model: options.model });
10872
10872
  const response = await fetch(apiUrl, {
10873
10873
  method: "POST",
@@ -10916,7 +10916,7 @@ async function callAnthropicCompletion(provider, apiKey, options, logger) {
10916
10916
  ...reasoningWire.outputConfig ? { output_config: reasoningWire.outputConfig } : {}
10917
10917
  };
10918
10918
  const apiUrl2 = _chunkA2YMUCBTcjs.buildProviderApiUrl.call(void 0, provider, { model: options.model, stream: false });
10919
- const headers2 = _chunkOIKREZVQcjs.getProviderHeaders.call(void 0, provider, apiKey);
10919
+ const headers2 = _chunkTX4UCSOPcjs.getProviderHeaders.call(void 0, provider, apiKey);
10920
10920
  logger.info("Calling Anthropic completion API with images", { url: apiUrl2, model: options.model });
10921
10921
  const response2 = await fetch(apiUrl2, {
10922
10922
  method: "POST",
@@ -10974,7 +10974,7 @@ async function callAnthropicCompletion(provider, apiKey, options, logger) {
10974
10974
  delete anthropicRequestBody.temperature;
10975
10975
  }
10976
10976
  const apiUrl = _chunkA2YMUCBTcjs.buildProviderApiUrl.call(void 0, provider, { model: options.model, stream: false });
10977
- const headers = _chunkOIKREZVQcjs.getProviderHeaders.call(void 0, provider, apiKey);
10977
+ const headers = _chunkTX4UCSOPcjs.getProviderHeaders.call(void 0, provider, apiKey);
10978
10978
  logger.info("Calling Anthropic completion API", { url: apiUrl, model: options.model });
10979
10979
  const response = await fetch(apiUrl, {
10980
10980
  method: "POST",
@@ -11030,7 +11030,7 @@ async function callGeminiCompletion(provider, apiKey, options, logger) {
11030
11030
  request.systemInstruction = systemInstruction;
11031
11031
  }
11032
11032
  const apiUrl = _chunkA2YMUCBTcjs.buildProviderApiUrl.call(void 0, provider, { model: options.model, stream: false });
11033
- const headers = _chunkOIKREZVQcjs.getProviderHeaders.call(void 0, provider, apiKey);
11033
+ const headers = _chunkTX4UCSOPcjs.getProviderHeaders.call(void 0, provider, apiKey);
11034
11034
  logger.info("Calling Gemini completion API", { url: apiUrl, model: options.model });
11035
11035
  const response = await fetch(apiUrl, {
11036
11036
  method: "POST",
@@ -11099,7 +11099,7 @@ async function callOpenAIResponseCompletion(provider, apiKey, options, logger) {
11099
11099
  request.reasoning = { effort: responseEffort, summary: "auto" };
11100
11100
  }
11101
11101
  const apiUrl = _chunkA2YMUCBTcjs.buildProviderApiUrl.call(void 0, provider, { model: options.model, stream: false });
11102
- const headers = _chunkOIKREZVQcjs.getProviderHeaders.call(void 0, provider, apiKey);
11102
+ const headers = _chunkTX4UCSOPcjs.getProviderHeaders.call(void 0, provider, apiKey);
11103
11103
  logger.info("Calling OpenAI Response API", { url: apiUrl, model: options.model });
11104
11104
  const response = await fetch(apiUrl, {
11105
11105
  method: "POST",
@@ -11162,7 +11162,7 @@ async function streamOpenAICompletion(provider, apiKey, options, messageId, call
11162
11162
  request.reasoning_effort = effort;
11163
11163
  }
11164
11164
  const apiUrl = _chunkA2YMUCBTcjs.buildProviderApiUrl.call(void 0, provider, { model: options.model, stream: true });
11165
- const headers = _chunkOIKREZVQcjs.getProviderHeaders.call(void 0, provider, apiKey);
11165
+ const headers = _chunkTX4UCSOPcjs.getProviderHeaders.call(void 0, provider, apiKey);
11166
11166
  if (options.nativeSearchAugmentation) {
11167
11167
  _chunkJMJBSACDcjs.applyAugmentation.call(void 0, request, options.nativeSearchAugmentation);
11168
11168
  }
@@ -11261,7 +11261,7 @@ async function streamAnthropicCompletion(provider, apiKey, options, messageId, c
11261
11261
  }
11262
11262
  }
11263
11263
  const apiUrl = _chunkA2YMUCBTcjs.buildProviderApiUrl.call(void 0, provider, { model: options.model, stream: true });
11264
- const headers = _chunkOIKREZVQcjs.getProviderHeaders.call(void 0, provider, apiKey);
11264
+ const headers = _chunkTX4UCSOPcjs.getProviderHeaders.call(void 0, provider, apiKey);
11265
11265
  if (options.nativeSearchAugmentation) {
11266
11266
  _chunkJMJBSACDcjs.applyAugmentation.call(void 0, anthropicRequest, options.nativeSearchAugmentation);
11267
11267
  }
@@ -11335,7 +11335,7 @@ async function streamGeminiCompletion(provider, apiKey, options, messageId, call
11335
11335
  request.systemInstruction = systemInstruction;
11336
11336
  }
11337
11337
  const apiUrl = _chunkA2YMUCBTcjs.buildProviderApiUrl.call(void 0, provider, { model: options.model, stream: true });
11338
- const headers = _chunkOIKREZVQcjs.getProviderHeaders.call(void 0, provider, apiKey);
11338
+ const headers = _chunkTX4UCSOPcjs.getProviderHeaders.call(void 0, provider, apiKey);
11339
11339
  if (options.nativeSearchAugmentation) {
11340
11340
  _chunkJMJBSACDcjs.applyAugmentation.call(void 0, request, options.nativeSearchAugmentation);
11341
11341
  }
@@ -11399,7 +11399,7 @@ async function streamOpenAIResponseCompletion(provider, apiKey, options, message
11399
11399
  request.reasoning = { effort: responseEffort, summary: "auto" };
11400
11400
  }
11401
11401
  const apiUrl = _chunkA2YMUCBTcjs.buildProviderApiUrl.call(void 0, provider, { model: options.model, stream: true });
11402
- const headers = _chunkOIKREZVQcjs.getProviderHeaders.call(void 0, provider, apiKey);
11402
+ const headers = _chunkTX4UCSOPcjs.getProviderHeaders.call(void 0, provider, apiKey);
11403
11403
  logger.info("Streaming OpenAI Response API request", {
11404
11404
  url: apiUrl,
11405
11405
  providerId: options.providerId,
@@ -11918,7 +11918,7 @@ async function streamWithTools(options, callbacks, mcpService, llmConfig, getPro
11918
11918
  if (options.nativeSearchAugmentation) {
11919
11919
  _chunkJMJBSACDcjs.applyAugmentation.call(void 0, requestBody, options.nativeSearchAugmentation);
11920
11920
  }
11921
- const headers = _chunkOIKREZVQcjs.getProviderHeaders.call(void 0, provider, apiKey);
11921
+ const headers = _chunkTX4UCSOPcjs.getProviderHeaders.call(void 0, provider, apiKey);
11922
11922
  logger.info("Sending tool call request", {
11923
11923
  url,
11924
11924
  headers,
@@ -12152,7 +12152,7 @@ async function completeWithTransformers(options, llmConfig, getProvider, resolve
12152
12152
  extendedContext: options.useExtendedContext ? { enabled: true, model: actualModel } : void 0,
12153
12153
  resolveUrl: (config) => config.url instanceof URL ? config.url.toString() : _chunkA2YMUCBTcjs.buildProviderApiUrl.call(void 0, provider, { model: actualModel, stream: false }),
12154
12154
  buildHeaders: (config) => ({
12155
- ..._chunkOIKREZVQcjs.getProviderHeaders.call(void 0, provider, apiKey),
12155
+ ..._chunkTX4UCSOPcjs.getProviderHeaders.call(void 0, provider, apiKey),
12156
12156
  ...config.headers,
12157
12157
  ..._chunkUNEFIWXIcjs.isOpenRouterProvider.call(void 0, provider) ? _chunkUNEFIWXIcjs.OPENROUTER_APP_HEADERS : {}
12158
12158
  }),
@@ -12283,7 +12283,7 @@ async function completeStreamWithTransformers(options, callbacks, llmConfig, get
12283
12283
  extendedContext: options.useExtendedContext ? { enabled: true, model: actualModel } : void 0,
12284
12284
  resolveUrl: (config) => config.url instanceof URL ? config.url.toString() : _chunkA2YMUCBTcjs.buildProviderApiUrl.call(void 0, provider, { model: actualModel, stream: true }),
12285
12285
  buildHeaders: (config) => ({
12286
- ..._chunkOIKREZVQcjs.getProviderHeaders.call(void 0, provider, apiKey),
12286
+ ..._chunkTX4UCSOPcjs.getProviderHeaders.call(void 0, provider, apiKey),
12287
12287
  ...config.headers,
12288
12288
  ..._chunkUNEFIWXIcjs.isOpenRouterProvider.call(void 0, provider) ? _chunkUNEFIWXIcjs.OPENROUTER_APP_HEADERS : {}
12289
12289
  }),
@@ -120,7 +120,9 @@ var SUBSCRIPTION_PROVIDER_IDS = [
120
120
  "codex",
121
121
  "gemini",
122
122
  "opencodego",
123
- "kimi"
123
+ "kimi",
124
+ "grok",
125
+ "copilot"
124
126
  ];
125
127
  var SUBSCRIPTION_ID_SET = new Set(SUBSCRIPTION_PROVIDER_IDS);
126
128
  function isSubscriptionProviderId(providerId) {
@@ -3,7 +3,7 @@
3
3
  var _chunkSVNDB62Dcjs = require('./chunk-SVNDB62D.cjs');
4
4
 
5
5
 
6
- var _chunkT55Z77BRcjs = require('./chunk-T55Z77BR.cjs');
6
+ var _chunkBKXC4XM6cjs = require('./chunk-BKXC4XM6.cjs');
7
7
 
8
8
 
9
9
  var _chunk25GXJCEZcjs = require('./chunk-25GXJCEZ.cjs');
@@ -45,7 +45,7 @@ var SubscriptionAuthSource = class {
45
45
  boundAccountFallbackPolicy: hints.boundAccountFallbackPolicy
46
46
  });
47
47
  } catch (err) {
48
- if (_chunkT55Z77BRcjs.isAccountAllowanceExhaustedError.call(void 0, err) || _chunk25GXJCEZcjs.isBoundAccountSelectionError.call(void 0, err)) throw err;
48
+ if (_chunkBKXC4XM6cjs.isAccountAllowanceExhaustedError.call(void 0, err) || _chunk25GXJCEZcjs.isBoundAccountSelectionError.call(void 0, err)) throw err;
49
49
  console.warn("[SubscriptionAuthSource] authStrategy.applyHeaders threw:", _chunkSVNDB62Dcjs.serializeError.call(void 0, err));
50
50
  }
51
51
  }
@@ -45,10 +45,34 @@ function getProviderHeaders(provider, apiKey) {
45
45
  };
46
46
  break;
47
47
  }
48
+ const withExtra = mergeExtraHeaders(headers, provider.extraHeaders);
48
49
  if (_chunkUNEFIWXIcjs.isOpenRouterProvider.call(void 0, provider)) {
49
- return { ...headers, ..._chunkUNEFIWXIcjs.OPENROUTER_APP_HEADERS };
50
+ return { ...withExtra, ..._chunkUNEFIWXIcjs.OPENROUTER_APP_HEADERS };
50
51
  }
51
- return headers;
52
+ return withExtra;
53
+ }
54
+ function expandHeaderPlaceholder(value) {
55
+ return value.includes("{{platform}}") ? value.replaceAll("{{platform}}", process.platform) : value;
56
+ }
57
+ var EXTRA_HEADER_RESERVED_NAMES = /* @__PURE__ */ new Set([
58
+ "authorization",
59
+ "x-api-key",
60
+ "x-goog-api-key",
61
+ "api-key",
62
+ "cookie",
63
+ "content-type",
64
+ "content-length"
65
+ ]);
66
+ function mergeExtraHeaders(base, extra) {
67
+ if (!extra) return base;
68
+ const entries = Object.entries(extra);
69
+ if (entries.length === 0) return base;
70
+ const merged = { ...base };
71
+ for (const [name, value] of entries) {
72
+ if (EXTRA_HEADER_RESERVED_NAMES.has(name.toLowerCase())) continue;
73
+ merged[name] = expandHeaderPlaceholder(value);
74
+ }
75
+ return merged;
52
76
  }
53
77
 
54
78
  // src/pipeline/LlmConfigProviderAuth.ts
@@ -126,4 +150,7 @@ var LlmConfigProviderAuth = class {
126
150
 
127
151
 
128
152
 
129
- exports.getProviderHeaders = getProviderHeaders; exports.LlmConfigProviderAuth = LlmConfigProviderAuth;
153
+
154
+
155
+
156
+ exports.getProviderHeaders = getProviderHeaders; exports.expandHeaderPlaceholder = expandHeaderPlaceholder; exports.EXTRA_HEADER_RESERVED_NAMES = EXTRA_HEADER_RESERVED_NAMES; exports.mergeExtraHeaders = mergeExtraHeaders; exports.LlmConfigProviderAuth = LlmConfigProviderAuth;
@@ -120,7 +120,9 @@ var SUBSCRIPTION_PROVIDER_IDS = [
120
120
  "codex",
121
121
  "gemini",
122
122
  "opencodego",
123
- "kimi"
123
+ "kimi",
124
+ "grok",
125
+ "copilot"
124
126
  ];
125
127
  var SUBSCRIPTION_ID_SET = new Set(SUBSCRIPTION_PROVIDER_IDS);
126
128
  function isSubscriptionProviderId(providerId) {
@@ -6,7 +6,7 @@
6
6
  var _chunk235MXAGXcjs = require('./chunk-235MXAGX.cjs');
7
7
 
8
8
 
9
- var _chunkFHXDUHVEcjs = require('./chunk-FHXDUHVE.cjs');
9
+ var _chunk2T6D7LWEcjs = require('./chunk-2T6D7LWE.cjs');
10
10
 
11
11
 
12
12
  var _chunkNKVZ6Z3Ycjs = require('./chunk-NKVZ6Z3Y.cjs');
@@ -118,12 +118,12 @@ function fetchUpstream(url, init, ctx) {
118
118
  const doFetchWithAllowanceTap = () => doFetch().then((response) => {
119
119
  if (_optionalChain([ctx, 'optionalAccess', _4 => _4.providerId]) === "codex" && ctx.accountId) {
120
120
  try {
121
- _chunkFHXDUHVEcjs.getSharedAccountAllowanceStore.call(void 0, ).recordCodexHeaders(ctx.accountId, response.headers);
121
+ _chunk2T6D7LWEcjs.getSharedAccountAllowanceStore.call(void 0, ).recordCodexHeaders(ctx.accountId, response.headers);
122
122
  } catch (e4) {
123
123
  }
124
124
  } else if (_optionalChain([ctx, 'optionalAccess', _5 => _5.providerId]) === "claude" && ctx.accountId) {
125
125
  try {
126
- _chunkFHXDUHVEcjs.getSharedAccountAllowanceStore.call(void 0, ).recordClaudeHeaders(ctx.accountId, response.headers);
126
+ _chunk2T6D7LWEcjs.getSharedAccountAllowanceStore.call(void 0, ).recordClaudeHeaders(ctx.accountId, response.headers);
127
127
  } catch (e5) {
128
128
  }
129
129
  }