Files
yetone c0c625ac7d antigravity 0.2.1: serves again for whoever has it; magpie gives it to nobody new
The owner (11-15): "正在使用的继续正常,加个提示,新用户不让下载".
0.2.0 answered every request with a 410. 0.2.1 restores the plugin as
0.1.18 had it (git checkout df7d7ae0 -- packages/antigravity), so a user
who has it keeps working. It stays out of registry.json, and magpie's
plugin.Add turns it away for anyone who doesn't have it listed, with a
line on the Providers page telling its users that Google suspends accounts
it sees used this way and pointing to agy-cli. The READMEs say so.

Run on mote at this tree, HOME a temp dir: bun scripts/check.mjs all, and
bun test packages/antigravity packages/agy-cli scripts: 195 pass, 0 fail.
2026-11-16 02:43:44 +08:00

62 lines
2.0 KiB
JavaScript

// The version the requests name is read from the update manifest (#1057).
import { afterEach, beforeEach, expect, test } from "bun:test"
import { _internal } from "./index.mjs"
import { real } from "./fake.mjs"
const { ver, version, lists, VERSION_TTL, VERSION_RETRY, DEFAULT_VERSION } = _internal
beforeEach(() => {
ver.v = ""
ver.at = 0
ver.pending = null
lists.clear()
})
afterEach(() => (globalThis.fetch = real))
const manifest = (v) => async () => new Response(`version: ${v}\nfiles: []\n`, { status: 200 })
const down = async () => { throw new TypeError("fetch failed") }
test("a manifest that can't be read is asked again after a minute, not six hours", async () => {
let asked = 0
globalThis.fetch = async (...a) => { asked++; return down(...a) }
expect(await version()).toBe(DEFAULT_VERSION)
expect(asked).toBe(1)
expect(await version()).toBe(DEFAULT_VERSION)
expect(asked).toBe(1)
ver.at -= VERSION_RETRY + 1
globalThis.fetch = async (...a) => { asked++; return manifest("2.40.0")(...a) }
expect(await version()).toBe("2.40.0")
expect(asked).toBe(2)
ver.at -= VERSION_RETRY + 1
expect(await version()).toBe("2.40.0")
expect(asked).toBe(2)
})
test("a read manifest holds for six hours", async () => {
let asked = 0
globalThis.fetch = async (...a) => { asked++; return manifest("2.40.0")(...a) }
await version()
ver.at -= VERSION_TTL - 1000
await version()
expect(asked).toBe(1)
})
test("a new version drops the model lists read under the old one", async () => {
globalThis.fetch = down
await version()
lists.set("rt", { at: Date.now(), infos: [], project: "p" })
ver.at -= VERSION_RETRY + 1
globalThis.fetch = manifest(DEFAULT_VERSION)
await version()
expect(lists.size).toBe(1)
ver.at -= VERSION_TTL + 1
globalThis.fetch = manifest("2.40.0")
await version()
expect(lists.size).toBe(0)
})
test("the default is a release Google serves Gemini 4 to", () => {
const [a, b] = DEFAULT_VERSION.split(".").map(Number)
expect(a > 2 || (a === 2 && b >= 20)).toBe(true)
})