jeopi-catalog 16.2.13
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/CHANGELOG.md +523 -0
- package/README.md +43 -0
- package/dist/types/build.d.ts +3 -0
- package/dist/types/compat/anthropic.d.ts +11 -0
- package/dist/types/compat/apply.d.ts +7 -0
- package/dist/types/compat/devin.d.ts +9 -0
- package/dist/types/compat/openai.d.ts +28 -0
- package/dist/types/discovery/antigravity.d.ts +70 -0
- package/dist/types/discovery/codex.d.ts +38 -0
- package/dist/types/discovery/cursor-gen/agent_pb.d.ts +13022 -0
- package/dist/types/discovery/cursor.d.ts +23 -0
- package/dist/types/discovery/devin-gen/buf/validate/validate_pb.d.ts +1715 -0
- package/dist/types/discovery/devin-gen/exa/analytics_pb/analytics_pb.d.ts +693 -0
- package/dist/types/discovery/devin-gen/exa/api_server_pb/api_server_pb.d.ts +9158 -0
- package/dist/types/discovery/devin-gen/exa/auth_pb/auth_pb.d.ts +52 -0
- package/dist/types/discovery/devin-gen/exa/auto_cascade_common_pb/auto_cascade_common_pb.d.ts +276 -0
- package/dist/types/discovery/devin-gen/exa/bug_checker_pb/bug_checker_pb.d.ts +78 -0
- package/dist/types/discovery/devin-gen/exa/cascade_plugins_pb/cascade_plugins_pb.d.ts +999 -0
- package/dist/types/discovery/devin-gen/exa/chat_pb/chat_pb.d.ts +1704 -0
- package/dist/types/discovery/devin-gen/exa/code_edit/code_edit_pb/code_edit_pb.d.ts +656 -0
- package/dist/types/discovery/devin-gen/exa/codeium_common_pb/codeium_common_pb.d.ts +15014 -0
- package/dist/types/discovery/devin-gen/exa/context_module_pb/context_module_pb.d.ts +607 -0
- package/dist/types/discovery/devin-gen/exa/cortex_pb/cortex_pb.d.ts +11830 -0
- package/dist/types/discovery/devin-gen/exa/diff_action_pb/diff_action_pb.d.ts +248 -0
- package/dist/types/discovery/devin-gen/exa/index_pb/index_pb.d.ts +1747 -0
- package/dist/types/discovery/devin-gen/exa/knowledge_base_pb/knowledge_base_pb.d.ts +509 -0
- package/dist/types/discovery/devin-gen/exa/language_server_pb/language_server_pb.d.ts +9048 -0
- package/dist/types/discovery/devin-gen/exa/opensearch_clients_pb/opensearch_clients_pb.d.ts +1760 -0
- package/dist/types/discovery/devin-gen/exa/prompt_pb/prompt_pb.d.ts +286 -0
- package/dist/types/discovery/devin-gen/exa/reactive_component_pb/reactive_component_pb.d.ts +405 -0
- package/dist/types/discovery/devin-gen/exa/trust_pb/trust_pb.d.ts +582 -0
- package/dist/types/discovery/devin.d.ts +24 -0
- package/dist/types/discovery/gemini.d.ts +25 -0
- package/dist/types/discovery/gitlab-duo-workflow.d.ts +30 -0
- package/dist/types/discovery/index.d.ts +5 -0
- package/dist/types/discovery/openai-compatible.d.ts +74 -0
- package/dist/types/effort.d.ts +9 -0
- package/dist/types/fireworks-model-id.d.ts +23 -0
- package/dist/types/hosts.d.ts +137 -0
- package/dist/types/identity/bundled.d.ts +3 -0
- package/dist/types/identity/classify.d.ts +69 -0
- package/dist/types/identity/dialect.d.ts +3 -0
- package/dist/types/identity/family.d.ts +139 -0
- package/dist/types/identity/id.d.ts +12 -0
- package/dist/types/identity/index.d.ts +8 -0
- package/dist/types/identity/markers.d.ts +4 -0
- package/dist/types/identity/priority.d.ts +1 -0
- package/dist/types/identity/reference.d.ts +23 -0
- package/dist/types/index.d.ts +17 -0
- package/dist/types/model-cache.d.ts +17 -0
- package/dist/types/model-manager.d.ts +68 -0
- package/dist/types/model-thinking.d.ts +79 -0
- package/dist/types/models.d.ts +12 -0
- package/dist/types/provider-models/bundled-references.d.ts +11 -0
- package/dist/types/provider-models/descriptor-types.d.ts +74 -0
- package/dist/types/provider-models/descriptors.d.ts +427 -0
- package/dist/types/provider-models/google.d.ts +27 -0
- package/dist/types/provider-models/index.d.ts +6 -0
- package/dist/types/provider-models/ollama.d.ts +9 -0
- package/dist/types/provider-models/openai-compat.d.ts +450 -0
- package/dist/types/provider-models/special.d.ts +33 -0
- package/dist/types/types.d.ts +656 -0
- package/dist/types/utils.d.ts +20 -0
- package/dist/types/variant-collapse.d.ts +133 -0
- package/dist/types/wire/codex.d.ts +26 -0
- package/dist/types/wire/coreweave.d.ts +12 -0
- package/dist/types/wire/gemini-headers.d.ts +37 -0
- package/dist/types/wire/github-copilot.d.ts +45 -0
- package/package.json +101 -0
- package/src/build.ts +47 -0
- package/src/compat/anthropic.ts +93 -0
- package/src/compat/apply.ts +15 -0
- package/src/compat/devin.ts +12 -0
- package/src/compat/openai.ts +689 -0
- package/src/discovery/antigravity.ts +253 -0
- package/src/discovery/codex.ts +371 -0
- package/src/discovery/cursor-gen/agent_pb.ts +15274 -0
- package/src/discovery/cursor.ts +314 -0
- package/src/discovery/devin-gen/buf/validate/validate_pb.ts +1862 -0
- package/src/discovery/devin-gen/exa/analytics_pb/analytics_pb.ts +871 -0
- package/src/discovery/devin-gen/exa/api_server_pb/api_server_pb.ts +11083 -0
- package/src/discovery/devin-gen/exa/auth_pb/auth_pb.ts +71 -0
- package/src/discovery/devin-gen/exa/auto_cascade_common_pb/auto_cascade_common_pb.ts +348 -0
- package/src/discovery/devin-gen/exa/bug_checker_pb/bug_checker_pb.ts +103 -0
- package/src/discovery/devin-gen/exa/cascade_plugins_pb/cascade_plugins_pb.ts +1198 -0
- package/src/discovery/devin-gen/exa/chat_pb/chat_pb.ts +2063 -0
- package/src/discovery/devin-gen/exa/code_edit/code_edit_pb/code_edit_pb.ts +810 -0
- package/src/discovery/devin-gen/exa/codeium_common_pb/codeium_common_pb.ts +18354 -0
- package/src/discovery/devin-gen/exa/context_module_pb/context_module_pb.ts +732 -0
- package/src/discovery/devin-gen/exa/cortex_pb/cortex_pb.ts +14277 -0
- package/src/discovery/devin-gen/exa/diff_action_pb/diff_action_pb.ts +312 -0
- package/src/discovery/devin-gen/exa/index_pb/index_pb.ts +2106 -0
- package/src/discovery/devin-gen/exa/knowledge_base_pb/knowledge_base_pb.ts +623 -0
- package/src/discovery/devin-gen/exa/language_server_pb/language_server_pb.ts +10918 -0
- package/src/discovery/devin-gen/exa/opensearch_clients_pb/opensearch_clients_pb.ts +2125 -0
- package/src/discovery/devin-gen/exa/prompt_pb/prompt_pb.ts +361 -0
- package/src/discovery/devin-gen/exa/reactive_component_pb/reactive_component_pb.ts +450 -0
- package/src/discovery/devin-gen/exa/trust_pb/trust_pb.ts +712 -0
- package/src/discovery/devin.ts +151 -0
- package/src/discovery/gemini.ts +260 -0
- package/src/discovery/gitlab-duo-workflow.ts +855 -0
- package/src/discovery/index.ts +5 -0
- package/src/discovery/openai-compatible.ts +249 -0
- package/src/effort.ts +16 -0
- package/src/fireworks-model-id.ts +50 -0
- package/src/hosts.ts +129 -0
- package/src/identity/bundled.ts +28 -0
- package/src/identity/classify.ts +214 -0
- package/src/identity/dialect.ts +42 -0
- package/src/identity/family.ts +296 -0
- package/src/identity/id.ts +81 -0
- package/src/identity/index.ts +8 -0
- package/src/identity/markers.ts +49 -0
- package/src/identity/priority.ts +57 -0
- package/src/identity/reference.ts +148 -0
- package/src/index.ts +17 -0
- package/src/model-cache.ts +171 -0
- package/src/model-manager.ts +520 -0
- package/src/model-thinking.ts +760 -0
- package/src/models.json +88898 -0
- package/src/models.json.d.ts +9 -0
- package/src/models.ts +64 -0
- package/src/provider-models/bundled-references.ts +58 -0
- package/src/provider-models/descriptor-types.ts +79 -0
- package/src/provider-models/descriptors.ts +503 -0
- package/src/provider-models/google.ts +107 -0
- package/src/provider-models/index.ts +6 -0
- package/src/provider-models/ollama.ts +172 -0
- package/src/provider-models/openai-compat.ts +4283 -0
- package/src/provider-models/special.ts +159 -0
- package/src/types.ts +786 -0
- package/src/utils.ts +69 -0
- package/src/variant-collapse.ts +1065 -0
- package/src/wire/codex.ts +43 -0
- package/src/wire/coreweave.ts +51 -0
- package/src/wire/gemini-headers.ts +74 -0
- package/src/wire/github-copilot.ts +121 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type FetchImpl } from "jeopi-utils";
|
|
2
|
+
export { isRecord } from "jeopi-utils";
|
|
3
|
+
/**
|
|
4
|
+
* Fetch implementation for catalog discovery probes: the caller's override
|
|
5
|
+
* when given, otherwise global fetch wrapped for `NODE_EXTRA_CA_CERTS`.
|
|
6
|
+
*/
|
|
7
|
+
export declare function discoveryFetch(override?: FetchImpl): FetchImpl;
|
|
8
|
+
export declare function toNumber(value: unknown): number | undefined;
|
|
9
|
+
export declare function toPositiveNumber(value: unknown, fallback: number): number;
|
|
10
|
+
export declare function toPositiveNumber(value: unknown, fallback: number | null): number | null;
|
|
11
|
+
/** Positive finite number, or `null` when the value is missing/non-positive. */
|
|
12
|
+
export declare function toPositiveNumberOrNull(value: unknown): number | null;
|
|
13
|
+
export declare function toBoolean(value: unknown): boolean | undefined;
|
|
14
|
+
export declare function isAnthropicOAuthToken(key: string): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Normalize a model display name: drop the gateway author prefix and
|
|
17
|
+
* model-extrinsic decorations. Returns the input verbatim when nothing
|
|
18
|
+
* matches (or when stripping would leave an empty name).
|
|
19
|
+
*/
|
|
20
|
+
export declare function cleanModelName(name: string): string;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { Effort } from "./effort";
|
|
2
|
+
import type { Api, Model, ModelSpec, Provider, ThinkingConfig } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Structural bound for collapse inputs: both raw `ModelSpec`s and built
|
|
5
|
+
* `Model`s qualify. (`Model.compat` is the resolved record, not the sparse
|
|
6
|
+
* config, so the two are not mutually assignable — collapsing never touches
|
|
7
|
+
* `compat`.)
|
|
8
|
+
*/
|
|
9
|
+
export type VariantSpecLike = Omit<ModelSpec<Api>, "compat"> & {
|
|
10
|
+
compat?: unknown;
|
|
11
|
+
};
|
|
12
|
+
/** One collapsed family: logical id + member wire ids + per-effort routing. */
|
|
13
|
+
export interface EffortVariantFamily {
|
|
14
|
+
/** Collapsed logical id (may equal a member id — e.g. bare/thinking pairs). */
|
|
15
|
+
id: string;
|
|
16
|
+
/** Final display name, no tier marker. */
|
|
17
|
+
name: string;
|
|
18
|
+
/**
|
|
19
|
+
* Member wire ids in priority order. The first member present in the input
|
|
20
|
+
* becomes the collapsed spec's default wire id (`requestModelId`; omitted
|
|
21
|
+
* when it equals the logical id).
|
|
22
|
+
*/
|
|
23
|
+
members: readonly string[];
|
|
24
|
+
/**
|
|
25
|
+
* Wire ids upstream no longer serves (e.g. a deployment killed while
|
|
26
|
+
* discovery still advertises it). Fresh collapsing never routes to them,
|
|
27
|
+
* and stale collapsed snapshots (bundled catalog, cache rows,
|
|
28
|
+
* previous-generation fallbacks) get routing/`requestModelId` entries that
|
|
29
|
+
* target them re-pointed through `routing`. Keep retired ids in `members`
|
|
30
|
+
* so the raw upstream spec is still consumed and aliased.
|
|
31
|
+
*/
|
|
32
|
+
retiredMembers?: readonly string[];
|
|
33
|
+
/**
|
|
34
|
+
* Per-effort upstream wire id; `"off"` applies when thinking is disabled.
|
|
35
|
+
* Entries whose target member is absent from the input are dropped — those
|
|
36
|
+
* efforts fall back to `requestModelId ?? id`.
|
|
37
|
+
*/
|
|
38
|
+
routing: Readonly<Partial<Record<Effort | "off", string>>>;
|
|
39
|
+
/** Explicit capability surface for the collapsed spec — no inference. */
|
|
40
|
+
thinking: Readonly<Omit<ThinkingConfig, "effortRouting" | "suppressWhenOff">>;
|
|
41
|
+
/** Thinking-off requests must explicitly suppress thinking on the wire. */
|
|
42
|
+
suppressWhenOff?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Preserve non-off effort routes even when discovery omits the backing member.
|
|
45
|
+
* Used for Cloud Code Assist `X`/`X-thinking` pairs where upstream accepts
|
|
46
|
+
* the `-thinking` wire id but the model-list endpoint may advertise only the
|
|
47
|
+
* bare id.
|
|
48
|
+
*/
|
|
49
|
+
preserveAbsentEffortRoutes?: boolean;
|
|
50
|
+
/** Retired/recycled selector ids that alias to this family without being members. */
|
|
51
|
+
extraAliases?: readonly string[];
|
|
52
|
+
}
|
|
53
|
+
export interface VariantCollapseTable {
|
|
54
|
+
families: readonly EffortVariantFamily[];
|
|
55
|
+
}
|
|
56
|
+
/** `google-antigravity` (daily-cloudcode-pa): Gemini 3.x on the budget transport. */
|
|
57
|
+
export declare const ANTIGRAVITY_VARIANT_COLLAPSE_TABLE: VariantCollapseTable;
|
|
58
|
+
/** `google-gemini-cli` (cloudcode-pa): Gemini 3.x on the level transport (official CLI parity). */
|
|
59
|
+
export declare const GEMINI_CLI_VARIANT_COLLAPSE_TABLE: VariantCollapseTable;
|
|
60
|
+
export declare const DEVIN_VARIANT_COLLAPSE_TABLE: VariantCollapseTable;
|
|
61
|
+
/** Provider id → hand collapse table. The CCA providers diverge on thinking transport. */
|
|
62
|
+
export declare const VARIANT_COLLAPSE_TABLES: Readonly<Record<string, VariantCollapseTable>>;
|
|
63
|
+
/**
|
|
64
|
+
* The global automatic rule: derive an `X` + `X-thinking` family for every
|
|
65
|
+
* pair where both ids are live in `specs` (trailing or infix token). Gates:
|
|
66
|
+
* - both members share the same `api`,
|
|
67
|
+
* - known pricing must match — all-zero cost rows count as unknown
|
|
68
|
+
* (aggregators routinely ship them), but twins that BOTH carry real,
|
|
69
|
+
* differing prices are distinct SKUs and never merge,
|
|
70
|
+
* - ids claimed by the provider's hand `table` are skipped (curation wins).
|
|
71
|
+
* The capability surface prefers the thinking member's metadata, then the
|
|
72
|
+
* bare member's, then the canonical deriver (aggregators often ship
|
|
73
|
+
* `reasoning: false` and no thinking config on the twin), then a budget
|
|
74
|
+
* default. `off` routes to the bare id; every supported effort routes to the
|
|
75
|
+
* thinking id.
|
|
76
|
+
*/
|
|
77
|
+
export declare function deriveThinkingPairFamilies<TSpec extends VariantSpecLike>(specs: readonly TSpec[], table?: VariantCollapseTable): EffortVariantFamily[];
|
|
78
|
+
/**
|
|
79
|
+
* True when `spec` is the output of collapsing rather than a raw upstream
|
|
80
|
+
* member. `thinking.effortRouting` is written only by collapsing; the
|
|
81
|
+
* `requestModelId` arm is scoped to the provider's hand-table family ids so
|
|
82
|
+
* unrelated carriers (GitHub Copilot `-1m` context variants) never match.
|
|
83
|
+
*/
|
|
84
|
+
export declare function isVariantCollapsedSpec(spec: VariantSpecLike): boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Collapse every family in `table` found in `specs`. Non-member specs pass
|
|
87
|
+
* through verbatim (by reference), order preserved; the collapsed spec
|
|
88
|
+
* replaces the first occurrence of its family.
|
|
89
|
+
*/
|
|
90
|
+
export declare function collapseEffortVariants<TSpec extends VariantSpecLike>(specs: readonly TSpec[], table: VariantCollapseTable): TSpec[];
|
|
91
|
+
/**
|
|
92
|
+
* Collapse a full mixed-provider list: per provider, the hand table (when
|
|
93
|
+
* registered) plus the automatic `X`/`X-thinking` pair rule. Used by the
|
|
94
|
+
* catalog generator; the runtime equivalent lives at the model-manager merge
|
|
95
|
+
* point. Output is regrouped by provider — callers re-sort.
|
|
96
|
+
*/
|
|
97
|
+
export declare function collapseEffortVariantsAcrossProviders<TSpec extends VariantSpecLike>(specs: readonly TSpec[]): TSpec[];
|
|
98
|
+
/**
|
|
99
|
+
* Runtime entry point for already-built `Model` lists (the model-manager
|
|
100
|
+
* merge point, coding-agent registry custom providers): collapses hand
|
|
101
|
+
* tables plus derived pairs, then re-runs `buildModel` on freshly created
|
|
102
|
+
* logical specs so thinking wire defaults stay resolved. Untouched entries
|
|
103
|
+
* pass through by reference.
|
|
104
|
+
*/
|
|
105
|
+
export declare function collapseBuiltModelVariants<TApi extends Api>(models: readonly Model<TApi>[]): Model<TApi>[];
|
|
106
|
+
/**
|
|
107
|
+
* Resolve a retired effort-tier variant id (collapsed member, recycled id) to
|
|
108
|
+
* its replacement model id for `provider` via the hand table. Returns
|
|
109
|
+
* `undefined` when the id is not a known alias; derived `X-thinking` members
|
|
110
|
+
* resolve through `stripThinkingVariantToken` instead. Callers must try an
|
|
111
|
+
* exact model lookup first — a live model always wins over an alias.
|
|
112
|
+
*/
|
|
113
|
+
export declare function resolveVariantAlias(provider: Provider, modelId: string): string | undefined;
|
|
114
|
+
/** Bare-id alias hit: replacement id plus the providers declaring it. */
|
|
115
|
+
export interface BareVariantAliasHit {
|
|
116
|
+
id: string;
|
|
117
|
+
/** Providers whose table declares the alias — candidates from these win ties. */
|
|
118
|
+
providers: readonly Provider[];
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Provider-agnostic hand-table alias lookup for bare-id selectors. Returns
|
|
122
|
+
* the declaring providers so callers can prefer their models when the
|
|
123
|
+
* replacement id exists on unrelated providers too (e.g. a retired Cursor
|
|
124
|
+
* tier id must not resolve to `openai/gpt-5.4`).
|
|
125
|
+
*/
|
|
126
|
+
export declare function resolveBareVariantAlias(modelId: string): BareVariantAliasHit | undefined;
|
|
127
|
+
/**
|
|
128
|
+
* Reverse alias lookup: the retired ids that resolve to `modelId` for
|
|
129
|
+
* `provider` via the hand table. Used to re-key config keyed by raw member
|
|
130
|
+
* ids (models.yml `modelOverrides`, suppressed selectors) onto the collapsed
|
|
131
|
+
* model. Empty for providers without a table.
|
|
132
|
+
*/
|
|
133
|
+
export declare function getVariantAliasSources(provider: Provider, modelId: string): readonly string[];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constants for OpenAI Codex (ChatGPT OAuth) backend
|
|
3
|
+
*/
|
|
4
|
+
export declare const CODEX_BASE_URL = "https://chatgpt.com/backend-api";
|
|
5
|
+
export declare const OPENAI_HEADERS: {
|
|
6
|
+
readonly BETA: "OpenAI-Beta";
|
|
7
|
+
readonly ACCOUNT_ID: "chatgpt-account-id";
|
|
8
|
+
readonly ORIGINATOR: "originator";
|
|
9
|
+
readonly SESSION_ID: "session_id";
|
|
10
|
+
readonly CONVERSATION_ID: "conversation_id";
|
|
11
|
+
};
|
|
12
|
+
export declare const OPENAI_HEADER_VALUES: {
|
|
13
|
+
readonly BETA_RESPONSES: "responses=experimental";
|
|
14
|
+
readonly BETA_RESPONSES_WEBSOCKETS_V2: "responses_websockets=2026-02-06";
|
|
15
|
+
readonly ORIGINATOR_CODEX: "pi";
|
|
16
|
+
};
|
|
17
|
+
export declare const URL_PATHS: {
|
|
18
|
+
readonly RESPONSES: "/responses";
|
|
19
|
+
readonly CODEX_RESPONSES: "/codex/responses";
|
|
20
|
+
};
|
|
21
|
+
export declare const JWT_CLAIM_PATH: "https://api.openai.com/auth";
|
|
22
|
+
/**
|
|
23
|
+
* Extract account ID from a Codex JWT access token.
|
|
24
|
+
* Returns undefined if the token is not a valid Codex JWT.
|
|
25
|
+
*/
|
|
26
|
+
export declare function getCodexAccountId(accessToken: string): string | undefined;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const COREWEAVE_PROJECT_HEADER: "OpenAI-Project";
|
|
2
|
+
export interface CoreWeaveProjectEnv {
|
|
3
|
+
[key: string]: string | undefined;
|
|
4
|
+
COREWEAVE_PROJECT?: string;
|
|
5
|
+
WANDB_INFERENCE_PROJECT?: string;
|
|
6
|
+
WANDB_ENTITY?: string;
|
|
7
|
+
WANDB_PROJECT?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function resolveCoreWeaveProject(env: CoreWeaveProjectEnv): string | undefined;
|
|
10
|
+
export declare function coreWeaveProjectHeaders(env: CoreWeaveProjectEnv): Record<string, string> | undefined;
|
|
11
|
+
export declare function hasCoreWeaveProjectHeader(headers: Record<string, string>): boolean;
|
|
12
|
+
export declare function removeBlankCoreWeaveProjectHeaders(headers: Record<string, string>): void;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build a User-Agent string that identifies as Gemini CLI to unlock higher rate limits.
|
|
3
|
+
* Uses the same format as the official Gemini CLI (v0.35+):
|
|
4
|
+
* GeminiCLI/VERSION/MODEL (PLATFORM; ARCH; SURFACE)
|
|
5
|
+
*/
|
|
6
|
+
export declare function getGeminiCliUserAgent(modelId?: string): string;
|
|
7
|
+
export declare const getGeminiCliHeaders: (modelId?: string) => {
|
|
8
|
+
"User-Agent": string;
|
|
9
|
+
"Client-Metadata": string;
|
|
10
|
+
};
|
|
11
|
+
export declare const ANTIGRAVITY_SYSTEM_INSTRUCTION: string;
|
|
12
|
+
/**
|
|
13
|
+
* Antigravity / Cloud Code Assist user agent. Lives in its own file so discovery
|
|
14
|
+
* and usage code can read it without pulling the heavy google-gemini-cli provider
|
|
15
|
+
* (and its @google/genai → google-auth-library dependency chain) into the startup
|
|
16
|
+
* parse graph.
|
|
17
|
+
*/
|
|
18
|
+
export declare let getAntigravityUserAgent: () => string;
|
|
19
|
+
/**
|
|
20
|
+
* Per-wire-id Antigravity Cloud Code Assist request constants, captured from the
|
|
21
|
+
* real `antigravity/hub` client against `daily-cloudcode-pa`. `modelEnum` is the
|
|
22
|
+
* opaque `labels.model_enum` token the client tags each request with — optional
|
|
23
|
+
* because Anthropic-backed wire ids (e.g. `claude-sonnet-4-6`,
|
|
24
|
+
* `claude-opus-4-6-thinking`) are accepted without one; the label is purely
|
|
25
|
+
* telemetry. `maxOutputTokens` is the fixed `generationConfig.maxOutputTokens`
|
|
26
|
+
* the backend enforces regardless of the thinking budget (Claude caps at
|
|
27
|
+
* 64000, Gemini accepts the discovered cap). Keyed by the routed upstream wire
|
|
28
|
+
* id (post effort-routing), not the collapsed logical id. Checkpoint-only ids
|
|
29
|
+
* (e.g. `gemini-3.1-flash-lite`) are intentionally absent — this provider only
|
|
30
|
+
* emits agent requests.
|
|
31
|
+
*/
|
|
32
|
+
export interface AntigravityModelWireProfile {
|
|
33
|
+
modelEnum?: string;
|
|
34
|
+
maxOutputTokens: number;
|
|
35
|
+
}
|
|
36
|
+
export declare const ANTIGRAVITY_MODEL_WIRE_PROFILES: Readonly<Record<string, AntigravityModelWireProfile>>;
|
|
37
|
+
export declare function getAntigravityModelWireProfile(wireModelId: string): AntigravityModelWireProfile | undefined;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitHub Copilot wire metadata: API-key envelope parsing and endpoint
|
|
3
|
+
* derivation shared by catalog discovery and the pi-ai OAuth flow. The device
|
|
4
|
+
* login / token refresh flow lives in `jeopi-ai`'s registry.
|
|
5
|
+
*/
|
|
6
|
+
export declare const COPILOT_USER_AGENT: "opencode/1.3.15";
|
|
7
|
+
export declare const OPENCODE_HEADERS: {
|
|
8
|
+
readonly "User-Agent": "opencode/1.3.15";
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Copilot API version sent on `api.githubcopilot.com` requests (`/models`,
|
|
12
|
+
* chat endpoints). Newer versions unlock tiered context metadata: `/models`
|
|
13
|
+
* reports the full long-context window in `capabilities.limits` plus per-tier
|
|
14
|
+
* boundaries/prices under `billing.token_prices.{default,long_context}`.
|
|
15
|
+
* Without it the endpoint serves default-tier limits only (e.g. 264k instead
|
|
16
|
+
* of 1M for Claude Opus). Never send this to `api.github.com` REST endpoints —
|
|
17
|
+
* they validate `X-GitHub-Api-Version` against the REST version vocabulary.
|
|
18
|
+
*/
|
|
19
|
+
export declare const COPILOT_API_VERSION: "2026-06-01";
|
|
20
|
+
/** Headers for `api.githubcopilot.com` (capi) requests: discovery, chat, policy. */
|
|
21
|
+
export declare const COPILOT_API_HEADERS: {
|
|
22
|
+
readonly "User-Agent": "opencode/1.3.15";
|
|
23
|
+
readonly "X-GitHub-Api-Version": "2026-06-01";
|
|
24
|
+
};
|
|
25
|
+
export type ParsedGitHubCopilotApiKey = {
|
|
26
|
+
accessToken: string;
|
|
27
|
+
enterpriseUrl?: string;
|
|
28
|
+
apiEndpoint?: string;
|
|
29
|
+
};
|
|
30
|
+
export declare function isPublicGitHubHost(host: string): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Canonical personal-Copilot API host. The business
|
|
33
|
+
* (`api.business.githubcopilot.com`) and enterprise (`copilot-api.{domain}`)
|
|
34
|
+
* endpoints respond with HTTP 400 "vision is not supported" on image inputs,
|
|
35
|
+
* so catalog discovery and capability gates MUST honour the upstream's
|
|
36
|
+
* `supports.vision` flag only for this exact base URL.
|
|
37
|
+
*/
|
|
38
|
+
export declare const PERSONAL_GITHUB_COPILOT_BASE_URL: "https://api.githubcopilot.com";
|
|
39
|
+
/** `true` when the resolved base URL is the canonical personal-Copilot host. */
|
|
40
|
+
export declare function isPersonalGitHubCopilotBaseUrl(baseUrl: string | undefined): boolean;
|
|
41
|
+
export declare function normalizeGitHubCopilotEnterpriseDomain(input: string | undefined): string | undefined;
|
|
42
|
+
export declare function normalizeGitHubCopilotApiEndpoint(input: string | undefined): string | undefined;
|
|
43
|
+
export declare function parseGitHubCopilotApiKey(apiKeyRaw: string): ParsedGitHubCopilotApiKey;
|
|
44
|
+
export declare function normalizeDomain(input: string): string | null;
|
|
45
|
+
export declare function getGitHubCopilotBaseUrl(enterpriseDomain?: string): string;
|
package/package.json
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "module",
|
|
3
|
+
"name": "jeopi-catalog",
|
|
4
|
+
"version": "16.2.13",
|
|
5
|
+
"description": "Model catalog for omp: bundled model database, provider discovery descriptors, model identity, classification, and equivalence",
|
|
6
|
+
"homepage": "https://github.com/akillness/jeopi",
|
|
7
|
+
"author": "Can Boluk",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/akillness/jeopi.git",
|
|
12
|
+
"directory": "packages/catalog"
|
|
13
|
+
},
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/akillness/jeopi/issues"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"ai",
|
|
19
|
+
"llm",
|
|
20
|
+
"models",
|
|
21
|
+
"catalog",
|
|
22
|
+
"discovery"
|
|
23
|
+
],
|
|
24
|
+
"main": "./src/index.ts",
|
|
25
|
+
"types": "./dist/types/index.d.ts",
|
|
26
|
+
"scripts": {
|
|
27
|
+
"check": "biome check . && bun run check:types",
|
|
28
|
+
"check:types": "tsgo -p tsconfig.json --noEmit",
|
|
29
|
+
"lint": "biome lint .",
|
|
30
|
+
"test": "bun test --parallel",
|
|
31
|
+
"fix": "biome check --write --unsafe .",
|
|
32
|
+
"fmt": "biome format --write .",
|
|
33
|
+
"gen:models": "bun scripts/generate-models.ts"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@bufbuild/protobuf": "^2.12.0",
|
|
37
|
+
"jeopi-utils": "16.2.13",
|
|
38
|
+
"arktype": "^2.2.0",
|
|
39
|
+
"zod": "^4"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"jeopi-ai": "16.2.13",
|
|
43
|
+
"@types/bun": "^1.3.14"
|
|
44
|
+
},
|
|
45
|
+
"engines": {
|
|
46
|
+
"bun": ">=1.3.14"
|
|
47
|
+
},
|
|
48
|
+
"files": [
|
|
49
|
+
"src",
|
|
50
|
+
"README.md",
|
|
51
|
+
"CHANGELOG.md",
|
|
52
|
+
"dist/types"
|
|
53
|
+
],
|
|
54
|
+
"exports": {
|
|
55
|
+
".": {
|
|
56
|
+
"types": "./dist/types/index.d.ts",
|
|
57
|
+
"import": "./src/index.ts"
|
|
58
|
+
},
|
|
59
|
+
"./models.json": {
|
|
60
|
+
"types": "./dist/types/models.json.d.d.ts",
|
|
61
|
+
"import": "./src/models.json"
|
|
62
|
+
},
|
|
63
|
+
"./provider-models": {
|
|
64
|
+
"types": "./dist/types/provider-models/index.d.ts",
|
|
65
|
+
"import": "./src/provider-models/index.ts"
|
|
66
|
+
},
|
|
67
|
+
"./provider-models/*": {
|
|
68
|
+
"types": "./dist/types/provider-models/*.d.ts",
|
|
69
|
+
"import": "./src/provider-models/*.ts"
|
|
70
|
+
},
|
|
71
|
+
"./discovery": {
|
|
72
|
+
"types": "./dist/types/discovery/index.d.ts",
|
|
73
|
+
"import": "./src/discovery/index.ts"
|
|
74
|
+
},
|
|
75
|
+
"./discovery/*": {
|
|
76
|
+
"types": "./dist/types/discovery/*.d.ts",
|
|
77
|
+
"import": "./src/discovery/*.ts"
|
|
78
|
+
},
|
|
79
|
+
"./identity": {
|
|
80
|
+
"types": "./dist/types/identity/index.d.ts",
|
|
81
|
+
"import": "./src/identity/index.ts"
|
|
82
|
+
},
|
|
83
|
+
"./identity/*": {
|
|
84
|
+
"types": "./dist/types/identity/*.d.ts",
|
|
85
|
+
"import": "./src/identity/*.ts"
|
|
86
|
+
},
|
|
87
|
+
"./wire/*": {
|
|
88
|
+
"types": "./dist/types/wire/*.d.ts",
|
|
89
|
+
"import": "./src/wire/*.ts"
|
|
90
|
+
},
|
|
91
|
+
"./compat/*": {
|
|
92
|
+
"types": "./dist/types/compat/*.d.ts",
|
|
93
|
+
"import": "./src/compat/*.ts"
|
|
94
|
+
},
|
|
95
|
+
"./*": {
|
|
96
|
+
"types": "./dist/types/*.d.ts",
|
|
97
|
+
"import": "./src/*.ts"
|
|
98
|
+
},
|
|
99
|
+
"./*.js": "./src/*.ts"
|
|
100
|
+
}
|
|
101
|
+
}
|
package/src/build.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The single Model constructor. Resolution order is a dependency chain, each
|
|
3
|
+
* step materialized exactly once per spec:
|
|
4
|
+
*
|
|
5
|
+
* 1. compat — URL/provider/id detection resolved into a complete record;
|
|
6
|
+
* 2. thinking — derived from identity + resolved compat (or trusted verbatim
|
|
7
|
+
* when the spec carries explicit metadata);
|
|
8
|
+
*
|
|
9
|
+
* Request handlers read fields — they never detect, parse ids, or allocate
|
|
10
|
+
* compat per request.
|
|
11
|
+
*/
|
|
12
|
+
import { buildAnthropicCompat } from "./compat/anthropic";
|
|
13
|
+
import { buildDevinCompat } from "./compat/devin";
|
|
14
|
+
import { buildOpenAICompat, buildOpenAIResponsesCompat, buildOpenRouterCompat } from "./compat/openai";
|
|
15
|
+
import { resolveModelThinking } from "./model-thinking";
|
|
16
|
+
import type { Api, CompatOf, Model, ModelSpec } from "./types";
|
|
17
|
+
import { cleanModelName } from "./utils";
|
|
18
|
+
|
|
19
|
+
export function buildModel<TApi extends Api>(spec: ModelSpec<TApi>): Model<TApi> {
|
|
20
|
+
const compat = buildCompat(spec) as CompatOf<TApi>;
|
|
21
|
+
return {
|
|
22
|
+
...spec,
|
|
23
|
+
name: cleanModelName(spec.name),
|
|
24
|
+
thinking: resolveModelThinking(spec, compat),
|
|
25
|
+
compat,
|
|
26
|
+
compatConfig: spec.compat,
|
|
27
|
+
} as Model<TApi>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function buildCompat(spec: ModelSpec<Api>): CompatOf<Api> {
|
|
31
|
+
switch (spec.api) {
|
|
32
|
+
case "openrouter":
|
|
33
|
+
return buildOpenRouterCompat(spec as ModelSpec<"openrouter">);
|
|
34
|
+
case "openai-completions":
|
|
35
|
+
return buildOpenAICompat(spec as ModelSpec<"openai-completions">);
|
|
36
|
+
case "openai-responses":
|
|
37
|
+
case "azure-openai-responses":
|
|
38
|
+
case "openai-codex-responses":
|
|
39
|
+
return buildOpenAIResponsesCompat(spec as ModelSpec<"openai-responses">);
|
|
40
|
+
case "anthropic-messages":
|
|
41
|
+
return buildAnthropicCompat(spec as ModelSpec<"anthropic-messages">);
|
|
42
|
+
case "devin-agent":
|
|
43
|
+
return buildDevinCompat(spec as ModelSpec<"devin-agent">);
|
|
44
|
+
default:
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Anthropic-messages compat builder — the anthropic-side analogue of
|
|
3
|
+
* `./openai`. Runs exactly once per model (from `buildModel`); detect-time
|
|
4
|
+
* defaults come from provider ids, strict host checks, and model-id
|
|
5
|
+
* classification, with explicit spec overrides assigned on top.
|
|
6
|
+
*/
|
|
7
|
+
import { modelMatchesHost } from "../hosts";
|
|
8
|
+
import {
|
|
9
|
+
hasOpus47ApiRestrictions,
|
|
10
|
+
isAnthropicFableOrMythosModel,
|
|
11
|
+
supportsMidConversationSystemMessages,
|
|
12
|
+
} from "../identity/family";
|
|
13
|
+
import type { ModelSpec, ResolvedAnthropicCompat } from "../types";
|
|
14
|
+
import { applyCompatOverrides } from "./apply";
|
|
15
|
+
|
|
16
|
+
const OFFICIAL_ANTHROPIC_URL = "https://api.anthropic.com";
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Official first-party Anthropic API. A missing baseUrl is official on purpose:
|
|
20
|
+
* request dispatch falls back to `https://api.anthropic.com`. This is the one
|
|
21
|
+
* auth-sensitive host check — OAuth credentials are attached based on it — so
|
|
22
|
+
* it requires the exact origin or a path boundary (`/`) after it; a bare
|
|
23
|
+
* prefix check would accept lookalikes like `https://api.anthropic.com.evil.com`.
|
|
24
|
+
*/
|
|
25
|
+
export function isOfficialAnthropicApiUrl(baseUrl?: string): boolean {
|
|
26
|
+
if (!baseUrl) return true;
|
|
27
|
+
const lower = baseUrl.toLowerCase();
|
|
28
|
+
return lower === OFFICIAL_ANTHROPIC_URL || lower.startsWith(`${OFFICIAL_ANTHROPIC_URL}/`);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Mirrors `compat/openai.ts`; native-only host gating is the caller's responsibility. */
|
|
32
|
+
const KIMI_K27_CODE_MODEL_PATTERN = /(?:^|\/)kimi[-._]?k2(?:[._-]?|p)7[-._]?code(?:[-._]?highspeed)?$/i;
|
|
33
|
+
|
|
34
|
+
function matchesKimiK27CodeFamily(spec: ModelSpec<"anthropic-messages">): boolean {
|
|
35
|
+
if (KIMI_K27_CODE_MODEL_PATTERN.test(spec.id)) return true;
|
|
36
|
+
return spec.id === "kimi-for-coding" && /k2\.?7 code/i.test(spec.name ?? "");
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Build the resolved anthropic-messages compat record for a model spec. */
|
|
40
|
+
export function buildAnthropicCompat(spec: ModelSpec<"anthropic-messages">): ResolvedAnthropicCompat {
|
|
41
|
+
const baseUrl = spec.baseUrl;
|
|
42
|
+
const official = isOfficialAnthropicApiUrl(baseUrl);
|
|
43
|
+
// Z.AI's Anthropic-compatible proxy lives at `api.z.ai/api/anthropic`.
|
|
44
|
+
const isZai = modelMatchesHost(spec, "zai");
|
|
45
|
+
// GitHub Copilot's Anthropic-compatible proxy (api.githubcopilot.com/v1/messages)
|
|
46
|
+
// rejects the per-tool `eager_input_streaming` field with
|
|
47
|
+
// `tools.0.custom.eager_input_streaming: Extra inputs are not permitted` and
|
|
48
|
+
// doesn't whitelist the `fine-grained-tool-streaming-2025-05-14` beta either
|
|
49
|
+
// (issue #2558), so eager tool-input streaming is unavailable on this host.
|
|
50
|
+
const isCopilot = modelMatchesHost(spec, "githubCopilot");
|
|
51
|
+
const requiresThinkingEnabled = modelMatchesHost(spec, "moonshotNative") && matchesKimiK27CodeFamily(spec);
|
|
52
|
+
const compat: ResolvedAnthropicCompat = {
|
|
53
|
+
officialEndpoint: official,
|
|
54
|
+
disableStrictTools: false,
|
|
55
|
+
disableAdaptiveThinking: false,
|
|
56
|
+
supportsEagerToolInputStreaming: !isCopilot,
|
|
57
|
+
// Long cache retention is only sent to the official API by default;
|
|
58
|
+
// proxies opt in explicitly via `compat.supportsLongCacheRetention: true`.
|
|
59
|
+
supportsLongCacheRetention: official,
|
|
60
|
+
// First-party Claude API only. Bedrock/Vertex/Foundry and other
|
|
61
|
+
// Anthropic-compatible gateways reject mid-conversation system roles, so
|
|
62
|
+
// detection requires the canonical api.anthropic.com host plus a
|
|
63
|
+
// supported model id.
|
|
64
|
+
supportsMidConversationSystem: official && supportsMidConversationSystemMessages(spec.id),
|
|
65
|
+
supportsForcedToolChoice: !requiresThinkingEnabled && !isAnthropicFableOrMythosModel(spec.id),
|
|
66
|
+
// Opus 4.7+ and Fable/Mythos reject temperature/top_p/top_k with a 400.
|
|
67
|
+
supportsSamplingParams: !hasOpus47ApiRestrictions(spec.id),
|
|
68
|
+
// Z.AI workaround (issue #814): its proxy deserializes tool_result blocks
|
|
69
|
+
// into a class that reads `.id`.
|
|
70
|
+
requiresToolResultId: isZai,
|
|
71
|
+
requiresThinkingEnabled,
|
|
72
|
+
// Official Anthropic enforces signature-based thinking-chain integrity, so
|
|
73
|
+
// unsigned thinking blocks must stay text there. Anthropic-compatible
|
|
74
|
+
// reasoning endpoints commonly emit unsigned thinking blocks while still
|
|
75
|
+
// expecting them back as `type: "thinking"` on continuation; demoting them
|
|
76
|
+
// loses the reasoning chain and can destabilize the next tool-call
|
|
77
|
+
// arguments (#2005). Known non-signing hosts (Z.AI, DeepSeek) are also
|
|
78
|
+
// preserved for compatibility.
|
|
79
|
+
//
|
|
80
|
+
// GitHub Copilot's `anthropic-messages` proxy is excluded: it forwards to
|
|
81
|
+
// signature-enforcing Anthropic and returns full thinking signatures, so it
|
|
82
|
+
// is a SIGNING endpoint. Replaying a stripped/unsigned thinking block as
|
|
83
|
+
// `signature: ""` there 400s the whole request ("Invalid signature") — most
|
|
84
|
+
// visibly when a checkpoint/branch-return turn's end_turn-bound signature is
|
|
85
|
+
// stripped on replay (issue #2851). Treating it like official Anthropic
|
|
86
|
+
// degrades such blocks to text instead, which the API accepts.
|
|
87
|
+
replayUnsignedThinking:
|
|
88
|
+
!isCopilot && (isZai || modelMatchesHost(spec, "deepseekFamily") || (spec.reasoning && !official)),
|
|
89
|
+
escapeBuiltinToolNames: modelMatchesHost(spec, "umans"),
|
|
90
|
+
};
|
|
91
|
+
applyCompatOverrides(compat, spec.compat);
|
|
92
|
+
return compat;
|
|
93
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Assign defined override values onto a freshly-built resolved compat record,
|
|
3
|
+
* in place. Keys the record doesn't declare are ignored (loosely-typed config
|
|
4
|
+
* may carry junk). `buildModel` is the only intended caller — the record being
|
|
5
|
+
* mutated is the single per-model allocation; nothing here runs per request.
|
|
6
|
+
*/
|
|
7
|
+
export function applyCompatOverrides(compat: object, overrides: object | undefined): void {
|
|
8
|
+
if (!overrides) return;
|
|
9
|
+
for (const key in overrides) {
|
|
10
|
+
const value = (overrides as Record<string, unknown>)[key];
|
|
11
|
+
if (value !== undefined && key in compat) {
|
|
12
|
+
(compat as Record<string, unknown>)[key] = value;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ModelSpec, ResolvedDevinCompat } from "../types";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Resolve devin-agent (Codeium Cascade) compat. Cascade has no wire
|
|
5
|
+
* reasoning/effort field — effort is selected by routing to a sibling model id
|
|
6
|
+
* (the `thinking.effortRouting` baked by variant-collapse). So the thinking
|
|
7
|
+
* deriver must never fabricate an effort ladder from identity for these models;
|
|
8
|
+
* only explicit routed metadata counts.
|
|
9
|
+
*/
|
|
10
|
+
export function buildDevinCompat(_spec: ModelSpec<"devin-agent">): ResolvedDevinCompat {
|
|
11
|
+
return { trustExplicitThinkingOnly: true };
|
|
12
|
+
}
|