agy-cli 0.1.72: Orchestrator isn't listed, since through the bridge it is its planner alone

@jiangnan_ on X (magpie 0.1.4283, agy 1.5.9): "Orchestrator (Carbon)" through
the bridge is single Carbon with no effort levels and no limits.

Orchestrator pairs a planner (Carbon or Argon) with Gemini 4 Hydrogen, which
applies edits and runs builds with agy's own tools (Antigravity's models
page). The bridge's agent has tools: [] so the client's tools are the only
ones, and the handoff can't happen. Making it work would mean agy editing
the disk outside the client, which the bridge exists to avoid. So:

- gemini-pro-orchestrator* rows (or names starting "Orchestrator") are
  left out of the listed and the routed catalog.
- A request naming one gets a 400 (no retry) naming the model it would
  really run: gemini-4-carbon, or gemini-4-argon for -argon/-g1-pro, which
  have their effort levels and limits.
- Limits for the families that had none, from sourced numbers:
  claude-sonnet-4-6 / claude-opus-4-6(-thinking) 250000/64000,
  gemini-3.5-flash 1048576/65536 and gemini-3.1-flash-lite
  1048576/65535 (Antigravity's own model list, magpie's
  testdata/antigravity-models-2026-10-20.json); gemini-4-hydrogen
  1048576/65536 (Google's own API listing in models.dev). Hydrogen's four
  efforts already grouped. gemini-3.6/3.7-flash and gemini-3-flash-preview
  stay without limits: no source names theirs.

Run (mote, sandbox HOME): bun test packages/agy-cli/ 36 pass;
bun scripts/check.mjs ok. Broken by hand: the new catalog test against
origin/main's index.mjs is red (Orchestrator listed, no Hydrogen limit).
Not tried: no Ultra or Pro account here (the owner's is free tier), so no
real Orchestrator, Carbon or Hydrogen request was sent, and the planner-only
behaviour is from the docs and the bridge's tools: [], not observed.
This commit is contained in:
yetone
2026-11-16 12:11:35 +08:00
parent 22272f1be8
commit 0b0b180957
3 changed files with 66 additions and 1 deletions
+30
View File
@@ -610,7 +610,29 @@ function modelFamilyId(model) {
return model.id.slice(0, -(model.effort.length + 1))
}
// Orchestrator pairs a planner (Carbon or Argon) with Gemini 4 Hydrogen,
// which applies edits and runs builds with agy's own tools. The bridge's agent
// has only the client's tools (tools: [] in agentDefinition), so the handoff
// can't happen here and an Orchestrator turn is its planner alone, at a fixed
// thinking level. It isn't listed, and a request naming it is told which
// model it would really get.
function isOrchestrator(model) {
const id = typeof model === "string" ? model : model?.id ?? ""
const name = typeof model === "string" ? "" : model?.name ?? ""
return /^gemini-[a-z0-9.]*-?orchestrator/i.test(id) || /^Orchestrator\b/i.test(name)
}
function orchestratorPlanner(id) {
return /argon|g1-pro/i.test(id) ? "gemini-4-argon" : "gemini-4-carbon"
}
function orchestratorRefusal(id) {
const planner = orchestratorPlanner(id)
return `agy bridge: ${id} (Orchestrator) is not served: its Gemini 4 Hydrogen handoff needs agy's own tools, which the bridge leaves to your client, so it would run as ${planner} alone. Choose ${planner}, or gemini-4-hydrogen, with the effort you want.`
}
function buildModelCatalog(list) {
list = list.filter(model => !isOrchestrator(model))
const rawIds = new Set(list.map(model => model.id))
const families = new Map()
for (const model of list) {
@@ -840,6 +862,13 @@ function modelLimits(id) {
// Gemini 4 Carbon (Ultra plans): the numbers Antigravity's own model list gives it
if (/^gemini-4-carbon$/i.test(family)) return { context: 1048576, output: 262144 }
if (/^claude-(?:opus|sonnet)-5-5$/i.test(family)) return { context: 1000000, output: 64000 }
// Antigravity's own model list (internal/provider/testdata/antigravity-models-2026-10-20.json
// in magpie): maxTokens/maxOutputTokens
if (/^claude-(?:sonnet-4-6|opus-4-6)(?:-thinking)?$/i.test(family)) return { context: 250000, output: 64000 }
if (/^gemini-3\.5-flash$/i.test(family)) return { context: 1048576, output: 65536 }
if (/^gemini-3\.1-flash-lite$/i.test(family)) return { context: 1048576, output: 65535 }
// Gemini 4 Hydrogen: Google's own API listing (models.dev's google provider)
if (/^gemini-4-hydrogen$/i.test(family)) return { context: 1048576, output: 65536 }
if (/^gpt-oss-120b$/i.test(family)) return { context: 131072, output: 32768 }
return undefined
}
@@ -6333,6 +6362,7 @@ export const AntigravityBridgePlugin = async () => {
// derives a key, instructions or history from the body.
const layout = requestLayout(body)
body = { ...canonicalBody(body), model: requestedModel }
if (isOrchestrator(requestedModel)) return jsonError(400, orchestratorRefusal(requestedModel), undefined, { noRetry: true })
const model = resolveAgyModel(await loadModelCatalog(agy), requestedModel, body)
const selection = { model: requestedModel, effort: requestedEffort(body) }
// an account's conversations are its own: its agy has them
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@magpie-community/opencode-agy-cli-auth",
"version": "0.1.71",
"version": "0.1.72",
"description": "Magpie/OpenCode model provider that connects your local agy CLI through the Agent Client Protocol (agy acp), so Antigravity subscription models run through the real CLI",
"type": "module",
"main": "./opencode.mjs",
+35
View File
@@ -450,6 +450,41 @@ test("Gemini 4 Carbon(Ultra):会话开放就列出,limit 是 Antigravity
})
})
// @jiangnan_ (X, agy 1.5.9): Orchestrator through the bridge is its planner
// alone, since the Hydrogen handoff needs agy's own tools (tools: []).
const ORCH_ROWS = [
["gemini-4-carbon-high", "Gemini 4 Carbon (High)"], ["gemini-4-carbon-medium", "Gemini 4 Carbon (Medium)"], ["gemini-4-carbon-low", "Gemini 4 Carbon (Low)"],
["gemini-4-argon-high", "Gemini 4 Argon (High)"], ["gemini-4-argon-low", "Gemini 4 Argon (Low)"],
["gemini-4-hydrogen-high", "Gemini 4 Hydrogen (High)"], ["gemini-4-hydrogen-xhigh", "Gemini 4 Hydrogen (XHigh)"],
["gemini-4-hydrogen-medium", "Gemini 4 Hydrogen (Medium)"], ["gemini-4-hydrogen-low", "Gemini 4 Hydrogen (Low)"],
["gemini-pro-orchestrator", "Orchestrator (Carbon)"], ["gemini-pro-orchestrator-g1-pro", "Orchestrator (Argon)"],
["claude-sonnet-4-6", "Claude Sonnet 4.6 (Thinking)"], ["claude-opus-4-6-thinking", "Claude Opus 4.6 (Thinking)"],
]
test("Orchestrator 不列出,点名它的请求得 400 并指向它实际会跑的型号;Hydrogen 等有 limit", async () => {
await withKit({ modelsBehavior: { stdout: modelsOutput(ORCH_ROWS) }, offeredModels: ORCH_ROWS }, async (kit) => {
await kit.models()
await settle(kit)
const models = await kit.models()
for (const id of ["gemini-pro-orchestrator", "gemini-pro-orchestrator-g1-pro"]) assert.equal(models[id], undefined, `列出了 ${id}`)
for (const model of Object.values(models)) assert.doesNotMatch(String(model.name), /Orchestrator/i)
const plain = (value) => JSON.parse(JSON.stringify(value))
assert.deepEqual(plain(models["gemini-4-hydrogen"].limit), { context: 1048576, output: 65536 })
assert.deepEqual(Object.keys(models["gemini-4-hydrogen"].variants ?? {}).sort(), ["high", "low", "medium", "xhigh"])
assert.deepEqual(plain(models["gemini-4-carbon"].limit), { context: 1048576, output: 262144 })
assert.deepEqual(plain(models["claude-sonnet-4-6"].limit), { context: 250000, output: 64000 })
assert.deepEqual(plain(models["claude-opus-4-6-thinking"].limit), { context: 250000, output: 64000 })
const spawned = kit.children.size
for (const [requested, planner] of [["agy-cli/gemini-pro-orchestrator", "gemini-4-carbon"], ["gemini-pro-orchestrator-g1-pro", "gemini-4-argon"]]) {
const response = await kit.request(baseBody({ model: requested, tools: [], messages: [{ role: "user", content: "hi" }] }))
assert.equal(response.status, 400)
const body = await response.json()
assert.match(body.error.message, new RegExp(`Choose ${planner}`))
}
assert.equal(kit.children.size, spawned, "被拒的 Orchestrator 请求起了 agy")
})
})
test("各家族 limit 正确,未知动态型号不猜成 1M", async () => {
const expected = {
"gemini-4-argon": { context: 1048576, output: 65536 },