@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.
- package/dist/ApiConverter.cjs +799 -0
- package/dist/ApiConverter.d.cts +82 -0
- package/dist/ApiConverter.d.ts +82 -0
- package/dist/ApiConverter.js +763 -0
- package/dist/BuiltinToolExecutor-BluWyeob.d.ts +81 -0
- package/dist/BuiltinToolExecutor-CS2WpXhM.d.cts +81 -0
- package/dist/CompletionService-7fCmKAP3.d.ts +212 -0
- package/dist/CompletionService-DtOF_War.d.cts +212 -0
- package/dist/{ProviderProxy-f_8ziIhW.d.cts → ProviderProxy-C-xqrkKi.d.ts} +7 -2
- package/dist/{ProviderProxy-vjt8sQQk.d.ts → ProviderProxy-CnMQYN59.d.cts} +7 -2
- package/dist/completion/BuiltinToolExecutor.cjs +327 -0
- package/dist/completion/BuiltinToolExecutor.d.cts +4 -0
- package/dist/completion/BuiltinToolExecutor.d.ts +4 -0
- package/dist/completion/BuiltinToolExecutor.js +296 -0
- package/dist/completion/CompletionService.cjs +3487 -0
- package/dist/completion/CompletionService.d.cts +21 -0
- package/dist/completion/CompletionService.d.ts +21 -0
- package/dist/completion/CompletionService.js +3461 -0
- package/dist/completion/NativeSearchInjector.cjs +196 -0
- package/dist/completion/NativeSearchInjector.d.cts +42 -0
- package/dist/completion/NativeSearchInjector.d.ts +42 -0
- package/dist/completion/NativeSearchInjector.js +167 -0
- package/dist/completion/ProviderSearchInjector.cjs +87 -0
- package/dist/completion/ProviderSearchInjector.d.cts +47 -0
- package/dist/completion/ProviderSearchInjector.d.ts +47 -0
- package/dist/completion/ProviderSearchInjector.js +60 -0
- package/dist/completion/native-search-types.cjs +67 -0
- package/dist/completion/native-search-types.d.cts +3 -0
- package/dist/completion/native-search-types.d.ts +3 -0
- package/dist/completion/native-search-types.js +38 -0
- package/dist/completion/openrouter-headers.cjs +72 -0
- package/dist/completion/openrouter-headers.d.cts +44 -0
- package/dist/completion/openrouter-headers.d.ts +44 -0
- package/dist/completion/openrouter-headers.js +42 -0
- package/dist/completion/openrouter-models.cjs +86 -0
- package/dist/completion/openrouter-models.d.cts +27 -0
- package/dist/completion/openrouter-models.d.ts +27 -0
- package/dist/completion/openrouter-models.js +59 -0
- package/dist/completion/types.cjs +18 -0
- package/dist/completion/types.d.cts +3 -0
- package/dist/completion/types.d.ts +3 -0
- package/dist/completion/types.js +0 -0
- package/dist/completion/url-builder.cjs +138 -0
- package/dist/completion/url-builder.d.cts +87 -0
- package/dist/completion/url-builder.d.ts +87 -0
- package/dist/completion/url-builder.js +104 -0
- package/dist/completion.d.cts +148 -7
- package/dist/completion.d.ts +148 -7
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +27 -90
- package/dist/index.d.ts +27 -90
- package/dist/index.js +1 -0
- package/dist/outbound-api/routeResolver.cjs +221 -0
- package/dist/outbound-api/routeResolver.d.cts +18 -0
- package/dist/outbound-api/routeResolver.d.ts +18 -0
- package/dist/outbound-api/routeResolver.js +192 -0
- package/dist/outbound-api/subscriptionRegistryPort.d.cts +5 -2
- package/dist/outbound-api/subscriptionRegistryPort.d.ts +5 -2
- package/dist/outbound-api/types.cjs +18 -0
- package/dist/{types-CbCN2NQP.d.ts → outbound-api/types.d.cts} +17 -3
- package/dist/{types-CGGrKqC_.d.cts → outbound-api/types.d.ts} +17 -3
- package/dist/outbound-api/types.js +0 -0
- package/dist/outbound-api.cjs +1 -0
- package/dist/outbound-api.d.cts +14 -87
- package/dist/outbound-api.d.ts +14 -87
- package/dist/outbound-api.js +1 -0
- package/dist/pipeline/AuthSource.cjs +18 -0
- package/dist/pipeline/AuthSource.d.cts +101 -0
- package/dist/pipeline/AuthSource.d.ts +101 -0
- package/dist/pipeline/AuthSource.js +0 -0
- package/dist/pipeline/LlmConfigProviderAuth.cjs +169 -0
- package/dist/pipeline/LlmConfigProviderAuth.d.cts +86 -0
- package/dist/pipeline/LlmConfigProviderAuth.d.ts +86 -0
- package/dist/pipeline/LlmConfigProviderAuth.js +142 -0
- package/dist/pipeline/SubscriptionAuthSource.d.cts +165 -3
- package/dist/pipeline/SubscriptionAuthSource.d.ts +165 -3
- package/dist/pipeline/executeProviderCall.cjs +70 -0
- package/dist/pipeline/executeProviderCall.d.cts +149 -0
- package/dist/pipeline/executeProviderCall.d.ts +149 -0
- package/dist/pipeline/executeProviderCall.js +45 -0
- package/dist/pipeline/resolveProviderChain.cjs +47 -0
- package/dist/pipeline/resolveProviderChain.d.cts +58 -0
- package/dist/pipeline/resolveProviderChain.d.ts +58 -0
- package/dist/pipeline/resolveProviderChain.js +22 -0
- package/dist/pipeline/resolveSubscriptionChain.cjs +68 -0
- package/dist/pipeline/resolveSubscriptionChain.d.cts +68 -0
- package/dist/pipeline/resolveSubscriptionChain.d.ts +68 -0
- package/dist/pipeline/resolveSubscriptionChain.js +43 -0
- package/dist/ports/provider-config-source.cjs +18 -0
- package/dist/ports/provider-config-source.d.cts +51 -0
- package/dist/ports/provider-config-source.d.ts +51 -0
- package/dist/ports/provider-config-source.js +0 -0
- package/dist/ports/web-search-backend.cjs +18 -0
- package/dist/ports/web-search-backend.d.cts +29 -0
- package/dist/ports/web-search-backend.d.ts +29 -0
- package/dist/ports/web-search-backend.js +0 -0
- package/dist/ports.d.cts +10 -7
- package/dist/ports.d.ts +10 -7
- package/dist/provider-proxy/ProviderProxy.cjs +4643 -0
- package/dist/provider-proxy/ProviderProxy.d.cts +16 -0
- package/dist/provider-proxy/ProviderProxy.d.ts +16 -0
- package/dist/provider-proxy/ProviderProxy.js +4618 -0
- package/dist/provider-proxy/ingress/providerProxyShared.d.cts +5 -2
- package/dist/provider-proxy/ingress/providerProxyShared.d.ts +5 -2
- package/dist/provider-proxy/types.d.cts +406 -8
- package/dist/provider-proxy/types.d.ts +406 -8
- package/dist/provider-proxy.cjs +1 -0
- package/dist/provider-proxy.d.cts +8 -5
- package/dist/provider-proxy.d.ts +8 -5
- package/dist/provider-proxy.js +1 -0
- package/dist/routeResolver-BrbK6ja9.d.cts +88 -0
- package/dist/routeResolver-HE-ZO0fO.d.ts +88 -0
- package/dist/transformer/anthropicBetaInject.cjs +51 -0
- package/dist/transformer/anthropicBetaInject.d.cts +20 -0
- package/dist/transformer/anthropicBetaInject.d.ts +20 -0
- package/dist/transformer/anthropicBetaInject.js +25 -0
- package/dist/transformer/transformers/AnthropicTransformer.cjs +1017 -0
- package/dist/transformer/transformers/AnthropicTransformer.d.cts +148 -0
- package/dist/transformer/transformers/AnthropicTransformer.d.ts +148 -0
- package/dist/transformer/transformers/AnthropicTransformer.js +990 -0
- package/dist/transformer/transformers/ReasoningTransformer.cjs +273 -0
- package/dist/transformer/transformers/ReasoningTransformer.d.cts +47 -0
- package/dist/transformer/transformers/ReasoningTransformer.d.ts +47 -0
- package/dist/transformer/transformers/ReasoningTransformer.js +253 -0
- package/dist/transformer/transformers.cjs +3206 -0
- package/dist/transformer/transformers.d.cts +100 -0
- package/dist/transformer/transformers.d.ts +100 -0
- package/dist/transformer/transformers.js +3174 -0
- package/dist/transformer.d.cts +8 -31
- package/dist/transformer.d.ts +8 -31
- package/dist/types-BScIHmPr.d.cts +153 -0
- package/dist/types-BScIHmPr.d.ts +153 -0
- package/package.json +3 -3
- package/dist/SubscriptionAuthSource-Cr4fVEYY.d.cts +0 -264
- package/dist/SubscriptionAuthSource-D89zmiSS.d.ts +0 -264
- package/dist/index-BTSmc9Sm.d.ts +0 -645
- package/dist/index-DXazdTzZ.d.cts +0 -645
- package/dist/types-DCzHkhJt.d.ts +0 -467
- package/dist/types-DZIQbgp0.d.cts +0 -467
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { TransformerService } from '../transformer/TransformerService.cjs';
|
|
2
|
+
import { Transformer, ResolvedTransformerChain } from '../transformer/types.cjs';
|
|
3
|
+
import { SubscriptionAuthProfile } from './SubscriptionAuthSource.cjs';
|
|
4
|
+
import '@omnicross/contracts/subscription-types';
|
|
5
|
+
import './AuthSource.cjs';
|
|
6
|
+
import './SubscriptionAuthStrategy.cjs';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* resolveSubscriptionChain — shared subscription provider-chain resolver.
|
|
10
|
+
*
|
|
11
|
+
* Cross-vendor subscription "route-to" generalization (task #29). The Codex /
|
|
12
|
+
* OpenAI-Responses ingress subscription plan used to HARD-CODE its provider
|
|
13
|
+
* transformer chain to a single `OpenAIResponseTransformer`, ignoring the
|
|
14
|
+
* subscription profile's own `providerTransformerNames`. That only produced
|
|
15
|
+
* Responses-API bytes upstream — correct for the codex/ChatGPT subscription
|
|
16
|
+
* (whose profile chain IS `['openai-response']`), but WRONG for any
|
|
17
|
+
* subscription whose upstream speaks a non-Responses wire.
|
|
18
|
+
*
|
|
19
|
+
* This helper mirrors `SubscriptionDispatcher.resolveTransformers`: it resolves
|
|
20
|
+
* the profile's transformer NAMES into instances via the shared
|
|
21
|
+
* `TransformerService` (the SAME registry the Anthropic-ingress dispatcher uses),
|
|
22
|
+
* so the Responses ingress re-encodes Unified → the target wire exactly like the
|
|
23
|
+
* BYO plan's `resolveProviderChain`. The endpoint transformer stays
|
|
24
|
+
* `OpenAIResponseTransformer` (the ingress wire is Responses) — so the full
|
|
25
|
+
* exchange is:
|
|
26
|
+
*
|
|
27
|
+
* Responses → (OpenAIResponseTransformer decode) → Unified
|
|
28
|
+
* → (profile providerTransformers encode) → target wire → upstream
|
|
29
|
+
* target wire → (profile providerTransformers decode) → Unified
|
|
30
|
+
* → (OpenAIResponseTransformer encode) → Responses → Codex CLI
|
|
31
|
+
*
|
|
32
|
+
* BYTE-IDENTICAL codex preservation: the codex profile's
|
|
33
|
+
* `providerTransformerNames` is `['openai-response']`, which resolves to the
|
|
34
|
+
* SAME `OpenAIResponseTransformer` instance the ingress already used — so the
|
|
35
|
+
* codex case is unchanged. The fallback (empty/missing names) ALSO yields the
|
|
36
|
+
* shared `OpenAIResponseTransformer`, so a profile that omits names behaves as
|
|
37
|
+
* before.
|
|
38
|
+
*
|
|
39
|
+
* @module pipeline/resolveSubscriptionChain
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Resolve a subscription profile's provider/model transformer chain.
|
|
44
|
+
*
|
|
45
|
+
* @param profile the subscription profile (carries the names).
|
|
46
|
+
* @param transformerService the shared registry (from `llmConfig.getTransformerService()`).
|
|
47
|
+
* @param fallbackEndpoint the shared `OpenAIResponseTransformer` instance,
|
|
48
|
+
* used when the profile declares NO provider names
|
|
49
|
+
* (preserves the prior hard-coded behavior).
|
|
50
|
+
* @param overrideNames OPTIONAL explicit provider transformer names that
|
|
51
|
+
* SUPERSEDE the profile's static
|
|
52
|
+
* `providerTransformerNames` — the opencodego zen
|
|
53
|
+
* seam (Phase 3) feeds the shape-resolved chain here
|
|
54
|
+
* (e.g. `['openai-response']` / `['gemini']`). When
|
|
55
|
+
* `undefined` the static field is read exactly as
|
|
56
|
+
* before (codex byte-identity). An explicit EMPTY
|
|
57
|
+
* array means "no provider chain" (the zen anthropic
|
|
58
|
+
* shape — though that path is same-format and never
|
|
59
|
+
* calls this) and falls back to `[fallbackEndpoint]`
|
|
60
|
+
* like the absent-names case.
|
|
61
|
+
*
|
|
62
|
+
* @returns the resolved chain. `providerTransformers` is the resolved provider
|
|
63
|
+
* names (or `[fallbackEndpoint]` when none declared); `modelTransformers` is the
|
|
64
|
+
* profile's resolved model names (usually empty).
|
|
65
|
+
*/
|
|
66
|
+
declare function resolveSubscriptionChain(profile: SubscriptionAuthProfile, transformerService: TransformerService | undefined, fallbackEndpoint: Transformer, overrideNames?: readonly string[]): ResolvedTransformerChain;
|
|
67
|
+
|
|
68
|
+
export { resolveSubscriptionChain };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { TransformerService } from '../transformer/TransformerService.js';
|
|
2
|
+
import { Transformer, ResolvedTransformerChain } from '../transformer/types.js';
|
|
3
|
+
import { SubscriptionAuthProfile } from './SubscriptionAuthSource.js';
|
|
4
|
+
import '@omnicross/contracts/subscription-types';
|
|
5
|
+
import './AuthSource.js';
|
|
6
|
+
import './SubscriptionAuthStrategy.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* resolveSubscriptionChain — shared subscription provider-chain resolver.
|
|
10
|
+
*
|
|
11
|
+
* Cross-vendor subscription "route-to" generalization (task #29). The Codex /
|
|
12
|
+
* OpenAI-Responses ingress subscription plan used to HARD-CODE its provider
|
|
13
|
+
* transformer chain to a single `OpenAIResponseTransformer`, ignoring the
|
|
14
|
+
* subscription profile's own `providerTransformerNames`. That only produced
|
|
15
|
+
* Responses-API bytes upstream — correct for the codex/ChatGPT subscription
|
|
16
|
+
* (whose profile chain IS `['openai-response']`), but WRONG for any
|
|
17
|
+
* subscription whose upstream speaks a non-Responses wire.
|
|
18
|
+
*
|
|
19
|
+
* This helper mirrors `SubscriptionDispatcher.resolveTransformers`: it resolves
|
|
20
|
+
* the profile's transformer NAMES into instances via the shared
|
|
21
|
+
* `TransformerService` (the SAME registry the Anthropic-ingress dispatcher uses),
|
|
22
|
+
* so the Responses ingress re-encodes Unified → the target wire exactly like the
|
|
23
|
+
* BYO plan's `resolveProviderChain`. The endpoint transformer stays
|
|
24
|
+
* `OpenAIResponseTransformer` (the ingress wire is Responses) — so the full
|
|
25
|
+
* exchange is:
|
|
26
|
+
*
|
|
27
|
+
* Responses → (OpenAIResponseTransformer decode) → Unified
|
|
28
|
+
* → (profile providerTransformers encode) → target wire → upstream
|
|
29
|
+
* target wire → (profile providerTransformers decode) → Unified
|
|
30
|
+
* → (OpenAIResponseTransformer encode) → Responses → Codex CLI
|
|
31
|
+
*
|
|
32
|
+
* BYTE-IDENTICAL codex preservation: the codex profile's
|
|
33
|
+
* `providerTransformerNames` is `['openai-response']`, which resolves to the
|
|
34
|
+
* SAME `OpenAIResponseTransformer` instance the ingress already used — so the
|
|
35
|
+
* codex case is unchanged. The fallback (empty/missing names) ALSO yields the
|
|
36
|
+
* shared `OpenAIResponseTransformer`, so a profile that omits names behaves as
|
|
37
|
+
* before.
|
|
38
|
+
*
|
|
39
|
+
* @module pipeline/resolveSubscriptionChain
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Resolve a subscription profile's provider/model transformer chain.
|
|
44
|
+
*
|
|
45
|
+
* @param profile the subscription profile (carries the names).
|
|
46
|
+
* @param transformerService the shared registry (from `llmConfig.getTransformerService()`).
|
|
47
|
+
* @param fallbackEndpoint the shared `OpenAIResponseTransformer` instance,
|
|
48
|
+
* used when the profile declares NO provider names
|
|
49
|
+
* (preserves the prior hard-coded behavior).
|
|
50
|
+
* @param overrideNames OPTIONAL explicit provider transformer names that
|
|
51
|
+
* SUPERSEDE the profile's static
|
|
52
|
+
* `providerTransformerNames` — the opencodego zen
|
|
53
|
+
* seam (Phase 3) feeds the shape-resolved chain here
|
|
54
|
+
* (e.g. `['openai-response']` / `['gemini']`). When
|
|
55
|
+
* `undefined` the static field is read exactly as
|
|
56
|
+
* before (codex byte-identity). An explicit EMPTY
|
|
57
|
+
* array means "no provider chain" (the zen anthropic
|
|
58
|
+
* shape — though that path is same-format and never
|
|
59
|
+
* calls this) and falls back to `[fallbackEndpoint]`
|
|
60
|
+
* like the absent-names case.
|
|
61
|
+
*
|
|
62
|
+
* @returns the resolved chain. `providerTransformers` is the resolved provider
|
|
63
|
+
* names (or `[fallbackEndpoint]` when none declared); `modelTransformers` is the
|
|
64
|
+
* profile's resolved model names (usually empty).
|
|
65
|
+
*/
|
|
66
|
+
declare function resolveSubscriptionChain(profile: SubscriptionAuthProfile, transformerService: TransformerService | undefined, fallbackEndpoint: Transformer, overrideNames?: readonly string[]): ResolvedTransformerChain;
|
|
67
|
+
|
|
68
|
+
export { resolveSubscriptionChain };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// src/pipeline/resolveSubscriptionChain.ts
|
|
2
|
+
function resolveOne(transformerService, name) {
|
|
3
|
+
const t = transformerService.getTransformer(name);
|
|
4
|
+
if (!t) return null;
|
|
5
|
+
return typeof t === "function" ? new t() : t;
|
|
6
|
+
}
|
|
7
|
+
function resolveSubscriptionChain(profile, transformerService, fallbackEndpoint, overrideNames) {
|
|
8
|
+
const providerNames = overrideNames ?? profile.providerTransformerNames ?? [];
|
|
9
|
+
const modelNames = profile.modelTransformerNames ?? [];
|
|
10
|
+
if (providerNames.length === 0) {
|
|
11
|
+
return { providerTransformers: [fallbackEndpoint], modelTransformers: [] };
|
|
12
|
+
}
|
|
13
|
+
if (!transformerService) {
|
|
14
|
+
throw new Error(
|
|
15
|
+
"[resolveSubscriptionChain] profile declares providerTransformerNames but no TransformerService is wired"
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
const providerTransformers = [];
|
|
19
|
+
for (const name of providerNames) {
|
|
20
|
+
const instance = resolveOne(transformerService, name);
|
|
21
|
+
if (!instance) {
|
|
22
|
+
console.warn(`[resolveSubscriptionChain] Transformer not registered: ${name}`);
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
providerTransformers.push(instance);
|
|
26
|
+
}
|
|
27
|
+
const modelTransformers = [];
|
|
28
|
+
for (const name of modelNames) {
|
|
29
|
+
const instance = resolveOne(transformerService, name);
|
|
30
|
+
if (!instance) {
|
|
31
|
+
console.warn(`[resolveSubscriptionChain] Model transformer not registered: ${name}`);
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
modelTransformers.push(instance);
|
|
35
|
+
}
|
|
36
|
+
if (providerTransformers.length === 0) {
|
|
37
|
+
return { providerTransformers: [fallbackEndpoint], modelTransformers };
|
|
38
|
+
}
|
|
39
|
+
return { providerTransformers, modelTransformers };
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
resolveSubscriptionChain
|
|
43
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
|
|
16
|
+
// src/ports/provider-config-source.ts
|
|
17
|
+
var provider_config_source_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(provider_config_source_exports);
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { LLMProvider, AgentDefaultModels, GlobalModelParameters } from '@omnicross/contracts/llm-config';
|
|
2
|
+
import { ResolvedTransformerChain, Transformer } from '../transformer/types.cjs';
|
|
3
|
+
import { TransformerService } from '../transformer/TransformerService.cjs';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* `ProviderConfigSource` — core-owned port for the provider catalog + routing +
|
|
7
|
+
* transformer-chain reads the serving core needs from its host config service.
|
|
8
|
+
*
|
|
9
|
+
* The serving core (`pipeline` / `transformer` / `provider-proxy` /
|
|
10
|
+
* `completion` / `outbound-api`) MUST depend on THIS interface, never on the
|
|
11
|
+
* host's concrete config-service class as a type. The host supplies the impl
|
|
12
|
+
* at bootstrap (its config service implementing `ProviderConfigSource` is the
|
|
13
|
+
* compile-time assignability guard).
|
|
14
|
+
*
|
|
15
|
+
* The surface is sized to EXACTLY the ten methods the core invokes today —
|
|
16
|
+
* signatures copied verbatim from the host's config service so the host stays
|
|
17
|
+
* structurally assignable with zero behavior change.
|
|
18
|
+
*
|
|
19
|
+
* NOTE (Phase-1 narrowing, omnicross): `getTransformerService()` is a
|
|
20
|
+
* transformer-registry accessor that returns a CORE class (`TransformerService`,
|
|
21
|
+
* not a host class), so exposing it through this port is sound for 0b. It is a
|
|
22
|
+
* separate concern from provider-catalog reads, however; splitting it into its
|
|
23
|
+
* own narrower port is deferred to Phase 1 (see design Q1). Do NOT split now.
|
|
24
|
+
*
|
|
25
|
+
* @module ports/provider-config-source
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
interface ProviderConfigSource {
|
|
29
|
+
getProvider(id: string): Promise<LLMProvider | null>;
|
|
30
|
+
/** @deprecated mirror of the host method — router-based routing is a no-op today. */
|
|
31
|
+
resolveRoutedModel(providerId: string, modelId: string): Promise<{
|
|
32
|
+
isRouted: boolean;
|
|
33
|
+
actualProviderId: string;
|
|
34
|
+
actualModelId: string;
|
|
35
|
+
routerId?: string;
|
|
36
|
+
routerName?: string;
|
|
37
|
+
} | null>;
|
|
38
|
+
resolveEffectiveModels(): Promise<{
|
|
39
|
+
background?: string;
|
|
40
|
+
vision?: string;
|
|
41
|
+
}>;
|
|
42
|
+
getAgentDefaultModels(): Promise<AgentDefaultModels>;
|
|
43
|
+
hasVisionCapability(providerId: string, modelId: string): Promise<boolean>;
|
|
44
|
+
getGlobalModelParameters(): Promise<GlobalModelParameters>;
|
|
45
|
+
getDiscoveredModelMaxTokens(providerId: string, modelId: string): Promise<number | undefined>;
|
|
46
|
+
resolveTransformerChain(providerId: string, model?: string): Promise<ResolvedTransformerChain>;
|
|
47
|
+
getMainTransformer(providerId: string): Promise<Transformer | null>;
|
|
48
|
+
getTransformerService(): TransformerService | undefined;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export type { ProviderConfigSource };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { LLMProvider, AgentDefaultModels, GlobalModelParameters } from '@omnicross/contracts/llm-config';
|
|
2
|
+
import { ResolvedTransformerChain, Transformer } from '../transformer/types.js';
|
|
3
|
+
import { TransformerService } from '../transformer/TransformerService.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* `ProviderConfigSource` — core-owned port for the provider catalog + routing +
|
|
7
|
+
* transformer-chain reads the serving core needs from its host config service.
|
|
8
|
+
*
|
|
9
|
+
* The serving core (`pipeline` / `transformer` / `provider-proxy` /
|
|
10
|
+
* `completion` / `outbound-api`) MUST depend on THIS interface, never on the
|
|
11
|
+
* host's concrete config-service class as a type. The host supplies the impl
|
|
12
|
+
* at bootstrap (its config service implementing `ProviderConfigSource` is the
|
|
13
|
+
* compile-time assignability guard).
|
|
14
|
+
*
|
|
15
|
+
* The surface is sized to EXACTLY the ten methods the core invokes today —
|
|
16
|
+
* signatures copied verbatim from the host's config service so the host stays
|
|
17
|
+
* structurally assignable with zero behavior change.
|
|
18
|
+
*
|
|
19
|
+
* NOTE (Phase-1 narrowing, omnicross): `getTransformerService()` is a
|
|
20
|
+
* transformer-registry accessor that returns a CORE class (`TransformerService`,
|
|
21
|
+
* not a host class), so exposing it through this port is sound for 0b. It is a
|
|
22
|
+
* separate concern from provider-catalog reads, however; splitting it into its
|
|
23
|
+
* own narrower port is deferred to Phase 1 (see design Q1). Do NOT split now.
|
|
24
|
+
*
|
|
25
|
+
* @module ports/provider-config-source
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
interface ProviderConfigSource {
|
|
29
|
+
getProvider(id: string): Promise<LLMProvider | null>;
|
|
30
|
+
/** @deprecated mirror of the host method — router-based routing is a no-op today. */
|
|
31
|
+
resolveRoutedModel(providerId: string, modelId: string): Promise<{
|
|
32
|
+
isRouted: boolean;
|
|
33
|
+
actualProviderId: string;
|
|
34
|
+
actualModelId: string;
|
|
35
|
+
routerId?: string;
|
|
36
|
+
routerName?: string;
|
|
37
|
+
} | null>;
|
|
38
|
+
resolveEffectiveModels(): Promise<{
|
|
39
|
+
background?: string;
|
|
40
|
+
vision?: string;
|
|
41
|
+
}>;
|
|
42
|
+
getAgentDefaultModels(): Promise<AgentDefaultModels>;
|
|
43
|
+
hasVisionCapability(providerId: string, modelId: string): Promise<boolean>;
|
|
44
|
+
getGlobalModelParameters(): Promise<GlobalModelParameters>;
|
|
45
|
+
getDiscoveredModelMaxTokens(providerId: string, modelId: string): Promise<number | undefined>;
|
|
46
|
+
resolveTransformerChain(providerId: string, model?: string): Promise<ResolvedTransformerChain>;
|
|
47
|
+
getMainTransformer(providerId: string): Promise<Transformer | null>;
|
|
48
|
+
getTransformerService(): TransformerService | undefined;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export type { ProviderConfigSource };
|
|
File without changes
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
|
|
16
|
+
// src/ports/web-search-backend.ts
|
|
17
|
+
var web_search_backend_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(web_search_backend_exports);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { WebSearchProviderId, WebSearchOptions, WebSearchResponse, JinaReaderResponse } from '@omnicross/contracts/websearch-types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* `WebSearchBackend` — core-owned port for the web-search service the serving
|
|
5
|
+
* core's built-in `web_search` tool executor and the Anthropic proxy hints use.
|
|
6
|
+
*
|
|
7
|
+
* The serving core MUST depend on THIS interface, never on the concrete host
|
|
8
|
+
* `WebSearchService` class as a type. The host already exposes a superset of
|
|
9
|
+
* this surface, so it is passed directly with NO adapter.
|
|
10
|
+
*
|
|
11
|
+
* The surface is EXACTLY the three methods the core invokes
|
|
12
|
+
* (`search`/`isProviderEnabled`/`readUrl`), signatures matching
|
|
13
|
+
* `WebSearchService`. The argument/return types are `@omnicross/contracts`
|
|
14
|
+
* contract types (not host classes), so they cross into a Phase-1 package cleanly.
|
|
15
|
+
*
|
|
16
|
+
* @module ports/web-search-backend
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
interface WebSearchBackend {
|
|
20
|
+
search(query: string, providerId: WebSearchProviderId, options?: WebSearchOptions): Promise<WebSearchResponse>;
|
|
21
|
+
isProviderEnabled(id: WebSearchProviderId): boolean;
|
|
22
|
+
readUrl(url: string, options?: {
|
|
23
|
+
timeout?: number;
|
|
24
|
+
signal?: AbortSignal;
|
|
25
|
+
apiKey?: string;
|
|
26
|
+
}): Promise<JinaReaderResponse>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type { WebSearchBackend };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { WebSearchProviderId, WebSearchOptions, WebSearchResponse, JinaReaderResponse } from '@omnicross/contracts/websearch-types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* `WebSearchBackend` — core-owned port for the web-search service the serving
|
|
5
|
+
* core's built-in `web_search` tool executor and the Anthropic proxy hints use.
|
|
6
|
+
*
|
|
7
|
+
* The serving core MUST depend on THIS interface, never on the concrete host
|
|
8
|
+
* `WebSearchService` class as a type. The host already exposes a superset of
|
|
9
|
+
* this surface, so it is passed directly with NO adapter.
|
|
10
|
+
*
|
|
11
|
+
* The surface is EXACTLY the three methods the core invokes
|
|
12
|
+
* (`search`/`isProviderEnabled`/`readUrl`), signatures matching
|
|
13
|
+
* `WebSearchService`. The argument/return types are `@omnicross/contracts`
|
|
14
|
+
* contract types (not host classes), so they cross into a Phase-1 package cleanly.
|
|
15
|
+
*
|
|
16
|
+
* @module ports/web-search-backend
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
interface WebSearchBackend {
|
|
20
|
+
search(query: string, providerId: WebSearchProviderId, options?: WebSearchOptions): Promise<WebSearchResponse>;
|
|
21
|
+
isProviderEnabled(id: WebSearchProviderId): boolean;
|
|
22
|
+
readUrl(url: string, options?: {
|
|
23
|
+
timeout?: number;
|
|
24
|
+
signal?: AbortSignal;
|
|
25
|
+
apiKey?: string;
|
|
26
|
+
}): Promise<JinaReaderResponse>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type { WebSearchBackend };
|
|
File without changes
|
package/dist/ports.d.cts
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
export { C as CorePaths, a as CoreUsageEvent, b as CoreUsageTokenCounts, U as UsageEventSink } from './usage-event-sink-BX7FE1NL.cjs';
|
|
2
2
|
export { L as Logger } from './ApiKeyPoolService-BmMkau07.cjs';
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
3
|
+
export { ProviderConfigSource } from './ports/provider-config-source.cjs';
|
|
4
|
+
export { WebSearchBackend } from './ports/web-search-backend.cjs';
|
|
5
|
+
export { UsageRecorderImport as UsageSink } from './provider-proxy/types.cjs';
|
|
6
|
+
export { OutboundKeyDb as OutboundCredentialStore } from './outbound-api/types.cjs';
|
|
5
7
|
import '@omnicross/contracts/llm-config';
|
|
8
|
+
import './transformer/types.cjs';
|
|
9
|
+
import './transformer/TransformerService.cjs';
|
|
10
|
+
import '@omnicross/contracts/websearch-types';
|
|
6
11
|
import 'node:http';
|
|
7
12
|
import '@omnicross/contracts/completion-types';
|
|
8
13
|
import '@omnicross/contracts/subscription-types';
|
|
9
14
|
import '@omnicross/contracts/usage-types';
|
|
10
|
-
import './
|
|
15
|
+
import './pipeline/AuthSource.cjs';
|
|
16
|
+
import './pipeline/SubscriptionAuthSource.cjs';
|
|
11
17
|
import './pipeline/SubscriptionAuthStrategy.cjs';
|
|
12
|
-
import './
|
|
13
|
-
import './transformer/TransformerService.cjs';
|
|
14
|
-
import '@omnicross/contracts/websearch-types';
|
|
15
|
-
import './ProviderProxy-f_8ziIhW.cjs';
|
|
18
|
+
import './ProviderProxy-CnMQYN59.cjs';
|
package/dist/ports.d.ts
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
export { C as CorePaths, a as CoreUsageEvent, b as CoreUsageTokenCounts, U as UsageEventSink } from './usage-event-sink-BX7FE1NL.js';
|
|
2
2
|
export { L as Logger } from './ApiKeyPoolService-BmMkau07.js';
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
3
|
+
export { ProviderConfigSource } from './ports/provider-config-source.js';
|
|
4
|
+
export { WebSearchBackend } from './ports/web-search-backend.js';
|
|
5
|
+
export { UsageRecorderImport as UsageSink } from './provider-proxy/types.js';
|
|
6
|
+
export { OutboundKeyDb as OutboundCredentialStore } from './outbound-api/types.js';
|
|
5
7
|
import '@omnicross/contracts/llm-config';
|
|
8
|
+
import './transformer/types.js';
|
|
9
|
+
import './transformer/TransformerService.js';
|
|
10
|
+
import '@omnicross/contracts/websearch-types';
|
|
6
11
|
import 'node:http';
|
|
7
12
|
import '@omnicross/contracts/completion-types';
|
|
8
13
|
import '@omnicross/contracts/subscription-types';
|
|
9
14
|
import '@omnicross/contracts/usage-types';
|
|
10
|
-
import './
|
|
15
|
+
import './pipeline/AuthSource.js';
|
|
16
|
+
import './pipeline/SubscriptionAuthSource.js';
|
|
11
17
|
import './pipeline/SubscriptionAuthStrategy.js';
|
|
12
|
-
import './
|
|
13
|
-
import './transformer/TransformerService.js';
|
|
14
|
-
import '@omnicross/contracts/websearch-types';
|
|
15
|
-
import './ProviderProxy-vjt8sQQk.js';
|
|
18
|
+
import './ProviderProxy-C-xqrkKi.js';
|