agent-agy 0.1.0: Antigravity CLI (agy) as an agent plugin
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.
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
# @magpie-community/agent-agy
|
||||
|
||||
[Antigravity CLI](https://antigravity.google) (`agy`) as a magpie agent.
|
||||
|
||||
```sh
|
||||
magpie plugin add @magpie-community/agent-agy
|
||||
```
|
||||
|
||||
Pick one of magpie's models in the Antigravity CLI row. magpie writes into
|
||||
`~/.gemini/antigravity-cli/settings.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"model": "magpie/deepseek/pro",
|
||||
"modelProvider": "gemini",
|
||||
"customModelsConfig": {
|
||||
"customModels": {
|
||||
"magpie/deepseek/pro": { "apiProvider": "API_PROVIDER_GOOGLE_GEMINI", "modelName": "deepseek/pro" }
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Your own custom models stay beside magpie's. agy takes the address and key
|
||||
of a Gemini endpoint only from how it is started, so magpie adds a function
|
||||
`agy` to your shells' profiles: it runs `magpie agy run`, which starts the
|
||||
agy on your PATH with `GEMINI_API_KEY`, `GOOGLE_GEMINI_BASE_URL` and
|
||||
`--model` while its model is one of magpie's, and as it is otherwise.
|
||||
`magpie agy env` prints what it starts agy with.
|
||||
|
||||
Picking agy's own model again, or switching it off, puts every key back as
|
||||
it was and takes the function out. agy in a WSL distro is set up the same
|
||||
way, from Windows.
|
||||
|
||||
This plugin takes the place of the Antigravity CLI magpie shipped with: what
|
||||
that one set up is handed over as it is.
|
||||
|
||||
How agent plugins work: [usemagpie.ai/docs/plugins#agents](https://usemagpie.ai/docs/plugins#agents).
|
||||
@@ -0,0 +1,51 @@
|
||||
// Antigravity CLI (agy) keeps its model in
|
||||
// ~/.gemini/antigravity-cli/settings.json, and the models it can pick in
|
||||
// customModelsConfig.customModels, each {apiProvider, modelName}. It takes
|
||||
// the address and key of a Gemini endpoint only from how it is started,
|
||||
// so magpie starts it: the function agy magpie puts in your shells runs
|
||||
// `magpie agy run`, which gives agy GEMINI_API_KEY, GOOGLE_GEMINI_BASE_URL
|
||||
// and --model while its model is one of magpie's.
|
||||
export const agent = {
|
||||
id: "agy",
|
||||
name: "Antigravity CLI",
|
||||
icon: "antigravity-color",
|
||||
aliases: ["antigravity-cli"],
|
||||
bin: "agy",
|
||||
dir: "~/.gemini/antigravity-cli",
|
||||
config: "~/.gemini/antigravity-cli/settings.json",
|
||||
format: "json",
|
||||
model: "model",
|
||||
prefix: "magpie/",
|
||||
launch: {
|
||||
env: { GEMINI_API_KEY: "{key}", GOOGLE_GEMINI_BASE_URL: "{url}" },
|
||||
model: "--model",
|
||||
},
|
||||
// magpie's models go in beside the user's own
|
||||
merge: ["customModelsConfig.customModels"],
|
||||
effort: true,
|
||||
wsl: true,
|
||||
}
|
||||
|
||||
const GEMINI = "API_PROVIDER_GOOGLE_GEMINI"
|
||||
|
||||
export function connect({ models }) {
|
||||
const custom = {}
|
||||
for (const m of models) custom[`magpie/${m.id}`] = { apiProvider: GEMINI, modelName: m.id }
|
||||
return { modelProvider: "gemini", "customModelsConfig.customModels": custom }
|
||||
}
|
||||
|
||||
// the user's own models, which go to their provider rather than through
|
||||
// magpie, and the one agy is on when it isn't listed
|
||||
export function own({ config, model }) {
|
||||
const custom = config?.customModelsConfig?.customModels ?? {}
|
||||
const out = []
|
||||
for (const [k, v] of Object.entries(custom)) {
|
||||
if (k.startsWith("magpie/")) continue
|
||||
const p = String(v?.apiProvider ?? "")
|
||||
const direct = p.includes("ANTHROPIC") ? "Anthropic" : p.includes("OPENAI") ? "OpenAI" : "Google"
|
||||
out.push({ value: k, model: String(v?.modelName ?? k), direct })
|
||||
}
|
||||
out.sort((a, b) => (a.value < b.value ? -1 : a.value > b.value ? 1 : 0))
|
||||
if (model && !(model in custom)) out.unshift({ value: model, model, direct: "Google" })
|
||||
return out
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
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([])
|
||||
})
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "@magpie-community/agent-agy",
|
||||
"version": "0.1.0",
|
||||
"description": "Antigravity CLI (agy) as a magpie agent: pick one of magpie's models for it on the Agents page, and agy starts on magpie's gateway",
|
||||
"type": "module",
|
||||
"files": ["agy.agent.js", "README.md"],
|
||||
"keywords": ["magpie", "magpie-agent", "antigravity", "agy", "llm-gateway"],
|
||||
"license": "MIT",
|
||||
"repository": { "type": "git", "url": "git+https://github.com/magpie-community/plugins.git", "directory": "packages/agent-agy" },
|
||||
"scripts": { "test": "bun test" },
|
||||
"magpie": { "agent": "./agy.agent.js" }
|
||||
}
|
||||
@@ -111,6 +111,8 @@
|
||||
"summary": { "en": "Opt-in, per-provider Codex Responses history filtering after switching providers. Preserves readable content and tool-call pairing; no model probes.", "zh": "按供应商开关 Codex Responses 历史过滤,缓解切换上游后的密文和历史 ID 兼容问题;保留正文与工具配对,不运行模型检测。" } },
|
||||
{ "package": "@magpie-community/middleware-history-trim", "name": "History Trim", "kind": "middleware", "community": true,
|
||||
"summary": { "en": "Send a request's history smaller: fold a run of blank lines, drop a system prompt written twice and a message repeated right after itself, and cut a past tool result longer than maxToolLength at a word boundary. The turn being sent now is left whole.", "zh": "把请求的历史发得更小:折叠连续空行、去掉逐字重复的 system 提示与紧挨着重复的消息、把历史中超过 maxToolLength 的工具结果在词边界处截断;正在发送的这一轮原样不动。" } },
|
||||
{ "package": "@magpie-community/agent-agy", "name": "Antigravity CLI", "kind": "agent", "community": true, "icon": "antigravity-color",
|
||||
"summary": { "en": "Antigravity CLI (agy) on magpie's Agents page: pick one of magpie's models, and the agy in your shells starts on magpie's gateway. Takes the place of the built-in, keeping what it set up.", "zh": "把 Antigravity CLI(agy)加到 magpie 的 Agent 页:选一个 magpie 的模型,终端里的 agy 就从 magpie 的网关启动。接替内置的 agy,保留它原有的设置。" } },
|
||||
{ "package": "@magpie-community/agent-aider", "name": "Aider", "kind": "agent", "community": true,
|
||||
"summary": { "en": "Aider (aider.chat) on magpie's Agents page: pick one of magpie's models for it, and switch it off to put its config back.", "zh": "把 Aider(aider.chat)加到 magpie 的 Agent 页:给它选 magpie 的模型,关掉即恢复它原来的配置。" } },
|
||||
{ "package": "@magpie-community/agent-nanobot", "name": "nanobot", "kind": "agent", "community": true, "icon": "https://raw.githubusercontent.com/HKUDS/nanobot/main/webui/public/brand/nanobot_mark.svg",
|
||||
|
||||
Reference in New Issue
Block a user