The agent plugin magpie's built-in agy moves onto. It names agy's settings.json, where magpie's models go beside the user's own (merge: customModelsConfig.customModels), and how agy is started: GEMINI_API_KEY and GOOGLE_GEMINI_BASE_URL from magpie's gateway and --model, given by the agy function magpie puts in the user's shells. own() lists the user's own custom models by their provider. Run: bun test in packages/agent-agy (3 pass) and bun scripts/check.mjs (ok) on mote. magpie's TestAgyPlugin, TestAgyHandedToPlugin and TestAgyHandedOverUnwire load this file and pass against the magpie change that reads launch, merge, effort, wsl and aliases. A magpie without that change keeps agy its built-in's, so this package does nothing there.
50 lines
1.9 KiB
JavaScript
50 lines
1.9 KiB
JavaScript
import { expect, test } from "bun:test"
|
|
import { agent, connect, own } from "./agy.agent.js"
|
|
|
|
test("says where agy keeps its model, and how it is started", () => {
|
|
expect(agent).toMatchObject({
|
|
id: "agy",
|
|
config: "~/.gemini/antigravity-cli/settings.json",
|
|
format: "json",
|
|
model: "model",
|
|
prefix: "magpie/",
|
|
bin: "agy",
|
|
launch: { env: { GEMINI_API_KEY: "{key}", GOOGLE_GEMINI_BASE_URL: "{url}" }, model: "--model" },
|
|
merge: ["customModelsConfig.customModels"],
|
|
})
|
|
})
|
|
|
|
test("lists magpie's models as agy's Gemini models", () => {
|
|
const out = connect({
|
|
gateway: { url: "http://127.0.0.1:3425", v1: "http://127.0.0.1:3425/v1", key: "magpie-agy" },
|
|
model: { id: "deepseek/pro" },
|
|
models: [{ id: "deepseek/pro" }, { id: "deepseek/flash" }],
|
|
})
|
|
expect(out).toEqual({
|
|
modelProvider: "gemini",
|
|
"customModelsConfig.customModels": {
|
|
"magpie/deepseek/pro": { apiProvider: "API_PROVIDER_GOOGLE_GEMINI", modelName: "deepseek/pro" },
|
|
"magpie/deepseek/flash": { apiProvider: "API_PROVIDER_GOOGLE_GEMINI", modelName: "deepseek/flash" },
|
|
},
|
|
})
|
|
})
|
|
|
|
test("the user's own models go to their own provider", () => {
|
|
const config = {
|
|
customModelsConfig: {
|
|
customModels: {
|
|
"magpie/deepseek/pro": { apiProvider: "API_PROVIDER_GOOGLE_GEMINI", modelName: "deepseek/pro" },
|
|
"my-claude": { apiProvider: "API_PROVIDER_ANTHROPIC", modelName: "claude-sonnet-4-5" },
|
|
"my-gpt": { apiProvider: "API_PROVIDER_OPENAI", modelName: "gpt-5" },
|
|
},
|
|
},
|
|
}
|
|
expect(own({ config, model: "gemini-3-pro" })).toEqual([
|
|
{ value: "gemini-3-pro", model: "gemini-3-pro", direct: "Google" },
|
|
{ value: "my-claude", model: "claude-sonnet-4-5", direct: "Anthropic" },
|
|
{ value: "my-gpt", model: "gpt-5", direct: "OpenAI" },
|
|
])
|
|
expect(own({ config, model: "my-gpt" }).map((o) => o.value)).toEqual(["my-claude", "my-gpt"])
|
|
expect(own({ config: {}, model: "" })).toEqual([])
|
|
})
|