@omnicross/core 0.1.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 -0
- package/NOTICE +57 -0
- package/README.md +15 -0
- package/dist/ApiKeyPoolService-BmMkau07.d.cts +170 -0
- package/dist/ApiKeyPoolService-BmMkau07.d.ts +170 -0
- package/dist/ProviderProxy-f_8ziIhW.d.cts +120 -0
- package/dist/ProviderProxy-vjt8sQQk.d.ts +120 -0
- package/dist/SubscriptionAuthSource-Cr4fVEYY.d.cts +264 -0
- package/dist/SubscriptionAuthSource-D89zmiSS.d.ts +264 -0
- package/dist/auth/GeminiCodeAssistProjectResolver.cjs +218 -0
- package/dist/auth/GeminiCodeAssistProjectResolver.d.cts +68 -0
- package/dist/auth/GeminiCodeAssistProjectResolver.d.ts +68 -0
- package/dist/auth/GeminiCodeAssistProjectResolver.js +189 -0
- package/dist/completion/ApiKeyPoolService.cjs +331 -0
- package/dist/completion/ApiKeyPoolService.d.cts +2 -0
- package/dist/completion/ApiKeyPoolService.d.ts +2 -0
- package/dist/completion/ApiKeyPoolService.js +306 -0
- package/dist/completion.cjs +4027 -0
- package/dist/completion.d.cts +17 -0
- package/dist/completion.d.ts +17 -0
- package/dist/completion.js +3983 -0
- package/dist/index-BTSmc9Sm.d.ts +645 -0
- package/dist/index-DXazdTzZ.d.cts +645 -0
- package/dist/index.cjs +10428 -0
- package/dist/index.d.cts +128 -0
- package/dist/index.d.ts +128 -0
- package/dist/index.js +10339 -0
- package/dist/outbound-api/subscriptionRegistryPort.cjs +38 -0
- package/dist/outbound-api/subscriptionRegistryPort.d.cts +73 -0
- package/dist/outbound-api/subscriptionRegistryPort.d.ts +73 -0
- package/dist/outbound-api/subscriptionRegistryPort.js +12 -0
- package/dist/outbound-api.cjs +5264 -0
- package/dist/outbound-api.d.cts +320 -0
- package/dist/outbound-api.d.ts +320 -0
- package/dist/outbound-api.js +5218 -0
- package/dist/pipeline/SubscriptionAuthSource.cjs +131 -0
- package/dist/pipeline/SubscriptionAuthSource.d.cts +3 -0
- package/dist/pipeline/SubscriptionAuthSource.d.ts +3 -0
- package/dist/pipeline/SubscriptionAuthSource.js +103 -0
- package/dist/pipeline/SubscriptionAuthStrategy.cjs +18 -0
- package/dist/pipeline/SubscriptionAuthStrategy.d.cts +61 -0
- package/dist/pipeline/SubscriptionAuthStrategy.d.ts +61 -0
- package/dist/pipeline/SubscriptionAuthStrategy.js +0 -0
- package/dist/ports/gemini-code-assist-resolver.cjs +38 -0
- package/dist/ports/gemini-code-assist-resolver.d.cts +26 -0
- package/dist/ports/gemini-code-assist-resolver.d.ts +26 -0
- package/dist/ports/gemini-code-assist-resolver.js +12 -0
- package/dist/ports.cjs +18 -0
- package/dist/ports.d.cts +15 -0
- package/dist/ports.d.ts +15 -0
- package/dist/ports.js +0 -0
- package/dist/provider-proxy/ingress/providerProxyShared.cjs +2958 -0
- package/dist/provider-proxy/ingress/providerProxyShared.d.cts +77 -0
- package/dist/provider-proxy/ingress/providerProxyShared.d.ts +77 -0
- package/dist/provider-proxy/ingress/providerProxyShared.js +2925 -0
- package/dist/provider-proxy/matchText.cjs +73 -0
- package/dist/provider-proxy/matchText.d.cts +47 -0
- package/dist/provider-proxy/matchText.d.ts +47 -0
- package/dist/provider-proxy/matchText.js +45 -0
- package/dist/provider-proxy/types.cjs +18 -0
- package/dist/provider-proxy/types.d.cts +12 -0
- package/dist/provider-proxy/types.d.ts +12 -0
- package/dist/provider-proxy/types.js +0 -0
- package/dist/provider-proxy.cjs +4667 -0
- package/dist/provider-proxy.d.cts +69 -0
- package/dist/provider-proxy.d.ts +69 -0
- package/dist/provider-proxy.js +4636 -0
- package/dist/serializeError.cjs +82 -0
- package/dist/serializeError.d.cts +24 -0
- package/dist/serializeError.d.ts +24 -0
- package/dist/serializeError.js +57 -0
- package/dist/sse-parser.cjs +456 -0
- package/dist/sse-parser.d.cts +143 -0
- package/dist/sse-parser.d.ts +143 -0
- package/dist/sse-parser.js +430 -0
- package/dist/transformer/TransformerChainExecutor.cjs +321 -0
- package/dist/transformer/TransformerChainExecutor.d.cts +104 -0
- package/dist/transformer/TransformerChainExecutor.d.ts +104 -0
- package/dist/transformer/TransformerChainExecutor.js +294 -0
- package/dist/transformer/TransformerService.cjs +290 -0
- package/dist/transformer/TransformerService.d.cts +138 -0
- package/dist/transformer/TransformerService.d.ts +138 -0
- package/dist/transformer/TransformerService.js +265 -0
- package/dist/transformer/transformers/GeminiCodeAssistTransformer.cjs +1115 -0
- package/dist/transformer/transformers/GeminiCodeAssistTransformer.d.cts +102 -0
- package/dist/transformer/transformers/GeminiCodeAssistTransformer.d.ts +102 -0
- package/dist/transformer/transformers/GeminiCodeAssistTransformer.js +1085 -0
- package/dist/transformer/transformers/GeminiTransformer.cjs +1013 -0
- package/dist/transformer/transformers/GeminiTransformer.d.cts +70 -0
- package/dist/transformer/transformers/GeminiTransformer.d.ts +70 -0
- package/dist/transformer/transformers/GeminiTransformer.js +986 -0
- package/dist/transformer/transformers/OpenAIResponseTransformer.cjs +538 -0
- package/dist/transformer/transformers/OpenAIResponseTransformer.d.cts +53 -0
- package/dist/transformer/transformers/OpenAIResponseTransformer.d.ts +53 -0
- package/dist/transformer/transformers/OpenAIResponseTransformer.js +513 -0
- package/dist/transformer/transformers/OpenCodeGoTransformer.cjs +73 -0
- package/dist/transformer/transformers/OpenCodeGoTransformer.d.cts +51 -0
- package/dist/transformer/transformers/OpenCodeGoTransformer.d.ts +51 -0
- package/dist/transformer/transformers/OpenCodeGoTransformer.js +48 -0
- package/dist/transformer/types.cjs +18 -0
- package/dist/transformer/types.d.cts +405 -0
- package/dist/transformer/types.d.ts +405 -0
- package/dist/transformer/types.js +0 -0
- package/dist/transformer.cjs +3736 -0
- package/dist/transformer.d.cts +33 -0
- package/dist/transformer.d.ts +33 -0
- package/dist/transformer.js +3712 -0
- package/dist/types-CGGrKqC_.d.cts +142 -0
- package/dist/types-CbCN2NQP.d.ts +142 -0
- package/dist/types-DCzHkhJt.d.ts +467 -0
- package/dist/types-DZIQbgp0.d.cts +467 -0
- package/dist/usage-event-sink-BX7FE1NL.d.cts +59 -0
- package/dist/usage-event-sink-BX7FE1NL.d.ts +59 -0
- package/package.json +62 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
export { serializeError } from './serializeError.cjs';
|
|
2
|
+
export { SSEEvent, SSEFormat, SSEParserCallbacks, createSSEParser, streamSSEResponse } from './sse-parser.cjs';
|
|
3
|
+
export { A as AnthropicTool, a as ApiFormat, B as BuiltinToolExecutor, C as CompletionOptions, b as CompletionResult, c as CompletionService, G as GeminiTools, M as McpToolProvider, N as NATIVE_SEARCH_TOOL_NAMES, d as NativeSearchAugmentation, e as NativeSearchDetectionResult, f as NativeSearchProvider, g as NativeSearchUserConfig, O as OpenAITool, S as SimpleChatGeminiMessage, h as SimpleChatGeminiPart, i as StreamCallbacks, j as StreamEvent, k as StreamEventType, l as StreamSender, V as VisionFallbackProvider, m as addOpenRouterProviderToRequest, n as applyAugmentation, o as attachStreamEventBuffer, p as buildAnthropicApiUrl, q as buildAzureOpenAIApiUrl, r as buildGeminiApiUrl, s as buildNativeSearchAugmentation, t as buildOpenAIApiUrl, u as buildOpenAIResponseApiUrl, v as buildProviderApiUrl, w as convertMessageToAnthropic, x as convertMessageToGemini, y as convertMessageToOpenAI, z as detectNativeSearch, D as emitStreamEvent, E as getBuiltinSearchTools, F as getOpenRouterProviderConfig, H as getProviderHeaders, I as normalizeAzureEndpoint, J as registerStreamEventBuffer, K as releaseStreamEventBuffer, L as resolveApiFormat, P as resolveProviderEndpoint } from './index-DXazdTzZ.cjs';
|
|
4
|
+
import { LLMProvider } from '@omnicross/contracts/llm-config';
|
|
5
|
+
export { C as CorePaths, a as CoreUsageEvent, b as CoreUsageTokenCounts, U as UsageEventSink } from './usage-event-sink-BX7FE1NL.cjs';
|
|
6
|
+
export { L as Logger } from './ApiKeyPoolService-BmMkau07.cjs';
|
|
7
|
+
export { A as AnthropicIngressHandler, b as AnthropicIngressHandlerFactory, c as AnthropicRouteHandlerParams, d as AnthropicSdkHints, E as ExtendedContextHint, I as IngressFormat, P as ProviderConfigSource, a as ProviderProxyDeps, e as ProxyAttribution, R as RetryCallback, f as RouteAuthMode, g as RouteContext, h as StreamEventCallback, S as SubscriptionDispatchProfile, i as SubscriptionRequestSummary, T as TargetProviderFormat, U as UsageRecorderImport, U as UsageSink, W as WebSearchBackend } from './types-DZIQbgp0.cjs';
|
|
8
|
+
export { E as EndpointRoutingConfig, a as OutboundApiDeps, b as OutboundApiKeyCreated, c as OutboundApiKeyInfo, d as OutboundApiServerConfig, e as OutboundApiServerStatus, O as OutboundCredentialStore, f as OutboundEndpoint, g as OutboundFormatUrls, O as OutboundKeyDb, h as OutboundKeyDbRow, R as RequestRole } from './types-CGGrKqC_.cjs';
|
|
9
|
+
export { __resetProviderProxyForTests, extractRouteToken, getProviderProxy } from './provider-proxy.cjs';
|
|
10
|
+
export { ApiServerSettingsStore, ApplyConfigInput, DEFAULT_OUTBOUND_PORT, OUTBOUND_API_SERVER_CONFIG_KEY, OutboundApiServer, OutboundRateLimiter, SUBSCRIPTION_PROVIDER_IDS, __resetOutboundApiServerForTests, createNamedKey, defaultServerConfig, detectRequestRole, endpointSupportsSubscription, endpointToIngressFormat, formatUrls, getOutboundApiServer, hashKey, isSubscriptionProviderId, loadServerConfig, mergeServerConfig, normalizeServerConfig, resolveRoute, saveServerConfig, verifyPresentedKey } from './outbound-api.cjs';
|
|
11
|
+
import { AnthropicChatRequest, OpenAIChatRequest, AnthropicChatResponse, OpenAIChatResponse, ConversionConfig } from '@omnicross/contracts/completion-types';
|
|
12
|
+
export { ChainExecutionOptions, TransformerChainExecutor } from './transformer/TransformerChainExecutor.cjs';
|
|
13
|
+
export { TransformerService } from './transformer/TransformerService.cjs';
|
|
14
|
+
export { registerBuiltinTransformers } from './transformer.cjs';
|
|
15
|
+
export { Annotation, ImageContent, MessageContent, ModelRoute, ModelTransformerConfig, ReasoningConfig, RequestConfig, RequestRouteInfo, ResolvedTransformerChain, StreamChunk, TextContent, ThinkLevel, ThinkingContent, ToolCall, ToolChoice, ToolParameterSchema, TransformRequestResult, Transformer, TransformerChainConfig, TransformerConfigEntry, TransformerConstructor, TransformerContext, TransformerLogger, TransformerOptions, TransformerReference, TransformerServiceConfig, UnifiedChatRequest, UnifiedChatResponse, UnifiedMessage, UnifiedTool, UrlCitation } from './transformer/types.cjs';
|
|
16
|
+
export { D as DEFAULT_ROUTE_IDLE_MS, P as ProviderProxy, a as ProviderProxyRouteMap } from './ProviderProxy-f_8ziIhW.cjs';
|
|
17
|
+
import '@omnicross/contracts/message-blocks';
|
|
18
|
+
import '@omnicross/contracts/mcp-types';
|
|
19
|
+
import '@omnicross/contracts/endpoint-resolver';
|
|
20
|
+
import 'node:http';
|
|
21
|
+
import '@omnicross/contracts/subscription-types';
|
|
22
|
+
import '@omnicross/contracts/usage-types';
|
|
23
|
+
import './SubscriptionAuthSource-Cr4fVEYY.cjs';
|
|
24
|
+
import './pipeline/SubscriptionAuthStrategy.cjs';
|
|
25
|
+
import '@omnicross/contracts/websearch-types';
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* OpenRouter-specific serving-core helpers.
|
|
29
|
+
*
|
|
30
|
+
* Relocated from the host `config-service/utils.ts` (LLM serving-core
|
|
31
|
+
* extraction, omnicross-phase1) so the serving core does not reach back into a
|
|
32
|
+
* host module. The host `config-service/utils.ts` re-imports and re-exports
|
|
33
|
+
* these from `@omnicross/core` so its own consumers are unchanged.
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Check if provider is OpenRouter based on base URL
|
|
38
|
+
*/
|
|
39
|
+
declare function isOpenRouterProvider(provider: LLMProvider): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* OpenRouter app attribution headers
|
|
42
|
+
* See: https://openrouter.ai/docs/app-attribution
|
|
43
|
+
*/
|
|
44
|
+
declare const OPENROUTER_APP_HEADERS: {
|
|
45
|
+
'HTTP-Referer': string;
|
|
46
|
+
'X-Title': string;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Anthropic → OpenAI API conversion.
|
|
51
|
+
*
|
|
52
|
+
* Used by the claude-code-rerouter direction: clients call our endpoint with
|
|
53
|
+
* an Anthropic-style payload, we forward to an upstream OpenAI provider.
|
|
54
|
+
*
|
|
55
|
+
* Includes:
|
|
56
|
+
* - Response conversion (chat + tools + thinking blocks)
|
|
57
|
+
* - Request conversion (reverse direction)
|
|
58
|
+
* - Streaming chunk transform (Anthropic SSE → OpenAI SSE)
|
|
59
|
+
* - Thinking-aware response enrichment
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Convert Anthropic response to OpenAI format.
|
|
64
|
+
*/
|
|
65
|
+
declare function convertAnthropicToOpenAI(response: AnthropicChatResponse): OpenAIChatResponse;
|
|
66
|
+
/**
|
|
67
|
+
* Convert Anthropic request to OpenAI format (reverse direction).
|
|
68
|
+
*/
|
|
69
|
+
declare function convertAnthropicRequestToOpenAI(request: AnthropicChatRequest): OpenAIChatRequest;
|
|
70
|
+
/**
|
|
71
|
+
* Convert Anthropic response to OpenAI with thinking content preserved.
|
|
72
|
+
*/
|
|
73
|
+
declare function convertAnthropicToOpenAIWithThinking(response: AnthropicChatResponse): OpenAIChatResponse;
|
|
74
|
+
/**
|
|
75
|
+
* Convert Anthropic streaming response to OpenAI format.
|
|
76
|
+
*/
|
|
77
|
+
declare function convertAnthropicStreamToOpenAI(anthropicStream: AsyncIterable<string>): AsyncGenerator<string>;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* OpenAI → Anthropic API conversion.
|
|
81
|
+
*
|
|
82
|
+
* Used by the claude-code-router direction: clients call our endpoint with
|
|
83
|
+
* an OpenAI-style payload, we forward to an upstream Anthropic provider.
|
|
84
|
+
*
|
|
85
|
+
* Includes:
|
|
86
|
+
* - Request conversion (chat + tools)
|
|
87
|
+
* - Streaming chunk transform (OpenAI SSE → Anthropic SSE)
|
|
88
|
+
* - Thinking-aware request enrichment
|
|
89
|
+
*/
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Convert OpenAI chat request to Anthropic format.
|
|
93
|
+
*/
|
|
94
|
+
declare function convertOpenAIToAnthropic(request: OpenAIChatRequest, config: ConversionConfig): AnthropicChatRequest;
|
|
95
|
+
/**
|
|
96
|
+
* Convert OpenAI response to Anthropic format.
|
|
97
|
+
*/
|
|
98
|
+
declare function convertOpenAIResponseToAnthropic(response: OpenAIChatResponse): AnthropicChatResponse;
|
|
99
|
+
/**
|
|
100
|
+
* Convert OpenAI request to Anthropic with thinking support.
|
|
101
|
+
*/
|
|
102
|
+
declare function convertOpenAIToAnthropicWithThinking(request: OpenAIChatRequest, config: ConversionConfig & {
|
|
103
|
+
thinkingBudget?: number;
|
|
104
|
+
}): AnthropicChatRequest;
|
|
105
|
+
/**
|
|
106
|
+
* Convert OpenAI streaming response to Anthropic format.
|
|
107
|
+
* This creates an async generator that yields Anthropic SSE events.
|
|
108
|
+
*/
|
|
109
|
+
declare function convertOpenAIStreamToAnthropic(openaiStream: AsyncIterable<string>): AsyncGenerator<string>;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Shared helpers for API direction converters.
|
|
113
|
+
*
|
|
114
|
+
* Pure functions used by both OpenAI→Anthropic and Anthropic→OpenAI
|
|
115
|
+
* conversion paths: tool schema mapping, stop-reason mapping, and
|
|
116
|
+
* lightweight image detection.
|
|
117
|
+
*/
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Check if a request contains image content (either format).
|
|
121
|
+
*/
|
|
122
|
+
declare function hasImageContent(request: OpenAIChatRequest | AnthropicChatRequest): boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Check if a request has thinking/reasoning enabled.
|
|
125
|
+
*/
|
|
126
|
+
declare function hasThinkingEnabled(request: OpenAIChatRequest | AnthropicChatRequest): boolean;
|
|
127
|
+
|
|
128
|
+
export { OPENROUTER_APP_HEADERS, convertAnthropicRequestToOpenAI, convertAnthropicStreamToOpenAI, convertAnthropicToOpenAI, convertAnthropicToOpenAIWithThinking, convertOpenAIResponseToAnthropic, convertOpenAIStreamToAnthropic, convertOpenAIToAnthropic, convertOpenAIToAnthropicWithThinking, hasImageContent, hasThinkingEnabled, isOpenRouterProvider };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
export { serializeError } from './serializeError.js';
|
|
2
|
+
export { SSEEvent, SSEFormat, SSEParserCallbacks, createSSEParser, streamSSEResponse } from './sse-parser.js';
|
|
3
|
+
export { A as AnthropicTool, a as ApiFormat, B as BuiltinToolExecutor, C as CompletionOptions, b as CompletionResult, c as CompletionService, G as GeminiTools, M as McpToolProvider, N as NATIVE_SEARCH_TOOL_NAMES, d as NativeSearchAugmentation, e as NativeSearchDetectionResult, f as NativeSearchProvider, g as NativeSearchUserConfig, O as OpenAITool, S as SimpleChatGeminiMessage, h as SimpleChatGeminiPart, i as StreamCallbacks, j as StreamEvent, k as StreamEventType, l as StreamSender, V as VisionFallbackProvider, m as addOpenRouterProviderToRequest, n as applyAugmentation, o as attachStreamEventBuffer, p as buildAnthropicApiUrl, q as buildAzureOpenAIApiUrl, r as buildGeminiApiUrl, s as buildNativeSearchAugmentation, t as buildOpenAIApiUrl, u as buildOpenAIResponseApiUrl, v as buildProviderApiUrl, w as convertMessageToAnthropic, x as convertMessageToGemini, y as convertMessageToOpenAI, z as detectNativeSearch, D as emitStreamEvent, E as getBuiltinSearchTools, F as getOpenRouterProviderConfig, H as getProviderHeaders, I as normalizeAzureEndpoint, J as registerStreamEventBuffer, K as releaseStreamEventBuffer, L as resolveApiFormat, P as resolveProviderEndpoint } from './index-BTSmc9Sm.js';
|
|
4
|
+
import { LLMProvider } from '@omnicross/contracts/llm-config';
|
|
5
|
+
export { C as CorePaths, a as CoreUsageEvent, b as CoreUsageTokenCounts, U as UsageEventSink } from './usage-event-sink-BX7FE1NL.js';
|
|
6
|
+
export { L as Logger } from './ApiKeyPoolService-BmMkau07.js';
|
|
7
|
+
export { A as AnthropicIngressHandler, b as AnthropicIngressHandlerFactory, c as AnthropicRouteHandlerParams, d as AnthropicSdkHints, E as ExtendedContextHint, I as IngressFormat, P as ProviderConfigSource, a as ProviderProxyDeps, e as ProxyAttribution, R as RetryCallback, f as RouteAuthMode, g as RouteContext, h as StreamEventCallback, S as SubscriptionDispatchProfile, i as SubscriptionRequestSummary, T as TargetProviderFormat, U as UsageRecorderImport, U as UsageSink, W as WebSearchBackend } from './types-DCzHkhJt.js';
|
|
8
|
+
export { E as EndpointRoutingConfig, a as OutboundApiDeps, b as OutboundApiKeyCreated, c as OutboundApiKeyInfo, d as OutboundApiServerConfig, e as OutboundApiServerStatus, O as OutboundCredentialStore, f as OutboundEndpoint, g as OutboundFormatUrls, O as OutboundKeyDb, h as OutboundKeyDbRow, R as RequestRole } from './types-CbCN2NQP.js';
|
|
9
|
+
export { __resetProviderProxyForTests, extractRouteToken, getProviderProxy } from './provider-proxy.js';
|
|
10
|
+
export { ApiServerSettingsStore, ApplyConfigInput, DEFAULT_OUTBOUND_PORT, OUTBOUND_API_SERVER_CONFIG_KEY, OutboundApiServer, OutboundRateLimiter, SUBSCRIPTION_PROVIDER_IDS, __resetOutboundApiServerForTests, createNamedKey, defaultServerConfig, detectRequestRole, endpointSupportsSubscription, endpointToIngressFormat, formatUrls, getOutboundApiServer, hashKey, isSubscriptionProviderId, loadServerConfig, mergeServerConfig, normalizeServerConfig, resolveRoute, saveServerConfig, verifyPresentedKey } from './outbound-api.js';
|
|
11
|
+
import { AnthropicChatRequest, OpenAIChatRequest, AnthropicChatResponse, OpenAIChatResponse, ConversionConfig } from '@omnicross/contracts/completion-types';
|
|
12
|
+
export { ChainExecutionOptions, TransformerChainExecutor } from './transformer/TransformerChainExecutor.js';
|
|
13
|
+
export { TransformerService } from './transformer/TransformerService.js';
|
|
14
|
+
export { registerBuiltinTransformers } from './transformer.js';
|
|
15
|
+
export { Annotation, ImageContent, MessageContent, ModelRoute, ModelTransformerConfig, ReasoningConfig, RequestConfig, RequestRouteInfo, ResolvedTransformerChain, StreamChunk, TextContent, ThinkLevel, ThinkingContent, ToolCall, ToolChoice, ToolParameterSchema, TransformRequestResult, Transformer, TransformerChainConfig, TransformerConfigEntry, TransformerConstructor, TransformerContext, TransformerLogger, TransformerOptions, TransformerReference, TransformerServiceConfig, UnifiedChatRequest, UnifiedChatResponse, UnifiedMessage, UnifiedTool, UrlCitation } from './transformer/types.js';
|
|
16
|
+
export { D as DEFAULT_ROUTE_IDLE_MS, P as ProviderProxy, a as ProviderProxyRouteMap } from './ProviderProxy-vjt8sQQk.js';
|
|
17
|
+
import '@omnicross/contracts/message-blocks';
|
|
18
|
+
import '@omnicross/contracts/mcp-types';
|
|
19
|
+
import '@omnicross/contracts/endpoint-resolver';
|
|
20
|
+
import 'node:http';
|
|
21
|
+
import '@omnicross/contracts/subscription-types';
|
|
22
|
+
import '@omnicross/contracts/usage-types';
|
|
23
|
+
import './SubscriptionAuthSource-D89zmiSS.js';
|
|
24
|
+
import './pipeline/SubscriptionAuthStrategy.js';
|
|
25
|
+
import '@omnicross/contracts/websearch-types';
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* OpenRouter-specific serving-core helpers.
|
|
29
|
+
*
|
|
30
|
+
* Relocated from the host `config-service/utils.ts` (LLM serving-core
|
|
31
|
+
* extraction, omnicross-phase1) so the serving core does not reach back into a
|
|
32
|
+
* host module. The host `config-service/utils.ts` re-imports and re-exports
|
|
33
|
+
* these from `@omnicross/core` so its own consumers are unchanged.
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Check if provider is OpenRouter based on base URL
|
|
38
|
+
*/
|
|
39
|
+
declare function isOpenRouterProvider(provider: LLMProvider): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* OpenRouter app attribution headers
|
|
42
|
+
* See: https://openrouter.ai/docs/app-attribution
|
|
43
|
+
*/
|
|
44
|
+
declare const OPENROUTER_APP_HEADERS: {
|
|
45
|
+
'HTTP-Referer': string;
|
|
46
|
+
'X-Title': string;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Anthropic → OpenAI API conversion.
|
|
51
|
+
*
|
|
52
|
+
* Used by the claude-code-rerouter direction: clients call our endpoint with
|
|
53
|
+
* an Anthropic-style payload, we forward to an upstream OpenAI provider.
|
|
54
|
+
*
|
|
55
|
+
* Includes:
|
|
56
|
+
* - Response conversion (chat + tools + thinking blocks)
|
|
57
|
+
* - Request conversion (reverse direction)
|
|
58
|
+
* - Streaming chunk transform (Anthropic SSE → OpenAI SSE)
|
|
59
|
+
* - Thinking-aware response enrichment
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Convert Anthropic response to OpenAI format.
|
|
64
|
+
*/
|
|
65
|
+
declare function convertAnthropicToOpenAI(response: AnthropicChatResponse): OpenAIChatResponse;
|
|
66
|
+
/**
|
|
67
|
+
* Convert Anthropic request to OpenAI format (reverse direction).
|
|
68
|
+
*/
|
|
69
|
+
declare function convertAnthropicRequestToOpenAI(request: AnthropicChatRequest): OpenAIChatRequest;
|
|
70
|
+
/**
|
|
71
|
+
* Convert Anthropic response to OpenAI with thinking content preserved.
|
|
72
|
+
*/
|
|
73
|
+
declare function convertAnthropicToOpenAIWithThinking(response: AnthropicChatResponse): OpenAIChatResponse;
|
|
74
|
+
/**
|
|
75
|
+
* Convert Anthropic streaming response to OpenAI format.
|
|
76
|
+
*/
|
|
77
|
+
declare function convertAnthropicStreamToOpenAI(anthropicStream: AsyncIterable<string>): AsyncGenerator<string>;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* OpenAI → Anthropic API conversion.
|
|
81
|
+
*
|
|
82
|
+
* Used by the claude-code-router direction: clients call our endpoint with
|
|
83
|
+
* an OpenAI-style payload, we forward to an upstream Anthropic provider.
|
|
84
|
+
*
|
|
85
|
+
* Includes:
|
|
86
|
+
* - Request conversion (chat + tools)
|
|
87
|
+
* - Streaming chunk transform (OpenAI SSE → Anthropic SSE)
|
|
88
|
+
* - Thinking-aware request enrichment
|
|
89
|
+
*/
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Convert OpenAI chat request to Anthropic format.
|
|
93
|
+
*/
|
|
94
|
+
declare function convertOpenAIToAnthropic(request: OpenAIChatRequest, config: ConversionConfig): AnthropicChatRequest;
|
|
95
|
+
/**
|
|
96
|
+
* Convert OpenAI response to Anthropic format.
|
|
97
|
+
*/
|
|
98
|
+
declare function convertOpenAIResponseToAnthropic(response: OpenAIChatResponse): AnthropicChatResponse;
|
|
99
|
+
/**
|
|
100
|
+
* Convert OpenAI request to Anthropic with thinking support.
|
|
101
|
+
*/
|
|
102
|
+
declare function convertOpenAIToAnthropicWithThinking(request: OpenAIChatRequest, config: ConversionConfig & {
|
|
103
|
+
thinkingBudget?: number;
|
|
104
|
+
}): AnthropicChatRequest;
|
|
105
|
+
/**
|
|
106
|
+
* Convert OpenAI streaming response to Anthropic format.
|
|
107
|
+
* This creates an async generator that yields Anthropic SSE events.
|
|
108
|
+
*/
|
|
109
|
+
declare function convertOpenAIStreamToAnthropic(openaiStream: AsyncIterable<string>): AsyncGenerator<string>;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Shared helpers for API direction converters.
|
|
113
|
+
*
|
|
114
|
+
* Pure functions used by both OpenAI→Anthropic and Anthropic→OpenAI
|
|
115
|
+
* conversion paths: tool schema mapping, stop-reason mapping, and
|
|
116
|
+
* lightweight image detection.
|
|
117
|
+
*/
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Check if a request contains image content (either format).
|
|
121
|
+
*/
|
|
122
|
+
declare function hasImageContent(request: OpenAIChatRequest | AnthropicChatRequest): boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Check if a request has thinking/reasoning enabled.
|
|
125
|
+
*/
|
|
126
|
+
declare function hasThinkingEnabled(request: OpenAIChatRequest | AnthropicChatRequest): boolean;
|
|
127
|
+
|
|
128
|
+
export { OPENROUTER_APP_HEADERS, convertAnthropicRequestToOpenAI, convertAnthropicStreamToOpenAI, convertAnthropicToOpenAI, convertAnthropicToOpenAIWithThinking, convertOpenAIResponseToAnthropic, convertOpenAIStreamToAnthropic, convertOpenAIToAnthropic, convertOpenAIToAnthropicWithThinking, hasImageContent, hasThinkingEnabled, isOpenRouterProvider };
|