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)