@omnicross/core 0.1.3 → 0.1.5
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.
- package/LICENSE +21 -21
- package/NOTICE +57 -57
- package/README.md +15 -15
- package/dist/auth/GeminiCodeAssistProjectResolver.cjs +6 -5
- package/dist/auth/GeminiCodeAssistProjectResolver.js +6 -5
- package/dist/{chunk-2DCNB7DF.cjs → chunk-3Q6Z6JTO.cjs} +154 -26
- package/dist/chunk-3QFXFCHG.js +33 -0
- package/dist/chunk-3Z5BQZFM.cjs +52 -0
- package/dist/{chunk-4VAVYUZS.cjs → chunk-4XMYPW46.cjs} +9 -9
- package/dist/chunk-4YINUUKQ.cjs +33 -0
- package/dist/{chunk-S4WBV25P.js → chunk-6QZGDLL4.js} +106 -23
- package/dist/{chunk-C72S6TTV.cjs → chunk-7FEBOPJO.cjs} +5 -4
- package/dist/chunk-APYG5QD7.cjs +50 -0
- package/dist/{chunk-5HTVET6E.js → chunk-BODMAL6G.js} +143 -15
- package/dist/{chunk-CWM2ZDU5.js → chunk-BPKCU575.js} +3 -10
- package/dist/{chunk-2FMI2B6V.cjs → chunk-CGKLE6IW.cjs} +350 -461
- package/dist/{chunk-BO4RFWBR.js → chunk-D3TDKWRP.js} +84 -3
- package/dist/{chunk-RSJ3TWJQ.cjs → chunk-DDMRUL76.cjs} +5 -5
- package/dist/chunk-FCR77GYM.cjs +33 -0
- package/dist/{chunk-4DECIFU7.js → chunk-FH2P4OCD.js} +178 -289
- package/dist/{chunk-N5QFKSDO.js → chunk-HRRYG2AX.js} +2 -1
- package/dist/{chunk-KUU2RNG6.cjs → chunk-HYN75H6G.cjs} +3 -0
- package/dist/{chunk-Z7LUNECE.js → chunk-IB3FDI4O.js} +5 -4
- package/dist/chunk-IFXJ2BG7.js +109 -0
- package/dist/{chunk-JO5NLTLY.js → chunk-IK3KE3AU.js} +3 -0
- package/dist/{chunk-C7PSERMH.js → chunk-IWQAX3CS.js} +1 -1
- package/dist/{chunk-YGXJGRFI.cjs → chunk-JWVTXXPX.cjs} +106 -23
- package/dist/{chunk-7YN22L2H.cjs → chunk-K52THW2C.cjs} +5 -5
- package/dist/chunk-K5NM7VAH.js +33 -0
- package/dist/{chunk-Y6OM7EV7.cjs → chunk-KFI44N2R.cjs} +2 -1
- package/dist/{chunk-Z7Y2NPHY.js → chunk-MFZ5437A.js} +1 -1
- package/dist/chunk-OE6TDIWW.js +22 -0
- package/dist/{chunk-MQNDWYPN.js → chunk-OQWKZCXP.js} +13 -6
- package/dist/chunk-OZFM4X3S.js +18 -0
- package/dist/chunk-PG7PS2NN.cjs +170 -0
- package/dist/{chunk-3QOSDDNI.cjs → chunk-SNYBEXLB.cjs} +6 -13
- package/dist/chunk-SYQF7OIR.js +52 -0
- package/dist/{chunk-CZHZGRU7.js → chunk-UHGVBFU3.js} +2 -0
- package/dist/chunk-UIBD2YY5.cjs +22 -0
- package/dist/chunk-UNWKG6EI.cjs +109 -0
- package/dist/{chunk-SVXC36MU.cjs → chunk-VACWOIRE.cjs} +2 -0
- package/dist/chunk-WLYIIEAF.js +50 -0
- package/dist/chunk-XSVNC2UD.cjs +18 -0
- package/dist/{chunk-FFALUUZZ.cjs → chunk-ZCIQ3L3R.cjs} +18 -11
- package/dist/completion/CompletionService.cjs +26 -19
- package/dist/completion/CompletionService.js +25 -18
- package/dist/completion.cjs +28 -21
- package/dist/completion.js +27 -20
- package/dist/index.cjs +35 -25
- package/dist/index.d.cts +7 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.js +44 -34
- package/dist/keyPolicy-Cp0FntZl.d.cts +90 -0
- package/dist/keyPolicy-Cp0FntZl.d.ts +90 -0
- package/dist/outbound-api/auditCapture.cjs +9 -0
- package/dist/outbound-api/auditCapture.d.cts +54 -0
- package/dist/outbound-api/auditCapture.d.ts +54 -0
- package/dist/outbound-api/auditCapture.js +9 -0
- package/dist/outbound-api/auditRedact.cjs +8 -0
- package/dist/outbound-api/auditRedact.d.cts +30 -0
- package/dist/outbound-api/auditRedact.d.ts +30 -0
- package/dist/outbound-api/auditRedact.js +8 -0
- package/dist/outbound-api/billingCapture.cjs +8 -0
- package/dist/outbound-api/billingCapture.d.cts +61 -0
- package/dist/outbound-api/billingCapture.d.ts +61 -0
- package/dist/outbound-api/billingCapture.js +8 -0
- package/dist/outbound-api/quotaWarn.cjs +12 -0
- package/dist/outbound-api/quotaWarn.d.cts +43 -0
- package/dist/outbound-api/quotaWarn.d.ts +43 -0
- package/dist/outbound-api/quotaWarn.js +12 -0
- package/dist/outbound-api/routeResolver.cjs +2 -2
- package/dist/outbound-api/routeResolver.d.cts +3 -2
- package/dist/outbound-api/routeResolver.d.ts +3 -2
- package/dist/outbound-api/routeResolver.js +1 -1
- package/dist/outbound-api/types.d.cts +2 -1
- package/dist/outbound-api/types.d.ts +2 -1
- package/dist/outbound-api.cjs +33 -23
- package/dist/outbound-api.d.cts +9 -140
- package/dist/outbound-api.d.ts +9 -140
- package/dist/outbound-api.js +32 -22
- package/dist/pipeline/AuthSource.d.cts +6 -0
- package/dist/pipeline/AuthSource.d.ts +6 -0
- package/dist/pipeline/SubscriptionAuthSource.cjs +2 -2
- package/dist/pipeline/SubscriptionAuthSource.js +1 -1
- package/dist/pipeline/SubscriptionAuthStrategy.d.cts +6 -0
- package/dist/pipeline/SubscriptionAuthStrategy.d.ts +6 -0
- package/dist/pipeline/auditUsageStash.cjs +10 -0
- package/dist/pipeline/auditUsageStash.d.cts +37 -0
- package/dist/pipeline/auditUsageStash.d.ts +37 -0
- package/dist/pipeline/auditUsageStash.js +10 -0
- package/dist/pipeline/executeProviderCall.cjs +2 -2
- package/dist/pipeline/executeProviderCall.js +1 -1
- package/dist/pipeline/upstreamFetch.cjs +15 -0
- package/dist/pipeline/upstreamFetch.d.cts +89 -0
- package/dist/pipeline/upstreamFetch.d.ts +89 -0
- package/dist/pipeline/upstreamFetch.js +15 -0
- package/dist/pipeline/upstreamTrace.cjs +14 -0
- package/dist/pipeline/upstreamTrace.d.cts +85 -0
- package/dist/pipeline/upstreamTrace.d.ts +85 -0
- package/dist/pipeline/upstreamTrace.js +14 -0
- package/dist/pipeline/webhookEmit.cjs +10 -0
- package/dist/pipeline/webhookEmit.d.cts +36 -0
- package/dist/pipeline/webhookEmit.d.ts +36 -0
- package/dist/pipeline/webhookEmit.js +10 -0
- package/dist/ports.d.cts +2 -1
- package/dist/ports.d.ts +2 -1
- package/dist/provider-proxy/ProviderProxy.cjs +26 -19
- package/dist/provider-proxy/ProviderProxy.js +25 -18
- package/dist/provider-proxy/ingress/providerProxyShared.cjs +28 -19
- package/dist/provider-proxy/ingress/providerProxyShared.d.cts +17 -1
- package/dist/provider-proxy/ingress/providerProxyShared.d.ts +17 -1
- package/dist/provider-proxy/ingress/providerProxyShared.js +27 -18
- package/dist/provider-proxy/types.d.cts +7 -0
- package/dist/provider-proxy/types.d.ts +7 -0
- package/dist/provider-proxy.cjs +26 -19
- package/dist/provider-proxy.js +25 -18
- package/dist/{routeResolver-B1NglTfe.d.ts → routeResolver-C4T7yClx.d.ts} +1 -1
- package/dist/{routeResolver-CbG5uBgm.d.cts → routeResolver-CB3tvJKy.d.cts} +1 -1
- package/dist/transformer/transformers/AnthropicTransformer.cjs +2 -2
- package/dist/transformer/transformers/AnthropicTransformer.js +1 -1
- package/dist/transformer/transformers/GeminiCodeAssistTransformer.cjs +3 -3
- package/dist/transformer/transformers/GeminiCodeAssistTransformer.js +2 -2
- package/dist/transformer/transformers/GeminiTransformer.cjs +3 -3
- package/dist/transformer/transformers/GeminiTransformer.js +2 -2
- package/dist/transformer/transformers/OpenAIResponseTransformer.cjs +2 -2
- package/dist/transformer/transformers/OpenAIResponseTransformer.js +1 -1
- package/dist/transformer/transformers/OpenCodeGoTransformer.cjs +2 -2
- package/dist/transformer/transformers/OpenCodeGoTransformer.js +1 -1
- package/dist/transformer/transformers.cjs +8 -8
- package/dist/transformer/transformers.js +7 -7
- package/dist/transformer.cjs +8 -8
- package/dist/transformer.js +7 -7
- package/dist/{types-aBFFXoBz.d.cts → types-B8Arpxn0.d.cts} +14 -90
- package/dist/{types-6OUY_xfA.d.ts → types-lgPYQuZS.d.ts} +14 -90
- package/dist/usage/usage-recorder.cjs +3 -2
- package/dist/usage/usage-recorder.js +2 -1
- package/dist/usage.cjs +3 -2
- package/dist/usage.js +2 -1
- package/package.json +64 -64
- package/dist/chunk-S6JGLF3G.cjs +0 -89
- package/dist/{chunk-FTQ7IQUC.js → chunk-C6OV7GCC.js} +8 -8
|
@@ -8,7 +8,7 @@ import '../logger-4GvQNzhE.js';
|
|
|
8
8
|
import '../ports/provider-config-source.js';
|
|
9
9
|
import '../ProviderProxy-C-xqrkKi.js';
|
|
10
10
|
import '../provider-proxy/types.js';
|
|
11
|
-
export {
|
|
11
|
+
export { H as AccountHealthConfig, A as AccountProbeConfig, C as ChatDispatchMode, a as ConcurrencyQueueConfig, E as ENDPOINT_MODEL_KINDS, b as EndpointRoutingConfig, F as FingerprintConfig, e as KindMappedEndpoint, M as MessagesModelKind, f as ModelKind, g as ModelPrefixTargets, G as ModelRef, h as OutboundApiDeps, i as OutboundApiKeyCreated, j as OutboundApiKeyInfo, k as OutboundApiServerConfig, l as OutboundApiServerStatus, m as OutboundEndpoint, n as OutboundFormatUrls, o as OutboundKeyActivationMode, O as OutboundKeyDb, p as OutboundKeyDbRow, I as OutboundKeyModelRestrictionMode, q as OutboundKeyPolicy, r as OutboundProxyConfig, R as RequestRole, s as ResponsesModelKind, U as UserMessageQueueConfig } from '../types-lgPYQuZS.js';
|
|
12
12
|
import '@omnicross/contracts/llm-config';
|
|
13
13
|
import '../transformer/types.js';
|
|
14
14
|
import '../transformer/TransformerService.js';
|
|
@@ -22,3 +22,4 @@ import '../pipeline/SubscriptionAuthSource.js';
|
|
|
22
22
|
import '../pipeline/SubscriptionAuthStrategy.js';
|
|
23
23
|
import '../ports/web-search-backend.js';
|
|
24
24
|
import '@omnicross/contracts/websearch-types';
|
|
25
|
+
import '../keyPolicy-Cp0FntZl.js';
|
package/dist/outbound-api.cjs
CHANGED
|
@@ -55,39 +55,38 @@
|
|
|
55
55
|
|
|
56
56
|
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
var _chunk2FMI2B6Vcjs = require('./chunk-2FMI2B6V.cjs');
|
|
58
|
+
var _chunkCGKLE6IWcjs = require('./chunk-CGKLE6IW.cjs');
|
|
63
59
|
require('./chunk-HQP3K7PU.cjs');
|
|
64
60
|
require('./chunk-FZ46M34D.cjs');
|
|
65
61
|
require('./chunk-46ZIFWYG.cjs');
|
|
66
62
|
require('./chunk-3OPYJG76.cjs');
|
|
67
|
-
require('./chunk-
|
|
68
|
-
require('./chunk-
|
|
63
|
+
require('./chunk-ZCIQ3L3R.cjs');
|
|
64
|
+
require('./chunk-7FEBOPJO.cjs');
|
|
69
65
|
require('./chunk-DWKQZ2SK.cjs');
|
|
70
|
-
require('./chunk-
|
|
71
|
-
require('./chunk-
|
|
72
|
-
require('./chunk-
|
|
66
|
+
require('./chunk-4XMYPW46.cjs');
|
|
67
|
+
require('./chunk-K52THW2C.cjs');
|
|
68
|
+
require('./chunk-3Q6Z6JTO.cjs');
|
|
73
69
|
require('./chunk-EYZYXJTJ.cjs');
|
|
74
70
|
require('./chunk-YMFAJFQT.cjs');
|
|
75
|
-
require('./chunk-
|
|
71
|
+
require('./chunk-SNYBEXLB.cjs');
|
|
76
72
|
require('./chunk-GBHYAGX3.cjs');
|
|
77
73
|
require('./chunk-RPII3E6Z.cjs');
|
|
78
74
|
require('./chunk-6RPZADX3.cjs');
|
|
79
75
|
require('./chunk-QWBWGODS.cjs');
|
|
76
|
+
require('./chunk-UIBD2YY5.cjs');
|
|
77
|
+
require('./chunk-R3HK6R4B.cjs');
|
|
78
|
+
require('./chunk-HYN75H6G.cjs');
|
|
79
|
+
require('./chunk-Q27JY5RG.cjs');
|
|
80
|
+
require('./chunk-QXD4MV2X.cjs');
|
|
80
81
|
require('./chunk-NYUNU75A.cjs');
|
|
81
82
|
require('./chunk-VQY5W4YW.cjs');
|
|
82
|
-
require('./chunk-
|
|
83
|
+
require('./chunk-KFI44N2R.cjs');
|
|
83
84
|
require('./chunk-SVNDB62D.cjs');
|
|
84
|
-
|
|
85
|
-
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
var _chunkAPYG5QD7cjs = require('./chunk-APYG5QD7.cjs');
|
|
86
88
|
require('./chunk-L74VDN4A.cjs');
|
|
87
|
-
require('./chunk-
|
|
88
|
-
require('./chunk-Q27JY5RG.cjs');
|
|
89
|
-
require('./chunk-QXD4MV2X.cjs');
|
|
90
|
-
require('./chunk-A2YMUCBT.cjs');
|
|
89
|
+
require('./chunk-4YINUUKQ.cjs');
|
|
91
90
|
|
|
92
91
|
|
|
93
92
|
|
|
@@ -104,15 +103,26 @@ require('./chunk-A2YMUCBT.cjs');
|
|
|
104
103
|
|
|
105
104
|
|
|
106
105
|
|
|
107
|
-
var
|
|
106
|
+
var _chunkVACWOIREcjs = require('./chunk-VACWOIRE.cjs');
|
|
108
107
|
require('./chunk-QBZJ7P2T.cjs');
|
|
109
108
|
|
|
110
109
|
|
|
111
110
|
var _chunk4IH4EL7Mcjs = require('./chunk-4IH4EL7M.cjs');
|
|
111
|
+
require('./chunk-A2YMUCBT.cjs');
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
var _chunkUNWKG6EIcjs = require('./chunk-UNWKG6EI.cjs');
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
var _chunkFCR77GYMcjs = require('./chunk-FCR77GYM.cjs');
|
|
119
|
+
require('./chunk-AEOZIDEB.cjs');
|
|
120
|
+
require('./chunk-XSVNC2UD.cjs');
|
|
112
121
|
require('./chunk-SUEGJ75D.cjs');
|
|
113
|
-
require('./chunk-
|
|
114
|
-
require('./chunk-
|
|
115
|
-
require('./chunk-
|
|
122
|
+
require('./chunk-DDMRUL76.cjs');
|
|
123
|
+
require('./chunk-JWVTXXPX.cjs');
|
|
124
|
+
require('./chunk-PG7PS2NN.cjs');
|
|
125
|
+
require('./chunk-3Z5BQZFM.cjs');
|
|
116
126
|
require('./chunk-NZYN7C3P.cjs');
|
|
117
127
|
require('./chunk-JMJBSACD.cjs');
|
|
118
128
|
require('./chunk-GMMT7RVN.cjs');
|
|
@@ -194,4 +204,4 @@ require('./chunk-UNEFIWXI.cjs');
|
|
|
194
204
|
|
|
195
205
|
|
|
196
206
|
|
|
197
|
-
exports.AUDIT_REDACTED =
|
|
207
|
+
exports.AUDIT_REDACTED = _chunkFCR77GYMcjs.AUDIT_REDACTED; exports.ConcurrencyQueueFullError = _chunkCGKLE6IWcjs.ConcurrencyQueueFullError; exports.ConcurrencyWaitCancelledError = _chunkCGKLE6IWcjs.ConcurrencyWaitCancelledError; exports.ConcurrencyWaitTimeoutError = _chunkCGKLE6IWcjs.ConcurrencyWaitTimeoutError; exports.DEFAULT_ACCOUNT_PROBE = _chunkCGKLE6IWcjs.DEFAULT_ACCOUNT_PROBE; exports.DEFAULT_CONCURRENCY_QUEUE = _chunkCGKLE6IWcjs.DEFAULT_CONCURRENCY_QUEUE; exports.DEFAULT_FINGERPRINT = _chunkCGKLE6IWcjs.DEFAULT_FINGERPRINT; exports.DEFAULT_OUTBOUND_PORT = _chunkCGKLE6IWcjs.DEFAULT_OUTBOUND_PORT; exports.DEFAULT_USER_MESSAGE_QUEUE = _chunkCGKLE6IWcjs.DEFAULT_USER_MESSAGE_QUEUE; exports.ENDPOINT_MODEL_KINDS = _chunk4IH4EL7Mcjs.ENDPOINT_MODEL_KINDS; exports.KeySpendTracker = _chunkCGKLE6IWcjs.KeySpendTracker; exports.KeyedMutex = _chunkCGKLE6IWcjs.KeyedMutex; exports.OUTBOUND_API_SERVER_CONFIG_KEY = _chunkCGKLE6IWcjs.OUTBOUND_API_SERVER_CONFIG_KEY; exports.OutboundApiConfigError = _chunkCGKLE6IWcjs.OutboundApiConfigError; exports.OutboundApiServer = _chunkCGKLE6IWcjs.OutboundApiServer; exports.OutboundConcurrencyGate = _chunkCGKLE6IWcjs.OutboundConcurrencyGate; exports.OutboundRateLimiter = _chunkCGKLE6IWcjs.OutboundRateLimiter; exports.SUBSCRIPTION_PROVIDER_IDS = _chunkVACWOIREcjs.SUBSCRIPTION_PROVIDER_IDS; exports.SerialQueueTimeoutError = _chunkCGKLE6IWcjs.SerialQueueTimeoutError; exports.UserMessageSerialQueue = _chunkCGKLE6IWcjs.UserMessageSerialQueue; exports.__resetOutboundApiServerForTests = _chunkCGKLE6IWcjs.__resetOutboundApiServerForTests; exports.beginAuditCapture = _chunkUNWKG6EIcjs.beginAuditCapture; exports.beginBillingCapture = _chunkAPYG5QD7cjs.beginBillingCapture; exports.checkKeyQuota = _chunkCGKLE6IWcjs.checkKeyQuota; exports.classifyModelPrefix = _chunkVACWOIREcjs.classifyModelPrefix; exports.computeKeyExpiry = _chunkCGKLE6IWcjs.computeKeyExpiry; exports.computeVoucherGrant = _chunkCGKLE6IWcjs.computeVoucherGrant; exports.createNamedKey = _chunkCGKLE6IWcjs.createNamedKey; exports.defaultServerConfig = _chunkCGKLE6IWcjs.defaultServerConfig; exports.detectModelKind = _chunkVACWOIREcjs.detectModelKind; exports.detectRequestRole = _chunkVACWOIREcjs.detectRequestRole; exports.endpointSupportsSubscription = _chunkVACWOIREcjs.endpointSupportsSubscription; exports.endpointToIngressFormat = _chunkVACWOIREcjs.endpointToIngressFormat; exports.formatUrls = _chunkCGKLE6IWcjs.formatUrls; exports.generateVoucherCode = _chunkCGKLE6IWcjs.generateVoucherCode; exports.getOutboundApiServer = _chunkCGKLE6IWcjs.getOutboundApiServer; exports.handleVoucherRedeem = _chunkCGKLE6IWcjs.handleVoucherRedeem; exports.hashKey = _chunkCGKLE6IWcjs.hashKey; exports.hashVoucherCode = _chunkCGKLE6IWcjs.hashVoucherCode; exports.isConcurrencyRejection = _chunkCGKLE6IWcjs.isConcurrencyRejection; exports.isKindMappedEndpoint = _chunkVACWOIREcjs.isKindMappedEndpoint; exports.isRedeemRequest = _chunkCGKLE6IWcjs.isRedeemRequest; exports.isSerialQueueTimeout = _chunkCGKLE6IWcjs.isSerialQueueTimeout; exports.isSubscriptionProviderId = _chunkVACWOIREcjs.isSubscriptionProviderId; exports.isUserMessageRequest = _chunkCGKLE6IWcjs.isUserMessageRequest; exports.loadServerConfig = _chunkCGKLE6IWcjs.loadServerConfig; exports.mergeServerConfig = _chunkCGKLE6IWcjs.mergeServerConfig; exports.modelKindsForEndpoint = _chunkVACWOIREcjs.modelKindsForEndpoint; exports.newVoucherId = _chunkCGKLE6IWcjs.newVoucherId; exports.normalizeAccountProbe = _chunkCGKLE6IWcjs.normalizeAccountProbe; exports.normalizeAudit = _chunkCGKLE6IWcjs.normalizeAudit; exports.normalizeBilling = _chunkCGKLE6IWcjs.normalizeBilling; exports.normalizeFingerprint = _chunkCGKLE6IWcjs.normalizeFingerprint; exports.normalizePrefixTargets = _chunkCGKLE6IWcjs.normalizePrefixTargets; exports.normalizeProxyConfig = _chunkCGKLE6IWcjs.normalizeProxyConfig; exports.normalizeProxySegment = _chunkCGKLE6IWcjs.normalizeProxySegment; exports.normalizeQueueSegments = _chunkCGKLE6IWcjs.normalizeQueueSegments; exports.normalizeServerConfig = _chunkCGKLE6IWcjs.normalizeServerConfig; exports.normalizeVoucher = _chunkCGKLE6IWcjs.normalizeVoucher; exports.normalizeWebhookDestination = _chunkCGKLE6IWcjs.normalizeWebhookDestination; exports.normalizeWebhookSegment = _chunkCGKLE6IWcjs.normalizeWebhookSegment; exports.parseModelRef = _chunkVACWOIREcjs.parseModelRef; exports.pickModelRefFromList = _chunkVACWOIREcjs.pickModelRefFromList; exports.randomBase62 = _chunkCGKLE6IWcjs.randomBase62; exports.redactAuditText = _chunkFCR77GYMcjs.redactAuditText; exports.resolvePrefixTarget = _chunkVACWOIREcjs.resolvePrefixTarget; exports.resolveRoute = _chunkVACWOIREcjs.resolveRoute; exports.saveServerConfig = _chunkCGKLE6IWcjs.saveServerConfig; exports.startOfLocalDay = _chunkCGKLE6IWcjs.startOfLocalDay; exports.startOfLocalWeek = _chunkCGKLE6IWcjs.startOfLocalWeek; exports.toVoucherInfo = _chunkCGKLE6IWcjs.toVoucherInfo; exports.validateEndpointModelConfig = _chunkVACWOIREcjs.validateEndpointModelConfig; exports.validateServerModelConfig = _chunkVACWOIREcjs.validateServerModelConfig; exports.verifyKey = _chunkCGKLE6IWcjs.verifyKey; exports.verifyPresentedKey = _chunkCGKLE6IWcjs.verifyPresentedKey; exports.voucherCodePrefix = _chunkCGKLE6IWcjs.voucherCodePrefix;
|
package/dist/outbound-api.d.cts
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { VoucherConfig } from '@omnicross/contracts/voucher-types';
|
|
2
|
-
import {
|
|
3
|
-
export { C as ChatDispatchMode, E as ENDPOINT_MODEL_KINDS,
|
|
2
|
+
import { e as KindMappedEndpoint, f as ModelKind, m as OutboundEndpoint, b as EndpointRoutingConfig, k as OutboundApiServerConfig, U as UserMessageQueueConfig, a as ConcurrencyQueueConfig, h as OutboundApiDeps, l as OutboundApiServerStatus, n as OutboundFormatUrls, A as AccountProbeConfig, F as FingerprintConfig, g as ModelPrefixTargets, r as OutboundProxyConfig, G as ModelRef, O as OutboundKeyDb, i as OutboundApiKeyCreated, R as RequestRole } from './types-B8Arpxn0.cjs';
|
|
3
|
+
export { C as ChatDispatchMode, E as ENDPOINT_MODEL_KINDS, K as KeySpendReader, c as KeySpendSeeder, d as KeySpendTracker, M as MessagesModelKind, j as OutboundApiKeyInfo, o as OutboundKeyActivationMode, p as OutboundKeyDbRow, q as OutboundKeyPolicy, s as ResponsesModelKind, 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';
|
|
4
4
|
import { ProxyConfig } from '@omnicross/contracts/account-tokens-types';
|
|
5
5
|
import { AuditConfig } from '@omnicross/contracts/audit-types';
|
|
6
6
|
import { BillingConfig } from '@omnicross/contracts/billing-types';
|
|
7
7
|
import { WebhookDestination, WebhookConfig } from '@omnicross/contracts/webhook-types';
|
|
8
|
+
export { AUDIT_REDACTED, redactAuditText } from './outbound-api/auditRedact.cjs';
|
|
9
|
+
export { AuditCaptureContext, beginAuditCapture } from './outbound-api/auditCapture.cjs';
|
|
10
|
+
export { BillingCaptureContext, beginBillingCapture } from './outbound-api/billingCapture.cjs';
|
|
11
|
+
import { K as KeyCostLimits, M as ModelRestriction } from './keyPolicy-Cp0FntZl.cjs';
|
|
12
|
+
export { a as KeyExpiryInput, b as KeyExpiryResult, c as KeySpend, Q as QuotaDecision, d as checkKeyQuota, e as computeKeyExpiry } from './keyPolicy-Cp0FntZl.cjs';
|
|
8
13
|
import http from 'node:http';
|
|
9
14
|
import { IngressFormat } from './provider-proxy/types.cjs';
|
|
10
|
-
export { S as SUBSCRIPTION_PROVIDER_IDS, e as endpointSupportsSubscription, i as isSubscriptionProviderId, p as parseModelRef, a as pickModelRefFromList, r as resolveRoute } from './routeResolver-
|
|
15
|
+
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';
|
|
11
16
|
import '@omnicross/contracts/health-logging-types';
|
|
12
17
|
import './logger-4GvQNzhE.cjs';
|
|
13
18
|
import './ports/provider-config-source.cjs';
|
|
@@ -369,142 +374,6 @@ declare function saveServerConfig(store: ApiServerSettingsStore, config: Outboun
|
|
|
369
374
|
/** Apply a partial patch to a config, returning the merged whole. */
|
|
370
375
|
declare function mergeServerConfig(current: OutboundApiServerConfig, patch: Partial<OutboundApiServerConfig>): OutboundApiServerConfig;
|
|
371
376
|
|
|
372
|
-
/**
|
|
373
|
-
* auditRedact — the pure secret-redaction pass for captured audit bodies
|
|
374
|
-
* (request-audit-log, design D3/D7).
|
|
375
|
-
*
|
|
376
|
-
* Body capture is opt-in and inherently sensitive: a prompt or tool argument can
|
|
377
|
-
* embed a secret. {@link redactAuditText} is run over EVERY captured body (and
|
|
378
|
-
* any other free text stored in a record) BEFORE it is persisted — defense in
|
|
379
|
-
* depth on top of "request headers are NEVER captured" (so an Authorization /
|
|
380
|
-
* x-api-key HEADER value never enters a record in the first place).
|
|
381
|
-
*
|
|
382
|
-
* It masks the obvious, high-confidence secret shapes ONLY (frozen list) — never
|
|
383
|
-
* a broad heuristic that would gut a legitimate prompt:
|
|
384
|
-
* - `sk-…` API keys (covers `sk-ant-…`, `sk-omnicross-…`, `sk-proj-…`, OpenAI).
|
|
385
|
-
* - `Bearer <token>` authorization values.
|
|
386
|
-
* - `x-api-key` / `api-key` / `authorization` values written inline as text.
|
|
387
|
-
* - Google `AIza…` API keys.
|
|
388
|
-
*
|
|
389
|
-
* Pure + allocation-light + never throws.
|
|
390
|
-
*
|
|
391
|
-
* @module @omnicross/core/outbound-api/auditRedact
|
|
392
|
-
*/
|
|
393
|
-
/** The sentinel a masked secret is replaced with. */
|
|
394
|
-
declare const AUDIT_REDACTED = "***REDACTED***";
|
|
395
|
-
/**
|
|
396
|
-
* Mask obvious secrets in `text`. Pure; returns the input unchanged when it holds
|
|
397
|
-
* no recognized secret shape. Never throws (a bad input returns `''`).
|
|
398
|
-
*/
|
|
399
|
-
declare function redactAuditText(text: string): string;
|
|
400
|
-
|
|
401
|
-
/**
|
|
402
|
-
* auditCapture — the outbound server's post-response audit capture hook
|
|
403
|
-
* (request-audit-log, design D1/D3/D5).
|
|
404
|
-
*
|
|
405
|
-
* {@link beginAuditCapture} is called at the TOP of `handleOutboundRequest`. It
|
|
406
|
-
* reads the active capture config from the core slot; when audit is DISABLED it
|
|
407
|
-
* returns `null` immediately (one slot read — no assembly, no listener, zero
|
|
408
|
-
* regression). When enabled it:
|
|
409
|
-
* - registers a one-shot `res.on('close')` listener that, at response end,
|
|
410
|
-
* assembles the {@link AuditRecord} from the http `req` (IP via the socket, or
|
|
411
|
-
* a trusted `X-Forwarded-For` only when configured — LEAD OQ1 anti-spoof; UA;
|
|
412
|
-
* method; path with the query string DROPPED), the response `statusCode`, the
|
|
413
|
-
* elapsed ms, and the fields the handler fills in (keyId / model / provider /
|
|
414
|
-
* error / bodies) — then hands it to the fire-and-forget `recordAudit`;
|
|
415
|
-
* - when `captureBodies` is ALSO on, wraps `res.write`/`res.end` to accumulate a
|
|
416
|
-
* BOUNDED response body (metadata-only for a streaming `text/event-stream`
|
|
417
|
-
* response — a full stream is unbounded), and truncates+redacts both bodies.
|
|
418
|
-
*
|
|
419
|
-
* Request HEADERS are NEVER read into a record (Authorization / x-api-key live
|
|
420
|
-
* there). Every stored body passes through {@link redactAuditText}. The assembly
|
|
421
|
-
* is wrapped so a capture failure can never surface into the relay path.
|
|
422
|
-
*
|
|
423
|
-
* @module @omnicross/core/outbound-api/auditCapture
|
|
424
|
-
*/
|
|
425
|
-
|
|
426
|
-
/**
|
|
427
|
-
* The mutable context the request handler enriches as it progresses. `null` is
|
|
428
|
-
* returned by {@link beginAuditCapture} when audit is disabled — the handler
|
|
429
|
-
* guards every write with `if (audit)`.
|
|
430
|
-
*/
|
|
431
|
-
interface AuditCaptureContext {
|
|
432
|
-
/** Outbound key id (set after auth). NEVER the key material. */
|
|
433
|
-
keyId?: string | null;
|
|
434
|
-
/** Resolved upstream model (set after route resolution). */
|
|
435
|
-
model?: string;
|
|
436
|
-
/** Upstream provider id (set after route resolution). */
|
|
437
|
-
provider?: string;
|
|
438
|
-
/** Sanitized error message (set on a relay/dispatch failure). */
|
|
439
|
-
error?: string;
|
|
440
|
-
/** Stash the raw request body for capture (a no-op unless `captureBodies`). */
|
|
441
|
-
setRequestBody(raw: string): void;
|
|
442
|
-
}
|
|
443
|
-
/**
|
|
444
|
-
* Begin audit capture for one request. Returns a mutable context the handler
|
|
445
|
-
* enriches, or `null` when audit is disabled (zero-cost path). The record is
|
|
446
|
-
* emitted on response `close` via the fire-and-forget sink.
|
|
447
|
-
*/
|
|
448
|
-
declare function beginAuditCapture(req: http.IncomingMessage, res: http.ServerResponse, now: number): AuditCaptureContext | null;
|
|
449
|
-
|
|
450
|
-
/**
|
|
451
|
-
* billingCapture — the outbound server's post-response billing capture hook
|
|
452
|
-
* (billing-event-stream, design D1/D4).
|
|
453
|
-
*
|
|
454
|
-
* {@link beginBillingCapture} is called at the TOP of `handleOutboundRequest`. It
|
|
455
|
-
* reads the active billing config from the core slot; when billing is DISABLED it
|
|
456
|
-
* returns `null` immediately (one slot read — no assembly, no listener, zero
|
|
457
|
-
* regression). When enabled it registers a one-shot `res.close` listener that
|
|
458
|
-
* assembles a {@link BillingEvent} from the handler-filled context (keyId / model
|
|
459
|
-
* / provider / authMode), the response `statusCode`, and this request's METERED
|
|
460
|
-
* FACTS (token counts + the ALREADY-COMPUTED cost) — then hands it to the
|
|
461
|
-
* no-throw {@link publishBillingEvent}.
|
|
462
|
-
*
|
|
463
|
-
* COST REUSE (design D3 — no double pricing): the metered facts are read from the
|
|
464
|
-
* per-request usage stash the usage tap populates ({@link readAuditUsage} — the
|
|
465
|
-
* SAME stash `usage-events.jsonl` correlation uses, populated UNCONDITIONALLY by
|
|
466
|
-
* the taps, independent of whether request-audit is enabled). Token counts are
|
|
467
|
-
* stashed SYNCHRONOUSLY at `record()`; the cost lands on the recorder's deferred
|
|
468
|
-
* pricing tick (scheduled BEFORE the response closes). So the assembly is deferred
|
|
469
|
-
* one macrotask past `close` — by then the earlier-scheduled pricing tick has run
|
|
470
|
-
* and stashed the computed cost we REUSE (we never re-price).
|
|
471
|
-
*
|
|
472
|
-
* BILLABLE-ONLY: an event is emitted ONLY when the request produced usage (an
|
|
473
|
-
* upstream call was billed). Auth failures / rate-limit / model-restriction
|
|
474
|
-
* rejections return before dispatch, stash no usage, and emit NO billing event.
|
|
475
|
-
*
|
|
476
|
-
* @module @omnicross/core/outbound-api/billingCapture
|
|
477
|
-
*/
|
|
478
|
-
|
|
479
|
-
/**
|
|
480
|
-
* The mutable context the request handler enriches as it progresses. `null` is
|
|
481
|
-
* returned by {@link beginBillingCapture} when billing is disabled — the handler
|
|
482
|
-
* guards every write with `if (billing)`.
|
|
483
|
-
*/
|
|
484
|
-
interface BillingCaptureContext {
|
|
485
|
-
/** Outbound key id (set after auth). NEVER the key material. */
|
|
486
|
-
keyId?: string | null;
|
|
487
|
-
/** Resolved upstream model (set after route resolution). */
|
|
488
|
-
model?: string;
|
|
489
|
-
/** Upstream provider id (set after route resolution). */
|
|
490
|
-
provider?: string;
|
|
491
|
-
/** Re-auth mode the request billed under (set after route resolution). */
|
|
492
|
-
authMode?: 'byo' | 'subscription';
|
|
493
|
-
}
|
|
494
|
-
/**
|
|
495
|
-
* Deferral used to schedule the event assembly one macrotask past `close`, so the
|
|
496
|
-
* usage tap's earlier-scheduled pricing tick has stashed the cost we reuse.
|
|
497
|
-
* Injectable ONLY for deterministic tests; production uses a zero-delay timer.
|
|
498
|
-
*/
|
|
499
|
-
type BillingDefer = (fn: () => void) => void;
|
|
500
|
-
/**
|
|
501
|
-
* Begin billing capture for one request. Returns a mutable context the handler
|
|
502
|
-
* enriches, or `null` when billing is disabled (zero-cost path). The event is
|
|
503
|
-
* emitted on response `close` via the no-throw sink — but ONLY when the request
|
|
504
|
-
* produced usage (a billable request).
|
|
505
|
-
*/
|
|
506
|
-
declare function beginBillingCapture(_req: http.IncomingMessage, res: http.ServerResponse, now: number, defer?: BillingDefer): BillingCaptureContext | null;
|
|
507
|
-
|
|
508
377
|
/**
|
|
509
378
|
* modelPrefixDispatch — pure model-name PREFIX classification for the `chat`
|
|
510
379
|
* endpoint's opt-in `dispatchMode: 'prefix'` (openai-chat-bridge #11, design D2).
|
|
@@ -1006,4 +875,4 @@ declare function getOutboundApiServer(deps?: OutboundApiDeps, onPortChange?: (po
|
|
|
1006
875
|
/** Reset the singleton (tests / teardown only). */
|
|
1007
876
|
declare function __resetOutboundApiServerForTests(): void;
|
|
1008
877
|
|
|
1009
|
-
export {
|
|
878
|
+
export { AccountProbeConfig, type ApiServerSettingsStore, type ApplyConfigInput, ConcurrencyQueueConfig, ConcurrencyQueueFullError, ConcurrencyWaitCancelledError, ConcurrencyWaitTimeoutError, DEFAULT_ACCOUNT_PROBE, DEFAULT_CONCURRENCY_QUEUE, DEFAULT_FINGERPRINT, DEFAULT_OUTBOUND_PORT, DEFAULT_USER_MESSAGE_QUEUE, type EndpointModelConfigError, EndpointRoutingConfig, FingerprintConfig, type GateAcquireOptions, type GateAcquisition, type GateSlot, type GateStatusEntry, KeyCostLimits, type KeyVerification, KeyedMutex, KindMappedEndpoint, ModelKind, type ModelPrefixKind, ModelPrefixTargets, OUTBOUND_API_SERVER_CONFIG_KEY, OutboundApiConfigError, OutboundApiDeps, OutboundApiKeyCreated, OutboundApiServer, OutboundApiServerConfig, OutboundApiServerStatus, OutboundConcurrencyGate, OutboundEndpoint, OutboundFormatUrls, OutboundKeyDb, OutboundProxyConfig, OutboundRateLimiter, RequestRole, type SerialAcquireOptions, type SerialQueueStatusEntry, SerialQueueTimeoutError, type SerialSlot, UserMessageQueueConfig, UserMessageSerialQueue, type 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 };
|
package/dist/outbound-api.d.ts
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { VoucherConfig } from '@omnicross/contracts/voucher-types';
|
|
2
|
-
import {
|
|
3
|
-
export { C as ChatDispatchMode, E as ENDPOINT_MODEL_KINDS,
|
|
2
|
+
import { e as KindMappedEndpoint, f as ModelKind, m as OutboundEndpoint, b as EndpointRoutingConfig, k as OutboundApiServerConfig, U as UserMessageQueueConfig, a as ConcurrencyQueueConfig, h as OutboundApiDeps, l as OutboundApiServerStatus, n as OutboundFormatUrls, A as AccountProbeConfig, F as FingerprintConfig, g as ModelPrefixTargets, r as OutboundProxyConfig, G as ModelRef, O as OutboundKeyDb, i as OutboundApiKeyCreated, R as RequestRole } from './types-lgPYQuZS.js';
|
|
3
|
+
export { C as ChatDispatchMode, E as ENDPOINT_MODEL_KINDS, K as KeySpendReader, c as KeySpendSeeder, d as KeySpendTracker, M as MessagesModelKind, j as OutboundApiKeyInfo, o as OutboundKeyActivationMode, p as OutboundKeyDbRow, q as OutboundKeyPolicy, s as ResponsesModelKind, 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';
|
|
4
4
|
import { ProxyConfig } from '@omnicross/contracts/account-tokens-types';
|
|
5
5
|
import { AuditConfig } from '@omnicross/contracts/audit-types';
|
|
6
6
|
import { BillingConfig } from '@omnicross/contracts/billing-types';
|
|
7
7
|
import { WebhookDestination, WebhookConfig } from '@omnicross/contracts/webhook-types';
|
|
8
|
+
export { AUDIT_REDACTED, redactAuditText } from './outbound-api/auditRedact.js';
|
|
9
|
+
export { AuditCaptureContext, beginAuditCapture } from './outbound-api/auditCapture.js';
|
|
10
|
+
export { BillingCaptureContext, beginBillingCapture } from './outbound-api/billingCapture.js';
|
|
11
|
+
import { K as KeyCostLimits, M as ModelRestriction } from './keyPolicy-Cp0FntZl.js';
|
|
12
|
+
export { a as KeyExpiryInput, b as KeyExpiryResult, c as KeySpend, Q as QuotaDecision, d as checkKeyQuota, e as computeKeyExpiry } from './keyPolicy-Cp0FntZl.js';
|
|
8
13
|
import http from 'node:http';
|
|
9
14
|
import { IngressFormat } from './provider-proxy/types.js';
|
|
10
|
-
export { S as SUBSCRIPTION_PROVIDER_IDS, e as endpointSupportsSubscription, i as isSubscriptionProviderId, p as parseModelRef, a as pickModelRefFromList, r as resolveRoute } from './routeResolver-
|
|
15
|
+
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';
|
|
11
16
|
import '@omnicross/contracts/health-logging-types';
|
|
12
17
|
import './logger-4GvQNzhE.js';
|
|
13
18
|
import './ports/provider-config-source.js';
|
|
@@ -369,142 +374,6 @@ declare function saveServerConfig(store: ApiServerSettingsStore, config: Outboun
|
|
|
369
374
|
/** Apply a partial patch to a config, returning the merged whole. */
|
|
370
375
|
declare function mergeServerConfig(current: OutboundApiServerConfig, patch: Partial<OutboundApiServerConfig>): OutboundApiServerConfig;
|
|
371
376
|
|
|
372
|
-
/**
|
|
373
|
-
* auditRedact — the pure secret-redaction pass for captured audit bodies
|
|
374
|
-
* (request-audit-log, design D3/D7).
|
|
375
|
-
*
|
|
376
|
-
* Body capture is opt-in and inherently sensitive: a prompt or tool argument can
|
|
377
|
-
* embed a secret. {@link redactAuditText} is run over EVERY captured body (and
|
|
378
|
-
* any other free text stored in a record) BEFORE it is persisted — defense in
|
|
379
|
-
* depth on top of "request headers are NEVER captured" (so an Authorization /
|
|
380
|
-
* x-api-key HEADER value never enters a record in the first place).
|
|
381
|
-
*
|
|
382
|
-
* It masks the obvious, high-confidence secret shapes ONLY (frozen list) — never
|
|
383
|
-
* a broad heuristic that would gut a legitimate prompt:
|
|
384
|
-
* - `sk-…` API keys (covers `sk-ant-…`, `sk-omnicross-…`, `sk-proj-…`, OpenAI).
|
|
385
|
-
* - `Bearer <token>` authorization values.
|
|
386
|
-
* - `x-api-key` / `api-key` / `authorization` values written inline as text.
|
|
387
|
-
* - Google `AIza…` API keys.
|
|
388
|
-
*
|
|
389
|
-
* Pure + allocation-light + never throws.
|
|
390
|
-
*
|
|
391
|
-
* @module @omnicross/core/outbound-api/auditRedact
|
|
392
|
-
*/
|
|
393
|
-
/** The sentinel a masked secret is replaced with. */
|
|
394
|
-
declare const AUDIT_REDACTED = "***REDACTED***";
|
|
395
|
-
/**
|
|
396
|
-
* Mask obvious secrets in `text`. Pure; returns the input unchanged when it holds
|
|
397
|
-
* no recognized secret shape. Never throws (a bad input returns `''`).
|
|
398
|
-
*/
|
|
399
|
-
declare function redactAuditText(text: string): string;
|
|
400
|
-
|
|
401
|
-
/**
|
|
402
|
-
* auditCapture — the outbound server's post-response audit capture hook
|
|
403
|
-
* (request-audit-log, design D1/D3/D5).
|
|
404
|
-
*
|
|
405
|
-
* {@link beginAuditCapture} is called at the TOP of `handleOutboundRequest`. It
|
|
406
|
-
* reads the active capture config from the core slot; when audit is DISABLED it
|
|
407
|
-
* returns `null` immediately (one slot read — no assembly, no listener, zero
|
|
408
|
-
* regression). When enabled it:
|
|
409
|
-
* - registers a one-shot `res.on('close')` listener that, at response end,
|
|
410
|
-
* assembles the {@link AuditRecord} from the http `req` (IP via the socket, or
|
|
411
|
-
* a trusted `X-Forwarded-For` only when configured — LEAD OQ1 anti-spoof; UA;
|
|
412
|
-
* method; path with the query string DROPPED), the response `statusCode`, the
|
|
413
|
-
* elapsed ms, and the fields the handler fills in (keyId / model / provider /
|
|
414
|
-
* error / bodies) — then hands it to the fire-and-forget `recordAudit`;
|
|
415
|
-
* - when `captureBodies` is ALSO on, wraps `res.write`/`res.end` to accumulate a
|
|
416
|
-
* BOUNDED response body (metadata-only for a streaming `text/event-stream`
|
|
417
|
-
* response — a full stream is unbounded), and truncates+redacts both bodies.
|
|
418
|
-
*
|
|
419
|
-
* Request HEADERS are NEVER read into a record (Authorization / x-api-key live
|
|
420
|
-
* there). Every stored body passes through {@link redactAuditText}. The assembly
|
|
421
|
-
* is wrapped so a capture failure can never surface into the relay path.
|
|
422
|
-
*
|
|
423
|
-
* @module @omnicross/core/outbound-api/auditCapture
|
|
424
|
-
*/
|
|
425
|
-
|
|
426
|
-
/**
|
|
427
|
-
* The mutable context the request handler enriches as it progresses. `null` is
|
|
428
|
-
* returned by {@link beginAuditCapture} when audit is disabled — the handler
|
|
429
|
-
* guards every write with `if (audit)`.
|
|
430
|
-
*/
|
|
431
|
-
interface AuditCaptureContext {
|
|
432
|
-
/** Outbound key id (set after auth). NEVER the key material. */
|
|
433
|
-
keyId?: string | null;
|
|
434
|
-
/** Resolved upstream model (set after route resolution). */
|
|
435
|
-
model?: string;
|
|
436
|
-
/** Upstream provider id (set after route resolution). */
|
|
437
|
-
provider?: string;
|
|
438
|
-
/** Sanitized error message (set on a relay/dispatch failure). */
|
|
439
|
-
error?: string;
|
|
440
|
-
/** Stash the raw request body for capture (a no-op unless `captureBodies`). */
|
|
441
|
-
setRequestBody(raw: string): void;
|
|
442
|
-
}
|
|
443
|
-
/**
|
|
444
|
-
* Begin audit capture for one request. Returns a mutable context the handler
|
|
445
|
-
* enriches, or `null` when audit is disabled (zero-cost path). The record is
|
|
446
|
-
* emitted on response `close` via the fire-and-forget sink.
|
|
447
|
-
*/
|
|
448
|
-
declare function beginAuditCapture(req: http.IncomingMessage, res: http.ServerResponse, now: number): AuditCaptureContext | null;
|
|
449
|
-
|
|
450
|
-
/**
|
|
451
|
-
* billingCapture — the outbound server's post-response billing capture hook
|
|
452
|
-
* (billing-event-stream, design D1/D4).
|
|
453
|
-
*
|
|
454
|
-
* {@link beginBillingCapture} is called at the TOP of `handleOutboundRequest`. It
|
|
455
|
-
* reads the active billing config from the core slot; when billing is DISABLED it
|
|
456
|
-
* returns `null` immediately (one slot read — no assembly, no listener, zero
|
|
457
|
-
* regression). When enabled it registers a one-shot `res.close` listener that
|
|
458
|
-
* assembles a {@link BillingEvent} from the handler-filled context (keyId / model
|
|
459
|
-
* / provider / authMode), the response `statusCode`, and this request's METERED
|
|
460
|
-
* FACTS (token counts + the ALREADY-COMPUTED cost) — then hands it to the
|
|
461
|
-
* no-throw {@link publishBillingEvent}.
|
|
462
|
-
*
|
|
463
|
-
* COST REUSE (design D3 — no double pricing): the metered facts are read from the
|
|
464
|
-
* per-request usage stash the usage tap populates ({@link readAuditUsage} — the
|
|
465
|
-
* SAME stash `usage-events.jsonl` correlation uses, populated UNCONDITIONALLY by
|
|
466
|
-
* the taps, independent of whether request-audit is enabled). Token counts are
|
|
467
|
-
* stashed SYNCHRONOUSLY at `record()`; the cost lands on the recorder's deferred
|
|
468
|
-
* pricing tick (scheduled BEFORE the response closes). So the assembly is deferred
|
|
469
|
-
* one macrotask past `close` — by then the earlier-scheduled pricing tick has run
|
|
470
|
-
* and stashed the computed cost we REUSE (we never re-price).
|
|
471
|
-
*
|
|
472
|
-
* BILLABLE-ONLY: an event is emitted ONLY when the request produced usage (an
|
|
473
|
-
* upstream call was billed). Auth failures / rate-limit / model-restriction
|
|
474
|
-
* rejections return before dispatch, stash no usage, and emit NO billing event.
|
|
475
|
-
*
|
|
476
|
-
* @module @omnicross/core/outbound-api/billingCapture
|
|
477
|
-
*/
|
|
478
|
-
|
|
479
|
-
/**
|
|
480
|
-
* The mutable context the request handler enriches as it progresses. `null` is
|
|
481
|
-
* returned by {@link beginBillingCapture} when billing is disabled — the handler
|
|
482
|
-
* guards every write with `if (billing)`.
|
|
483
|
-
*/
|
|
484
|
-
interface BillingCaptureContext {
|
|
485
|
-
/** Outbound key id (set after auth). NEVER the key material. */
|
|
486
|
-
keyId?: string | null;
|
|
487
|
-
/** Resolved upstream model (set after route resolution). */
|
|
488
|
-
model?: string;
|
|
489
|
-
/** Upstream provider id (set after route resolution). */
|
|
490
|
-
provider?: string;
|
|
491
|
-
/** Re-auth mode the request billed under (set after route resolution). */
|
|
492
|
-
authMode?: 'byo' | 'subscription';
|
|
493
|
-
}
|
|
494
|
-
/**
|
|
495
|
-
* Deferral used to schedule the event assembly one macrotask past `close`, so the
|
|
496
|
-
* usage tap's earlier-scheduled pricing tick has stashed the cost we reuse.
|
|
497
|
-
* Injectable ONLY for deterministic tests; production uses a zero-delay timer.
|
|
498
|
-
*/
|
|
499
|
-
type BillingDefer = (fn: () => void) => void;
|
|
500
|
-
/**
|
|
501
|
-
* Begin billing capture for one request. Returns a mutable context the handler
|
|
502
|
-
* enriches, or `null` when billing is disabled (zero-cost path). The event is
|
|
503
|
-
* emitted on response `close` via the no-throw sink — but ONLY when the request
|
|
504
|
-
* produced usage (a billable request).
|
|
505
|
-
*/
|
|
506
|
-
declare function beginBillingCapture(_req: http.IncomingMessage, res: http.ServerResponse, now: number, defer?: BillingDefer): BillingCaptureContext | null;
|
|
507
|
-
|
|
508
377
|
/**
|
|
509
378
|
* modelPrefixDispatch — pure model-name PREFIX classification for the `chat`
|
|
510
379
|
* endpoint's opt-in `dispatchMode: 'prefix'` (openai-chat-bridge #11, design D2).
|
|
@@ -1006,4 +875,4 @@ declare function getOutboundApiServer(deps?: OutboundApiDeps, onPortChange?: (po
|
|
|
1006
875
|
/** Reset the singleton (tests / teardown only). */
|
|
1007
876
|
declare function __resetOutboundApiServerForTests(): void;
|
|
1008
877
|
|
|
1009
|
-
export {
|
|
878
|
+
export { AccountProbeConfig, type ApiServerSettingsStore, type ApplyConfigInput, ConcurrencyQueueConfig, ConcurrencyQueueFullError, ConcurrencyWaitCancelledError, ConcurrencyWaitTimeoutError, DEFAULT_ACCOUNT_PROBE, DEFAULT_CONCURRENCY_QUEUE, DEFAULT_FINGERPRINT, DEFAULT_OUTBOUND_PORT, DEFAULT_USER_MESSAGE_QUEUE, type EndpointModelConfigError, EndpointRoutingConfig, FingerprintConfig, type GateAcquireOptions, type GateAcquisition, type GateSlot, type GateStatusEntry, KeyCostLimits, type KeyVerification, KeyedMutex, KindMappedEndpoint, ModelKind, type ModelPrefixKind, ModelPrefixTargets, OUTBOUND_API_SERVER_CONFIG_KEY, OutboundApiConfigError, OutboundApiDeps, OutboundApiKeyCreated, OutboundApiServer, OutboundApiServerConfig, OutboundApiServerStatus, OutboundConcurrencyGate, OutboundEndpoint, OutboundFormatUrls, OutboundKeyDb, OutboundProxyConfig, OutboundRateLimiter, RequestRole, type SerialAcquireOptions, type SerialQueueStatusEntry, SerialQueueTimeoutError, type SerialSlot, UserMessageQueueConfig, UserMessageSerialQueue, type 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 };
|
package/dist/outbound-api.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {
|
|
2
|
-
AUDIT_REDACTED,
|
|
3
2
|
ConcurrencyQueueFullError,
|
|
4
3
|
ConcurrencyWaitCancelledError,
|
|
5
4
|
ConcurrencyWaitTimeoutError,
|
|
@@ -18,8 +17,6 @@ import {
|
|
|
18
17
|
SerialQueueTimeoutError,
|
|
19
18
|
UserMessageSerialQueue,
|
|
20
19
|
__resetOutboundApiServerForTests,
|
|
21
|
-
beginAuditCapture,
|
|
22
|
-
beginBillingCapture,
|
|
23
20
|
checkKeyQuota,
|
|
24
21
|
computeKeyExpiry,
|
|
25
22
|
computeVoucherGrant,
|
|
@@ -51,7 +48,6 @@ import {
|
|
|
51
48
|
normalizeWebhookDestination,
|
|
52
49
|
normalizeWebhookSegment,
|
|
53
50
|
randomBase62,
|
|
54
|
-
redactAuditText,
|
|
55
51
|
saveServerConfig,
|
|
56
52
|
startOfLocalDay,
|
|
57
53
|
startOfLocalWeek,
|
|
@@ -59,35 +55,38 @@ import {
|
|
|
59
55
|
verifyKey,
|
|
60
56
|
verifyPresentedKey,
|
|
61
57
|
voucherCodePrefix
|
|
62
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-FH2P4OCD.js";
|
|
63
59
|
import "./chunk-VVEHS2LI.js";
|
|
64
60
|
import "./chunk-46RLHI7D.js";
|
|
65
61
|
import "./chunk-G2UTNSGU.js";
|
|
66
62
|
import "./chunk-DK4A7DLE.js";
|
|
67
|
-
import "./chunk-
|
|
68
|
-
import "./chunk-
|
|
63
|
+
import "./chunk-OQWKZCXP.js";
|
|
64
|
+
import "./chunk-IB3FDI4O.js";
|
|
69
65
|
import "./chunk-ZJZAOKI7.js";
|
|
70
|
-
import "./chunk-
|
|
71
|
-
import "./chunk-
|
|
72
|
-
import "./chunk-
|
|
66
|
+
import "./chunk-C6OV7GCC.js";
|
|
67
|
+
import "./chunk-IWQAX3CS.js";
|
|
68
|
+
import "./chunk-BODMAL6G.js";
|
|
73
69
|
import "./chunk-7VU7V2E4.js";
|
|
74
70
|
import "./chunk-ZLX3KGXX.js";
|
|
75
|
-
import "./chunk-
|
|
71
|
+
import "./chunk-BPKCU575.js";
|
|
76
72
|
import "./chunk-MZNPGW5Q.js";
|
|
77
73
|
import "./chunk-XTEI64OU.js";
|
|
78
74
|
import "./chunk-XX6NQJMA.js";
|
|
79
75
|
import "./chunk-IAXWICZU.js";
|
|
76
|
+
import "./chunk-OE6TDIWW.js";
|
|
77
|
+
import "./chunk-DRWHTIIZ.js";
|
|
78
|
+
import "./chunk-IK3KE3AU.js";
|
|
79
|
+
import "./chunk-ZY6KU6P3.js";
|
|
80
|
+
import "./chunk-JWC6APFQ.js";
|
|
80
81
|
import "./chunk-5ERIZW3D.js";
|
|
81
82
|
import "./chunk-5ENKBSWO.js";
|
|
82
|
-
import "./chunk-
|
|
83
|
+
import "./chunk-HRRYG2AX.js";
|
|
83
84
|
import "./chunk-AVYJ4YBN.js";
|
|
84
|
-
import
|
|
85
|
-
|
|
85
|
+
import {
|
|
86
|
+
beginBillingCapture
|
|
87
|
+
} from "./chunk-WLYIIEAF.js";
|
|
86
88
|
import "./chunk-TKJMZBAH.js";
|
|
87
|
-
import "./chunk-
|
|
88
|
-
import "./chunk-ZY6KU6P3.js";
|
|
89
|
-
import "./chunk-JWC6APFQ.js";
|
|
90
|
-
import "./chunk-H5JUT3KV.js";
|
|
89
|
+
import "./chunk-3QFXFCHG.js";
|
|
91
90
|
import {
|
|
92
91
|
SUBSCRIPTION_PROVIDER_IDS,
|
|
93
92
|
classifyModelPrefix,
|
|
@@ -104,15 +103,26 @@ import {
|
|
|
104
103
|
resolveRoute,
|
|
105
104
|
validateEndpointModelConfig,
|
|
106
105
|
validateServerModelConfig
|
|
107
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-UHGVBFU3.js";
|
|
108
107
|
import "./chunk-AQ5TNQB7.js";
|
|
109
108
|
import {
|
|
110
109
|
ENDPOINT_MODEL_KINDS
|
|
111
110
|
} from "./chunk-XEKD23J5.js";
|
|
111
|
+
import "./chunk-H5JUT3KV.js";
|
|
112
|
+
import {
|
|
113
|
+
beginAuditCapture
|
|
114
|
+
} from "./chunk-IFXJ2BG7.js";
|
|
115
|
+
import {
|
|
116
|
+
AUDIT_REDACTED,
|
|
117
|
+
redactAuditText
|
|
118
|
+
} from "./chunk-K5NM7VAH.js";
|
|
119
|
+
import "./chunk-WNY4WMRF.js";
|
|
120
|
+
import "./chunk-OZFM4X3S.js";
|
|
112
121
|
import "./chunk-5ZQBEOMD.js";
|
|
113
|
-
import "./chunk-
|
|
114
|
-
import "./chunk-
|
|
115
|
-
import "./chunk-
|
|
122
|
+
import "./chunk-MFZ5437A.js";
|
|
123
|
+
import "./chunk-6QZGDLL4.js";
|
|
124
|
+
import "./chunk-D3TDKWRP.js";
|
|
125
|
+
import "./chunk-SYQF7OIR.js";
|
|
116
126
|
import "./chunk-CDHS2QDC.js";
|
|
117
127
|
import "./chunk-Y7FO65VT.js";
|
|
118
128
|
import "./chunk-FMOBD2OQ.js";
|
|
@@ -52,6 +52,12 @@ interface AuthApplyHints {
|
|
|
52
52
|
* (no cross-request race). BYO auth sources ignore it.
|
|
53
53
|
*/
|
|
54
54
|
reportSelection?: (accountId: string, isActive: boolean, remappedModel?: string) => void;
|
|
55
|
+
/**
|
|
56
|
+
* OPTIONAL preferred subscription account id (provider/subscription duality).
|
|
57
|
+
* When set and schedulable the account picker resolves it directly; absent or
|
|
58
|
+
* unschedulable ⇒ pool auto-schedule. BYO auth sources ignore it.
|
|
59
|
+
*/
|
|
60
|
+
preferredAccountId?: string;
|
|
55
61
|
}
|
|
56
62
|
/**
|
|
57
63
|
* Result of {@link AuthSource.onResult}.
|
|
@@ -52,6 +52,12 @@ interface AuthApplyHints {
|
|
|
52
52
|
* (no cross-request race). BYO auth sources ignore it.
|
|
53
53
|
*/
|
|
54
54
|
reportSelection?: (accountId: string, isActive: boolean, remappedModel?: string) => void;
|
|
55
|
+
/**
|
|
56
|
+
* OPTIONAL preferred subscription account id (provider/subscription duality).
|
|
57
|
+
* When set and schedulable the account picker resolves it directly; absent or
|
|
58
|
+
* unschedulable ⇒ pool auto-schedule. BYO auth sources ignore it.
|
|
59
|
+
*/
|
|
60
|
+
preferredAccountId?: string;
|
|
55
61
|
}
|
|
56
62
|
/**
|
|
57
63
|
* Result of {@link AuthSource.onResult}.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkKFI44N2Rcjs = require('../chunk-KFI44N2R.cjs');
|
|
5
5
|
require('../chunk-SVNDB62D.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
exports.SubscriptionAuthSource =
|
|
9
|
+
exports.SubscriptionAuthSource = _chunkKFI44N2Rcjs.SubscriptionAuthSource; exports.stripAuthHeaders = _chunkKFI44N2Rcjs.stripAuthHeaders;
|