@linxiraos/pi-catalog 1.3.0 → 1.3.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 +57 -47
- package/dist/types/provider-models/special.d.ts +6 -1
- package/package.json +4 -4
- package/src/compat/rules/providers/openrouter.kdl +8 -1
- package/src/compat/rules/providers/typesafe.kdl +11 -1
- package/src/compat/rules/providers/web.kdl +7 -0
- package/src/compat/rules/runtime/behavior.kdl +3 -2
- package/src/compat/rules.json +1 -1
- package/src/models.json +1 -1
- package/src/provider-models/special.d.ts +6 -1
- package/src/provider-models/special.ts +14 -9
|
@@ -73,7 +73,12 @@ export interface TypeSafeModelManagerConfig {
|
|
|
73
73
|
baseUrl?: string;
|
|
74
74
|
fetch?: FetchImpl;
|
|
75
75
|
}
|
|
76
|
-
/**
|
|
76
|
+
/**
|
|
77
|
+
* Discover account-visible judge models while keeping the bundled offline seed. `GET /v1/models` lists
|
|
78
|
+
* only aliases, yet TypeSafe accepts versioned ids whether or not they are listed, so a successful
|
|
79
|
+
* discovery is extended with the seed rows it omits (the pinned default judge, `jev-1.14.0`) instead of
|
|
80
|
+
* pruning them as `dynamicModelsAuthoritative` otherwise would.
|
|
81
|
+
*/
|
|
77
82
|
export declare function typesafeModelManagerOptions(config?: TypeSafeModelManagerConfig): ModelManagerOptions<"typesafe">;
|
|
78
83
|
export interface ZaiModelManagerConfig {
|
|
79
84
|
}
|
|
@@ -422,25 +422,30 @@ export interface TypeSafeModelManagerConfig {
|
|
|
422
422
|
fetch?: FetchImpl;
|
|
423
423
|
}
|
|
424
424
|
|
|
425
|
-
/**
|
|
425
|
+
/**
|
|
426
|
+
* Discover account-visible judge models while keeping the bundled offline seed. `GET /v1/models` lists
|
|
427
|
+
* only aliases, yet TypeSafe accepts versioned ids whether or not they are listed, so a successful
|
|
428
|
+
* discovery is extended with the seed rows it omits (the pinned default judge, `jev-1.14.0`) instead of
|
|
429
|
+
* pruning them as `dynamicModelsAuthoritative` otherwise would.
|
|
430
|
+
*/
|
|
426
431
|
export function typesafeModelManagerOptions(config: TypeSafeModelManagerConfig = {}): ModelManagerOptions<"typesafe"> {
|
|
427
432
|
const { apiKey } = config;
|
|
428
433
|
const envBaseUrl = Bun.env.TYPESAFE_BASE_URL?.trim();
|
|
429
434
|
const baseUrl = (config.baseUrl ?? (envBaseUrl || TYPESAFE_DEFAULT_BASE_URL)).replace(/\/+$/, "");
|
|
430
|
-
const staticModels = seedModels<"typesafe">("typesafe");
|
|
435
|
+
const staticModels = seedModels<"typesafe">("typesafe").map(model => ({ ...model, baseUrl }));
|
|
431
436
|
return {
|
|
432
437
|
providerId: "typesafe",
|
|
433
438
|
cacheProviderId: resolveModelCacheProviderId("typesafe"),
|
|
434
|
-
staticModels
|
|
439
|
+
staticModels,
|
|
435
440
|
...(apiKey ? { dynamicModelsAuthoritative: true } : undefined),
|
|
436
441
|
...(apiKey
|
|
437
442
|
? {
|
|
438
|
-
fetchDynamicModels: () =>
|
|
439
|
-
fetchTypeSafeModels({
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
443
|
+
fetchDynamicModels: async () => {
|
|
444
|
+
const discovered = await fetchTypeSafeModels({ apiKey, baseUrl, fetch: config.fetch });
|
|
445
|
+
if (!discovered) return discovered;
|
|
446
|
+
const listed = new Set(discovered.map(model => model.id));
|
|
447
|
+
return [...discovered, ...staticModels.filter(model => !listed.has(model.id))];
|
|
448
|
+
},
|
|
444
449
|
}
|
|
445
450
|
: undefined),
|
|
446
451
|
};
|