@@ -69,9 +69,13 @@ function pickerModelIdForDiscoveredWireId(
6969 wireId : string ,
7070 available : ReadonlyMap < string , Record < string , unknown > > ,
7171) : string {
72- const explicitPickerId = ANTIGRAVITY_PICKER_MODEL_BY_WIRE_ID [ wireId ] ;
72+ const explicitPickerId = Object . hasOwn ( ANTIGRAVITY_PICKER_MODEL_BY_WIRE_ID , wireId )
73+ ? ANTIGRAVITY_PICKER_MODEL_BY_WIRE_ID [ wireId ]
74+ : undefined ;
7375 if ( explicitPickerId ) {
74- const requiredWireIds = ANTIGRAVITY_WIRE_IDS_BY_PICKER_MODEL [ explicitPickerId ] ?? [ ] ;
76+ const requiredWireIds = Object . hasOwn ( ANTIGRAVITY_WIRE_IDS_BY_PICKER_MODEL , explicitPickerId )
77+ ? ANTIGRAVITY_WIRE_IDS_BY_PICKER_MODEL [ explicitPickerId ] ?? [ ]
78+ : [ ] ;
7579 if ( requiredWireIds . every ( id => available . has ( id ) ) ) return explicitPickerId ;
7680 }
7781
@@ -257,6 +261,7 @@ export function parseAntigravityAvailableModels(
257261 if ( ! Array . isArray ( modelIds ) ) return null ;
258262 for ( const id of modelIds ) {
259263 if ( ! isValidModelDiscoveryModelId ( id )
264+ || ! Object . hasOwn ( models , id )
260265 || ! antigravityRecord ( models [ id ] )
261266 || ids . length >= limit ) return null ;
262267 ids . push ( id ) ;
@@ -277,6 +282,7 @@ export function parseAntigravityAvailableModels(
277282 if ( Array . isArray ( flashTieredIds ) ) {
278283 for ( const id of flashTieredIds ) {
279284 if ( ! isValidModelDiscoveryModelId ( id )
285+ || ! Object . hasOwn ( models , id )
280286 || ! antigravityRecord ( models [ id ] )
281287 || ids . length >= limit ) return null ;
282288 ids . push ( id ) ;
@@ -289,7 +295,10 @@ export function parseAntigravityAvailableModels(
289295 if ( ! info || available . has ( wireId ) ) continue ;
290296 // Legacy compatibility aliases are deliberately routed to newer wire ids for saved
291297 // selections. They are not safe as independently discovered picker rows.
292- if ( ANTIGRAVITY_MODEL_ALIASES [ wireId ] && ANTIGRAVITY_MODEL_ALIASES [ wireId ] !== wireId ) continue ;
298+ const alias = Object . hasOwn ( ANTIGRAVITY_MODEL_ALIASES , wireId )
299+ ? ANTIGRAVITY_MODEL_ALIASES [ wireId ]
300+ : undefined ;
301+ if ( alias && alias !== wireId ) continue ;
293302 available . set ( wireId , info ) ;
294303 }
295304
@@ -309,7 +318,9 @@ export function parseAntigravityAvailableModels(
309318}
310319
311320export function resolveAntigravityWireModelId ( modelId : string ) : string {
312- return ANTIGRAVITY_MODEL_ALIASES [ modelId ] ?? modelId ;
321+ return Object . hasOwn ( ANTIGRAVITY_MODEL_ALIASES , modelId )
322+ ? ANTIGRAVITY_MODEL_ALIASES [ modelId ]
323+ : modelId ;
313324}
314325
315326/**
@@ -323,7 +334,7 @@ export function isAntigravitySuffixModelId(modelId: string): boolean {
323334
324335/** The reasoning tier a retired Flash id used to encode, if it is one. */
325336export function retiredAntigravityFlashTier ( modelId : string ) : string | undefined {
326- return RETIRED_FLASH_TIERS [ modelId ] ;
337+ return Object . hasOwn ( RETIRED_FLASH_TIERS , modelId ) ? RETIRED_FLASH_TIERS [ modelId ] : undefined ;
327338}
328339
329340/**
@@ -343,7 +354,7 @@ export function resolveAntigravityEffortWireModel(
343354 // Rule 0: retired Flash id — Google has taken the wire id offline, so route to the
344355 // current generation and carry the tier the retired id encoded. This runs BEFORE the
345356 // suffix check because those ids are aliases, and rule 1 would drop the tier.
346- const retiredTier = RETIRED_FLASH_TIERS [ modelId ] ;
357+ const retiredTier = retiredAntigravityFlashTier ( modelId ) ;
347358 if ( retiredTier ) {
348359 return {
349360 wireModelId : GEMINI_FLASH_CURRENT ,
0 commit comments