Wave's magpie mode now carries the picked model's name ("Magpie · <model>"),
display:order 1 and the crow icon, and ai:thinkinglevel from the model's
efforts (medium, then high, then low; left out when it has none). The agent
also detects Wave by the wsh CLI, attributes usage by Wave's User-Agent, and
shows a notice on picking the Magpie mode in Wave. connect still returns one
whole `magpie` object, so a disconnect removes the mode. By aibot88.
Checked against Wave's source (pkg/wconfig/settingsconfig.go): display:order,
display:icon and ai:thinkinglevel (enum low/medium/high) are AIModeConfigType
fields. magpie passes name and efforts to connect (internal/agent/plugged.go),
and bin/ua/notice are agentplug.Desc fields.
Run at the reviewed head 008cd8bb4, HOME=$(mktemp -d):
- packages/wave: bun test 5 pass, 0 fail (mote)
- bun scripts/check.mjs wave: ok
Broken by hand: putting "high" ahead of "medium" turns the thinking-level
test red (4 pass, 1 fail, magpie-desktop WSL); restored.
The author ran it on magpie 0.1.3900 with Wave 0.14.5 on macOS.
Not tried by the reviewer: a real Wave install.
55 lines
2.1 KiB
JavaScript
55 lines
2.1 KiB
JavaScript
import { expect, test } from "bun:test"
|
|
import { agent, connect } from "./wave.agent.js"
|
|
|
|
test("says where Wave keeps its model", () => {
|
|
expect(agent).toMatchObject({
|
|
id: "wave",
|
|
config: "~/.config/waveterm/waveai.json",
|
|
model: "magpie.ai:model",
|
|
prefix: "",
|
|
})
|
|
})
|
|
|
|
test("shows Wave's own icon, as the package gives it", async () => {
|
|
const pkg = await Bun.file(new URL("./package.json", import.meta.url)).json()
|
|
expect(agent.icon).toBe("https://github.com/wavetermdev.png")
|
|
expect(pkg.magpie.icon).toBe(agent.icon)
|
|
})
|
|
|
|
test("writes the whole magpie mode, and nothing else", () => {
|
|
const out = connect({
|
|
gateway: { url: "http://127.0.0.1:3425", v1: "http://127.0.0.1:3425/v1", key: "magpie-wave" },
|
|
model: { id: "v2ex/glm-5.3-flash", name: "GLM-5.3-Flash", images: false },
|
|
models: [],
|
|
agent: { id: "wave", config: "/Users/u/.config/waveterm/waveai.json" },
|
|
})
|
|
// a single "magpie" object, so switching off removes the mode entirely
|
|
expect(Object.keys(out)).toEqual(["magpie"])
|
|
expect(out.magpie).toEqual({
|
|
"display:name": "Magpie · GLM-5.3-Flash",
|
|
"display:order": 1,
|
|
"display:icon": "crow",
|
|
"ai:model": "v2ex/glm-5.3-flash",
|
|
"ai:endpoint": "http://127.0.0.1:3425/v1/chat/completions",
|
|
"ai:apitype": "openai-chat",
|
|
"ai:apitoken": "magpie-wave",
|
|
"ai:capabilities": ["tools"],
|
|
})
|
|
})
|
|
|
|
test("declares images and a thinking level when the model offers them", () => {
|
|
const out = connect({
|
|
gateway: { v1: "http://127.0.0.1:3425/v1", key: "magpie-wave" },
|
|
model: { id: "zhipu/glm-5.3-flash", images: true, efforts: ["low", "medium", "high"] },
|
|
})
|
|
expect(out.magpie["ai:capabilities"]).toEqual(["tools", "images"])
|
|
expect(out.magpie["ai:thinkinglevel"]).toBe("medium")
|
|
})
|
|
|
|
test("tolerates being called without a model", () => {
|
|
const out = connect({ gateway: { v1: "http://127.0.0.1:3425/v1", key: "magpie-wave" } })
|
|
expect(out.magpie["display:name"]).toBe("Magpie")
|
|
expect(out.magpie["ai:endpoint"]).toBe("http://127.0.0.1:3425/v1/chat/completions")
|
|
expect(out.magpie["ai:thinkinglevel"]).toBeUndefined()
|
|
})
|