Kun (KunAgent 0.4.5, Electron, com.xingyuzhong.deepseekgui) keeps its
model providers in ~/.kun/data/model-connections.v2.json (or
$KUN_DATA_DIR) and changes them only through its runtime's admin API,
whose address and token are in runtime.json. magpie wires Kun by
calling that API while Kun runs:
POST /v1/model-connections/connect the magpie connection
PATCH /v1/model-connections/:id models, gateway address
POST /v1/model-connections/select the default model
DELETE /v1/model-connections/:id off
POST /v1/provider-config/transactions/preview, then commit
off when magpie's connection is the default: Kun refuses a
plain DELETE of the connection its default names, so the
transaction clears the default and removes it in one step,
and the default the user had before is put back.
When Kun isn't running, wiring says "open Kun, then try again"; the
file is never written behind Kun's back. Kun joins the agent list,
desktop-app detection, the env guard, the icon set (kun.png), the
READMEs and docs/reference.md and docs/subsystems/agent-wiring.md.
Run:
- WSL (Ubuntu 24.04), at the rebased head: go test -tags nogui
-run 'Kun|ListsModels|Picker|Spelled|HandWired|Sync|Drift|ListOnly|
Moved|LAN|Proxy' ./internal/agent ./internal/agentenv ok;
./internal/library ok; ./internal/gui -run 'Icon|Budget|CSS|I18n|
Picker' ok (agentenv: no tests match the filter).
- Windows (win-run): go test -run 'Kun|ListsModels|Picker|Spelled|
HandWired|Drift|ListOnly' ./internal/agent ok. CGO_ENABLED=0 go vet
for windows (agent, gui, agentenv), darwin nogui (agent, agentenv)
and linux nogui (agent, agentenv, gui): clean. gofmt -l clean.
- GUI (WSL, chromium + webkit): i18n-keys, i18n-en-no-cjk,
icon-one-tone, routing-client-icons, icon-tile together 63/63 at
this head. An earlier run at the pre-rebase head was 60/63, the 3
reds icon-one-tone's "Open Design one-tone ... Plugins page"
(chromium), which passed 48/48 alone there and at origin/main: a
load red (#5425).
- Real Kun 0.4.5 (Linux build, sandbox HOME, `kun serve`): connect,
a second model, Sync, restart, off. `kun run`
finished a turn through the gateway (POST /v1/chat/completions,
Bearer magpie-kun, reply "hello from magpie"). Off restored the
previous default, and with no previous default Kun was left with
none and no magpie connection.
Broken by hand: off through the plain DELETE again. The fake Kun now
refuses it as the real one does, and TestKunFromNothing and
TestKunFollowsTheGateway went red with "Deleted connection still has
references: default.providerId"; green with the transaction.
Not tried: Kun's desktop window itself (the runtime was driven
headless); macOS (mote refused SSH all session); `kun run --model`
(run uses its own default model, not the registry's default, so a
CLI run picks magpie's model only with --model).
75 lines
2.9 KiB
Go
75 lines
2.9 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)",
|
|
"miniq": "not looked at (#5897)",
|
|
"avibe": "not looked at (#5897)",
|
|
"obsidian": "not looked at (#5897)",
|
|
"paimon": "not looked at (#5897)",
|
|
"shelley": "not looked at (#5897)",
|
|
"kun": "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)
|
|
}
|
|
}
|
|
}
|