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,172 @@
|
|
|
1
|
+
import { fetchWithRetry } from "jeopi-utils";
|
|
2
|
+
import { Effort } from "../effort";
|
|
3
|
+
import { isGlm52ReasoningEffortModelId } from "../identity/family";
|
|
4
|
+
import type { ModelManagerOptions } from "../model-manager";
|
|
5
|
+
import type { FetchImpl, ThinkingConfig } from "../types";
|
|
6
|
+
import { discoveryFetch } from "../utils";
|
|
7
|
+
import { createBundledReferenceMap, createReferenceResolver } from "./bundled-references";
|
|
8
|
+
|
|
9
|
+
export interface OllamaCloudModelManagerConfig {
|
|
10
|
+
apiKey?: string;
|
|
11
|
+
baseUrl?: string;
|
|
12
|
+
fetch?: FetchImpl;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
type OllamaTagEntry = {
|
|
16
|
+
name?: string;
|
|
17
|
+
model?: string;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
type OllamaShowResponse = {
|
|
21
|
+
capabilities?: string[];
|
|
22
|
+
model_info?: Record<string, unknown>;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const OLLAMA_RETRY_DELAYS_MS = [2_000, 5_000, 10_000];
|
|
26
|
+
const OLLAMA_CLOUD_GLM_52_THINKING: ThinkingConfig = {
|
|
27
|
+
mode: "effort",
|
|
28
|
+
efforts: [Effort.High, Effort.XHigh],
|
|
29
|
+
effortMap: { [Effort.XHigh]: "max" },
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
function trimTrailingSlash(value: string): string {
|
|
33
|
+
return value.endsWith("/") ? value.slice(0, -1) : value;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function normalizeOllamaCloudBaseUrl(baseUrl?: string): string {
|
|
37
|
+
const value = baseUrl?.trim();
|
|
38
|
+
if (!value) {
|
|
39
|
+
return "https://ollama.com";
|
|
40
|
+
}
|
|
41
|
+
const trimmed = trimTrailingSlash(value);
|
|
42
|
+
return trimmed.endsWith("/api") ? trimmed.slice(0, -4) : trimmed;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function createCloudHeaders(apiKey: string): Record<string, string> {
|
|
46
|
+
return {
|
|
47
|
+
Accept: "application/json",
|
|
48
|
+
Authorization: `Bearer ${apiKey}`,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function getContextWindow(modelInfo: Record<string, unknown> | undefined): number | undefined {
|
|
53
|
+
if (!modelInfo) {
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
for (const [key, value] of Object.entries(modelInfo)) {
|
|
57
|
+
if (typeof value !== "number") {
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
if (key.endsWith(".context_length") || key.endsWith(".num_ctx") || key.endsWith(".context_window")) {
|
|
61
|
+
return value;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function getThinkingConfig(modelId: string, capabilities: string[] | undefined): ThinkingConfig | undefined {
|
|
67
|
+
if (!capabilities?.includes("thinking")) {
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
if (isGlm52ReasoningEffortModelId(modelId)) {
|
|
71
|
+
return OLLAMA_CLOUD_GLM_52_THINKING;
|
|
72
|
+
}
|
|
73
|
+
return { mode: "effort", efforts: [Effort.Minimal, Effort.Low, Effort.Medium, Effort.High] };
|
|
74
|
+
}
|
|
75
|
+
async function fetchShowMetadata(
|
|
76
|
+
baseUrl: string,
|
|
77
|
+
apiKey: string,
|
|
78
|
+
model: string,
|
|
79
|
+
fetchImpl: FetchImpl = discoveryFetch(),
|
|
80
|
+
): Promise<OllamaShowResponse | undefined> {
|
|
81
|
+
const response = await fetchImpl(`${baseUrl}/api/show`, {
|
|
82
|
+
method: "POST",
|
|
83
|
+
headers: {
|
|
84
|
+
...createCloudHeaders(apiKey),
|
|
85
|
+
"Content-Type": "application/json",
|
|
86
|
+
},
|
|
87
|
+
body: JSON.stringify({ model }),
|
|
88
|
+
});
|
|
89
|
+
if (!response.ok) {
|
|
90
|
+
return undefined;
|
|
91
|
+
}
|
|
92
|
+
return (await response.json()) as OllamaShowResponse;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export function ollamaCloudModelManagerOptions(
|
|
96
|
+
config?: OllamaCloudModelManagerConfig,
|
|
97
|
+
): ModelManagerOptions<"ollama-chat"> {
|
|
98
|
+
const apiKey = config?.apiKey;
|
|
99
|
+
const baseUrl = normalizeOllamaCloudBaseUrl(config?.baseUrl);
|
|
100
|
+
const providerReferences = createBundledReferenceMap<"ollama-chat">("ollama-cloud");
|
|
101
|
+
const resolveReference = createReferenceResolver(providerReferences);
|
|
102
|
+
return {
|
|
103
|
+
providerId: "ollama-cloud",
|
|
104
|
+
fetchDynamicModels: async () => {
|
|
105
|
+
if (!apiKey) {
|
|
106
|
+
return [];
|
|
107
|
+
}
|
|
108
|
+
const response = await fetchWithRetry(`${baseUrl}/api/tags`, {
|
|
109
|
+
method: "GET",
|
|
110
|
+
headers: createCloudHeaders(apiKey),
|
|
111
|
+
fetch: discoveryFetch(config?.fetch),
|
|
112
|
+
defaultDelayMs: OLLAMA_RETRY_DELAYS_MS,
|
|
113
|
+
});
|
|
114
|
+
if (!response.ok) {
|
|
115
|
+
throw new Error(`HTTP ${response.status} from ${baseUrl}/api/tags`);
|
|
116
|
+
}
|
|
117
|
+
const payload = (await response.json()) as { models?: OllamaTagEntry[] };
|
|
118
|
+
const entries = payload.models ?? [];
|
|
119
|
+
const models = await Promise.all(
|
|
120
|
+
entries.map(async entry => {
|
|
121
|
+
const id = entry.model ?? entry.name;
|
|
122
|
+
if (!id) {
|
|
123
|
+
return undefined;
|
|
124
|
+
}
|
|
125
|
+
const providerReference = providerReferences.get(id);
|
|
126
|
+
const reference = resolveReference(id);
|
|
127
|
+
let metadata: OllamaShowResponse | undefined;
|
|
128
|
+
try {
|
|
129
|
+
metadata = await fetchShowMetadata(baseUrl, apiKey, id, config?.fetch);
|
|
130
|
+
} catch {
|
|
131
|
+
metadata = undefined;
|
|
132
|
+
}
|
|
133
|
+
const capabilities = metadata?.capabilities;
|
|
134
|
+
const discoveredContextWindow = getContextWindow(metadata?.model_info);
|
|
135
|
+
// `/api/show` is the only trustworthy Ollama-owned source for size caps.
|
|
136
|
+
// When it is unavailable (or returns only coarse capabilities), do NOT
|
|
137
|
+
// inherit giant budgets from bundled fallback metadata sourced from a
|
|
138
|
+
// different catalog; keep the historical safe fallback instead.
|
|
139
|
+
const contextWindow = discoveredContextWindow ?? 128000;
|
|
140
|
+
const reasoning = capabilities ? capabilities.includes("thinking") : (reference?.reasoning ?? false);
|
|
141
|
+
const thinking = capabilities ? getThinkingConfig(id, capabilities) : reference?.thinking;
|
|
142
|
+
const input = capabilities
|
|
143
|
+
? capabilities.includes("vision")
|
|
144
|
+
? (["text", "image"] as Array<"text" | "image">)
|
|
145
|
+
: (["text"] as Array<"text">)
|
|
146
|
+
: ((reference?.input as Array<"text" | "image"> | undefined) ?? (["text"] as Array<"text">));
|
|
147
|
+
const resolvedName = entry.name && entry.name !== id ? entry.name : (reference?.name ?? id);
|
|
148
|
+
return {
|
|
149
|
+
id,
|
|
150
|
+
name: resolvedName,
|
|
151
|
+
api: "ollama-chat" as const,
|
|
152
|
+
provider: "ollama-cloud" as const,
|
|
153
|
+
baseUrl,
|
|
154
|
+
reasoning,
|
|
155
|
+
thinking,
|
|
156
|
+
input,
|
|
157
|
+
cost: reference?.cost ?? { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
158
|
+
contextWindow,
|
|
159
|
+
maxTokens:
|
|
160
|
+
discoveredContextWindow !== null && discoveredContextWindow !== undefined
|
|
161
|
+
? (providerReference?.maxTokens ?? Math.min(contextWindow, 8192))
|
|
162
|
+
: Math.min(contextWindow, 8192),
|
|
163
|
+
omitMaxOutputTokens: true,
|
|
164
|
+
};
|
|
165
|
+
}),
|
|
166
|
+
);
|
|
167
|
+
return models
|
|
168
|
+
.filter((model): model is NonNullable<(typeof models)[number]> => model !== undefined)
|
|
169
|
+
.sort((left, right) => left.id.localeCompare(right.id));
|
|
170
|
+
},
|
|
171
|
+
};
|
|
172
|
+
}
|