@oh-my-pi/pi-catalog 18.11.0 → 18.11.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.
@@ -668,6 +668,8 @@ export interface CompiledProvider {
668
668
  dynamicModelsAuthoritative?: boolean;
669
669
  /** Generator backfills never copy reasoning/input/limits from same-id rows on other hosts. */
670
670
  skipCrossProviderReferenceFills?: boolean;
671
+ /** Runtime discovery keeps a bundled row's display name instead of the live one. */
672
+ keepBundledNames?: boolean;
671
673
  /** Present only for providers enrolled in `generate-models.ts` discovery. */
672
674
  discovery?: CompiledProviderDiscovery;
673
675
  /** Non-chat model kinds mapped to their runtime transport APIs. */
@@ -29,6 +29,13 @@ export interface AntigravityDiscoveryApiModel {
29
29
  apiProvider?: string;
30
30
  modelProvider?: string;
31
31
  isInternal?: boolean;
32
+ /**
33
+ * Set for roster rows the backend lists but refuses to serve on this
34
+ * account (e.g. `gemini-4-argon-disabled`, `tagTitle: "Unavailable"`,
35
+ * `model: MODEL_PLACEHOLDER_M421`); a request against such an id answers
36
+ * `Cloud Code Assist API error (404): Requested entity was not found.`
37
+ */
38
+ disabled?: boolean;
32
39
  supportsVideo?: boolean;
33
40
  }
34
41
 
@@ -72,6 +79,7 @@ const AntigravityDiscoveryApiModelSchema = type({
72
79
  "apiProvider?": type("unknown").pipe(value => (typeof value === "string" ? value : undefined)),
73
80
  "modelProvider?": type("unknown").pipe(value => (typeof value === "string" ? value : undefined)),
74
81
  "isInternal?": type("unknown").pipe(value => (typeof value === "boolean" ? value : undefined)),
82
+ "disabled?": type("unknown").pipe(value => (typeof value === "boolean" ? value : undefined)),
75
83
  "supportsVideo?": type("unknown").pipe(value => (typeof value === "boolean" ? value : undefined)),
76
84
  });
77
85
 
@@ -188,6 +196,11 @@ export async function fetchAntigravityDiscoveryModels(
188
196
  if (model.isInternal === true) {
189
197
  continue;
190
198
  }
199
+ // Rows the backend marks unavailable are listed but 404 on inference;
200
+ // discovery is authoritative, so drop them instead of offering a dead id.
201
+ if (model.disabled === true) {
202
+ continue;
203
+ }
191
204
 
192
205
  const supportsImages = model.supportsImages === true;
193
206
  models.push({
@@ -1,5 +1,6 @@
1
1
  import * as http2 from "node:http2";
2
2
  import { type } from "@oh-my-pi/omptype";
3
+ import { slugify } from "@oh-my-pi/pi-utils";
3
4
  import { collapseVariants, type EffortVariantFamily, reviewedVariantFamilyId } from "../compat/collapse";
4
5
  import { compareRevision, parseRevision } from "../compat/revision";
5
6
  import { resolveCatalogAxes, resolveModelPolicy } from "../compat/resolve";
@@ -693,8 +694,8 @@ function cursorLaneId(
693
694
  ): string {
694
695
  const suffixes: string[] = [];
695
696
  for (const parameter of parameters) {
696
- const id = sanitizeCursorLanePart(parameter.id);
697
- const value = sanitizeCursorLanePart(parameter.value);
697
+ const id = slugify(parameter.id);
698
+ const value = slugify(parameter.value);
698
699
  // Boolean lanes are named by their `true` side regardless of variant
699
700
  // order: Cursor lists `composer-2.5`'s Fast variant first, and treating
700
701
  // that as the default would hand the bare id to the Fast route.
@@ -743,13 +744,6 @@ function reviewedCursorLaneId(entries: readonly NormalizedRichVariant[], claimed
743
744
  return familyId;
744
745
  }
745
746
 
746
- function sanitizeCursorLanePart(value: string): string {
747
- return value
748
- .toLowerCase()
749
- .replace(/[^a-z0-9]+/g, "-")
750
- .replace(/^-+|-+$/g, "");
751
- }
752
-
753
747
  function cursorLaneName(details: AvailableModelsResponse_ModelDetails, laneId: string, baseId: string): string {
754
748
  const baseName =
755
749
  details.clientDisplayName?.trim() || details.serverModelName?.trim() || details.name.trim() || baseId;
@@ -1,4 +1,4 @@
1
- import { logger } from "@oh-my-pi/pi-utils";
1
+ import { logger, slugify } from "@oh-my-pi/pi-utils";
2
2
  import { collapseVariants, type EffortVariantFamily } from "../compat/collapse";
3
3
  import { Effort, THINKING_EFFORTS } from "../effort";
4
4
  import type { DevinCompat, FetchImpl, ModelCost, ModelSpec } from "../types";
@@ -229,10 +229,7 @@ function collectDevinFamilyLane(lanes: Map<string, DevinFamilyLane>, config: Cli
229
229
  if (thinking === false) effort = "off";
230
230
 
231
231
  // Family label as an OMP id: "GPT-5.6 Sol" -> "gpt-5-6-sol".
232
- const baseId = label
233
- .toLowerCase()
234
- .replace(/[^a-z0-9]+/g, "-")
235
- .replace(/^-+|-+$/g, "");
232
+ const baseId = slugify(label);
236
233
  if (!baseId) return;
237
234
  const laneId = `${baseId}${oneMillionContext ? "-1m" : ""}${fast ? "-fast" : ""}`;
238
235
  let lane = lanes.get(laneId);
@@ -73,6 +73,12 @@ export interface ModelManagerOptions<TApi extends Api = Api, TModelsDevPayload =
73
73
  * a zero discovery price is treated as unknown and the bundled rate is kept.
74
74
  */
75
75
  dynamicCostAuthoritative?: boolean;
76
+ /**
77
+ * When true, a static row's display name wins over the cached or live row
78
+ * for the same id, so a model keeps one name before and after discovery.
79
+ * Set from the provider's `keep-bundled-names` catalog entry.
80
+ */
81
+ keepStaticNames?: boolean;
76
82
  /**
77
83
  * When true, a fresh cache never satisfies an online-eligible refresh: the
78
84
  * dynamic fetch always runs (an explicit `"offline"` strategy is still
@@ -275,6 +281,7 @@ export async function resolveProviderModels<TApi extends Api = Api, TModelsDevPa
275
281
  input: options.dynamicInputAuthoritative ?? false,
276
282
  reasoning: options.dynamicReasoningAuthoritative ?? false,
277
283
  cost: options.dynamicCostAuthoritative ?? false,
284
+ staticNames: options.keepStaticNames ? new Map(staticModels.map(model => [model.id, model.name])) : undefined,
278
285
  };
279
286
  const cacheDropIds = options.dropCachedModelIdsOnStaticMismatch;
280
287
  const staticCatalogFingerprint = fingerprintStaticModels(staticModels, dynamicModelsAuthoritative);
@@ -582,6 +589,8 @@ interface DynamicMergeAuthority {
582
589
  readonly input: boolean;
583
590
  readonly reasoning: boolean;
584
591
  readonly cost: boolean;
592
+ /** Static display names by id that override dynamic rows (`keepStaticNames`). */
593
+ readonly staticNames: ReadonlyMap<string, string> | undefined;
585
594
  }
586
595
 
587
596
  function mergeDynamicModels<TApi extends Api>(
@@ -694,7 +703,9 @@ function mergeDynamicModel<TApi extends Api>(
694
703
  return buildModel({
695
704
  ...existingModel,
696
705
  ...dynamicModel,
697
- name: preferDiscoveryName(dynamicModel.name, existingModel.name, dynamicModel.id),
706
+ name:
707
+ authority.staticNames?.get(dynamicModel.id) ??
708
+ preferDiscoveryName(dynamicModel.name, existingModel.name, dynamicModel.id),
698
709
  reasoning,
699
710
  ...(trustsOwnThinking ? { thinking: dynamicModel.thinking } : {}),
700
711
  input: supportsImage ? ["text", "image"] : ["text"],