@omnicross/core 0.1.10 → 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.
Files changed (166) hide show
  1. package/LICENSE +21 -21
  2. package/NOTICE +57 -57
  3. package/README.md +22 -15
  4. package/dist/{CompletionService-kNA17cfI.d.cts → CompletionService-BiJqftc-.d.cts} +1 -1
  5. package/dist/{CompletionService-C3BX0Ovy.d.ts → CompletionService-NXN_Av5W.d.ts} +1 -1
  6. package/dist/{ProviderProxy-QdwNV6l1.d.cts → ProviderProxy-CgIcCVwk.d.cts} +1 -1
  7. package/dist/{ProviderProxy--ROec6VI.d.ts → ProviderProxy-DYoY5XoT.d.ts} +1 -1
  8. package/dist/auth/GeminiCodeAssistProjectResolver.cjs +6 -6
  9. package/dist/auth/GeminiCodeAssistProjectResolver.js +4 -4
  10. package/dist/{chunk-QUSEZNYS.cjs → chunk-32SRZFFP.cjs} +4 -1
  11. package/dist/chunk-4JOU54M5.js +200 -0
  12. package/dist/{chunk-2UTGX6FM.js → chunk-4VVCXVB7.js} +1 -1
  13. package/dist/chunk-6DDYNS2B.cjs +384 -0
  14. package/dist/{chunk-HKB656B4.js → chunk-6OC3ORW6.js} +55 -287
  15. package/dist/{chunk-GXEZ2R3E.js → chunk-6OKXH2TW.js} +18 -7
  16. package/dist/{chunk-TIT74RIL.cjs → chunk-7B56AJBB.cjs} +6214 -2423
  17. package/dist/{chunk-YWL7YZWS.cjs → chunk-7LRTPNFL.cjs} +5 -0
  18. package/dist/{chunk-CCVRRJOX.js → chunk-7PIUVCKK.js} +9 -2
  19. package/dist/{chunk-IIRPUVPH.cjs → chunk-7ZHBN75N.cjs} +3 -1
  20. package/dist/{chunk-RJ5ZGNI3.js → chunk-CFSGYFOZ.js} +1 -1
  21. package/dist/chunk-CTKM773J.cjs +3919 -0
  22. package/dist/chunk-DEIUR2TH.js +3919 -0
  23. package/dist/{chunk-WNKWAEUR.js → chunk-EYGBM2VC.js} +3 -1
  24. package/dist/{chunk-NGYOO5TO.js → chunk-FJNKXOWE.js} +9 -9
  25. package/dist/{chunk-UWDW6PN3.cjs → chunk-FX325I5Q.cjs} +20 -9
  26. package/dist/chunk-G4CZIUIB.cjs +200 -0
  27. package/dist/chunk-HCOQQAZE.cjs +123 -0
  28. package/dist/{chunk-55FMGZ3L.js → chunk-HN74IGEO.js} +1 -1
  29. package/dist/{chunk-ZY6KU6P3.js → chunk-HOMUGKHR.js} +8 -5
  30. package/dist/{chunk-AOFWNWLT.cjs → chunk-IUL4VWNU.cjs} +22 -1
  31. package/dist/{chunk-5LNYGCIW.cjs → chunk-KIQ2HA2A.cjs} +5 -5
  32. package/dist/{chunk-MUHWHQVM.cjs → chunk-KQBLZMP6.cjs} +4 -3
  33. package/dist/chunk-LFEH7CEO.js +384 -0
  34. package/dist/chunk-N76KU6F5.js +123 -0
  35. package/dist/{chunk-CMVXX7ON.cjs → chunk-NOITAVHA.cjs} +114 -58
  36. package/dist/{chunk-Q27JY5RG.cjs → chunk-OIKREZVQ.cjs} +7 -4
  37. package/dist/{chunk-RJUONLUQ.cjs → chunk-OST5RJOJ.cjs} +1 -1
  38. package/dist/{chunk-6D4W22P4.js → chunk-QIIAMBTM.js} +4 -1
  39. package/dist/{chunk-56QD3YW6.cjs → chunk-QWNUOR7F.cjs} +11 -4
  40. package/dist/{chunk-S3DYFEBE.js → chunk-R4VCO2CB.js} +10 -1
  41. package/dist/{chunk-ZQQUD66M.cjs → chunk-SQMAEDNE.cjs} +63 -295
  42. package/dist/{chunk-4VZX5F4T.cjs → chunk-T6NWPIYZ.cjs} +5 -2
  43. package/dist/{chunk-P7EM6BND.cjs → chunk-TVYA5JSQ.cjs} +10 -10
  44. package/dist/{chunk-EBLFCNPY.js → chunk-U47LQXPB.js} +5 -2
  45. package/dist/{chunk-N7OOJI5V.js → chunk-V2UKUTJ3.js} +5 -0
  46. package/dist/{chunk-45FHEOKW.js → chunk-V53ZEFXC.js} +92 -36
  47. package/dist/{chunk-OC6DOOFX.cjs → chunk-VXRTQZF2.cjs} +5 -5
  48. package/dist/{chunk-FEBAQI5A.js → chunk-WSJE42SG.js} +4964 -1173
  49. package/dist/{chunk-RICPANBY.cjs → chunk-WX2E2G7H.cjs} +13 -4
  50. package/dist/{chunk-DE2SRBFZ.js → chunk-X335TJNS.js} +4 -3
  51. package/dist/{chunk-N2EIM2XJ.js → chunk-ZLNHPUFA.js} +22 -1
  52. package/dist/completion/CompletionService.cjs +29 -26
  53. package/dist/completion/CompletionService.d.cts +3 -2
  54. package/dist/completion/CompletionService.d.ts +3 -2
  55. package/dist/completion/CompletionService.js +28 -25
  56. package/dist/completion.cjs +37 -34
  57. package/dist/completion.d.cts +3 -2
  58. package/dist/completion.d.ts +3 -2
  59. package/dist/completion.js +36 -33
  60. package/dist/image-generation.cjs +52 -0
  61. package/dist/image-generation.d.cts +93 -0
  62. package/dist/image-generation.d.ts +93 -0
  63. package/dist/image-generation.js +52 -0
  64. package/dist/index.cjs +126 -31
  65. package/dist/index.d.cts +11 -7
  66. package/dist/index.d.ts +11 -7
  67. package/dist/index.js +142 -47
  68. package/dist/openai-operation.cjs +18 -0
  69. package/dist/openai-operation.d.cts +19 -0
  70. package/dist/openai-operation.d.ts +19 -0
  71. package/dist/openai-operation.js +18 -0
  72. package/dist/outbound-api/auditCapture.cjs +3 -3
  73. package/dist/outbound-api/auditCapture.d.cts +13 -2
  74. package/dist/outbound-api/auditCapture.d.ts +13 -2
  75. package/dist/outbound-api/auditCapture.js +2 -2
  76. package/dist/outbound-api/auditRedact.cjs +2 -2
  77. package/dist/outbound-api/auditRedact.js +1 -1
  78. package/dist/outbound-api/routeResolver.cjs +2 -2
  79. package/dist/outbound-api/routeResolver.d.cts +7 -4
  80. package/dist/outbound-api/routeResolver.d.ts +7 -4
  81. package/dist/outbound-api/routeResolver.js +1 -1
  82. package/dist/outbound-api/subscriptionRegistryPort.d.cts +2 -1
  83. package/dist/outbound-api/subscriptionRegistryPort.d.ts +2 -1
  84. package/dist/outbound-api/types.d.cts +6 -3
  85. package/dist/outbound-api/types.d.ts +6 -3
  86. package/dist/outbound-api.cjs +48 -31
  87. package/dist/outbound-api.d.cts +95 -9
  88. package/dist/outbound-api.d.ts +95 -9
  89. package/dist/outbound-api.js +47 -30
  90. package/dist/pipeline/AccountAllowanceScheduling.d.cts +18 -15
  91. package/dist/pipeline/AccountAllowanceScheduling.d.ts +18 -15
  92. package/dist/pipeline/LlmConfigProviderAuth.cjs +3 -3
  93. package/dist/pipeline/LlmConfigProviderAuth.js +2 -2
  94. package/dist/pipeline/SubscriptionAccountHealth.cjs +2 -2
  95. package/dist/pipeline/SubscriptionAccountHealth.d.cts +7 -0
  96. package/dist/pipeline/SubscriptionAccountHealth.d.ts +7 -0
  97. package/dist/pipeline/SubscriptionAccountHealth.js +1 -1
  98. package/dist/pipeline/executeProviderCall.cjs +2 -2
  99. package/dist/pipeline/executeProviderCall.d.cts +11 -6
  100. package/dist/pipeline/executeProviderCall.d.ts +11 -6
  101. package/dist/pipeline/executeProviderCall.js +1 -1
  102. package/dist/pipeline/upstreamFetch.cjs +2 -2
  103. package/dist/pipeline/upstreamFetch.d.cts +5 -0
  104. package/dist/pipeline/upstreamFetch.d.ts +5 -0
  105. package/dist/pipeline/upstreamFetch.js +1 -1
  106. package/dist/ports.d.cts +6 -3
  107. package/dist/ports.d.ts +6 -3
  108. package/dist/provider-proxy/ProviderProxy.cjs +29 -26
  109. package/dist/provider-proxy/ProviderProxy.d.cts +3 -2
  110. package/dist/provider-proxy/ProviderProxy.d.ts +3 -2
  111. package/dist/provider-proxy/ProviderProxy.js +28 -25
  112. package/dist/provider-proxy/identity/codexCliHeaders.cjs +4 -2
  113. package/dist/provider-proxy/identity/codexCliHeaders.d.cts +26 -6
  114. package/dist/provider-proxy/identity/codexCliHeaders.d.ts +26 -6
  115. package/dist/provider-proxy/identity/codexCliHeaders.js +5 -3
  116. package/dist/provider-proxy/ingress/providerProxyShared.cjs +31 -26
  117. package/dist/provider-proxy/ingress/providerProxyShared.d.cts +21 -8
  118. package/dist/provider-proxy/ingress/providerProxyShared.d.ts +21 -8
  119. package/dist/provider-proxy/ingress/providerProxyShared.js +30 -25
  120. package/dist/provider-proxy/types.d.cts +14 -483
  121. package/dist/provider-proxy/types.d.ts +14 -483
  122. package/dist/provider-proxy.cjs +43 -26
  123. package/dist/provider-proxy.d.cts +30 -8
  124. package/dist/provider-proxy.d.ts +30 -8
  125. package/dist/provider-proxy.js +42 -25
  126. package/dist/{routeResolver-C0mkkZaM.d.ts → routeResolver-CTCcSHWu.d.ts} +4 -2
  127. package/dist/{routeResolver-CVFE8KKe.d.cts → routeResolver-rpKQLyDO.d.cts} +4 -2
  128. package/dist/transformer/TransformerChainExecutor.cjs +2 -2
  129. package/dist/transformer/TransformerChainExecutor.d.cts +2 -2
  130. package/dist/transformer/TransformerChainExecutor.d.ts +2 -2
  131. package/dist/transformer/TransformerChainExecutor.js +1 -1
  132. package/dist/transformer/transformers/AnthropicOpenAIToAnthropicStream.cjs +16 -0
  133. package/dist/transformer/transformers/AnthropicOpenAIToAnthropicStream.d.cts +53 -0
  134. package/dist/transformer/transformers/AnthropicOpenAIToAnthropicStream.d.ts +53 -0
  135. package/dist/transformer/transformers/AnthropicOpenAIToAnthropicStream.js +16 -0
  136. package/dist/transformer/transformers/AnthropicTransformer.cjs +4 -3
  137. package/dist/transformer/transformers/AnthropicTransformer.js +3 -2
  138. package/dist/transformer/transformers/GeminiCodeAssistTransformer.cjs +4 -4
  139. package/dist/transformer/transformers/GeminiCodeAssistTransformer.js +3 -3
  140. package/dist/transformer/transformers/GeminiTransformer.cjs +4 -4
  141. package/dist/transformer/transformers/GeminiTransformer.js +3 -3
  142. package/dist/transformer/transformers/OpenAIResponseTransformer.cjs +3 -3
  143. package/dist/transformer/transformers/OpenAIResponseTransformer.js +2 -2
  144. package/dist/transformer/transformers/OpenAITransformer.cjs +3 -3
  145. package/dist/transformer/transformers/OpenAITransformer.js +2 -2
  146. package/dist/transformer/transformers.cjs +10 -9
  147. package/dist/transformer/transformers.js +13 -12
  148. package/dist/transformer/types.d.cts +39 -4
  149. package/dist/transformer/types.d.ts +39 -4
  150. package/dist/transformer.cjs +14 -13
  151. package/dist/transformer.js +14 -13
  152. package/dist/{types-BB8pxk_3.d.ts → types-5T223WYQ.d.ts} +183 -23
  153. package/dist/types-Bd72H4SB.d.ts +196 -0
  154. package/dist/types-CVRge76p.d.ts +1115 -0
  155. package/dist/types-CbglB73l.d.cts +196 -0
  156. package/dist/types-DsHBBk3h.d.cts +1115 -0
  157. package/dist/{types-C2MwkLah.d.cts → types-jjU24eYG.d.cts} +183 -23
  158. package/dist/usage.cjs +2 -2
  159. package/dist/usage.d.cts +6 -1
  160. package/dist/usage.d.ts +6 -1
  161. package/dist/usage.js +1 -1
  162. package/package.json +69 -64
  163. package/dist/chunk-FCR77GYM.cjs +0 -33
  164. package/dist/chunk-K5NM7VAH.js +0 -33
  165. /package/dist/{chunk-XXFYLL7R.js → chunk-ECZ3ZE2C.js} +0 -0
  166. /package/dist/{chunk-3SCOLIPT.cjs → chunk-MXI2PWIC.cjs} +0 -0
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Sayo
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Sayo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/NOTICE CHANGED
@@ -1,57 +1,57 @@
1
- @omnicross/core — THIRD-PARTY NOTICES
2
- ======================================
3
-
4
- This package contains code adapted from, and depends on, the following
5
- third-party works. Their respective licenses apply to those portions.
6
-
7
- --------------------------------------------------------------------------------
8
- 1. musistudio/llms (MIT License)
9
- --------------------------------------------------------------------------------
10
-
11
- The transformer subsystem (`src/transformer/`) — the unified-IR request/response
12
- transformer chain (`TransformerService`, `TransformerChainExecutor`, and the
13
- built-in transformers) — is adapted from the `musistudio/llms` project, the
14
- upstream of the transformer intermediate representation.
15
-
16
- Copyright (c) 2025 musistudio
17
- https://github.com/musistudio/llms
18
-
19
- Permission is hereby granted, free of charge, to any person obtaining a copy
20
- of this software and associated documentation files (the "Software"), to deal
21
- in the Software without restriction, including without limitation the rights
22
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
23
- copies of the Software, and to permit persons to whom the Software is
24
- furnished to do so, subject to the following conditions:
25
-
26
- The above copyright notice and this permission notice shall be included in
27
- all copies or substantial portions of the Software.
28
-
29
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35
- SOFTWARE.
36
-
37
- --------------------------------------------------------------------------------
38
- 2. @mozilla/readability (Apache License 2.0)
39
- --------------------------------------------------------------------------------
40
-
41
- The built-in web-fetch tool (`src/completion/builtin-web-fetch.ts`) uses
42
- `@mozilla/readability` to extract readable article content from fetched HTML.
43
-
44
- Copyright Mozilla Foundation and contributors
45
- https://github.com/mozilla/readability
46
-
47
- Licensed under the Apache License, Version 2.0 (the "License"); you may not
48
- use this file except in compliance with the License. You may obtain a copy of
49
- the License at
50
-
51
- http://www.apache.org/licenses/LICENSE-2.0
52
-
53
- Unless required by applicable law or agreed to in writing, software
54
- distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
55
- WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
56
- License for the specific language governing permissions and limitations under
57
- the License.
1
+ @omnicross/core — THIRD-PARTY NOTICES
2
+ ======================================
3
+
4
+ This package contains code adapted from, and depends on, the following
5
+ third-party works. Their respective licenses apply to those portions.
6
+
7
+ --------------------------------------------------------------------------------
8
+ 1. musistudio/llms (MIT License)
9
+ --------------------------------------------------------------------------------
10
+
11
+ The transformer subsystem (`src/transformer/`) — the unified-IR request/response
12
+ transformer chain (`TransformerService`, `TransformerChainExecutor`, and the
13
+ built-in transformers) — is adapted from the `musistudio/llms` project, the
14
+ upstream of the transformer intermediate representation.
15
+
16
+ Copyright (c) 2025 musistudio
17
+ https://github.com/musistudio/llms
18
+
19
+ Permission is hereby granted, free of charge, to any person obtaining a copy
20
+ of this software and associated documentation files (the "Software"), to deal
21
+ in the Software without restriction, including without limitation the rights
22
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
23
+ copies of the Software, and to permit persons to whom the Software is
24
+ furnished to do so, subject to the following conditions:
25
+
26
+ The above copyright notice and this permission notice shall be included in
27
+ all copies or substantial portions of the Software.
28
+
29
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35
+ SOFTWARE.
36
+
37
+ --------------------------------------------------------------------------------
38
+ 2. @mozilla/readability (Apache License 2.0)
39
+ --------------------------------------------------------------------------------
40
+
41
+ The built-in web-fetch tool (`src/completion/builtin-web-fetch.ts`) uses
42
+ `@mozilla/readability` to extract readable article content from fetched HTML.
43
+
44
+ Copyright Mozilla Foundation and contributors
45
+ https://github.com/mozilla/readability
46
+
47
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not
48
+ use this file except in compliance with the License. You may obtain a copy of
49
+ the License at
50
+
51
+ http://www.apache.org/licenses/LICENSE-2.0
52
+
53
+ Unless required by applicable law or agreed to in writing, software
54
+ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
55
+ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
56
+ License for the specific language governing permissions and limitations under
57
+ the License.
package/README.md CHANGED
@@ -1,15 +1,22 @@
1
- # @omnicross/core
2
-
3
- The omnicross LLM serving core — provider dispatch, the completion pipeline, the transformer chain, the outbound API server, and the resident provider proxy. Embed it in any Node project, or run it via [`@omnicross/daemon`](https://www.npmjs.com/package/@omnicross/daemon).
4
-
5
- Part of the [omnicross](https://github.com/Dumoedss/omnicross) monorepo — see the root README for the full overview.
6
-
7
- ```bash
8
- npm install @omnicross/core @omnicross/contracts
9
- ```
10
-
11
- ## License
12
-
13
- [MIT](LICENSE)
14
-
15
- This package adapts third-party work under its own license see the `NOTICE` file.
1
+ # @omnicross/core
2
+
3
+ The omnicross LLM serving core — provider dispatch, the completion pipeline, the transformer chain, the outbound API server, and the resident provider proxy. Embed it in any Node project, or run it via [`@omnicross/daemon`](https://www.npmjs.com/package/@omnicross/daemon).
4
+
5
+ Part of the [omnicross](https://github.com/Dumoedss/omnicross) monorepo — see the root README for the full overview.
6
+
7
+ ```bash
8
+ npm install @omnicross/core @omnicross/contracts
9
+ ```
10
+
11
+ The published core runtime remains supported on Node.js `>=20.9`. The monorepo's
12
+ official OpenAI JavaScript SDK contract suite is contributor tooling, uses
13
+ `openai@7.8.x`, and requires Node.js 22 or newer. Run it from the repository root
14
+ with `npm run test:images-sdk-contract`; the command checks the Node major before
15
+ loading the SDK. The SDK is intentionally not a runtime or package-local
16
+ development dependency of `@omnicross/core`.
17
+
18
+ ## License
19
+
20
+ [MIT](LICENSE)
21
+
22
+ This package adapts third-party work under its own license — see the `NOTICE` file.
@@ -3,7 +3,7 @@ import { LLMProvider } from '@omnicross/contracts/llm-config';
3
3
  import { C as CorePaths, U as UsageEventSink } from './usage-event-sink-BX7FE1NL.cjs';
4
4
  import { L as Logger } from './logger-4GvQNzhE.cjs';
5
5
  import { ProviderConfigSource } from './ports/provider-config-source.cjs';
6
- import { UsageRecorderImport } from './provider-proxy/types.cjs';
6
+ import { U as UsageRecorderImport } from './types-DsHBBk3h.cjs';
7
7
  import { O as OpenAITool, A as AnthropicTool, G as GeminiTools, M as McpToolProvider, B as BuiltinToolExecutor } from './BuiltinToolExecutor-CS2WpXhM.cjs';
8
8
  import { C as CompletionOptions, S as StreamCallbacks, a as CompletionResult } from './types-BScIHmPr.cjs';
9
9
  import { ApiKeyPoolService } from './completion/ApiKeyPoolService.cjs';
@@ -3,7 +3,7 @@ import { LLMProvider } from '@omnicross/contracts/llm-config';
3
3
  import { C as CorePaths, U as UsageEventSink } from './usage-event-sink-BX7FE1NL.js';
4
4
  import { L as Logger } from './logger-4GvQNzhE.js';
5
5
  import { ProviderConfigSource } from './ports/provider-config-source.js';
6
- import { UsageRecorderImport } from './provider-proxy/types.js';
6
+ import { U as UsageRecorderImport } from './types-CVRge76p.js';
7
7
  import { O as OpenAITool, A as AnthropicTool, G as GeminiTools, M as McpToolProvider, B as BuiltinToolExecutor } from './BuiltinToolExecutor-BluWyeob.js';
8
8
  import { C as CompletionOptions, S as StreamCallbacks, a as CompletionResult } from './types-BScIHmPr.js';
9
9
  import { ApiKeyPoolService } from './completion/ApiKeyPoolService.js';
@@ -1,4 +1,4 @@
1
- import { RouteContext, ProviderProxyDeps } from './provider-proxy/types.cjs';
1
+ import { aD as RouteContext, W as ProviderProxyDeps } from './types-DsHBBk3h.cjs';
2
2
 
3
3
  /**
4
4
  * ProviderProxyRouteMap — the per-run `Map<token, RouteContext>` with crypto
@@ -1,4 +1,4 @@
1
- import { RouteContext, ProviderProxyDeps } from './provider-proxy/types.js';
1
+ import { aD as RouteContext, W as ProviderProxyDeps } from './types-CVRge76p.js';
2
2
 
3
3
  /**
4
4
  * ProviderProxyRouteMap — the per-run `Map<token, RouteContext>` with crypto
@@ -1,13 +1,13 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;
2
2
 
3
3
 
4
- var _chunkOC6DOOFXcjs = require('../chunk-OC6DOOFX.cjs');
5
- require('../chunk-RICPANBY.cjs');
4
+ var _chunkVXRTQZF2cjs = require('../chunk-VXRTQZF2.cjs');
5
+ require('../chunk-WX2E2G7H.cjs');
6
6
  require('../chunk-77USGNRW.cjs');
7
- require('../chunk-AOFWNWLT.cjs');
7
+ require('../chunk-IUL4VWNU.cjs');
8
8
 
9
9
 
10
- var _chunkRJUONLUQcjs = require('../chunk-RJUONLUQ.cjs');
10
+ var _chunkOST5RJOJcjs = require('../chunk-OST5RJOJ.cjs');
11
11
  require('../chunk-235MXAGX.cjs');
12
12
  require('../chunk-HVBBDBS3.cjs');
13
13
  require('../chunk-NKVZ6Z3Y.cjs');
@@ -30,7 +30,7 @@ var GeminiCodeAssistHandshakeError = class extends Error {
30
30
  var GeminiCodeAssistProjectResolver = (_class = class {
31
31
  // upstream-proxy: the Code Assist handshake is upstream egress → honor the
32
32
  // gemini proxy by default (still injectable for tests).
33
- constructor(fetchImpl = (url, init) => _chunkRJUONLUQcjs.fetchUpstream.call(void 0, url, init, { providerId: "gemini" })) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);
33
+ constructor(fetchImpl = (url, init) => _chunkOST5RJOJcjs.fetchUpstream.call(void 0, url, init, { providerId: "gemini" })) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);
34
34
  this.fetchImpl = fetchImpl;
35
35
  }
36
36
 
@@ -64,7 +64,7 @@ var GeminiCodeAssistProjectResolver = (_class = class {
64
64
  return run;
65
65
  }
66
66
  codeAssistUrl(method) {
67
- return `${_chunkOC6DOOFXcjs.resolveCodeAssistEndpoint.call(void 0, )}/${_chunkOC6DOOFXcjs.resolveCodeAssistApiVersion.call(void 0, )}:${method}`;
67
+ return `${_chunkVXRTQZF2cjs.resolveCodeAssistEndpoint.call(void 0, )}/${_chunkVXRTQZF2cjs.resolveCodeAssistApiVersion.call(void 0, )}:${method}`;
68
68
  }
69
69
  /** Seed project id from env; reject a purely-numeric value (project NUMBER). */
70
70
  seedProjectId() {
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  resolveCodeAssistApiVersion,
3
3
  resolveCodeAssistEndpoint
4
- } from "../chunk-2UTGX6FM.js";
5
- import "../chunk-S3DYFEBE.js";
4
+ } from "../chunk-4VVCXVB7.js";
5
+ import "../chunk-R4VCO2CB.js";
6
6
  import "../chunk-WYVGULTQ.js";
7
- import "../chunk-N2EIM2XJ.js";
7
+ import "../chunk-ZLNHPUFA.js";
8
8
  import {
9
9
  fetchUpstream
10
- } from "../chunk-RJ5ZGNI3.js";
10
+ } from "../chunk-CFSGYFOZ.js";
11
11
  import "../chunk-3WD4HTR2.js";
12
12
  import "../chunk-MKF46GNZ.js";
13
13
  import "../chunk-GL6XM527.js";
@@ -84,6 +84,7 @@ var UsageThroughputTracker = (_class = class {
84
84
  tokensPerMinute: 0,
85
85
  inputTokensPerMinute: 0,
86
86
  outputTokensPerMinute: 0,
87
+ cacheTokensPerMinute: 0,
87
88
  costUsdPerMinute: 0,
88
89
  complete: this.evictedThroughTs === null || this.evictedThroughTs < startTs
89
90
  };
@@ -104,6 +105,7 @@ var UsageThroughputTracker = (_class = class {
104
105
  row.tokensPerMinute = row.totalTokens / minutes;
105
106
  row.inputTokensPerMinute = row.inputTokens / minutes;
106
107
  row.outputTokensPerMinute = row.outputTokens / minutes;
108
+ row.cacheTokensPerMinute = (row.cacheReadTokens + row.cacheCreationTokens) / minutes;
107
109
  row.costUsdPerMinute = row.costUsd / minutes;
108
110
  return row;
109
111
  }
@@ -113,7 +115,7 @@ var UsageThroughputTracker = (_class = class {
113
115
  const startTs = endTs - THROUGHPUT_RETENTION_MS;
114
116
  const out = [];
115
117
  for (let i = 0; i < THROUGHPUT_BUCKET_COUNT; i += 1) {
116
- out.push({ startTs: startTs + i * bucketMs, requests: 0, tokens: 0 });
118
+ out.push({ startTs: startTs + i * bucketMs, requests: 0, tokens: 0, outputTokens: 0 });
117
119
  }
118
120
  for (let i = this.head; i < this.samples.length; i += 1) {
119
121
  const sample = this.samples[i];
@@ -121,6 +123,7 @@ var UsageThroughputTracker = (_class = class {
121
123
  const bucket = out[Math.floor((sample.ts - startTs) / bucketMs)];
122
124
  if (!bucket) continue;
123
125
  bucket.requests += 1;
126
+ bucket.outputTokens += sample.outputTokens;
124
127
  bucket.tokens += sample.inputTokens + sample.outputTokens + sample.cacheReadTokens + sample.cacheCreationTokens;
125
128
  }
126
129
  return out;
@@ -0,0 +1,200 @@
1
+ // src/openai-operation/openAIOperation.ts
2
+ var OPERATIONS = {
3
+ "chat.completions.create": {
4
+ id: "chat.completions.create",
5
+ policyFamily: "chat",
6
+ routeFamily: "chat",
7
+ owner: "builtin",
8
+ bodyKind: "json",
9
+ requestedModelSource: "request"
10
+ },
11
+ "responses.create": {
12
+ id: "responses.create",
13
+ policyFamily: "responses",
14
+ routeFamily: "responses",
15
+ owner: "builtin",
16
+ bodyKind: "json",
17
+ requestedModelSource: "request"
18
+ },
19
+ "responses.compact": {
20
+ id: "responses.compact",
21
+ policyFamily: "responses",
22
+ routeFamily: "responses",
23
+ owner: "extension",
24
+ bodyKind: "json",
25
+ requestedModelSource: "request"
26
+ },
27
+ "images.generate": {
28
+ id: "images.generate",
29
+ policyFamily: "images",
30
+ routeFamily: "images",
31
+ owner: "extension",
32
+ bodyKind: "json",
33
+ requestedModelSource: "configured"
34
+ },
35
+ "images.edit": {
36
+ id: "images.edit",
37
+ policyFamily: "images",
38
+ routeFamily: "images",
39
+ owner: "extension",
40
+ bodyKind: "multipart",
41
+ requestedModelSource: "configured"
42
+ }
43
+ };
44
+ var MATCH_ORDER = [
45
+ { id: "responses.compact", suffix: ["responses", "compact"] },
46
+ { id: "images.generate", suffix: ["images", "generations"] },
47
+ { id: "images.edit", suffix: ["images", "edits"] },
48
+ { id: "chat.completions.create", suffix: ["chat", "completions"] },
49
+ { id: "responses.create", suffix: ["responses"] }
50
+ ];
51
+ function getOpenAIOperation(id) {
52
+ return OPERATIONS[id];
53
+ }
54
+ function pathSegments(url) {
55
+ const queryIndex = url.indexOf("?");
56
+ const path = queryIndex >= 0 ? url.slice(0, queryIndex) : url;
57
+ return path.split("/").filter(Boolean);
58
+ }
59
+ function hasExactSuffix(segments, suffix) {
60
+ if (segments.length < suffix.length) return false;
61
+ const offset = segments.length - suffix.length;
62
+ return suffix.every((segment, index) => segments[offset + index] === segment);
63
+ }
64
+ function classifyOpenAIOperation(method, url) {
65
+ if (method !== "POST" || !url) return null;
66
+ const segments = pathSegments(url);
67
+ for (const candidate of MATCH_ORDER) {
68
+ if (hasExactSuffix(segments, candidate.suffix)) return OPERATIONS[candidate.id];
69
+ }
70
+ return null;
71
+ }
72
+
73
+ // src/openai-operation/openAIOperationRegistry.ts
74
+ var OpenAIOperationRegistrationError = class extends Error {
75
+ constructor(code, message) {
76
+ super(message);
77
+ this.code = code;
78
+ }
79
+ code;
80
+ name = "OpenAIOperationRegistrationError";
81
+ };
82
+ var OpenAIOperationError = class extends Error {
83
+ name = "OpenAIOperationError";
84
+ status;
85
+ code;
86
+ retryable;
87
+ headers;
88
+ constructor(init) {
89
+ super(init.message);
90
+ this.status = init.status;
91
+ this.code = init.code;
92
+ this.retryable = init.retryable ?? false;
93
+ this.headers = init.headers ?? {};
94
+ }
95
+ };
96
+ var SAFE_LOCAL_ERROR_HEADERS = /* @__PURE__ */ new Set(["retry-after", "x-request-id"]);
97
+ function safeErrorHeaders(headers) {
98
+ const safe = {};
99
+ for (const [name, value] of Object.entries(headers)) {
100
+ if (SAFE_LOCAL_ERROR_HEADERS.has(name.toLowerCase())) safe[name] = value;
101
+ }
102
+ return safe;
103
+ }
104
+ function writeOpenAIOperationError(res, error) {
105
+ if (res.headersSent || res.writableEnded) return false;
106
+ res.writeHead(error.status, {
107
+ "Content-Type": "application/json",
108
+ ...safeErrorHeaders(error.headers)
109
+ });
110
+ res.end(JSON.stringify({
111
+ error: {
112
+ type: "openai_operation_error",
113
+ code: error.code,
114
+ message: error.message,
115
+ retryable: error.retryable
116
+ }
117
+ }));
118
+ return true;
119
+ }
120
+ function unsupportedOpenAIOperation(operation) {
121
+ return new OpenAIOperationError({
122
+ status: 501,
123
+ code: "unsupported_capability",
124
+ message: `Operation '${operation.id}' is not available`
125
+ });
126
+ }
127
+ var OpenAIOperationRegistry = class {
128
+ handlers = /* @__PURE__ */ new Map();
129
+ register(operationId, handler) {
130
+ const operation = getOpenAIOperation(operationId);
131
+ if (operation.owner !== "extension") {
132
+ throw new OpenAIOperationRegistrationError(
133
+ "builtin_operation",
134
+ `Operation '${operationId}' is owned by a built-in ingress`
135
+ );
136
+ }
137
+ if (this.handlers.has(operationId)) {
138
+ throw new OpenAIOperationRegistrationError(
139
+ "duplicate_operation_handler",
140
+ `Operation '${operationId}' already has a handler`
141
+ );
142
+ }
143
+ this.handlers.set(operationId, handler);
144
+ let disposed = false;
145
+ return () => {
146
+ if (disposed) return;
147
+ disposed = true;
148
+ if (this.handlers.get(operationId) === handler) this.handlers.delete(operationId);
149
+ };
150
+ }
151
+ has(operationId) {
152
+ return this.handlers.has(operationId);
153
+ }
154
+ async dispatch(context) {
155
+ const handler = this.handlers.get(context.operation.id);
156
+ if (!handler) return false;
157
+ const controller = new AbortController();
158
+ const abort = () => {
159
+ if (!controller.signal.aborted) controller.abort();
160
+ };
161
+ const onRequestClose = () => {
162
+ if (context.request.aborted || !context.request.complete) abort();
163
+ };
164
+ const onResponseClose = () => {
165
+ if (!context.response.writableEnded) abort();
166
+ };
167
+ context.request.once("aborted", abort);
168
+ context.request.once("close", onRequestClose);
169
+ context.response.once("close", onResponseClose);
170
+ if (context.request.aborted || context.response.destroyed) abort();
171
+ try {
172
+ await handler({ ...context, signal: controller.signal });
173
+ return true;
174
+ } catch (error) {
175
+ const publicError = error instanceof OpenAIOperationError ? error : new OpenAIOperationError({
176
+ status: 500,
177
+ code: "operation_handler_failed",
178
+ message: `Operation '${context.operation.id}' handler failed`
179
+ });
180
+ if (!writeOpenAIOperationError(context.response, publicError)) {
181
+ throw new Error(publicError.message);
182
+ }
183
+ return true;
184
+ } finally {
185
+ context.request.removeListener("aborted", abort);
186
+ context.request.removeListener("close", onRequestClose);
187
+ context.response.removeListener("close", onResponseClose);
188
+ }
189
+ }
190
+ };
191
+
192
+ export {
193
+ getOpenAIOperation,
194
+ classifyOpenAIOperation,
195
+ OpenAIOperationRegistrationError,
196
+ OpenAIOperationError,
197
+ writeOpenAIOperationError,
198
+ unsupportedOpenAIOperation,
199
+ OpenAIOperationRegistry
200
+ };
@@ -3,7 +3,7 @@ import {
3
3
  transformRequestOut,
4
4
  transformResponseIn,
5
5
  transformResponseOut
6
- } from "./chunk-S3DYFEBE.js";
6
+ } from "./chunk-R4VCO2CB.js";
7
7
 
8
8
  // src/transformer/transformers/GeminiCodeAssistTransformer.ts
9
9
  var DEFAULT_CODE_ASSIST_ENDPOINT = "https://cloudcode-pa.googleapis.com";