refactor(google): merge gemini auth into google plugin

This commit is contained in:
Peter Steinberger
2026-03-16 01:13:17 +00:00
parent d56559bad7
commit bc5054ce68
30 changed files with 200 additions and 291 deletions

View File

@@ -77,7 +77,7 @@ describe("applyAuthChoiceGoogleGeminiCli", () => {
expect(result).toBe(expected);
expect(mockedApplyAuthChoicePluginProvider).toHaveBeenCalledWith(params, {
authChoice: "google-gemini-cli",
pluginId: "google-gemini-cli-auth",
pluginId: "google",
providerId: "google-gemini-cli",
methodId: "oauth",
label: "Google Gemini CLI",

View File

@@ -29,7 +29,7 @@ export async function applyAuthChoiceGoogleGeminiCli(
return await applyAuthChoicePluginProvider(params, {
authChoice: "google-gemini-cli",
pluginId: "google-gemini-cli-auth",
pluginId: "google",
providerId: "google-gemini-cli",
methodId: "oauth",
label: "Google Gemini CLI",

View File

@@ -307,7 +307,7 @@ describe("applyPluginAutoEnable", () => {
env: {},
});
expect(result.config.plugins?.entries?.["google-gemini-cli-auth"]?.enabled).toBe(true);
expect(result.config.plugins?.entries?.google?.enabled).toBe(true);
});
it("auto-enables acpx plugin when ACP is configured", () => {

View File

@@ -28,7 +28,7 @@ export type PluginAutoEnableResult = {
};
const PROVIDER_PLUGIN_IDS: Array<{ pluginId: string; providerId: string }> = [
{ pluginId: "google-gemini-cli-auth", providerId: "google-gemini-cli" },
{ pluginId: "google", providerId: "google-gemini-cli" },
{ pluginId: "qwen-portal-auth", providerId: "qwen-portal" },
{ pluginId: "copilot-proxy", providerId: "copilot-proxy" },
{ pluginId: "minimax-portal-auth", providerId: "minimax-portal" },

View File

@@ -1,15 +0,0 @@
// Narrow plugin-sdk surface for the bundled google-gemini-cli-auth plugin.
// Keep this list additive and scoped to symbols used under extensions/google-gemini-cli-auth.
export { fetchWithSsrFGuard } from "../infra/net/fetch-guard.js";
export { isWSL2Sync } from "../infra/wsl.js";
export { emptyPluginConfigSchema } from "../plugins/config-schema.js";
export type {
OpenClawPluginApi,
ProviderAuthContext,
ProviderFetchUsageSnapshotContext,
ProviderResolveDynamicModelContext,
ProviderRuntimeModel,
} from "../plugins/types.js";
export type { ProviderUsageSnapshot } from "../infra/provider-usage.types.js";
export { buildOauthProviderAuthResult } from "./provider-auth-result.js";

View File

@@ -25,7 +25,6 @@ const pluginSdkEntrypoints = [
"diagnostics-otel",
"diffs",
"feishu",
"google-gemini-cli-auth",
"googlechat",
"irc",
"llm-task",

View File

@@ -18,10 +18,6 @@ const bundledExtensionSubpathLoaders = [
{ id: "diagnostics-otel", load: () => import("openclaw/plugin-sdk/diagnostics-otel") },
{ id: "diffs", load: () => import("openclaw/plugin-sdk/diffs") },
{ id: "feishu", load: () => import("openclaw/plugin-sdk/feishu") },
{
id: "google-gemini-cli-auth",
load: () => import("openclaw/plugin-sdk/google-gemini-cli-auth"),
},
{ id: "googlechat", load: () => import("openclaw/plugin-sdk/googlechat") },
{ id: "irc", load: () => import("openclaw/plugin-sdk/irc") },
{ id: "llm-task", load: () => import("openclaw/plugin-sdk/llm-task") },

View File

@@ -5,9 +5,9 @@ import { enablePluginInConfig } from "./enable.js";
describe("enablePluginInConfig", () => {
it("enables a plugin entry", () => {
const cfg: OpenClawConfig = {};
const result = enablePluginInConfig(cfg, "google-gemini-cli-auth");
const result = enablePluginInConfig(cfg, "google");
expect(result.enabled).toBe(true);
expect(result.config.plugins?.entries?.["google-gemini-cli-auth"]?.enabled).toBe(true);
expect(result.config.plugins?.entries?.google?.enabled).toBe(true);
});
it("adds plugin to allowlist when allowlist is configured", () => {
@@ -16,18 +16,18 @@ describe("enablePluginInConfig", () => {
allow: ["memory-core"],
},
};
const result = enablePluginInConfig(cfg, "google-gemini-cli-auth");
const result = enablePluginInConfig(cfg, "google");
expect(result.enabled).toBe(true);
expect(result.config.plugins?.allow).toEqual(["memory-core", "google-gemini-cli-auth"]);
expect(result.config.plugins?.allow).toEqual(["memory-core", "google"]);
});
it("refuses enable when plugin is denylisted", () => {
const cfg: OpenClawConfig = {
plugins: {
deny: ["google-gemini-cli-auth"],
deny: ["google"],
},
};
const result = enablePluginInConfig(cfg, "google-gemini-cli-auth");
const result = enablePluginInConfig(cfg, "google");
expect(result.enabled).toBe(false);
expect(result.reason).toBe("blocked by denylist");
});

View File

@@ -10,7 +10,7 @@ const BUNDLED_PROVIDER_ALLOWLIST_COMPAT_PLUGIN_IDS = [
"cloudflare-ai-gateway",
"copilot-proxy",
"github-copilot",
"google-gemini-cli-auth",
"google",
"huggingface",
"kilocode",
"kimi-coding",