@omnicross/contracts 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/README.md +15 -0
- package/dist/account-tokens-types.cjs +18 -0
- package/dist/account-tokens-types.d.cts +142 -0
- package/dist/account-tokens-types.d.ts +142 -0
- package/dist/account-tokens-types.js +0 -0
- package/dist/canonical-models.cjs +262 -0
- package/dist/canonical-models.d.cts +107 -0
- package/dist/canonical-models.d.ts +107 -0
- package/dist/canonical-models.js +232 -0
- package/dist/completion-types.cjs +18 -0
- package/dist/completion-types.d.cts +324 -0
- package/dist/completion-types.d.ts +324 -0
- package/dist/completion-types.js +0 -0
- package/dist/endpoint-resolver.cjs +54 -0
- package/dist/endpoint-resolver.d.cts +43 -0
- package/dist/endpoint-resolver.d.ts +43 -0
- package/dist/endpoint-resolver.js +29 -0
- package/dist/extended-context.cjs +39 -0
- package/dist/extended-context.d.cts +21 -0
- package/dist/extended-context.d.ts +21 -0
- package/dist/extended-context.js +13 -0
- package/dist/index.cjs +2724 -0
- package/dist/index.d.cts +14 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +2656 -0
- package/dist/llm-config-CQjOimv2.d.cts +390 -0
- package/dist/llm-config-D1jKQLVp.d.ts +390 -0
- package/dist/llm-config.cjs +18 -0
- package/dist/llm-config.d.cts +2 -0
- package/dist/llm-config.d.ts +2 -0
- package/dist/llm-config.js +0 -0
- package/dist/mcp-types.cjs +33 -0
- package/dist/mcp-types.d.cts +131 -0
- package/dist/mcp-types.d.ts +131 -0
- package/dist/mcp-types.js +8 -0
- package/dist/message-blocks.cjs +18 -0
- package/dist/message-blocks.d.cts +44 -0
- package/dist/message-blocks.d.ts +44 -0
- package/dist/message-blocks.js +0 -0
- package/dist/provider-presets/index.cjs +2183 -0
- package/dist/provider-presets/index.d.cts +104 -0
- package/dist/provider-presets/index.d.ts +104 -0
- package/dist/provider-presets/index.js +2143 -0
- package/dist/subscription-types.cjs +48 -0
- package/dist/subscription-types.d.cts +149 -0
- package/dist/subscription-types.d.ts +149 -0
- package/dist/subscription-types.js +22 -0
- package/dist/thinking-CBWSLel8.d.cts +33 -0
- package/dist/thinking-CBWSLel8.d.ts +33 -0
- package/dist/thinking-config.cjs +243 -0
- package/dist/thinking-config.d.cts +71 -0
- package/dist/thinking-config.d.ts +71 -0
- package/dist/thinking-config.js +205 -0
- package/dist/usage-types.cjs +18 -0
- package/dist/usage-types.d.cts +41 -0
- package/dist/usage-types.d.ts +41 -0
- package/dist/usage-types.js +0 -0
- package/dist/websearch-types.cjs +37 -0
- package/dist/websearch-types.d.cts +76 -0
- package/dist/websearch-types.d.ts +76 -0
- package/dist/websearch-types.js +11 -0
- package/package.json +116 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { L as LLMProvider } from './llm-config-CQjOimv2.cjs';
|
|
2
|
+
import './thinking-CBWSLel8.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Provider endpoint resolver — single source of truth for "which baseUrl/apiKey
|
|
6
|
+
* does this provider actually use right now?"
|
|
7
|
+
*
|
|
8
|
+
* Three resolution layers, in priority order:
|
|
9
|
+
* 1. `apiModes + selectedApiModeId` — preferred path (introduced by
|
|
10
|
+
* `provider-api-mode-toggle` change). User customizations on
|
|
11
|
+
* `api_base_url` / `api_key` always win over the mode default.
|
|
12
|
+
* 2. Legacy `codingPlan.enabled` flag — kept for backward compat with
|
|
13
|
+
* pre-migration rows that may still have `apiModes` undefined when
|
|
14
|
+
* preset registry reattach hasn't run for some reason.
|
|
15
|
+
* 3. Plain `api_base_url` / `api_key` — for providers without modes at all.
|
|
16
|
+
*
|
|
17
|
+
* NOTE: this module lives in the contracts package because both the serving
|
|
18
|
+
* core (`CompletionService`) and client UIs (preview hints) need to compute
|
|
19
|
+
* endpoints consistently.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
interface ResolvedEndpoint {
|
|
23
|
+
/** The base URL the request should hit */
|
|
24
|
+
baseUrl: string;
|
|
25
|
+
/** The API key to use; empty string when none configured */
|
|
26
|
+
apiKey: string;
|
|
27
|
+
/** Which mode id resolved (for telemetry / debug only) */
|
|
28
|
+
resolvedModeId?: string;
|
|
29
|
+
/** Which resolution layer fired (for telemetry / debug only) */
|
|
30
|
+
source: 'api-mode' | 'legacy-coding-plan' | 'plain';
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Resolve the endpoint for a provider.
|
|
34
|
+
*
|
|
35
|
+
* Important: when `apiModes` is set and a mode is selected, we still prefer
|
|
36
|
+
* the user-customized `api_base_url` / `api_key` over the mode's defaults,
|
|
37
|
+
* because the UI synchronizes these fields when the user picks a mode (D6 in
|
|
38
|
+
* design.md). A mismatch only happens transiently or after a "Keep
|
|
39
|
+
* customizations" flow — both should round-trip via the user's value.
|
|
40
|
+
*/
|
|
41
|
+
declare function resolveProviderEndpoint(provider: LLMProvider): ResolvedEndpoint;
|
|
42
|
+
|
|
43
|
+
export { type ResolvedEndpoint, resolveProviderEndpoint };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { L as LLMProvider } from './llm-config-D1jKQLVp.js';
|
|
2
|
+
import './thinking-CBWSLel8.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Provider endpoint resolver — single source of truth for "which baseUrl/apiKey
|
|
6
|
+
* does this provider actually use right now?"
|
|
7
|
+
*
|
|
8
|
+
* Three resolution layers, in priority order:
|
|
9
|
+
* 1. `apiModes + selectedApiModeId` — preferred path (introduced by
|
|
10
|
+
* `provider-api-mode-toggle` change). User customizations on
|
|
11
|
+
* `api_base_url` / `api_key` always win over the mode default.
|
|
12
|
+
* 2. Legacy `codingPlan.enabled` flag — kept for backward compat with
|
|
13
|
+
* pre-migration rows that may still have `apiModes` undefined when
|
|
14
|
+
* preset registry reattach hasn't run for some reason.
|
|
15
|
+
* 3. Plain `api_base_url` / `api_key` — for providers without modes at all.
|
|
16
|
+
*
|
|
17
|
+
* NOTE: this module lives in the contracts package because both the serving
|
|
18
|
+
* core (`CompletionService`) and client UIs (preview hints) need to compute
|
|
19
|
+
* endpoints consistently.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
interface ResolvedEndpoint {
|
|
23
|
+
/** The base URL the request should hit */
|
|
24
|
+
baseUrl: string;
|
|
25
|
+
/** The API key to use; empty string when none configured */
|
|
26
|
+
apiKey: string;
|
|
27
|
+
/** Which mode id resolved (for telemetry / debug only) */
|
|
28
|
+
resolvedModeId?: string;
|
|
29
|
+
/** Which resolution layer fired (for telemetry / debug only) */
|
|
30
|
+
source: 'api-mode' | 'legacy-coding-plan' | 'plain';
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Resolve the endpoint for a provider.
|
|
34
|
+
*
|
|
35
|
+
* Important: when `apiModes` is set and a mode is selected, we still prefer
|
|
36
|
+
* the user-customized `api_base_url` / `api_key` over the mode's defaults,
|
|
37
|
+
* because the UI synchronizes these fields when the user picks a mode (D6 in
|
|
38
|
+
* design.md). A mismatch only happens transiently or after a "Keep
|
|
39
|
+
* customizations" flow — both should round-trip via the user's value.
|
|
40
|
+
*/
|
|
41
|
+
declare function resolveProviderEndpoint(provider: LLMProvider): ResolvedEndpoint;
|
|
42
|
+
|
|
43
|
+
export { type ResolvedEndpoint, resolveProviderEndpoint };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// src/endpoint-resolver.ts
|
|
2
|
+
function resolveProviderEndpoint(provider) {
|
|
3
|
+
if (provider.apiModes && provider.apiModes.length > 0 && provider.selectedApiModeId) {
|
|
4
|
+
const mode = provider.apiModes.find((m) => m.id === provider.selectedApiModeId);
|
|
5
|
+
if (mode) {
|
|
6
|
+
return {
|
|
7
|
+
baseUrl: provider.api_base_url || mode.baseUrl,
|
|
8
|
+
apiKey: provider.api_key || mode.apiKey || "",
|
|
9
|
+
resolvedModeId: mode.id,
|
|
10
|
+
source: "api-mode"
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
if (provider.codingPlan?.enabled && provider.codingPlan.baseUrl) {
|
|
15
|
+
return {
|
|
16
|
+
baseUrl: provider.codingPlan.baseUrl,
|
|
17
|
+
apiKey: provider.codingPlan.apiKey || provider.api_key || "",
|
|
18
|
+
source: "legacy-coding-plan"
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
baseUrl: provider.api_base_url || "",
|
|
23
|
+
apiKey: provider.api_key || "",
|
|
24
|
+
source: "plain"
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
resolveProviderEndpoint
|
|
29
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
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 __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/extended-context.ts
|
|
21
|
+
var extended_context_exports = {};
|
|
22
|
+
__export(extended_context_exports, {
|
|
23
|
+
EXTENDED_CONTEXT_CAPABLE_MODELS: () => EXTENDED_CONTEXT_CAPABLE_MODELS,
|
|
24
|
+
isExtendedContextCapable: () => isExtendedContextCapable
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(extended_context_exports);
|
|
27
|
+
var EXTENDED_CONTEXT_CAPABLE_MODELS = /* @__PURE__ */ new Set([
|
|
28
|
+
"claude-opus-4-7",
|
|
29
|
+
"claude-opus-4-6",
|
|
30
|
+
"claude-sonnet-4-6"
|
|
31
|
+
]);
|
|
32
|
+
function isExtendedContextCapable(model) {
|
|
33
|
+
return EXTENDED_CONTEXT_CAPABLE_MODELS.has(model);
|
|
34
|
+
}
|
|
35
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
+
0 && (module.exports = {
|
|
37
|
+
EXTENDED_CONTEXT_CAPABLE_MODELS,
|
|
38
|
+
isExtendedContextCapable
|
|
39
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 1M-context (extended-context) capability gate for Anthropic models.
|
|
3
|
+
*
|
|
4
|
+
* @module extended-context
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Bare model ids that have a 1M-context (extended) tier registered in
|
|
8
|
+
* `canonical-models.ts`. The beta header `context-1m-2025-08-07` is only
|
|
9
|
+
* injected on outbound requests when the active model is in this set AND
|
|
10
|
+
* the caller opted in.
|
|
11
|
+
*/
|
|
12
|
+
declare const EXTENDED_CONTEXT_CAPABLE_MODELS: ReadonlySet<string>;
|
|
13
|
+
/**
|
|
14
|
+
* Returns true when the bare model id has a 1M-context variant. Used as a
|
|
15
|
+
* defensive gate before injecting `context-1m-2025-08-07` into the
|
|
16
|
+
* `anthropic_beta` array — guards against stale opt-in state whose model has
|
|
17
|
+
* been edited to a non-capable id.
|
|
18
|
+
*/
|
|
19
|
+
declare function isExtendedContextCapable(model: string): boolean;
|
|
20
|
+
|
|
21
|
+
export { EXTENDED_CONTEXT_CAPABLE_MODELS, isExtendedContextCapable };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 1M-context (extended-context) capability gate for Anthropic models.
|
|
3
|
+
*
|
|
4
|
+
* @module extended-context
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Bare model ids that have a 1M-context (extended) tier registered in
|
|
8
|
+
* `canonical-models.ts`. The beta header `context-1m-2025-08-07` is only
|
|
9
|
+
* injected on outbound requests when the active model is in this set AND
|
|
10
|
+
* the caller opted in.
|
|
11
|
+
*/
|
|
12
|
+
declare const EXTENDED_CONTEXT_CAPABLE_MODELS: ReadonlySet<string>;
|
|
13
|
+
/**
|
|
14
|
+
* Returns true when the bare model id has a 1M-context variant. Used as a
|
|
15
|
+
* defensive gate before injecting `context-1m-2025-08-07` into the
|
|
16
|
+
* `anthropic_beta` array — guards against stale opt-in state whose model has
|
|
17
|
+
* been edited to a non-capable id.
|
|
18
|
+
*/
|
|
19
|
+
declare function isExtendedContextCapable(model: string): boolean;
|
|
20
|
+
|
|
21
|
+
export { EXTENDED_CONTEXT_CAPABLE_MODELS, isExtendedContextCapable };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// src/extended-context.ts
|
|
2
|
+
var EXTENDED_CONTEXT_CAPABLE_MODELS = /* @__PURE__ */ new Set([
|
|
3
|
+
"claude-opus-4-7",
|
|
4
|
+
"claude-opus-4-6",
|
|
5
|
+
"claude-sonnet-4-6"
|
|
6
|
+
]);
|
|
7
|
+
function isExtendedContextCapable(model) {
|
|
8
|
+
return EXTENDED_CONTEXT_CAPABLE_MODELS.has(model);
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
EXTENDED_CONTEXT_CAPABLE_MODELS,
|
|
12
|
+
isExtendedContextCapable
|
|
13
|
+
};
|