@omnicross/core 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ApiConverter.cjs +2 -2
- package/dist/ApiConverter.js +1 -1
- package/dist/{CompletionService-DdWaAxq0.d.ts → CompletionService-C3BX0Ovy.d.ts} +4 -3
- package/dist/{CompletionService-D3a47vdU.d.cts → CompletionService-kNA17cfI.d.cts} +4 -3
- package/dist/auth/GeminiCodeAssistProjectResolver.cjs +7 -5
- package/dist/auth/GeminiCodeAssistProjectResolver.js +5 -3
- package/dist/{chunk-HRRYG2AX.js → chunk-23S5OPIO.js} +10 -1
- package/dist/chunk-25GXJCEZ.cjs +40 -0
- package/dist/chunk-2JYRIADS.js +40 -0
- package/dist/chunk-3Z5BQZFM.cjs +52 -0
- package/dist/{chunk-4VAVYUZS.cjs → chunk-4VLRHHFE.cjs} +82 -40
- package/dist/{chunk-VACWOIRE.cjs → chunk-4VZX5F4T.cjs} +39 -15
- package/dist/{chunk-FTQ7IQUC.js → chunk-6CL5HTPQ.js} +52 -10
- package/dist/chunk-6QQG7YG3.cjs +153 -0
- package/dist/{chunk-SU2GCLAC.cjs → chunk-6VUQPOV3.cjs} +359 -60
- package/dist/chunk-7AK7B36B.cjs +44 -0
- package/dist/{chunk-5ZQBEOMD.js → chunk-AT7B7SOZ.js} +25 -2
- package/dist/{chunk-IK3KE3AU.js → chunk-DE2SRBFZ.js} +1 -1
- package/dist/chunk-DLXZEZWO.cjs +285 -0
- package/dist/{chunk-UHGVBFU3.js → chunk-EBLFCNPY.js} +38 -14
- package/dist/chunk-EJLH6NFT.cjs +166 -0
- package/dist/chunk-HVBBDBS3.cjs +350 -0
- package/dist/{chunk-7Y47UCF2.js → chunk-IFXJ2BG7.js} +5 -38
- package/dist/{chunk-46ZIFWYG.cjs → chunk-IIRPUVPH.cjs} +7 -1
- package/dist/{chunk-YGXJGRFI.cjs → chunk-KBM2W6UY.cjs} +111 -24
- package/dist/{chunk-OCEUVQHW.cjs → chunk-KCVJWJST.cjs} +73 -3
- package/dist/chunk-LB6EBS6Y.js +69 -0
- package/dist/{chunk-C7PSERMH.js → chunk-LVUCAWMK.js} +1 -1
- package/dist/chunk-MKF46GNZ.js +350 -0
- package/dist/{chunk-HYN75H6G.cjs → chunk-MUHWHQVM.cjs} +1 -1
- package/dist/{chunk-Z7Y2NPHY.js → chunk-N5T4M4GU.js} +1 -1
- package/dist/{chunk-TIER4SUC.js → chunk-OEWZUX4G.js} +346 -47
- package/dist/chunk-OF3BECU2.cjs +69 -0
- package/dist/{chunk-RSJ3TWJQ.cjs → chunk-OKMJLEXX.cjs} +5 -5
- package/dist/chunk-OPRS4IQZ.js +153 -0
- package/dist/{chunk-XK5CIRMQ.js → chunk-SIZQQD6T.js} +72 -2
- package/dist/{chunk-DKPXN34V.cjs → chunk-SQYVORNP.cjs} +1334 -510
- package/dist/chunk-SYQF7OIR.js +52 -0
- package/dist/{chunk-S4WBV25P.js → chunk-TOVPMMHM.js} +111 -24
- package/dist/{chunk-QYTT6GE3.js → chunk-UDCC7EMR.js} +1093 -269
- package/dist/{chunk-E3UCVHLP.cjs → chunk-UNWKG6EI.cjs} +5 -38
- package/dist/{chunk-ZLX3KGXX.js → chunk-UX7VWA46.js} +135 -23
- package/dist/{chunk-7YN22L2H.cjs → chunk-V4TXMEJS.cjs} +5 -5
- package/dist/chunk-VRFBB5DB.js +44 -0
- package/dist/chunk-WB6PH56J.js +166 -0
- package/dist/{chunk-G2UTNSGU.js → chunk-WNKWAEUR.js} +7 -1
- package/dist/{chunk-SUEGJ75D.cjs → chunk-WYTEQ4Q5.cjs} +25 -2
- package/dist/{chunk-5ENKBSWO.js → chunk-YJVHCHQX.js} +42 -6
- package/dist/{chunk-VQY5W4YW.cjs → chunk-YK57NMIF.cjs} +44 -8
- package/dist/{chunk-KFI44N2R.cjs → chunk-YNJNTCSQ.cjs} +10 -1
- package/dist/completion/ApiKeyPoolService.cjs +12 -0
- package/dist/completion/ApiKeyPoolService.d.cts +6 -0
- package/dist/completion/ApiKeyPoolService.d.ts +6 -0
- package/dist/completion/ApiKeyPoolService.js +12 -0
- package/dist/completion/CompletionService.cjs +27 -24
- package/dist/completion/CompletionService.d.cts +2 -1
- package/dist/completion/CompletionService.d.ts +2 -1
- package/dist/completion/CompletionService.js +26 -23
- package/dist/completion.cjs +27 -24
- package/dist/completion.d.cts +2 -1
- package/dist/completion.d.ts +2 -1
- package/dist/completion.js +26 -23
- package/dist/index.cjs +53 -29
- package/dist/index.d.cts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +56 -32
- package/dist/{keyPolicy-Cp0FntZl.d.cts → keyPolicy-zdWTu3CQ.d.cts} +1 -1
- package/dist/{keyPolicy-Cp0FntZl.d.ts → keyPolicy-zdWTu3CQ.d.ts} +1 -1
- package/dist/outbound-api/auditCapture.cjs +2 -2
- package/dist/outbound-api/auditCapture.d.cts +5 -3
- package/dist/outbound-api/auditCapture.d.ts +5 -3
- package/dist/outbound-api/auditCapture.js +1 -1
- package/dist/outbound-api/quotaWarn.d.cts +1 -1
- package/dist/outbound-api/quotaWarn.d.ts +1 -1
- package/dist/outbound-api/routeResolver.cjs +2 -2
- package/dist/outbound-api/routeResolver.d.cts +4 -3
- package/dist/outbound-api/routeResolver.d.ts +4 -3
- package/dist/outbound-api/routeResolver.js +1 -1
- package/dist/outbound-api/subscriptionRegistryPort.d.cts +1 -0
- package/dist/outbound-api/subscriptionRegistryPort.d.ts +1 -0
- package/dist/outbound-api/types.d.cts +3 -2
- package/dist/outbound-api/types.d.ts +3 -2
- package/dist/outbound-api.cjs +49 -25
- package/dist/outbound-api.d.cts +127 -85
- package/dist/outbound-api.d.ts +127 -85
- package/dist/outbound-api.js +52 -28
- package/dist/pipeline/AccountAllowanceScheduling.cjs +15 -0
- package/dist/pipeline/AccountAllowanceScheduling.d.cts +90 -0
- package/dist/pipeline/AccountAllowanceScheduling.d.ts +90 -0
- package/dist/pipeline/AccountAllowanceScheduling.js +15 -0
- package/dist/pipeline/AccountAllowanceStore.cjs +20 -0
- package/dist/pipeline/AccountAllowanceStore.d.cts +77 -0
- package/dist/pipeline/AccountAllowanceStore.d.ts +77 -0
- package/dist/pipeline/AccountAllowanceStore.js +20 -0
- package/dist/pipeline/AuthSource.d.cts +11 -2
- package/dist/pipeline/AuthSource.d.ts +11 -2
- package/dist/pipeline/BoundAccountSelectionError.cjs +10 -0
- package/dist/pipeline/BoundAccountSelectionError.d.cts +28 -0
- package/dist/pipeline/BoundAccountSelectionError.d.ts +28 -0
- package/dist/pipeline/BoundAccountSelectionError.js +10 -0
- package/dist/pipeline/LlmConfigProviderAuth.d.cts +1 -0
- package/dist/pipeline/LlmConfigProviderAuth.d.ts +1 -0
- package/dist/pipeline/SubscriptionAccountHealth.cjs +4 -2
- package/dist/pipeline/SubscriptionAccountHealth.d.cts +34 -6
- package/dist/pipeline/SubscriptionAccountHealth.d.ts +34 -6
- package/dist/pipeline/SubscriptionAccountHealth.js +3 -1
- package/dist/pipeline/SubscriptionAuthSource.cjs +5 -2
- package/dist/pipeline/SubscriptionAuthSource.d.cts +1 -0
- package/dist/pipeline/SubscriptionAuthSource.d.ts +1 -0
- package/dist/pipeline/SubscriptionAuthSource.js +4 -1
- package/dist/pipeline/SubscriptionAuthStrategy.d.cts +8 -3
- package/dist/pipeline/SubscriptionAuthStrategy.d.ts +8 -3
- package/dist/pipeline/executeProviderCall.cjs +2 -2
- package/dist/pipeline/executeProviderCall.d.cts +8 -3
- package/dist/pipeline/executeProviderCall.d.ts +8 -3
- package/dist/pipeline/executeProviderCall.js +1 -1
- package/dist/pipeline/resolveProviderChain.d.cts +2 -3
- package/dist/pipeline/resolveProviderChain.d.ts +2 -3
- package/dist/pipeline/resolveSubscriptionChain.d.cts +1 -0
- package/dist/pipeline/resolveSubscriptionChain.d.ts +1 -0
- package/dist/pipeline/upstreamFetch.cjs +4 -2
- package/dist/pipeline/upstreamFetch.d.cts +6 -0
- package/dist/pipeline/upstreamFetch.d.ts +6 -0
- package/dist/pipeline/upstreamFetch.js +3 -1
- 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/ports/pricing-store.d.cts +4 -3
- package/dist/ports/pricing-store.d.ts +4 -3
- package/dist/ports.d.cts +4 -3
- package/dist/ports.d.ts +4 -3
- package/dist/provider-proxy/ProviderProxy.cjs +27 -24
- package/dist/provider-proxy/ProviderProxy.d.cts +1 -0
- package/dist/provider-proxy/ProviderProxy.d.ts +1 -0
- package/dist/provider-proxy/ProviderProxy.js +26 -23
- package/dist/provider-proxy/ingress/providerProxyShared.cjs +31 -24
- package/dist/provider-proxy/ingress/providerProxyShared.d.cts +50 -5
- package/dist/provider-proxy/ingress/providerProxyShared.d.ts +50 -5
- package/dist/provider-proxy/ingress/providerProxyShared.js +30 -23
- package/dist/provider-proxy/matchText.cjs +4 -2
- package/dist/provider-proxy/matchText.d.cts +41 -6
- package/dist/provider-proxy/matchText.d.ts +41 -6
- package/dist/provider-proxy/matchText.js +3 -1
- package/dist/provider-proxy/types.d.cts +30 -2
- package/dist/provider-proxy/types.d.ts +30 -2
- package/dist/provider-proxy.cjs +27 -24
- package/dist/provider-proxy.d.cts +1 -0
- package/dist/provider-proxy.d.ts +1 -0
- package/dist/provider-proxy.js +26 -23
- package/dist/{routeResolver-C4T7yClx.d.ts → routeResolver-CHTv_Bs5.d.ts} +1 -1
- package/dist/{routeResolver-CB3tvJKy.d.cts → routeResolver-kepxnfcC.d.cts} +1 -1
- package/dist/transformer/TransformerChainExecutor.cjs +2 -2
- package/dist/transformer/TransformerChainExecutor.js +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.d.cts +1 -1
- package/dist/transformer/transformers/OpenAIResponseTransformer.d.ts +1 -1
- package/dist/transformer/transformers/OpenAIResponseTransformer.js +1 -1
- package/dist/transformer/transformers/OpenAITransformer.cjs +6 -0
- package/dist/transformer/transformers/OpenAITransformer.d.cts +68 -0
- package/dist/transformer/transformers/OpenAITransformer.d.ts +68 -0
- package/dist/transformer/transformers/OpenAITransformer.js +6 -0
- package/dist/transformer/transformers.cjs +8 -14
- package/dist/transformer/transformers.d.cts +12 -48
- package/dist/transformer/transformers.d.ts +12 -48
- package/dist/transformer/transformers.js +11 -17
- package/dist/transformer/types.d.cts +17 -0
- package/dist/transformer/types.d.ts +17 -0
- package/dist/transformer.cjs +11 -12
- package/dist/transformer.d.cts +1 -2
- package/dist/transformer.d.ts +1 -2
- package/dist/transformer.js +11 -12
- package/dist/{types-B8Arpxn0.d.cts → types-H3wGZSOo.d.cts} +134 -7
- package/dist/{types-lgPYQuZS.d.ts → types-hsoKrVQS.d.ts} +134 -7
- package/dist/usage/pricing-engine.cjs +2 -2
- package/dist/usage/pricing-engine.d.cts +9 -1
- package/dist/usage/pricing-engine.d.ts +9 -1
- package/dist/usage/pricing-engine.js +1 -1
- package/dist/usage.cjs +2 -2
- package/dist/usage.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-C72S6TTV.cjs +0 -49
- package/dist/chunk-DWKQZ2SK.cjs +0 -254
- package/dist/chunk-IAXWICZU.js +0 -69
- package/dist/chunk-QWBWGODS.cjs +0 -69
- package/dist/chunk-RGTR7CIO.cjs +0 -235
- package/dist/chunk-VPBAUQ2M.js +0 -235
- package/dist/chunk-YMFAJFQT.cjs +0 -173
- package/dist/chunk-Z7LUNECE.js +0 -49
- package/dist/chunk-ZJZAOKI7.js +0 -254
- package/dist/transformer/transformers/OpenCodeGoTransformer.cjs +0 -6
- package/dist/transformer/transformers/OpenCodeGoTransformer.d.cts +0 -51
- package/dist/transformer/transformers/OpenCodeGoTransformer.d.ts +0 -51
- package/dist/transformer/transformers/OpenCodeGoTransformer.js +0 -6
- package/dist/transformer/transformers/ReasoningTransformer.cjs +0 -6
- package/dist/transformer/transformers/ReasoningTransformer.d.cts +0 -47
- package/dist/transformer/transformers/ReasoningTransformer.d.ts +0 -47
- package/dist/transformer/transformers/ReasoningTransformer.js +0 -6
package/dist/outbound-api.js
CHANGED
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
ConcurrencyWaitCancelledError,
|
|
4
4
|
ConcurrencyWaitTimeoutError,
|
|
5
5
|
DEFAULT_ACCOUNT_PROBE,
|
|
6
|
+
DEFAULT_ALLOWANCE_SCHEDULING,
|
|
6
7
|
DEFAULT_CONCURRENCY_QUEUE,
|
|
7
8
|
DEFAULT_FINGERPRINT,
|
|
8
9
|
DEFAULT_OUTBOUND_PORT,
|
|
@@ -10,19 +11,22 @@ import {
|
|
|
10
11
|
KeySpendTracker,
|
|
11
12
|
KeyedMutex,
|
|
12
13
|
OUTBOUND_API_SERVER_CONFIG_KEY,
|
|
13
|
-
OutboundApiConfigError,
|
|
14
14
|
OutboundApiServer,
|
|
15
15
|
OutboundConcurrencyGate,
|
|
16
16
|
OutboundRateLimiter,
|
|
17
17
|
SerialQueueTimeoutError,
|
|
18
18
|
UserMessageSerialQueue,
|
|
19
19
|
__resetOutboundApiServerForTests,
|
|
20
|
+
candidateBackgroundModelIds,
|
|
21
|
+
candidateGatewayBindings,
|
|
20
22
|
checkKeyQuota,
|
|
21
23
|
computeKeyExpiry,
|
|
22
24
|
computeVoucherGrant,
|
|
25
|
+
createIntegrationKey,
|
|
23
26
|
createNamedKey,
|
|
24
27
|
defaultServerConfig,
|
|
25
28
|
formatUrls,
|
|
29
|
+
gatewayBindingToEndpointConfig,
|
|
26
30
|
generateVoucherCode,
|
|
27
31
|
getOutboundApiServer,
|
|
28
32
|
handleVoucherRedeem,
|
|
@@ -32,13 +36,16 @@ import {
|
|
|
32
36
|
isRedeemRequest,
|
|
33
37
|
isSerialQueueTimeout,
|
|
34
38
|
isUserMessageRequest,
|
|
39
|
+
legacyEndpointsToBindings,
|
|
35
40
|
loadServerConfig,
|
|
36
41
|
mergeServerConfig,
|
|
37
42
|
newVoucherId,
|
|
38
43
|
normalizeAccountProbe,
|
|
44
|
+
normalizeAllowanceScheduling,
|
|
39
45
|
normalizeAudit,
|
|
40
46
|
normalizeBilling,
|
|
41
47
|
normalizeFingerprint,
|
|
48
|
+
normalizeGatewayBindings,
|
|
42
49
|
normalizePrefixTargets,
|
|
43
50
|
normalizeProxyConfig,
|
|
44
51
|
normalizeProxySegment,
|
|
@@ -48,6 +55,7 @@ import {
|
|
|
48
55
|
normalizeWebhookDestination,
|
|
49
56
|
normalizeWebhookSegment,
|
|
50
57
|
randomBase62,
|
|
58
|
+
resolveGatewayBinding,
|
|
51
59
|
saveServerConfig,
|
|
52
60
|
startOfLocalDay,
|
|
53
61
|
startOfLocalWeek,
|
|
@@ -55,33 +63,38 @@ import {
|
|
|
55
63
|
verifyKey,
|
|
56
64
|
verifyPresentedKey,
|
|
57
65
|
voucherCodePrefix
|
|
58
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-UDCC7EMR.js";
|
|
67
|
+
import "./chunk-WB6PH56J.js";
|
|
59
68
|
import "./chunk-VVEHS2LI.js";
|
|
60
69
|
import "./chunk-46RLHI7D.js";
|
|
70
|
+
import "./chunk-WNKWAEUR.js";
|
|
71
|
+
import "./chunk-MZNPGW5Q.js";
|
|
61
72
|
import "./chunk-DK4A7DLE.js";
|
|
62
|
-
import "./chunk-
|
|
63
|
-
import "./chunk-
|
|
64
|
-
import "./chunk-
|
|
65
|
-
import "./chunk-
|
|
66
|
-
import "./chunk-
|
|
67
|
-
import "./chunk-Z7LUNECE.js";
|
|
73
|
+
import "./chunk-VRFBB5DB.js";
|
|
74
|
+
import "./chunk-LVUCAWMK.js";
|
|
75
|
+
import "./chunk-OEWZUX4G.js";
|
|
76
|
+
import "./chunk-LB6EBS6Y.js";
|
|
77
|
+
import "./chunk-6CL5HTPQ.js";
|
|
68
78
|
import "./chunk-7VU7V2E4.js";
|
|
69
|
-
import "./chunk-
|
|
79
|
+
import "./chunk-UX7VWA46.js";
|
|
70
80
|
import "./chunk-BPKCU575.js";
|
|
71
|
-
import "./chunk-
|
|
72
|
-
import "./chunk-MZNPGW5Q.js";
|
|
81
|
+
import "./chunk-DRWHTIIZ.js";
|
|
73
82
|
import "./chunk-XTEI64OU.js";
|
|
74
83
|
import "./chunk-XX6NQJMA.js";
|
|
75
|
-
import "./chunk-
|
|
84
|
+
import "./chunk-5ERIZW3D.js";
|
|
85
|
+
import "./chunk-YJVHCHQX.js";
|
|
86
|
+
import "./chunk-23S5OPIO.js";
|
|
87
|
+
import "./chunk-AVYJ4YBN.js";
|
|
76
88
|
import "./chunk-OE6TDIWW.js";
|
|
77
|
-
import "./chunk-
|
|
78
|
-
import
|
|
89
|
+
import "./chunk-OPRS4IQZ.js";
|
|
90
|
+
import {
|
|
91
|
+
BoundAccountSelectionError,
|
|
92
|
+
boundAccountSelectionMessage,
|
|
93
|
+
isBoundAccountSelectionError
|
|
94
|
+
} from "./chunk-2JYRIADS.js";
|
|
95
|
+
import "./chunk-DE2SRBFZ.js";
|
|
79
96
|
import "./chunk-ZY6KU6P3.js";
|
|
80
97
|
import "./chunk-JWC6APFQ.js";
|
|
81
|
-
import "./chunk-5ERIZW3D.js";
|
|
82
|
-
import "./chunk-5ENKBSWO.js";
|
|
83
|
-
import "./chunk-HRRYG2AX.js";
|
|
84
|
-
import "./chunk-AVYJ4YBN.js";
|
|
85
98
|
import {
|
|
86
99
|
beginBillingCapture
|
|
87
100
|
} from "./chunk-WLYIIEAF.js";
|
|
@@ -101,9 +114,8 @@ import {
|
|
|
101
114
|
pickModelRefFromList,
|
|
102
115
|
resolvePrefixTarget,
|
|
103
116
|
resolveRoute,
|
|
104
|
-
validateEndpointModelConfig
|
|
105
|
-
|
|
106
|
-
} from "./chunk-UHGVBFU3.js";
|
|
117
|
+
validateEndpointModelConfig
|
|
118
|
+
} from "./chunk-EBLFCNPY.js";
|
|
107
119
|
import "./chunk-AQ5TNQB7.js";
|
|
108
120
|
import {
|
|
109
121
|
ENDPOINT_MODEL_KINDS
|
|
@@ -111,27 +123,31 @@ import {
|
|
|
111
123
|
import "./chunk-H5JUT3KV.js";
|
|
112
124
|
import {
|
|
113
125
|
beginAuditCapture
|
|
114
|
-
} from "./chunk-
|
|
126
|
+
} from "./chunk-IFXJ2BG7.js";
|
|
115
127
|
import {
|
|
116
128
|
AUDIT_REDACTED,
|
|
117
129
|
redactAuditText
|
|
118
130
|
} from "./chunk-K5NM7VAH.js";
|
|
119
131
|
import "./chunk-WNY4WMRF.js";
|
|
120
132
|
import "./chunk-OZFM4X3S.js";
|
|
121
|
-
import "./chunk-
|
|
122
|
-
import "./chunk-
|
|
123
|
-
import "./chunk-
|
|
124
|
-
import "./chunk-
|
|
133
|
+
import "./chunk-AT7B7SOZ.js";
|
|
134
|
+
import "./chunk-N5T4M4GU.js";
|
|
135
|
+
import "./chunk-TOVPMMHM.js";
|
|
136
|
+
import "./chunk-SIZQQD6T.js";
|
|
137
|
+
import "./chunk-SYQF7OIR.js";
|
|
138
|
+
import "./chunk-MKF46GNZ.js";
|
|
125
139
|
import "./chunk-CDHS2QDC.js";
|
|
126
140
|
import "./chunk-Y7FO65VT.js";
|
|
127
141
|
import "./chunk-FMOBD2OQ.js";
|
|
128
142
|
import "./chunk-HUZZZ3JL.js";
|
|
129
143
|
export {
|
|
130
144
|
AUDIT_REDACTED,
|
|
145
|
+
BoundAccountSelectionError,
|
|
131
146
|
ConcurrencyQueueFullError,
|
|
132
147
|
ConcurrencyWaitCancelledError,
|
|
133
148
|
ConcurrencyWaitTimeoutError,
|
|
134
149
|
DEFAULT_ACCOUNT_PROBE,
|
|
150
|
+
DEFAULT_ALLOWANCE_SCHEDULING,
|
|
135
151
|
DEFAULT_CONCURRENCY_QUEUE,
|
|
136
152
|
DEFAULT_FINGERPRINT,
|
|
137
153
|
DEFAULT_OUTBOUND_PORT,
|
|
@@ -140,7 +156,6 @@ export {
|
|
|
140
156
|
KeySpendTracker,
|
|
141
157
|
KeyedMutex,
|
|
142
158
|
OUTBOUND_API_SERVER_CONFIG_KEY,
|
|
143
|
-
OutboundApiConfigError,
|
|
144
159
|
OutboundApiServer,
|
|
145
160
|
OutboundConcurrencyGate,
|
|
146
161
|
OutboundRateLimiter,
|
|
@@ -150,10 +165,14 @@ export {
|
|
|
150
165
|
__resetOutboundApiServerForTests,
|
|
151
166
|
beginAuditCapture,
|
|
152
167
|
beginBillingCapture,
|
|
168
|
+
boundAccountSelectionMessage,
|
|
169
|
+
candidateBackgroundModelIds,
|
|
170
|
+
candidateGatewayBindings,
|
|
153
171
|
checkKeyQuota,
|
|
154
172
|
classifyModelPrefix,
|
|
155
173
|
computeKeyExpiry,
|
|
156
174
|
computeVoucherGrant,
|
|
175
|
+
createIntegrationKey,
|
|
157
176
|
createNamedKey,
|
|
158
177
|
defaultServerConfig,
|
|
159
178
|
detectModelKind,
|
|
@@ -161,25 +180,30 @@ export {
|
|
|
161
180
|
endpointSupportsSubscription,
|
|
162
181
|
endpointToIngressFormat,
|
|
163
182
|
formatUrls,
|
|
183
|
+
gatewayBindingToEndpointConfig,
|
|
164
184
|
generateVoucherCode,
|
|
165
185
|
getOutboundApiServer,
|
|
166
186
|
handleVoucherRedeem,
|
|
167
187
|
hashKey,
|
|
168
188
|
hashVoucherCode,
|
|
189
|
+
isBoundAccountSelectionError,
|
|
169
190
|
isConcurrencyRejection,
|
|
170
191
|
isKindMappedEndpoint,
|
|
171
192
|
isRedeemRequest,
|
|
172
193
|
isSerialQueueTimeout,
|
|
173
194
|
isSubscriptionProviderId,
|
|
174
195
|
isUserMessageRequest,
|
|
196
|
+
legacyEndpointsToBindings,
|
|
175
197
|
loadServerConfig,
|
|
176
198
|
mergeServerConfig,
|
|
177
199
|
modelKindsForEndpoint,
|
|
178
200
|
newVoucherId,
|
|
179
201
|
normalizeAccountProbe,
|
|
202
|
+
normalizeAllowanceScheduling,
|
|
180
203
|
normalizeAudit,
|
|
181
204
|
normalizeBilling,
|
|
182
205
|
normalizeFingerprint,
|
|
206
|
+
normalizeGatewayBindings,
|
|
183
207
|
normalizePrefixTargets,
|
|
184
208
|
normalizeProxyConfig,
|
|
185
209
|
normalizeProxySegment,
|
|
@@ -192,6 +216,7 @@ export {
|
|
|
192
216
|
pickModelRefFromList,
|
|
193
217
|
randomBase62,
|
|
194
218
|
redactAuditText,
|
|
219
|
+
resolveGatewayBinding,
|
|
195
220
|
resolvePrefixTarget,
|
|
196
221
|
resolveRoute,
|
|
197
222
|
saveServerConfig,
|
|
@@ -199,7 +224,6 @@ export {
|
|
|
199
224
|
startOfLocalWeek,
|
|
200
225
|
toVoucherInfo,
|
|
201
226
|
validateEndpointModelConfig,
|
|
202
|
-
validateServerModelConfig,
|
|
203
227
|
verifyKey,
|
|
204
228
|
verifyPresentedKey,
|
|
205
229
|
voucherCodePrefix
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunk6QQG7YG3cjs = require('../chunk-6QQG7YG3.cjs');
|
|
8
|
+
require('../chunk-HVBBDBS3.cjs');
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
exports.AccountAllowanceExhaustedError = _chunk6QQG7YG3cjs.AccountAllowanceExhaustedError; exports.AccountAllowanceScheduling = _chunk6QQG7YG3cjs.AccountAllowanceScheduling; exports.__resetSharedAccountAllowanceSchedulingForTests = _chunk6QQG7YG3cjs.__resetSharedAccountAllowanceSchedulingForTests; exports.getSharedAccountAllowanceScheduling = _chunk6QQG7YG3cjs.getSharedAccountAllowanceScheduling; exports.isAccountAllowanceExhaustedError = _chunk6QQG7YG3cjs.isAccountAllowanceExhaustedError;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { SubscriptionProviderId } from '@omnicross/contracts/subscription-types';
|
|
2
|
+
import { a as AllowanceSchedulingConfig } from '../types-H3wGZSOo.cjs';
|
|
3
|
+
import { AccountAllowanceStore } from './AccountAllowanceStore.cjs';
|
|
4
|
+
import '@omnicross/contracts/account-tokens-types';
|
|
5
|
+
import '@omnicross/contracts/audit-types';
|
|
6
|
+
import '@omnicross/contracts/billing-types';
|
|
7
|
+
import '@omnicross/contracts/health-logging-types';
|
|
8
|
+
import '@omnicross/contracts/voucher-types';
|
|
9
|
+
import '@omnicross/contracts/webhook-types';
|
|
10
|
+
import '../logger-4GvQNzhE.cjs';
|
|
11
|
+
import '../ports/provider-config-source.cjs';
|
|
12
|
+
import '@omnicross/contracts/llm-config';
|
|
13
|
+
import '../transformer/types.cjs';
|
|
14
|
+
import '../transformer/TransformerService.cjs';
|
|
15
|
+
import '../ProviderProxy-CnMQYN59.cjs';
|
|
16
|
+
import '../provider-proxy/types.cjs';
|
|
17
|
+
import 'node:http';
|
|
18
|
+
import '@omnicross/contracts/completion-types';
|
|
19
|
+
import '@omnicross/contracts/usage-types';
|
|
20
|
+
import '../completion/ApiKeyPoolService.cjs';
|
|
21
|
+
import './AuthSource.cjs';
|
|
22
|
+
import './BoundAccountSelectionError.cjs';
|
|
23
|
+
import './SubscriptionAuthSource.cjs';
|
|
24
|
+
import './SubscriptionAuthStrategy.cjs';
|
|
25
|
+
import '../ports/web-search-backend.cjs';
|
|
26
|
+
import '@omnicross/contracts/websearch-types';
|
|
27
|
+
import '../keyPolicy-zdWTu3CQ.cjs';
|
|
28
|
+
import '@omnicross/contracts/account-allowance-types';
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Default-off allowance-aware scheduling policy.
|
|
32
|
+
*
|
|
33
|
+
* This layer consumes only normalized, secret-free snapshots. Missing, stale,
|
|
34
|
+
* unsupported, or reset-expired data is deliberately ignored so telemetry can
|
|
35
|
+
* never strand an account by accident.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
type AllowanceSchedulingAction = 'normal' | 'demote' | 'pause' | 'ignore';
|
|
39
|
+
interface AllowanceSchedulingDecision {
|
|
40
|
+
providerId: SubscriptionProviderId;
|
|
41
|
+
accountId: string;
|
|
42
|
+
action: AllowanceSchedulingAction;
|
|
43
|
+
reason: 'policy-disabled' | 'provider-unsupported' | 'snapshot-missing' | 'snapshot-not-fresh' | 'below-threshold' | 'demote-threshold' | 'pause-threshold';
|
|
44
|
+
basePriority: number;
|
|
45
|
+
effectivePriority: number;
|
|
46
|
+
schedulable: boolean;
|
|
47
|
+
usedPercent?: number;
|
|
48
|
+
observedAt?: string;
|
|
49
|
+
resumeAt?: string;
|
|
50
|
+
decidedAt: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Safe, structured signal emitted only when an enabled allowance policy paused
|
|
54
|
+
* every otherwise eligible account. Request ingress maps it to HTTP 429 instead
|
|
55
|
+
* of disguising a local scheduling decision as an upstream 5xx.
|
|
56
|
+
*/
|
|
57
|
+
declare class AccountAllowanceExhaustedError extends Error {
|
|
58
|
+
readonly providerId: SubscriptionProviderId;
|
|
59
|
+
readonly resumeAt?: string | undefined;
|
|
60
|
+
readonly code = "account_allowance_exhausted";
|
|
61
|
+
readonly status = 429;
|
|
62
|
+
constructor(providerId: SubscriptionProviderId, resumeAt?: string | undefined);
|
|
63
|
+
}
|
|
64
|
+
/** Structural guard survives package/bundle boundaries and never inspects secrets. */
|
|
65
|
+
declare function isAccountAllowanceExhaustedError(error: unknown): error is AccountAllowanceExhaustedError;
|
|
66
|
+
declare class AccountAllowanceScheduling {
|
|
67
|
+
private readonly store;
|
|
68
|
+
private readonly now;
|
|
69
|
+
private config;
|
|
70
|
+
private readonly history;
|
|
71
|
+
private readonly lastRecorded;
|
|
72
|
+
constructor(store?: AccountAllowanceStore, now?: () => number);
|
|
73
|
+
configure(config: AllowanceSchedulingConfig | undefined): void;
|
|
74
|
+
getConfig(): AllowanceSchedulingConfig;
|
|
75
|
+
evaluate(providerId: SubscriptionProviderId, accountId: string, basePriority: number, now?: number): AllowanceSchedulingDecision;
|
|
76
|
+
/**
|
|
77
|
+
* Project the current policy result without recording an applied decision.
|
|
78
|
+
* Admin/read-model callers use this so polling an account list never creates
|
|
79
|
+
* synthetic demotion/pause history entries.
|
|
80
|
+
*/
|
|
81
|
+
preview(providerId: SubscriptionProviderId, accountId: string, basePriority: number, now?: number): AllowanceSchedulingDecision;
|
|
82
|
+
private decide;
|
|
83
|
+
getHistory(): AllowanceSchedulingDecision[];
|
|
84
|
+
clearHistory(): void;
|
|
85
|
+
private recordApplied;
|
|
86
|
+
}
|
|
87
|
+
declare function getSharedAccountAllowanceScheduling(): AccountAllowanceScheduling;
|
|
88
|
+
declare function __resetSharedAccountAllowanceSchedulingForTests(): void;
|
|
89
|
+
|
|
90
|
+
export { AccountAllowanceExhaustedError, AccountAllowanceScheduling, type AllowanceSchedulingAction, type AllowanceSchedulingDecision, __resetSharedAccountAllowanceSchedulingForTests, getSharedAccountAllowanceScheduling, isAccountAllowanceExhaustedError };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { SubscriptionProviderId } from '@omnicross/contracts/subscription-types';
|
|
2
|
+
import { a as AllowanceSchedulingConfig } from '../types-hsoKrVQS.js';
|
|
3
|
+
import { AccountAllowanceStore } from './AccountAllowanceStore.js';
|
|
4
|
+
import '@omnicross/contracts/account-tokens-types';
|
|
5
|
+
import '@omnicross/contracts/audit-types';
|
|
6
|
+
import '@omnicross/contracts/billing-types';
|
|
7
|
+
import '@omnicross/contracts/health-logging-types';
|
|
8
|
+
import '@omnicross/contracts/voucher-types';
|
|
9
|
+
import '@omnicross/contracts/webhook-types';
|
|
10
|
+
import '../logger-4GvQNzhE.js';
|
|
11
|
+
import '../ports/provider-config-source.js';
|
|
12
|
+
import '@omnicross/contracts/llm-config';
|
|
13
|
+
import '../transformer/types.js';
|
|
14
|
+
import '../transformer/TransformerService.js';
|
|
15
|
+
import '../ProviderProxy-C-xqrkKi.js';
|
|
16
|
+
import '../provider-proxy/types.js';
|
|
17
|
+
import 'node:http';
|
|
18
|
+
import '@omnicross/contracts/completion-types';
|
|
19
|
+
import '@omnicross/contracts/usage-types';
|
|
20
|
+
import '../completion/ApiKeyPoolService.js';
|
|
21
|
+
import './AuthSource.js';
|
|
22
|
+
import './BoundAccountSelectionError.js';
|
|
23
|
+
import './SubscriptionAuthSource.js';
|
|
24
|
+
import './SubscriptionAuthStrategy.js';
|
|
25
|
+
import '../ports/web-search-backend.js';
|
|
26
|
+
import '@omnicross/contracts/websearch-types';
|
|
27
|
+
import '../keyPolicy-zdWTu3CQ.js';
|
|
28
|
+
import '@omnicross/contracts/account-allowance-types';
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Default-off allowance-aware scheduling policy.
|
|
32
|
+
*
|
|
33
|
+
* This layer consumes only normalized, secret-free snapshots. Missing, stale,
|
|
34
|
+
* unsupported, or reset-expired data is deliberately ignored so telemetry can
|
|
35
|
+
* never strand an account by accident.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
type AllowanceSchedulingAction = 'normal' | 'demote' | 'pause' | 'ignore';
|
|
39
|
+
interface AllowanceSchedulingDecision {
|
|
40
|
+
providerId: SubscriptionProviderId;
|
|
41
|
+
accountId: string;
|
|
42
|
+
action: AllowanceSchedulingAction;
|
|
43
|
+
reason: 'policy-disabled' | 'provider-unsupported' | 'snapshot-missing' | 'snapshot-not-fresh' | 'below-threshold' | 'demote-threshold' | 'pause-threshold';
|
|
44
|
+
basePriority: number;
|
|
45
|
+
effectivePriority: number;
|
|
46
|
+
schedulable: boolean;
|
|
47
|
+
usedPercent?: number;
|
|
48
|
+
observedAt?: string;
|
|
49
|
+
resumeAt?: string;
|
|
50
|
+
decidedAt: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Safe, structured signal emitted only when an enabled allowance policy paused
|
|
54
|
+
* every otherwise eligible account. Request ingress maps it to HTTP 429 instead
|
|
55
|
+
* of disguising a local scheduling decision as an upstream 5xx.
|
|
56
|
+
*/
|
|
57
|
+
declare class AccountAllowanceExhaustedError extends Error {
|
|
58
|
+
readonly providerId: SubscriptionProviderId;
|
|
59
|
+
readonly resumeAt?: string | undefined;
|
|
60
|
+
readonly code = "account_allowance_exhausted";
|
|
61
|
+
readonly status = 429;
|
|
62
|
+
constructor(providerId: SubscriptionProviderId, resumeAt?: string | undefined);
|
|
63
|
+
}
|
|
64
|
+
/** Structural guard survives package/bundle boundaries and never inspects secrets. */
|
|
65
|
+
declare function isAccountAllowanceExhaustedError(error: unknown): error is AccountAllowanceExhaustedError;
|
|
66
|
+
declare class AccountAllowanceScheduling {
|
|
67
|
+
private readonly store;
|
|
68
|
+
private readonly now;
|
|
69
|
+
private config;
|
|
70
|
+
private readonly history;
|
|
71
|
+
private readonly lastRecorded;
|
|
72
|
+
constructor(store?: AccountAllowanceStore, now?: () => number);
|
|
73
|
+
configure(config: AllowanceSchedulingConfig | undefined): void;
|
|
74
|
+
getConfig(): AllowanceSchedulingConfig;
|
|
75
|
+
evaluate(providerId: SubscriptionProviderId, accountId: string, basePriority: number, now?: number): AllowanceSchedulingDecision;
|
|
76
|
+
/**
|
|
77
|
+
* Project the current policy result without recording an applied decision.
|
|
78
|
+
* Admin/read-model callers use this so polling an account list never creates
|
|
79
|
+
* synthetic demotion/pause history entries.
|
|
80
|
+
*/
|
|
81
|
+
preview(providerId: SubscriptionProviderId, accountId: string, basePriority: number, now?: number): AllowanceSchedulingDecision;
|
|
82
|
+
private decide;
|
|
83
|
+
getHistory(): AllowanceSchedulingDecision[];
|
|
84
|
+
clearHistory(): void;
|
|
85
|
+
private recordApplied;
|
|
86
|
+
}
|
|
87
|
+
declare function getSharedAccountAllowanceScheduling(): AccountAllowanceScheduling;
|
|
88
|
+
declare function __resetSharedAccountAllowanceSchedulingForTests(): void;
|
|
89
|
+
|
|
90
|
+
export { AccountAllowanceExhaustedError, AccountAllowanceScheduling, type AllowanceSchedulingAction, type AllowanceSchedulingDecision, __resetSharedAccountAllowanceSchedulingForTests, getSharedAccountAllowanceScheduling, isAccountAllowanceExhaustedError };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AccountAllowanceExhaustedError,
|
|
3
|
+
AccountAllowanceScheduling,
|
|
4
|
+
__resetSharedAccountAllowanceSchedulingForTests,
|
|
5
|
+
getSharedAccountAllowanceScheduling,
|
|
6
|
+
isAccountAllowanceExhaustedError
|
|
7
|
+
} from "../chunk-OPRS4IQZ.js";
|
|
8
|
+
import "../chunk-MKF46GNZ.js";
|
|
9
|
+
export {
|
|
10
|
+
AccountAllowanceExhaustedError,
|
|
11
|
+
AccountAllowanceScheduling,
|
|
12
|
+
__resetSharedAccountAllowanceSchedulingForTests,
|
|
13
|
+
getSharedAccountAllowanceScheduling,
|
|
14
|
+
isAccountAllowanceExhaustedError
|
|
15
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
var _chunkHVBBDBS3cjs = require('../chunk-HVBBDBS3.cjs');
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
exports.AccountAllowanceStore = _chunkHVBBDBS3cjs.AccountAllowanceStore; exports.DEFAULT_ALLOWANCE_MAX_SNAPSHOTS = _chunkHVBBDBS3cjs.DEFAULT_ALLOWANCE_MAX_SNAPSHOTS; exports.DEFAULT_CODEX_ALLOWANCE_FRESH_MS = _chunkHVBBDBS3cjs.DEFAULT_CODEX_ALLOWANCE_FRESH_MS; exports.__resetSharedAccountAllowanceStoreForTests = _chunkHVBBDBS3cjs.__resetSharedAccountAllowanceStoreForTests; exports.getSharedAccountAllowanceStore = _chunkHVBBDBS3cjs.getSharedAccountAllowanceStore; exports.normalizeAccountAllowanceSnapshot = _chunkHVBBDBS3cjs.normalizeAccountAllowanceSnapshot; exports.parseCodexAllowanceHeaders = _chunkHVBBDBS3cjs.parseCodexAllowanceHeaders; exports.setSharedAccountAllowanceStore = _chunkHVBBDBS3cjs.setSharedAccountAllowanceStore;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { AccountAllowanceSnapshot } from '@omnicross/contracts/account-allowance-types';
|
|
2
|
+
import { SubscriptionProviderId } from '@omnicross/contracts/subscription-types';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Secret-free upstream account allowance snapshots.
|
|
6
|
+
*
|
|
7
|
+
* Claude actively populates this store from the daemon. Codex is observed at the
|
|
8
|
+
* core egress seam so the response headers are attributed to the exact account id
|
|
9
|
+
* selected for that request. Only normalized numbers are retained; raw headers
|
|
10
|
+
* and credentials never enter the store. A host may inject a small persistence
|
|
11
|
+
* port; core deliberately does not know where that host stores the snapshot.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
declare const DEFAULT_CODEX_ALLOWANCE_FRESH_MS: number;
|
|
15
|
+
declare const DEFAULT_ALLOWANCE_MAX_SNAPSHOTS = 256;
|
|
16
|
+
type AllowanceHeadersLike = Headers | Record<string, string | string[] | number | null | undefined>;
|
|
17
|
+
interface CodexAllowanceWindowObservation {
|
|
18
|
+
usedPercent?: number;
|
|
19
|
+
resetAfterSeconds?: number;
|
|
20
|
+
windowMinutes?: number;
|
|
21
|
+
}
|
|
22
|
+
interface CodexAllowanceObservation {
|
|
23
|
+
primary?: CodexAllowanceWindowObservation;
|
|
24
|
+
secondary?: CodexAllowanceWindowObservation;
|
|
25
|
+
primaryOverSecondaryLimitPercent?: number;
|
|
26
|
+
}
|
|
27
|
+
/** Host-owned persistence seam for normalized allowance snapshots. */
|
|
28
|
+
interface AccountAllowancePersistence {
|
|
29
|
+
/** Return the decoded file payload, or any value for the store to validate. */
|
|
30
|
+
load(): unknown;
|
|
31
|
+
/** Replace the durable snapshot with this already-normalized bounded list. */
|
|
32
|
+
save(snapshots: readonly AccountAllowanceSnapshot[]): void;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Pick and normalize only the public DTO fields. This is used for both live
|
|
36
|
+
* writes and restart loads, so a structurally-cast object can never smuggle raw
|
|
37
|
+
* headers, response bodies, or token fields into the cache.
|
|
38
|
+
*/
|
|
39
|
+
declare function normalizeAccountAllowanceSnapshot(value: unknown): AccountAllowanceSnapshot | null;
|
|
40
|
+
/** Parse only the documented numeric Codex allowance headers. */
|
|
41
|
+
declare function parseCodexAllowanceHeaders(headers: AllowanceHeadersLike): CodexAllowanceObservation | null;
|
|
42
|
+
/** In-memory allowance projection shared by serving/admin with optional host persistence. */
|
|
43
|
+
declare class AccountAllowanceStore {
|
|
44
|
+
private readonly now;
|
|
45
|
+
private readonly codexFreshMs;
|
|
46
|
+
private readonly persistence?;
|
|
47
|
+
private readonly snapshots;
|
|
48
|
+
private readonly maxSnapshots;
|
|
49
|
+
constructor(now?: () => number, codexFreshMs?: number, persistence?: AccountAllowancePersistence | undefined, maxSnapshots?: number);
|
|
50
|
+
set(snapshot: AccountAllowanceSnapshot): void;
|
|
51
|
+
delete(providerId: SubscriptionProviderId, accountId: string): void;
|
|
52
|
+
/** Remove rows that no longer correspond to a configured account. */
|
|
53
|
+
pruneToKnownAccounts(accounts: Iterable<{
|
|
54
|
+
providerId: SubscriptionProviderId;
|
|
55
|
+
accountId: string;
|
|
56
|
+
}>): number;
|
|
57
|
+
get(providerId: SubscriptionProviderId, accountId: string, now?: number): AccountAllowanceSnapshot | null;
|
|
58
|
+
list(filter?: {
|
|
59
|
+
providerId?: SubscriptionProviderId;
|
|
60
|
+
accountId?: string;
|
|
61
|
+
}, now?: number): AccountAllowanceSnapshot[];
|
|
62
|
+
/**
|
|
63
|
+
* Merge one real Codex upstream response into the selected account's snapshot.
|
|
64
|
+
* A response with no recognized headers is a strict no-op, and a partial header
|
|
65
|
+
* set preserves previous values while marking untouched windows stale.
|
|
66
|
+
*/
|
|
67
|
+
recordCodexHeaders(accountId: string, headers: AllowanceHeadersLike, observedMs?: number): AccountAllowanceSnapshot | null;
|
|
68
|
+
clear(): void;
|
|
69
|
+
private loadPersisted;
|
|
70
|
+
private persist;
|
|
71
|
+
}
|
|
72
|
+
declare function getSharedAccountAllowanceStore(): AccountAllowanceStore;
|
|
73
|
+
declare function setSharedAccountAllowanceStore(store: AccountAllowanceStore): void;
|
|
74
|
+
/** Test/daemon teardown seam. */
|
|
75
|
+
declare function __resetSharedAccountAllowanceStoreForTests(): void;
|
|
76
|
+
|
|
77
|
+
export { type AccountAllowancePersistence, AccountAllowanceStore, type AllowanceHeadersLike, type CodexAllowanceObservation, type CodexAllowanceWindowObservation, DEFAULT_ALLOWANCE_MAX_SNAPSHOTS, DEFAULT_CODEX_ALLOWANCE_FRESH_MS, __resetSharedAccountAllowanceStoreForTests, getSharedAccountAllowanceStore, normalizeAccountAllowanceSnapshot, parseCodexAllowanceHeaders, setSharedAccountAllowanceStore };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { AccountAllowanceSnapshot } from '@omnicross/contracts/account-allowance-types';
|
|
2
|
+
import { SubscriptionProviderId } from '@omnicross/contracts/subscription-types';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Secret-free upstream account allowance snapshots.
|
|
6
|
+
*
|
|
7
|
+
* Claude actively populates this store from the daemon. Codex is observed at the
|
|
8
|
+
* core egress seam so the response headers are attributed to the exact account id
|
|
9
|
+
* selected for that request. Only normalized numbers are retained; raw headers
|
|
10
|
+
* and credentials never enter the store. A host may inject a small persistence
|
|
11
|
+
* port; core deliberately does not know where that host stores the snapshot.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
declare const DEFAULT_CODEX_ALLOWANCE_FRESH_MS: number;
|
|
15
|
+
declare const DEFAULT_ALLOWANCE_MAX_SNAPSHOTS = 256;
|
|
16
|
+
type AllowanceHeadersLike = Headers | Record<string, string | string[] | number | null | undefined>;
|
|
17
|
+
interface CodexAllowanceWindowObservation {
|
|
18
|
+
usedPercent?: number;
|
|
19
|
+
resetAfterSeconds?: number;
|
|
20
|
+
windowMinutes?: number;
|
|
21
|
+
}
|
|
22
|
+
interface CodexAllowanceObservation {
|
|
23
|
+
primary?: CodexAllowanceWindowObservation;
|
|
24
|
+
secondary?: CodexAllowanceWindowObservation;
|
|
25
|
+
primaryOverSecondaryLimitPercent?: number;
|
|
26
|
+
}
|
|
27
|
+
/** Host-owned persistence seam for normalized allowance snapshots. */
|
|
28
|
+
interface AccountAllowancePersistence {
|
|
29
|
+
/** Return the decoded file payload, or any value for the store to validate. */
|
|
30
|
+
load(): unknown;
|
|
31
|
+
/** Replace the durable snapshot with this already-normalized bounded list. */
|
|
32
|
+
save(snapshots: readonly AccountAllowanceSnapshot[]): void;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Pick and normalize only the public DTO fields. This is used for both live
|
|
36
|
+
* writes and restart loads, so a structurally-cast object can never smuggle raw
|
|
37
|
+
* headers, response bodies, or token fields into the cache.
|
|
38
|
+
*/
|
|
39
|
+
declare function normalizeAccountAllowanceSnapshot(value: unknown): AccountAllowanceSnapshot | null;
|
|
40
|
+
/** Parse only the documented numeric Codex allowance headers. */
|
|
41
|
+
declare function parseCodexAllowanceHeaders(headers: AllowanceHeadersLike): CodexAllowanceObservation | null;
|
|
42
|
+
/** In-memory allowance projection shared by serving/admin with optional host persistence. */
|
|
43
|
+
declare class AccountAllowanceStore {
|
|
44
|
+
private readonly now;
|
|
45
|
+
private readonly codexFreshMs;
|
|
46
|
+
private readonly persistence?;
|
|
47
|
+
private readonly snapshots;
|
|
48
|
+
private readonly maxSnapshots;
|
|
49
|
+
constructor(now?: () => number, codexFreshMs?: number, persistence?: AccountAllowancePersistence | undefined, maxSnapshots?: number);
|
|
50
|
+
set(snapshot: AccountAllowanceSnapshot): void;
|
|
51
|
+
delete(providerId: SubscriptionProviderId, accountId: string): void;
|
|
52
|
+
/** Remove rows that no longer correspond to a configured account. */
|
|
53
|
+
pruneToKnownAccounts(accounts: Iterable<{
|
|
54
|
+
providerId: SubscriptionProviderId;
|
|
55
|
+
accountId: string;
|
|
56
|
+
}>): number;
|
|
57
|
+
get(providerId: SubscriptionProviderId, accountId: string, now?: number): AccountAllowanceSnapshot | null;
|
|
58
|
+
list(filter?: {
|
|
59
|
+
providerId?: SubscriptionProviderId;
|
|
60
|
+
accountId?: string;
|
|
61
|
+
}, now?: number): AccountAllowanceSnapshot[];
|
|
62
|
+
/**
|
|
63
|
+
* Merge one real Codex upstream response into the selected account's snapshot.
|
|
64
|
+
* A response with no recognized headers is a strict no-op, and a partial header
|
|
65
|
+
* set preserves previous values while marking untouched windows stale.
|
|
66
|
+
*/
|
|
67
|
+
recordCodexHeaders(accountId: string, headers: AllowanceHeadersLike, observedMs?: number): AccountAllowanceSnapshot | null;
|
|
68
|
+
clear(): void;
|
|
69
|
+
private loadPersisted;
|
|
70
|
+
private persist;
|
|
71
|
+
}
|
|
72
|
+
declare function getSharedAccountAllowanceStore(): AccountAllowanceStore;
|
|
73
|
+
declare function setSharedAccountAllowanceStore(store: AccountAllowanceStore): void;
|
|
74
|
+
/** Test/daemon teardown seam. */
|
|
75
|
+
declare function __resetSharedAccountAllowanceStoreForTests(): void;
|
|
76
|
+
|
|
77
|
+
export { type AccountAllowancePersistence, AccountAllowanceStore, type AllowanceHeadersLike, type CodexAllowanceObservation, type CodexAllowanceWindowObservation, DEFAULT_ALLOWANCE_MAX_SNAPSHOTS, DEFAULT_CODEX_ALLOWANCE_FRESH_MS, __resetSharedAccountAllowanceStoreForTests, getSharedAccountAllowanceStore, normalizeAccountAllowanceSnapshot, parseCodexAllowanceHeaders, setSharedAccountAllowanceStore };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AccountAllowanceStore,
|
|
3
|
+
DEFAULT_ALLOWANCE_MAX_SNAPSHOTS,
|
|
4
|
+
DEFAULT_CODEX_ALLOWANCE_FRESH_MS,
|
|
5
|
+
__resetSharedAccountAllowanceStoreForTests,
|
|
6
|
+
getSharedAccountAllowanceStore,
|
|
7
|
+
normalizeAccountAllowanceSnapshot,
|
|
8
|
+
parseCodexAllowanceHeaders,
|
|
9
|
+
setSharedAccountAllowanceStore
|
|
10
|
+
} from "../chunk-MKF46GNZ.js";
|
|
11
|
+
export {
|
|
12
|
+
AccountAllowanceStore,
|
|
13
|
+
DEFAULT_ALLOWANCE_MAX_SNAPSHOTS,
|
|
14
|
+
DEFAULT_CODEX_ALLOWANCE_FRESH_MS,
|
|
15
|
+
__resetSharedAccountAllowanceStoreForTests,
|
|
16
|
+
getSharedAccountAllowanceStore,
|
|
17
|
+
normalizeAccountAllowanceSnapshot,
|
|
18
|
+
parseCodexAllowanceHeaders,
|
|
19
|
+
setSharedAccountAllowanceStore
|
|
20
|
+
};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { BoundAccountFallbackPolicy } from './BoundAccountSelectionError.cjs';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* AuthSource — unified outbound-authentication strategy for the provider
|
|
3
5
|
* request pipeline.
|
|
@@ -54,10 +56,17 @@ interface AuthApplyHints {
|
|
|
54
56
|
reportSelection?: (accountId: string, isActive: boolean, remappedModel?: string) => void;
|
|
55
57
|
/**
|
|
56
58
|
* OPTIONAL preferred subscription account id (provider/subscription duality).
|
|
57
|
-
* When set
|
|
58
|
-
*
|
|
59
|
+
* When set, strict is the default; only the explicit `'pool'` policy permits
|
|
60
|
+
* pool fallback. BYO auth sources ignore both binding hints.
|
|
59
61
|
*/
|
|
60
62
|
preferredAccountId?: string;
|
|
63
|
+
/** Optional account group selected by a resource-level gateway binding. */
|
|
64
|
+
preferredAccountGroup?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Binding behavior. `'pool'` is an explicit opt-in; any other value used
|
|
67
|
+
* with a preferred account is treated as strict by the selector.
|
|
68
|
+
*/
|
|
69
|
+
boundAccountFallbackPolicy?: BoundAccountFallbackPolicy;
|
|
61
70
|
}
|
|
62
71
|
/**
|
|
63
72
|
* Result of {@link AuthSource.onResult}.
|