@omnicross/core 0.1.5 → 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 +6 -5
- package/dist/auth/GeminiCodeAssistProjectResolver.js +4 -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-4XMYPW46.cjs → chunk-4VLRHHFE.cjs} +75 -33
- package/dist/{chunk-VACWOIRE.cjs → chunk-4VZX5F4T.cjs} +39 -15
- package/dist/{chunk-C6OV7GCC.js → chunk-6CL5HTPQ.js} +44 -2
- package/dist/chunk-6QQG7YG3.cjs +153 -0
- package/dist/{chunk-3Q6Z6JTO.cjs → chunk-6VUQPOV3.cjs} +277 -86
- 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-46ZIFWYG.cjs → chunk-IIRPUVPH.cjs} +7 -1
- package/dist/{chunk-JWVTXXPX.cjs → chunk-KBM2W6UY.cjs} +8 -4
- package/dist/{chunk-PG7PS2NN.cjs → chunk-KCVJWJST.cjs} +14 -2
- package/dist/chunk-LB6EBS6Y.js +69 -0
- package/dist/{chunk-IWQAX3CS.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-MFZ5437A.js → chunk-N5T4M4GU.js} +1 -1
- package/dist/{chunk-BODMAL6G.js → chunk-OEWZUX4G.js} +262 -71
- package/dist/chunk-OF3BECU2.cjs +69 -0
- package/dist/{chunk-DDMRUL76.cjs → chunk-OKMJLEXX.cjs} +5 -5
- package/dist/chunk-OPRS4IQZ.js +153 -0
- package/dist/{chunk-D3TDKWRP.js → chunk-SIZQQD6T.js} +14 -2
- package/dist/{chunk-CGKLE6IW.cjs → chunk-SQYVORNP.cjs} +1219 -510
- package/dist/{chunk-6QZGDLL4.js → chunk-TOVPMMHM.js} +5 -1
- package/dist/{chunk-FH2P4OCD.js → chunk-UDCC7EMR.js} +976 -267
- package/dist/{chunk-ZLX3KGXX.js → chunk-UX7VWA46.js} +135 -23
- package/dist/{chunk-K52THW2C.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 +25 -23
- package/dist/completion/CompletionService.d.cts +2 -1
- package/dist/completion/CompletionService.d.ts +2 -1
- package/dist/completion/CompletionService.js +24 -22
- package/dist/completion.cjs +25 -23
- package/dist/completion.d.cts +2 -1
- package/dist/completion.d.ts +2 -1
- package/dist/completion.js +24 -22
- package/dist/index.cjs +49 -26
- package/dist/index.d.cts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +52 -29
- package/dist/{keyPolicy-Cp0FntZl.d.ts → keyPolicy-zdWTu3CQ.d.cts} +1 -1
- package/dist/{keyPolicy-Cp0FntZl.d.cts → keyPolicy-zdWTu3CQ.d.ts} +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 +47 -24
- package/dist/outbound-api.d.cts +127 -85
- package/dist/outbound-api.d.ts +127 -85
- package/dist/outbound-api.js +50 -27
- 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 +3 -2
- package/dist/pipeline/upstreamFetch.js +2 -1
- 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 +25 -23
- package/dist/provider-proxy/ProviderProxy.d.cts +1 -0
- package/dist/provider-proxy/ProviderProxy.d.ts +1 -0
- package/dist/provider-proxy/ProviderProxy.js +24 -22
- package/dist/provider-proxy/ingress/providerProxyShared.cjs +27 -23
- package/dist/provider-proxy/ingress/providerProxyShared.d.cts +34 -5
- package/dist/provider-proxy/ingress/providerProxyShared.d.ts +34 -5
- package/dist/provider-proxy/ingress/providerProxyShared.js +26 -22
- 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 +25 -23
- package/dist/provider-proxy.d.cts +1 -0
- package/dist/provider-proxy.d.ts +1 -0
- package/dist/provider-proxy.js +24 -22
- 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 +12 -18
- package/dist/transformer/types.d.cts +17 -0
- package/dist/transformer/types.d.ts +17 -0
- package/dist/transformer.cjs +10 -11
- package/dist/transformer.d.cts +1 -2
- package/dist/transformer.d.ts +1 -2
- package/dist/transformer.js +9 -10
- 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-7FEBOPJO.cjs +0 -50
- package/dist/chunk-DWKQZ2SK.cjs +0 -254
- package/dist/chunk-IAXWICZU.js +0 -69
- package/dist/chunk-IB3FDI4O.js +0 -50
- package/dist/chunk-OQWKZCXP.js +0 -242
- package/dist/chunk-QWBWGODS.cjs +0 -69
- package/dist/chunk-YMFAJFQT.cjs +0 -173
- package/dist/chunk-ZCIQ3L3R.cjs +0 -242
- 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
|
@@ -1,37 +1,38 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ProviderProxy,
|
|
3
3
|
isLoopbackAddress
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-UDCC7EMR.js";
|
|
5
|
+
import "../chunk-WB6PH56J.js";
|
|
5
6
|
import "../chunk-VVEHS2LI.js";
|
|
6
7
|
import "../chunk-46RLHI7D.js";
|
|
7
|
-
import "../chunk-
|
|
8
|
+
import "../chunk-WNKWAEUR.js";
|
|
9
|
+
import "../chunk-MZNPGW5Q.js";
|
|
8
10
|
import "../chunk-DK4A7DLE.js";
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
11
|
-
import "../chunk-
|
|
12
|
-
import "../chunk-
|
|
13
|
-
import "../chunk-
|
|
14
|
-
import "../chunk-BODMAL6G.js";
|
|
11
|
+
import "../chunk-VRFBB5DB.js";
|
|
12
|
+
import "../chunk-LVUCAWMK.js";
|
|
13
|
+
import "../chunk-OEWZUX4G.js";
|
|
14
|
+
import "../chunk-LB6EBS6Y.js";
|
|
15
|
+
import "../chunk-6CL5HTPQ.js";
|
|
15
16
|
import "../chunk-7VU7V2E4.js";
|
|
16
|
-
import "../chunk-
|
|
17
|
+
import "../chunk-UX7VWA46.js";
|
|
17
18
|
import "../chunk-BPKCU575.js";
|
|
18
|
-
import "../chunk-
|
|
19
|
+
import "../chunk-DRWHTIIZ.js";
|
|
19
20
|
import "../chunk-XTEI64OU.js";
|
|
20
21
|
import "../chunk-XX6NQJMA.js";
|
|
21
|
-
import "../chunk-
|
|
22
|
+
import "../chunk-5ERIZW3D.js";
|
|
23
|
+
import "../chunk-YJVHCHQX.js";
|
|
24
|
+
import "../chunk-23S5OPIO.js";
|
|
25
|
+
import "../chunk-AVYJ4YBN.js";
|
|
22
26
|
import "../chunk-OE6TDIWW.js";
|
|
23
|
-
import "../chunk-
|
|
24
|
-
import "../chunk-
|
|
27
|
+
import "../chunk-OPRS4IQZ.js";
|
|
28
|
+
import "../chunk-2JYRIADS.js";
|
|
29
|
+
import "../chunk-DE2SRBFZ.js";
|
|
25
30
|
import "../chunk-ZY6KU6P3.js";
|
|
26
31
|
import "../chunk-JWC6APFQ.js";
|
|
27
|
-
import "../chunk-5ERIZW3D.js";
|
|
28
|
-
import "../chunk-5ENKBSWO.js";
|
|
29
|
-
import "../chunk-HRRYG2AX.js";
|
|
30
|
-
import "../chunk-AVYJ4YBN.js";
|
|
31
32
|
import "../chunk-WLYIIEAF.js";
|
|
32
33
|
import "../chunk-TKJMZBAH.js";
|
|
33
34
|
import "../chunk-3QFXFCHG.js";
|
|
34
|
-
import "../chunk-
|
|
35
|
+
import "../chunk-EBLFCNPY.js";
|
|
35
36
|
import "../chunk-AQ5TNQB7.js";
|
|
36
37
|
import "../chunk-XEKD23J5.js";
|
|
37
38
|
import "../chunk-H5JUT3KV.js";
|
|
@@ -39,11 +40,12 @@ import "../chunk-IFXJ2BG7.js";
|
|
|
39
40
|
import "../chunk-K5NM7VAH.js";
|
|
40
41
|
import "../chunk-WNY4WMRF.js";
|
|
41
42
|
import "../chunk-OZFM4X3S.js";
|
|
42
|
-
import "../chunk-
|
|
43
|
-
import "../chunk-
|
|
44
|
-
import "../chunk-
|
|
45
|
-
import "../chunk-
|
|
43
|
+
import "../chunk-AT7B7SOZ.js";
|
|
44
|
+
import "../chunk-N5T4M4GU.js";
|
|
45
|
+
import "../chunk-TOVPMMHM.js";
|
|
46
|
+
import "../chunk-SIZQQD6T.js";
|
|
46
47
|
import "../chunk-SYQF7OIR.js";
|
|
48
|
+
import "../chunk-MKF46GNZ.js";
|
|
47
49
|
import "../chunk-CDHS2QDC.js";
|
|
48
50
|
import "../chunk-Y7FO65VT.js";
|
|
49
51
|
import "../chunk-FMOBD2OQ.js";
|
|
@@ -8,37 +8,39 @@
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
var _chunkSQYVORNPcjs = require('../../chunk-SQYVORNP.cjs');
|
|
13
|
+
require('../../chunk-EJLH6NFT.cjs');
|
|
12
14
|
require('../../chunk-HQP3K7PU.cjs');
|
|
13
15
|
require('../../chunk-FZ46M34D.cjs');
|
|
14
|
-
require('../../chunk-
|
|
16
|
+
require('../../chunk-IIRPUVPH.cjs');
|
|
17
|
+
require('../../chunk-GBHYAGX3.cjs');
|
|
15
18
|
require('../../chunk-3OPYJG76.cjs');
|
|
16
|
-
require('../../chunk-
|
|
17
|
-
require('../../chunk-
|
|
18
|
-
require('../../chunk-
|
|
19
|
-
require('../../chunk-
|
|
20
|
-
require('../../chunk-
|
|
21
|
-
require('../../chunk-3Q6Z6JTO.cjs');
|
|
19
|
+
require('../../chunk-7AK7B36B.cjs');
|
|
20
|
+
require('../../chunk-V4TXMEJS.cjs');
|
|
21
|
+
require('../../chunk-6VUQPOV3.cjs');
|
|
22
|
+
require('../../chunk-OF3BECU2.cjs');
|
|
23
|
+
require('../../chunk-4VLRHHFE.cjs');
|
|
22
24
|
require('../../chunk-EYZYXJTJ.cjs');
|
|
23
|
-
require('../../chunk-
|
|
25
|
+
require('../../chunk-DLXZEZWO.cjs');
|
|
24
26
|
require('../../chunk-SNYBEXLB.cjs');
|
|
25
|
-
require('../../chunk-
|
|
27
|
+
require('../../chunk-R3HK6R4B.cjs');
|
|
26
28
|
require('../../chunk-RPII3E6Z.cjs');
|
|
27
29
|
require('../../chunk-6RPZADX3.cjs');
|
|
28
|
-
require('../../chunk-
|
|
30
|
+
require('../../chunk-NYUNU75A.cjs');
|
|
31
|
+
require('../../chunk-YK57NMIF.cjs');
|
|
32
|
+
require('../../chunk-YNJNTCSQ.cjs');
|
|
33
|
+
require('../../chunk-SVNDB62D.cjs');
|
|
29
34
|
require('../../chunk-UIBD2YY5.cjs');
|
|
30
|
-
require('../../chunk-
|
|
31
|
-
require('../../chunk-
|
|
35
|
+
require('../../chunk-6QQG7YG3.cjs');
|
|
36
|
+
require('../../chunk-25GXJCEZ.cjs');
|
|
37
|
+
require('../../chunk-MUHWHQVM.cjs');
|
|
32
38
|
require('../../chunk-Q27JY5RG.cjs');
|
|
33
39
|
require('../../chunk-QXD4MV2X.cjs');
|
|
34
|
-
require('../../chunk-NYUNU75A.cjs');
|
|
35
|
-
require('../../chunk-VQY5W4YW.cjs');
|
|
36
|
-
require('../../chunk-KFI44N2R.cjs');
|
|
37
|
-
require('../../chunk-SVNDB62D.cjs');
|
|
38
40
|
require('../../chunk-APYG5QD7.cjs');
|
|
39
41
|
require('../../chunk-L74VDN4A.cjs');
|
|
40
42
|
require('../../chunk-4YINUUKQ.cjs');
|
|
41
|
-
require('../../chunk-
|
|
43
|
+
require('../../chunk-4VZX5F4T.cjs');
|
|
42
44
|
require('../../chunk-QBZJ7P2T.cjs');
|
|
43
45
|
require('../../chunk-4IH4EL7M.cjs');
|
|
44
46
|
require('../../chunk-A2YMUCBT.cjs');
|
|
@@ -46,11 +48,12 @@ require('../../chunk-UNWKG6EI.cjs');
|
|
|
46
48
|
require('../../chunk-FCR77GYM.cjs');
|
|
47
49
|
require('../../chunk-AEOZIDEB.cjs');
|
|
48
50
|
require('../../chunk-XSVNC2UD.cjs');
|
|
49
|
-
require('../../chunk-
|
|
50
|
-
require('../../chunk-
|
|
51
|
-
require('../../chunk-
|
|
52
|
-
require('../../chunk-
|
|
51
|
+
require('../../chunk-WYTEQ4Q5.cjs');
|
|
52
|
+
require('../../chunk-OKMJLEXX.cjs');
|
|
53
|
+
require('../../chunk-KBM2W6UY.cjs');
|
|
54
|
+
require('../../chunk-KCVJWJST.cjs');
|
|
53
55
|
require('../../chunk-3Z5BQZFM.cjs');
|
|
56
|
+
require('../../chunk-HVBBDBS3.cjs');
|
|
54
57
|
require('../../chunk-NZYN7C3P.cjs');
|
|
55
58
|
require('../../chunk-JMJBSACD.cjs');
|
|
56
59
|
require('../../chunk-GMMT7RVN.cjs');
|
|
@@ -65,4 +68,5 @@ require('../../chunk-UNEFIWXI.cjs');
|
|
|
65
68
|
|
|
66
69
|
|
|
67
70
|
|
|
68
|
-
|
|
71
|
+
|
|
72
|
+
exports.aggregateAnthropicSseToJsonBody = _chunkSQYVORNPcjs.aggregateAnthropicSseToJsonBody; exports.getAnthropicEndpointTransformer = _chunkSQYVORNPcjs.getAnthropicEndpointTransformer; exports.getGeminiEndpointTransformer = _chunkSQYVORNPcjs.getGeminiEndpointTransformer; exports.getResponsesEndpointTransformer = _chunkSQYVORNPcjs.getResponsesEndpointTransformer; exports.getSharedExecutor = _chunkSQYVORNPcjs.getSharedExecutor; exports.readBody = _chunkSQYVORNPcjs.readBody; exports.relayResponse = _chunkSQYVORNPcjs.relayResponse; exports.resolvePoolBoundKey = _chunkSQYVORNPcjs.resolvePoolBoundKey; exports.writeBoundAccountError = _chunkSQYVORNPcjs.writeBoundAccountError; exports.writeError = _chunkSQYVORNPcjs.writeError;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import http from 'node:http';
|
|
2
2
|
import { LLMProvider } from '@omnicross/contracts/llm-config';
|
|
3
|
+
import { BoundAccountSelectionError } from '../../pipeline/BoundAccountSelectionError.cjs';
|
|
3
4
|
import { TransformerChainExecutor } from '../../transformer/TransformerChainExecutor.cjs';
|
|
4
5
|
import { Transformer } from '../../transformer/types.cjs';
|
|
5
6
|
import { ProviderProxyDeps } from '../types.cjs';
|
|
@@ -37,6 +38,28 @@ declare function getAnthropicEndpointTransformer(): Transformer;
|
|
|
37
38
|
declare function getGeminiEndpointTransformer(): Transformer;
|
|
38
39
|
/** Read the full request body from an IncomingMessage. */
|
|
39
40
|
declare function readBody(req: http.IncomingMessage): Promise<string>;
|
|
41
|
+
/**
|
|
42
|
+
* A usage tap for {@link relayResponse}'s stream branch. Streaming responses were
|
|
43
|
+
* previously not metered (only the non-stream branch recorded usage), so Codex
|
|
44
|
+
* — which always streams — produced zero usage/dashboard rows. The tap lets each
|
|
45
|
+
* ingress extract the RAW provider usage object from the SSE events it already
|
|
46
|
+
* knows, and {@link onUsage} fires once at stream end so the recorder charges
|
|
47
|
+
* exactly one event per request. Returning the raw object (not normalized)
|
|
48
|
+
* keeps this tap endpoint-agnostic; each recorder normalizes its own shape.
|
|
49
|
+
*/
|
|
50
|
+
interface StreamUsageTap {
|
|
51
|
+
/**
|
|
52
|
+
* Inspect one parsed SSE `data:` JSON event. Return the raw provider usage
|
|
53
|
+
* object it carries (else null/undefined). The LAST non-null return across
|
|
54
|
+
* the whole stream is what {@link onUsage} receives — so for endpoints whose
|
|
55
|
+
* usage arrives piecewise (e.g. Anthropic `message_start`+`message_delta`),
|
|
56
|
+
* merge inside this closure and return the combined value from the terminal
|
|
57
|
+
* event.
|
|
58
|
+
*/
|
|
59
|
+
extractUsage(event: Record<string, unknown>): Record<string, unknown> | null | undefined;
|
|
60
|
+
/** Called once at stream end with the last captured usage (only if any). */
|
|
61
|
+
onUsage(rawUsage: Record<string, unknown>): void;
|
|
62
|
+
}
|
|
40
63
|
/**
|
|
41
64
|
* Relay an already-wire-shaped `Response` to the http `res`.
|
|
42
65
|
* - `text/event-stream` (or `isStream`): pipe the ReadableStream chunk-by-chunk.
|
|
@@ -54,7 +77,7 @@ declare function readBody(req: http.IncomingMessage): Promise<string>;
|
|
|
54
77
|
*
|
|
55
78
|
* @returns the (upstream) JSON body text for non-stream responses, else `null`.
|
|
56
79
|
*/
|
|
57
|
-
declare function relayResponse(res: http.ServerResponse, providerResponse: Response, isStream: boolean, rewriteModel?: string): Promise<string | null>;
|
|
80
|
+
declare function relayResponse(res: http.ServerResponse, providerResponse: Response, isStream: boolean, rewriteModel?: string, usageTap?: StreamUsageTap): Promise<string | null>;
|
|
58
81
|
/**
|
|
59
82
|
* Aggregate a streaming Anthropic `text/event-stream` body into ONE buffered
|
|
60
83
|
* Anthropic `message` JSON object — the inverse of the SDK's SSE wire format.
|
|
@@ -73,13 +96,19 @@ declare function relayResponse(res: http.ServerResponse, providerResponse: Respo
|
|
|
73
96
|
declare function aggregateAnthropicSseToJsonBody(response: Response, rewriteModel?: string): Promise<string>;
|
|
74
97
|
/** Write a JSON error response if the headers have not been sent. */
|
|
75
98
|
declare function writeError(res: http.ServerResponse, status: number, message: string): void;
|
|
99
|
+
/**
|
|
100
|
+
* Map a strict bound-account failure to a stable structured response. The body
|
|
101
|
+
* carries only the fixed code/reason/message; account ids, tokens, and upstream
|
|
102
|
+
* error text never cross the wire.
|
|
103
|
+
*/
|
|
104
|
+
declare function writeBoundAccountError(res: http.ServerResponse, error: BoundAccountSelectionError): void;
|
|
76
105
|
/**
|
|
77
106
|
* Resolve the FIRST-CHOICE BYO request key for a `buildByoPlan`, threading the
|
|
78
107
|
* ApiKeyPool through TWO gates so 429/529/401/403 failover actually fires on the
|
|
79
108
|
* outbound serving path (omnicross-daemon-parity-poolseam, design D2(b)).
|
|
80
109
|
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
110
|
+
* Matches the host engine adapter's `resolveApiKeyForProvider` contract so pool
|
|
111
|
+
* failover remains inside the provider layer:
|
|
83
112
|
* - pool present AND a (synthesized outbound) sessionId present →
|
|
84
113
|
* `getKeyForSession(providerId, sessionId)`. This SEEDS `sessionBindings`
|
|
85
114
|
* with the chosen key AND returns that same key, so it becomes the first
|
|
@@ -101,6 +130,6 @@ declare function writeError(res: http.ServerResponse, status: number, message: s
|
|
|
101
130
|
* already-`resolveKey`-resolved string (its loader passes the host resolver),
|
|
102
131
|
* so the pool branch needs no further `$ENV` expansion.
|
|
103
132
|
*/
|
|
104
|
-
declare function resolvePoolBoundKey(deps: ProviderProxyDeps, providerId: string, provider: LLMProvider, sessionId: string | null): Promise<string>;
|
|
133
|
+
declare function resolvePoolBoundKey(deps: ProviderProxyDeps, providerId: string, provider: LLMProvider, sessionId: string | null, preferredKeyId?: string, boundKeyFallbackPolicy?: 'strict' | 'pool'): Promise<string>;
|
|
105
134
|
|
|
106
|
-
export { aggregateAnthropicSseToJsonBody, getAnthropicEndpointTransformer, getGeminiEndpointTransformer, getResponsesEndpointTransformer, getSharedExecutor, readBody, relayResponse, resolvePoolBoundKey, writeError };
|
|
135
|
+
export { type StreamUsageTap, aggregateAnthropicSseToJsonBody, getAnthropicEndpointTransformer, getGeminiEndpointTransformer, getResponsesEndpointTransformer, getSharedExecutor, readBody, relayResponse, resolvePoolBoundKey, writeBoundAccountError, writeError };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import http from 'node:http';
|
|
2
2
|
import { LLMProvider } from '@omnicross/contracts/llm-config';
|
|
3
|
+
import { BoundAccountSelectionError } from '../../pipeline/BoundAccountSelectionError.js';
|
|
3
4
|
import { TransformerChainExecutor } from '../../transformer/TransformerChainExecutor.js';
|
|
4
5
|
import { Transformer } from '../../transformer/types.js';
|
|
5
6
|
import { ProviderProxyDeps } from '../types.js';
|
|
@@ -37,6 +38,28 @@ declare function getAnthropicEndpointTransformer(): Transformer;
|
|
|
37
38
|
declare function getGeminiEndpointTransformer(): Transformer;
|
|
38
39
|
/** Read the full request body from an IncomingMessage. */
|
|
39
40
|
declare function readBody(req: http.IncomingMessage): Promise<string>;
|
|
41
|
+
/**
|
|
42
|
+
* A usage tap for {@link relayResponse}'s stream branch. Streaming responses were
|
|
43
|
+
* previously not metered (only the non-stream branch recorded usage), so Codex
|
|
44
|
+
* — which always streams — produced zero usage/dashboard rows. The tap lets each
|
|
45
|
+
* ingress extract the RAW provider usage object from the SSE events it already
|
|
46
|
+
* knows, and {@link onUsage} fires once at stream end so the recorder charges
|
|
47
|
+
* exactly one event per request. Returning the raw object (not normalized)
|
|
48
|
+
* keeps this tap endpoint-agnostic; each recorder normalizes its own shape.
|
|
49
|
+
*/
|
|
50
|
+
interface StreamUsageTap {
|
|
51
|
+
/**
|
|
52
|
+
* Inspect one parsed SSE `data:` JSON event. Return the raw provider usage
|
|
53
|
+
* object it carries (else null/undefined). The LAST non-null return across
|
|
54
|
+
* the whole stream is what {@link onUsage} receives — so for endpoints whose
|
|
55
|
+
* usage arrives piecewise (e.g. Anthropic `message_start`+`message_delta`),
|
|
56
|
+
* merge inside this closure and return the combined value from the terminal
|
|
57
|
+
* event.
|
|
58
|
+
*/
|
|
59
|
+
extractUsage(event: Record<string, unknown>): Record<string, unknown> | null | undefined;
|
|
60
|
+
/** Called once at stream end with the last captured usage (only if any). */
|
|
61
|
+
onUsage(rawUsage: Record<string, unknown>): void;
|
|
62
|
+
}
|
|
40
63
|
/**
|
|
41
64
|
* Relay an already-wire-shaped `Response` to the http `res`.
|
|
42
65
|
* - `text/event-stream` (or `isStream`): pipe the ReadableStream chunk-by-chunk.
|
|
@@ -54,7 +77,7 @@ declare function readBody(req: http.IncomingMessage): Promise<string>;
|
|
|
54
77
|
*
|
|
55
78
|
* @returns the (upstream) JSON body text for non-stream responses, else `null`.
|
|
56
79
|
*/
|
|
57
|
-
declare function relayResponse(res: http.ServerResponse, providerResponse: Response, isStream: boolean, rewriteModel?: string): Promise<string | null>;
|
|
80
|
+
declare function relayResponse(res: http.ServerResponse, providerResponse: Response, isStream: boolean, rewriteModel?: string, usageTap?: StreamUsageTap): Promise<string | null>;
|
|
58
81
|
/**
|
|
59
82
|
* Aggregate a streaming Anthropic `text/event-stream` body into ONE buffered
|
|
60
83
|
* Anthropic `message` JSON object — the inverse of the SDK's SSE wire format.
|
|
@@ -73,13 +96,19 @@ declare function relayResponse(res: http.ServerResponse, providerResponse: Respo
|
|
|
73
96
|
declare function aggregateAnthropicSseToJsonBody(response: Response, rewriteModel?: string): Promise<string>;
|
|
74
97
|
/** Write a JSON error response if the headers have not been sent. */
|
|
75
98
|
declare function writeError(res: http.ServerResponse, status: number, message: string): void;
|
|
99
|
+
/**
|
|
100
|
+
* Map a strict bound-account failure to a stable structured response. The body
|
|
101
|
+
* carries only the fixed code/reason/message; account ids, tokens, and upstream
|
|
102
|
+
* error text never cross the wire.
|
|
103
|
+
*/
|
|
104
|
+
declare function writeBoundAccountError(res: http.ServerResponse, error: BoundAccountSelectionError): void;
|
|
76
105
|
/**
|
|
77
106
|
* Resolve the FIRST-CHOICE BYO request key for a `buildByoPlan`, threading the
|
|
78
107
|
* ApiKeyPool through TWO gates so 429/529/401/403 failover actually fires on the
|
|
79
108
|
* outbound serving path (omnicross-daemon-parity-poolseam, design D2(b)).
|
|
80
109
|
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
110
|
+
* Matches the host engine adapter's `resolveApiKeyForProvider` contract so pool
|
|
111
|
+
* failover remains inside the provider layer:
|
|
83
112
|
* - pool present AND a (synthesized outbound) sessionId present →
|
|
84
113
|
* `getKeyForSession(providerId, sessionId)`. This SEEDS `sessionBindings`
|
|
85
114
|
* with the chosen key AND returns that same key, so it becomes the first
|
|
@@ -101,6 +130,6 @@ declare function writeError(res: http.ServerResponse, status: number, message: s
|
|
|
101
130
|
* already-`resolveKey`-resolved string (its loader passes the host resolver),
|
|
102
131
|
* so the pool branch needs no further `$ENV` expansion.
|
|
103
132
|
*/
|
|
104
|
-
declare function resolvePoolBoundKey(deps: ProviderProxyDeps, providerId: string, provider: LLMProvider, sessionId: string | null): Promise<string>;
|
|
133
|
+
declare function resolvePoolBoundKey(deps: ProviderProxyDeps, providerId: string, provider: LLMProvider, sessionId: string | null, preferredKeyId?: string, boundKeyFallbackPolicy?: 'strict' | 'pool'): Promise<string>;
|
|
105
134
|
|
|
106
|
-
export { aggregateAnthropicSseToJsonBody, getAnthropicEndpointTransformer, getGeminiEndpointTransformer, getResponsesEndpointTransformer, getSharedExecutor, readBody, relayResponse, resolvePoolBoundKey, writeError };
|
|
135
|
+
export { type StreamUsageTap, aggregateAnthropicSseToJsonBody, getAnthropicEndpointTransformer, getGeminiEndpointTransformer, getResponsesEndpointTransformer, getSharedExecutor, readBody, relayResponse, resolvePoolBoundKey, writeBoundAccountError, writeError };
|
|
@@ -7,38 +7,40 @@ import {
|
|
|
7
7
|
readBody,
|
|
8
8
|
relayResponse,
|
|
9
9
|
resolvePoolBoundKey,
|
|
10
|
+
writeBoundAccountError,
|
|
10
11
|
writeError
|
|
11
|
-
} from "../../chunk-
|
|
12
|
+
} from "../../chunk-UDCC7EMR.js";
|
|
13
|
+
import "../../chunk-WB6PH56J.js";
|
|
12
14
|
import "../../chunk-VVEHS2LI.js";
|
|
13
15
|
import "../../chunk-46RLHI7D.js";
|
|
14
|
-
import "../../chunk-
|
|
16
|
+
import "../../chunk-WNKWAEUR.js";
|
|
17
|
+
import "../../chunk-MZNPGW5Q.js";
|
|
15
18
|
import "../../chunk-DK4A7DLE.js";
|
|
16
|
-
import "../../chunk-
|
|
17
|
-
import "../../chunk-
|
|
18
|
-
import "../../chunk-
|
|
19
|
-
import "../../chunk-
|
|
20
|
-
import "../../chunk-
|
|
21
|
-
import "../../chunk-BODMAL6G.js";
|
|
19
|
+
import "../../chunk-VRFBB5DB.js";
|
|
20
|
+
import "../../chunk-LVUCAWMK.js";
|
|
21
|
+
import "../../chunk-OEWZUX4G.js";
|
|
22
|
+
import "../../chunk-LB6EBS6Y.js";
|
|
23
|
+
import "../../chunk-6CL5HTPQ.js";
|
|
22
24
|
import "../../chunk-7VU7V2E4.js";
|
|
23
|
-
import "../../chunk-
|
|
25
|
+
import "../../chunk-UX7VWA46.js";
|
|
24
26
|
import "../../chunk-BPKCU575.js";
|
|
25
|
-
import "../../chunk-
|
|
27
|
+
import "../../chunk-DRWHTIIZ.js";
|
|
26
28
|
import "../../chunk-XTEI64OU.js";
|
|
27
29
|
import "../../chunk-XX6NQJMA.js";
|
|
28
|
-
import "../../chunk-
|
|
30
|
+
import "../../chunk-5ERIZW3D.js";
|
|
31
|
+
import "../../chunk-YJVHCHQX.js";
|
|
32
|
+
import "../../chunk-23S5OPIO.js";
|
|
33
|
+
import "../../chunk-AVYJ4YBN.js";
|
|
29
34
|
import "../../chunk-OE6TDIWW.js";
|
|
30
|
-
import "../../chunk-
|
|
31
|
-
import "../../chunk-
|
|
35
|
+
import "../../chunk-OPRS4IQZ.js";
|
|
36
|
+
import "../../chunk-2JYRIADS.js";
|
|
37
|
+
import "../../chunk-DE2SRBFZ.js";
|
|
32
38
|
import "../../chunk-ZY6KU6P3.js";
|
|
33
39
|
import "../../chunk-JWC6APFQ.js";
|
|
34
|
-
import "../../chunk-5ERIZW3D.js";
|
|
35
|
-
import "../../chunk-5ENKBSWO.js";
|
|
36
|
-
import "../../chunk-HRRYG2AX.js";
|
|
37
|
-
import "../../chunk-AVYJ4YBN.js";
|
|
38
40
|
import "../../chunk-WLYIIEAF.js";
|
|
39
41
|
import "../../chunk-TKJMZBAH.js";
|
|
40
42
|
import "../../chunk-3QFXFCHG.js";
|
|
41
|
-
import "../../chunk-
|
|
43
|
+
import "../../chunk-EBLFCNPY.js";
|
|
42
44
|
import "../../chunk-AQ5TNQB7.js";
|
|
43
45
|
import "../../chunk-XEKD23J5.js";
|
|
44
46
|
import "../../chunk-H5JUT3KV.js";
|
|
@@ -46,11 +48,12 @@ import "../../chunk-IFXJ2BG7.js";
|
|
|
46
48
|
import "../../chunk-K5NM7VAH.js";
|
|
47
49
|
import "../../chunk-WNY4WMRF.js";
|
|
48
50
|
import "../../chunk-OZFM4X3S.js";
|
|
49
|
-
import "../../chunk-
|
|
50
|
-
import "../../chunk-
|
|
51
|
-
import "../../chunk-
|
|
52
|
-
import "../../chunk-
|
|
51
|
+
import "../../chunk-AT7B7SOZ.js";
|
|
52
|
+
import "../../chunk-N5T4M4GU.js";
|
|
53
|
+
import "../../chunk-TOVPMMHM.js";
|
|
54
|
+
import "../../chunk-SIZQQD6T.js";
|
|
53
55
|
import "../../chunk-SYQF7OIR.js";
|
|
56
|
+
import "../../chunk-MKF46GNZ.js";
|
|
54
57
|
import "../../chunk-CDHS2QDC.js";
|
|
55
58
|
import "../../chunk-Y7FO65VT.js";
|
|
56
59
|
import "../../chunk-FMOBD2OQ.js";
|
|
@@ -64,5 +67,6 @@ export {
|
|
|
64
67
|
readBody,
|
|
65
68
|
relayResponse,
|
|
66
69
|
resolvePoolBoundKey,
|
|
70
|
+
writeBoundAccountError,
|
|
67
71
|
writeError
|
|
68
72
|
};
|
|
@@ -4,11 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var _chunkQWBWGODScjs = require('../chunk-QWBWGODS.cjs');
|
|
8
7
|
|
|
8
|
+
var _chunkEJLH6NFTcjs = require('../chunk-EJLH6NFT.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
exports.MATCH_TEXT_PER_MESSAGE_CAP = _chunkEJLH6NFTcjs.MATCH_TEXT_PER_MESSAGE_CAP; exports.MATCH_TEXT_RECENT_MESSAGES = _chunkEJLH6NFTcjs.MATCH_TEXT_RECENT_MESSAGES; exports.collectMatchText = _chunkEJLH6NFTcjs.collectMatchText; exports.deriveGatewaySessionKey = _chunkEJLH6NFTcjs.deriveGatewaySessionKey; exports.deriveSubscriptionSessionKey = _chunkEJLH6NFTcjs.deriveSubscriptionSessionKey; exports.flattenMatchText = _chunkEJLH6NFTcjs.flattenMatchText;
|
|
@@ -34,11 +34,10 @@ declare const MATCH_TEXT_RECENT_MESSAGES = 6;
|
|
|
34
34
|
declare function flattenMatchText(value: unknown): string;
|
|
35
35
|
/**
|
|
36
36
|
* Build the BOUNDED match-text slice: the `system` prompt plus the most recent
|
|
37
|
-
* `user`/`system` messages, each truncated to a per-message char cap
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* background tool-blocker pre-scan). System prompt is emitted first.
|
|
37
|
+
* `user`/`system` messages, each truncated to a per-message char cap so matching
|
|
38
|
+
* cost is independent of conversation length. Assistant turns are excluded to
|
|
39
|
+
* keep routing based on instructions rather than generated text. System prompt
|
|
40
|
+
* is emitted first.
|
|
42
41
|
*
|
|
43
42
|
* @param anthropicBody the parsed Anthropic Messages request body.
|
|
44
43
|
*/
|
|
@@ -56,5 +55,41 @@ declare function collectMatchText(anthropicBody: Record<string, unknown>): strin
|
|
|
56
55
|
* SAME key for the same body.
|
|
57
56
|
*/
|
|
58
57
|
declare function deriveSubscriptionSessionKey(anthropicBody: Record<string, unknown>): string | undefined;
|
|
58
|
+
/** 32-bit FNV-1a hex digest — a small, dependency-free stable string hash for the
|
|
59
|
+
* session-affinity bucket key (NOT a security primitive). */
|
|
60
|
+
/**
|
|
61
|
+
* Source used to derive a gateway session-affinity key. The value is kept
|
|
62
|
+
* deliberately small and non-sensitive: callers only receive the hashed key,
|
|
63
|
+
* while the source is useful to tests/diagnostics without exposing the raw
|
|
64
|
+
* session id.
|
|
65
|
+
*/
|
|
66
|
+
type SessionKeySource = 'session-header' | 'thread-header' | 'body-session-id' | 'body-thread-id' | 'prompt-cache-key' | 'content-fingerprint' | 'api-key-fallback';
|
|
67
|
+
/** A hashed session key and the extraction path that produced it. */
|
|
68
|
+
interface DerivedSessionKey {
|
|
69
|
+
readonly key: string;
|
|
70
|
+
readonly source: SessionKeySource;
|
|
71
|
+
}
|
|
72
|
+
/** Options for {@link deriveGatewaySessionKey}. */
|
|
73
|
+
interface GatewaySessionKeyOptions {
|
|
74
|
+
/** A stable route/key seed used when the request has no conversation id. */
|
|
75
|
+
readonly fallbackKey?: string;
|
|
76
|
+
/** Namespaces the conservative fallback (normally `responses`). */
|
|
77
|
+
readonly endpoint?: string;
|
|
78
|
+
}
|
|
79
|
+
/** Header bag accepted by Node's IncomingHttpHeaders and browser-style tests. */
|
|
80
|
+
type SessionRequestHeaders = Record<string, string | string[] | undefined>;
|
|
81
|
+
/**
|
|
82
|
+
* Derive one stable account-pool affinity key for a gateway request.
|
|
83
|
+
*
|
|
84
|
+
* Codex/Responses sends the same conversation id in a few wire-compatible
|
|
85
|
+
* locations depending on the client version. Prefer those explicit ids in a
|
|
86
|
+
* deterministic order, then fall back to a bounded content fingerprint made
|
|
87
|
+
* from stable developer/system instructions and the first user input. The
|
|
88
|
+
* final fallback is route-scoped (api key/session + endpoint) so a request
|
|
89
|
+
* with no usable metadata remains conservative and does not rotate accounts
|
|
90
|
+
* on every turn. Raw ids and prompts are never returned or logged; only their
|
|
91
|
+
* FNV-1a digest is exposed as `key`.
|
|
92
|
+
*/
|
|
93
|
+
declare function deriveGatewaySessionKey(body: Record<string, unknown>, headers?: SessionRequestHeaders, options?: GatewaySessionKeyOptions): DerivedSessionKey;
|
|
59
94
|
|
|
60
|
-
export { MATCH_TEXT_PER_MESSAGE_CAP, MATCH_TEXT_RECENT_MESSAGES, collectMatchText, deriveSubscriptionSessionKey, flattenMatchText };
|
|
95
|
+
export { type DerivedSessionKey, type GatewaySessionKeyOptions, MATCH_TEXT_PER_MESSAGE_CAP, MATCH_TEXT_RECENT_MESSAGES, type SessionKeySource, type SessionRequestHeaders, collectMatchText, deriveGatewaySessionKey, deriveSubscriptionSessionKey, flattenMatchText };
|
|
@@ -34,11 +34,10 @@ declare const MATCH_TEXT_RECENT_MESSAGES = 6;
|
|
|
34
34
|
declare function flattenMatchText(value: unknown): string;
|
|
35
35
|
/**
|
|
36
36
|
* Build the BOUNDED match-text slice: the `system` prompt plus the most recent
|
|
37
|
-
* `user`/`system` messages, each truncated to a per-message char cap
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* background tool-blocker pre-scan). System prompt is emitted first.
|
|
37
|
+
* `user`/`system` messages, each truncated to a per-message char cap so matching
|
|
38
|
+
* cost is independent of conversation length. Assistant turns are excluded to
|
|
39
|
+
* keep routing based on instructions rather than generated text. System prompt
|
|
40
|
+
* is emitted first.
|
|
42
41
|
*
|
|
43
42
|
* @param anthropicBody the parsed Anthropic Messages request body.
|
|
44
43
|
*/
|
|
@@ -56,5 +55,41 @@ declare function collectMatchText(anthropicBody: Record<string, unknown>): strin
|
|
|
56
55
|
* SAME key for the same body.
|
|
57
56
|
*/
|
|
58
57
|
declare function deriveSubscriptionSessionKey(anthropicBody: Record<string, unknown>): string | undefined;
|
|
58
|
+
/** 32-bit FNV-1a hex digest — a small, dependency-free stable string hash for the
|
|
59
|
+
* session-affinity bucket key (NOT a security primitive). */
|
|
60
|
+
/**
|
|
61
|
+
* Source used to derive a gateway session-affinity key. The value is kept
|
|
62
|
+
* deliberately small and non-sensitive: callers only receive the hashed key,
|
|
63
|
+
* while the source is useful to tests/diagnostics without exposing the raw
|
|
64
|
+
* session id.
|
|
65
|
+
*/
|
|
66
|
+
type SessionKeySource = 'session-header' | 'thread-header' | 'body-session-id' | 'body-thread-id' | 'prompt-cache-key' | 'content-fingerprint' | 'api-key-fallback';
|
|
67
|
+
/** A hashed session key and the extraction path that produced it. */
|
|
68
|
+
interface DerivedSessionKey {
|
|
69
|
+
readonly key: string;
|
|
70
|
+
readonly source: SessionKeySource;
|
|
71
|
+
}
|
|
72
|
+
/** Options for {@link deriveGatewaySessionKey}. */
|
|
73
|
+
interface GatewaySessionKeyOptions {
|
|
74
|
+
/** A stable route/key seed used when the request has no conversation id. */
|
|
75
|
+
readonly fallbackKey?: string;
|
|
76
|
+
/** Namespaces the conservative fallback (normally `responses`). */
|
|
77
|
+
readonly endpoint?: string;
|
|
78
|
+
}
|
|
79
|
+
/** Header bag accepted by Node's IncomingHttpHeaders and browser-style tests. */
|
|
80
|
+
type SessionRequestHeaders = Record<string, string | string[] | undefined>;
|
|
81
|
+
/**
|
|
82
|
+
* Derive one stable account-pool affinity key for a gateway request.
|
|
83
|
+
*
|
|
84
|
+
* Codex/Responses sends the same conversation id in a few wire-compatible
|
|
85
|
+
* locations depending on the client version. Prefer those explicit ids in a
|
|
86
|
+
* deterministic order, then fall back to a bounded content fingerprint made
|
|
87
|
+
* from stable developer/system instructions and the first user input. The
|
|
88
|
+
* final fallback is route-scoped (api key/session + endpoint) so a request
|
|
89
|
+
* with no usable metadata remains conservative and does not rotate accounts
|
|
90
|
+
* on every turn. Raw ids and prompts are never returned or logged; only their
|
|
91
|
+
* FNV-1a digest is exposed as `key`.
|
|
92
|
+
*/
|
|
93
|
+
declare function deriveGatewaySessionKey(body: Record<string, unknown>, headers?: SessionRequestHeaders, options?: GatewaySessionKeyOptions): DerivedSessionKey;
|
|
59
94
|
|
|
60
|
-
export { MATCH_TEXT_PER_MESSAGE_CAP, MATCH_TEXT_RECENT_MESSAGES, collectMatchText, deriveSubscriptionSessionKey, flattenMatchText };
|
|
95
|
+
export { type DerivedSessionKey, type GatewaySessionKeyOptions, MATCH_TEXT_PER_MESSAGE_CAP, MATCH_TEXT_RECENT_MESSAGES, type SessionKeySource, type SessionRequestHeaders, collectMatchText, deriveGatewaySessionKey, deriveSubscriptionSessionKey, flattenMatchText };
|
|
@@ -2,13 +2,15 @@ import {
|
|
|
2
2
|
MATCH_TEXT_PER_MESSAGE_CAP,
|
|
3
3
|
MATCH_TEXT_RECENT_MESSAGES,
|
|
4
4
|
collectMatchText,
|
|
5
|
+
deriveGatewaySessionKey,
|
|
5
6
|
deriveSubscriptionSessionKey,
|
|
6
7
|
flattenMatchText
|
|
7
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-WB6PH56J.js";
|
|
8
9
|
export {
|
|
9
10
|
MATCH_TEXT_PER_MESSAGE_CAP,
|
|
10
11
|
MATCH_TEXT_RECENT_MESSAGES,
|
|
11
12
|
collectMatchText,
|
|
13
|
+
deriveGatewaySessionKey,
|
|
12
14
|
deriveSubscriptionSessionKey,
|
|
13
15
|
flattenMatchText
|
|
14
16
|
};
|
|
@@ -4,6 +4,7 @@ import { SubscriptionProviderId, OpenCodeGoTokenConfig, OpenCodeGoScenario, Open
|
|
|
4
4
|
import { UsageEngineOrigin, UsageTokens } from '@omnicross/contracts/usage-types';
|
|
5
5
|
import { ApiKeyPoolService } from '../completion/ApiKeyPoolService.cjs';
|
|
6
6
|
import { AuthSource } from '../pipeline/AuthSource.cjs';
|
|
7
|
+
import { BoundAccountFallbackPolicy } from '../pipeline/BoundAccountSelectionError.cjs';
|
|
7
8
|
import { SubscriptionAuthProfile } from '../pipeline/SubscriptionAuthSource.cjs';
|
|
8
9
|
import { AuthStrategy } from '../pipeline/SubscriptionAuthStrategy.cjs';
|
|
9
10
|
import { ProviderConfigSource } from '../ports/provider-config-source.cjs';
|
|
@@ -161,6 +162,15 @@ interface AnthropicRouteHandlerParams {
|
|
|
161
162
|
/** Lazy per-request resolver for the pass-through Bearer (takes precedence over the static one). */
|
|
162
163
|
readonly resolvePassThroughAuthToken?: (() => Promise<string | null>) | null;
|
|
163
164
|
readonly subscriptionProfile?: SubscriptionDispatchProfile | null;
|
|
165
|
+
/** Bound subscription account forwarded to the host's Anthropic handler. */
|
|
166
|
+
readonly preferredAccountId?: string;
|
|
167
|
+
readonly preferredAccountGroup?: string;
|
|
168
|
+
/** Strict by default; pool fallback is an explicit endpoint opt-in. */
|
|
169
|
+
readonly boundAccountFallbackPolicy?: BoundAccountFallbackPolicy;
|
|
170
|
+
/** Preferred provider-pool key selected by a resource-level binding. */
|
|
171
|
+
readonly preferredKeyId?: string;
|
|
172
|
+
/** Strict by default; pool fallback is an explicit binding opt-in. */
|
|
173
|
+
readonly boundKeyFallbackPolicy?: BoundAccountFallbackPolicy;
|
|
164
174
|
readonly maxConcurrency?: number;
|
|
165
175
|
/** Instance-level web-search backend; falls back to the proxy-global one. */
|
|
166
176
|
readonly webSearchService?: WebSearchBackend | null;
|
|
@@ -249,6 +259,15 @@ interface AnthropicSdkHints {
|
|
|
249
259
|
readonly extendedContext?: ExtendedContextHint | null;
|
|
250
260
|
/** Subscription dispatch profile (Codex/Gemini/OpenCodeGo over the SDK wire). */
|
|
251
261
|
readonly subscriptionProfile?: SubscriptionDispatchProfile | null;
|
|
262
|
+
/** Bound subscription account for the delegated Anthropic path. */
|
|
263
|
+
readonly preferredAccountId?: string;
|
|
264
|
+
readonly preferredAccountGroup?: string;
|
|
265
|
+
/** Strict by default; pool fallback is an explicit endpoint opt-in. */
|
|
266
|
+
readonly boundAccountFallbackPolicy?: BoundAccountFallbackPolicy;
|
|
267
|
+
/** Preferred provider-pool key for a delegated BYO Anthropic route. */
|
|
268
|
+
readonly preferredKeyId?: string;
|
|
269
|
+
/** Strict by default; pool fallback is an explicit binding opt-in. */
|
|
270
|
+
readonly boundKeyFallbackPolicy?: BoundAccountFallbackPolicy;
|
|
252
271
|
/** Per-request max-concurrency cap for the error-handler semaphore. */
|
|
253
272
|
readonly maxConcurrency?: number;
|
|
254
273
|
/** Instance-level web-search backend (falls back to the proxy-global one). */
|
|
@@ -338,10 +357,19 @@ interface RouteContext {
|
|
|
338
357
|
/**
|
|
339
358
|
* Per-request preferred subscription account id (provider/subscription
|
|
340
359
|
* duality). Stamped by the outbound `resolveRoute` from
|
|
341
|
-
* `EndpointRoutingConfig.boundAccountId`;
|
|
342
|
-
*
|
|
360
|
+
* `EndpointRoutingConfig.boundAccountId`; strict bindings fail when this
|
|
361
|
+
* account cannot serve. The pool is used only when the route carries the
|
|
362
|
+
* explicit `'pool'` fallback policy. Undefined ⇒ pool auto-schedule.
|
|
343
363
|
*/
|
|
344
364
|
readonly preferredAccountId?: string;
|
|
365
|
+
/** Account-group binding projected by the outbound gateway. */
|
|
366
|
+
readonly preferredAccountGroup?: string;
|
|
367
|
+
/** Bound-account behavior; `'pool'` is the explicit fallback opt-in. */
|
|
368
|
+
readonly boundAccountFallbackPolicy?: BoundAccountFallbackPolicy;
|
|
369
|
+
/** Optional provider key selected by a resource-level gateway binding. */
|
|
370
|
+
readonly preferredKeyId?: string;
|
|
371
|
+
/** Strict by default; `'pool'` permits normal provider key selection. */
|
|
372
|
+
readonly boundKeyFallbackPolicy?: BoundAccountFallbackPolicy;
|
|
345
373
|
/**
|
|
346
374
|
* OPAQUE per-account subscription config (opencodego-only). Populated by the
|
|
347
375
|
* route resolver from the subscription registry's `getOpenCodeGoConfig()`
|