@oh-my-pi/pi-catalog 18.4.4 → 18.4.6

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.
Files changed (61) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/dist/types/compat/auth-ids.d.ts +2 -2
  3. package/dist/types/compat/axes.d.ts +3 -1
  4. package/dist/types/compat/factory-droid.d.ts +65 -0
  5. package/dist/types/compat/provider-ids.d.ts +1 -1
  6. package/dist/types/compat/resolve.d.ts +8 -2
  7. package/dist/types/compat/types.d.ts +26 -1
  8. package/dist/types/discovery/cursor-proto.d.ts +284 -0
  9. package/dist/types/discovery/cursor.d.ts +12 -6
  10. package/dist/types/discovery/factory-droid.d.ts +28 -0
  11. package/dist/types/discovery/index.d.ts +1 -0
  12. package/dist/types/discovery/protobuf.d.ts +3 -3
  13. package/dist/types/model-manager.d.ts +10 -0
  14. package/dist/types/models.d.ts +5 -1
  15. package/dist/types/provider-models/cache-provider-id.d.ts +2 -1
  16. package/dist/types/provider-models/descriptor-types.d.ts +2 -1
  17. package/dist/types/provider-models/openai-compat.d.ts +21 -0
  18. package/dist/types/provider-models/special.d.ts +2 -0
  19. package/dist/types/types.d.ts +100 -3
  20. package/dist/types/wire/cursor.d.ts +20 -0
  21. package/dist/types/wire/factory-droid.d.ts +45 -0
  22. package/package.json +4 -4
  23. package/src/build.ts +21 -0
  24. package/src/compat/auth-ids.ts +4 -0
  25. package/src/compat/axes.ts +113 -2
  26. package/src/compat/cascade.ts +8 -1
  27. package/src/compat/collapse.ts +3 -0
  28. package/src/compat/factory-droid.ts +170 -0
  29. package/src/compat/provider-ids.ts +2 -0
  30. package/src/compat/resolve.ts +47 -5
  31. package/src/compat/rules/README.md +18 -8
  32. package/src/compat/rules/auth/_order.kdl +2 -2
  33. package/src/compat/rules/auth/factory-droid.kdl +28 -0
  34. package/src/compat/rules/auth/helmcode.kdl +9 -0
  35. package/src/compat/rules/classes/anthropic.kdl +195 -80
  36. package/src/compat/rules/providers/commandcode.kdl +21 -5
  37. package/src/compat/rules/providers/cursor.kdl +29 -17
  38. package/src/compat/rules/providers/factory-droid.kdl +1166 -0
  39. package/src/compat/rules/providers/helmcode.kdl +120 -0
  40. package/src/compat/rules/runtime/behavior.kdl +65 -4
  41. package/src/compat/rules/taxonomy/_collapse.kdl +36 -14
  42. package/src/compat/rules.json +1 -1
  43. package/src/compat/types.ts +27 -1
  44. package/src/discovery/cursor-models.proto +261 -0
  45. package/src/discovery/cursor-proto.ts +471 -0
  46. package/src/discovery/cursor.ts +817 -88
  47. package/src/discovery/devin.ts +1 -3
  48. package/src/discovery/factory-droid.ts +296 -0
  49. package/src/discovery/index.ts +1 -0
  50. package/src/discovery/protobuf.ts +16 -7
  51. package/src/model-manager.ts +13 -0
  52. package/src/models.json +1 -1
  53. package/src/models.ts +13 -0
  54. package/src/provider-models/cache-provider-id.ts +37 -6
  55. package/src/provider-models/descriptor-types.ts +2 -1
  56. package/src/provider-models/descriptors.ts +4 -0
  57. package/src/provider-models/openai-compat.ts +83 -17
  58. package/src/provider-models/special.ts +26 -2
  59. package/src/types.ts +112 -1
  60. package/src/wire/cursor.ts +32 -0
  61. package/src/wire/factory-droid.ts +130 -0
@@ -329,9 +329,7 @@ export async function fetchDevinModels(
329
329
  const fetchCatalog = async (metadata: Metadata): Promise<ModelSpec<"devin-agent">[] | null> => {
330
330
  try {
331
331
  const request = create(GetCliModelConfigsRequestSchema, { metadata });
332
- // `toBinary` always allocates a fresh ArrayBuffer-backed view; the DOM
333
- // `BodyInit` typing just cannot see that through its ArrayBufferLike signature.
334
- const body = toBinary(GetCliModelConfigsRequestSchema, request) as Uint8Array<ArrayBuffer>;
332
+ const body = toBinary(GetCliModelConfigsRequestSchema, request);
335
333
  const response = await fetchImpl(requestUrl, {
336
334
  method: "POST",
337
335
  headers: {
@@ -0,0 +1,296 @@
1
+ import { isRecord } from "@oh-my-pi/pi-utils";
2
+ import {
3
+ type FactoryDroidRegistryModel,
4
+ factoryDroidRegionalLimits,
5
+ factoryDroidRegistry,
6
+ resolveFactoryDroidRotation,
7
+ } from "../compat/factory-droid";
8
+ import { hasModelScopedEffortLadder, resolveModelPolicy } from "../compat/resolve";
9
+ import type { RequestPolicy } from "../compat/types";
10
+ import { getBundledModel, isGeneratedProvider } from "../models";
11
+ import type { FetchImpl, ModelSpec, ThinkingConfig, ThinkingControlMode } from "../types";
12
+ import {
13
+ type AccountScope,
14
+ type FactoryDroidWire,
15
+ factoryDroidApiBaseUrl,
16
+ factoryDroidClientHeaders,
17
+ factoryDroidWireBaseUrl,
18
+ resolveFactoryDroidInferenceRegion,
19
+ } from "../wire/factory-droid";
20
+
21
+ /**
22
+ * Factory Droid (Droid Core + Standard Credits subscription) — direct HTTP
23
+ * integration.
24
+ *
25
+ * The model registry is KDL (`rules/providers/factory-droid.kdl`, read through
26
+ * `compat/factory-droid.ts`): Factory has no model-listing endpoint, so
27
+ * first-party clients ship the roster and narrow it live with Statsig feature
28
+ * flags and the org model policy. This module holds the discovery logic:
29
+ * policy parsing, availability filtering, routing, and building model specs
30
+ * from the registry.
31
+ */
32
+
33
+ /** Org policy subset from `/api/organization/managed-settings` that gates models. */
34
+ interface FactoryModelPolicy {
35
+ allowAllFactoryModels?: boolean;
36
+ allowedModelIds?: string[];
37
+ blockedModelIds?: string[];
38
+ /** Models requiring explicit consent are denied when listed here. */
39
+ requireExplicitOptInModelIds?: string[];
40
+ /**
41
+ * Org switch for the paid fast tiers. Absent means allow: the CLI's
42
+ * default policy kind is allow-all, and self-hosted/legacy servers omit
43
+ * the field entirely, so only an explicit `false` withdraws them.
44
+ */
45
+ isFastModelsAllowed?: boolean;
46
+ }
47
+
48
+ function canonicalPolicyId(id: string): string {
49
+ return (
50
+ factoryDroidRegistry().find(({ spec, policy }) => spec.id === id || policy.policyAliases.includes(id))?.spec.id ??
51
+ id
52
+ );
53
+ }
54
+
55
+ function readModelPolicy(body: unknown): FactoryModelPolicy | null {
56
+ if (!isRecord(body) || !isRecord(body.settings)) return null;
57
+ const policy = body.settings.modelPolicy;
58
+ if (!isRecord(policy)) return null;
59
+ const ids = (key: "allowedModelIds" | "blockedModelIds" | "requireExplicitOptInModelIds"): string[] | undefined => {
60
+ const value = policy[key];
61
+ return Array.isArray(value)
62
+ ? [...new Set(value.filter((v): v is string => typeof v === "string").map(canonicalPolicyId))]
63
+ : undefined;
64
+ };
65
+ return {
66
+ allowAllFactoryModels:
67
+ typeof policy.allowAllFactoryModels === "boolean" ? policy.allowAllFactoryModels : undefined,
68
+ allowedModelIds: ids("allowedModelIds"),
69
+ blockedModelIds: ids("blockedModelIds"),
70
+ requireExplicitOptInModelIds: ids("requireExplicitOptInModelIds"),
71
+ isFastModelsAllowed: typeof policy.isFastModelsAllowed === "boolean" ? policy.isFastModelsAllowed : undefined,
72
+ };
73
+ }
74
+
75
+ /**
76
+ * Live `provider_routing` dynamic config from the flags payload: per-model
77
+ * upstream rotations that override the registry's static order.
78
+ */
79
+ interface FactoryProviderRouting {
80
+ models?: Record<string, readonly string[]>;
81
+ defaults?: Record<string, readonly string[]>;
82
+ blockedProviders?: Record<string, readonly string[]>;
83
+ }
84
+
85
+ /** Reads `configs.provider_routing` from the feature-flags payload. */
86
+ function readProviderRouting(body: Record<string, unknown>): FactoryProviderRouting | null {
87
+ if (!isRecord(body.configs) || !isRecord(body.configs.provider_routing)) return null;
88
+ const routing = body.configs.provider_routing;
89
+ const parse = (value: unknown): Record<string, readonly string[]> => {
90
+ if (!isRecord(value)) return {};
91
+ return Object.fromEntries(
92
+ Object.entries(value).filter(
93
+ (entry): entry is [string, string[]] =>
94
+ Array.isArray(entry[1]) && entry[1].every(provider => typeof provider === "string"),
95
+ ),
96
+ );
97
+ };
98
+ return {
99
+ models: parse(routing.models),
100
+ defaults: parse(routing.defaults),
101
+ blockedProviders: parse(routing.blockedProviders),
102
+ };
103
+ }
104
+
105
+ /** Mirrors the client-side model gating: feature flags first, then org model policy. */
106
+ function isModelAvailable(
107
+ { spec, policy: registry }: FactoryDroidRegistryModel,
108
+ flags: Record<string, boolean>,
109
+ policy: FactoryModelPolicy | null,
110
+ region: string | undefined,
111
+ ): boolean {
112
+ const gates = registry.entitlement;
113
+ if (resolveFactoryDroidRotation(registry, region).length === 0) return false;
114
+ if (gates.featureFlag !== undefined && flags[gates.featureFlag] !== true) return false;
115
+ if (gates.deprecationFlag !== undefined && flags[gates.deprecationFlag] === true) return false;
116
+ // Fast tiers are withdrawn as a class, not by id: `base-variant` is what
117
+ // marks an entry as one, and only an explicit `false` hides it.
118
+ if (gates.baseVariant !== undefined && policy?.isFastModelsAllowed === false) return false;
119
+ if (policy?.requireExplicitOptInModelIds?.includes(spec.id) || (!policy && gates.requiresExplicitOptIn))
120
+ return false;
121
+ const allowlist = policy?.allowAllFactoryModels === false || Boolean(policy?.allowedModelIds?.length);
122
+ if (policy?.blockedModelIds?.includes(spec.id)) return false;
123
+ if (allowlist && !policy?.allowedModelIds?.includes(spec.id)) return false;
124
+ return true;
125
+ }
126
+
127
+ export interface FactoryDroidModelDiscoveryOptions extends AccountScope {
128
+ /** OMP-stored WorkOS access token (from `/login factory-droid`), when present. */
129
+ apiKey?: string;
130
+ fetch?: FetchImpl;
131
+ }
132
+
133
+ /**
134
+ * Offline seed: the registry narrowed by the same availability rule live
135
+ * discovery applies, with no flags or org policy known yet. Feature-gated and
136
+ * explicit-opt-in models stay hidden until an online refresh proves access.
137
+ */
138
+ export function factoryDroidSeedModels(scope: AccountScope): ModelSpec<"factory-droid-agent">[] {
139
+ const inferenceRegion = resolveFactoryDroidInferenceRegion(scope);
140
+ return factoryDroidRegistry()
141
+ .filter(model => isModelAvailable(model, {}, null, inferenceRegion))
142
+ .map(model =>
143
+ buildFactoryDroidModel(model, {
144
+ region: scope.region,
145
+ inferenceRegion,
146
+ orgId: scope.orgId,
147
+ apiProviders: resolveFactoryDroidRotation(model.policy, inferenceRegion),
148
+ }),
149
+ );
150
+ }
151
+
152
+ /**
153
+ * Availability filter, not a catalog: Factory has no model-listing endpoint,
154
+ * so the KDL registry is narrowed live with `GET /api/feature-flags`
155
+ * (Statsig gates) and the org model policy in
156
+ * `GET /api/organization/managed-settings`. Returns null when no credential
157
+ * resolves or the flags fetch fails — callers keep an offline snapshot, not
158
+ * evidence of current entitlement. Missing policy denies explicit-opt-in models.
159
+ */
160
+ export async function fetchFactoryDroidModels(
161
+ options: FactoryDroidModelDiscoveryOptions = {},
162
+ ): Promise<ModelSpec<"factory-droid-agent">[] | null> {
163
+ const token = options.apiKey?.trim();
164
+ if (!token) return null;
165
+ const fetchImpl = options.fetch ?? fetch;
166
+ const headers = { Authorization: `Bearer ${token}`, ...factoryDroidClientHeaders(options.orgId) };
167
+ const apiBaseUrl = factoryDroidApiBaseUrl(options.region);
168
+ let flags: Record<string, boolean>;
169
+ let policy: FactoryModelPolicy | null = null;
170
+ let routing: FactoryProviderRouting | null = null;
171
+ const servingRegion = resolveFactoryDroidInferenceRegion(options);
172
+ try {
173
+ const [flagsResponse, settingsResponse] = await Promise.all([
174
+ fetchImpl(`${apiBaseUrl}/api/feature-flags`, { headers }),
175
+ fetchImpl(`${apiBaseUrl}/api/organization/managed-settings`, { headers }).catch(() => null),
176
+ ]);
177
+ if (!flagsResponse.ok) return null;
178
+ const body: unknown = await flagsResponse.json();
179
+ if (body == null || typeof body !== "object" || !("flags" in body)) return null;
180
+ const raw = body.flags;
181
+ if (raw == null || typeof raw !== "object" || Array.isArray(raw)) return null;
182
+ flags = Object.fromEntries(Object.entries(raw).map(([key, value]) => [key, value === true]));
183
+ if (settingsResponse?.ok) {
184
+ policy = readModelPolicy(await settingsResponse.json());
185
+ }
186
+ routing = readProviderRouting(body as Record<string, unknown>);
187
+ } catch {
188
+ return null;
189
+ }
190
+ return factoryDroidRegistry().flatMap(model => {
191
+ if (!isModelAvailable(model, flags, policy, servingRegion)) return [];
192
+ const { id } = model.spec;
193
+ const family = model.policy.routingFamily;
194
+ const routed = routing?.models?.[id] ?? (family === undefined ? undefined : routing?.defaults?.[family]);
195
+ const rotation = resolveRotation(model, routed, servingRegion, routing?.blockedProviders?.[id]);
196
+ if (rotation.length === 0) return [];
197
+ const spec = buildFactoryDroidModel(model, {
198
+ region: options.region,
199
+ inferenceRegion: servingRegion,
200
+ orgId: options.orgId,
201
+ apiProviders: rotation,
202
+ });
203
+ // Native reports configured ordering only when live routing chose the rotation.
204
+ if (routed !== undefined) spec.factoryDroidRoutingSource = "configured_order";
205
+ return [spec];
206
+ });
207
+ }
208
+
209
+ /**
210
+ * Intersect live rotations with registry eligibility and explicit blocks.
211
+ * An explicitly configured empty/disallowed rotation never widens to defaults.
212
+ */
213
+ function resolveRotation(
214
+ model: FactoryDroidRegistryModel,
215
+ routed: readonly string[] | undefined,
216
+ region: string | undefined,
217
+ blocked: readonly string[] = [],
218
+ ): readonly string[] {
219
+ const eligible = resolveFactoryDroidRotation(model.policy, region).filter(provider => !blocked.includes(provider));
220
+ return routed === undefined
221
+ ? eligible
222
+ : routed.filter(provider => eligible.some(candidate => candidate === provider));
223
+ }
224
+
225
+ /** Account scope plus the upstream rotation resolved for that account. */
226
+ export interface FactoryDroidModelBuildOptions extends AccountScope {
227
+ apiProviders?: readonly string[];
228
+ }
229
+
230
+ export function buildFactoryDroidModel(
231
+ { spec, policy }: FactoryDroidRegistryModel,
232
+ options: FactoryDroidModelBuildOptions = {},
233
+ ): ModelSpec<"factory-droid-agent"> {
234
+ // Runtime-unsafe lookup by design: a models.json regen can drop a referenced
235
+ // id, and a missing reference must keep the seed's zero cost, not break discovery.
236
+ const priceRef = policy.listPriceFrom;
237
+ const reference =
238
+ priceRef && isGeneratedProvider(priceRef.provider)
239
+ ? getBundledModel(priceRef.provider, priceRef.modelId)
240
+ : undefined;
241
+ const model: ModelSpec<"factory-droid-agent"> = {
242
+ id: spec.id,
243
+ name: spec.name,
244
+ api: "factory-droid-agent",
245
+ provider: "factory-droid",
246
+ baseUrl: factoryDroidWireBaseUrl(policy.wire, options.region),
247
+ reasoning: true,
248
+ input: [...spec.input],
249
+ cost: { ...(reference?.cost ?? spec.cost) },
250
+ ...factoryDroidRegionalLimits(policy, resolveFactoryDroidInferenceRegion(options)),
251
+ ...(options.orgId ? { factoryDroidOrgId: options.orgId } : {}),
252
+ ...(policy.creditRates ? { factoryDroidCredits: policy.creditRates.input } : {}),
253
+ ...(options.apiProviders?.length ? { factoryDroidApiProviders: [...options.apiProviders] } : {}),
254
+ };
255
+ const resolved = resolveModelPolicy(model);
256
+ // Only a reviewed per-model ladder counts: the generic fallback ladder is
257
+ // not a native effort surface.
258
+ model.thinking =
259
+ resolved.thinking && hasModelScopedEffortLadder(model)
260
+ ? buildFactoryDroidThinking(resolved.thinking, policy.wire, resolved.request.anthropicThinking)
261
+ : undefined;
262
+ model.reasoning = model.thinking !== undefined;
263
+ return model;
264
+ }
265
+
266
+ /**
267
+ * The thinking control mode rides the wire family, not the model: Anthropic
268
+ * variants use per-model adaptive vs budget thinking, Gemini uses
269
+ * thinkingLevel, and the completions/responses families take the generic
270
+ * effort field. The ladder, default and off-rung come from the KDL registry.
271
+ */
272
+ function buildFactoryDroidThinking(
273
+ ladder: ThinkingConfig,
274
+ wire: FactoryDroidWire,
275
+ thinkingStyle: RequestPolicy["anthropicThinking"],
276
+ ): ThinkingConfig {
277
+ const mode: ThinkingControlMode =
278
+ wire === "google-generate"
279
+ ? "google-level"
280
+ : wire === "anthropic-messages"
281
+ ? thinkingStyle === "budget-interleaved"
282
+ ? "budget"
283
+ : thinkingStyle === "budget-effort"
284
+ ? "anthropic-budget-effort"
285
+ : "anthropic-adaptive"
286
+ : "effort";
287
+ return {
288
+ mode,
289
+ efforts: ladder.efforts,
290
+ // Only summarized adaptive thinking carries `display` natively; every other
291
+ // Messages style must not send it.
292
+ ...(wire === "anthropic-messages" ? { supportsDisplay: thinkingStyle === "adaptive-summarized" } : {}),
293
+ requiresEffort: ladder.requiresEffort === true,
294
+ ...(ladder.defaultLevel ? { defaultLevel: ladder.defaultLevel } : undefined),
295
+ };
296
+ }
@@ -1,5 +1,6 @@
1
1
  export * from "./antigravity";
2
2
  export * from "./codex";
3
+ export * from "./factory-droid";
3
4
  export * from "./gemini";
4
5
  export * from "./gemini-cli";
5
6
  export * from "./gitlab-duo-workflow";
@@ -28,12 +28,12 @@ export interface ProtoMessage {
28
28
 
29
29
  /** A bidirectional codec for one protobuf message type. */
30
30
  export interface MessageCodec<T extends ProtoMessage = ProtoMessage> {
31
- (value: T): Uint8Array;
31
+ (value: T): Uint8Array<ArrayBuffer>;
32
32
  (value: Uint8Array): T;
33
33
  /** Creates a message with protobuf defaults for omitted fields. */
34
34
  create(value?: Partial<T>): T;
35
35
  /** Encodes one message into protobuf wire bytes. */
36
- encode(value: T): Uint8Array;
36
+ encode(value: T): Uint8Array<ArrayBuffer>;
37
37
  /** Decodes one protobuf message from wire bytes. */
38
38
  decode(value: Uint8Array): T;
39
39
  /** Converts a message to its protobuf JSON representation. */
@@ -144,7 +144,7 @@ export function pb<T extends ProtoMessage = ProtoMessage>(
144
144
  }) as MessageCodec<T>;
145
145
 
146
146
  codec.create = (value?: Partial<T>): T => getCodec().create(value);
147
- codec.encode = (value: T): Uint8Array => getCodec().encode(value);
147
+ codec.encode = (value: T): Uint8Array<ArrayBuffer> => getCodec().encode(value);
148
148
  codec.decode = (value: Uint8Array): T => getCodec().decode(value);
149
149
  codec.toJson = (value: T): JsonValue => getCodec().toJson(value);
150
150
 
@@ -160,7 +160,10 @@ export function create<TMessage extends ProtoMessage>(
160
160
  }
161
161
 
162
162
  /** Encodes a message using its codec. */
163
- export function toBinary<TMessage extends ProtoMessage>(codec: MessageCodec<TMessage>, value: TMessage): Uint8Array {
163
+ export function toBinary<TMessage extends ProtoMessage>(
164
+ codec: MessageCodec<TMessage>,
165
+ value: TMessage,
166
+ ): Uint8Array<ArrayBuffer> {
164
167
  return codec.encode(value);
165
168
  }
166
169
 
@@ -238,7 +241,7 @@ function compileCodec<T extends ProtoMessage>(typeName: string, fieldDescs: read
238
241
  return message;
239
242
  };
240
243
 
241
- codec.encode = (value: T): Uint8Array => {
244
+ codec.encode = (value: T): Uint8Array<ArrayBuffer> => {
242
245
  const writer = new Writer();
243
246
  for (const f of compiledFields) {
244
247
  f.encode(value, writer);
@@ -736,6 +739,10 @@ function assertWireType(actual: WireType, expected: WireType): void {
736
739
  if (actual !== expected) throw new Error(`Unexpected protobuf wire type ${actual}; expected ${expected}`);
737
740
  }
738
741
 
742
+ function isArrayBufferBacked(bytes: Uint8Array | undefined): bytes is Uint8Array<ArrayBuffer> {
743
+ return bytes?.buffer instanceof ArrayBuffer;
744
+ }
745
+
739
746
  class Writer {
740
747
  #chunks: Uint8Array[] = [];
741
748
  #length = 0;
@@ -814,8 +821,10 @@ class Writer {
814
821
  this.#length += chunk.byteLength;
815
822
  }
816
823
 
817
- finish(): Uint8Array {
818
- if (this.#chunks.length === 1) return this.#chunks[0];
824
+ /** Wire bytes on a plain `ArrayBuffer`, so they satisfy `fetch`'s `BodyInit` as-is. */
825
+ finish(): Uint8Array<ArrayBuffer> {
826
+ const [only] = this.#chunks;
827
+ if (this.#chunks.length === 1 && isArrayBufferBacked(only)) return only;
819
828
  const result = new Uint8Array(this.#length);
820
829
  let offset = 0;
821
830
  for (const chunk of this.#chunks) {
@@ -57,6 +57,16 @@ export interface ModelManagerOptions<TApi extends Api = Api, TModelsDevPayload =
57
57
  cacheTtlMs?: number;
58
58
  /** When true, a successful dynamic fetch is the complete provider catalog and prunes static-only models. */
59
59
  dynamicModelsAuthoritative?: boolean;
60
+ /**
61
+ * When true, a fresh cache never satisfies an online-eligible refresh: the
62
+ * dynamic fetch always runs (an explicit `"offline"` strategy is still
63
+ * honored), and the cache serves only as the fetch-failure fallback. For
64
+ * providers whose dynamic result encodes fast-changing live state that a
65
+ * TTL cache would replay wrongly — e.g. Factory discovery includes live
66
+ * organization model policy and upstream blocks. Cached eligibility is
67
+ * an offline snapshot, not current entitlement.
68
+ */
69
+ alwaysRefetchDynamicModels?: boolean;
60
70
  /** Cached model ids whose presence forces refresh when the static or migration-policy fingerprint changes. */
61
71
  dropCachedModelIdsOnStaticMismatch?: readonly string[];
62
72
  /**
@@ -217,6 +227,9 @@ export async function resolveProviderModels<TApi extends Api = Api, TModelsDevPa
217
227
  options: ModelManagerOptions<TApi, TModelsDevPayload>,
218
228
  strategy: ModelRefreshStrategy = "online-if-uncached",
219
229
  ): Promise<ModelResolutionResult<TApi>> {
230
+ if (options.alwaysRefetchDynamicModels && strategy === "online-if-uncached") {
231
+ strategy = "online";
232
+ }
220
233
  const cacheProviderId = options.cacheProviderId ?? options.providerId;
221
234
  const now = options.now ?? Date.now;
222
235
  const ttlMs = options.cacheTtlMs ?? DEFAULT_CACHE_TTL_MS;