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.
This commit is contained in:
yetone
2026-11-12 20:32:36 +08:00
parent 3d691e6e15
commit 768eafd6dc
3 changed files with 12 additions and 4 deletions
+1 -1
View File
@@ -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",
+4 -3
View File
@@ -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] }
}
+7
View File
@@ -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)