@omnicross/core 0.1.9 → 0.2.0
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 +22 -15
- package/dist/{CompletionService-kNA17cfI.d.cts → CompletionService-BiJqftc-.d.cts} +1 -1
- package/dist/{CompletionService-C3BX0Ovy.d.ts → CompletionService-NXN_Av5W.d.ts} +1 -1
- package/dist/{ProviderProxy-QdwNV6l1.d.cts → ProviderProxy-CgIcCVwk.d.cts} +1 -1
- package/dist/{ProviderProxy--ROec6VI.d.ts → ProviderProxy-DYoY5XoT.d.ts} +1 -1
- package/dist/auth/GeminiCodeAssistProjectResolver.cjs +6 -6
- package/dist/auth/GeminiCodeAssistProjectResolver.js +4 -4
- package/dist/chunk-32SRZFFP.cjs +153 -0
- package/dist/chunk-4JOU54M5.js +200 -0
- package/dist/{chunk-2UTGX6FM.js → chunk-4VVCXVB7.js} +1 -1
- package/dist/{chunk-EPN67EGP.cjs → chunk-5UK3KLE2.cjs} +9 -1
- package/dist/chunk-6DDYNS2B.cjs +384 -0
- package/dist/{chunk-HKB656B4.js → chunk-6OC3ORW6.js} +55 -287
- package/dist/chunk-6OKXH2TW.js +320 -0
- package/dist/{chunk-XELFM7KL.cjs → chunk-7B56AJBB.cjs} +6275 -2421
- package/dist/{chunk-YWL7YZWS.cjs → chunk-7LRTPNFL.cjs} +5 -0
- package/dist/{chunk-CCVRRJOX.js → chunk-7PIUVCKK.js} +9 -2
- package/dist/{chunk-IIRPUVPH.cjs → chunk-7ZHBN75N.cjs} +3 -1
- package/dist/{chunk-UAPBLNN2.js → chunk-AQDON6MB.js} +8 -0
- package/dist/{chunk-RJ5ZGNI3.js → chunk-CFSGYFOZ.js} +1 -1
- package/dist/chunk-CTKM773J.cjs +3919 -0
- package/dist/chunk-DEIUR2TH.js +3919 -0
- package/dist/{chunk-WNKWAEUR.js → chunk-EYGBM2VC.js} +3 -1
- package/dist/{chunk-NGYOO5TO.js → chunk-FJNKXOWE.js} +9 -9
- package/dist/chunk-FX325I5Q.cjs +320 -0
- package/dist/chunk-G4CZIUIB.cjs +200 -0
- package/dist/chunk-HCOQQAZE.cjs +123 -0
- package/dist/{chunk-55FMGZ3L.js → chunk-HN74IGEO.js} +1 -1
- package/dist/{chunk-ZY6KU6P3.js → chunk-HOMUGKHR.js} +8 -5
- package/dist/{chunk-AOFWNWLT.cjs → chunk-IUL4VWNU.cjs} +22 -1
- package/dist/{chunk-5LNYGCIW.cjs → chunk-KIQ2HA2A.cjs} +5 -5
- package/dist/{chunk-MUHWHQVM.cjs → chunk-KQBLZMP6.cjs} +4 -3
- package/dist/chunk-LFEH7CEO.js +384 -0
- package/dist/chunk-N76KU6F5.js +123 -0
- package/dist/{chunk-CMVXX7ON.cjs → chunk-NOITAVHA.cjs} +114 -58
- package/dist/{chunk-Q27JY5RG.cjs → chunk-OIKREZVQ.cjs} +7 -4
- package/dist/{chunk-RJUONLUQ.cjs → chunk-OST5RJOJ.cjs} +1 -1
- package/dist/chunk-QIIAMBTM.js +153 -0
- package/dist/{chunk-56QD3YW6.cjs → chunk-QWNUOR7F.cjs} +11 -4
- package/dist/{chunk-S3DYFEBE.js → chunk-R4VCO2CB.js} +10 -1
- package/dist/{chunk-ZQQUD66M.cjs → chunk-SQMAEDNE.cjs} +63 -295
- package/dist/{chunk-4VZX5F4T.cjs → chunk-T6NWPIYZ.cjs} +5 -2
- package/dist/{chunk-P7EM6BND.cjs → chunk-TVYA5JSQ.cjs} +10 -10
- package/dist/{chunk-EBLFCNPY.js → chunk-U47LQXPB.js} +5 -2
- package/dist/{chunk-N7OOJI5V.js → chunk-V2UKUTJ3.js} +5 -0
- package/dist/{chunk-45FHEOKW.js → chunk-V53ZEFXC.js} +92 -36
- package/dist/{chunk-OC6DOOFX.cjs → chunk-VXRTQZF2.cjs} +5 -5
- package/dist/{chunk-CQIJCPMF.js → chunk-WSJE42SG.js} +5149 -1295
- package/dist/{chunk-RICPANBY.cjs → chunk-WX2E2G7H.cjs} +13 -4
- package/dist/{chunk-DE2SRBFZ.js → chunk-X335TJNS.js} +4 -3
- package/dist/{chunk-N2EIM2XJ.js → chunk-ZLNHPUFA.js} +22 -1
- package/dist/completion/CompletionService.cjs +30 -27
- package/dist/completion/CompletionService.d.cts +3 -2
- package/dist/completion/CompletionService.d.ts +3 -2
- package/dist/completion/CompletionService.js +29 -26
- package/dist/completion.cjs +38 -35
- package/dist/completion.d.cts +3 -2
- package/dist/completion.d.ts +3 -2
- package/dist/completion.js +37 -34
- package/dist/image-generation.cjs +52 -0
- package/dist/image-generation.d.cts +93 -0
- package/dist/image-generation.d.ts +93 -0
- package/dist/image-generation.js +52 -0
- package/dist/index.cjs +126 -31
- package/dist/index.d.cts +11 -7
- package/dist/index.d.ts +11 -7
- package/dist/index.js +143 -48
- package/dist/openai-operation.cjs +18 -0
- package/dist/openai-operation.d.cts +19 -0
- package/dist/openai-operation.d.ts +19 -0
- package/dist/openai-operation.js +18 -0
- package/dist/outbound-api/auditCapture.cjs +3 -3
- package/dist/outbound-api/auditCapture.d.cts +19 -2
- package/dist/outbound-api/auditCapture.d.ts +19 -2
- package/dist/outbound-api/auditCapture.js +2 -2
- package/dist/outbound-api/auditRedact.cjs +2 -2
- package/dist/outbound-api/auditRedact.js +1 -1
- package/dist/outbound-api/routeResolver.cjs +2 -2
- package/dist/outbound-api/routeResolver.d.cts +7 -4
- package/dist/outbound-api/routeResolver.d.ts +7 -4
- package/dist/outbound-api/routeResolver.js +1 -1
- package/dist/outbound-api/subscriptionRegistryPort.d.cts +2 -1
- package/dist/outbound-api/subscriptionRegistryPort.d.ts +2 -1
- package/dist/outbound-api/types.d.cts +6 -3
- package/dist/outbound-api/types.d.ts +6 -3
- package/dist/outbound-api.cjs +49 -32
- package/dist/outbound-api.d.cts +97 -10
- package/dist/outbound-api.d.ts +97 -10
- package/dist/outbound-api.js +48 -31
- package/dist/pipeline/AccountAllowanceScheduling.d.cts +18 -15
- package/dist/pipeline/AccountAllowanceScheduling.d.ts +18 -15
- package/dist/pipeline/LlmConfigProviderAuth.cjs +3 -3
- package/dist/pipeline/LlmConfigProviderAuth.js +2 -2
- package/dist/pipeline/SubscriptionAccountHealth.cjs +2 -2
- package/dist/pipeline/SubscriptionAccountHealth.d.cts +7 -0
- package/dist/pipeline/SubscriptionAccountHealth.d.ts +7 -0
- package/dist/pipeline/SubscriptionAccountHealth.js +1 -1
- package/dist/pipeline/executeProviderCall.cjs +2 -2
- package/dist/pipeline/executeProviderCall.d.cts +11 -6
- package/dist/pipeline/executeProviderCall.d.ts +11 -6
- package/dist/pipeline/executeProviderCall.js +1 -1
- package/dist/pipeline/upstreamFetch.cjs +2 -2
- package/dist/pipeline/upstreamFetch.d.cts +5 -0
- package/dist/pipeline/upstreamFetch.d.ts +5 -0
- package/dist/pipeline/upstreamFetch.js +1 -1
- package/dist/ports.d.cts +6 -3
- package/dist/ports.d.ts +6 -3
- package/dist/provider-proxy/ProviderProxy.cjs +30 -27
- package/dist/provider-proxy/ProviderProxy.d.cts +3 -2
- package/dist/provider-proxy/ProviderProxy.d.ts +3 -2
- package/dist/provider-proxy/ProviderProxy.js +29 -26
- package/dist/provider-proxy/identity/codexCliHeaders.cjs +4 -2
- package/dist/provider-proxy/identity/codexCliHeaders.d.cts +26 -6
- package/dist/provider-proxy/identity/codexCliHeaders.d.ts +26 -6
- package/dist/provider-proxy/identity/codexCliHeaders.js +5 -3
- package/dist/provider-proxy/ingress/providerProxyShared.cjs +32 -27
- package/dist/provider-proxy/ingress/providerProxyShared.d.cts +21 -8
- package/dist/provider-proxy/ingress/providerProxyShared.d.ts +21 -8
- package/dist/provider-proxy/ingress/providerProxyShared.js +31 -26
- package/dist/provider-proxy/types.d.cts +14 -483
- package/dist/provider-proxy/types.d.ts +14 -483
- package/dist/provider-proxy.cjs +44 -27
- package/dist/provider-proxy.d.cts +30 -8
- package/dist/provider-proxy.d.ts +30 -8
- package/dist/provider-proxy.js +43 -26
- package/dist/{routeResolver-C0mkkZaM.d.ts → routeResolver-CTCcSHWu.d.ts} +4 -2
- package/dist/{routeResolver-CVFE8KKe.d.cts → routeResolver-rpKQLyDO.d.cts} +4 -2
- package/dist/transformer/TransformerChainExecutor.cjs +2 -2
- package/dist/transformer/TransformerChainExecutor.d.cts +2 -2
- package/dist/transformer/TransformerChainExecutor.d.ts +2 -2
- package/dist/transformer/TransformerChainExecutor.js +1 -1
- package/dist/transformer/transformers/AnthropicOpenAIToAnthropicStream.cjs +16 -0
- package/dist/transformer/transformers/AnthropicOpenAIToAnthropicStream.d.cts +53 -0
- package/dist/transformer/transformers/AnthropicOpenAIToAnthropicStream.d.ts +53 -0
- package/dist/transformer/transformers/AnthropicOpenAIToAnthropicStream.js +16 -0
- package/dist/transformer/transformers/AnthropicTransformer.cjs +4 -3
- package/dist/transformer/transformers/AnthropicTransformer.js +3 -2
- package/dist/transformer/transformers/GeminiCodeAssistTransformer.cjs +4 -4
- package/dist/transformer/transformers/GeminiCodeAssistTransformer.js +3 -3
- package/dist/transformer/transformers/GeminiTransformer.cjs +4 -4
- package/dist/transformer/transformers/GeminiTransformer.js +3 -3
- package/dist/transformer/transformers/OpenAIResponseTransformer.cjs +3 -3
- package/dist/transformer/transformers/OpenAIResponseTransformer.js +2 -2
- package/dist/transformer/transformers/OpenAITransformer.cjs +3 -3
- package/dist/transformer/transformers/OpenAITransformer.js +2 -2
- package/dist/transformer/transformers.cjs +10 -9
- package/dist/transformer/transformers.js +13 -12
- package/dist/transformer/types.d.cts +39 -4
- package/dist/transformer/types.d.ts +39 -4
- package/dist/transformer.cjs +14 -13
- package/dist/transformer.js +14 -13
- package/dist/{types-BB8pxk_3.d.ts → types-5T223WYQ.d.ts} +183 -23
- package/dist/types-Bd72H4SB.d.ts +196 -0
- package/dist/types-CVRge76p.d.ts +1115 -0
- package/dist/types-CbglB73l.d.cts +196 -0
- package/dist/types-DsHBBk3h.d.cts +1115 -0
- package/dist/{types-C2MwkLah.d.cts → types-jjU24eYG.d.cts} +183 -23
- package/dist/usage/usage-recorder.cjs +2 -2
- package/dist/usage/usage-recorder.d.cts +12 -2
- package/dist/usage/usage-recorder.d.ts +12 -2
- package/dist/usage/usage-recorder.js +1 -1
- package/dist/usage.cjs +20 -3
- package/dist/usage.d.cts +154 -0
- package/dist/usage.d.ts +154 -0
- package/dist/usage.js +20 -3
- package/package.json +69 -64
- package/dist/chunk-7C7DET6S.js +0 -154
- package/dist/chunk-7VU7V2E4.js +0 -0
- package/dist/chunk-EYZYXJTJ.cjs +0 -1
- package/dist/chunk-FCR77GYM.cjs +0 -33
- package/dist/chunk-K5NM7VAH.js +0 -33
- package/dist/chunk-XPIOJQS2.cjs +0 -154
- /package/dist/{chunk-XXFYLL7R.js → chunk-ECZ3ZE2C.js} +0 -0
- /package/dist/{chunk-3SCOLIPT.cjs → chunk-MXI2PWIC.cjs} +0 -0
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* headerMerge — the shared outbound-header merge primitive used by the
|
|
3
|
+
* per-client header builders (`claudeCodeHeaders`, `codexCliHeaders`).
|
|
4
|
+
*
|
|
5
|
+
* Split out so neither builder has to import the other just to reuse the merge.
|
|
6
|
+
*
|
|
7
|
+
* @module provider-proxy/identity/headerMerge
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Copy every entry of `source` into `headers` that `headers` does not already
|
|
11
|
+
* carry (case-insensitive on the existing keys, so an `Authorization` set by the
|
|
12
|
+
* auth strategy is never shadowed by an `authorization` from a caller bag).
|
|
13
|
+
* Existing values ALWAYS win — this only fills empty slots, which is what makes
|
|
14
|
+
* the precedence chain (auth > frozen fingerprint > caller > defaults) work by
|
|
15
|
+
* simply calling it in order.
|
|
16
|
+
*/
|
|
17
|
+
declare function fillMissingHeaders(headers: Record<string, string>, source: Readonly<Record<string, string>>): void;
|
|
18
|
+
|
|
1
19
|
/**
|
|
2
20
|
* codexCliHeaders — the Codex CLI client headers the CODEX SUBSCRIPTION relay
|
|
3
21
|
* puts on every `chatgpt.com/backend-api/codex/responses` request.
|
|
@@ -14,24 +32,26 @@
|
|
|
14
32
|
* shares this relay and must stay byte-identical — sending it `originator:
|
|
15
33
|
* codex_cli_rs` would be wrong and could trip its own checks.
|
|
16
34
|
*
|
|
17
|
-
* Modeled on
|
|
35
|
+
* Modeled on observed Codex CLI-compatible relay behavior.
|
|
18
36
|
*
|
|
19
37
|
* NOT DONE HERE (deliberate, see the relay call site):
|
|
20
|
-
* - `chatgpt-account-id`:
|
|
21
|
-
* OAuth `id_token`. Guessing it wrong risks a 403 on a
|
|
22
|
-
* works, so it is left to a follow-up that can verify
|
|
38
|
+
* - `chatgpt-account-id`: compatible implementations send the ChatGPT account
|
|
39
|
+
* id parsed out of the OAuth `id_token`. Guessing it wrong risks a 403 on a
|
|
40
|
+
* path that currently works, so it is left to a follow-up that can verify it.
|
|
23
41
|
* - forcing `store: false` on the body: a body mutation with its own regression
|
|
24
42
|
* surface, tracked separately.
|
|
25
43
|
*
|
|
26
44
|
* @module provider-proxy/identity/codexCliHeaders
|
|
27
45
|
*/
|
|
46
|
+
|
|
28
47
|
/**
|
|
29
48
|
* Client markers a real `codex` CLI invocation carries. Used ONLY to fill a slot
|
|
30
49
|
* the caller left empty — a forwarded real value always wins, so a genuine Codex
|
|
31
50
|
* CLI keeps its own identity and only a caller that sent nothing gets these.
|
|
32
51
|
*
|
|
33
52
|
* `originator` is the load-bearing one: it is how the backend tells the Codex
|
|
34
|
-
* CLI apart from a generic Responses client,
|
|
53
|
+
* CLI apart from a generic Responses client, so compatible relays send it
|
|
54
|
+
* unconditionally.
|
|
35
55
|
*/
|
|
36
56
|
declare const DEFAULT_CODEX_CLI_HEADERS: Readonly<Record<string, string>>;
|
|
37
57
|
/**
|
|
@@ -42,4 +62,4 @@ declare function extractCodexClientHeaders(reqHeaders: Record<string, string | s
|
|
|
42
62
|
/** The `accept` a Codex CLI sends, which differs by streaming mode. */
|
|
43
63
|
declare function codexAcceptHeader(isStream: boolean): string;
|
|
44
64
|
|
|
45
|
-
export { DEFAULT_CODEX_CLI_HEADERS, codexAcceptHeader, extractCodexClientHeaders };
|
|
65
|
+
export { DEFAULT_CODEX_CLI_HEADERS, codexAcceptHeader, extractCodexClientHeaders, fillMissingHeaders };
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DEFAULT_CODEX_CLI_HEADERS,
|
|
3
3
|
codexAcceptHeader,
|
|
4
|
-
extractCodexClientHeaders
|
|
5
|
-
|
|
4
|
+
extractCodexClientHeaders,
|
|
5
|
+
fillMissingHeaders
|
|
6
|
+
} from "../../chunk-ECZ3ZE2C.js";
|
|
6
7
|
export {
|
|
7
8
|
DEFAULT_CODEX_CLI_HEADERS,
|
|
8
9
|
codexAcceptHeader,
|
|
9
|
-
extractCodexClientHeaders
|
|
10
|
+
extractCodexClientHeaders,
|
|
11
|
+
fillMissingHeaders
|
|
10
12
|
};
|
|
@@ -9,61 +9,65 @@
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
|
|
13
|
+
var _chunk7B56AJBBcjs = require('../../chunk-7B56AJBB.cjs');
|
|
13
14
|
require('../../chunk-HQP3K7PU.cjs');
|
|
14
15
|
require('../../chunk-QVOB2DNX.cjs');
|
|
15
|
-
require('../../chunk-
|
|
16
|
-
require('../../chunk-
|
|
17
|
-
require('../../chunk-
|
|
18
|
-
require('../../chunk-
|
|
16
|
+
require('../../chunk-7ZHBN75N.cjs');
|
|
17
|
+
require('../../chunk-3OPYJG76.cjs');
|
|
18
|
+
require('../../chunk-TVYA5JSQ.cjs');
|
|
19
|
+
require('../../chunk-NOITAVHA.cjs');
|
|
20
|
+
require('../../chunk-QWNUOR7F.cjs');
|
|
21
|
+
require('../../chunk-SQMAEDNE.cjs');
|
|
19
22
|
require('../../chunk-5RSZYQJH.cjs');
|
|
20
|
-
require('../../chunk-
|
|
21
|
-
require('../../chunk-
|
|
23
|
+
require('../../chunk-6DDYNS2B.cjs');
|
|
24
|
+
require('../../chunk-KIQ2HA2A.cjs');
|
|
25
|
+
require('../../chunk-32SRZFFP.cjs');
|
|
22
26
|
require('../../chunk-2E42SAW3.cjs');
|
|
23
|
-
require('../../chunk-
|
|
24
|
-
require('../../chunk-IIRPUVPH.cjs');
|
|
27
|
+
require('../../chunk-5UK3KLE2.cjs');
|
|
25
28
|
require('../../chunk-GBHYAGX3.cjs');
|
|
26
|
-
require('../../chunk-
|
|
27
|
-
require('../../chunk-3SCOLIPT.cjs');
|
|
29
|
+
require('../../chunk-MXI2PWIC.cjs');
|
|
28
30
|
require('../../chunk-RPII3E6Z.cjs');
|
|
29
31
|
require('../../chunk-6RPZADX3.cjs');
|
|
30
32
|
require('../../chunk-J3QQ6JS5.cjs');
|
|
31
33
|
require('../../chunk-UIBD2YY5.cjs');
|
|
32
34
|
require('../../chunk-R3HK6R4B.cjs');
|
|
35
|
+
require('../../chunk-KQBLZMP6.cjs');
|
|
36
|
+
require('../../chunk-OIKREZVQ.cjs');
|
|
33
37
|
require('../../chunk-QXD4MV2X.cjs');
|
|
34
38
|
require('../../chunk-NYUNU75A.cjs');
|
|
35
39
|
require('../../chunk-OTZC4TNH.cjs');
|
|
36
|
-
require('../../chunk-
|
|
40
|
+
require('../../chunk-7LRTPNFL.cjs');
|
|
37
41
|
require('../../chunk-YNJNTCSQ.cjs');
|
|
38
42
|
require('../../chunk-SVNDB62D.cjs');
|
|
39
43
|
require('../../chunk-6QQG7YG3.cjs');
|
|
40
44
|
require('../../chunk-25GXJCEZ.cjs');
|
|
41
|
-
require('../../chunk-
|
|
42
|
-
require('../../chunk-
|
|
45
|
+
require('../../chunk-FX325I5Q.cjs');
|
|
46
|
+
require('../../chunk-AEOZIDEB.cjs');
|
|
47
|
+
require('../../chunk-HCOQQAZE.cjs');
|
|
43
48
|
require('../../chunk-APYG5QD7.cjs');
|
|
44
49
|
require('../../chunk-L74VDN4A.cjs');
|
|
50
|
+
require('../../chunk-XSVNC2UD.cjs');
|
|
45
51
|
require('../../chunk-4YINUUKQ.cjs');
|
|
46
|
-
require('../../chunk-
|
|
52
|
+
require('../../chunk-T6NWPIYZ.cjs');
|
|
47
53
|
require('../../chunk-QBZJ7P2T.cjs');
|
|
48
54
|
require('../../chunk-4IH4EL7M.cjs');
|
|
55
|
+
require('../../chunk-JMJBSACD.cjs');
|
|
56
|
+
require('../../chunk-GMMT7RVN.cjs');
|
|
57
|
+
require('../../chunk-UNEFIWXI.cjs');
|
|
49
58
|
require('../../chunk-A2YMUCBT.cjs');
|
|
50
|
-
require('../../chunk-XPIOJQS2.cjs');
|
|
51
|
-
require('../../chunk-FCR77GYM.cjs');
|
|
52
|
-
require('../../chunk-AEOZIDEB.cjs');
|
|
53
|
-
require('../../chunk-XSVNC2UD.cjs');
|
|
54
59
|
require('../../chunk-GDIXXKF2.cjs');
|
|
55
|
-
require('../../chunk-
|
|
56
|
-
require('../../chunk-
|
|
60
|
+
require('../../chunk-VXRTQZF2.cjs');
|
|
61
|
+
require('../../chunk-WX2E2G7H.cjs');
|
|
57
62
|
require('../../chunk-77USGNRW.cjs');
|
|
58
|
-
require('../../chunk-
|
|
59
|
-
require('../../chunk-
|
|
63
|
+
require('../../chunk-IUL4VWNU.cjs');
|
|
64
|
+
require('../../chunk-OST5RJOJ.cjs');
|
|
60
65
|
require('../../chunk-235MXAGX.cjs');
|
|
61
66
|
require('../../chunk-HVBBDBS3.cjs');
|
|
62
67
|
require('../../chunk-NKVZ6Z3Y.cjs');
|
|
68
|
+
require('../../chunk-CTKM773J.cjs');
|
|
69
|
+
require('../../chunk-G4CZIUIB.cjs');
|
|
63
70
|
require('../../chunk-NZYN7C3P.cjs');
|
|
64
|
-
require('../../chunk-JMJBSACD.cjs');
|
|
65
|
-
require('../../chunk-GMMT7RVN.cjs');
|
|
66
|
-
require('../../chunk-UNEFIWXI.cjs');
|
|
67
71
|
|
|
68
72
|
|
|
69
73
|
|
|
@@ -75,4 +79,5 @@ require('../../chunk-UNEFIWXI.cjs');
|
|
|
75
79
|
|
|
76
80
|
|
|
77
81
|
|
|
78
|
-
|
|
82
|
+
|
|
83
|
+
exports.aggregateAnthropicSseToJsonBody = _chunk7B56AJBBcjs.aggregateAnthropicSseToJsonBody; exports.getAnthropicEndpointTransformer = _chunk7B56AJBBcjs.getAnthropicEndpointTransformer; exports.getGeminiEndpointTransformer = _chunk7B56AJBBcjs.getGeminiEndpointTransformer; exports.getResponsesEndpointTransformer = _chunk7B56AJBBcjs.getResponsesEndpointTransformer; exports.getSharedExecutor = _chunk7B56AJBBcjs.getSharedExecutor; exports.projectUpstreamResponseHeaders = _chunk7B56AJBBcjs.projectUpstreamResponseHeaders; exports.readBody = _chunk7B56AJBBcjs.readBody; exports.relayResponse = _chunk7B56AJBBcjs.relayResponse; exports.resolvePoolBoundKey = _chunk7B56AJBBcjs.resolvePoolBoundKey; exports.writeBoundAccountError = _chunk7B56AJBBcjs.writeBoundAccountError; exports.writeError = _chunk7B56AJBBcjs.writeError;
|
|
@@ -3,7 +3,7 @@ import { LLMProvider } from '@omnicross/contracts/llm-config';
|
|
|
3
3
|
import { BoundAccountSelectionError } from '../../pipeline/BoundAccountSelectionError.cjs';
|
|
4
4
|
import { TransformerChainExecutor } from '../../transformer/TransformerChainExecutor.cjs';
|
|
5
5
|
import { Transformer } from '../../transformer/types.cjs';
|
|
6
|
-
import { ProviderProxyDeps } from '
|
|
6
|
+
import { W as ProviderProxyDeps } from '../../types-DsHBBk3h.cjs';
|
|
7
7
|
import '@omnicross/contracts/completion-types';
|
|
8
8
|
import '@omnicross/contracts/usage-stats-types';
|
|
9
9
|
import '@omnicross/contracts/subscription-types';
|
|
@@ -17,6 +17,7 @@ import '../../ports/provider-config-source.cjs';
|
|
|
17
17
|
import '../../transformer/TransformerService.cjs';
|
|
18
18
|
import '../../ports/web-search-backend.cjs';
|
|
19
19
|
import '@omnicross/contracts/websearch-types';
|
|
20
|
+
import '@omnicross/contracts/image-generation-types';
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
23
|
* Shared helpers for the ProviderProxy ingress parsers.
|
|
@@ -37,8 +38,8 @@ declare function getSharedExecutor(): TransformerChainExecutor;
|
|
|
37
38
|
declare function getResponsesEndpointTransformer(): Transformer;
|
|
38
39
|
declare function getAnthropicEndpointTransformer(): Transformer;
|
|
39
40
|
declare function getGeminiEndpointTransformer(): Transformer;
|
|
40
|
-
/** Read the full request body from an IncomingMessage. */
|
|
41
|
-
declare function readBody(req: http.IncomingMessage): Promise<string>;
|
|
41
|
+
/** Read the full request body from an IncomingMessage with deterministic listener cleanup. */
|
|
42
|
+
declare function readBody(req: http.IncomingMessage, signal?: AbortSignal): Promise<string>;
|
|
42
43
|
/**
|
|
43
44
|
* A usage tap for {@link relayResponse}'s stream branch. Streaming responses were
|
|
44
45
|
* previously not metered (only the non-stream branch recorded usage), so Codex
|
|
@@ -61,9 +62,12 @@ interface StreamUsageTap {
|
|
|
61
62
|
/** Called once at stream end with the last captured usage (only if any). */
|
|
62
63
|
onUsage(rawUsage: Record<string, unknown>): void;
|
|
63
64
|
}
|
|
65
|
+
/** Project only explicitly safe end-to-end upstream response metadata. */
|
|
66
|
+
declare function projectUpstreamResponseHeaders(headers: Headers, upstreamIsSse: boolean): Record<string, string>;
|
|
64
67
|
/**
|
|
65
68
|
* Relay an already-wire-shaped `Response` to the http `res`.
|
|
66
|
-
* - `text/event-stream
|
|
69
|
+
* - explicit `text/event-stream`, or a confirmed headerless SSE compatibility
|
|
70
|
+
* response: pipe the ReadableStream chunk-by-chunk.
|
|
67
71
|
* - else: read the JSON text and write it once, returning it so the caller can
|
|
68
72
|
* tap usage. Mirrors the host's codex relay.
|
|
69
73
|
*
|
|
@@ -87,7 +91,7 @@ declare function relayResponse(res: http.ServerResponse, providerResponse: Respo
|
|
|
87
91
|
* server-overload event. When present, forces the line-based relay path so
|
|
88
92
|
* events are parsed even without a `rewriteModel`/`usageTap`.
|
|
89
93
|
*/
|
|
90
|
-
onSseEvent?: (event: Record<string, unknown>) => void): Promise<string | null>;
|
|
94
|
+
onSseEvent?: (event: Record<string, unknown>) => void, signal?: AbortSignal): Promise<string | null>;
|
|
91
95
|
/**
|
|
92
96
|
* Aggregate a streaming Anthropic `text/event-stream` body into ONE buffered
|
|
93
97
|
* Anthropic `message` JSON object — the inverse of the SDK's SSE wire format.
|
|
@@ -104,12 +108,21 @@ onSseEvent?: (event: Record<string, unknown>) => void): Promise<string | null>;
|
|
|
104
108
|
* Best-effort: a malformed event is skipped, never thrown.
|
|
105
109
|
*/
|
|
106
110
|
declare function aggregateAnthropicSseToJsonBody(response: Response, rewriteModel?: string): Promise<string>;
|
|
107
|
-
/**
|
|
111
|
+
/**
|
|
112
|
+
* Write a JSON error response if the headers have not been sent.
|
|
113
|
+
*
|
|
114
|
+
* On an Anthropic-protocol request (res marked at the pipeline entry — see
|
|
115
|
+
* `anthropicErrorEnvelope`) the body takes the Anthropic error shape so
|
|
116
|
+
* Anthropic SDK clients can type-parse it; every other path keeps the legacy
|
|
117
|
+
* `provider_proxy_error` envelope byte-for-byte.
|
|
118
|
+
*/
|
|
108
119
|
declare function writeError(res: http.ServerResponse, status: number, message: string): void;
|
|
109
120
|
/**
|
|
110
121
|
* Map a strict bound-account failure to a stable structured response. The body
|
|
111
122
|
* carries only the fixed code/reason/message; account ids, tokens, and upstream
|
|
112
|
-
* error text never cross the wire.
|
|
123
|
+
* error text never cross the wire. On a marked Anthropic-protocol response the
|
|
124
|
+
* stable `code`/`reason` fields fold INTO the Anthropic `error` object and the
|
|
125
|
+
* `Retry-After` header is preserved.
|
|
113
126
|
*/
|
|
114
127
|
declare function writeBoundAccountError(res: http.ServerResponse, error: BoundAccountSelectionError): void;
|
|
115
128
|
/**
|
|
@@ -142,4 +155,4 @@ declare function writeBoundAccountError(res: http.ServerResponse, error: BoundAc
|
|
|
142
155
|
*/
|
|
143
156
|
declare function resolvePoolBoundKey(deps: ProviderProxyDeps, providerId: string, provider: LLMProvider, sessionId: string | null, preferredKeyId?: string, boundKeyFallbackPolicy?: 'strict' | 'pool'): Promise<string>;
|
|
144
157
|
|
|
145
|
-
export { type StreamUsageTap, aggregateAnthropicSseToJsonBody, getAnthropicEndpointTransformer, getGeminiEndpointTransformer, getResponsesEndpointTransformer, getSharedExecutor, readBody, relayResponse, resolvePoolBoundKey, writeBoundAccountError, writeError };
|
|
158
|
+
export { type StreamUsageTap, aggregateAnthropicSseToJsonBody, getAnthropicEndpointTransformer, getGeminiEndpointTransformer, getResponsesEndpointTransformer, getSharedExecutor, projectUpstreamResponseHeaders, readBody, relayResponse, resolvePoolBoundKey, writeBoundAccountError, writeError };
|
|
@@ -3,7 +3,7 @@ import { LLMProvider } from '@omnicross/contracts/llm-config';
|
|
|
3
3
|
import { BoundAccountSelectionError } from '../../pipeline/BoundAccountSelectionError.js';
|
|
4
4
|
import { TransformerChainExecutor } from '../../transformer/TransformerChainExecutor.js';
|
|
5
5
|
import { Transformer } from '../../transformer/types.js';
|
|
6
|
-
import { ProviderProxyDeps } from '
|
|
6
|
+
import { W as ProviderProxyDeps } from '../../types-CVRge76p.js';
|
|
7
7
|
import '@omnicross/contracts/completion-types';
|
|
8
8
|
import '@omnicross/contracts/usage-stats-types';
|
|
9
9
|
import '@omnicross/contracts/subscription-types';
|
|
@@ -17,6 +17,7 @@ import '../../ports/provider-config-source.js';
|
|
|
17
17
|
import '../../transformer/TransformerService.js';
|
|
18
18
|
import '../../ports/web-search-backend.js';
|
|
19
19
|
import '@omnicross/contracts/websearch-types';
|
|
20
|
+
import '@omnicross/contracts/image-generation-types';
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
23
|
* Shared helpers for the ProviderProxy ingress parsers.
|
|
@@ -37,8 +38,8 @@ declare function getSharedExecutor(): TransformerChainExecutor;
|
|
|
37
38
|
declare function getResponsesEndpointTransformer(): Transformer;
|
|
38
39
|
declare function getAnthropicEndpointTransformer(): Transformer;
|
|
39
40
|
declare function getGeminiEndpointTransformer(): Transformer;
|
|
40
|
-
/** Read the full request body from an IncomingMessage. */
|
|
41
|
-
declare function readBody(req: http.IncomingMessage): Promise<string>;
|
|
41
|
+
/** Read the full request body from an IncomingMessage with deterministic listener cleanup. */
|
|
42
|
+
declare function readBody(req: http.IncomingMessage, signal?: AbortSignal): Promise<string>;
|
|
42
43
|
/**
|
|
43
44
|
* A usage tap for {@link relayResponse}'s stream branch. Streaming responses were
|
|
44
45
|
* previously not metered (only the non-stream branch recorded usage), so Codex
|
|
@@ -61,9 +62,12 @@ interface StreamUsageTap {
|
|
|
61
62
|
/** Called once at stream end with the last captured usage (only if any). */
|
|
62
63
|
onUsage(rawUsage: Record<string, unknown>): void;
|
|
63
64
|
}
|
|
65
|
+
/** Project only explicitly safe end-to-end upstream response metadata. */
|
|
66
|
+
declare function projectUpstreamResponseHeaders(headers: Headers, upstreamIsSse: boolean): Record<string, string>;
|
|
64
67
|
/**
|
|
65
68
|
* Relay an already-wire-shaped `Response` to the http `res`.
|
|
66
|
-
* - `text/event-stream
|
|
69
|
+
* - explicit `text/event-stream`, or a confirmed headerless SSE compatibility
|
|
70
|
+
* response: pipe the ReadableStream chunk-by-chunk.
|
|
67
71
|
* - else: read the JSON text and write it once, returning it so the caller can
|
|
68
72
|
* tap usage. Mirrors the host's codex relay.
|
|
69
73
|
*
|
|
@@ -87,7 +91,7 @@ declare function relayResponse(res: http.ServerResponse, providerResponse: Respo
|
|
|
87
91
|
* server-overload event. When present, forces the line-based relay path so
|
|
88
92
|
* events are parsed even without a `rewriteModel`/`usageTap`.
|
|
89
93
|
*/
|
|
90
|
-
onSseEvent?: (event: Record<string, unknown>) => void): Promise<string | null>;
|
|
94
|
+
onSseEvent?: (event: Record<string, unknown>) => void, signal?: AbortSignal): Promise<string | null>;
|
|
91
95
|
/**
|
|
92
96
|
* Aggregate a streaming Anthropic `text/event-stream` body into ONE buffered
|
|
93
97
|
* Anthropic `message` JSON object — the inverse of the SDK's SSE wire format.
|
|
@@ -104,12 +108,21 @@ onSseEvent?: (event: Record<string, unknown>) => void): Promise<string | null>;
|
|
|
104
108
|
* Best-effort: a malformed event is skipped, never thrown.
|
|
105
109
|
*/
|
|
106
110
|
declare function aggregateAnthropicSseToJsonBody(response: Response, rewriteModel?: string): Promise<string>;
|
|
107
|
-
/**
|
|
111
|
+
/**
|
|
112
|
+
* Write a JSON error response if the headers have not been sent.
|
|
113
|
+
*
|
|
114
|
+
* On an Anthropic-protocol request (res marked at the pipeline entry — see
|
|
115
|
+
* `anthropicErrorEnvelope`) the body takes the Anthropic error shape so
|
|
116
|
+
* Anthropic SDK clients can type-parse it; every other path keeps the legacy
|
|
117
|
+
* `provider_proxy_error` envelope byte-for-byte.
|
|
118
|
+
*/
|
|
108
119
|
declare function writeError(res: http.ServerResponse, status: number, message: string): void;
|
|
109
120
|
/**
|
|
110
121
|
* Map a strict bound-account failure to a stable structured response. The body
|
|
111
122
|
* carries only the fixed code/reason/message; account ids, tokens, and upstream
|
|
112
|
-
* error text never cross the wire.
|
|
123
|
+
* error text never cross the wire. On a marked Anthropic-protocol response the
|
|
124
|
+
* stable `code`/`reason` fields fold INTO the Anthropic `error` object and the
|
|
125
|
+
* `Retry-After` header is preserved.
|
|
113
126
|
*/
|
|
114
127
|
declare function writeBoundAccountError(res: http.ServerResponse, error: BoundAccountSelectionError): void;
|
|
115
128
|
/**
|
|
@@ -142,4 +155,4 @@ declare function writeBoundAccountError(res: http.ServerResponse, error: BoundAc
|
|
|
142
155
|
*/
|
|
143
156
|
declare function resolvePoolBoundKey(deps: ProviderProxyDeps, providerId: string, provider: LLMProvider, sessionId: string | null, preferredKeyId?: string, boundKeyFallbackPolicy?: 'strict' | 'pool'): Promise<string>;
|
|
144
157
|
|
|
145
|
-
export { type StreamUsageTap, aggregateAnthropicSseToJsonBody, getAnthropicEndpointTransformer, getGeminiEndpointTransformer, getResponsesEndpointTransformer, getSharedExecutor, readBody, relayResponse, resolvePoolBoundKey, writeBoundAccountError, writeError };
|
|
158
|
+
export { type StreamUsageTap, aggregateAnthropicSseToJsonBody, getAnthropicEndpointTransformer, getGeminiEndpointTransformer, getResponsesEndpointTransformer, getSharedExecutor, projectUpstreamResponseHeaders, readBody, relayResponse, resolvePoolBoundKey, writeBoundAccountError, writeError };
|
|
@@ -4,72 +4,77 @@ import {
|
|
|
4
4
|
getGeminiEndpointTransformer,
|
|
5
5
|
getResponsesEndpointTransformer,
|
|
6
6
|
getSharedExecutor,
|
|
7
|
+
projectUpstreamResponseHeaders,
|
|
7
8
|
readBody,
|
|
8
9
|
relayResponse,
|
|
9
10
|
resolvePoolBoundKey,
|
|
10
11
|
writeBoundAccountError,
|
|
11
12
|
writeError
|
|
12
|
-
} from "../../chunk-
|
|
13
|
+
} from "../../chunk-WSJE42SG.js";
|
|
13
14
|
import "../../chunk-VVEHS2LI.js";
|
|
14
15
|
import "../../chunk-WTQMX2Q6.js";
|
|
15
|
-
import "../../chunk-
|
|
16
|
-
import "../../chunk-
|
|
17
|
-
import "../../chunk-
|
|
18
|
-
import "../../chunk-
|
|
16
|
+
import "../../chunk-EYGBM2VC.js";
|
|
17
|
+
import "../../chunk-DK4A7DLE.js";
|
|
18
|
+
import "../../chunk-FJNKXOWE.js";
|
|
19
|
+
import "../../chunk-V53ZEFXC.js";
|
|
20
|
+
import "../../chunk-7PIUVCKK.js";
|
|
21
|
+
import "../../chunk-6OC3ORW6.js";
|
|
19
22
|
import "../../chunk-FU7EAR73.js";
|
|
20
|
-
import "../../chunk-
|
|
21
|
-
import "../../chunk-
|
|
23
|
+
import "../../chunk-LFEH7CEO.js";
|
|
24
|
+
import "../../chunk-HN74IGEO.js";
|
|
25
|
+
import "../../chunk-QIIAMBTM.js";
|
|
22
26
|
import "../../chunk-FXR6N3SR.js";
|
|
23
|
-
import "../../chunk-
|
|
24
|
-
import "../../chunk-WNKWAEUR.js";
|
|
27
|
+
import "../../chunk-AQDON6MB.js";
|
|
25
28
|
import "../../chunk-MZNPGW5Q.js";
|
|
26
|
-
import "../../chunk-
|
|
27
|
-
import "../../chunk-XXFYLL7R.js";
|
|
29
|
+
import "../../chunk-ECZ3ZE2C.js";
|
|
28
30
|
import "../../chunk-XTEI64OU.js";
|
|
29
31
|
import "../../chunk-XX6NQJMA.js";
|
|
30
32
|
import "../../chunk-GFIZ6LQI.js";
|
|
31
33
|
import "../../chunk-OE6TDIWW.js";
|
|
32
34
|
import "../../chunk-DRWHTIIZ.js";
|
|
35
|
+
import "../../chunk-X335TJNS.js";
|
|
36
|
+
import "../../chunk-HOMUGKHR.js";
|
|
33
37
|
import "../../chunk-JWC6APFQ.js";
|
|
34
38
|
import "../../chunk-5ERIZW3D.js";
|
|
35
39
|
import "../../chunk-PO3XB56Z.js";
|
|
36
|
-
import "../../chunk-
|
|
40
|
+
import "../../chunk-V2UKUTJ3.js";
|
|
37
41
|
import "../../chunk-23S5OPIO.js";
|
|
38
42
|
import "../../chunk-AVYJ4YBN.js";
|
|
39
43
|
import "../../chunk-OPRS4IQZ.js";
|
|
40
44
|
import "../../chunk-2JYRIADS.js";
|
|
41
|
-
import "../../chunk-
|
|
42
|
-
import "../../chunk-
|
|
45
|
+
import "../../chunk-6OKXH2TW.js";
|
|
46
|
+
import "../../chunk-WNY4WMRF.js";
|
|
47
|
+
import "../../chunk-N76KU6F5.js";
|
|
43
48
|
import "../../chunk-WLYIIEAF.js";
|
|
44
49
|
import "../../chunk-TKJMZBAH.js";
|
|
50
|
+
import "../../chunk-OZFM4X3S.js";
|
|
45
51
|
import "../../chunk-3QFXFCHG.js";
|
|
46
|
-
import "../../chunk-
|
|
52
|
+
import "../../chunk-U47LQXPB.js";
|
|
47
53
|
import "../../chunk-AQ5TNQB7.js";
|
|
48
54
|
import "../../chunk-XEKD23J5.js";
|
|
55
|
+
import "../../chunk-Y7FO65VT.js";
|
|
56
|
+
import "../../chunk-FMOBD2OQ.js";
|
|
57
|
+
import "../../chunk-HUZZZ3JL.js";
|
|
49
58
|
import "../../chunk-H5JUT3KV.js";
|
|
50
|
-
import "../../chunk-7C7DET6S.js";
|
|
51
|
-
import "../../chunk-K5NM7VAH.js";
|
|
52
|
-
import "../../chunk-WNY4WMRF.js";
|
|
53
|
-
import "../../chunk-OZFM4X3S.js";
|
|
54
59
|
import "../../chunk-5NJLQ6T6.js";
|
|
55
|
-
import "../../chunk-
|
|
56
|
-
import "../../chunk-
|
|
60
|
+
import "../../chunk-4VVCXVB7.js";
|
|
61
|
+
import "../../chunk-R4VCO2CB.js";
|
|
57
62
|
import "../../chunk-WYVGULTQ.js";
|
|
58
|
-
import "../../chunk-
|
|
59
|
-
import "../../chunk-
|
|
63
|
+
import "../../chunk-ZLNHPUFA.js";
|
|
64
|
+
import "../../chunk-CFSGYFOZ.js";
|
|
60
65
|
import "../../chunk-3WD4HTR2.js";
|
|
61
66
|
import "../../chunk-MKF46GNZ.js";
|
|
62
67
|
import "../../chunk-GL6XM527.js";
|
|
68
|
+
import "../../chunk-DEIUR2TH.js";
|
|
69
|
+
import "../../chunk-4JOU54M5.js";
|
|
63
70
|
import "../../chunk-CDHS2QDC.js";
|
|
64
|
-
import "../../chunk-Y7FO65VT.js";
|
|
65
|
-
import "../../chunk-FMOBD2OQ.js";
|
|
66
|
-
import "../../chunk-HUZZZ3JL.js";
|
|
67
71
|
export {
|
|
68
72
|
aggregateAnthropicSseToJsonBody,
|
|
69
73
|
getAnthropicEndpointTransformer,
|
|
70
74
|
getGeminiEndpointTransformer,
|
|
71
75
|
getResponsesEndpointTransformer,
|
|
72
76
|
getSharedExecutor,
|
|
77
|
+
projectUpstreamResponseHeaders,
|
|
73
78
|
readBody,
|
|
74
79
|
relayResponse,
|
|
75
80
|
resolvePoolBoundKey,
|