Library → Skills showed a chip for WorkBuddy on every row though it
wasn't installed ("一排有点密恐了"). WorkBuddy has no CLI and no detect
rule, so it counted as installed whenever ~/.workbuddy (or its
models.json) existed; that folder stays after the app is trashed, and
magpie itself writes models.json, mcp.json and skills/ there.
- agent: on a Mac WorkBuddy and WorkBuddy AI are detected by their apps,
each by its own bundle id (com.tencent.workbuddy.mac,
com.workbuddy.workbuddy-ai) in /Applications or ~/Applications
(macBundle). Off a Mac the folder still counts, as before.
- library: an agent that isn't a target but still has skills, servers or
hooks magpie gave it is held (Target.Gone). A sync takes edits from its
copies and then only takes things out of it; Read lists it with
gone: true while it has any, and not once it has none.
- GUI: a gone agent's chip is only on the rows of what it has, lit; a
click takes it away. All, the How-per-agent sheet and the pickers leave
it out; By agent lists it as "Not installed here" with Turn all on off.
No layout change. New strings in zh, zh-TW, ja, de.
Run at this tree (macOS, sandbox HOME, Go caches pinned):
- gofmt -l: nothing. go vet ./..., GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./...: clean. go build, GOOS=linux go build -tags
nogui, GOOS=windows go build: ok.
- go test -tags nogui -timeout 30m ./...: all ok (59 packages);
internal/gui rerun after the last string rename: ok.
- GUI: the 74 test files that open the Library, chromium and webkit:
563/563 each. library-gone-agents.test.cjs (new; 1100px and 390px, en,
zh, zh-TW, ja, de): 11/11 in both; i18n-keys.test.cjs: 3/3.
Broken by hand, each went red, then restored and green:
- old client.js: library-gone-agents fails "a chip for an agent not
installed on a row it has nothing on".
- workbuddyHere's Mac branch falling back to the folder:
TestWorkBuddyOnMacIsItsApp "no app, only the folders: WorkBuddy true,
WorkBuddy AI true".
- syncSkills' Gone guard off: TestGoneAgentListedToTakeOut "a sync gave
the gone hermes a skill again".
- held() returning nil: "hermes, holding a skill and a server, isn't
listed as gone".
- the gone sync steps skipped: "hermes, holding nothing, is still listed".
Not verified: the reporter's machine; WorkBuddy detection on Windows and
Linux (unchanged, still by folder); other agents detected by folder alone
(zcode, alma, grok-app, air, hanako, morph, grok) are unchanged. WorkBuddy
AI.app is installed on the owner's Mac without ~/.workbuddy-ai, so it now
shows as detected there.
95 lines
3.4 KiB
Go
95 lines
3.4 KiB
Go
package library
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"slices"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
// holdApp puts a macOS app bundle, its Info.plist saying id, in the sandbox
|
|
// home's Applications, where a Mac's apps are looked for.
|
|
func holdApp(t *testing.T, h, name, id string) {
|
|
t.Helper()
|
|
write(t, filepath.Join(h, "Applications", name, "Contents", "Info.plist"),
|
|
`<?xml version="1.0" encoding="UTF-8"?><plist version="1.0"><dict><key>CFBundleIdentifier</key><string>`+id+`</string></dict></plist>`)
|
|
}
|
|
|
|
// @jiahao_jayden on X: the library's rows listed agents that aren't
|
|
// installed. One gone from here (uninstalled: its CLI gone, its folder
|
|
// left, #2177) is listed only while it still has what magpie gave it, on
|
|
// the rows of what it has, so that can be unticked and taken out of its
|
|
// folder; a sync gives it nothing new, and once it has nothing it isn't
|
|
// listed at all.
|
|
func TestGoneAgentListedToTakeOut(t *testing.T) {
|
|
h := sandbox(t)
|
|
write(t, filepath.Join(h, ".hermes/config.yaml"), "")
|
|
holdCLI(t, h, "hermes")
|
|
src := filepath.Join(h, "src/skills")
|
|
skill(t, filepath.Join(src, "pdf"), "pdf", "Read PDFs")
|
|
skill(t, filepath.Join(src, "csv"), "csv", "Read CSVs")
|
|
ok(t)(InstallSkills(src, []string{"pdf", "csv"}, []string{"claude", "hermes"}))
|
|
pdf, csv := filepath.Join(h, ".hermes/skills/pdf"), filepath.Join(h, ".hermes/skills/csv")
|
|
if !ours(pdf, "pdf") || !ours(csv, "csv") {
|
|
t.Fatal("hermes wasn't given the skills")
|
|
}
|
|
cfg := filepath.Join(h, ".hermes/config.yaml")
|
|
ok(t)(SaveServer("", Server{Name: "fs", Transport: "stdio", Command: "npx", Args: []string{"-y", "@mcp/fs"}, Agents: []string{"claude", "hermes"}}))
|
|
if !strings.Contains(read(t, cfg), "@mcp/fs") {
|
|
t.Fatalf("hermes wasn't given the server:\n%s", read(t, cfg))
|
|
}
|
|
|
|
// uninstalled: its CLI gone, its folder left
|
|
os.Remove(filepath.Join(h, "bin/hermes"))
|
|
os.Remove(filepath.Join(h, "bin/hermes.exe"))
|
|
if targetByID("hermes") != nil {
|
|
t.Fatal("hermes is still a target without its CLI")
|
|
}
|
|
gone := func() *AgentView {
|
|
t.Helper()
|
|
v, err := Read(nil)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
for i, a := range v.Agents {
|
|
if a.ID == "hermes" {
|
|
return &v.Agents[i]
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
if a := gone(); a == nil || !a.Gone || a.Skills == "" || a.MCP == "" {
|
|
t.Fatalf("hermes, holding a skill and a server, isn't listed as gone: %+v", a)
|
|
}
|
|
// claude is no gone agent
|
|
if v, _ := Read(nil); !slices.ContainsFunc(v.Agents, func(a AgentView) bool { return a.ID == "claude" && !a.Gone }) {
|
|
t.Errorf("claude: %+v", v.Agents)
|
|
}
|
|
|
|
// a sync gives it nothing new: a link taken out by hand isn't made again
|
|
os.Remove(csv)
|
|
ok(t)(Sync())
|
|
if _, err := os.Lstat(csv); !os.IsNotExist(err) {
|
|
t.Error("a sync gave the gone hermes a skill again")
|
|
}
|
|
|
|
// unticked, the skill and the server come out of its folder
|
|
ok(t)(SkillAgents("pdf", []string{"claude"}))
|
|
if _, err := os.Lstat(pdf); !os.IsNotExist(err) {
|
|
t.Errorf("pdf unticked is still in the gone hermes's skills: %v", err)
|
|
}
|
|
if !ours(filepath.Join(h, ".claude/skills/pdf"), "pdf") {
|
|
t.Error("claude lost pdf")
|
|
}
|
|
ok(t)(SkillAgents("csv", []string{"claude"}))
|
|
ok(t)(ServerAgents("fs", []string{"claude"}))
|
|
if strings.Contains(read(t, cfg), "@mcp/fs") {
|
|
t.Errorf("the server unticked is still in the gone hermes's config:\n%s", read(t, cfg))
|
|
}
|
|
// with nothing left it isn't listed
|
|
if a := gone(); a != nil {
|
|
t.Errorf("hermes, holding nothing, is still listed: %+v", a)
|
|
}
|
|
}
|