@linxiraos/pi-catalog 1.0.0 → 1.0.2
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 +88 -6
- package/package.json +98 -99
- package/src/build.ts +3 -3
- package/src/compat/openai.ts +0 -6
- package/src/discovery/antigravity.ts +5 -1
- package/src/discovery/openai-compatible.ts +21 -4
- package/src/identity/classify.ts +32 -9
- package/src/identity/family.ts +18 -4
- package/src/model-manager.ts +13 -2
- package/src/model-thinking.ts +15 -7
- package/src/models.json +7999 -2099
- package/src/models.ts +28 -14
- package/src/provider-models/bundled-references.ts +4 -2
- package/src/provider-models/openai-compat.ts +379 -301
- package/src/types.ts +24 -16
- package/src/variant-collapse.ts +34 -17
- package/src/wire/gemini-headers.ts +79 -18
- package/dist/types/build.d.ts +0 -14
- package/dist/types/compat/anthropic.d.ts +0 -18
- package/dist/types/compat/apply.d.ts +0 -7
- package/dist/types/compat/bedrock.d.ts +0 -3
- package/dist/types/compat/devin.d.ts +0 -9
- package/dist/types/compat/openai.d.ts +0 -26
- package/dist/types/discovery/antigravity.d.ts +0 -70
- package/dist/types/discovery/codex.d.ts +0 -36
- package/dist/types/discovery/cursor-gen/agent_pb.d.ts +0 -16769
- package/dist/types/discovery/cursor.d.ts +0 -23
- package/dist/types/discovery/devin-gen/buf/validate/validate_pb.d.ts +0 -1715
- package/dist/types/discovery/devin-gen/exa/analytics_pb/analytics_pb.d.ts +0 -693
- package/dist/types/discovery/devin-gen/exa/api_server_pb/api_server_pb.d.ts +0 -9158
- package/dist/types/discovery/devin-gen/exa/auth_pb/auth_pb.d.ts +0 -52
- package/dist/types/discovery/devin-gen/exa/auto_cascade_common_pb/auto_cascade_common_pb.d.ts +0 -276
- package/dist/types/discovery/devin-gen/exa/bug_checker_pb/bug_checker_pb.d.ts +0 -78
- package/dist/types/discovery/devin-gen/exa/cascade_plugins_pb/cascade_plugins_pb.d.ts +0 -999
- package/dist/types/discovery/devin-gen/exa/chat_pb/chat_pb.d.ts +0 -1704
- package/dist/types/discovery/devin-gen/exa/code_edit/code_edit_pb/code_edit_pb.d.ts +0 -656
- package/dist/types/discovery/devin-gen/exa/codeium_common_pb/codeium_common_pb.d.ts +0 -15014
- package/dist/types/discovery/devin-gen/exa/context_module_pb/context_module_pb.d.ts +0 -607
- package/dist/types/discovery/devin-gen/exa/cortex_pb/cortex_pb.d.ts +0 -11830
- package/dist/types/discovery/devin-gen/exa/diff_action_pb/diff_action_pb.d.ts +0 -248
- package/dist/types/discovery/devin-gen/exa/index_pb/index_pb.d.ts +0 -1747
- package/dist/types/discovery/devin-gen/exa/knowledge_base_pb/knowledge_base_pb.d.ts +0 -509
- package/dist/types/discovery/devin-gen/exa/language_server_pb/language_server_pb.d.ts +0 -9048
- package/dist/types/discovery/devin-gen/exa/opensearch_clients_pb/opensearch_clients_pb.d.ts +0 -1760
- package/dist/types/discovery/devin-gen/exa/prompt_pb/prompt_pb.d.ts +0 -286
- package/dist/types/discovery/devin-gen/exa/reactive_component_pb/reactive_component_pb.d.ts +0 -405
- package/dist/types/discovery/devin-gen/exa/trust_pb/trust_pb.d.ts +0 -582
- package/dist/types/discovery/devin.d.ts +0 -24
- package/dist/types/discovery/gemini.d.ts +0 -25
- package/dist/types/discovery/gitlab-duo-workflow.d.ts +0 -30
- package/dist/types/discovery/index.d.ts +0 -5
- package/dist/types/discovery/openai-compatible.d.ts +0 -74
- package/dist/types/effort.d.ts +0 -10
- package/dist/types/fireworks-model-id.d.ts +0 -23
- package/dist/types/hosts.d.ts +0 -164
- package/dist/types/identity/bundled.d.ts +0 -3
- package/dist/types/identity/classify.d.ts +0 -69
- package/dist/types/identity/dialect.d.ts +0 -3
- package/dist/types/identity/family.d.ts +0 -181
- package/dist/types/identity/id.d.ts +0 -12
- package/dist/types/identity/index.d.ts +0 -8
- package/dist/types/identity/markers.d.ts +0 -4
- package/dist/types/identity/priority.d.ts +0 -1
- package/dist/types/identity/reference.d.ts +0 -29
- package/dist/types/index.d.ts +0 -17
- package/dist/types/model-cache.d.ts +0 -23
- package/dist/types/model-manager.d.ts +0 -77
- package/dist/types/model-thinking.d.ts +0 -66
- package/dist/types/models.d.ts +0 -12
- package/dist/types/provider-models/bundled-references.d.ts +0 -13
- package/dist/types/provider-models/cache-provider-id.d.ts +0 -9
- package/dist/types/provider-models/descriptor-types.d.ts +0 -76
- package/dist/types/provider-models/descriptors.d.ts +0 -504
- package/dist/types/provider-models/google.d.ts +0 -27
- package/dist/types/provider-models/index.d.ts +0 -7
- package/dist/types/provider-models/ollama.d.ts +0 -22
- package/dist/types/provider-models/openai-compat.d.ts +0 -599
- package/dist/types/provider-models/special.d.ts +0 -53
- package/dist/types/types.d.ts +0 -811
- package/dist/types/utils.d.ts +0 -20
- package/dist/types/variant-collapse.d.ts +0 -133
- package/dist/types/wire/alibaba-token-plan.d.ts +0 -22
- package/dist/types/wire/codex.d.ts +0 -42
- package/dist/types/wire/coreweave.d.ts +0 -12
- package/dist/types/wire/gemini-headers.d.ts +0 -37
- package/dist/types/wire/github-copilot.d.ts +0 -39
package/src/types.ts
CHANGED
|
@@ -155,6 +155,7 @@ export type OpenAIReasoningFormat = "openai" | "openrouter" | "zai" | "kimi" | "
|
|
|
155
155
|
export type OpenAIReasoningDisableMode =
|
|
156
156
|
| "omit"
|
|
157
157
|
| "lowest-effort"
|
|
158
|
+
| "none-effort"
|
|
158
159
|
| "openrouter-enabled-false"
|
|
159
160
|
| "zai-thinking-disabled"
|
|
160
161
|
| "qwen-enable-thinking-false"
|
|
@@ -190,13 +191,6 @@ export interface OpenAICompat {
|
|
|
190
191
|
reasoningEffortMap?: Partial<Record<Effort, string>>;
|
|
191
192
|
/** Whether the provider supports `stream_options: { include_usage: true }` for token usage in streaming responses. Default: true. */
|
|
192
193
|
supportsUsageInStreaming?: boolean;
|
|
193
|
-
/**
|
|
194
|
-
* Enable the Gemini thinking-loop guard (pi-ai stream layer) for this model.
|
|
195
|
-
* Defaults to true when the model id classifies as the gemini family. Set
|
|
196
|
-
* explicitly to cover an opaque OpenAI-compat proxy alias (e.g. `my-model`)
|
|
197
|
-
* that routes to Gemini, or to false to opt a gemini-family id out.
|
|
198
|
-
*/
|
|
199
|
-
enableGeminiThinkingLoopGuard?: boolean;
|
|
200
194
|
/** Which field to use for max tokens. Default: auto-detected from URL. */
|
|
201
195
|
maxTokensField?: "max_completion_tokens" | "max_tokens";
|
|
202
196
|
/** Whether tool results require the `name` field. Default: auto-detected from URL. */
|
|
@@ -627,8 +621,6 @@ export interface ResolvedOpenAISharedCompat {
|
|
|
627
621
|
isOpenRouterHost: boolean;
|
|
628
622
|
/** Whether this endpoint needs a max-token field even when caller did not set one. */
|
|
629
623
|
alwaysSendMaxTokens: boolean;
|
|
630
|
-
/** See {@link OpenAICompat.enableGeminiThinkingLoopGuard}. Set by the builder from the family classifier. */
|
|
631
|
-
enableGeminiThinkingLoopGuard?: boolean;
|
|
632
624
|
openRouterRouting?: OpenAICompat["openRouterRouting"];
|
|
633
625
|
/** Provider-specific wire model-id transform applied to the base id. */
|
|
634
626
|
wireModelIdMode: "raw" | "firepass" | "fireworks" | "openrouter";
|
|
@@ -697,7 +689,6 @@ export type ResolvedOpenAICompat = ResolvedOpenAISharedCompat &
|
|
|
697
689
|
| "thinkingKeep"
|
|
698
690
|
| "strictResponsesPairing"
|
|
699
691
|
| "supportsImageDetailOriginal"
|
|
700
|
-
| "enableGeminiThinkingLoopGuard"
|
|
701
692
|
| "whenThinking"
|
|
702
693
|
>
|
|
703
694
|
> & {
|
|
@@ -819,6 +810,28 @@ export interface RemoteCompactionConfig<TApi extends Api = Api> {
|
|
|
819
810
|
model?: string;
|
|
820
811
|
}
|
|
821
812
|
|
|
813
|
+
/** Per-million-token rates for one model pricing tier. */
|
|
814
|
+
export interface TokenCost {
|
|
815
|
+
input: number;
|
|
816
|
+
output: number;
|
|
817
|
+
cacheRead: number;
|
|
818
|
+
cacheWrite: number;
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
/**
|
|
822
|
+
* Rates applied to the full request when its prompt exceeds `inputThreshold`.
|
|
823
|
+
* Prompt input is the sum of uncached, cached-read, cache-write, and
|
|
824
|
+
* provider-orchestration input tokens.
|
|
825
|
+
*/
|
|
826
|
+
export interface LongContextTokenCost extends TokenCost {
|
|
827
|
+
inputThreshold: number;
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
/** Base token rates plus an optional long-context tier. */
|
|
831
|
+
export interface ModelCost extends TokenCost {
|
|
832
|
+
longContext?: LongContextTokenCost;
|
|
833
|
+
}
|
|
834
|
+
|
|
822
835
|
// Model interface for the unified model system
|
|
823
836
|
export interface Model<TApi extends Api = Api> {
|
|
824
837
|
id: string;
|
|
@@ -864,12 +877,7 @@ export interface Model<TApi extends Api = Api> {
|
|
|
864
877
|
gitlabDuoWorkflowRootNamespaceId?: string;
|
|
865
878
|
/** Cursor `max_mode` request flag returned by `GetUsableModels` for premium models that require max mode. */
|
|
866
879
|
cursorMaxMode?: boolean;
|
|
867
|
-
cost:
|
|
868
|
-
input: number; // $/million tokens
|
|
869
|
-
output: number; // $/million tokens
|
|
870
|
-
cacheRead: number; // $/million tokens
|
|
871
|
-
cacheWrite: number; // $/million tokens
|
|
872
|
-
};
|
|
880
|
+
cost: ModelCost;
|
|
873
881
|
/** Premium Copilot requests charged per user-initiated request (defaults to 1). */
|
|
874
882
|
premiumMultiplier?: number;
|
|
875
883
|
contextWindow: number | null;
|
package/src/variant-collapse.ts
CHANGED
|
@@ -265,22 +265,32 @@ function geminiFlashFamily(mode: "budget" | "google-level"): EffortVariantFamily
|
|
|
265
265
|
};
|
|
266
266
|
}
|
|
267
267
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
}
|
|
268
|
+
/**
|
|
269
|
+
* Gemini 3.6+ Flash exposes one mandatory-reasoning wire id per thinking
|
|
270
|
+
* level. Some generations retain additional discovery-only aliases.
|
|
271
|
+
*/
|
|
272
|
+
function geminiLevelFlashFamily(version: "3.6" | "3.7", ...additionalMembers: string[]): EffortVariantFamily {
|
|
273
|
+
const id = `gemini-${version}-flash`;
|
|
274
|
+
return {
|
|
275
|
+
id,
|
|
276
|
+
name: `Gemini ${version} Flash`,
|
|
277
|
+
members: [`${id}-low`, `${id}-medium`, `${id}-high`, ...additionalMembers],
|
|
278
|
+
routing: {
|
|
279
|
+
[Effort.Minimal]: `${id}-low`,
|
|
280
|
+
[Effort.Low]: `${id}-low`,
|
|
281
|
+
[Effort.Medium]: `${id}-medium`,
|
|
282
|
+
[Effort.High]: `${id}-high`,
|
|
283
|
+
},
|
|
284
|
+
thinking: {
|
|
285
|
+
mode: "google-level",
|
|
286
|
+
efforts: GEMINI_3_FLASH_FAMILY_EFFORTS,
|
|
287
|
+
requiresEffort: true,
|
|
288
|
+
},
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
const GEMINI_36_FLASH_FAMILY = geminiLevelFlashFamily("3.6", "gemini-3.6-flash-tiered");
|
|
293
|
+
const GEMINI_37_FLASH_FAMILY = geminiLevelFlashFamily("3.7");
|
|
284
294
|
|
|
285
295
|
function geminiProFamily(mode: "budget" | "google-level"): EffortVariantFamily {
|
|
286
296
|
const budget = mode === "budget";
|
|
@@ -364,13 +374,20 @@ const SHARED_CCA_FAMILIES: readonly EffortVariantFamily[] = [
|
|
|
364
374
|
|
|
365
375
|
/** `google-antigravity` Gemini families, using each generation's native transport. */
|
|
366
376
|
export const ANTIGRAVITY_VARIANT_COLLAPSE_TABLE: VariantCollapseTable = {
|
|
367
|
-
families: [
|
|
377
|
+
families: [
|
|
378
|
+
GEMINI_36_FLASH_FAMILY,
|
|
379
|
+
GEMINI_37_FLASH_FAMILY,
|
|
380
|
+
geminiFlashFamily("budget"),
|
|
381
|
+
geminiProFamily("budget"),
|
|
382
|
+
...SHARED_CCA_FAMILIES,
|
|
383
|
+
],
|
|
368
384
|
};
|
|
369
385
|
|
|
370
386
|
/** `google-gemini-cli` Gemini families on the official CLI's level transport. */
|
|
371
387
|
export const GEMINI_CLI_VARIANT_COLLAPSE_TABLE: VariantCollapseTable = {
|
|
372
388
|
families: [
|
|
373
389
|
GEMINI_36_FLASH_FAMILY,
|
|
390
|
+
GEMINI_37_FLASH_FAMILY,
|
|
374
391
|
geminiFlashFamily("google-level"),
|
|
375
392
|
geminiProFamily("google-level"),
|
|
376
393
|
...SHARED_CCA_FAMILIES,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { FetchImpl } from "@linxiraos/pi-utils";
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Build a User-Agent string that identifies as Gemini CLI to unlock higher rate limits.
|
|
3
5
|
* Uses the same format as the official Gemini CLI (v0.35+):
|
|
@@ -15,30 +17,89 @@ export const getGeminiCliHeaders = (modelId?: string) => ({
|
|
|
15
17
|
"Client-Metadata": "ideType=IDE_UNSPECIFIED,platform=PLATFORM_UNSPECIFIED,pluginType=GEMINI",
|
|
16
18
|
});
|
|
17
19
|
|
|
18
|
-
export const ANTIGRAVITY_SYSTEM_INSTRUCTION =
|
|
19
|
-
"You are Antigravity, a powerful agentic AI coding assistant designed by the Google Deepmind team working on Advanced Agentic Coding." +
|
|
20
|
-
"You are pair programming with a USER to solve their coding task. The task may require creating a new codebase, modifying or debugging an existing codebase, or simply answering a question." +
|
|
21
|
-
"**Absolute paths only**" +
|
|
22
|
-
"**Proactiveness**";
|
|
23
20
|
/**
|
|
24
21
|
* Antigravity / Cloud Code Assist user agent. Lives in its own file so discovery
|
|
25
22
|
* and usage code can read it without pulling the heavy google-gemini-cli provider
|
|
26
23
|
* (and its @google/genai → google-auth-library dependency chain) into the startup
|
|
27
24
|
* parse graph.
|
|
25
|
+
*
|
|
26
|
+
* Format captured from the real 2.8.0 `antigravity/hub` client:
|
|
27
|
+
* `antigravity/hub/2.8.0 (aidev_client; os_type=darwin; arch=arm64; cl=963137146)`.
|
|
28
|
+
* The backend gates newer models (e.g. gemini-3.7-flash) on the client version,
|
|
29
|
+
* so the version tracks the latest Antigravity release via the update manifest
|
|
30
|
+
* (see {@link ensureAntigravityVersion}) with `DEFAULT_ANTIGRAVITY_VERSION` as
|
|
31
|
+
* the offline fallback. os_type/arch are pinned to the darwin/arm64 reference
|
|
32
|
+
* client the version and manifest are captured from, independent of the host
|
|
33
|
+
* platform. Overrides: PI_AI_ANTIGRAVITY_VERSION / _CL / _OS / _ARCH.
|
|
28
34
|
*/
|
|
29
|
-
export
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
return
|
|
41
|
-
}
|
|
35
|
+
export const DEFAULT_ANTIGRAVITY_VERSION = "2.8.0";
|
|
36
|
+
|
|
37
|
+
const ANTIGRAVITY_VERSION_MANIFEST_URL =
|
|
38
|
+
"https://antigravity-hub-auto-updater-974169037036.us-central1.run.app/manifest/latest-arm64-mac.yml";
|
|
39
|
+
const ANTIGRAVITY_VERSION_FETCH_TIMEOUT_MS = 5_000;
|
|
40
|
+
|
|
41
|
+
let discoveredAntigravityVersion: string | null = null;
|
|
42
|
+
let antigravityVersionFetch: Promise<void> | null = null;
|
|
43
|
+
|
|
44
|
+
/** Current Antigravity client version: env override → manifest-discovered → pinned fallback. */
|
|
45
|
+
export function getAntigravityVersion(): string {
|
|
46
|
+
return process.env.PI_AI_ANTIGRAVITY_VERSION || discoveredAntigravityVersion || DEFAULT_ANTIGRAVITY_VERSION;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Extracts the client version from an electron-builder update manifest.
|
|
51
|
+
* Returns null when no well-formed `version:` line is present.
|
|
52
|
+
*/
|
|
53
|
+
export function parseAntigravityManifestVersion(yamlText: string): string | null {
|
|
54
|
+
for (const line of yamlText.split(/\r?\n/)) {
|
|
55
|
+
const match = /^\s*version\s*:\s*(?:"([^"]*)"|'([^']*)'|([^\s#]+))\s*(?:#.*)?$/.exec(line);
|
|
56
|
+
if (!match) continue;
|
|
57
|
+
const version = (match[1] ?? match[2] ?? match[3] ?? "").trim();
|
|
58
|
+
return /^\d+\.\d+\.\d+$/.test(version) ? version : null;
|
|
59
|
+
}
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Resolves the latest Antigravity release from the official update manifest.
|
|
65
|
+
* Success is cached for the process lifetime; failures are silent (the pinned
|
|
66
|
+
* fallback stays valid) and clear the in-flight cache so a later call retries.
|
|
67
|
+
* Skipped entirely when PI_AI_ANTIGRAVITY_VERSION is set.
|
|
68
|
+
*/
|
|
69
|
+
export function ensureAntigravityVersion(fetcher: FetchImpl = fetch, signal?: AbortSignal): Promise<void> {
|
|
70
|
+
if (process.env.PI_AI_ANTIGRAVITY_VERSION || discoveredAntigravityVersion) return Promise.resolve();
|
|
71
|
+
if (antigravityVersionFetch) return antigravityVersionFetch;
|
|
72
|
+
|
|
73
|
+
antigravityVersionFetch = (async () => {
|
|
74
|
+
try {
|
|
75
|
+
const timeoutSignal = AbortSignal.timeout(ANTIGRAVITY_VERSION_FETCH_TIMEOUT_MS);
|
|
76
|
+
const response = await fetcher(ANTIGRAVITY_VERSION_MANIFEST_URL, {
|
|
77
|
+
headers: { "Cache-Control": "no-cache", "User-Agent": "electron-builder" },
|
|
78
|
+
signal: signal ? AbortSignal.any([signal, timeoutSignal]) : timeoutSignal,
|
|
79
|
+
});
|
|
80
|
+
if (response.ok) {
|
|
81
|
+
discoveredAntigravityVersion = parseAntigravityManifestVersion(await response.text());
|
|
82
|
+
}
|
|
83
|
+
} catch {
|
|
84
|
+
// Silent: the pinned fallback remains valid when version discovery fails.
|
|
85
|
+
} finally {
|
|
86
|
+
if (!discoveredAntigravityVersion) antigravityVersionFetch = null;
|
|
87
|
+
}
|
|
88
|
+
})();
|
|
89
|
+
return antigravityVersionFetch;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** Antigravity `User-Agent` header value; rebuilt when the discovered version changes. */
|
|
93
|
+
export function getAntigravityUserAgent(): string {
|
|
94
|
+
const version = getAntigravityVersion();
|
|
95
|
+
// The backend does not validate `cl` (verified live: stale, zero, and absent
|
|
96
|
+
// cl all pass model gating on daily-cloudcode-pa; only the version gates).
|
|
97
|
+
// The update manifest carries no changelist, so the captured value stays.
|
|
98
|
+
const cl = process.env.PI_AI_ANTIGRAVITY_CL || "963137146";
|
|
99
|
+
const os = process.env.PI_AI_ANTIGRAVITY_OS || "darwin";
|
|
100
|
+
const arch = process.env.PI_AI_ANTIGRAVITY_ARCH || "arm64";
|
|
101
|
+
return `antigravity/hub/${version} (aidev_client; os_type=${os}; arch=${arch}; cl=${cl})`;
|
|
102
|
+
}
|
|
42
103
|
|
|
43
104
|
/**
|
|
44
105
|
* Per-wire-id Antigravity Cloud Code Assist request constants, captured from the
|
package/dist/types/build.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
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 type { Api, CompatOf, Model, ModelSpec } from "./types.js";
|
|
13
|
-
export declare function buildModel<TApi extends Api>(spec: ModelSpec<TApi>): Model<TApi>;
|
|
14
|
-
export declare function buildCompat(spec: ModelSpec<Api>): CompatOf<Api>;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { ModelSpec, ResolvedAnthropicCompat } from "../types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Official first-party Anthropic API. A missing baseUrl is official on purpose:
|
|
4
|
-
* request dispatch falls back to `https://api.anthropic.com`. This is the one
|
|
5
|
-
* auth-sensitive host check — OAuth credentials are attached based on it — so
|
|
6
|
-
* it requires the exact origin or a path boundary (`/`) after it; a bare
|
|
7
|
-
* prefix check would accept lookalikes like `https://api.anthropic.com.evil.com`.
|
|
8
|
-
*/
|
|
9
|
-
export declare function isOfficialAnthropicApiUrl(baseUrl?: string): boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Known non-official URLs that enforce Anthropic thinking signatures on replay.
|
|
12
|
-
*
|
|
13
|
-
* Runtime routing calls this with the effective URL because a model's resolved
|
|
14
|
-
* compat can be stale after Foundry or a provider base-URL override reroutes it.
|
|
15
|
-
*/
|
|
16
|
-
export declare function isAnthropicSigningProxyUrl(baseUrl?: string): boolean;
|
|
17
|
-
/** Build the resolved anthropic-messages compat record for a model spec. */
|
|
18
|
-
export declare function buildAnthropicCompat(spec: ModelSpec<"anthropic-messages">): ResolvedAnthropicCompat;
|
|
@@ -1,7 +0,0 @@
|
|
|
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 declare function applyCompatOverrides(compat: object, overrides: object | undefined): void;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { ModelSpec, ResolvedDevinCompat } from "../types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Resolve devin-agent (Codeium Cascade) compat. Cascade has no wire
|
|
4
|
-
* reasoning/effort field — effort is selected by routing to a sibling model id
|
|
5
|
-
* (the `thinking.effortRouting` baked by variant-collapse). So the thinking
|
|
6
|
-
* deriver must never fabricate an effort ladder from identity for these models;
|
|
7
|
-
* only explicit routed metadata counts.
|
|
8
|
-
*/
|
|
9
|
-
export declare function buildDevinCompat(_spec: ModelSpec<"devin-agent">): ResolvedDevinCompat;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { ModelSpec, OpenAICompat, ResolvedOpenAICompat, ResolvedOpenAIResponsesCompat, ResolvedOpenRouterCompat } from "../types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Build the resolved chat-completions compat record for a model spec.
|
|
4
|
-
* Provider takes precedence over URL-based detection since it's explicitly configured.
|
|
5
|
-
*/
|
|
6
|
-
export declare function buildOpenAICompat(spec: ModelSpec<"openai-completions">): ResolvedOpenAICompat;
|
|
7
|
-
interface OpenAIResponsesSpecLike {
|
|
8
|
-
id?: string;
|
|
9
|
-
provider: string;
|
|
10
|
-
name: string;
|
|
11
|
-
baseUrl: string;
|
|
12
|
-
reasoning?: boolean;
|
|
13
|
-
compat?: OpenAICompat;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Build the resolved Responses-API compat record. Most shared OpenAI-compatible
|
|
17
|
-
* capability defaults intentionally mirror chat-completions, while Responses-
|
|
18
|
-
* only behavior (developer role, prompt cache, pairing strictness, image detail)
|
|
19
|
-
* keeps endpoint-specific detection. Azure is detected by provider id as well
|
|
20
|
-
* as URL — bundled `azure` models carry no baseUrl (the deployment host is per-
|
|
21
|
-
* resource, resolved at runtime) — while OpenAI/Copilot developer-role and
|
|
22
|
-
* prompt-cache detection stay URL-keyed, as the historical call sites were.
|
|
23
|
-
*/
|
|
24
|
-
export declare function buildOpenAIResponsesCompat(spec: OpenAIResponsesSpecLike): ResolvedOpenAIResponsesCompat;
|
|
25
|
-
export declare function buildOpenRouterCompat(spec: ModelSpec<"openrouter">): ResolvedOpenRouterCompat;
|
|
26
|
-
export {};
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import type { ModelSpec } from "../types.js";
|
|
2
|
-
import { type VariantCollapseTable } from "../variant-collapse.js";
|
|
3
|
-
export declare const ANTIGRAVITY_PRIMARY_ENDPOINT = "https://daily-cloudcode-pa.googleapis.com";
|
|
4
|
-
export declare const ANTIGRAVITY_SANDBOX_ENDPOINT = "https://daily-cloudcode-pa.sandbox.googleapis.com";
|
|
5
|
-
/**
|
|
6
|
-
* Raw model metadata returned by Antigravity's `fetchAvailableModels` endpoint.
|
|
7
|
-
*/
|
|
8
|
-
export interface AntigravityDiscoveryApiModel {
|
|
9
|
-
displayName?: string;
|
|
10
|
-
supportsImages?: boolean;
|
|
11
|
-
supportsThinking?: boolean;
|
|
12
|
-
thinkingBudget?: number;
|
|
13
|
-
recommended?: boolean;
|
|
14
|
-
maxTokens?: number;
|
|
15
|
-
maxOutputTokens?: number;
|
|
16
|
-
model?: string;
|
|
17
|
-
apiProvider?: string;
|
|
18
|
-
modelProvider?: string;
|
|
19
|
-
isInternal?: boolean;
|
|
20
|
-
supportsVideo?: boolean;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Grouping metadata used by Antigravity to surface recommended model ids.
|
|
24
|
-
*/
|
|
25
|
-
export interface AntigravityDiscoveryAgentModelGroup {
|
|
26
|
-
modelIds?: string[];
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Sort/group metadata used by Antigravity to surface recommended model ids.
|
|
30
|
-
*/
|
|
31
|
-
export interface AntigravityDiscoveryAgentModelSort {
|
|
32
|
-
groups?: AntigravityDiscoveryAgentModelGroup[];
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Response payload returned by Antigravity's `fetchAvailableModels` endpoint.
|
|
36
|
-
*/
|
|
37
|
-
export interface AntigravityDiscoveryApiResponse {
|
|
38
|
-
models?: Record<string, AntigravityDiscoveryApiModel>;
|
|
39
|
-
agentModelSorts?: AntigravityDiscoveryAgentModelSort[];
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Options for fetching Antigravity discovery models.
|
|
43
|
-
*/
|
|
44
|
-
export interface FetchAntigravityDiscoveryModelsOptions {
|
|
45
|
-
/** OAuth access token used as `Authorization: Bearer <token>`. */
|
|
46
|
-
token: string;
|
|
47
|
-
/** Optional endpoint override. Defaults to Antigravity fallback endpoints. */
|
|
48
|
-
endpoint?: string;
|
|
49
|
-
/** Deprecated and ignored for antigravity discovery parity. */
|
|
50
|
-
project?: string;
|
|
51
|
-
/** Optional user agent override. */
|
|
52
|
-
userAgent?: string;
|
|
53
|
-
/** Optional abort signal for request cancellation. */
|
|
54
|
-
signal?: AbortSignal;
|
|
55
|
-
/** Optional fetch implementation override for tests. */
|
|
56
|
-
fetcher?: typeof fetch;
|
|
57
|
-
/**
|
|
58
|
-
* Hand collapse table to apply to the discovered list. Defaults to the
|
|
59
|
-
* Antigravity (budget-transport) table; `googleGeminiCli` passes the
|
|
60
|
-
* level-transport table so cloudcode-pa keeps `thinkingLevel`.
|
|
61
|
-
*/
|
|
62
|
-
collapseTable?: VariantCollapseTable;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Fetches discoverable Antigravity models and normalizes them into canonical model entries.
|
|
66
|
-
*
|
|
67
|
-
* Returns `null` on network/payload/auth failures.
|
|
68
|
-
* Returns `[]` only when the endpoint responds successfully with no usable models.
|
|
69
|
-
*/
|
|
70
|
-
export declare function fetchAntigravityDiscoveryModels(options: FetchAntigravityDiscoveryModelsOptions): Promise<ModelSpec<"google-gemini-cli">[] | null>;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { FetchImpl, ModelSpec } from "../types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Fetch options for OpenAI Codex model discovery.
|
|
4
|
-
*/
|
|
5
|
-
export interface CodexModelDiscoveryOptions {
|
|
6
|
-
/** OAuth access token used for `Authorization: Bearer ...`. */
|
|
7
|
-
accessToken: string;
|
|
8
|
-
/** ChatGPT account id value used for `chatgpt-account-id` header. */
|
|
9
|
-
accountId?: string;
|
|
10
|
-
/** Base URL for Codex backend. Defaults to `https://chatgpt.com/backend-api`. */
|
|
11
|
-
baseUrl?: string;
|
|
12
|
-
/** Optional client version attached as `client_version` query parameter. */
|
|
13
|
-
clientVersion?: string;
|
|
14
|
-
/** Optional endpoint path candidates. Defaults to `/codex/models`, then `/models`. */
|
|
15
|
-
paths?: readonly string[];
|
|
16
|
-
/** Additional headers merged on top of required Codex headers. */
|
|
17
|
-
headers?: Record<string, string>;
|
|
18
|
-
/** Abort signal for network request cancellation. */
|
|
19
|
-
signal?: AbortSignal;
|
|
20
|
-
/** Optional fetch implementation override for tests. */
|
|
21
|
-
fetchFn?: FetchImpl;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Normalized Codex discovery response.
|
|
25
|
-
*/
|
|
26
|
-
export interface CodexModelDiscoveryResult {
|
|
27
|
-
models: ModelSpec<"openai-codex-responses">[];
|
|
28
|
-
etag?: string;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Fetches model metadata from Codex backend and normalizes it for pi model management.
|
|
32
|
-
*
|
|
33
|
-
* Returns `null` when no supported model-list route can be fetched/parsed.
|
|
34
|
-
* Returns `{ models: [] }` when a route succeeds but yields no usable models.
|
|
35
|
-
*/
|
|
36
|
-
export declare function fetchCodexModels(options: CodexModelDiscoveryOptions): Promise<CodexModelDiscoveryResult | null>;
|