Grok ("grok") joins Zed in retiredBuiltins. It is served by
@magpie-community/opencode-grok-auth, moved or not.
Removed, the built-in's own paths:
- the sign-in (startGrokSignIn) and the per-account homes it made;
- the Logins/switch/on/forget cases and the alsoOn branch;
- grokAccount and the account list entry;
- the usage fetch (grokSubscriptionUsage, grokLoginUsage, the windows);
- the model list (grokModels, grokContextModels, the window labels);
- the token refresh, the headers, the version probe, and routing's usage
clearing.
grok_usage_test.go is deleted, along with the six built-in-only tests in
grok_test.go and the four in grok_accounts_test.go.
Kept, because something still uses them:
- grokLogins and readGrokCredential, for the mover (migrate_side.go);
- grokBody, for the plugin's request bodies;
- GrokHome, the CLI install (pluginRunsCLI) and GrokBase;
- the gateway's grok draw, video, search and namespace code. It asks
PluginProvider()=="grok" too.
Each remaining grok file has a PLUGIN-SERVED notice.
Fixes the retirement needed:
- movedAgent asks Moved again, not PluginServes. A retired Grok that is
not moved yet still records the CLI's own sign-in, so the move takes it.
TestMoveGrok fails without this: only the second account moved.
- In Logins(""), a retired built-in keeps its place, with no list. Grok's
and Zed's accounts list where the built-ins' stood. Without this,
TestAllLoginsMovedKeepTheirPlace fails ("[zed grok]").
Tests whose meaning changed:
- The gateway's grokSignedIn now serves Grok through the fake plugin
moved onto "grok". It proxies to provider.GrokBase, read per request
and refused unless loopback, so no test reaches the network. It names
127.0.0.1 in fetchPrivate, because the vendor's own host is now the
fake's.
- TestVideoContentAtPrivateAddressNotFetched clears that setting. Without
the clear it fails with "200 secret-bytes".
- TestGrokAccountDraws checks the plugin's Authorization only. The real
plugin's headers are the plugin repo's to test.
- The Grok cases in TestVideosRedacted and TestMediaRedactedErrors reach
their echo through GrokBase (grokEcho).
- TestVideoModelByItsBareName's chat model is the fake's fake-1.
- TestGrokPluginSearchesItself expects "grok", not grok-plugin.
- TestGrokHideOwnSignIn is removed: hiding the CLI's own sign-in was the
built-in's ForgetLogin.
- grok_accounts_test.go keeps test-only newGrokHome and addGrokLogin
fixtures for the mover's tests.
Run in the worktree:
- gofmt -l internal: empty.
- go vet -tags nogui ./... on darwin, GOOS=linux and GOOS=windows: clean.
- go test -tags nogui -count=1 -run
'Private|Grok|grok|CallerUsageVideos|GatewayKeyModelsHoldTheImageAndVideoLists|RemoteMagpie|Video|Redact'
./internal/gateway: ok.
- go test -tags nogui -count=1 -run
'Grok|grok|Migrat|Move|Moved|Retired|Retir|SignIn|AsksOwnBackend|SideLogin|Hide|OwnRow|Logins|Unmoved'
./internal/provider ./internal/cli: ok, ok.
- go test -tags nogui -count=1 -run 'Grok|grok|Plugin|Retired|Moved'
./internal/gui: ok.
Not run: the full suite, the GUI node suite, and a real Grok account.
The machine is under heavy load.
15 lines
770 B
Go
15 lines
770 B
Go
package provider
|
|
|
|
// PLUGIN-SERVED (see AGENTS.md): Grok ("grok") is a retired built-in
|
|
// subscription, served by its plugin alone,
|
|
// @magpie-community/opencode-grok-auth (provider.BuiltinRetired). Its
|
|
// sign-in, models, requests and usage are the plugin's; what is left here
|
|
// reads the accounts signed in to the built-in for the move onto the plugin
|
|
// (migrate_side.go), installs and finds the Grok CLI the plugin signs in
|
|
// with, and shapes the plugin's request bodies (grokBody). A fix belongs in
|
|
// the plugin (github.com/magpie-community/plugins, packages/grok), with the
|
|
// mover's min raised in internal/provider/migrate_side.go.
|
|
|
|
// GrokBase is the CLI's backend; a var so tests can point it elsewhere.
|
|
var GrokBase = "https://cli-chat-proxy.grok.com/v1"
|