mirror of
https://github.com/moltbot/moltbot.git
synced 2026-03-07 22:44:16 +00:00
fix(gemini-cli-auth): use PLATFORM_UNSPECIFIED for Linux in loadCodeAssist
Google's loadCodeAssist API rejects "LINUX" as an invalid Platform enum value, causing OAuth setup to fail with 400 Bad Request on Linux systems. The pi-ai runtime already uses "PLATFORM_UNSPECIFIED" for this field. This aligns the extension's discoverProject() with that approach by returning "PLATFORM_UNSPECIFIED" for Linux (and other non-Windows/macOS platforms) instead of "LINUX". Also fixes the original resolvePlatform() which incorrectly fell through to "MACOS" as default instead of explicitly checking for "darwin".
This commit is contained in:
committed by
Peter Steinberger
parent
4c32411bee
commit
008e4804a6
@@ -239,14 +239,15 @@ describe("loginGeminiCliOAuth", () => {
|
||||
"GOOGLE_CLOUD_PROJECT_ID",
|
||||
] as const;
|
||||
|
||||
function getExpectedPlatform(): "WINDOWS" | "MACOS" | "LINUX" {
|
||||
function getExpectedPlatform(): "WINDOWS" | "MACOS" | "LINUX" | "PLATFORM_UNSPECIFIED" {
|
||||
if (process.platform === "win32") {
|
||||
return "WINDOWS";
|
||||
}
|
||||
if (process.platform === "linux") {
|
||||
return "LINUX";
|
||||
if (process.platform === "darwin") {
|
||||
return "MACOS";
|
||||
}
|
||||
return "MACOS";
|
||||
// Matches updated resolvePlatform() which uses PLATFORM_UNSPECIFIED for Linux
|
||||
return "PLATFORM_UNSPECIFIED";
|
||||
}
|
||||
|
||||
function getRequestUrl(input: string | URL | Request): string {
|
||||
|
||||
@@ -224,14 +224,16 @@ function generatePkce(): { verifier: string; challenge: string } {
|
||||
return { verifier, challenge };
|
||||
}
|
||||
|
||||
function resolvePlatform(): "WINDOWS" | "MACOS" | "LINUX" {
|
||||
function resolvePlatform(): "WINDOWS" | "MACOS" | "LINUX" | "PLATFORM_UNSPECIFIED" {
|
||||
if (process.platform === "win32") {
|
||||
return "WINDOWS";
|
||||
}
|
||||
if (process.platform === "linux") {
|
||||
return "LINUX";
|
||||
if (process.platform === "darwin") {
|
||||
return "MACOS";
|
||||
}
|
||||
return "MACOS";
|
||||
// Google's loadCodeAssist API rejects "LINUX" as an invalid Platform enum value.
|
||||
// Use "PLATFORM_UNSPECIFIED" for Linux and other platforms to match the pi-ai runtime.
|
||||
return "PLATFORM_UNSPECIFIED";
|
||||
}
|
||||
|
||||
async function fetchWithTimeout(
|
||||
|
||||
Reference in New Issue
Block a user