CC Switch's and Alma's entries whose base speaks Gemini's own protocol
(GOOGLE_GEMINI_BASE_URL; Alma's gemini format, or a google type with a
base_url) were skipped as "magpie doesn't talk the Gemini protocol to
relays yet". That was true when the import was written (0b0f258c0), but
a custom provider has taken a Gemini base since #1346, as the editor,
the TUI (#2201) and import links (#2251) do.
endpoints carries the Gemini base now, and imported() checks it as it
does the other three (http(s), never magpie's own address); merge() and
firstURL() take it. The skip and its four translations go. An entry
with no base still comes in on Google's preset, a sign-in with no key is
still skipped, and presetAt still matches on chat/responses/anthropic,
so a Gemini-only entry stays a custom provider.
Review change (on top of ggbdpq's 79a2fc71): Gemini CLI's own
@google/genai (getRequestUrlInternal, read in gemini-cli 0.35.3's
bundle) puts the API version after GOOGLE_GEMINI_BASE_URL on every
request, always "v1beta". magpie's Gemini base holds the version, and
GeminiBase adds it only to a bare host, so a relay under a path
(https://relay/gemini) would have been asked at /gemini/models/… instead
of /gemini/v1beta/models/…. geminiCLIBase appends /v1beta to CC Switch's
value. Alma's base_url already holds it (its google provider defaults to
…/v1beta and asks ${base}/models, read in Alma.app's main bundle), so
Alma's is taken as it is. TestImportAlma gains a gemini-format row and a
google-type row with a base; before, only CC Switch was tested.
Run:
- TestImportCCSwitch and TestImportAlma with importapps.go and
import_opencode.go put back to origin/main: FAIL ("gemini relay: …
Skip:magpie doesn't talk…", "alma gemini relay: …"). With
geminiCLIBase taken out: FAIL ("gemini relay: … Gemini:https://g.example.com").
Restored: ok.
- TestImport*, TestGeminiURLIsItsHost: ok.
- Full suite, go test -tags nogui -timeout 45m ./... (set -o pipefail,
sandbox HOME, load ~350) at 0224e826f (these four commits on
ebf3f48f7) plus #2545's patch: every package ok except internal/agent,
whose one red (TestRekeyGivesWSLAgentTheSharingKey) is #2545's, which
was dropped (problems posted on #2545). internal/agent alone at
0224e826f: ok. Rebased on dccfefdf7 (#2635, internal/library only):
build, vet, internal/library ok. gofmt -l clean; go vet darwin (gui),
GOOS=linux and GOOS=windows -tags nogui: clean. GUI (i18n-keys,
gui-de/ja/zh-TW, import-*, key-import, login-import): all pass except
login-import's Chromium case, which fails the same alone on origin/main
ebf3f48f7 (#1307, output posted there).
Not tried: a real CC Switch or Alma database, or a real Gemini relay.
Co-authored-by: ggbdpq <ggbdpq@gmail.com>