@omnicross/core 0.2.0 → 0.2.1

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 (122) hide show
  1. package/LICENSE +21 -21
  2. package/NOTICE +57 -57
  3. package/README.md +22 -22
  4. package/dist/{BuiltinToolExecutor-CS2WpXhM.d.cts → BuiltinToolExecutor-BHgH-EaZ.d.cts} +25 -2
  5. package/dist/{BuiltinToolExecutor-BluWyeob.d.ts → BuiltinToolExecutor-Bi1LmiTP.d.ts} +25 -2
  6. package/dist/{CompletionService-BiJqftc-.d.cts → CompletionService-BniP7j88.d.cts} +2 -2
  7. package/dist/{CompletionService-NXN_Av5W.d.ts → CompletionService-BqrKPwfA.d.ts} +2 -2
  8. package/dist/{ProviderProxy-CgIcCVwk.d.cts → ProviderProxy-Bz_nkOwq.d.cts} +1 -1
  9. package/dist/{ProviderProxy-DYoY5XoT.d.ts → ProviderProxy-Ckr6oTrE.d.ts} +1 -1
  10. package/dist/auth/GeminiCodeAssistProjectResolver.cjs +2 -2
  11. package/dist/auth/GeminiCodeAssistProjectResolver.js +1 -1
  12. package/dist/{chunk-FJNKXOWE.js → chunk-2C3TTBS7.js} +4 -4
  13. package/dist/{chunk-OST5RJOJ.cjs → chunk-4Z3ZLLC2.cjs} +13 -7
  14. package/dist/chunk-7RJI3NDI.cjs +236 -0
  15. package/dist/chunk-D4WNI6BR.cjs +386 -0
  16. package/dist/chunk-DBBR6RHF.js +236 -0
  17. package/dist/chunk-E4QHVXV5.cjs +118 -0
  18. package/dist/chunk-HL2YSPL7.cjs +673 -0
  19. package/dist/chunk-LFPQ2OVH.js +386 -0
  20. package/dist/{chunk-WSJE42SG.js → chunk-LKDAN4D7.js} +3684 -2462
  21. package/dist/{chunk-DEIUR2TH.js → chunk-LQYS2N47.js} +12 -8
  22. package/dist/{chunk-NZYN7C3P.cjs → chunk-MPXOKQJP.cjs} +53 -53
  23. package/dist/chunk-MZEGQSKQ.js +118 -0
  24. package/dist/chunk-NLUOTJWB.js +673 -0
  25. package/dist/{chunk-CTKM773J.cjs → chunk-UPQIWJIE.cjs} +12 -8
  26. package/dist/{chunk-CFSGYFOZ.js → chunk-VL5TUDTM.js} +7 -1
  27. package/dist/{chunk-7B56AJBB.cjs → chunk-VSYQ6XYN.cjs} +2233 -1011
  28. package/dist/{chunk-CDHS2QDC.js → chunk-Y4CRNHJO.js} +53 -53
  29. package/dist/{chunk-TVYA5JSQ.cjs → chunk-ZAPN7XA6.cjs} +5 -5
  30. package/dist/completion/BuiltinToolExecutor.cjs +2 -2
  31. package/dist/completion/BuiltinToolExecutor.d.cts +3 -1
  32. package/dist/completion/BuiltinToolExecutor.d.ts +3 -1
  33. package/dist/completion/BuiltinToolExecutor.js +1 -1
  34. package/dist/completion/CompletionService.cjs +11 -10
  35. package/dist/completion/CompletionService.d.cts +6 -3
  36. package/dist/completion/CompletionService.d.ts +6 -3
  37. package/dist/completion/CompletionService.js +10 -9
  38. package/dist/completion.cjs +11 -10
  39. package/dist/completion.d.cts +6 -3
  40. package/dist/completion.d.ts +6 -3
  41. package/dist/completion.js +10 -9
  42. package/dist/egress-I46O_p5L.d.cts +126 -0
  43. package/dist/egress-I46O_p5L.d.ts +126 -0
  44. package/dist/frontends-Doz0RaWu.d.cts +97 -0
  45. package/dist/frontends-Doz0RaWu.d.ts +97 -0
  46. package/dist/image-generation.cjs +2 -2
  47. package/dist/image-generation.d.cts +7 -4
  48. package/dist/image-generation.d.ts +7 -4
  49. package/dist/image-generation.js +1 -1
  50. package/dist/index.cjs +25 -10
  51. package/dist/index.d.cts +12 -8
  52. package/dist/index.d.ts +12 -8
  53. package/dist/index.js +24 -9
  54. package/dist/openai-operation.d.cts +4 -1
  55. package/dist/openai-operation.d.ts +4 -1
  56. package/dist/outbound-api/routeResolver.d.cts +9 -5
  57. package/dist/outbound-api/routeResolver.d.ts +9 -5
  58. package/dist/outbound-api/subscriptionRegistryPort.d.cts +4 -1
  59. package/dist/outbound-api/subscriptionRegistryPort.d.ts +4 -1
  60. package/dist/outbound-api/types.d.cts +8 -4
  61. package/dist/outbound-api/types.d.ts +8 -4
  62. package/dist/outbound-api.cjs +25 -10
  63. package/dist/outbound-api.d.cts +117 -8
  64. package/dist/outbound-api.d.ts +117 -8
  65. package/dist/outbound-api.js +24 -9
  66. package/dist/pipeline/AccountAllowanceScheduling.d.cts +8 -4
  67. package/dist/pipeline/AccountAllowanceScheduling.d.ts +8 -4
  68. package/dist/pipeline/upstreamFetch.cjs +2 -2
  69. package/dist/pipeline/upstreamFetch.js +1 -1
  70. package/dist/ports.d.cts +8 -4
  71. package/dist/ports.d.ts +8 -4
  72. package/dist/provider-proxy/ProviderProxy.cjs +11 -10
  73. package/dist/provider-proxy/ProviderProxy.d.cts +5 -2
  74. package/dist/provider-proxy/ProviderProxy.d.ts +5 -2
  75. package/dist/provider-proxy/ProviderProxy.js +10 -9
  76. package/dist/provider-proxy/ingress/providerProxyShared.cjs +13 -10
  77. package/dist/provider-proxy/ingress/providerProxyShared.d.cts +22 -3
  78. package/dist/provider-proxy/ingress/providerProxyShared.d.ts +22 -3
  79. package/dist/provider-proxy/ingress/providerProxyShared.js +12 -9
  80. package/dist/provider-proxy/types.d.cts +4 -1
  81. package/dist/provider-proxy/types.d.ts +4 -1
  82. package/dist/provider-proxy.cjs +11 -10
  83. package/dist/provider-proxy.d.cts +10 -6
  84. package/dist/provider-proxy.d.ts +10 -6
  85. package/dist/provider-proxy.js +10 -9
  86. package/dist/proxy-UZTtjPZx.d.cts +18 -0
  87. package/dist/proxy-UZTtjPZx.d.ts +18 -0
  88. package/dist/{routeResolver-rpKQLyDO.d.cts → routeResolver-Da0yvkL1.d.cts} +2 -2
  89. package/dist/{routeResolver-CTCcSHWu.d.ts → routeResolver-STwMz_G4.d.ts} +2 -2
  90. package/dist/runtime-6QXNU526.cjs +8 -0
  91. package/dist/runtime-M5WXLD2R.js +8 -0
  92. package/dist/runtime-t8AZacFF.d.cts +233 -0
  93. package/dist/runtime-t8AZacFF.d.ts +233 -0
  94. package/dist/search/api.cjs +761 -0
  95. package/dist/search/api.d.cts +370 -0
  96. package/dist/search/api.d.ts +370 -0
  97. package/dist/search/api.js +761 -0
  98. package/dist/search/http.cjs +37 -0
  99. package/dist/search/http.d.cts +269 -0
  100. package/dist/search/http.d.ts +269 -0
  101. package/dist/search/http.js +37 -0
  102. package/dist/search.cjs +57 -0
  103. package/dist/search.d.cts +113 -0
  104. package/dist/search.d.ts +113 -0
  105. package/dist/search.js +57 -0
  106. package/dist/transformer/transformers/AnthropicTransformer.cjs +3 -3
  107. package/dist/transformer/transformers/AnthropicTransformer.js +2 -2
  108. package/dist/transformer/transformers.cjs +7 -7
  109. package/dist/transformer/transformers.js +6 -6
  110. package/dist/transformer.cjs +6 -6
  111. package/dist/transformer.js +5 -5
  112. package/dist/{types-DsHBBk3h.d.cts → types-BSIJdsyl.d.cts} +15 -0
  113. package/dist/{types-CbglB73l.d.cts → types-Be-yt_6T.d.cts} +1 -1
  114. package/dist/{types-CVRge76p.d.ts → types-By9Tg6-I.d.ts} +15 -0
  115. package/dist/types-CbCZqLGg.d.cts +127 -0
  116. package/dist/types-CbCZqLGg.d.ts +127 -0
  117. package/dist/{types-jjU24eYG.d.cts → types-D-oHYusb.d.cts} +73 -4
  118. package/dist/{types-Bd72H4SB.d.ts → types-Dm4_36V4.d.ts} +1 -1
  119. package/dist/{types-5T223WYQ.d.ts → types-Dvlpjn0d.d.ts} +73 -4
  120. package/package.json +5 -3
  121. package/dist/{chunk-6OC3ORW6.js → chunk-EUZRH544.js} +3 -3
  122. package/dist/{chunk-SQMAEDNE.cjs → chunk-POUTD5AM.cjs} +2 -2
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,22 +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
- 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.
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.
@@ -1,5 +1,6 @@
1
1
  import { MCPCallToolResponse, MCPTool } from '@omnicross/contracts/mcp-types';
2
2
  import { WebSearchBackend } from './ports/web-search-backend.cjs';
3
+ import { S as SearchRuntime } from './runtime-t8AZacFF.cjs';
3
4
 
4
5
  /**
5
6
  * Core-owned tool-shape types.
@@ -65,10 +66,32 @@ interface McpToolProvider {
65
66
 
66
67
  declare class BuiltinToolExecutor {
67
68
  private webSearch;
68
- constructor(webSearch: WebSearchBackend);
69
+ private runtime?;
70
+ /**
71
+ * @param webSearch - the legacy port, still the `web_fetch` URL reader.
72
+ * @param runtime - the search runtime `web_search` delegates to. Optional so
73
+ * the single-argument construction hosts already use keeps compiling; when
74
+ * omitted, a default runtime over the builtin HTTP providers is built on
75
+ * first use.
76
+ */
77
+ constructor(webSearch: WebSearchBackend, runtime?: SearchRuntime | undefined);
69
78
  execute(toolName: string, args: Record<string, unknown>): Promise<MCPCallToolResponse>;
70
79
  private executeWebSearch;
71
- private resolveProviderChain;
80
+ /** Memoized lazy construction, so concurrent first calls share one runtime. */
81
+ private runtimeInit?;
82
+ /**
83
+ * The runtime `web_search` delegates to.
84
+ *
85
+ * Imported lazily so the search stack's transport and HTML parsing stay out
86
+ * of the module graph of every consumer that only wants the tool definitions
87
+ * — the same reason `builtin-web-fetch` is loaded on demand below.
88
+ *
89
+ * The PROMISE is memoized, not just its result: two concurrent first searches
90
+ * would otherwise each build a runtime and the later one would win. Harmless
91
+ * while the default runtime is stateless, but it stops being harmless the
92
+ * moment one holds a connection pool or a cache.
93
+ */
94
+ private getRuntime;
72
95
  private executeWebFetch;
73
96
  }
74
97
  /** Get the built-in MCPTool definitions for web search tools. */
@@ -1,5 +1,6 @@
1
1
  import { MCPCallToolResponse, MCPTool } from '@omnicross/contracts/mcp-types';
2
2
  import { WebSearchBackend } from './ports/web-search-backend.js';
3
+ import { S as SearchRuntime } from './runtime-t8AZacFF.js';
3
4
 
4
5
  /**
5
6
  * Core-owned tool-shape types.
@@ -65,10 +66,32 @@ interface McpToolProvider {
65
66
 
66
67
  declare class BuiltinToolExecutor {
67
68
  private webSearch;
68
- constructor(webSearch: WebSearchBackend);
69
+ private runtime?;
70
+ /**
71
+ * @param webSearch - the legacy port, still the `web_fetch` URL reader.
72
+ * @param runtime - the search runtime `web_search` delegates to. Optional so
73
+ * the single-argument construction hosts already use keeps compiling; when
74
+ * omitted, a default runtime over the builtin HTTP providers is built on
75
+ * first use.
76
+ */
77
+ constructor(webSearch: WebSearchBackend, runtime?: SearchRuntime | undefined);
69
78
  execute(toolName: string, args: Record<string, unknown>): Promise<MCPCallToolResponse>;
70
79
  private executeWebSearch;
71
- private resolveProviderChain;
80
+ /** Memoized lazy construction, so concurrent first calls share one runtime. */
81
+ private runtimeInit?;
82
+ /**
83
+ * The runtime `web_search` delegates to.
84
+ *
85
+ * Imported lazily so the search stack's transport and HTML parsing stay out
86
+ * of the module graph of every consumer that only wants the tool definitions
87
+ * — the same reason `builtin-web-fetch` is loaded on demand below.
88
+ *
89
+ * The PROMISE is memoized, not just its result: two concurrent first searches
90
+ * would otherwise each build a runtime and the later one would win. Harmless
91
+ * while the default runtime is stateless, but it stops being harmless the
92
+ * moment one holds a connection pool or a cache.
93
+ */
94
+ private getRuntime;
72
95
  private executeWebFetch;
73
96
  }
74
97
  /** Get the built-in MCPTool definitions for web search tools. */
@@ -3,8 +3,8 @@ 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 { U as UsageRecorderImport } from './types-DsHBBk3h.cjs';
7
- import { O as OpenAITool, A as AnthropicTool, G as GeminiTools, M as McpToolProvider, B as BuiltinToolExecutor } from './BuiltinToolExecutor-CS2WpXhM.cjs';
6
+ import { U as UsageRecorderImport } from './types-BSIJdsyl.cjs';
7
+ import { O as OpenAITool, A as AnthropicTool, G as GeminiTools, M as McpToolProvider, B as BuiltinToolExecutor } from './BuiltinToolExecutor-BHgH-EaZ.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';
10
10
  import { MCPTool } from '@omnicross/contracts/mcp-types';
@@ -3,8 +3,8 @@ 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 { U as UsageRecorderImport } from './types-CVRge76p.js';
7
- import { O as OpenAITool, A as AnthropicTool, G as GeminiTools, M as McpToolProvider, B as BuiltinToolExecutor } from './BuiltinToolExecutor-BluWyeob.js';
6
+ import { U as UsageRecorderImport } from './types-By9Tg6-I.js';
7
+ import { O as OpenAITool, A as AnthropicTool, G as GeminiTools, M as McpToolProvider, B as BuiltinToolExecutor } from './BuiltinToolExecutor-Bi1LmiTP.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';
10
10
  import { MCPTool } from '@omnicross/contracts/mcp-types';
@@ -1,4 +1,4 @@
1
- import { aD as RouteContext, W as ProviderProxyDeps } from './types-DsHBBk3h.cjs';
1
+ import { aD as RouteContext, W as ProviderProxyDeps } from './types-BSIJdsyl.cjs';
2
2
 
3
3
  /**
4
4
  * ProviderProxyRouteMap — the per-run `Map<token, RouteContext>` with crypto
@@ -1,4 +1,4 @@
1
- import { aD as RouteContext, W as ProviderProxyDeps } from './types-CVRge76p.js';
1
+ import { aD as RouteContext, W as ProviderProxyDeps } from './types-By9Tg6-I.js';
2
2
 
3
3
  /**
4
4
  * ProviderProxyRouteMap — the per-run `Map<token, RouteContext>` with crypto
@@ -7,7 +7,7 @@ require('../chunk-77USGNRW.cjs');
7
7
  require('../chunk-IUL4VWNU.cjs');
8
8
 
9
9
 
10
- var _chunkOST5RJOJcjs = require('../chunk-OST5RJOJ.cjs');
10
+ var _chunk4Z3ZLLC2cjs = require('../chunk-4Z3ZLLC2.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) => _chunkOST5RJOJcjs.fetchUpstream.call(void 0, url, init, { providerId: "gemini" })) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);
33
+ constructor(fetchImpl = (url, init) => _chunk4Z3ZLLC2cjs.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
 
@@ -7,7 +7,7 @@ import "../chunk-WYVGULTQ.js";
7
7
  import "../chunk-ZLNHPUFA.js";
8
8
  import {
9
9
  fetchUpstream
10
- } from "../chunk-CFSGYFOZ.js";
10
+ } from "../chunk-VL5TUDTM.js";
11
11
  import "../chunk-3WD4HTR2.js";
12
12
  import "../chunk-MKF46GNZ.js";
13
13
  import "../chunk-GL6XM527.js";
@@ -1,3 +1,6 @@
1
+ import {
2
+ GeminiTransformer
3
+ } from "./chunk-HN74IGEO.js";
1
4
  import {
2
5
  OpenAIResponseTransformer
3
6
  } from "./chunk-V53ZEFXC.js";
@@ -6,10 +9,7 @@ import {
6
9
  } from "./chunk-7PIUVCKK.js";
7
10
  import {
8
11
  AnthropicTransformer
9
- } from "./chunk-6OC3ORW6.js";
10
- import {
11
- GeminiTransformer
12
- } from "./chunk-HN74IGEO.js";
12
+ } from "./chunk-EUZRH544.js";
13
13
  import {
14
14
  GeminiCodeAssistTransformer
15
15
  } from "./chunk-4VVCXVB7.js";
@@ -32,6 +32,12 @@ function bumpUpstreamProxyGeneration() {
32
32
  }
33
33
  }
34
34
  }
35
+ function isClientDisconnectAbort(signal) {
36
+ if (!_optionalChain([signal, 'optionalAccess', _3 => _3.aborted])) return false;
37
+ const reason = signal.reason;
38
+ if (!reason || typeof reason !== "object") return false;
39
+ return reason.code === "client_disconnect";
40
+ }
35
41
  function normalizeProxy(cfg) {
36
42
  if ("url" in cfg) {
37
43
  let u;
@@ -110,7 +116,7 @@ function fetchUpstream(url, init, ctx) {
110
116
  const dispatcher = resolveUpstreamDispatcher({ ..._nullishCoalesce(ctx, () => ( {})), url });
111
117
  const doFetch = dispatcher ? () => fetch(url, { ...init, dispatcher }) : () => fetch(url, init);
112
118
  const doFetchWithAllowanceTap = () => doFetch().then((response) => {
113
- if (_optionalChain([ctx, 'optionalAccess', _3 => _3.providerId]) === "codex" && ctx.accountId) {
119
+ if (_optionalChain([ctx, 'optionalAccess', _4 => _4.providerId]) === "codex" && ctx.accountId) {
114
120
  try {
115
121
  _chunkHVBBDBS3cjs.getSharedAccountAllowanceStore.call(void 0, ).recordCodexHeaders(ctx.accountId, response.headers);
116
122
  } catch (e4) {
@@ -118,10 +124,10 @@ function fetchUpstream(url, init, ctx) {
118
124
  }
119
125
  return response;
120
126
  });
121
- const activity = _optionalChain([ctx, 'optionalAccess', _4 => _4.routeActivity]);
122
- const activityStartedAt = activity && _optionalChain([ctx, 'optionalAccess', _5 => _5.providerId]) && ctx.accountId ? Date.now() : 0;
127
+ const activity = _optionalChain([ctx, 'optionalAccess', _5 => _5.routeActivity]);
128
+ const activityStartedAt = activity && _optionalChain([ctx, 'optionalAccess', _6 => _6.providerId]) && ctx.accountId ? Date.now() : 0;
123
129
  const recordActivity = (status) => {
124
- if (!activity || !_optionalChain([ctx, 'optionalAccess', _6 => _6.providerId]) || !ctx.accountId) return;
130
+ if (!activity || !_optionalChain([ctx, 'optionalAccess', _7 => _7.providerId]) || !ctx.accountId) return;
125
131
  const record = _chunkNKVZ6Z3Ycjs.getSharedAccountRouteActivity.call(void 0, ).record({
126
132
  providerId: ctx.providerId,
127
133
  accountId: ctx.accountId,
@@ -134,7 +140,7 @@ function fetchUpstream(url, init, ctx) {
134
140
  ts: activityStartedAt
135
141
  });
136
142
  try {
137
- _optionalChain([activity, 'access', _7 => _7.onRecorded, 'optionalCall', _8 => _8(record)]);
143
+ _optionalChain([activity, 'access', _8 => _8.onRecorded, 'optionalCall', _9 => _9(record)]);
138
144
  } catch (e5) {
139
145
  }
140
146
  };
@@ -144,12 +150,12 @@ function fetchUpstream(url, init, ctx) {
144
150
  return response;
145
151
  },
146
152
  (error) => {
147
- recordActivity(0);
153
+ if (!isClientDisconnectAbort(init.signal)) recordActivity(0);
148
154
  throw error;
149
155
  }
150
156
  );
151
157
  const tracePath = _chunk235MXAGXcjs.getUpstreamTracePath.call(void 0, );
152
- if (!tracePath || !_optionalChain([ctx, 'optionalAccess', _9 => _9.providerId])) return doFetchWithActivity();
158
+ if (!tracePath || !_optionalChain([ctx, 'optionalAccess', _10 => _10.providerId])) return doFetchWithActivity();
153
159
  const startedAt = Date.now();
154
160
  const method = typeof init.method === "string" ? init.method : "GET";
155
161
  const requestHeaders = _chunk235MXAGXcjs.redactHeaders.call(void 0,