@omnicross/core 0.1.2 → 0.1.3

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 (131) hide show
  1. package/dist/auth/GeminiCodeAssistProjectResolver.cjs +6 -1
  2. package/dist/auth/GeminiCodeAssistProjectResolver.js +6 -1
  3. package/dist/{chunk-SN3YWBX7.cjs → chunk-2FMI2B6V.cjs} +2329 -533
  4. package/dist/{chunk-XBSYYZIY.cjs → chunk-3QOSDDNI.cjs} +39 -3
  5. package/dist/{chunk-2FEVTJWG.js → chunk-4DECIFU7.js} +2162 -366
  6. package/dist/chunk-4IH4EL7M.cjs +9 -0
  7. package/dist/chunk-5ENKBSWO.js +311 -0
  8. package/dist/chunk-6RPZADX3.cjs +92 -0
  9. package/dist/chunk-AEOZIDEB.cjs +32 -0
  10. package/dist/chunk-BO4RFWBR.js +89 -0
  11. package/dist/{chunk-MNYKI4CI.js → chunk-CWM2ZDU5.js} +36 -0
  12. package/dist/chunk-CZHZGRU7.js +383 -0
  13. package/dist/{chunk-4NBS6KPV.cjs → chunk-DQ5VAYZ6.cjs} +7 -8
  14. package/dist/chunk-HUZZZ3JL.js +32 -0
  15. package/dist/{chunk-QOCNX236.js → chunk-IAXWICZU.js} +24 -1
  16. package/dist/{chunk-V5KPWNYX.cjs → chunk-JMJBSACD.cjs} +3 -3
  17. package/dist/chunk-L74VDN4A.cjs +32 -0
  18. package/dist/{chunk-74TMJA7Z.js → chunk-N5QFKSDO.js} +7 -4
  19. package/dist/{chunk-LKZJEL6E.cjs → chunk-Q27JY5RG.cjs} +6 -4
  20. package/dist/{chunk-SPVWWUHX.cjs → chunk-QWBWGODS.cjs} +24 -1
  21. package/dist/chunk-RPII3E6Z.cjs +145 -0
  22. package/dist/chunk-S6JGLF3G.cjs +89 -0
  23. package/dist/chunk-SVXC36MU.cjs +383 -0
  24. package/dist/chunk-TKJMZBAH.js +32 -0
  25. package/dist/{chunk-ZSVQT3PW.js → chunk-UBWEBKRC.js} +5 -6
  26. package/dist/chunk-UNEFIWXI.cjs +32 -0
  27. package/dist/chunk-VQY5W4YW.cjs +311 -0
  28. package/dist/chunk-WNY4WMRF.js +32 -0
  29. package/dist/chunk-XEKD23J5.js +9 -0
  30. package/dist/chunk-XTEI64OU.js +145 -0
  31. package/dist/chunk-XX6NQJMA.js +92 -0
  32. package/dist/{chunk-N3V2J5ZO.cjs → chunk-Y6OM7EV7.cjs} +7 -4
  33. package/dist/{chunk-745DV5FL.js → chunk-Y7FO65VT.js} +3 -3
  34. package/dist/{chunk-PXUJF5HS.js → chunk-ZY6KU6P3.js} +4 -2
  35. package/dist/completion/CompletionService.cjs +22 -15
  36. package/dist/completion/CompletionService.js +21 -14
  37. package/dist/completion/NativeSearchInjector.cjs +3 -3
  38. package/dist/completion/NativeSearchInjector.js +2 -2
  39. package/dist/completion/openrouter-headers.cjs +3 -6
  40. package/dist/completion/openrouter-headers.d.cts +9 -12
  41. package/dist/completion/openrouter-headers.d.ts +9 -12
  42. package/dist/completion/openrouter-headers.js +2 -5
  43. package/dist/completion/openrouter-models.cjs +4 -3
  44. package/dist/completion/openrouter-models.js +2 -1
  45. package/dist/completion.cjs +22 -15
  46. package/dist/completion.js +21 -14
  47. package/dist/index.cjs +139 -17
  48. package/dist/index.d.cts +40 -10
  49. package/dist/index.d.ts +40 -10
  50. package/dist/index.js +146 -24
  51. package/dist/outbound-api/routeResolver.cjs +5 -2
  52. package/dist/outbound-api/routeResolver.d.cts +8 -2
  53. package/dist/outbound-api/routeResolver.d.ts +8 -2
  54. package/dist/outbound-api/routeResolver.js +4 -1
  55. package/dist/outbound-api/types.cjs +6 -1
  56. package/dist/outbound-api/types.d.cts +11 -144
  57. package/dist/outbound-api/types.d.ts +11 -144
  58. package/dist/outbound-api/types.js +6 -0
  59. package/dist/outbound-api.cjs +133 -15
  60. package/dist/outbound-api.d.cts +786 -25
  61. package/dist/outbound-api.d.ts +786 -25
  62. package/dist/outbound-api.js +137 -19
  63. package/dist/pipeline/AuthSource.d.cts +23 -1
  64. package/dist/pipeline/AuthSource.d.ts +23 -1
  65. package/dist/pipeline/LlmConfigProviderAuth.cjs +3 -3
  66. package/dist/pipeline/LlmConfigProviderAuth.js +2 -2
  67. package/dist/pipeline/SubscriptionAccountHealth.cjs +22 -0
  68. package/dist/pipeline/SubscriptionAccountHealth.d.cts +235 -0
  69. package/dist/pipeline/SubscriptionAccountHealth.d.ts +235 -0
  70. package/dist/pipeline/SubscriptionAccountHealth.js +22 -0
  71. package/dist/pipeline/SubscriptionAuthSource.cjs +2 -2
  72. package/dist/pipeline/SubscriptionAuthSource.d.cts +3 -2
  73. package/dist/pipeline/SubscriptionAuthSource.d.ts +3 -2
  74. package/dist/pipeline/SubscriptionAuthSource.js +1 -1
  75. package/dist/pipeline/SubscriptionAuthStrategy.d.cts +24 -1
  76. package/dist/pipeline/SubscriptionAuthStrategy.d.ts +24 -1
  77. package/dist/pipeline/auditSink.cjs +14 -0
  78. package/dist/pipeline/auditSink.d.cts +48 -0
  79. package/dist/pipeline/auditSink.d.ts +48 -0
  80. package/dist/pipeline/auditSink.js +14 -0
  81. package/dist/pipeline/billingEmit.cjs +14 -0
  82. package/dist/pipeline/billingEmit.d.cts +49 -0
  83. package/dist/pipeline/billingEmit.d.ts +49 -0
  84. package/dist/pipeline/billingEmit.js +14 -0
  85. package/dist/ports/usage-event-store.d.cts +26 -1
  86. package/dist/ports/usage-event-store.d.ts +26 -1
  87. package/dist/ports.d.cts +7 -1
  88. package/dist/ports.d.ts +7 -1
  89. package/dist/provider-proxy/ProviderProxy.cjs +22 -15
  90. package/dist/provider-proxy/ProviderProxy.js +21 -14
  91. package/dist/provider-proxy/identity/SubscriptionIdentityStore.cjs +15 -0
  92. package/dist/provider-proxy/identity/SubscriptionIdentityStore.d.cts +121 -0
  93. package/dist/provider-proxy/identity/SubscriptionIdentityStore.d.ts +121 -0
  94. package/dist/provider-proxy/identity/SubscriptionIdentityStore.js +15 -0
  95. package/dist/provider-proxy/identity/fingerprintHeaders.cjs +20 -0
  96. package/dist/provider-proxy/identity/fingerprintHeaders.d.cts +89 -0
  97. package/dist/provider-proxy/identity/fingerprintHeaders.d.ts +89 -0
  98. package/dist/provider-proxy/identity/fingerprintHeaders.js +20 -0
  99. package/dist/provider-proxy/ingress/providerProxyShared.cjs +22 -15
  100. package/dist/provider-proxy/ingress/providerProxyShared.d.cts +11 -2
  101. package/dist/provider-proxy/ingress/providerProxyShared.d.ts +11 -2
  102. package/dist/provider-proxy/ingress/providerProxyShared.js +21 -14
  103. package/dist/provider-proxy/matchText.cjs +4 -2
  104. package/dist/provider-proxy/matchText.d.cts +14 -1
  105. package/dist/provider-proxy/matchText.d.ts +14 -1
  106. package/dist/provider-proxy/matchText.js +3 -1
  107. package/dist/provider-proxy/types.d.cts +23 -0
  108. package/dist/provider-proxy/types.d.ts +23 -0
  109. package/dist/provider-proxy.cjs +22 -15
  110. package/dist/provider-proxy.js +21 -14
  111. package/dist/{routeResolver-HE-ZO0fO.d.ts → routeResolver-B1NglTfe.d.ts} +36 -10
  112. package/dist/{routeResolver-BrbK6ja9.d.cts → routeResolver-CbG5uBgm.d.cts} +36 -10
  113. package/dist/transformer/transformers.cjs +7 -7
  114. package/dist/transformer/transformers.js +7 -7
  115. package/dist/transformer.cjs +5 -5
  116. package/dist/transformer.js +4 -4
  117. package/dist/types-6OUY_xfA.d.ts +830 -0
  118. package/dist/types-aBFFXoBz.d.cts +830 -0
  119. package/dist/usage/usage-recorder.cjs +2 -2
  120. package/dist/usage/usage-recorder.d.cts +19 -1
  121. package/dist/usage/usage-recorder.d.ts +19 -1
  122. package/dist/usage/usage-recorder.js +1 -1
  123. package/dist/usage.cjs +2 -2
  124. package/dist/usage.js +1 -1
  125. package/package.json +4 -2
  126. package/dist/chunk-3MEACFK3.js +0 -193
  127. package/dist/chunk-6VIXXLMX.cjs +0 -14
  128. package/dist/chunk-E3WHL7CO.js +0 -14
  129. package/dist/chunk-G2FUJNA2.cjs +0 -193
  130. package/dist/{chunk-UYPEN5XE.cjs → chunk-FFALUUZZ.cjs} +5 -5
  131. package/dist/{chunk-O466Y272.js → chunk-MQNDWYPN.js} +6 -6
@@ -1,6 +1,6 @@
1
1
  import { ProviderConfigSource } from './ports/provider-config-source.cjs';
2
2
  import { IngressFormat, RouteContext } from './provider-proxy/types.cjs';
3
- import { OutboundEndpoint, EndpointRoutingConfig, RequestRole } from './outbound-api/types.cjs';
3
+ import { q as OutboundEndpoint, P as ModelRef, b as EndpointRoutingConfig, R as RequestRole } from './types-aBFFXoBz.cjs';
4
4
  import { SubscriptionProviderId } from '@omnicross/contracts/subscription-types';
5
5
 
6
6
  /**
@@ -39,21 +39,26 @@ declare function endpointSupportsSubscription(endpoint: OutboundEndpoint): boole
39
39
 
40
40
  /**
41
41
  * routeResolver — turn an endpoint's `EndpointRoutingConfig` + the detected
42
- * request role into a `RouteContext` for the shared `provider-proxy` dispatch
43
- * (`outbound-api-server`, design D2).
42
+ * request KIND (messages/responses) or ROLE (chat/gemini) into a `RouteContext`
43
+ * for the shared `provider-proxy` dispatch (`outbound-api-server`, design D1/D2).
44
44
  *
45
45
  * Steps:
46
- * 1. Pick the model for the role (vision default fallback when `visionModel`
47
- * is unset; vision is optional).
46
+ * 1. Pick the model ref: by model KIND for the kind-mapped endpoints
47
+ * (`messages`/`responses`) via `modelMap[detectModelKind(...)]` with a
48
+ * serving-owned fallback (messages: first configured of `sonnet → opus →
49
+ * haiku → fable`; responses: `codex`); by ROLE (default/background) for the
50
+ * role-based endpoints (`chat`/`gemini`). Vision was removed.
48
51
  * 2. Parse the chosen `"providerId,modelId"` ref.
49
52
  * 3. Gate by `useSubscription`: OFF → only BYO-key providers are eligible
50
53
  * (subscription-backed providers excluded); ON → subscription-backed
51
54
  * providers are eligible.
52
55
  * 4. Resolve the provider (BYO via the `ProviderConfigSource`; subscription via the
53
56
  * subscription registry) and build the `RouteContext` exactly as the
54
- * internal callers do.
55
- * 5. Return a clear `503`-style error when the role's required model is unset,
56
- * the provider is unavailable, or the subscription gate excludes it.
57
+ * internal callers do. For kind-mapped endpoints STAMP `route.requestedModel`
58
+ * with the client's ORIGINAL requested id so the response `model` can be
59
+ * passed through unchanged (the resident proxy leaves this unset).
60
+ * 5. Return a clear `503`-style error when the required model is unset, the
61
+ * provider is unavailable, or the subscription gate excludes it.
57
62
  *
58
63
  * @module outbound-api/routeResolver
59
64
  */
@@ -76,13 +81,34 @@ declare function parseModelRef(ref: string | undefined): {
76
81
  providerId: string;
77
82
  modelId: string;
78
83
  } | null;
84
+ /**
85
+ * Pick the model ref for the LIST-mapped `chat` endpoint: the client requests
86
+ * one of the configured refs' modelIds directly (the same names `GET /v1/models`
87
+ * advertises). Exact modelId match first, then case-insensitive. No requested
88
+ * model, or a model not in the list → `undefined` (per-request 404).
89
+ */
90
+ declare function pickModelRefFromList(models: ModelRef[] | undefined, requestedModel: string | undefined): ModelRef | undefined;
79
91
  /** Resolve a route for one authenticated outbound request. */
80
92
  declare function resolveRoute(args: {
81
93
  config: EndpointRoutingConfig;
82
- role: RequestRole;
94
+ /** Role for the role-based endpoints (`chat`/`gemini`); ignored (optional) for kind-mapped ones. */
95
+ role?: RequestRole;
83
96
  ingressFormat: IngressFormat;
84
97
  llmConfig: ProviderConfigSource;
85
98
  sessionId?: string | null;
99
+ /**
100
+ * The client's ORIGINAL requested model id. For kind-mapped endpoints it
101
+ * selects the model KIND AND is stamped onto `route.requestedModel` so the
102
+ * response `model` passes through unchanged. Ignored for role-based endpoints.
103
+ */
104
+ requestedModel?: string;
105
+ /**
106
+ * The verified named-key id (`verified.id`). Stamped onto EVERY outbound
107
+ * endpoint's route (not gated on kind — attribution is orthogonal to the
108
+ * passthrough-rewrite gate), BYO + subscription. Absent for the resident
109
+ * proxy's internal route minting, so internal usage records `apiKeyId: null`.
110
+ */
111
+ apiKeyId?: string;
86
112
  }): Promise<RouteResolveResult>;
87
113
 
88
- export { type RouteResolveError as R, SUBSCRIPTION_PROVIDER_IDS as S, type RouteResolveResult as a, endpointSupportsSubscription as e, isSubscriptionProviderId as i, parseModelRef as p, resolveRoute as r };
114
+ export { type RouteResolveError as R, SUBSCRIPTION_PROVIDER_IDS as S, pickModelRefFromList as a, type RouteResolveResult as b, endpointSupportsSubscription as e, isSubscriptionProviderId as i, parseModelRef as p, resolveRoute as r };
@@ -4,22 +4,22 @@
4
4
 
5
5
 
6
6
 
7
- var _chunkUYPEN5XEcjs = require('../chunk-UYPEN5XE.cjs');
7
+ var _chunkFFALUUZZcjs = require('../chunk-FFALUUZZ.cjs');
8
8
 
9
9
 
10
- var _chunk7YN22L2Hcjs = require('../chunk-7YN22L2H.cjs');
10
+ var _chunkC72S6TTVcjs = require('../chunk-C72S6TTV.cjs');
11
11
 
12
12
 
13
- var _chunk2DCNB7DFcjs = require('../chunk-2DCNB7DF.cjs');
13
+ var _chunkDWKQZ2SKcjs = require('../chunk-DWKQZ2SK.cjs');
14
14
 
15
15
 
16
- var _chunkC72S6TTVcjs = require('../chunk-C72S6TTV.cjs');
16
+ var _chunk4VAVYUZScjs = require('../chunk-4VAVYUZS.cjs');
17
17
 
18
18
 
19
- var _chunkDWKQZ2SKcjs = require('../chunk-DWKQZ2SK.cjs');
19
+ var _chunk7YN22L2Hcjs = require('../chunk-7YN22L2H.cjs');
20
20
 
21
21
 
22
- var _chunk4VAVYUZScjs = require('../chunk-4VAVYUZS.cjs');
22
+ var _chunk2DCNB7DFcjs = require('../chunk-2DCNB7DF.cjs');
23
23
 
24
24
 
25
25
  var _chunkRSJ3TWJQcjs = require('../chunk-RSJ3TWJQ.cjs');
@@ -36,4 +36,4 @@ require('../chunk-YGXJGRFI.cjs');
36
36
 
37
37
 
38
38
 
39
- exports.AnthropicTransformer = _chunk4VAVYUZScjs.AnthropicTransformer; exports.BUILTIN_TRANSFORMER_NAMES = _chunkUYPEN5XEcjs.BUILTIN_TRANSFORMER_NAMES; exports.BuiltinTransformers = _chunkUYPEN5XEcjs.BuiltinTransformers; exports.DeepseekTransformer = _chunkUYPEN5XEcjs.DeepseekTransformer; exports.GeminiCodeAssistTransformer = _chunkRSJ3TWJQcjs.GeminiCodeAssistTransformer; exports.GeminiTransformer = _chunk7YN22L2Hcjs.GeminiTransformer; exports.OpenAIResponseTransformer = _chunk2DCNB7DFcjs.OpenAIResponseTransformer; exports.OpenCodeGoTransformer = _chunkC72S6TTVcjs.OpenCodeGoTransformer; exports.ReasoningTransformer = _chunkDWKQZ2SKcjs.ReasoningTransformer; exports.getBuiltinTransformers = _chunkUYPEN5XEcjs.getBuiltinTransformers; exports.registerBuiltinTransformers = _chunkUYPEN5XEcjs.registerBuiltinTransformers;
39
+ exports.AnthropicTransformer = _chunk4VAVYUZScjs.AnthropicTransformer; exports.BUILTIN_TRANSFORMER_NAMES = _chunkFFALUUZZcjs.BUILTIN_TRANSFORMER_NAMES; exports.BuiltinTransformers = _chunkFFALUUZZcjs.BuiltinTransformers; exports.DeepseekTransformer = _chunkFFALUUZZcjs.DeepseekTransformer; exports.GeminiCodeAssistTransformer = _chunkRSJ3TWJQcjs.GeminiCodeAssistTransformer; exports.GeminiTransformer = _chunk7YN22L2Hcjs.GeminiTransformer; exports.OpenAIResponseTransformer = _chunk2DCNB7DFcjs.OpenAIResponseTransformer; exports.OpenCodeGoTransformer = _chunkC72S6TTVcjs.OpenCodeGoTransformer; exports.ReasoningTransformer = _chunkDWKQZ2SKcjs.ReasoningTransformer; exports.getBuiltinTransformers = _chunkFFALUUZZcjs.getBuiltinTransformers; exports.registerBuiltinTransformers = _chunkFFALUUZZcjs.registerBuiltinTransformers;
@@ -4,13 +4,7 @@ import {
4
4
  DeepseekTransformer,
5
5
  getBuiltinTransformers,
6
6
  registerBuiltinTransformers
7
- } from "../chunk-O466Y272.js";
8
- import {
9
- GeminiTransformer
10
- } from "../chunk-C7PSERMH.js";
11
- import {
12
- OpenAIResponseTransformer
13
- } from "../chunk-5HTVET6E.js";
7
+ } from "../chunk-MQNDWYPN.js";
14
8
  import {
15
9
  OpenCodeGoTransformer
16
10
  } from "../chunk-Z7LUNECE.js";
@@ -20,6 +14,12 @@ import {
20
14
  import {
21
15
  AnthropicTransformer
22
16
  } from "../chunk-FTQ7IQUC.js";
17
+ import {
18
+ GeminiTransformer
19
+ } from "../chunk-C7PSERMH.js";
20
+ import {
21
+ OpenAIResponseTransformer
22
+ } from "../chunk-5HTVET6E.js";
23
23
  import {
24
24
  GeminiCodeAssistTransformer
25
25
  } from "../chunk-Z7Y2NPHY.js";
@@ -2,22 +2,22 @@
2
2
 
3
3
 
4
4
  var _chunk46ZIFWYGcjs = require('./chunk-46ZIFWYG.cjs');
5
- require('./chunk-GBHYAGX3.cjs');
6
5
 
7
6
 
8
7
  var _chunk3OPYJG76cjs = require('./chunk-3OPYJG76.cjs');
9
8
 
10
9
 
11
- var _chunkUYPEN5XEcjs = require('./chunk-UYPEN5XE.cjs');
12
- require('./chunk-7YN22L2H.cjs');
13
- require('./chunk-2DCNB7DF.cjs');
10
+ var _chunkFFALUUZZcjs = require('./chunk-FFALUUZZ.cjs');
14
11
  require('./chunk-C72S6TTV.cjs');
15
12
  require('./chunk-DWKQZ2SK.cjs');
16
13
  require('./chunk-4VAVYUZS.cjs');
14
+ require('./chunk-7YN22L2H.cjs');
15
+ require('./chunk-2DCNB7DF.cjs');
16
+ require('./chunk-GBHYAGX3.cjs');
17
17
  require('./chunk-RSJ3TWJQ.cjs');
18
18
  require('./chunk-YGXJGRFI.cjs');
19
19
 
20
20
 
21
21
 
22
22
 
23
- exports.TransformerChainExecutor = _chunk46ZIFWYGcjs.TransformerChainExecutor; exports.TransformerService = _chunk3OPYJG76cjs.TransformerService; exports.registerBuiltinTransformers = _chunkUYPEN5XEcjs.registerBuiltinTransformers;
23
+ exports.TransformerChainExecutor = _chunk46ZIFWYGcjs.TransformerChainExecutor; exports.TransformerService = _chunk3OPYJG76cjs.TransformerService; exports.registerBuiltinTransformers = _chunkFFALUUZZcjs.registerBuiltinTransformers;
@@ -2,18 +2,18 @@ import "./chunk-46RLHI7D.js";
2
2
  import {
3
3
  TransformerChainExecutor
4
4
  } from "./chunk-G2UTNSGU.js";
5
- import "./chunk-MZNPGW5Q.js";
6
5
  import {
7
6
  TransformerService
8
7
  } from "./chunk-DK4A7DLE.js";
9
8
  import {
10
9
  registerBuiltinTransformers
11
- } from "./chunk-O466Y272.js";
12
- import "./chunk-C7PSERMH.js";
13
- import "./chunk-5HTVET6E.js";
10
+ } from "./chunk-MQNDWYPN.js";
14
11
  import "./chunk-Z7LUNECE.js";
15
12
  import "./chunk-ZJZAOKI7.js";
16
13
  import "./chunk-FTQ7IQUC.js";
14
+ import "./chunk-C7PSERMH.js";
15
+ import "./chunk-5HTVET6E.js";
16
+ import "./chunk-MZNPGW5Q.js";
17
17
  import "./chunk-Z7Y2NPHY.js";
18
18
  import "./chunk-S4WBV25P.js";
19
19
  export {