@omnicross/core 0.1.0 → 0.1.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 (139) hide show
  1. package/dist/ApiConverter.cjs +799 -0
  2. package/dist/ApiConverter.d.cts +82 -0
  3. package/dist/ApiConverter.d.ts +82 -0
  4. package/dist/ApiConverter.js +763 -0
  5. package/dist/BuiltinToolExecutor-BluWyeob.d.ts +81 -0
  6. package/dist/BuiltinToolExecutor-CS2WpXhM.d.cts +81 -0
  7. package/dist/CompletionService-7fCmKAP3.d.ts +212 -0
  8. package/dist/CompletionService-DtOF_War.d.cts +212 -0
  9. package/dist/{ProviderProxy-f_8ziIhW.d.cts → ProviderProxy-C-xqrkKi.d.ts} +7 -2
  10. package/dist/{ProviderProxy-vjt8sQQk.d.ts → ProviderProxy-CnMQYN59.d.cts} +7 -2
  11. package/dist/completion/BuiltinToolExecutor.cjs +327 -0
  12. package/dist/completion/BuiltinToolExecutor.d.cts +4 -0
  13. package/dist/completion/BuiltinToolExecutor.d.ts +4 -0
  14. package/dist/completion/BuiltinToolExecutor.js +296 -0
  15. package/dist/completion/CompletionService.cjs +3487 -0
  16. package/dist/completion/CompletionService.d.cts +21 -0
  17. package/dist/completion/CompletionService.d.ts +21 -0
  18. package/dist/completion/CompletionService.js +3461 -0
  19. package/dist/completion/NativeSearchInjector.cjs +196 -0
  20. package/dist/completion/NativeSearchInjector.d.cts +42 -0
  21. package/dist/completion/NativeSearchInjector.d.ts +42 -0
  22. package/dist/completion/NativeSearchInjector.js +167 -0
  23. package/dist/completion/ProviderSearchInjector.cjs +87 -0
  24. package/dist/completion/ProviderSearchInjector.d.cts +47 -0
  25. package/dist/completion/ProviderSearchInjector.d.ts +47 -0
  26. package/dist/completion/ProviderSearchInjector.js +60 -0
  27. package/dist/completion/native-search-types.cjs +67 -0
  28. package/dist/completion/native-search-types.d.cts +3 -0
  29. package/dist/completion/native-search-types.d.ts +3 -0
  30. package/dist/completion/native-search-types.js +38 -0
  31. package/dist/completion/openrouter-headers.cjs +72 -0
  32. package/dist/completion/openrouter-headers.d.cts +44 -0
  33. package/dist/completion/openrouter-headers.d.ts +44 -0
  34. package/dist/completion/openrouter-headers.js +42 -0
  35. package/dist/completion/openrouter-models.cjs +86 -0
  36. package/dist/completion/openrouter-models.d.cts +27 -0
  37. package/dist/completion/openrouter-models.d.ts +27 -0
  38. package/dist/completion/openrouter-models.js +59 -0
  39. package/dist/completion/types.cjs +18 -0
  40. package/dist/completion/types.d.cts +3 -0
  41. package/dist/completion/types.d.ts +3 -0
  42. package/dist/completion/types.js +0 -0
  43. package/dist/completion/url-builder.cjs +138 -0
  44. package/dist/completion/url-builder.d.cts +87 -0
  45. package/dist/completion/url-builder.d.ts +87 -0
  46. package/dist/completion/url-builder.js +104 -0
  47. package/dist/completion.d.cts +148 -7
  48. package/dist/completion.d.ts +148 -7
  49. package/dist/index.cjs +1 -0
  50. package/dist/index.d.cts +27 -90
  51. package/dist/index.d.ts +27 -90
  52. package/dist/index.js +1 -0
  53. package/dist/outbound-api/routeResolver.cjs +221 -0
  54. package/dist/outbound-api/routeResolver.d.cts +18 -0
  55. package/dist/outbound-api/routeResolver.d.ts +18 -0
  56. package/dist/outbound-api/routeResolver.js +192 -0
  57. package/dist/outbound-api/subscriptionRegistryPort.d.cts +5 -2
  58. package/dist/outbound-api/subscriptionRegistryPort.d.ts +5 -2
  59. package/dist/outbound-api/types.cjs +18 -0
  60. package/dist/{types-CbCN2NQP.d.ts → outbound-api/types.d.cts} +17 -3
  61. package/dist/{types-CGGrKqC_.d.cts → outbound-api/types.d.ts} +17 -3
  62. package/dist/outbound-api/types.js +0 -0
  63. package/dist/outbound-api.cjs +1 -0
  64. package/dist/outbound-api.d.cts +14 -87
  65. package/dist/outbound-api.d.ts +14 -87
  66. package/dist/outbound-api.js +1 -0
  67. package/dist/pipeline/AuthSource.cjs +18 -0
  68. package/dist/pipeline/AuthSource.d.cts +101 -0
  69. package/dist/pipeline/AuthSource.d.ts +101 -0
  70. package/dist/pipeline/AuthSource.js +0 -0
  71. package/dist/pipeline/LlmConfigProviderAuth.cjs +169 -0
  72. package/dist/pipeline/LlmConfigProviderAuth.d.cts +86 -0
  73. package/dist/pipeline/LlmConfigProviderAuth.d.ts +86 -0
  74. package/dist/pipeline/LlmConfigProviderAuth.js +142 -0
  75. package/dist/pipeline/SubscriptionAuthSource.d.cts +165 -3
  76. package/dist/pipeline/SubscriptionAuthSource.d.ts +165 -3
  77. package/dist/pipeline/executeProviderCall.cjs +70 -0
  78. package/dist/pipeline/executeProviderCall.d.cts +149 -0
  79. package/dist/pipeline/executeProviderCall.d.ts +149 -0
  80. package/dist/pipeline/executeProviderCall.js +45 -0
  81. package/dist/pipeline/resolveProviderChain.cjs +47 -0
  82. package/dist/pipeline/resolveProviderChain.d.cts +58 -0
  83. package/dist/pipeline/resolveProviderChain.d.ts +58 -0
  84. package/dist/pipeline/resolveProviderChain.js +22 -0
  85. package/dist/pipeline/resolveSubscriptionChain.cjs +68 -0
  86. package/dist/pipeline/resolveSubscriptionChain.d.cts +68 -0
  87. package/dist/pipeline/resolveSubscriptionChain.d.ts +68 -0
  88. package/dist/pipeline/resolveSubscriptionChain.js +43 -0
  89. package/dist/ports/provider-config-source.cjs +18 -0
  90. package/dist/ports/provider-config-source.d.cts +51 -0
  91. package/dist/ports/provider-config-source.d.ts +51 -0
  92. package/dist/ports/provider-config-source.js +0 -0
  93. package/dist/ports/web-search-backend.cjs +18 -0
  94. package/dist/ports/web-search-backend.d.cts +29 -0
  95. package/dist/ports/web-search-backend.d.ts +29 -0
  96. package/dist/ports/web-search-backend.js +0 -0
  97. package/dist/ports.d.cts +10 -7
  98. package/dist/ports.d.ts +10 -7
  99. package/dist/provider-proxy/ProviderProxy.cjs +4643 -0
  100. package/dist/provider-proxy/ProviderProxy.d.cts +16 -0
  101. package/dist/provider-proxy/ProviderProxy.d.ts +16 -0
  102. package/dist/provider-proxy/ProviderProxy.js +4618 -0
  103. package/dist/provider-proxy/ingress/providerProxyShared.d.cts +5 -2
  104. package/dist/provider-proxy/ingress/providerProxyShared.d.ts +5 -2
  105. package/dist/provider-proxy/types.d.cts +406 -8
  106. package/dist/provider-proxy/types.d.ts +406 -8
  107. package/dist/provider-proxy.cjs +1 -0
  108. package/dist/provider-proxy.d.cts +8 -5
  109. package/dist/provider-proxy.d.ts +8 -5
  110. package/dist/provider-proxy.js +1 -0
  111. package/dist/routeResolver-BrbK6ja9.d.cts +88 -0
  112. package/dist/routeResolver-HE-ZO0fO.d.ts +88 -0
  113. package/dist/transformer/anthropicBetaInject.cjs +51 -0
  114. package/dist/transformer/anthropicBetaInject.d.cts +20 -0
  115. package/dist/transformer/anthropicBetaInject.d.ts +20 -0
  116. package/dist/transformer/anthropicBetaInject.js +25 -0
  117. package/dist/transformer/transformers/AnthropicTransformer.cjs +1017 -0
  118. package/dist/transformer/transformers/AnthropicTransformer.d.cts +148 -0
  119. package/dist/transformer/transformers/AnthropicTransformer.d.ts +148 -0
  120. package/dist/transformer/transformers/AnthropicTransformer.js +990 -0
  121. package/dist/transformer/transformers/ReasoningTransformer.cjs +273 -0
  122. package/dist/transformer/transformers/ReasoningTransformer.d.cts +47 -0
  123. package/dist/transformer/transformers/ReasoningTransformer.d.ts +47 -0
  124. package/dist/transformer/transformers/ReasoningTransformer.js +253 -0
  125. package/dist/transformer/transformers.cjs +3206 -0
  126. package/dist/transformer/transformers.d.cts +100 -0
  127. package/dist/transformer/transformers.d.ts +100 -0
  128. package/dist/transformer/transformers.js +3174 -0
  129. package/dist/transformer.d.cts +8 -31
  130. package/dist/transformer.d.ts +8 -31
  131. package/dist/types-BScIHmPr.d.cts +153 -0
  132. package/dist/types-BScIHmPr.d.ts +153 -0
  133. package/package.json +3 -3
  134. package/dist/SubscriptionAuthSource-Cr4fVEYY.d.cts +0 -264
  135. package/dist/SubscriptionAuthSource-D89zmiSS.d.ts +0 -264
  136. package/dist/index-BTSmc9Sm.d.ts +0 -645
  137. package/dist/index-DXazdTzZ.d.cts +0 -645
  138. package/dist/types-DCzHkhJt.d.ts +0 -467
  139. package/dist/types-DZIQbgp0.d.cts +0 -467
@@ -0,0 +1,82 @@
1
+ import { AnthropicChatRequest, OpenAIChatRequest, AnthropicChatResponse, OpenAIChatResponse, ConversionConfig } from '@omnicross/contracts/completion-types';
2
+
3
+ /**
4
+ * Anthropic → OpenAI API conversion.
5
+ *
6
+ * Used by the claude-code-rerouter direction: clients call our endpoint with
7
+ * an Anthropic-style payload, we forward to an upstream OpenAI provider.
8
+ *
9
+ * Includes:
10
+ * - Response conversion (chat + tools + thinking blocks)
11
+ * - Request conversion (reverse direction)
12
+ * - Streaming chunk transform (Anthropic SSE → OpenAI SSE)
13
+ * - Thinking-aware response enrichment
14
+ */
15
+
16
+ /**
17
+ * Convert Anthropic response to OpenAI format.
18
+ */
19
+ declare function convertAnthropicToOpenAI(response: AnthropicChatResponse): OpenAIChatResponse;
20
+ /**
21
+ * Convert Anthropic request to OpenAI format (reverse direction).
22
+ */
23
+ declare function convertAnthropicRequestToOpenAI(request: AnthropicChatRequest): OpenAIChatRequest;
24
+ /**
25
+ * Convert Anthropic response to OpenAI with thinking content preserved.
26
+ */
27
+ declare function convertAnthropicToOpenAIWithThinking(response: AnthropicChatResponse): OpenAIChatResponse;
28
+ /**
29
+ * Convert Anthropic streaming response to OpenAI format.
30
+ */
31
+ declare function convertAnthropicStreamToOpenAI(anthropicStream: AsyncIterable<string>): AsyncGenerator<string>;
32
+
33
+ /**
34
+ * OpenAI → Anthropic API conversion.
35
+ *
36
+ * Used by the claude-code-router direction: clients call our endpoint with
37
+ * an OpenAI-style payload, we forward to an upstream Anthropic provider.
38
+ *
39
+ * Includes:
40
+ * - Request conversion (chat + tools)
41
+ * - Streaming chunk transform (OpenAI SSE → Anthropic SSE)
42
+ * - Thinking-aware request enrichment
43
+ */
44
+
45
+ /**
46
+ * Convert OpenAI chat request to Anthropic format.
47
+ */
48
+ declare function convertOpenAIToAnthropic(request: OpenAIChatRequest, config: ConversionConfig): AnthropicChatRequest;
49
+ /**
50
+ * Convert OpenAI response to Anthropic format.
51
+ */
52
+ declare function convertOpenAIResponseToAnthropic(response: OpenAIChatResponse): AnthropicChatResponse;
53
+ /**
54
+ * Convert OpenAI request to Anthropic with thinking support.
55
+ */
56
+ declare function convertOpenAIToAnthropicWithThinking(request: OpenAIChatRequest, config: ConversionConfig & {
57
+ thinkingBudget?: number;
58
+ }): AnthropicChatRequest;
59
+ /**
60
+ * Convert OpenAI streaming response to Anthropic format.
61
+ * This creates an async generator that yields Anthropic SSE events.
62
+ */
63
+ declare function convertOpenAIStreamToAnthropic(openaiStream: AsyncIterable<string>): AsyncGenerator<string>;
64
+
65
+ /**
66
+ * Shared helpers for API direction converters.
67
+ *
68
+ * Pure functions used by both OpenAI→Anthropic and Anthropic→OpenAI
69
+ * conversion paths: tool schema mapping, stop-reason mapping, and
70
+ * lightweight image detection.
71
+ */
72
+
73
+ /**
74
+ * Check if a request contains image content (either format).
75
+ */
76
+ declare function hasImageContent(request: OpenAIChatRequest | AnthropicChatRequest): boolean;
77
+ /**
78
+ * Check if a request has thinking/reasoning enabled.
79
+ */
80
+ declare function hasThinkingEnabled(request: OpenAIChatRequest | AnthropicChatRequest): boolean;
81
+
82
+ export { convertAnthropicRequestToOpenAI, convertAnthropicStreamToOpenAI, convertAnthropicToOpenAI, convertAnthropicToOpenAIWithThinking, convertOpenAIResponseToAnthropic, convertOpenAIStreamToAnthropic, convertOpenAIToAnthropic, convertOpenAIToAnthropicWithThinking, hasImageContent, hasThinkingEnabled };
@@ -0,0 +1,82 @@
1
+ import { AnthropicChatRequest, OpenAIChatRequest, AnthropicChatResponse, OpenAIChatResponse, ConversionConfig } from '@omnicross/contracts/completion-types';
2
+
3
+ /**
4
+ * Anthropic → OpenAI API conversion.
5
+ *
6
+ * Used by the claude-code-rerouter direction: clients call our endpoint with
7
+ * an Anthropic-style payload, we forward to an upstream OpenAI provider.
8
+ *
9
+ * Includes:
10
+ * - Response conversion (chat + tools + thinking blocks)
11
+ * - Request conversion (reverse direction)
12
+ * - Streaming chunk transform (Anthropic SSE → OpenAI SSE)
13
+ * - Thinking-aware response enrichment
14
+ */
15
+
16
+ /**
17
+ * Convert Anthropic response to OpenAI format.
18
+ */
19
+ declare function convertAnthropicToOpenAI(response: AnthropicChatResponse): OpenAIChatResponse;
20
+ /**
21
+ * Convert Anthropic request to OpenAI format (reverse direction).
22
+ */
23
+ declare function convertAnthropicRequestToOpenAI(request: AnthropicChatRequest): OpenAIChatRequest;
24
+ /**
25
+ * Convert Anthropic response to OpenAI with thinking content preserved.
26
+ */
27
+ declare function convertAnthropicToOpenAIWithThinking(response: AnthropicChatResponse): OpenAIChatResponse;
28
+ /**
29
+ * Convert Anthropic streaming response to OpenAI format.
30
+ */
31
+ declare function convertAnthropicStreamToOpenAI(anthropicStream: AsyncIterable<string>): AsyncGenerator<string>;
32
+
33
+ /**
34
+ * OpenAI → Anthropic API conversion.
35
+ *
36
+ * Used by the claude-code-router direction: clients call our endpoint with
37
+ * an OpenAI-style payload, we forward to an upstream Anthropic provider.
38
+ *
39
+ * Includes:
40
+ * - Request conversion (chat + tools)
41
+ * - Streaming chunk transform (OpenAI SSE → Anthropic SSE)
42
+ * - Thinking-aware request enrichment
43
+ */
44
+
45
+ /**
46
+ * Convert OpenAI chat request to Anthropic format.
47
+ */
48
+ declare function convertOpenAIToAnthropic(request: OpenAIChatRequest, config: ConversionConfig): AnthropicChatRequest;
49
+ /**
50
+ * Convert OpenAI response to Anthropic format.
51
+ */
52
+ declare function convertOpenAIResponseToAnthropic(response: OpenAIChatResponse): AnthropicChatResponse;
53
+ /**
54
+ * Convert OpenAI request to Anthropic with thinking support.
55
+ */
56
+ declare function convertOpenAIToAnthropicWithThinking(request: OpenAIChatRequest, config: ConversionConfig & {
57
+ thinkingBudget?: number;
58
+ }): AnthropicChatRequest;
59
+ /**
60
+ * Convert OpenAI streaming response to Anthropic format.
61
+ * This creates an async generator that yields Anthropic SSE events.
62
+ */
63
+ declare function convertOpenAIStreamToAnthropic(openaiStream: AsyncIterable<string>): AsyncGenerator<string>;
64
+
65
+ /**
66
+ * Shared helpers for API direction converters.
67
+ *
68
+ * Pure functions used by both OpenAI→Anthropic and Anthropic→OpenAI
69
+ * conversion paths: tool schema mapping, stop-reason mapping, and
70
+ * lightweight image detection.
71
+ */
72
+
73
+ /**
74
+ * Check if a request contains image content (either format).
75
+ */
76
+ declare function hasImageContent(request: OpenAIChatRequest | AnthropicChatRequest): boolean;
77
+ /**
78
+ * Check if a request has thinking/reasoning enabled.
79
+ */
80
+ declare function hasThinkingEnabled(request: OpenAIChatRequest | AnthropicChatRequest): boolean;
81
+
82
+ export { convertAnthropicRequestToOpenAI, convertAnthropicStreamToOpenAI, convertAnthropicToOpenAI, convertAnthropicToOpenAIWithThinking, convertOpenAIResponseToAnthropic, convertOpenAIStreamToAnthropic, convertOpenAIToAnthropic, convertOpenAIToAnthropicWithThinking, hasImageContent, hasThinkingEnabled };