Files
magpie/internal/library/every_agent_test.go
T
yetone 93a33d8174 agent: OpenBot's icon, its requests named its own, its skills in the Library (SSNQT on X)
SSNQT on X, magpie 0.1.3503 on macOS, OpenBot (611ce90d1): no icon in
the Agents list, its requests listed as OpenCode's, and no way to pick
it for skills or MCP servers in the Library.

- Icon: OpenBot's production icon (build/icon-production.png in
  nightly-labs/openbot, 128px) as icons/openbot.png, in pngIcons and in
  app.css's tile rule (a solid tile, icon-tile.test.cjs); openbot is off
  client_icons_test's generic list.
- Requests: OpenBot seals an endpoint's key and headers in safeStorage,
  which magpie can't write, and hands the endpoint to the OpenCode it
  runs, so every request came with OpenCode's User-Agent and nothing of
  OpenBot's. magpie's entry is now at <gateway>/agent/openbot/v1
  (gateway.AgentURL). lanGuard takes /agent/<id> off the path when <id>
  is an agent magpie knows (takeAgentPath), agentOf names that agent
  first, and startedByAgent never takes such a request for a script. An
  unknown id is left in the path (404 as before). An entry written at
  /v1 is rewritten at the next sync; OpenBot reads it after a restart,
  which its notice already says. Requests recorded before stay
  OpenCode's.
- Library: an openbot target with skills in ~/.agents/skills, the only
  folder OpenBot reads (home-skills.ts, HOME_SKILL_FOLDER). Its MCP
  servers are rows in its SQLite database (openbot.db,
  projection_mcp_servers), which magpie doesn't write, so it stays out
  of the MCP picker: #5896.
- Guard: TestEveryAgentInLibrary fails for a built-in agent that has no
  Library target and isn't in noLibrary with a reason. 34 agents had
  none when it landed; they are listed as "not looked at (#5897)". The
  icon guard (TestEveryClientHasNameAndIcon) and the agent-name guard
  (TestIsAgentByUserAgent) were there already.

Run (mote unless said): gofmt -l internal (clean); go vet darwin, GOOS=linux
-tags nogui, GOOS=windows on agent, gateway, library, gui: ok;
go test -count=1 ./internal/agent ./internal/gateway ./internal/library
./internal/gui ./internal/usage: all ok but internal/gui's
TestUpdateSlowDownloadOutlastsTheCheckBound (its check request hit its
deadline with four other suites on the box; passes 3 of 3 alone; the
updater isn't touched here; #5905); TestAgentInPath and
TestEveryAgentInLibrary on Windows (win-run): ok; GUI i18n-keys,
icon-tile, icon-one-tone, icon-builtin-over-address,
routing-client-icons, library-pick-remove: chromium 101/101, webkit
54/54. Real gateway (nogui build, sandbox HOME, port 3591): a POST to
/agent/openbot/v1/chat/completions with OpenCode's User-Agent was
recorded as agent openbot, the same at /v1 as opencode, and
/agent/openbot/v1/models answered the list.

Broken by hand, each red: the takeAgentPath call in lanGuard taken out
(TestAgentInPath: path kept, agent opencode); the pathAgent check in
agentOf taken out (agent opencode); the openbot case in targetOf renamed
(TestEveryAgentInLibrary: openbot has no place); Icon back to generic
(TestEveryClientHasNameAndIcon).

Not tried: real OpenBot or a real OpenCode sending to the new address
(the URL is built as `${baseURL}/chat/completions` by
@ai-sdk/openai-compatible, read in its source); the full suite (runs
after the tag).
2026-11-10 15:56:21 +08:00

69 lines
2.6 KiB
Go

package library
import (
"testing"
"github.com/yetone/magpie/internal/agent"
)
// noLibrary are the built-in agents the Library gives nothing to, each
// with why. Every other agent has a place for skills, MCP servers or
// instructions: OpenBot was added with none, so it was in no picker of the
// Library (SSNQT on X). A new agent fails TestEveryAgentInLibrary until it
// gets a target or a line here.
var noLibrary = map[string]string{
"claude-science": "not looked at (#5897)",
"antigravity": "not looked at (#5897)",
"openchamber": "not looked at (#5897)",
"mothx": "not looked at (#5897)",
"penguin": "not looked at (#5897)",
"aside": "not looked at (#5897)",
"cursor-local": "not looked at (#5897)",
"vscode": "not looked at (#5897)",
"vscode-insiders": "not looked at (#5897)",
"vscodium": "not looked at (#5897)",
"zoo-code": "not looked at (#5897)",
"copilot-jetbrains": "not looked at (#5897)",
"air": "not looked at (#5897)",
"air-ide": "not looked at (#5897)",
"ds-bot": "not looked at (#5897)",
"morph": "not looked at (#5897)",
"muse": "not looked at (#5897)",
"empryo": "not looked at (#5897)",
"nanobot": "not looked at (#5897)",
"ante": "not looked at (#5897)",
"astrbot": "not looked at (#5897)",
"qwenpaw": "not looked at (#5897)",
"openclaw": "not looked at (#5897)",
"pencil": "not looked at (#5897)",
"openpencil": "not looked at (#5897)",
"newmax": "not looked at (#5897)",
"raycast": "not looked at (#5897)",
"kirocrew": "not looked at (#5897)",
"t3code": "not looked at (#5897)",
"openmausbot": "not looked at (#5897)",
"snow": "not looked at (#5897)",
"aionui": "not looked at (#5897)",
"cherrystudio": "not looked at (#5897)",
"lody": "not looked at (#5897)",
}
func TestEveryAgentInLibrary(t *testing.T) {
sandbox(t)
for _, a := range agent.All() {
if a.WSL != "" || a.Plugin != "" {
continue // a distro's twin and a plugin's agent have their own
}
why, listed := noLibrary[a.ID]
tg := targetOf(a)
switch {
case tg == nil && !listed:
t.Errorf("%s (%s): no place in the Library; give it a target in targetOf, or a reason in noLibrary", a.ID, a.Name)
case tg != nil && listed:
t.Errorf("%s: in noLibrary (%q) but has a target", a.ID, why)
case tg != nil && tg.Skills == "" && tg.MCP == nil && tg.Instructions == "":
t.Errorf("%s: a target with nothing in it", a.ID)
}
}
}