From 768eafd6dcff5a28889768019348473a9973176e Mon Sep 17 00:00:00 2001 From: yetone Date: Thu, 12 Nov 2026 20:32:36 +0800 Subject: [PATCH] agy-cli 0.1.25: nc.exe is built under magpie's renamed Bun too (tearicerice on X) windowsNcBuild() accepted only a runtime named bun / bun.exe. magpie's plugin host runs the Bun it downloads as magpie-bun(.exe) (internal/plugin bunupdate.go magpieBun), so on Windows 0.1.24 always returned null and fell back to nc.cmd: the console window and conhost per `agy acp` MCP call stayed (#1047). The name now matches (magpie-)?bun(.exe). An opencode build, which reports a bun version but has no `build` command, and Node still get null. Run: node --test packages/agy-cli/test/windows-nc.mjs on mica, 6 of 6 pass. Broke by hand: the old regex puts the new magpie-bun.exe assertion red (1 of 6 fails). win-run on xiaomi-gpu: a copy of Bun renamed magpie-bun.exe, platform.mjs picked it, `build --compile --windows-hide-console` exited 0, nc.exe PE subsystem = 2 (GUI). Siblings: no other package checks a Bun basename (grep). Not tried: a real `agy acp` session on Windows. --- packages/agy-cli/package.json | 2 +- packages/agy-cli/platform.mjs | 7 ++++--- packages/agy-cli/test/windows-nc.mjs | 7 +++++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/agy-cli/package.json b/packages/agy-cli/package.json index 1d60422..ee4d83a 100644 --- a/packages/agy-cli/package.json +++ b/packages/agy-cli/package.json @@ -1,6 +1,6 @@ { "name": "@magpie-community/opencode-agy-cli-auth", - "version": "0.1.24", + "version": "0.1.25", "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", diff --git a/packages/agy-cli/platform.mjs b/packages/agy-cli/platform.mjs index 636290f..ceaac9d 100644 --- a/packages/agy-cli/platform.mjs +++ b/packages/agy-cli/platform.mjs @@ -109,10 +109,11 @@ export function windowsMcpShim(executable, server) { // and leaves a conhost.exe behind (#1047). A GUI-subsystem nc.exe never gets // a console, whatever creation flags agy uses, and still talks over the // stdio pipes agy hands it. Bun builds it from mcp-server.mjs on the user's -// own machine; nothing prebuilt ships. Another runtime gets null, and the -// caller falls back to nc.cmd. +// own machine; nothing prebuilt ships. magpie runs plugins on a Bun it keeps +// as magpie-bun(.exe), so that name counts as Bun too. Another runtime (an +// opencode build, Node) gets null, and the caller falls back to nc.cmd. export function windowsNcBuild(runtime, server, outfile, versions = process.versions) { - if (!versions?.bun || !/^bun(?:\.exe)?$/i.test(path.win32.basename(String(runtime || "")))) return null + if (!versions?.bun || !/^(?:magpie-)?bun(?:\.exe)?$/i.test(path.win32.basename(String(runtime || "")))) return null return { file: runtime, args: ["build", "--compile", "--windows-hide-console", server, "--outfile", outfile] } } diff --git a/packages/agy-cli/test/windows-nc.mjs b/packages/agy-cli/test/windows-nc.mjs index 2937624..05248c2 100644 --- a/packages/agy-cli/test/windows-nc.mjs +++ b/packages/agy-cli/test/windows-nc.mjs @@ -54,6 +54,13 @@ test("windowsNcBuild compiles a hidden-console exe under Bun only", () => { file: BUN, args: ["build", "--compile", "--windows-hide-console", "C:\\p\\mcp-server.mjs", "--outfile", "C:\\t\\nc.exe"], }) + // magpie's plugin host runs a Bun renamed magpie-bun.exe + const MAGPIE_BUN = "C:\\Users\\u\\AppData\\Local\\magpie\\bun\\1.4.2\\magpie-bun.exe" + assert.deepEqual(windowsNcBuild(MAGPIE_BUN, "s", "o", { bun: "1.4.2" }), { + file: MAGPIE_BUN, + args: ["build", "--compile", "--windows-hide-console", "s", "--outfile", "o"], + }) + assert.equal(windowsNcBuild("C:\\x\\magpie-bun.exe", "s", "o", { node: "22.0.0" }), null) assert.equal(windowsNcBuild("C:\\opencode\\opencode.exe", "s", "o", { bun: "1.4.2" }), null) assert.equal(windowsNcBuild("C:\\node\\node.exe", "s", "o", { node: "22.0.0" }), null) assert.equal(windowsNcBuild(BUN, "s", "o", { node: "22.0.0" }), null)