Repository navigation
Add Gemini 4 Neon to the Antigravity model list #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| package registry | ||
|
|
||
| import ( | ||
| "encoding/json" | ||
| "slices" | ||
| "testing" | ||
| ) | ||
|
|
||
| func TestAntigravityModelFallbacksYieldToRemoteCatalog(t *testing.T) { | ||
| original := getModels() | ||
| t.Cleanup(func() { | ||
| modelsCatalogStore.mu.Lock() | ||
| modelsCatalogStore.data = original | ||
| modelsCatalogStore.mu.Unlock() | ||
| }) | ||
|
|
||
| var remote map[string][]map[string]any | ||
| if err := json.Unmarshal(embeddedModelsJSON, &remote); err != nil { | ||
| t.Fatal(err) | ||
| } | ||
| remote["antigravity"] = []map[string]any{ | ||
| {"id": "gemini-4-argon-high", "display_name": "Remote Argon"}, | ||
| {"id": "gemini-4-neon-high", "display_name": "Remote Neon"}, | ||
| } | ||
| data, err := json.Marshal(remote) | ||
| if err != nil { | ||
| t.Fatal(err) | ||
| } | ||
| if _, err := publishCatalogBytes(data); err != nil { | ||
| t.Fatal(err) | ||
| } | ||
|
|
||
| models := make(map[string]*ModelInfo) | ||
| for _, model := range GetAntigravityModels() { | ||
| if models[model.ID] != nil { | ||
| t.Fatalf("duplicate model %q", model.ID) | ||
| } | ||
| models[model.ID] = model | ||
| } | ||
| for id, name := range map[string]string{ | ||
| "gemini-4-argon-high": "Remote Argon", | ||
| "gemini-4-neon-high": "Remote Neon", | ||
| } { | ||
| if model := models[id]; model == nil || model.DisplayName != name { | ||
| t.Fatalf("%s = %+v, want remote display name %q", id, model, name) | ||
| } | ||
| } | ||
| for _, tier := range []string{"low", "medium"} { | ||
| model := models["gemini-4-neon-"+tier] | ||
| if model == nil || model.Thinking == nil || !slices.Equal(model.Thinking.Levels, []string{tier}) { | ||
| t.Fatalf("missing Neon %s fallback or incorrect reasoning levels: %+v", tier, model) | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -70,41 +70,41 @@ func GetCodexFreeModels() []*ModelInfo { | |
|
|
||
| // GetCodexTeamModels returns model definitions for the Codex team plan tier. | ||
| func GetCodexTeamModels() []*ModelInfo { | ||
| return WithCodexBuiltins(withCodexPaidModelFallbacks(cloneModelInfos(getModels().CodexTeam))) | ||
| return WithCodexBuiltins(withModelFallbacks(cloneModelInfos(getModels().CodexTeam), codexPaidModelFallbacks)) | ||
| } | ||
|
|
||
| // GetCodexPlusModels returns model definitions for the Codex plus plan tier. | ||
| func GetCodexPlusModels() []*ModelInfo { | ||
| return WithCodexBuiltins(withCodexPaidModelFallbacks(cloneModelInfos(getModels().CodexPlus))) | ||
| return WithCodexBuiltins(withModelFallbacks(cloneModelInfos(getModels().CodexPlus), codexPaidModelFallbacks)) | ||
| } | ||
|
|
||
| // GetCodexProModels returns model definitions for the Codex pro plan tier. | ||
| func GetCodexProModels() []*ModelInfo { | ||
| return WithCodexBuiltins(withCodexPaidModelFallbacks(cloneModelInfos(getModels().CodexPro))) | ||
| return WithCodexBuiltins(withModelFallbacks(cloneModelInfos(getModels().CodexPro), codexPaidModelFallbacks)) | ||
| } | ||
|
|
||
| //go:embed models/codex_paid_model_fallbacks.json | ||
| var embeddedCodexPaidModelFallbacksJSON []byte | ||
|
|
||
| var codexPaidModelFallbacks = parseCodexPaidModelFallbacks(embeddedCodexPaidModelFallbacksJSON) | ||
| var codexPaidModelFallbacks = parseModelFallbacks("codex_paid_model_fallbacks.json", embeddedCodexPaidModelFallbacksJSON) | ||
|
|
||
| func parseCodexPaidModelFallbacks(data []byte) []*ModelInfo { | ||
| func parseModelFallbacks(filename string, data []byte) []*ModelInfo { | ||
| var models []*ModelInfo | ||
| if err := json.Unmarshal(data, &models); err != nil { | ||
| log.Warnf("registry: failed to parse embedded codex_paid_model_fallbacks.json: %v", err) | ||
| log.Warnf("registry: failed to parse embedded %s: %v", filename, err) | ||
| return nil | ||
| } | ||
| return models | ||
| } | ||
|
|
||
| func withCodexPaidModelFallbacks(models []*ModelInfo) []*ModelInfo { | ||
| func withModelFallbacks(models, fallbacks []*ModelInfo) []*ModelInfo { | ||
| present := make(map[string]struct{}, len(models)) | ||
| for _, model := range models { | ||
| if model != nil { | ||
| present[model.ID] = struct{}{} | ||
| } | ||
| } | ||
| for _, fallback := range codexPaidModelFallbacks { | ||
| for _, fallback := range fallbacks { | ||
| if _, exists := present[fallback.ID]; !exists { | ||
| models = append(models, cloneModelInfo(fallback)) | ||
| } | ||
|
|
@@ -117,9 +117,14 @@ func GetKimiModels() []*ModelInfo { | |
| return cloneModelInfos(getModels().Kimi) | ||
| } | ||
|
|
||
| //go:embed models/antigravity_model_fallbacks.json | ||
| var embeddedAntigravityModelFallbacksJSON []byte | ||
|
|
||
| var antigravityModelFallbacks = parseModelFallbacks("antigravity_model_fallbacks.json", embeddedAntigravityModelFallbacksJSON) | ||
|
|
||
| // GetAntigravityModels returns the standard Antigravity model definitions. | ||
| func GetAntigravityModels() []*ModelInfo { | ||
| return cloneModelInfos(getModels().Antigravity) | ||
| return withModelFallbacks(cloneModelInfos(getModels().Antigravity), antigravityModelFallbacks) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Medium · Preserve fallback metadata for aliased Neon routes When Neon is registered only under an OAuth alias with |
||
| } | ||
|
|
||
| var staticDevinModels = []*ModelInfo{ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| [ | ||
| { | ||
| "id": "gemini-4-neon-low", | ||
| "object": "model", | ||
| "type": "antigravity", | ||
| "owned_by": "antigravity", | ||
| "name": "gemini-4-neon-low", | ||
| "display_name": "Gemini 4 Neon (Low)", | ||
| "context_length": 1048576, | ||
| "max_completion_tokens": 262144, | ||
| "thinking": { | ||
| "levels": [ | ||
| "low" | ||
| ] | ||
| }, | ||
| "supportedInputModalities": [ | ||
| "text", | ||
| "image", | ||
| "audio", | ||
| "video" | ||
| ], | ||
| "supportedOutputModalities": [ | ||
| "text" | ||
| ] | ||
| }, | ||
| { | ||
| "id": "gemini-4-neon-medium", | ||
| "object": "model", | ||
| "type": "antigravity", | ||
| "owned_by": "antigravity", | ||
| "name": "gemini-4-neon-medium", | ||
| "display_name": "Gemini 4 Neon (Medium)", | ||
| "context_length": 1048576, | ||
| "max_completion_tokens": 262144, | ||
| "thinking": { | ||
| "levels": [ | ||
| "medium" | ||
| ] | ||
| }, | ||
| "supportedInputModalities": [ | ||
| "text", | ||
| "image", | ||
| "audio", | ||
| "video" | ||
| ], | ||
| "supportedOutputModalities": [ | ||
| "text" | ||
| ] | ||
| }, | ||
| { | ||
| "id": "gemini-4-neon-high", | ||
| "object": "model", | ||
| "type": "antigravity", | ||
| "owned_by": "antigravity", | ||
| "name": "gemini-4-neon-high", | ||
| "display_name": "Gemini 4 Neon (High)", | ||
| "context_length": 1048576, | ||
| "max_completion_tokens": 262144, | ||
| "thinking": { | ||
| "levels": [ | ||
| "high" | ||
| ] | ||
| }, | ||
| "supportedInputModalities": [ | ||
| "text", | ||
| "image", | ||
| "audio", | ||
| "video" | ||
| ], | ||
| "supportedOutputModalities": [ | ||
| "text" | ||
| ] | ||
| } | ||
| ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔵 Low · Shadowed publish error violates the repository naming rule
This initializer shadows the
errdeclared bydata, err := json.Marshal(remote)at line 25. AGENTS.md explicitly requires method-suffixed names for shadowed variables. Use a call-specific name such aserrPublishfor this new error binding.