New package `@magpie-community/opencode-agy-cli-auth` (provider `agy-cli`, `packages/agy-cli`). It serves Antigravity models through the user's installed `agy` CLI over ACP (`agy acp`) and uses agy's own Google sign-in. The plugin reads and writes no Google tokens. The bridge is gitxm's. On top of it, after review: - **ACP identity.** The client names itself (`opencode-agy-cli-auth` and its package version) instead of `zed`. - **Catalog.** - Only what agy offers this client is listed: Gemini until a session says more, then the session's model option and `availableModels`. - Requests are still routed by everything `agy models` lists. - **Prompt.** agy keeps its own system prompt by default. The minimal agent is opt-in with `AGY_BRIDGE_MINIMAL_AGENT=1`, and the README says what turning it on sends upstream. - **Version check.** agy older than 1.4.12 is refused at the handshake. 1.4.12 is the oldest version the `nc` MCP bridge was checked on, and the README documents the bridge. - **Auto-update.** - `AGY_CLI_DISABLE_AUTO_UPDATE` defaults to `true` only for the plugin's own agy processes. - A value the user set is passed on as written. - **Docs.** The READMEs and the registry summary say how this differs from antigravity-acp (#87). - **Tests.** The author's tests came over under `test/` with a fake agy (an ACP stdio server). Each suite runs in its own `bun test`, and a `mock.module` preload stands in for `node:child_process`. - **Cleanup.** A duplicate, unreachable image branch in validateBody is gone. Run at ae5eafb0 on mote (macOS) with HOME=$(mktemp -d): - `bun test packages/agy-cli`: 7 pass. Per suite: - platform 14, compat 9, usage 20; - catalog 15, usage-settlement 18, repeat-batch 14; - smoke ALL OK (301 checks). - `bun scripts/check.mjs`: all ok. - Repo-wide `bun test`: 6792 pass, 0 fail (6812 tests, 492 files). Broken by hand, and each went red: - clientInfo set back to zed; - the version check turned off; - routing limited to the listed models; - auto-update forced to true; - the minimal agent on by default. Not tried: a real agy, since mote has none, or a real Antigravity account. Co-authored-by: gitxm <21175063+gitxm@users.noreply.github.com>
37 lines
1.3 KiB
JavaScript
37 lines
1.3 KiB
JavaScript
// Runs the suites in test/ (brought over from gitxm/yce-magpie-agy, MIT), each
|
|
// in a bun process of its own: they mock node:child_process, move the clock and
|
|
// set the bridge's environment, and smoke.mjs ends with process.exit.
|
|
import { expect, test } from "bun:test"
|
|
import path from "node:path"
|
|
|
|
const dir = path.join(import.meta.dir, "test")
|
|
const hook = path.join(dir, "cp-hook.mjs")
|
|
|
|
function run(args, timeout) {
|
|
const result = Bun.spawnSync({ cmd: [process.execPath, ...args], cwd: dir, env: { ...process.env }, stdout: "pipe", stderr: "pipe", timeout })
|
|
const output = result.stdout.toString() + result.stderr.toString()
|
|
if (result.exitCode !== 0) console.error(output)
|
|
return { code: result.exitCode, output }
|
|
}
|
|
|
|
for (const [name, mocks] of [
|
|
["platform.mjs", true],
|
|
["compat.mjs", true],
|
|
["usage.mjs", true],
|
|
["catalog.mjs", false],
|
|
["usage-settlement.mjs", false],
|
|
["repeat-batch.mjs", false],
|
|
]) {
|
|
test(`test/${name}`, () => {
|
|
const { code, output } = run(["test", ...(mocks ? ["--preload", hook] : []), `./${name}`], 240_000)
|
|
expect(output).toMatch(/\b[1-9]\d* pass\b/)
|
|
expect(code).toBe(0)
|
|
}, 250_000)
|
|
}
|
|
|
|
test("test/smoke.mjs against a fake agy", () => {
|
|
const { code, output } = run([path.join(dir, "smoke.mjs")], 240_000)
|
|
expect(output).toMatch(/ALL OK \(\d+ checks\)/)
|
|
expect(code).toBe(0)
|
|
}, 250_000)
|