@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.
@@ -73,7 +73,12 @@ export interface TypeSafeModelManagerConfig {
73
73
  baseUrl?: string;
74
74
  fetch?: FetchImpl;
75
75
  }
76
- /** Discover account-visible judge models while keeping the bundled offline seed. */
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
- /** Discover account-visible judge models while keeping the bundled offline seed. */
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: staticModels.map(model => ({ ...model, baseUrl })),
439
+ staticModels,
435
440
  ...(apiKey ? { dynamicModelsAuthoritative: true } : undefined),
436
441
  ...(apiKey
437
442
  ? {
438
- fetchDynamicModels: () =>
439
- fetchTypeSafeModels({
440
- apiKey,
441
- baseUrl,
442
- fetch: config.fetch,
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
  };