tuxevil-rotator 3.4.0 → 3.6.0

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.
@@ -0,0 +1,602 @@
1
+ // Dynamic Google Antigravity model availability discovered during quota polling.
2
+
3
+ import {
4
+ getStaticModelSpec,
5
+ type ModelSpec,
6
+ } from "../../compat/model-specs.js";
7
+ import {
8
+ QUOTA_MODEL_KEYS,
9
+ type GoogleQuotaResponse,
10
+ type PersistedDynamicModelOwnership,
11
+ } from "../../types.js";
12
+
13
+ export interface DynamicModelEntry {
14
+ id: string;
15
+ family: string;
16
+ ctx: number;
17
+ quotaPool: string;
18
+ multimodal: boolean;
19
+ tools: boolean;
20
+ maxOutputTokens: number;
21
+ thinkingBudget: number;
22
+ minThinkingBudget?: number;
23
+ isThinking: boolean;
24
+ isTiered: boolean;
25
+ displayName?: string;
26
+ }
27
+
28
+ const DEFAULT_ACCOUNT_KEY = "__default__";
29
+ const RESERVED_QUOTA_MODEL_IDS = new Set(
30
+ Object.values(QUOTA_MODEL_KEYS).map(({ key }) => key.toLowerCase()),
31
+ );
32
+
33
+ type GoogleModelInfo = GoogleQuotaResponse["models"][string];
34
+ type ActiveAccount = string | { id: string; generation: string };
35
+ type PersistedOwnershipAccount = {
36
+ id: string;
37
+ credentialGenerationFingerprint: string;
38
+ };
39
+ interface ActiveAccountGeneration {
40
+ credentialGeneration: string | null;
41
+ epoch: number;
42
+ }
43
+
44
+ function isRecord(value: unknown): value is Record<string, unknown> {
45
+ return typeof value === "object" && value !== null && !Array.isArray(value);
46
+ }
47
+
48
+ function isSafeModelId(value: string): boolean {
49
+ const lower = value.toLowerCase();
50
+ return value.length <= 256 &&
51
+ /^[a-z0-9][a-z0-9._:/-]*$/i.test(value) &&
52
+ lower !== "__proto__" &&
53
+ lower !== "prototype" &&
54
+ lower !== "constructor";
55
+ }
56
+
57
+ function isDiscoverableModelId(value: string): boolean {
58
+ const id = value.trim();
59
+ const lower = id.toLowerCase();
60
+ return isSafeModelId(id) &&
61
+ !RESERVED_QUOTA_MODEL_IDS.has(lower) &&
62
+ !lower.startsWith("chat_") &&
63
+ !lower.startsWith("tab_") &&
64
+ !lower.startsWith("gemini-3.5-");
65
+ }
66
+
67
+ /** Validate and sanitize the untrusted runtime catalog response. */
68
+ export function parseGoogleQuotaResponse(
69
+ value: unknown,
70
+ ): GoogleQuotaResponse | null {
71
+ if (!isRecord(value) || !isRecord(value.models)) return null;
72
+
73
+ const models = Object.create(null) as GoogleQuotaResponse["models"];
74
+ let rawEntryCount = 0;
75
+ let validEntryCount = 0;
76
+ for (const [rawId, rawInfo] of Object.entries(value.models)) {
77
+ rawEntryCount++;
78
+ const id = rawId.trim();
79
+ if (!isSafeModelId(id) || !isRecord(rawInfo)) continue;
80
+ validEntryCount++;
81
+
82
+ const info: GoogleModelInfo = {};
83
+ if (typeof rawInfo.displayName === "string" && rawInfo.displayName.trim()) {
84
+ info.displayName = rawInfo.displayName.trim();
85
+ }
86
+ for (const field of ["maxTokens", "maxOutputTokens"] as const) {
87
+ const candidate = rawInfo[field];
88
+ if (typeof candidate === "number" && Number.isFinite(candidate) && candidate > 0) {
89
+ info[field] = candidate;
90
+ }
91
+ }
92
+ if (
93
+ typeof rawInfo.thinkingBudget === "number" &&
94
+ Number.isFinite(rawInfo.thinkingBudget) &&
95
+ (rawInfo.thinkingBudget === -1 || rawInfo.thinkingBudget >= 0)
96
+ ) {
97
+ info.thinkingBudget = rawInfo.thinkingBudget;
98
+ }
99
+ if (
100
+ typeof rawInfo.minThinkingBudget === "number" &&
101
+ Number.isFinite(rawInfo.minThinkingBudget) &&
102
+ rawInfo.minThinkingBudget >= 0
103
+ ) {
104
+ info.minThinkingBudget = rawInfo.minThinkingBudget;
105
+ }
106
+ for (
107
+ const field of [
108
+ "supportsThinking",
109
+ "supportsImages",
110
+ "supportsVideo",
111
+ ] as const
112
+ ) {
113
+ if (typeof rawInfo[field] === "boolean") info[field] = rawInfo[field];
114
+ }
115
+ if (isRecord(rawInfo.quotaInfo)) {
116
+ const quotaInfo: NonNullable<GoogleModelInfo["quotaInfo"]> = {};
117
+ const remaining = rawInfo.quotaInfo.remainingFraction;
118
+ if (
119
+ typeof remaining === "number" &&
120
+ Number.isFinite(remaining) &&
121
+ remaining >= 0 &&
122
+ remaining <= 1
123
+ ) {
124
+ quotaInfo.remainingFraction = remaining;
125
+ }
126
+ const resetTime = rawInfo.quotaInfo.resetTime;
127
+ if (typeof resetTime === "string" && resetTime.trim()) {
128
+ quotaInfo.resetTime = resetTime;
129
+ }
130
+ if (Object.keys(quotaInfo).length > 0) info.quotaInfo = quotaInfo;
131
+ }
132
+ models[id] = info;
133
+ }
134
+
135
+ // An explicitly empty catalog is a valid snapshot. A non-empty catalog
136
+ // containing no usable entries is ambiguous, so retain the last good one.
137
+ if (rawEntryCount > 0 && validEntryCount === 0) return null;
138
+
139
+ const parsed: GoogleQuotaResponse = { models };
140
+ if (
141
+ typeof value.defaultAgentModelId === "string" &&
142
+ isSafeModelId(value.defaultAgentModelId.trim())
143
+ ) {
144
+ parsed.defaultAgentModelId = value.defaultAgentModelId.trim();
145
+ }
146
+ if (isRecord(value.tieredModelIds)) {
147
+ const tieredModelIds = Object.create(null) as Record<string, string[]>;
148
+ for (const [tier, rawIds] of Object.entries(value.tieredModelIds)) {
149
+ if (!Array.isArray(rawIds)) continue;
150
+ const ids = rawIds
151
+ .filter((id): id is string => typeof id === "string")
152
+ .map((id) => id.trim())
153
+ .filter(isSafeModelId);
154
+ if (ids.length > 0) tieredModelIds[tier] = ids;
155
+ }
156
+ if (Object.keys(tieredModelIds).length > 0) {
157
+ parsed.tieredModelIds = tieredModelIds;
158
+ }
159
+ }
160
+ return parsed;
161
+ }
162
+
163
+ function accountKey(value: string): string {
164
+ return value.trim();
165
+ }
166
+
167
+ function familyDefaults(
168
+ family: string,
169
+ ): Pick<
170
+ DynamicModelEntry,
171
+ "ctx" | "multimodal" | "tools" | "maxOutputTokens" | "thinkingBudget" | "isThinking"
172
+ > {
173
+ if (family === "gpt-oss") {
174
+ return {
175
+ ctx: 131_072,
176
+ multimodal: false,
177
+ tools: true,
178
+ maxOutputTokens: 32_768,
179
+ thinkingBudget: 8_192,
180
+ isThinking: true,
181
+ };
182
+ }
183
+ if (family.includes("claude")) {
184
+ return {
185
+ ctx: 1_000_000,
186
+ multimodal: true,
187
+ tools: true,
188
+ maxOutputTokens: 64_000,
189
+ thinkingBudget: 32_768,
190
+ isThinking: true,
191
+ };
192
+ }
193
+ if (family.includes("gemini")) {
194
+ return {
195
+ ctx: 1_000_000,
196
+ multimodal: true,
197
+ tools: true,
198
+ maxOutputTokens: 65_536,
199
+ thinkingBudget: 24_576,
200
+ isThinking: true,
201
+ };
202
+ }
203
+ return {
204
+ ctx: 128_000,
205
+ multimodal: false,
206
+ tools: true,
207
+ maxOutputTokens: 65_536,
208
+ thinkingBudget: 24_576,
209
+ isThinking: false,
210
+ };
211
+ }
212
+
213
+ export class DynamicModelRegistry {
214
+ private static instance: DynamicModelRegistry | null = null;
215
+ private accountModels = new Map<string, Map<string, DynamicModelEntry>>();
216
+ private defaultAgentModelIds = new Map<string, string>();
217
+ private discoveredModels = new Map<
218
+ string,
219
+ Pick<DynamicModelEntry, "id" | "quotaPool">
220
+ >();
221
+ private accountModelOwnership = new Map<string, Set<string>>();
222
+ private ownershipScopedModels = new Set<string>();
223
+ private activeAccountGenerations: Map<
224
+ string,
225
+ ActiveAccountGeneration
226
+ > | null = null;
227
+ private nextAccountEpoch = 0;
228
+
229
+ static getInstance(): DynamicModelRegistry {
230
+ DynamicModelRegistry.instance ??= new DynamicModelRegistry();
231
+ return DynamicModelRegistry.instance;
232
+ }
233
+
234
+ /** Reset dynamic account state (primarily for tests). */
235
+ reset(): void {
236
+ this.accountModels.clear();
237
+ this.defaultAgentModelIds.clear();
238
+ this.discoveredModels.clear();
239
+ this.accountModelOwnership.clear();
240
+ this.ownershipScopedModels.clear();
241
+ this.activeAccountGenerations = null;
242
+ this.nextAccountEpoch = 0;
243
+ }
244
+
245
+ /** Derive the model family and quota pool from a model ID string. */
246
+ static inferFamilyAndPool(modelId: string): { family: string; quotaPool: string } {
247
+ const lower = modelId.toLowerCase();
248
+ if (lower.includes("claude") || lower.includes("sonnet") || lower.includes("opus")) {
249
+ const match = lower.match(/(claude-[a-z0-9.-]+)/);
250
+ return { family: match?.[1] ?? "claude", quotaPool: "claude" };
251
+ }
252
+ if (lower.includes("gpt-oss")) {
253
+ return { family: "gpt-oss", quotaPool: "claude" };
254
+ }
255
+ if (lower.includes("gemini")) {
256
+ const match = lower.match(/(gemini-[0-9.]+-?[a-z]*)/);
257
+ return { family: match?.[1] ?? "gemini", quotaPool: "gemini" };
258
+ }
259
+ return { family: lower, quotaPool: "gemini" };
260
+ }
261
+
262
+ /** Replace one account's advertised models with its latest successful response. */
263
+ updateFromEndpointResponse(
264
+ value: unknown,
265
+ accountId = DEFAULT_ACCOUNT_KEY,
266
+ credentialGeneration?: string,
267
+ accountEpoch?: number,
268
+ ): number {
269
+ const data = parseGoogleQuotaResponse(value);
270
+ if (!data) return 0;
271
+
272
+ const key = accountKey(accountId);
273
+ if (
274
+ !this.isAccountGenerationActive(
275
+ key,
276
+ credentialGeneration,
277
+ accountEpoch,
278
+ )
279
+ ) return 0;
280
+ const previous = this.accountModels.get(key);
281
+ const knownBefore = new Set(this.getAllModels().map((model) => model.id.toLowerCase()));
282
+ const next = new Map<string, DynamicModelEntry>();
283
+ const tieredIds = new Set(
284
+ Object.values(data.tieredModelIds ?? {}).flat().map((id) => id.trim().toLowerCase()),
285
+ );
286
+ let newModelsCount = 0;
287
+
288
+ if (data.defaultAgentModelId) {
289
+ this.defaultAgentModelIds.delete(key);
290
+ this.defaultAgentModelIds.set(key, data.defaultAgentModelId);
291
+ } else {
292
+ this.defaultAgentModelIds.delete(key);
293
+ }
294
+
295
+ for (const [rawId, info] of Object.entries(data.models)) {
296
+ const normalizedId = rawId.trim();
297
+ const lowerId = normalizedId.toLowerCase();
298
+ if (!isDiscoverableModelId(normalizedId)) continue;
299
+
300
+ const { family, quotaPool } = DynamicModelRegistry.inferFamilyAndPool(normalizedId);
301
+ const familySpec = familyDefaults(family);
302
+ const staticSpec = getStaticModelSpec(normalizedId);
303
+ const defaults = previous?.get(lowerId) ?? {
304
+ ...familySpec,
305
+ ...(staticSpec
306
+ ? {
307
+ ctx: staticSpec.contextWindow ?? familySpec.ctx,
308
+ maxOutputTokens: staticSpec.maxOutputTokens,
309
+ thinkingBudget: staticSpec.thinkingBudget,
310
+ minThinkingBudget: staticSpec.minThinkingBudget,
311
+ isThinking: staticSpec.isThinking,
312
+ }
313
+ : {}),
314
+ };
315
+ const isTiered = lowerId.includes("-tiered") || tieredIds.has(lowerId);
316
+ const hasThinkingBudget = typeof info.thinkingBudget === "number";
317
+ const thinkingBudget = hasThinkingBudget
318
+ ? info.thinkingBudget!
319
+ : isTiered
320
+ ? -1
321
+ : defaults.thinkingBudget;
322
+ const isThinking = typeof info.supportsThinking === "boolean"
323
+ ? info.supportsThinking
324
+ : hasThinkingBudget
325
+ ? thinkingBudget !== 0
326
+ : defaults.isThinking;
327
+ const hasMultimodalMetadata =
328
+ typeof info.supportsImages === "boolean" || typeof info.supportsVideo === "boolean";
329
+
330
+ next.set(lowerId, {
331
+ id: normalizedId,
332
+ family,
333
+ ctx: typeof info.maxTokens === "number" && info.maxTokens > 0
334
+ ? info.maxTokens
335
+ : defaults.ctx,
336
+ quotaPool,
337
+ multimodal: hasMultimodalMetadata
338
+ ? Boolean(info.supportsImages || info.supportsVideo)
339
+ : defaults.multimodal,
340
+ tools: defaults.tools,
341
+ maxOutputTokens:
342
+ typeof info.maxOutputTokens === "number" && info.maxOutputTokens > 0
343
+ ? info.maxOutputTokens
344
+ : defaults.maxOutputTokens,
345
+ thinkingBudget,
346
+ minThinkingBudget:
347
+ typeof info.minThinkingBudget === "number"
348
+ ? info.minThinkingBudget
349
+ : defaults.minThinkingBudget,
350
+ isThinking,
351
+ isTiered,
352
+ displayName: info.displayName ?? previous?.get(lowerId)?.displayName ?? normalizedId,
353
+ });
354
+ this.discoveredModels.set(lowerId, { id: normalizedId, quotaPool });
355
+ this.ownershipScopedModels.add(lowerId);
356
+ if (!knownBefore.has(lowerId)) newModelsCount++;
357
+ }
358
+
359
+ this.accountModels.set(key, next);
360
+ this.accountModelOwnership.set(key, new Set(next.keys()));
361
+ return newModelsCount;
362
+ }
363
+
364
+ /** Expire catalogs belonging to accounts that are no longer active. */
365
+ retainAccounts(accounts: Iterable<ActiveAccount>): void {
366
+ const previous = this.activeAccountGenerations;
367
+ const active = new Map<string, ActiveAccountGeneration>();
368
+ for (const account of accounts) {
369
+ const key = accountKey(typeof account === "string" ? account : account.id);
370
+ const credentialGeneration = typeof account === "string"
371
+ ? null
372
+ : account.generation;
373
+ const prior = previous?.get(key);
374
+ active.set(
375
+ key,
376
+ prior?.credentialGeneration === credentialGeneration
377
+ ? prior
378
+ : { credentialGeneration, epoch: ++this.nextAccountEpoch },
379
+ );
380
+ }
381
+ for (const key of this.accountModels.keys()) {
382
+ const nextGeneration = active.get(key)?.credentialGeneration;
383
+ const previousGeneration = previous?.get(key)?.credentialGeneration;
384
+ if (
385
+ !active.has(key) ||
386
+ (previousGeneration !== undefined && previousGeneration !== nextGeneration)
387
+ ) {
388
+ this.accountModels.delete(key);
389
+ }
390
+ }
391
+ for (const key of this.accountModelOwnership.keys()) {
392
+ const nextGeneration = active.get(key)?.credentialGeneration;
393
+ const previousGeneration = previous?.get(key)?.credentialGeneration;
394
+ if (
395
+ !active.has(key) ||
396
+ (previousGeneration !== undefined && previousGeneration !== nextGeneration)
397
+ ) {
398
+ this.accountModelOwnership.delete(key);
399
+ }
400
+ }
401
+ for (const key of this.defaultAgentModelIds.keys()) {
402
+ if (!this.accountModels.has(key)) this.defaultAgentModelIds.delete(key);
403
+ }
404
+ this.activeAccountGenerations = active;
405
+ }
406
+
407
+ captureAccountEpoch(
408
+ accountId: string,
409
+ credentialGeneration: string,
410
+ ): number | null | undefined {
411
+ if (!this.activeAccountGenerations) return undefined;
412
+ const active = this.activeAccountGenerations.get(accountKey(accountId));
413
+ if (
414
+ !active ||
415
+ (active.credentialGeneration !== null &&
416
+ active.credentialGeneration !== credentialGeneration)
417
+ ) {
418
+ return null;
419
+ }
420
+ return active.epoch;
421
+ }
422
+
423
+ isAccountGenerationActive(
424
+ accountId: string,
425
+ credentialGeneration?: string,
426
+ accountEpoch?: number,
427
+ ): boolean {
428
+ if (!this.activeAccountGenerations) return true;
429
+ const key = accountKey(accountId);
430
+ const active = this.activeAccountGenerations.get(key);
431
+ if (!active) return false;
432
+ if (accountEpoch !== undefined && active.epoch !== accountEpoch) return false;
433
+ return credentialGeneration === undefined ||
434
+ active.credentialGeneration === null ||
435
+ active.credentialGeneration === credentialGeneration;
436
+ }
437
+
438
+ getAllModels(): DynamicModelEntry[] {
439
+ const models = new Map<string, DynamicModelEntry>();
440
+ for (const accountCatalog of this.accountModels.values()) {
441
+ for (const [id, model] of accountCatalog) models.set(id, model);
442
+ }
443
+ return Array.from(models.values());
444
+ }
445
+
446
+ getModel(id: string): DynamicModelEntry | undefined {
447
+ let match: DynamicModelEntry | undefined;
448
+ const lowerId = id.toLowerCase();
449
+ for (const accountCatalog of this.accountModels.values()) {
450
+ match = accountCatalog.get(lowerId) ?? match;
451
+ }
452
+ return match;
453
+ }
454
+
455
+ hasModelForAccount(accountId: string, id: string): boolean {
456
+ return this.accountModelOwnership
457
+ .get(accountKey(accountId))
458
+ ?.has(id.trim().toLowerCase()) ?? false;
459
+ }
460
+
461
+ hasOwnershipForModel(id: string): boolean {
462
+ return this.ownershipScopedModels.has(id.trim().toLowerCase());
463
+ }
464
+
465
+ wasDiscovered(id: string): boolean {
466
+ return this.discoveredModels.has(id.trim().toLowerCase());
467
+ }
468
+
469
+ getObservedModelId(id: string): string | undefined {
470
+ return this.getModel(id)?.id ??
471
+ this.discoveredModels.get(id.trim().toLowerCase())?.id;
472
+ }
473
+
474
+ getDiscoveredQuotaPools(): Record<string, string> {
475
+ const pools = Object.create(null) as Record<string, string>;
476
+ for (const { id, quotaPool } of this.discoveredModels.values()) {
477
+ pools[id] = quotaPool;
478
+ }
479
+ return pools;
480
+ }
481
+
482
+ getPersistedModelOwnership(
483
+ accounts: Iterable<PersistedOwnershipAccount>,
484
+ ): PersistedDynamicModelOwnership {
485
+ const persistedAccounts = Object.create(null) as PersistedDynamicModelOwnership["accounts"];
486
+ for (const account of accounts) {
487
+ const id = accountKey(account.id);
488
+ const models = this.accountModelOwnership.get(id);
489
+ if (!models) continue;
490
+ persistedAccounts[id] = {
491
+ credentialGenerationFingerprint:
492
+ account.credentialGenerationFingerprint,
493
+ models: Array.from(models).sort(),
494
+ };
495
+ }
496
+ return {
497
+ scopedModels: Array.from(this.ownershipScopedModels).sort(),
498
+ accounts: persistedAccounts,
499
+ };
500
+ }
501
+
502
+ restorePersistedModelOwnership(
503
+ value: unknown,
504
+ accounts: Iterable<PersistedOwnershipAccount>,
505
+ ): void {
506
+ if (
507
+ !isRecord(value) ||
508
+ !Array.isArray(value.scopedModels) ||
509
+ !isRecord(value.accounts)
510
+ ) return;
511
+
512
+ const expectedGenerations = new Map(
513
+ Array.from(accounts, (account) => [
514
+ accountKey(account.id),
515
+ account.credentialGenerationFingerprint,
516
+ ]),
517
+ );
518
+ const scopedModels = new Set<string>();
519
+ for (const rawModel of value.scopedModels) {
520
+ if (typeof rawModel !== "string") continue;
521
+ const model = rawModel.trim().toLowerCase();
522
+ if (
523
+ isDiscoverableModelId(model) &&
524
+ this.discoveredModels.has(model)
525
+ ) scopedModels.add(model);
526
+ }
527
+
528
+ const restoredAccounts = new Map<string, Set<string>>();
529
+ for (const [rawAccountId, rawSnapshot] of Object.entries(value.accounts)) {
530
+ const accountId = accountKey(rawAccountId);
531
+ const expectedGeneration = expectedGenerations.get(accountId);
532
+ if (
533
+ !expectedGeneration ||
534
+ !isRecord(rawSnapshot) ||
535
+ rawSnapshot.credentialGenerationFingerprint !== expectedGeneration ||
536
+ !Array.isArray(rawSnapshot.models)
537
+ ) continue;
538
+ const models = new Set<string>();
539
+ for (const rawModel of rawSnapshot.models) {
540
+ if (typeof rawModel !== "string") continue;
541
+ const model = rawModel.trim().toLowerCase();
542
+ if (scopedModels.has(model)) models.add(model);
543
+ }
544
+ restoredAccounts.set(accountId, models);
545
+ }
546
+
547
+ for (const model of scopedModels) this.ownershipScopedModels.add(model);
548
+ for (const [accountId, models] of restoredAccounts) {
549
+ this.accountModelOwnership.set(accountId, models);
550
+ }
551
+ }
552
+
553
+ restoreDiscoveredQuotaPools(value: unknown): void {
554
+ if (!isRecord(value)) return;
555
+ for (const [rawId, rawPool] of Object.entries(value)) {
556
+ const id = rawId.trim();
557
+ const quotaPool = typeof rawPool === "string"
558
+ ? rawPool.trim().toLowerCase()
559
+ : "";
560
+ if (
561
+ !isDiscoverableModelId(id) ||
562
+ (quotaPool !== "gemini" && quotaPool !== "claude")
563
+ ) continue;
564
+ this.discoveredModels.set(id.toLowerCase(), { id, quotaPool });
565
+ }
566
+ }
567
+
568
+ getModelSpec(id: string): ModelSpec | undefined {
569
+ const entry = this.getModel(id);
570
+ if (!entry) return undefined;
571
+ return {
572
+ maxOutputTokens: entry.maxOutputTokens,
573
+ thinkingBudget: entry.thinkingBudget,
574
+ ...(entry.minThinkingBudget !== undefined
575
+ ? { minThinkingBudget: entry.minThinkingBudget }
576
+ : {}),
577
+ isThinking: entry.isThinking,
578
+ contextWindow: entry.ctx,
579
+ };
580
+ }
581
+
582
+ getContextWindow(id: string): number | undefined {
583
+ return this.getModel(id)?.ctx;
584
+ }
585
+
586
+ isTiered(id: string): boolean {
587
+ const lowerId = id.toLowerCase();
588
+ return lowerId.includes("-tiered") || (this.getModel(lowerId)?.isTiered ?? false);
589
+ }
590
+
591
+ resolveQuotaPool(id: string): string | undefined {
592
+ const lowerId = id.trim().toLowerCase();
593
+ return this.getModel(lowerId)?.quotaPool ??
594
+ this.discoveredModels.get(lowerId)?.quotaPool;
595
+ }
596
+
597
+ getDefaultAgentModelId(): string | null {
598
+ return Array.from(this.defaultAgentModelIds.values()).at(-1) ?? null;
599
+ }
600
+ }
601
+
602
+ export const dynamicCatalog = DynamicModelRegistry.getInstance();