mimi001234 (Discord, #general): agy installed in a WSL distro never showed on the Agents page. wslKinds had no agy, so the distro probe never looked for it. agy is now a WSL kind (bin agy, dir .gemini/antigravity-cli), with the model field offered for a stopped distro too. agy takes magpie only from how it is started, and no magpie runs inside the distro, so a magpie pick writes an agy shell function into the distro's own profiles: .bashrc, plus .zshrc or fish's config.fish when the login shell in the distro's /etc/passwd is zsh or fish. The function reads settings.json's model at run time. It adds --model only for a magpie model the user didn't name themselves, and sets GOOGLE_GEMINI_BASE_URL to place.gw() (the NAT address, never 127.0.0.1) and GEMINI_API_KEY to the distro's WSL key. Default removes the block. Check flags a function whose address has moved, and Sync rewrites it. update.ShellFunction gained ShellFunctionAt, DropShellFunctionAt and ShellFunctionInAt for profiles given by path (fnProfile is now ShellProfile). This machine's own agy function is unchanged. The restart notice is translated (de, zh, zh-TW, ja). agent-wiring.md and reference.md are updated. Run atc272f3799+ this change, then at this head (rebased on65ee8c65c, which touched only gateway and plugin): the whole of internal/agent and internal/update again, ok, and go build ok. - go test -tags nogui -timeout 45m ./internal/agent/... ./internal/update/... ./internal/cli/...: update and cli ok. agent was red only on TestEveryNoticeIsTranslated (the new notice wasn't in i18n.js); after adding it, TestEveryNoticeIsTranslated and TestWSLAgy* are ok. - go test -tags nogui ./internal/gui: ok. - GUI, chromium and webkit: i18n-keys, agent-notice-lang and wsl-agents-setting all pass. - gofmt -l on the changed files; go vet ./...; GOOS=linux go vet -tags nogui ./...; GOOS=windows go vet ./...; go build for darwin, linux (nogui) and windows: all clean. - The bash and zsh functions are sourced in the test with a fake agy. The fish function was run in docker alpine:3.20 with fish. Broken by hand, each red: - bin "agyx" in the wsl kind: TestWSLAgyFound and TestWSLAgyStopped fail. - 127.0.0.1 instead of at.gw(): TestWSLAgyPick and TestWSLAgyFunctionRuns fail. - default not dropping the function: TestWSLAgyPick fails on .bashrc. Not tried: real WSL. The Windows box (10.0.0.132) didn't answer ssh. Fish wasn't tried inside a real distro.
49 lines
1.2 KiB
Go
49 lines
1.2 KiB
Go
//go:build !windows
|
|
|
|
package update
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"runtime"
|
|
)
|
|
|
|
// shellProfiles are the profiles of the shells installed here that a
|
|
// function goes in: zsh's, bash's and fish's (cliProfile), the one a
|
|
// terminal opens made when it isn't there yet. A Mac's login bash reads
|
|
// the first of .bash_profile, .bash_login and .profile there is.
|
|
func shellProfiles() []ShellProfile {
|
|
var out []ShellProfile
|
|
for _, sh := range cliShells() {
|
|
p := cliProfile(sh.Name)
|
|
if p == "" {
|
|
continue
|
|
}
|
|
kind := "posix"
|
|
create := sh.Default
|
|
switch sh.Name {
|
|
case "fish":
|
|
kind = "fish"
|
|
// fish makes ~/.config/fish on its first start, and reads
|
|
// config.fish there when there is one
|
|
if st, err := os.Stat(filepath.Dir(p)); err == nil && st.IsDir() {
|
|
create = true
|
|
}
|
|
case "bash":
|
|
if runtime.GOOS == "darwin" {
|
|
if _, err := os.Lstat(p); os.IsNotExist(err) {
|
|
h := filepath.Dir(p)
|
|
for _, n := range []string{".bash_login", ".profile"} {
|
|
if _, err := os.Lstat(filepath.Join(h, n)); err == nil {
|
|
p = filepath.Join(h, n)
|
|
break
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
out = append(out, ShellProfile{Kind: kind, Path: p, Create: create})
|
|
}
|
|
return out
|
|
}
|