@omnicross/core 0.1.3 → 0.1.4

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 (114) hide show
  1. package/LICENSE +21 -21
  2. package/NOTICE +57 -57
  3. package/README.md +15 -15
  4. package/dist/auth/GeminiCodeAssistProjectResolver.cjs +4 -4
  5. package/dist/auth/GeminiCodeAssistProjectResolver.js +3 -3
  6. package/dist/chunk-3QFXFCHG.js +33 -0
  7. package/dist/chunk-4YINUUKQ.cjs +33 -0
  8. package/dist/chunk-7Y47UCF2.js +142 -0
  9. package/dist/chunk-APYG5QD7.cjs +50 -0
  10. package/dist/{chunk-CWM2ZDU5.js → chunk-BPKCU575.js} +3 -10
  11. package/dist/{chunk-2FMI2B6V.cjs → chunk-DKPXN34V.cjs} +222 -448
  12. package/dist/chunk-E3UCVHLP.cjs +142 -0
  13. package/dist/chunk-FCR77GYM.cjs +33 -0
  14. package/dist/{chunk-N5QFKSDO.js → chunk-HRRYG2AX.js} +2 -1
  15. package/dist/{chunk-KUU2RNG6.cjs → chunk-HYN75H6G.cjs} +3 -0
  16. package/dist/{chunk-JO5NLTLY.js → chunk-IK3KE3AU.js} +3 -0
  17. package/dist/chunk-K5NM7VAH.js +33 -0
  18. package/dist/{chunk-Y6OM7EV7.cjs → chunk-KFI44N2R.cjs} +2 -1
  19. package/dist/{chunk-S6JGLF3G.cjs → chunk-OCEUVQHW.cjs} +27 -4
  20. package/dist/chunk-OE6TDIWW.js +22 -0
  21. package/dist/chunk-OZFM4X3S.js +18 -0
  22. package/dist/{chunk-4DECIFU7.js → chunk-QYTT6GE3.js} +62 -288
  23. package/dist/{chunk-FFALUUZZ.cjs → chunk-RGTR7CIO.cjs} +5 -5
  24. package/dist/{chunk-3QOSDDNI.cjs → chunk-SNYBEXLB.cjs} +6 -13
  25. package/dist/{chunk-2DCNB7DF.cjs → chunk-SU2GCLAC.cjs} +30 -10
  26. package/dist/{chunk-5HTVET6E.js → chunk-TIER4SUC.js} +24 -4
  27. package/dist/{chunk-CZHZGRU7.js → chunk-UHGVBFU3.js} +2 -0
  28. package/dist/chunk-UIBD2YY5.cjs +22 -0
  29. package/dist/{chunk-SVXC36MU.cjs → chunk-VACWOIRE.cjs} +2 -0
  30. package/dist/{chunk-MQNDWYPN.js → chunk-VPBAUQ2M.js} +4 -4
  31. package/dist/chunk-WLYIIEAF.js +50 -0
  32. package/dist/{chunk-BO4RFWBR.js → chunk-XK5CIRMQ.js} +24 -1
  33. package/dist/chunk-XSVNC2UD.cjs +18 -0
  34. package/dist/completion/CompletionService.cjs +22 -16
  35. package/dist/completion/CompletionService.js +21 -15
  36. package/dist/completion.cjs +24 -18
  37. package/dist/completion.js +23 -17
  38. package/dist/index.cjs +33 -24
  39. package/dist/index.d.cts +7 -3
  40. package/dist/index.d.ts +7 -3
  41. package/dist/index.js +42 -33
  42. package/dist/keyPolicy-Cp0FntZl.d.cts +90 -0
  43. package/dist/keyPolicy-Cp0FntZl.d.ts +90 -0
  44. package/dist/outbound-api/auditCapture.cjs +9 -0
  45. package/dist/outbound-api/auditCapture.d.cts +52 -0
  46. package/dist/outbound-api/auditCapture.d.ts +52 -0
  47. package/dist/outbound-api/auditCapture.js +9 -0
  48. package/dist/outbound-api/auditRedact.cjs +8 -0
  49. package/dist/outbound-api/auditRedact.d.cts +30 -0
  50. package/dist/outbound-api/auditRedact.d.ts +30 -0
  51. package/dist/outbound-api/auditRedact.js +8 -0
  52. package/dist/outbound-api/billingCapture.cjs +8 -0
  53. package/dist/outbound-api/billingCapture.d.cts +61 -0
  54. package/dist/outbound-api/billingCapture.d.ts +61 -0
  55. package/dist/outbound-api/billingCapture.js +8 -0
  56. package/dist/outbound-api/quotaWarn.cjs +12 -0
  57. package/dist/outbound-api/quotaWarn.d.cts +43 -0
  58. package/dist/outbound-api/quotaWarn.d.ts +43 -0
  59. package/dist/outbound-api/quotaWarn.js +12 -0
  60. package/dist/outbound-api/routeResolver.cjs +2 -2
  61. package/dist/outbound-api/routeResolver.d.cts +3 -2
  62. package/dist/outbound-api/routeResolver.d.ts +3 -2
  63. package/dist/outbound-api/routeResolver.js +1 -1
  64. package/dist/outbound-api/types.d.cts +2 -1
  65. package/dist/outbound-api/types.d.ts +2 -1
  66. package/dist/outbound-api.cjs +29 -20
  67. package/dist/outbound-api.d.cts +9 -140
  68. package/dist/outbound-api.d.ts +9 -140
  69. package/dist/outbound-api.js +28 -19
  70. package/dist/pipeline/AuthSource.d.cts +6 -0
  71. package/dist/pipeline/AuthSource.d.ts +6 -0
  72. package/dist/pipeline/SubscriptionAuthSource.cjs +2 -2
  73. package/dist/pipeline/SubscriptionAuthSource.js +1 -1
  74. package/dist/pipeline/SubscriptionAuthStrategy.d.cts +6 -0
  75. package/dist/pipeline/SubscriptionAuthStrategy.d.ts +6 -0
  76. package/dist/pipeline/auditUsageStash.cjs +10 -0
  77. package/dist/pipeline/auditUsageStash.d.cts +37 -0
  78. package/dist/pipeline/auditUsageStash.d.ts +37 -0
  79. package/dist/pipeline/auditUsageStash.js +10 -0
  80. package/dist/pipeline/executeProviderCall.cjs +2 -2
  81. package/dist/pipeline/executeProviderCall.js +1 -1
  82. package/dist/pipeline/upstreamFetch.cjs +14 -0
  83. package/dist/pipeline/upstreamFetch.d.cts +83 -0
  84. package/dist/pipeline/upstreamFetch.d.ts +83 -0
  85. package/dist/pipeline/upstreamFetch.js +14 -0
  86. package/dist/pipeline/webhookEmit.cjs +10 -0
  87. package/dist/pipeline/webhookEmit.d.cts +36 -0
  88. package/dist/pipeline/webhookEmit.d.ts +36 -0
  89. package/dist/pipeline/webhookEmit.js +10 -0
  90. package/dist/ports.d.cts +2 -1
  91. package/dist/ports.d.ts +2 -1
  92. package/dist/provider-proxy/ProviderProxy.cjs +22 -16
  93. package/dist/provider-proxy/ProviderProxy.js +21 -15
  94. package/dist/provider-proxy/ingress/providerProxyShared.cjs +22 -16
  95. package/dist/provider-proxy/ingress/providerProxyShared.js +21 -15
  96. package/dist/provider-proxy/types.d.cts +7 -0
  97. package/dist/provider-proxy/types.d.ts +7 -0
  98. package/dist/provider-proxy.cjs +22 -16
  99. package/dist/provider-proxy.js +21 -15
  100. package/dist/{routeResolver-B1NglTfe.d.ts → routeResolver-C4T7yClx.d.ts} +1 -1
  101. package/dist/{routeResolver-CbG5uBgm.d.cts → routeResolver-CB3tvJKy.d.cts} +1 -1
  102. package/dist/transformer/transformers/OpenAIResponseTransformer.cjs +2 -2
  103. package/dist/transformer/transformers/OpenAIResponseTransformer.js +1 -1
  104. package/dist/transformer/transformers.cjs +6 -6
  105. package/dist/transformer/transformers.js +5 -5
  106. package/dist/transformer.cjs +7 -7
  107. package/dist/transformer.js +6 -6
  108. package/dist/{types-aBFFXoBz.d.cts → types-B8Arpxn0.d.cts} +14 -90
  109. package/dist/{types-6OUY_xfA.d.ts → types-lgPYQuZS.d.ts} +14 -90
  110. package/dist/usage/usage-recorder.cjs +3 -2
  111. package/dist/usage/usage-recorder.js +2 -1
  112. package/dist/usage.cjs +3 -2
  113. package/dist/usage.js +2 -1
  114. package/package.json +64 -64
package/dist/index.cjs CHANGED
@@ -71,11 +71,7 @@
71
71
 
72
72
 
73
73
 
74
-
75
-
76
-
77
-
78
- var _chunk2FMI2B6Vcjs = require('./chunk-2FMI2B6V.cjs');
74
+ var _chunkDKPXN34Vcjs = require('./chunk-DKPXN34V.cjs');
79
75
 
80
76
 
81
77
 
@@ -83,43 +79,50 @@ var _chunkHQP3K7PUcjs = require('./chunk-HQP3K7PU.cjs');
83
79
  require('./chunk-FZ46M34D.cjs');
84
80
 
85
81
 
86
- var _chunk46ZIFWYGcjs = require('./chunk-46ZIFWYG.cjs');
87
-
88
-
89
82
  var _chunk3OPYJG76cjs = require('./chunk-3OPYJG76.cjs');
90
83
 
91
84
 
92
- var _chunkFFALUUZZcjs = require('./chunk-FFALUUZZ.cjs');
93
- require('./chunk-C72S6TTV.cjs');
85
+ var _chunkRGTR7CIOcjs = require('./chunk-RGTR7CIO.cjs');
94
86
  require('./chunk-DWKQZ2SK.cjs');
95
87
  require('./chunk-4VAVYUZS.cjs');
96
88
  require('./chunk-7YN22L2H.cjs');
97
- require('./chunk-2DCNB7DF.cjs');
89
+ require('./chunk-SU2GCLAC.cjs');
90
+ require('./chunk-C72S6TTV.cjs');
98
91
  require('./chunk-EYZYXJTJ.cjs');
99
92
 
100
93
 
101
94
  var _chunkYMFAJFQTcjs = require('./chunk-YMFAJFQT.cjs');
102
95
 
103
96
 
104
- var _chunk3QOSDDNIcjs = require('./chunk-3QOSDDNI.cjs');
97
+ var _chunkSNYBEXLBcjs = require('./chunk-SNYBEXLB.cjs');
98
+
99
+
100
+ var _chunk46ZIFWYGcjs = require('./chunk-46ZIFWYG.cjs');
105
101
  require('./chunk-GBHYAGX3.cjs');
106
102
  require('./chunk-RPII3E6Z.cjs');
107
103
  require('./chunk-6RPZADX3.cjs');
108
104
  require('./chunk-QWBWGODS.cjs');
105
+ require('./chunk-UIBD2YY5.cjs');
106
+ require('./chunk-R3HK6R4B.cjs');
107
+ require('./chunk-HYN75H6G.cjs');
108
+
109
+
110
+ var _chunkQ27JY5RGcjs = require('./chunk-Q27JY5RG.cjs');
111
+ require('./chunk-QXD4MV2X.cjs');
109
112
  require('./chunk-NYUNU75A.cjs');
110
113
  require('./chunk-VQY5W4YW.cjs');
111
- require('./chunk-Y6OM7EV7.cjs');
114
+ require('./chunk-KFI44N2R.cjs');
112
115
 
113
116
 
114
117
  var _chunkSVNDB62Dcjs = require('./chunk-SVNDB62D.cjs');
115
- require('./chunk-R3HK6R4B.cjs');
116
- require('./chunk-AEOZIDEB.cjs');
118
+
119
+
120
+ var _chunkAPYG5QD7cjs = require('./chunk-APYG5QD7.cjs');
117
121
  require('./chunk-L74VDN4A.cjs');
118
- require('./chunk-KUU2RNG6.cjs');
122
+ require('./chunk-4YINUUKQ.cjs');
123
+
119
124
 
120
125
 
121
- var _chunkQ27JY5RGcjs = require('./chunk-Q27JY5RG.cjs');
122
- require('./chunk-QXD4MV2X.cjs');
123
126
 
124
127
 
125
128
 
@@ -130,12 +133,14 @@ require('./chunk-QXD4MV2X.cjs');
130
133
 
131
134
 
132
135
 
133
- var _chunkA2YMUCBTcjs = require('./chunk-A2YMUCBT.cjs');
134
136
 
135
137
 
136
138
 
139
+ var _chunkVACWOIREcjs = require('./chunk-VACWOIRE.cjs');
140
+ require('./chunk-QBZJ7P2T.cjs');
137
141
 
138
142
 
143
+ var _chunk4IH4EL7Mcjs = require('./chunk-4IH4EL7M.cjs');
139
144
 
140
145
 
141
146
 
@@ -146,12 +151,16 @@ var _chunkA2YMUCBTcjs = require('./chunk-A2YMUCBT.cjs');
146
151
 
147
152
 
148
153
 
154
+ var _chunkA2YMUCBTcjs = require('./chunk-A2YMUCBT.cjs');
149
155
 
150
- var _chunkSVXC36MUcjs = require('./chunk-SVXC36MU.cjs');
151
- require('./chunk-QBZJ7P2T.cjs');
152
156
 
157
+ var _chunkE3UCVHLPcjs = require('./chunk-E3UCVHLP.cjs');
153
158
 
154
- var _chunk4IH4EL7Mcjs = require('./chunk-4IH4EL7M.cjs');
159
+
160
+
161
+ var _chunkFCR77GYMcjs = require('./chunk-FCR77GYM.cjs');
162
+ require('./chunk-AEOZIDEB.cjs');
163
+ require('./chunk-XSVNC2UD.cjs');
155
164
 
156
165
 
157
166
 
@@ -164,9 +173,9 @@ var _chunk4IH4EL7Mcjs = require('./chunk-4IH4EL7M.cjs');
164
173
 
165
174
 
166
175
  var _chunkSUEGJ75Dcjs = require('./chunk-SUEGJ75D.cjs');
167
- require('./chunk-S6JGLF3G.cjs');
168
176
  require('./chunk-RSJ3TWJQ.cjs');
169
177
  require('./chunk-YGXJGRFI.cjs');
178
+ require('./chunk-OCEUVQHW.cjs');
170
179
 
171
180
 
172
181
 
@@ -316,4 +325,4 @@ var _chunkUNEFIWXIcjs = require('./chunk-UNEFIWXI.cjs');
316
325
 
317
326
 
318
327
 
319
- exports.AUDIT_REDACTED = _chunk2FMI2B6Vcjs.AUDIT_REDACTED; exports.BuiltinToolExecutor = _chunkNZYN7C3Pcjs.BuiltinToolExecutor; exports.CompletionService = _chunk2FMI2B6Vcjs.CompletionService; exports.ConcurrencyQueueFullError = _chunk2FMI2B6Vcjs.ConcurrencyQueueFullError; exports.ConcurrencyWaitCancelledError = _chunk2FMI2B6Vcjs.ConcurrencyWaitCancelledError; exports.ConcurrencyWaitTimeoutError = _chunk2FMI2B6Vcjs.ConcurrencyWaitTimeoutError; exports.DEFAULT_ACCOUNT_PROBE = _chunk2FMI2B6Vcjs.DEFAULT_ACCOUNT_PROBE; exports.DEFAULT_CONCURRENCY_QUEUE = _chunk2FMI2B6Vcjs.DEFAULT_CONCURRENCY_QUEUE; exports.DEFAULT_FINGERPRINT = _chunk2FMI2B6Vcjs.DEFAULT_FINGERPRINT; exports.DEFAULT_OUTBOUND_PORT = _chunk2FMI2B6Vcjs.DEFAULT_OUTBOUND_PORT; exports.DEFAULT_ROUTE_IDLE_MS = _chunk2FMI2B6Vcjs.DEFAULT_ROUTE_IDLE_MS; exports.DEFAULT_USER_MESSAGE_QUEUE = _chunk2FMI2B6Vcjs.DEFAULT_USER_MESSAGE_QUEUE; exports.ENDPOINT_MODEL_KINDS = _chunk4IH4EL7Mcjs.ENDPOINT_MODEL_KINDS; exports.KeySpendTracker = _chunk2FMI2B6Vcjs.KeySpendTracker; exports.KeyedMutex = _chunk2FMI2B6Vcjs.KeyedMutex; exports.NATIVE_SEARCH_TOOL_NAMES = _chunkGMMT7RVNcjs.NATIVE_SEARCH_TOOL_NAMES; exports.OPENROUTER_APP_HEADERS = _chunkUNEFIWXIcjs.OPENROUTER_APP_HEADERS; exports.OUTBOUND_API_SERVER_CONFIG_KEY = _chunk2FMI2B6Vcjs.OUTBOUND_API_SERVER_CONFIG_KEY; exports.OutboundApiConfigError = _chunk2FMI2B6Vcjs.OutboundApiConfigError; exports.OutboundApiServer = _chunk2FMI2B6Vcjs.OutboundApiServer; exports.OutboundConcurrencyGate = _chunk2FMI2B6Vcjs.OutboundConcurrencyGate; exports.OutboundRateLimiter = _chunk2FMI2B6Vcjs.OutboundRateLimiter; exports.PricingEngine = _chunkYMFAJFQTcjs.PricingEngine; exports.ProviderProxy = _chunk2FMI2B6Vcjs.ProviderProxy; exports.ProviderProxyRouteMap = _chunk2FMI2B6Vcjs.ProviderProxyRouteMap; exports.SUBSCRIPTION_PROVIDER_IDS = _chunkSVXC36MUcjs.SUBSCRIPTION_PROVIDER_IDS; exports.SerialQueueTimeoutError = _chunk2FMI2B6Vcjs.SerialQueueTimeoutError; exports.TransformerChainExecutor = _chunk46ZIFWYGcjs.TransformerChainExecutor; exports.TransformerService = _chunk3OPYJG76cjs.TransformerService; exports.UsageRecorder = _chunk3QOSDDNIcjs.UsageRecorder; exports.UserMessageSerialQueue = _chunk2FMI2B6Vcjs.UserMessageSerialQueue; exports.__resetOutboundApiServerForTests = _chunk2FMI2B6Vcjs.__resetOutboundApiServerForTests; exports.__resetProviderProxyForTests = _chunk2FMI2B6Vcjs.__resetProviderProxyForTests; exports.addOpenRouterProviderToRequest = _chunk2FMI2B6Vcjs.addOpenRouterProviderToRequest; exports.applyAugmentation = _chunkJMJBSACDcjs.applyAugmentation; exports.attachStreamEventBuffer = _chunk2FMI2B6Vcjs.attach; exports.beginAuditCapture = _chunk2FMI2B6Vcjs.beginAuditCapture; exports.beginBillingCapture = _chunk2FMI2B6Vcjs.beginBillingCapture; exports.buildAnthropicApiUrl = _chunkA2YMUCBTcjs.buildAnthropicApiUrl; exports.buildAzureOpenAIApiUrl = _chunkA2YMUCBTcjs.buildAzureOpenAIApiUrl; exports.buildGeminiApiUrl = _chunkA2YMUCBTcjs.buildGeminiApiUrl; exports.buildNativeSearchAugmentation = _chunkJMJBSACDcjs.buildNativeSearchAugmentation; exports.buildOpenAIApiUrl = _chunkA2YMUCBTcjs.buildOpenAIApiUrl; exports.buildOpenAIResponseApiUrl = _chunkA2YMUCBTcjs.buildOpenAIResponseApiUrl; exports.buildProviderApiUrl = _chunkA2YMUCBTcjs.buildProviderApiUrl; exports.checkKeyQuota = _chunk2FMI2B6Vcjs.checkKeyQuota; exports.classifyModelPrefix = _chunkSVXC36MUcjs.classifyModelPrefix; exports.computeKeyExpiry = _chunk2FMI2B6Vcjs.computeKeyExpiry; exports.computeVoucherGrant = _chunk2FMI2B6Vcjs.computeVoucherGrant; exports.convertAnthropicRequestToOpenAI = _chunkSUEGJ75Dcjs.convertAnthropicRequestToOpenAI; exports.convertAnthropicStreamToOpenAI = _chunkSUEGJ75Dcjs.convertAnthropicStreamToOpenAI; exports.convertAnthropicToOpenAI = _chunkSUEGJ75Dcjs.convertAnthropicToOpenAI; exports.convertAnthropicToOpenAIWithThinking = _chunkSUEGJ75Dcjs.convertAnthropicToOpenAIWithThinking; exports.convertMessageToAnthropic = _chunk2FMI2B6Vcjs.convertMessageToAnthropic; exports.convertMessageToGemini = _chunk2FMI2B6Vcjs.convertMessageToGemini; exports.convertMessageToOpenAI = _chunk2FMI2B6Vcjs.convertMessageToOpenAI; exports.convertOpenAIResponseToAnthropic = _chunkSUEGJ75Dcjs.convertOpenAIResponseToAnthropic; exports.convertOpenAIStreamToAnthropic = _chunkSUEGJ75Dcjs.convertOpenAIStreamToAnthropic; exports.convertOpenAIToAnthropic = _chunkSUEGJ75Dcjs.convertOpenAIToAnthropic; exports.convertOpenAIToAnthropicWithThinking = _chunkSUEGJ75Dcjs.convertOpenAIToAnthropicWithThinking; exports.createNamedKey = _chunk2FMI2B6Vcjs.createNamedKey; exports.createSSEParser = _chunkHQP3K7PUcjs.createSSEParser; exports.defaultServerConfig = _chunk2FMI2B6Vcjs.defaultServerConfig; exports.detectModelKind = _chunkSVXC36MUcjs.detectModelKind; exports.detectNativeSearch = _chunkJMJBSACDcjs.detectNativeSearch; exports.detectRequestRole = _chunkSVXC36MUcjs.detectRequestRole; exports.emitStreamEvent = _chunk2FMI2B6Vcjs.emit; exports.endpointSupportsSubscription = _chunkSVXC36MUcjs.endpointSupportsSubscription; exports.endpointToIngressFormat = _chunkSVXC36MUcjs.endpointToIngressFormat; exports.extractRouteToken = _chunk2FMI2B6Vcjs.extractRouteToken; exports.formatUrls = _chunk2FMI2B6Vcjs.formatUrls; exports.generateVoucherCode = _chunk2FMI2B6Vcjs.generateVoucherCode; exports.getBuiltinSearchTools = _chunkNZYN7C3Pcjs.getBuiltinSearchTools; exports.getOpenRouterAppIdentity = _chunkUNEFIWXIcjs.getOpenRouterAppIdentity; exports.getOpenRouterProviderConfig = _chunk2FMI2B6Vcjs.getOpenRouterProviderConfig; exports.getOutboundApiServer = _chunk2FMI2B6Vcjs.getOutboundApiServer; exports.getProviderHeaders = _chunkQ27JY5RGcjs.getProviderHeaders; exports.getProviderProxy = _chunk2FMI2B6Vcjs.getProviderProxy; exports.handleVoucherRedeem = _chunk2FMI2B6Vcjs.handleVoucherRedeem; exports.hasImageContent = _chunkSUEGJ75Dcjs.hasImageContent; exports.hasThinkingEnabled = _chunkSUEGJ75Dcjs.hasThinkingEnabled; exports.hashKey = _chunk2FMI2B6Vcjs.hashKey; exports.hashVoucherCode = _chunk2FMI2B6Vcjs.hashVoucherCode; exports.isConcurrencyRejection = _chunk2FMI2B6Vcjs.isConcurrencyRejection; exports.isKindMappedEndpoint = _chunkSVXC36MUcjs.isKindMappedEndpoint; exports.isOpenRouterProvider = _chunkUNEFIWXIcjs.isOpenRouterProvider; exports.isRedeemRequest = _chunk2FMI2B6Vcjs.isRedeemRequest; exports.isSerialQueueTimeout = _chunk2FMI2B6Vcjs.isSerialQueueTimeout; exports.isSubscriptionProviderId = _chunkSVXC36MUcjs.isSubscriptionProviderId; exports.isUserMessageRequest = _chunk2FMI2B6Vcjs.isUserMessageRequest; exports.loadServerConfig = _chunk2FMI2B6Vcjs.loadServerConfig; exports.mergeServerConfig = _chunk2FMI2B6Vcjs.mergeServerConfig; exports.modelKindsForEndpoint = _chunkSVXC36MUcjs.modelKindsForEndpoint; exports.newVoucherId = _chunk2FMI2B6Vcjs.newVoucherId; exports.normalizeAccountProbe = _chunk2FMI2B6Vcjs.normalizeAccountProbe; exports.normalizeAudit = _chunk2FMI2B6Vcjs.normalizeAudit; exports.normalizeAzureEndpoint = _chunkA2YMUCBTcjs.normalizeAzureEndpoint; exports.normalizeBilling = _chunk2FMI2B6Vcjs.normalizeBilling; exports.normalizeFingerprint = _chunk2FMI2B6Vcjs.normalizeFingerprint; exports.normalizePrefixTargets = _chunk2FMI2B6Vcjs.normalizePrefixTargets; exports.normalizeProxyConfig = _chunk2FMI2B6Vcjs.normalizeProxyConfig; exports.normalizeProxySegment = _chunk2FMI2B6Vcjs.normalizeProxySegment; exports.normalizeQueueSegments = _chunk2FMI2B6Vcjs.normalizeQueueSegments; exports.normalizeServerConfig = _chunk2FMI2B6Vcjs.normalizeServerConfig; exports.normalizeVoucher = _chunk2FMI2B6Vcjs.normalizeVoucher; exports.normalizeWebhookDestination = _chunk2FMI2B6Vcjs.normalizeWebhookDestination; exports.normalizeWebhookSegment = _chunk2FMI2B6Vcjs.normalizeWebhookSegment; exports.parseModelRef = _chunkSVXC36MUcjs.parseModelRef; exports.pickModelRefFromList = _chunkSVXC36MUcjs.pickModelRefFromList; exports.randomBase62 = _chunk2FMI2B6Vcjs.randomBase62; exports.redactAuditText = _chunk2FMI2B6Vcjs.redactAuditText; exports.registerBuiltinTransformers = _chunkFFALUUZZcjs.registerBuiltinTransformers; exports.registerStreamEventBuffer = _chunk2FMI2B6Vcjs.register; exports.releaseStreamEventBuffer = _chunk2FMI2B6Vcjs.release; exports.resolveApiFormat = _chunkA2YMUCBTcjs.resolveApiFormat; exports.resolvePrefixTarget = _chunkSVXC36MUcjs.resolvePrefixTarget; exports.resolveProviderEndpoint = _chunkA2YMUCBTcjs.resolveProviderEndpoint; exports.resolveRoute = _chunkSVXC36MUcjs.resolveRoute; exports.saveServerConfig = _chunk2FMI2B6Vcjs.saveServerConfig; exports.serializeError = _chunkSVNDB62Dcjs.serializeError; exports.setOpenRouterAppIdentity = _chunkUNEFIWXIcjs.setOpenRouterAppIdentity; exports.startOfLocalDay = _chunk2FMI2B6Vcjs.startOfLocalDay; exports.startOfLocalWeek = _chunk2FMI2B6Vcjs.startOfLocalWeek; exports.streamSSEResponse = _chunkHQP3K7PUcjs.streamSSEResponse; exports.toVoucherInfo = _chunk2FMI2B6Vcjs.toVoucherInfo; exports.validateEndpointModelConfig = _chunkSVXC36MUcjs.validateEndpointModelConfig; exports.validateServerModelConfig = _chunkSVXC36MUcjs.validateServerModelConfig; exports.verifyKey = _chunk2FMI2B6Vcjs.verifyKey; exports.verifyPresentedKey = _chunk2FMI2B6Vcjs.verifyPresentedKey; exports.voucherCodePrefix = _chunk2FMI2B6Vcjs.voucherCodePrefix;
328
+ exports.AUDIT_REDACTED = _chunkFCR77GYMcjs.AUDIT_REDACTED; exports.BuiltinToolExecutor = _chunkNZYN7C3Pcjs.BuiltinToolExecutor; exports.CompletionService = _chunkDKPXN34Vcjs.CompletionService; exports.ConcurrencyQueueFullError = _chunkDKPXN34Vcjs.ConcurrencyQueueFullError; exports.ConcurrencyWaitCancelledError = _chunkDKPXN34Vcjs.ConcurrencyWaitCancelledError; exports.ConcurrencyWaitTimeoutError = _chunkDKPXN34Vcjs.ConcurrencyWaitTimeoutError; exports.DEFAULT_ACCOUNT_PROBE = _chunkDKPXN34Vcjs.DEFAULT_ACCOUNT_PROBE; exports.DEFAULT_CONCURRENCY_QUEUE = _chunkDKPXN34Vcjs.DEFAULT_CONCURRENCY_QUEUE; exports.DEFAULT_FINGERPRINT = _chunkDKPXN34Vcjs.DEFAULT_FINGERPRINT; exports.DEFAULT_OUTBOUND_PORT = _chunkDKPXN34Vcjs.DEFAULT_OUTBOUND_PORT; exports.DEFAULT_ROUTE_IDLE_MS = _chunkDKPXN34Vcjs.DEFAULT_ROUTE_IDLE_MS; exports.DEFAULT_USER_MESSAGE_QUEUE = _chunkDKPXN34Vcjs.DEFAULT_USER_MESSAGE_QUEUE; exports.ENDPOINT_MODEL_KINDS = _chunk4IH4EL7Mcjs.ENDPOINT_MODEL_KINDS; exports.KeySpendTracker = _chunkDKPXN34Vcjs.KeySpendTracker; exports.KeyedMutex = _chunkDKPXN34Vcjs.KeyedMutex; exports.NATIVE_SEARCH_TOOL_NAMES = _chunkGMMT7RVNcjs.NATIVE_SEARCH_TOOL_NAMES; exports.OPENROUTER_APP_HEADERS = _chunkUNEFIWXIcjs.OPENROUTER_APP_HEADERS; exports.OUTBOUND_API_SERVER_CONFIG_KEY = _chunkDKPXN34Vcjs.OUTBOUND_API_SERVER_CONFIG_KEY; exports.OutboundApiConfigError = _chunkDKPXN34Vcjs.OutboundApiConfigError; exports.OutboundApiServer = _chunkDKPXN34Vcjs.OutboundApiServer; exports.OutboundConcurrencyGate = _chunkDKPXN34Vcjs.OutboundConcurrencyGate; exports.OutboundRateLimiter = _chunkDKPXN34Vcjs.OutboundRateLimiter; exports.PricingEngine = _chunkYMFAJFQTcjs.PricingEngine; exports.ProviderProxy = _chunkDKPXN34Vcjs.ProviderProxy; exports.ProviderProxyRouteMap = _chunkDKPXN34Vcjs.ProviderProxyRouteMap; exports.SUBSCRIPTION_PROVIDER_IDS = _chunkVACWOIREcjs.SUBSCRIPTION_PROVIDER_IDS; exports.SerialQueueTimeoutError = _chunkDKPXN34Vcjs.SerialQueueTimeoutError; exports.TransformerChainExecutor = _chunk46ZIFWYGcjs.TransformerChainExecutor; exports.TransformerService = _chunk3OPYJG76cjs.TransformerService; exports.UsageRecorder = _chunkSNYBEXLBcjs.UsageRecorder; exports.UserMessageSerialQueue = _chunkDKPXN34Vcjs.UserMessageSerialQueue; exports.__resetOutboundApiServerForTests = _chunkDKPXN34Vcjs.__resetOutboundApiServerForTests; exports.__resetProviderProxyForTests = _chunkDKPXN34Vcjs.__resetProviderProxyForTests; exports.addOpenRouterProviderToRequest = _chunkDKPXN34Vcjs.addOpenRouterProviderToRequest; exports.applyAugmentation = _chunkJMJBSACDcjs.applyAugmentation; exports.attachStreamEventBuffer = _chunkDKPXN34Vcjs.attach; exports.beginAuditCapture = _chunkE3UCVHLPcjs.beginAuditCapture; exports.beginBillingCapture = _chunkAPYG5QD7cjs.beginBillingCapture; exports.buildAnthropicApiUrl = _chunkA2YMUCBTcjs.buildAnthropicApiUrl; exports.buildAzureOpenAIApiUrl = _chunkA2YMUCBTcjs.buildAzureOpenAIApiUrl; exports.buildGeminiApiUrl = _chunkA2YMUCBTcjs.buildGeminiApiUrl; exports.buildNativeSearchAugmentation = _chunkJMJBSACDcjs.buildNativeSearchAugmentation; exports.buildOpenAIApiUrl = _chunkA2YMUCBTcjs.buildOpenAIApiUrl; exports.buildOpenAIResponseApiUrl = _chunkA2YMUCBTcjs.buildOpenAIResponseApiUrl; exports.buildProviderApiUrl = _chunkA2YMUCBTcjs.buildProviderApiUrl; exports.checkKeyQuota = _chunkDKPXN34Vcjs.checkKeyQuota; exports.classifyModelPrefix = _chunkVACWOIREcjs.classifyModelPrefix; exports.computeKeyExpiry = _chunkDKPXN34Vcjs.computeKeyExpiry; exports.computeVoucherGrant = _chunkDKPXN34Vcjs.computeVoucherGrant; exports.convertAnthropicRequestToOpenAI = _chunkSUEGJ75Dcjs.convertAnthropicRequestToOpenAI; exports.convertAnthropicStreamToOpenAI = _chunkSUEGJ75Dcjs.convertAnthropicStreamToOpenAI; exports.convertAnthropicToOpenAI = _chunkSUEGJ75Dcjs.convertAnthropicToOpenAI; exports.convertAnthropicToOpenAIWithThinking = _chunkSUEGJ75Dcjs.convertAnthropicToOpenAIWithThinking; exports.convertMessageToAnthropic = _chunkDKPXN34Vcjs.convertMessageToAnthropic; exports.convertMessageToGemini = _chunkDKPXN34Vcjs.convertMessageToGemini; exports.convertMessageToOpenAI = _chunkDKPXN34Vcjs.convertMessageToOpenAI; exports.convertOpenAIResponseToAnthropic = _chunkSUEGJ75Dcjs.convertOpenAIResponseToAnthropic; exports.convertOpenAIStreamToAnthropic = _chunkSUEGJ75Dcjs.convertOpenAIStreamToAnthropic; exports.convertOpenAIToAnthropic = _chunkSUEGJ75Dcjs.convertOpenAIToAnthropic; exports.convertOpenAIToAnthropicWithThinking = _chunkSUEGJ75Dcjs.convertOpenAIToAnthropicWithThinking; exports.createNamedKey = _chunkDKPXN34Vcjs.createNamedKey; exports.createSSEParser = _chunkHQP3K7PUcjs.createSSEParser; exports.defaultServerConfig = _chunkDKPXN34Vcjs.defaultServerConfig; exports.detectModelKind = _chunkVACWOIREcjs.detectModelKind; exports.detectNativeSearch = _chunkJMJBSACDcjs.detectNativeSearch; exports.detectRequestRole = _chunkVACWOIREcjs.detectRequestRole; exports.emitStreamEvent = _chunkDKPXN34Vcjs.emit; exports.endpointSupportsSubscription = _chunkVACWOIREcjs.endpointSupportsSubscription; exports.endpointToIngressFormat = _chunkVACWOIREcjs.endpointToIngressFormat; exports.extractRouteToken = _chunkDKPXN34Vcjs.extractRouteToken; exports.formatUrls = _chunkDKPXN34Vcjs.formatUrls; exports.generateVoucherCode = _chunkDKPXN34Vcjs.generateVoucherCode; exports.getBuiltinSearchTools = _chunkNZYN7C3Pcjs.getBuiltinSearchTools; exports.getOpenRouterAppIdentity = _chunkUNEFIWXIcjs.getOpenRouterAppIdentity; exports.getOpenRouterProviderConfig = _chunkDKPXN34Vcjs.getOpenRouterProviderConfig; exports.getOutboundApiServer = _chunkDKPXN34Vcjs.getOutboundApiServer; exports.getProviderHeaders = _chunkQ27JY5RGcjs.getProviderHeaders; exports.getProviderProxy = _chunkDKPXN34Vcjs.getProviderProxy; exports.handleVoucherRedeem = _chunkDKPXN34Vcjs.handleVoucherRedeem; exports.hasImageContent = _chunkSUEGJ75Dcjs.hasImageContent; exports.hasThinkingEnabled = _chunkSUEGJ75Dcjs.hasThinkingEnabled; exports.hashKey = _chunkDKPXN34Vcjs.hashKey; exports.hashVoucherCode = _chunkDKPXN34Vcjs.hashVoucherCode; exports.isConcurrencyRejection = _chunkDKPXN34Vcjs.isConcurrencyRejection; exports.isKindMappedEndpoint = _chunkVACWOIREcjs.isKindMappedEndpoint; exports.isOpenRouterProvider = _chunkUNEFIWXIcjs.isOpenRouterProvider; exports.isRedeemRequest = _chunkDKPXN34Vcjs.isRedeemRequest; exports.isSerialQueueTimeout = _chunkDKPXN34Vcjs.isSerialQueueTimeout; exports.isSubscriptionProviderId = _chunkVACWOIREcjs.isSubscriptionProviderId; exports.isUserMessageRequest = _chunkDKPXN34Vcjs.isUserMessageRequest; exports.loadServerConfig = _chunkDKPXN34Vcjs.loadServerConfig; exports.mergeServerConfig = _chunkDKPXN34Vcjs.mergeServerConfig; exports.modelKindsForEndpoint = _chunkVACWOIREcjs.modelKindsForEndpoint; exports.newVoucherId = _chunkDKPXN34Vcjs.newVoucherId; exports.normalizeAccountProbe = _chunkDKPXN34Vcjs.normalizeAccountProbe; exports.normalizeAudit = _chunkDKPXN34Vcjs.normalizeAudit; exports.normalizeAzureEndpoint = _chunkA2YMUCBTcjs.normalizeAzureEndpoint; exports.normalizeBilling = _chunkDKPXN34Vcjs.normalizeBilling; exports.normalizeFingerprint = _chunkDKPXN34Vcjs.normalizeFingerprint; exports.normalizePrefixTargets = _chunkDKPXN34Vcjs.normalizePrefixTargets; exports.normalizeProxyConfig = _chunkDKPXN34Vcjs.normalizeProxyConfig; exports.normalizeProxySegment = _chunkDKPXN34Vcjs.normalizeProxySegment; exports.normalizeQueueSegments = _chunkDKPXN34Vcjs.normalizeQueueSegments; exports.normalizeServerConfig = _chunkDKPXN34Vcjs.normalizeServerConfig; exports.normalizeVoucher = _chunkDKPXN34Vcjs.normalizeVoucher; exports.normalizeWebhookDestination = _chunkDKPXN34Vcjs.normalizeWebhookDestination; exports.normalizeWebhookSegment = _chunkDKPXN34Vcjs.normalizeWebhookSegment; exports.parseModelRef = _chunkVACWOIREcjs.parseModelRef; exports.pickModelRefFromList = _chunkVACWOIREcjs.pickModelRefFromList; exports.randomBase62 = _chunkDKPXN34Vcjs.randomBase62; exports.redactAuditText = _chunkFCR77GYMcjs.redactAuditText; exports.registerBuiltinTransformers = _chunkRGTR7CIOcjs.registerBuiltinTransformers; exports.registerStreamEventBuffer = _chunkDKPXN34Vcjs.register; exports.releaseStreamEventBuffer = _chunkDKPXN34Vcjs.release; exports.resolveApiFormat = _chunkA2YMUCBTcjs.resolveApiFormat; exports.resolvePrefixTarget = _chunkVACWOIREcjs.resolvePrefixTarget; exports.resolveProviderEndpoint = _chunkA2YMUCBTcjs.resolveProviderEndpoint; exports.resolveRoute = _chunkVACWOIREcjs.resolveRoute; exports.saveServerConfig = _chunkDKPXN34Vcjs.saveServerConfig; exports.serializeError = _chunkSVNDB62Dcjs.serializeError; exports.setOpenRouterAppIdentity = _chunkUNEFIWXIcjs.setOpenRouterAppIdentity; exports.startOfLocalDay = _chunkDKPXN34Vcjs.startOfLocalDay; exports.startOfLocalWeek = _chunkDKPXN34Vcjs.startOfLocalWeek; exports.streamSSEResponse = _chunkHQP3K7PUcjs.streamSSEResponse; exports.toVoucherInfo = _chunkDKPXN34Vcjs.toVoucherInfo; exports.validateEndpointModelConfig = _chunkVACWOIREcjs.validateEndpointModelConfig; exports.validateServerModelConfig = _chunkVACWOIREcjs.validateServerModelConfig; exports.verifyKey = _chunkDKPXN34Vcjs.verifyKey; exports.verifyPresentedKey = _chunkDKPXN34Vcjs.verifyPresentedKey; exports.voucherCodePrefix = _chunkDKPXN34Vcjs.voucherCodePrefix;
package/dist/index.d.cts CHANGED
@@ -9,7 +9,7 @@ export { ProviderConfigSource } from './ports/provider-config-source.cjs';
9
9
  export { UsageEventStore } from './ports/usage-event-store.cjs';
10
10
  export { WebSearchBackend } from './ports/web-search-backend.cjs';
11
11
  export { AnthropicIngressHandler, AnthropicIngressHandlerFactory, AnthropicRouteHandlerParams, AnthropicSdkHints, ExtendedContextHint, IngressFormat, ProviderProxyDeps, ProxyAttribution, RetryCallback, RouteAuthMode, RouteContext, StreamEventCallback, SubscriptionDispatchProfile, SubscriptionRequestSummary, TargetProviderFormat, UsageRecorderImport, UsageRecorderImport as UsageSink } from './provider-proxy/types.cjs';
12
- export { A as AccountProbeConfig, C as ChatDispatchMode, a as ConcurrencyQueueConfig, E as ENDPOINT_MODEL_KINDS, b as EndpointRoutingConfig, F as FingerprintConfig, K as KeyCostLimits, c as KeyExpiryInput, d as KeyExpiryResult, e as KeySpend, f as KeySpendReader, g as KeySpendSeeder, h as KeySpendTracker, i as KindMappedEndpoint, M as MessagesModelKind, j as ModelKind, k as ModelPrefixTargets, l as OutboundApiDeps, m as OutboundApiKeyCreated, n as OutboundApiKeyInfo, o as OutboundApiServerConfig, p as OutboundApiServerStatus, O as OutboundCredentialStore, q as OutboundEndpoint, r as OutboundFormatUrls, s as OutboundKeyActivationMode, O as OutboundKeyDb, t as OutboundKeyDbRow, u as OutboundKeyPolicy, v as OutboundProxyConfig, Q as QuotaDecision, R as RequestRole, w as ResponsesModelKind, U as UserMessageQueueConfig, V as VoucherCreateInput, x as VoucherDb, y as checkKeyQuota, z as computeKeyExpiry, B as computeVoucherGrant, D as generateVoucherCode, G as hashVoucherCode, H as newVoucherId, I as startOfLocalDay, J as startOfLocalWeek, L as toVoucherInfo, N as voucherCodePrefix } from './types-aBFFXoBz.cjs';
12
+ export { A as AccountProbeConfig, C as ChatDispatchMode, a as ConcurrencyQueueConfig, E as ENDPOINT_MODEL_KINDS, b as EndpointRoutingConfig, F as FingerprintConfig, K as KeySpendReader, c as KeySpendSeeder, d as KeySpendTracker, e as KindMappedEndpoint, M as MessagesModelKind, f as ModelKind, g as ModelPrefixTargets, h as OutboundApiDeps, i as OutboundApiKeyCreated, j as OutboundApiKeyInfo, k as OutboundApiServerConfig, l as OutboundApiServerStatus, O as OutboundCredentialStore, m as OutboundEndpoint, n as OutboundFormatUrls, o as OutboundKeyActivationMode, O as OutboundKeyDb, p as OutboundKeyDbRow, q as OutboundKeyPolicy, r as OutboundProxyConfig, R as RequestRole, s as ResponsesModelKind, U as UserMessageQueueConfig, V as VoucherCreateInput, t as VoucherDb, u as computeVoucherGrant, v as generateVoucherCode, w as hashVoucherCode, x as newVoucherId, y as startOfLocalDay, z as startOfLocalWeek, B as toVoucherInfo, D as voucherCodePrefix } from './types-B8Arpxn0.cjs';
13
13
  export { CostCalculation, PricingEngine, PricingEngineOptions } from './usage/pricing-engine.cjs';
14
14
  export { UsageRecordInput, UsageRecorder, UsageRecorderOptions } from './usage/usage-recorder.cjs';
15
15
  export { A as ApiFormat, C as CompletionOptions, a as CompletionResult, N as NATIVE_SEARCH_TOOL_NAMES, b as NativeSearchAugmentation, c as NativeSearchDetectionResult, d as NativeSearchProvider, e as NativeSearchUserConfig, S as StreamCallbacks } from './types-BScIHmPr.cjs';
@@ -18,14 +18,18 @@ export { SimpleChatGeminiMessage, SimpleChatGeminiPart, StreamEvent, StreamEvent
18
18
  export { buildAnthropicApiUrl, buildAzureOpenAIApiUrl, buildGeminiApiUrl, buildOpenAIApiUrl, buildOpenAIResponseApiUrl, buildProviderApiUrl, normalizeAzureEndpoint, resolveApiFormat, resolveProviderEndpoint } from './completion/url-builder.cjs';
19
19
  export { applyAugmentation, buildNativeSearchAugmentation, detectNativeSearch } from './completion/NativeSearchInjector.cjs';
20
20
  export { __resetProviderProxyForTests, extractRouteToken, getProviderProxy } from './provider-proxy.cjs';
21
- export { AUDIT_REDACTED, ApiServerSettingsStore, ApplyConfigInput, AuditCaptureContext, BillingCaptureContext, ConcurrencyQueueFullError, ConcurrencyWaitCancelledError, ConcurrencyWaitTimeoutError, DEFAULT_ACCOUNT_PROBE, DEFAULT_CONCURRENCY_QUEUE, DEFAULT_FINGERPRINT, DEFAULT_OUTBOUND_PORT, DEFAULT_USER_MESSAGE_QUEUE, EndpointModelConfigError, GateAcquireOptions, GateAcquisition, GateSlot, GateStatusEntry, KeyVerification, KeyedMutex, ModelPrefixKind, OUTBOUND_API_SERVER_CONFIG_KEY, OutboundApiConfigError, OutboundApiServer, OutboundConcurrencyGate, OutboundRateLimiter, SerialAcquireOptions, SerialQueueStatusEntry, SerialQueueTimeoutError, SerialSlot, UserMessageSerialQueue, VerifiedKey, __resetOutboundApiServerForTests, beginAuditCapture, beginBillingCapture, classifyModelPrefix, createNamedKey, defaultServerConfig, detectModelKind, detectRequestRole, endpointToIngressFormat, formatUrls, getOutboundApiServer, handleVoucherRedeem, hashKey, isConcurrencyRejection, isKindMappedEndpoint, isRedeemRequest, isSerialQueueTimeout, isUserMessageRequest, loadServerConfig, mergeServerConfig, modelKindsForEndpoint, normalizeAccountProbe, normalizeAudit, normalizeBilling, normalizeFingerprint, normalizePrefixTargets, normalizeProxyConfig, normalizeProxySegment, normalizeQueueSegments, normalizeServerConfig, normalizeVoucher, normalizeWebhookDestination, normalizeWebhookSegment, randomBase62, redactAuditText, resolvePrefixTarget, saveServerConfig, validateEndpointModelConfig, validateServerModelConfig, verifyKey, verifyPresentedKey } from './outbound-api.cjs';
21
+ export { ApiServerSettingsStore, ApplyConfigInput, ConcurrencyQueueFullError, ConcurrencyWaitCancelledError, ConcurrencyWaitTimeoutError, DEFAULT_ACCOUNT_PROBE, DEFAULT_CONCURRENCY_QUEUE, DEFAULT_FINGERPRINT, DEFAULT_OUTBOUND_PORT, DEFAULT_USER_MESSAGE_QUEUE, EndpointModelConfigError, GateAcquireOptions, GateAcquisition, GateSlot, GateStatusEntry, KeyVerification, KeyedMutex, ModelPrefixKind, OUTBOUND_API_SERVER_CONFIG_KEY, OutboundApiConfigError, OutboundApiServer, OutboundConcurrencyGate, OutboundRateLimiter, SerialAcquireOptions, SerialQueueStatusEntry, SerialQueueTimeoutError, SerialSlot, UserMessageSerialQueue, VerifiedKey, __resetOutboundApiServerForTests, classifyModelPrefix, createNamedKey, defaultServerConfig, detectModelKind, detectRequestRole, endpointToIngressFormat, formatUrls, getOutboundApiServer, handleVoucherRedeem, hashKey, isConcurrencyRejection, isKindMappedEndpoint, isRedeemRequest, isSerialQueueTimeout, isUserMessageRequest, loadServerConfig, mergeServerConfig, modelKindsForEndpoint, normalizeAccountProbe, normalizeAudit, normalizeBilling, normalizeFingerprint, normalizePrefixTargets, normalizeProxyConfig, normalizeProxySegment, normalizeQueueSegments, normalizeServerConfig, normalizeVoucher, normalizeWebhookDestination, normalizeWebhookSegment, randomBase62, resolvePrefixTarget, saveServerConfig, validateEndpointModelConfig, validateServerModelConfig, verifyKey, verifyPresentedKey } from './outbound-api.cjs';
22
22
  export { convertAnthropicRequestToOpenAI, convertAnthropicStreamToOpenAI, convertAnthropicToOpenAI, convertAnthropicToOpenAIWithThinking, convertOpenAIResponseToAnthropic, convertOpenAIStreamToAnthropic, convertOpenAIToAnthropic, convertOpenAIToAnthropicWithThinking, hasImageContent, hasThinkingEnabled } from './ApiConverter.cjs';
23
23
  export { ChainExecutionOptions, TransformerChainExecutor } from './transformer/TransformerChainExecutor.cjs';
24
24
  export { TransformerService } from './transformer/TransformerService.cjs';
25
25
  export { registerBuiltinTransformers } from './transformer/transformers.cjs';
26
26
  export { Annotation, ImageContent, MessageContent, ModelRoute, ModelTransformerConfig, ReasoningConfig, RequestConfig, RequestRouteInfo, ResolvedTransformerChain, StreamChunk, TextContent, ThinkLevel, ThinkingContent, ToolCall, ToolChoice, ToolParameterSchema, TransformRequestResult, Transformer, TransformerChainConfig, TransformerConfigEntry, TransformerConstructor, TransformerContext, TransformerLogger, TransformerOptions, TransformerReference, TransformerServiceConfig, UnifiedChatRequest, UnifiedChatResponse, UnifiedMessage, UnifiedTool, UrlCitation } from './transformer/types.cjs';
27
+ export { AUDIT_REDACTED, redactAuditText } from './outbound-api/auditRedact.cjs';
28
+ export { AuditCaptureContext, beginAuditCapture } from './outbound-api/auditCapture.cjs';
29
+ export { BillingCaptureContext, beginBillingCapture } from './outbound-api/billingCapture.cjs';
27
30
  export { D as DEFAULT_ROUTE_IDLE_MS, P as ProviderProxy, a as ProviderProxyRouteMap } from './ProviderProxy-CnMQYN59.cjs';
28
- export { S as SUBSCRIPTION_PROVIDER_IDS, e as endpointSupportsSubscription, i as isSubscriptionProviderId, p as parseModelRef, a as pickModelRefFromList, r as resolveRoute } from './routeResolver-CbG5uBgm.cjs';
31
+ export { K as KeyCostLimits, a as KeyExpiryInput, b as KeyExpiryResult, c as KeySpend, Q as QuotaDecision, d as checkKeyQuota, e as computeKeyExpiry } from './keyPolicy-Cp0FntZl.cjs';
32
+ export { S as SUBSCRIPTION_PROVIDER_IDS, e as endpointSupportsSubscription, i as isSubscriptionProviderId, p as parseModelRef, a as pickModelRefFromList, r as resolveRoute } from './routeResolver-CB3tvJKy.cjs';
29
33
  import '@omnicross/contracts/message-blocks';
30
34
  import '@omnicross/contracts/completion-types';
31
35
  import '@omnicross/contracts/mcp-types';
package/dist/index.d.ts CHANGED
@@ -9,7 +9,7 @@ export { ProviderConfigSource } from './ports/provider-config-source.js';
9
9
  export { UsageEventStore } from './ports/usage-event-store.js';
10
10
  export { WebSearchBackend } from './ports/web-search-backend.js';
11
11
  export { AnthropicIngressHandler, AnthropicIngressHandlerFactory, AnthropicRouteHandlerParams, AnthropicSdkHints, ExtendedContextHint, IngressFormat, ProviderProxyDeps, ProxyAttribution, RetryCallback, RouteAuthMode, RouteContext, StreamEventCallback, SubscriptionDispatchProfile, SubscriptionRequestSummary, TargetProviderFormat, UsageRecorderImport, UsageRecorderImport as UsageSink } from './provider-proxy/types.js';
12
- export { A as AccountProbeConfig, C as ChatDispatchMode, a as ConcurrencyQueueConfig, E as ENDPOINT_MODEL_KINDS, b as EndpointRoutingConfig, F as FingerprintConfig, K as KeyCostLimits, c as KeyExpiryInput, d as KeyExpiryResult, e as KeySpend, f as KeySpendReader, g as KeySpendSeeder, h as KeySpendTracker, i as KindMappedEndpoint, M as MessagesModelKind, j as ModelKind, k as ModelPrefixTargets, l as OutboundApiDeps, m as OutboundApiKeyCreated, n as OutboundApiKeyInfo, o as OutboundApiServerConfig, p as OutboundApiServerStatus, O as OutboundCredentialStore, q as OutboundEndpoint, r as OutboundFormatUrls, s as OutboundKeyActivationMode, O as OutboundKeyDb, t as OutboundKeyDbRow, u as OutboundKeyPolicy, v as OutboundProxyConfig, Q as QuotaDecision, R as RequestRole, w as ResponsesModelKind, U as UserMessageQueueConfig, V as VoucherCreateInput, x as VoucherDb, y as checkKeyQuota, z as computeKeyExpiry, B as computeVoucherGrant, D as generateVoucherCode, G as hashVoucherCode, H as newVoucherId, I as startOfLocalDay, J as startOfLocalWeek, L as toVoucherInfo, N as voucherCodePrefix } from './types-6OUY_xfA.js';
12
+ export { A as AccountProbeConfig, C as ChatDispatchMode, a as ConcurrencyQueueConfig, E as ENDPOINT_MODEL_KINDS, b as EndpointRoutingConfig, F as FingerprintConfig, K as KeySpendReader, c as KeySpendSeeder, d as KeySpendTracker, e as KindMappedEndpoint, M as MessagesModelKind, f as ModelKind, g as ModelPrefixTargets, h as OutboundApiDeps, i as OutboundApiKeyCreated, j as OutboundApiKeyInfo, k as OutboundApiServerConfig, l as OutboundApiServerStatus, O as OutboundCredentialStore, m as OutboundEndpoint, n as OutboundFormatUrls, o as OutboundKeyActivationMode, O as OutboundKeyDb, p as OutboundKeyDbRow, q as OutboundKeyPolicy, r as OutboundProxyConfig, R as RequestRole, s as ResponsesModelKind, U as UserMessageQueueConfig, V as VoucherCreateInput, t as VoucherDb, u as computeVoucherGrant, v as generateVoucherCode, w as hashVoucherCode, x as newVoucherId, y as startOfLocalDay, z as startOfLocalWeek, B as toVoucherInfo, D as voucherCodePrefix } from './types-lgPYQuZS.js';
13
13
  export { CostCalculation, PricingEngine, PricingEngineOptions } from './usage/pricing-engine.js';
14
14
  export { UsageRecordInput, UsageRecorder, UsageRecorderOptions } from './usage/usage-recorder.js';
15
15
  export { A as ApiFormat, C as CompletionOptions, a as CompletionResult, N as NATIVE_SEARCH_TOOL_NAMES, b as NativeSearchAugmentation, c as NativeSearchDetectionResult, d as NativeSearchProvider, e as NativeSearchUserConfig, S as StreamCallbacks } from './types-BScIHmPr.js';
@@ -18,14 +18,18 @@ export { SimpleChatGeminiMessage, SimpleChatGeminiPart, StreamEvent, StreamEvent
18
18
  export { buildAnthropicApiUrl, buildAzureOpenAIApiUrl, buildGeminiApiUrl, buildOpenAIApiUrl, buildOpenAIResponseApiUrl, buildProviderApiUrl, normalizeAzureEndpoint, resolveApiFormat, resolveProviderEndpoint } from './completion/url-builder.js';
19
19
  export { applyAugmentation, buildNativeSearchAugmentation, detectNativeSearch } from './completion/NativeSearchInjector.js';
20
20
  export { __resetProviderProxyForTests, extractRouteToken, getProviderProxy } from './provider-proxy.js';
21
- export { AUDIT_REDACTED, ApiServerSettingsStore, ApplyConfigInput, AuditCaptureContext, BillingCaptureContext, ConcurrencyQueueFullError, ConcurrencyWaitCancelledError, ConcurrencyWaitTimeoutError, DEFAULT_ACCOUNT_PROBE, DEFAULT_CONCURRENCY_QUEUE, DEFAULT_FINGERPRINT, DEFAULT_OUTBOUND_PORT, DEFAULT_USER_MESSAGE_QUEUE, EndpointModelConfigError, GateAcquireOptions, GateAcquisition, GateSlot, GateStatusEntry, KeyVerification, KeyedMutex, ModelPrefixKind, OUTBOUND_API_SERVER_CONFIG_KEY, OutboundApiConfigError, OutboundApiServer, OutboundConcurrencyGate, OutboundRateLimiter, SerialAcquireOptions, SerialQueueStatusEntry, SerialQueueTimeoutError, SerialSlot, UserMessageSerialQueue, VerifiedKey, __resetOutboundApiServerForTests, beginAuditCapture, beginBillingCapture, classifyModelPrefix, createNamedKey, defaultServerConfig, detectModelKind, detectRequestRole, endpointToIngressFormat, formatUrls, getOutboundApiServer, handleVoucherRedeem, hashKey, isConcurrencyRejection, isKindMappedEndpoint, isRedeemRequest, isSerialQueueTimeout, isUserMessageRequest, loadServerConfig, mergeServerConfig, modelKindsForEndpoint, normalizeAccountProbe, normalizeAudit, normalizeBilling, normalizeFingerprint, normalizePrefixTargets, normalizeProxyConfig, normalizeProxySegment, normalizeQueueSegments, normalizeServerConfig, normalizeVoucher, normalizeWebhookDestination, normalizeWebhookSegment, randomBase62, redactAuditText, resolvePrefixTarget, saveServerConfig, validateEndpointModelConfig, validateServerModelConfig, verifyKey, verifyPresentedKey } from './outbound-api.js';
21
+ export { ApiServerSettingsStore, ApplyConfigInput, ConcurrencyQueueFullError, ConcurrencyWaitCancelledError, ConcurrencyWaitTimeoutError, DEFAULT_ACCOUNT_PROBE, DEFAULT_CONCURRENCY_QUEUE, DEFAULT_FINGERPRINT, DEFAULT_OUTBOUND_PORT, DEFAULT_USER_MESSAGE_QUEUE, EndpointModelConfigError, GateAcquireOptions, GateAcquisition, GateSlot, GateStatusEntry, KeyVerification, KeyedMutex, ModelPrefixKind, OUTBOUND_API_SERVER_CONFIG_KEY, OutboundApiConfigError, OutboundApiServer, OutboundConcurrencyGate, OutboundRateLimiter, SerialAcquireOptions, SerialQueueStatusEntry, SerialQueueTimeoutError, SerialSlot, UserMessageSerialQueue, VerifiedKey, __resetOutboundApiServerForTests, classifyModelPrefix, createNamedKey, defaultServerConfig, detectModelKind, detectRequestRole, endpointToIngressFormat, formatUrls, getOutboundApiServer, handleVoucherRedeem, hashKey, isConcurrencyRejection, isKindMappedEndpoint, isRedeemRequest, isSerialQueueTimeout, isUserMessageRequest, loadServerConfig, mergeServerConfig, modelKindsForEndpoint, normalizeAccountProbe, normalizeAudit, normalizeBilling, normalizeFingerprint, normalizePrefixTargets, normalizeProxyConfig, normalizeProxySegment, normalizeQueueSegments, normalizeServerConfig, normalizeVoucher, normalizeWebhookDestination, normalizeWebhookSegment, randomBase62, resolvePrefixTarget, saveServerConfig, validateEndpointModelConfig, validateServerModelConfig, verifyKey, verifyPresentedKey } from './outbound-api.js';
22
22
  export { convertAnthropicRequestToOpenAI, convertAnthropicStreamToOpenAI, convertAnthropicToOpenAI, convertAnthropicToOpenAIWithThinking, convertOpenAIResponseToAnthropic, convertOpenAIStreamToAnthropic, convertOpenAIToAnthropic, convertOpenAIToAnthropicWithThinking, hasImageContent, hasThinkingEnabled } from './ApiConverter.js';
23
23
  export { ChainExecutionOptions, TransformerChainExecutor } from './transformer/TransformerChainExecutor.js';
24
24
  export { TransformerService } from './transformer/TransformerService.js';
25
25
  export { registerBuiltinTransformers } from './transformer/transformers.js';
26
26
  export { Annotation, ImageContent, MessageContent, ModelRoute, ModelTransformerConfig, ReasoningConfig, RequestConfig, RequestRouteInfo, ResolvedTransformerChain, StreamChunk, TextContent, ThinkLevel, ThinkingContent, ToolCall, ToolChoice, ToolParameterSchema, TransformRequestResult, Transformer, TransformerChainConfig, TransformerConfigEntry, TransformerConstructor, TransformerContext, TransformerLogger, TransformerOptions, TransformerReference, TransformerServiceConfig, UnifiedChatRequest, UnifiedChatResponse, UnifiedMessage, UnifiedTool, UrlCitation } from './transformer/types.js';
27
+ export { AUDIT_REDACTED, redactAuditText } from './outbound-api/auditRedact.js';
28
+ export { AuditCaptureContext, beginAuditCapture } from './outbound-api/auditCapture.js';
29
+ export { BillingCaptureContext, beginBillingCapture } from './outbound-api/billingCapture.js';
27
30
  export { D as DEFAULT_ROUTE_IDLE_MS, P as ProviderProxy, a as ProviderProxyRouteMap } from './ProviderProxy-C-xqrkKi.js';
28
- export { S as SUBSCRIPTION_PROVIDER_IDS, e as endpointSupportsSubscription, i as isSubscriptionProviderId, p as parseModelRef, a as pickModelRefFromList, r as resolveRoute } from './routeResolver-B1NglTfe.js';
31
+ export { K as KeyCostLimits, a as KeyExpiryInput, b as KeyExpiryResult, c as KeySpend, Q as QuotaDecision, d as checkKeyQuota, e as computeKeyExpiry } from './keyPolicy-Cp0FntZl.js';
32
+ export { S as SUBSCRIPTION_PROVIDER_IDS, e as endpointSupportsSubscription, i as isSubscriptionProviderId, p as parseModelRef, a as pickModelRefFromList, r as resolveRoute } from './routeResolver-C4T7yClx.js';
29
33
  import '@omnicross/contracts/message-blocks';
30
34
  import '@omnicross/contracts/completion-types';
31
35
  import '@omnicross/contracts/mcp-types';
package/dist/index.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import {
2
- AUDIT_REDACTED,
3
2
  CompletionService,
4
3
  ConcurrencyQueueFullError,
5
4
  ConcurrencyWaitCancelledError,
@@ -25,8 +24,6 @@ import {
25
24
  __resetProviderProxyForTests,
26
25
  addOpenRouterProviderToRequest,
27
26
  attach,
28
- beginAuditCapture,
29
- beginBillingCapture,
30
27
  checkKeyQuota,
31
28
  computeKeyExpiry,
32
29
  computeVoucherGrant,
@@ -65,7 +62,6 @@ import {
65
62
  normalizeWebhookDestination,
66
63
  normalizeWebhookSegment,
67
64
  randomBase62,
68
- redactAuditText,
69
65
  register,
70
66
  release,
71
67
  saveServerConfig,
@@ -75,62 +71,55 @@ import {
75
71
  verifyKey,
76
72
  verifyPresentedKey,
77
73
  voucherCodePrefix
78
- } from "./chunk-4DECIFU7.js";
74
+ } from "./chunk-QYTT6GE3.js";
79
75
  import {
80
76
  createSSEParser,
81
77
  streamSSEResponse
82
78
  } from "./chunk-VVEHS2LI.js";
83
79
  import "./chunk-46RLHI7D.js";
84
- import {
85
- TransformerChainExecutor
86
- } from "./chunk-G2UTNSGU.js";
87
80
  import {
88
81
  TransformerService
89
82
  } from "./chunk-DK4A7DLE.js";
90
83
  import {
91
84
  registerBuiltinTransformers
92
- } from "./chunk-MQNDWYPN.js";
93
- import "./chunk-Z7LUNECE.js";
85
+ } from "./chunk-VPBAUQ2M.js";
94
86
  import "./chunk-ZJZAOKI7.js";
95
87
  import "./chunk-FTQ7IQUC.js";
96
88
  import "./chunk-C7PSERMH.js";
97
- import "./chunk-5HTVET6E.js";
89
+ import "./chunk-TIER4SUC.js";
90
+ import "./chunk-Z7LUNECE.js";
98
91
  import "./chunk-7VU7V2E4.js";
99
92
  import {
100
93
  PricingEngine
101
94
  } from "./chunk-ZLX3KGXX.js";
102
95
  import {
103
96
  UsageRecorder
104
- } from "./chunk-CWM2ZDU5.js";
97
+ } from "./chunk-BPKCU575.js";
98
+ import {
99
+ TransformerChainExecutor
100
+ } from "./chunk-G2UTNSGU.js";
105
101
  import "./chunk-MZNPGW5Q.js";
106
102
  import "./chunk-XTEI64OU.js";
107
103
  import "./chunk-XX6NQJMA.js";
108
104
  import "./chunk-IAXWICZU.js";
109
- import "./chunk-5ERIZW3D.js";
110
- import "./chunk-5ENKBSWO.js";
111
- import "./chunk-N5QFKSDO.js";
112
- import {
113
- serializeError
114
- } from "./chunk-AVYJ4YBN.js";
105
+ import "./chunk-OE6TDIWW.js";
115
106
  import "./chunk-DRWHTIIZ.js";
116
- import "./chunk-WNY4WMRF.js";
117
- import "./chunk-TKJMZBAH.js";
118
- import "./chunk-JO5NLTLY.js";
107
+ import "./chunk-IK3KE3AU.js";
119
108
  import {
120
109
  getProviderHeaders
121
110
  } from "./chunk-ZY6KU6P3.js";
122
111
  import "./chunk-JWC6APFQ.js";
112
+ import "./chunk-5ERIZW3D.js";
113
+ import "./chunk-5ENKBSWO.js";
114
+ import "./chunk-HRRYG2AX.js";
123
115
  import {
124
- buildAnthropicApiUrl,
125
- buildAzureOpenAIApiUrl,
126
- buildGeminiApiUrl,
127
- buildOpenAIApiUrl,
128
- buildOpenAIResponseApiUrl,
129
- buildProviderApiUrl,
130
- normalizeAzureEndpoint,
131
- resolveApiFormat,
132
- resolveProviderEndpoint
133
- } from "./chunk-H5JUT3KV.js";
116
+ serializeError
117
+ } from "./chunk-AVYJ4YBN.js";
118
+ import {
119
+ beginBillingCapture
120
+ } from "./chunk-WLYIIEAF.js";
121
+ import "./chunk-TKJMZBAH.js";
122
+ import "./chunk-3QFXFCHG.js";
134
123
  import {
135
124
  SUBSCRIPTION_PROVIDER_IDS,
136
125
  classifyModelPrefix,
@@ -147,11 +136,31 @@ import {
147
136
  resolveRoute,
148
137
  validateEndpointModelConfig,
149
138
  validateServerModelConfig
150
- } from "./chunk-CZHZGRU7.js";
139
+ } from "./chunk-UHGVBFU3.js";
151
140
  import "./chunk-AQ5TNQB7.js";
152
141
  import {
153
142
  ENDPOINT_MODEL_KINDS
154
143
  } from "./chunk-XEKD23J5.js";
144
+ import {
145
+ buildAnthropicApiUrl,
146
+ buildAzureOpenAIApiUrl,
147
+ buildGeminiApiUrl,
148
+ buildOpenAIApiUrl,
149
+ buildOpenAIResponseApiUrl,
150
+ buildProviderApiUrl,
151
+ normalizeAzureEndpoint,
152
+ resolveApiFormat,
153
+ resolveProviderEndpoint
154
+ } from "./chunk-H5JUT3KV.js";
155
+ import {
156
+ beginAuditCapture
157
+ } from "./chunk-7Y47UCF2.js";
158
+ import {
159
+ AUDIT_REDACTED,
160
+ redactAuditText
161
+ } from "./chunk-K5NM7VAH.js";
162
+ import "./chunk-WNY4WMRF.js";
163
+ import "./chunk-OZFM4X3S.js";
155
164
  import {
156
165
  convertAnthropicRequestToOpenAI,
157
166
  convertAnthropicStreamToOpenAI,
@@ -164,9 +173,9 @@ import {
164
173
  hasImageContent,
165
174
  hasThinkingEnabled
166
175
  } from "./chunk-5ZQBEOMD.js";
167
- import "./chunk-BO4RFWBR.js";
168
176
  import "./chunk-Z7Y2NPHY.js";
169
177
  import "./chunk-S4WBV25P.js";
178
+ import "./chunk-XK5CIRMQ.js";
170
179
  import {
171
180
  BuiltinToolExecutor,
172
181
  getBuiltinSearchTools
@@ -0,0 +1,90 @@
1
+ /**
2
+ * keyPolicy — PURE decision helpers for the outbound key-policy envelope
3
+ * (`outbound-key-policy`, design D2/D4). Expiry/activation resolution +
4
+ * cost-quota decision. No I/O, no clock ownership (the caller passes `now`), so
5
+ * these are trivially unit-testable and reused by both the auth path
6
+ * (`verifyKey`) and the wire path (`outboundApiRouter`).
7
+ *
8
+ * The #6 (`restrictedModels`) and #9 (voucher) children EXTEND the key-policy
9
+ * schema; they must not change the shapes frozen here.
10
+ *
11
+ * @module outbound-api/keyPolicy
12
+ */
13
+ /** The expiry/activation subset of a key row `computeKeyExpiry` reads. */
14
+ interface KeyExpiryInput {
15
+ /** Fixed-mode absolute expiry (epoch ms). */
16
+ expiresAt?: number | null;
17
+ /** Expiry mode; absent ⇒ `'fixed'`. */
18
+ activationMode?: 'fixed' | 'activation';
19
+ /** Activation-mode lifetime in days (absent/null ⇒ never expires). */
20
+ activationDays?: number | null;
21
+ /** First-use activation stamp (epoch ms); null ⇒ not yet activated. */
22
+ activatedAt?: number | null;
23
+ }
24
+ /** Result of {@link computeKeyExpiry}. */
25
+ interface KeyExpiryResult {
26
+ expired: boolean;
27
+ /** The resolved absolute expiry (epoch ms), when the key has one. */
28
+ effectiveExpiresAt?: number;
29
+ /**
30
+ * True when this is an activation-mode key that has NOT been activated yet, so
31
+ * the caller SHOULD stamp the activation (best-effort) on a successful verify.
32
+ */
33
+ needsActivation?: boolean;
34
+ }
35
+ /**
36
+ * Resolve whether a key is past its effective expiry (design D2).
37
+ * - `fixed`: expired when `expiresAt != null && now >= expiresAt`.
38
+ * - `activation`: while `activatedAt == null` the key is NOT expired (it
39
+ * activates on THIS use → `needsActivation`); once activated, expired when
40
+ * `now >= activatedAt + activationDays*DAY`. A null `activationDays` never
41
+ * expires.
42
+ * A key with no expiry configured never expires.
43
+ */
44
+ declare function computeKeyExpiry(row: KeyExpiryInput, now: number): KeyExpiryResult;
45
+ /** Per-key USD cost limits carried on the verified key (absent scope ⇒ no cap). */
46
+ interface KeyCostLimits {
47
+ dailyUsd?: number;
48
+ totalUsd?: number;
49
+ weeklyUsd?: number;
50
+ }
51
+ /** In-memory per-key accumulated spend snapshot (see `keySpendTracker`). */
52
+ interface KeySpend {
53
+ dailyUsd: number;
54
+ /** Local-midnight boundary the `dailyUsd` window opened at (epoch ms). */
55
+ dailyWindowStart: number;
56
+ weeklyUsd: number;
57
+ /** Local week-start boundary the `weeklyUsd` window opened at (epoch ms). */
58
+ weeklyWindowStart: number;
59
+ totalUsd: number;
60
+ }
61
+ /** Decision returned by {@link checkKeyQuota}. */
62
+ type QuotaDecision = {
63
+ allowed: true;
64
+ } | {
65
+ allowed: false;
66
+ scope: 'daily' | 'weekly' | 'total';
67
+ limitUsd: number;
68
+ spentUsd: number;
69
+ };
70
+ /**
71
+ * Decide whether the key's accumulated spend already meets/exceeds any
72
+ * configured cost limit (design D4). `allowed:false` when a scope's PRIOR spend
73
+ * is `>= limit` (the triggering request's own cost is unknown pre-flight →
74
+ * bounded one-request overage, CRS-equivalent). An unconfigured scope is never
75
+ * gated; a `limits`-less key always passes.
76
+ */
77
+ declare function checkKeyQuota(limits: KeyCostLimits | undefined, spend: KeySpend): QuotaDecision;
78
+ /**
79
+ * Per-key model restriction carried on the verified key (outbound-key-policy #6).
80
+ * Present ONLY when the key has `enableModelRestriction === true` — so the wire
81
+ * layer's presence check (`if (key.modelRestriction) …`) is the zero-regression
82
+ * gate.
83
+ */
84
+ interface ModelRestriction {
85
+ mode: 'blacklist' | 'allowlist';
86
+ /** Bare modelIds the mode acts on. Empty allowlist denies every model. */
87
+ models: string[];
88
+ }
89
+
90
+ export { type KeyCostLimits as K, type ModelRestriction as M, type QuotaDecision as Q, type KeyExpiryInput as a, type KeyExpiryResult as b, type KeySpend as c, checkKeyQuota as d, computeKeyExpiry as e };
@@ -0,0 +1,90 @@
1
+ /**
2
+ * keyPolicy — PURE decision helpers for the outbound key-policy envelope
3
+ * (`outbound-key-policy`, design D2/D4). Expiry/activation resolution +
4
+ * cost-quota decision. No I/O, no clock ownership (the caller passes `now`), so
5
+ * these are trivially unit-testable and reused by both the auth path
6
+ * (`verifyKey`) and the wire path (`outboundApiRouter`).
7
+ *
8
+ * The #6 (`restrictedModels`) and #9 (voucher) children EXTEND the key-policy
9
+ * schema; they must not change the shapes frozen here.
10
+ *
11
+ * @module outbound-api/keyPolicy
12
+ */
13
+ /** The expiry/activation subset of a key row `computeKeyExpiry` reads. */
14
+ interface KeyExpiryInput {
15
+ /** Fixed-mode absolute expiry (epoch ms). */
16
+ expiresAt?: number | null;
17
+ /** Expiry mode; absent ⇒ `'fixed'`. */
18
+ activationMode?: 'fixed' | 'activation';
19
+ /** Activation-mode lifetime in days (absent/null ⇒ never expires). */
20
+ activationDays?: number | null;
21
+ /** First-use activation stamp (epoch ms); null ⇒ not yet activated. */
22
+ activatedAt?: number | null;
23
+ }
24
+ /** Result of {@link computeKeyExpiry}. */
25
+ interface KeyExpiryResult {
26
+ expired: boolean;
27
+ /** The resolved absolute expiry (epoch ms), when the key has one. */
28
+ effectiveExpiresAt?: number;
29
+ /**
30
+ * True when this is an activation-mode key that has NOT been activated yet, so
31
+ * the caller SHOULD stamp the activation (best-effort) on a successful verify.
32
+ */
33
+ needsActivation?: boolean;
34
+ }
35
+ /**
36
+ * Resolve whether a key is past its effective expiry (design D2).
37
+ * - `fixed`: expired when `expiresAt != null && now >= expiresAt`.
38
+ * - `activation`: while `activatedAt == null` the key is NOT expired (it
39
+ * activates on THIS use → `needsActivation`); once activated, expired when
40
+ * `now >= activatedAt + activationDays*DAY`. A null `activationDays` never
41
+ * expires.
42
+ * A key with no expiry configured never expires.
43
+ */
44
+ declare function computeKeyExpiry(row: KeyExpiryInput, now: number): KeyExpiryResult;
45
+ /** Per-key USD cost limits carried on the verified key (absent scope ⇒ no cap). */
46
+ interface KeyCostLimits {
47
+ dailyUsd?: number;
48
+ totalUsd?: number;
49
+ weeklyUsd?: number;
50
+ }
51
+ /** In-memory per-key accumulated spend snapshot (see `keySpendTracker`). */
52
+ interface KeySpend {
53
+ dailyUsd: number;
54
+ /** Local-midnight boundary the `dailyUsd` window opened at (epoch ms). */
55
+ dailyWindowStart: number;
56
+ weeklyUsd: number;
57
+ /** Local week-start boundary the `weeklyUsd` window opened at (epoch ms). */
58
+ weeklyWindowStart: number;
59
+ totalUsd: number;
60
+ }
61
+ /** Decision returned by {@link checkKeyQuota}. */
62
+ type QuotaDecision = {
63
+ allowed: true;
64
+ } | {
65
+ allowed: false;
66
+ scope: 'daily' | 'weekly' | 'total';
67
+ limitUsd: number;
68
+ spentUsd: number;
69
+ };
70
+ /**
71
+ * Decide whether the key's accumulated spend already meets/exceeds any
72
+ * configured cost limit (design D4). `allowed:false` when a scope's PRIOR spend
73
+ * is `>= limit` (the triggering request's own cost is unknown pre-flight →
74
+ * bounded one-request overage, CRS-equivalent). An unconfigured scope is never
75
+ * gated; a `limits`-less key always passes.
76
+ */
77
+ declare function checkKeyQuota(limits: KeyCostLimits | undefined, spend: KeySpend): QuotaDecision;
78
+ /**
79
+ * Per-key model restriction carried on the verified key (outbound-key-policy #6).
80
+ * Present ONLY when the key has `enableModelRestriction === true` — so the wire
81
+ * layer's presence check (`if (key.modelRestriction) …`) is the zero-regression
82
+ * gate.
83
+ */
84
+ interface ModelRestriction {
85
+ mode: 'blacklist' | 'allowlist';
86
+ /** Bare modelIds the mode acts on. Empty allowlist denies every model. */
87
+ models: string[];
88
+ }
89
+
90
+ export { type KeyCostLimits as K, type ModelRestriction as M, type QuotaDecision as Q, type KeyExpiryInput as a, type KeyExpiryResult as b, type KeySpend as c, checkKeyQuota as d, computeKeyExpiry as e };
@@ -0,0 +1,9 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkE3UCVHLPcjs = require('../chunk-E3UCVHLP.cjs');
4
+ require('../chunk-FCR77GYM.cjs');
5
+ require('../chunk-AEOZIDEB.cjs');
6
+ require('../chunk-XSVNC2UD.cjs');
7
+
8
+
9
+ exports.beginAuditCapture = _chunkE3UCVHLPcjs.beginAuditCapture;
@@ -0,0 +1,52 @@
1
+ import http from 'node:http';
2
+
3
+ /**
4
+ * auditCapture — the outbound server's post-response audit capture hook
5
+ * (request-audit-log, design D1/D3/D5).
6
+ *
7
+ * {@link beginAuditCapture} is called at the TOP of `handleOutboundRequest`. It
8
+ * reads the active capture config from the core slot; when audit is DISABLED it
9
+ * returns `null` immediately (one slot read — no assembly, no listener, zero
10
+ * regression). When enabled it:
11
+ * - registers a one-shot `res.on('close')` listener that, at response end,
12
+ * assembles the {@link AuditRecord} from the http `req` (IP via the socket, or
13
+ * a trusted `X-Forwarded-For` only when configured — LEAD OQ1 anti-spoof; UA;
14
+ * method; path with the query string DROPPED), the response `statusCode`, the
15
+ * elapsed ms, and the fields the handler fills in (keyId / model / provider /
16
+ * error / bodies) — then hands it to the fire-and-forget `recordAudit`;
17
+ * - when `captureBodies` is ALSO on, wraps `res.write`/`res.end` to accumulate a
18
+ * BOUNDED response body (metadata-only for a streaming `text/event-stream`
19
+ * response — a full stream is unbounded), and truncates+redacts both bodies.
20
+ *
21
+ * Request HEADERS are NEVER read into a record (Authorization / x-api-key live
22
+ * there). Every stored body passes through {@link redactAuditText}. The assembly
23
+ * is wrapped so a capture failure can never surface into the relay path.
24
+ *
25
+ * @module @omnicross/core/outbound-api/auditCapture
26
+ */
27
+
28
+ /**
29
+ * The mutable context the request handler enriches as it progresses. `null` is
30
+ * returned by {@link beginAuditCapture} when audit is disabled — the handler
31
+ * guards every write with `if (audit)`.
32
+ */
33
+ interface AuditCaptureContext {
34
+ /** Outbound key id (set after auth). NEVER the key material. */
35
+ keyId?: string | null;
36
+ /** Resolved upstream model (set after route resolution). */
37
+ model?: string;
38
+ /** Upstream provider id (set after route resolution). */
39
+ provider?: string;
40
+ /** Sanitized error message (set on a relay/dispatch failure). */
41
+ error?: string;
42
+ /** Stash the raw request body for capture (a no-op unless `captureBodies`). */
43
+ setRequestBody(raw: string): void;
44
+ }
45
+ /**
46
+ * Begin audit capture for one request. Returns a mutable context the handler
47
+ * enriches, or `null` when audit is disabled (zero-cost path). The record is
48
+ * emitted on response `close` via the fire-and-forget sink.
49
+ */
50
+ declare function beginAuditCapture(req: http.IncomingMessage, res: http.ServerResponse, now: number): AuditCaptureContext | null;
51
+
52
+ export { type AuditCaptureContext, beginAuditCapture };