@google/gemini-cli 0.33.0-preview.3 → 0.33.0-preview.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bundle/gemini.js CHANGED
@@ -196293,8 +196293,8 @@ var GIT_COMMIT_INFO, CLI_VERSION;
196293
196293
  var init_git_commit = __esm({
196294
196294
  "packages/core/dist/src/generated/git-commit.js"() {
196295
196295
  "use strict";
196296
- GIT_COMMIT_INFO = "03a8fc311";
196297
- CLI_VERSION = "0.33.0-preview.3";
196296
+ GIT_COMMIT_INFO = "7e6e40c81";
196297
+ CLI_VERSION = "0.33.0-preview.4";
196298
196298
  }
196299
196299
  });
196300
196300
 
@@ -292762,7 +292762,7 @@ function getVersion() {
292762
292762
  }
292763
292763
  versionPromise = (async () => {
292764
292764
  const pkgJson = await getPackageJson(__dirname3);
292765
- return "0.33.0-preview.3";
292765
+ return "0.33.0-preview.4";
292766
292766
  })();
292767
292767
  return versionPromise;
292768
292768
  }
@@ -294201,14 +294201,16 @@ function getAuthTypeFromEnv() {
294201
294201
  }
294202
294202
  return void 0;
294203
294203
  }
294204
- async function createContentGeneratorConfig(config2, authType, apiKey) {
294204
+ async function createContentGeneratorConfig(config2, authType, apiKey, baseUrl, customHeaders) {
294205
294205
  const geminiApiKey = apiKey || process.env["GEMINI_API_KEY"] || await loadApiKey() || void 0;
294206
294206
  const googleApiKey = process.env["GOOGLE_API_KEY"] || void 0;
294207
294207
  const googleCloudProject = process.env["GOOGLE_CLOUD_PROJECT"] || process.env["GOOGLE_CLOUD_PROJECT_ID"] || void 0;
294208
294208
  const googleCloudLocation = process.env["GOOGLE_CLOUD_LOCATION"] || void 0;
294209
294209
  const contentGeneratorConfig = {
294210
294210
  authType,
294211
- proxy: config2?.getProxy()
294211
+ proxy: config2?.getProxy(),
294212
+ baseUrl,
294213
+ customHeaders
294212
294214
  };
294213
294215
  if (authType === AuthType2.LOGIN_WITH_GOOGLE || authType === AuthType2.COMPUTE_ADC) {
294214
294216
  return contentGeneratorConfig;
@@ -294249,8 +294251,11 @@ async function createContentGenerator(config2, gcConfig, sessionId2) {
294249
294251
  const httpOptions = { headers: baseHeaders };
294250
294252
  return new LoggingContentGenerator(await createCodeAssistContentGenerator(httpOptions, config2.authType, gcConfig, sessionId2), gcConfig);
294251
294253
  }
294252
- if (config2.authType === AuthType2.USE_GEMINI || config2.authType === AuthType2.USE_VERTEX_AI) {
294254
+ if (config2.authType === AuthType2.USE_GEMINI || config2.authType === AuthType2.USE_VERTEX_AI || config2.authType === AuthType2.GATEWAY) {
294253
294255
  let headers = { ...baseHeaders };
294256
+ if (config2.customHeaders) {
294257
+ headers = { ...headers, ...config2.customHeaders };
294258
+ }
294254
294259
  if (gcConfig?.getUsageStatisticsEnabled()) {
294255
294260
  const installationManager2 = new InstallationManager();
294256
294261
  const installationId = installationManager2.getInstallationId();
@@ -294260,6 +294265,9 @@ async function createContentGenerator(config2, gcConfig, sessionId2) {
294260
294265
  };
294261
294266
  }
294262
294267
  const httpOptions = { headers };
294268
+ if (config2.baseUrl) {
294269
+ httpOptions.baseUrl = config2.baseUrl;
294270
+ }
294263
294271
  const googleGenAI = new GoogleGenAI({
294264
294272
  apiKey: config2.apiKey === "" ? void 0 : config2.apiKey,
294265
294273
  vertexai: config2.vertexai,
@@ -294294,6 +294302,7 @@ var init_contentGenerator = __esm({
294294
294302
  AuthType3["USE_VERTEX_AI"] = "vertex-ai";
294295
294303
  AuthType3["LEGACY_CLOUD_SHELL"] = "cloud-shell";
294296
294304
  AuthType3["COMPUTE_ADC"] = "compute-default-credentials";
294305
+ AuthType3["GATEWAY"] = "gateway";
294297
294306
  })(AuthType2 || (AuthType2 = {}));
294298
294307
  }
294299
294308
  });
@@ -433764,7 +433773,7 @@ var init_config4 = __esm({
433764
433773
  getContentGenerator() {
433765
433774
  return this.contentGenerator;
433766
433775
  }
433767
- async refreshAuth(authMethod, apiKey) {
433776
+ async refreshAuth(authMethod, apiKey, baseUrl, customHeaders) {
433768
433777
  this.modelAvailabilityService.reset();
433769
433778
  if (this.contentGeneratorConfig?.authType === AuthType2.USE_GEMINI && authMethod !== AuthType2.USE_GEMINI) {
433770
433779
  this.geminiClient.stripThoughtsFromHistory();
@@ -433773,7 +433782,7 @@ var init_config4 = __esm({
433773
433782
  if (this.contentGeneratorConfig) {
433774
433783
  this.contentGeneratorConfig.authType = void 0;
433775
433784
  }
433776
- const newContentGeneratorConfig = await createContentGeneratorConfig(this, authMethod, apiKey);
433785
+ const newContentGeneratorConfig = await createContentGeneratorConfig(this, authMethod, apiKey, baseUrl, customHeaders);
433777
433786
  this.contentGenerator = await createContentGenerator(newContentGeneratorConfig, this, this.getSessionId());
433778
433787
  this.contentGeneratorConfig = newContentGeneratorConfig;
433779
433788
  this.baseLlmClient = new BaseLlmClient(this.contentGenerator, this);
@@ -515083,7 +515092,7 @@ var WarningMessage = ({ text }) => {
515083
515092
  };
515084
515093
 
515085
515094
  // packages/cli/src/generated/git-commit.ts
515086
- var GIT_COMMIT_INFO2 = "b25c8137f";
515095
+ var GIT_COMMIT_INFO2 = "c316fc6c5";
515087
515096
 
515088
515097
  // packages/cli/src/ui/components/AboutBox.tsx
515089
515098
  init_dist8();
@@ -563500,7 +563509,7 @@ async function loadSandboxConfig(settings, argv) {
563500
563509
  const sandboxOption = argv.sandbox ?? settings.tools?.sandbox;
563501
563510
  const command2 = getSandboxCommand(sandboxOption);
563502
563511
  const packageJson2 = await getPackageJson(__dirname13);
563503
- const image2 = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.33.0-preview.3" ?? packageJson2?.config?.sandboxImageUri;
563512
+ const image2 = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.33.0-preview.4" ?? packageJson2?.config?.sandboxImageUri;
563504
563513
  return command2 && image2 ? { command: command2, image: image2 } : void 0;
563505
563514
  }
563506
563515
 
@@ -567814,6 +567823,8 @@ var GeminiAgent = class {
567814
567823
  sessions = /* @__PURE__ */ new Map();
567815
567824
  clientCapabilities;
567816
567825
  apiKey;
567826
+ baseUrl;
567827
+ customHeaders;
567817
567828
  async initialize(args2) {
567818
567829
  this.clientCapabilities = args2.clientCapabilities;
567819
567830
  const authMethods = [
@@ -567836,6 +567847,17 @@ var GeminiAgent = class {
567836
567847
  id: AuthType2.USE_VERTEX_AI,
567837
567848
  name: "Vertex AI",
567838
567849
  description: "Use an API key with Vertex AI GenAI API"
567850
+ },
567851
+ {
567852
+ id: AuthType2.GATEWAY,
567853
+ name: "AI API Gateway",
567854
+ description: "Use a custom AI API Gateway",
567855
+ _meta: {
567856
+ gateway: {
567857
+ protocol: "google",
567858
+ restartRequired: "false"
567859
+ }
567860
+ }
567839
567861
  }
567840
567862
  ];
567841
567863
  await this.config.initialize();
@@ -567875,7 +567897,32 @@ var GeminiAgent = class {
567875
567897
  if (apiKey) {
567876
567898
  this.apiKey = apiKey;
567877
567899
  }
567878
- await this.config.refreshAuth(method, apiKey ?? this.apiKey);
567900
+ const gatewaySchema = external_exports.object({
567901
+ baseUrl: external_exports.string().optional(),
567902
+ headers: external_exports.record(external_exports.string()).optional()
567903
+ });
567904
+ let baseUrl;
567905
+ let headers;
567906
+ if (meta?.["gateway"]) {
567907
+ const result2 = gatewaySchema.safeParse(meta["gateway"]);
567908
+ if (result2.success) {
567909
+ baseUrl = result2.data.baseUrl;
567910
+ headers = result2.data.headers;
567911
+ } else {
567912
+ throw new RequestError3(
567913
+ -32602,
567914
+ `Malformed gateway payload: ${result2.error.message}`
567915
+ );
567916
+ }
567917
+ }
567918
+ this.baseUrl = baseUrl;
567919
+ this.customHeaders = headers;
567920
+ await this.config.refreshAuth(
567921
+ method,
567922
+ apiKey ?? this.apiKey,
567923
+ baseUrl,
567924
+ headers
567925
+ );
567879
567926
  } catch (e3) {
567880
567927
  throw new RequestError3(-32e3, getAcpErrorMessage(e3));
567881
567928
  }
@@ -567901,7 +567948,12 @@ var GeminiAgent = class {
567901
567948
  let isAuthenticated = false;
567902
567949
  let authErrorMessage = "";
567903
567950
  try {
567904
- await config2.refreshAuth(authType, this.apiKey);
567951
+ await config2.refreshAuth(
567952
+ authType,
567953
+ this.apiKey,
567954
+ this.baseUrl,
567955
+ this.customHeaders
567956
+ );
567905
567957
  isAuthenticated = true;
567906
567958
  const contentGeneratorConfig = config2.getContentGeneratorConfig();
567907
567959
  if (authType === AuthType2.USE_GEMINI && (!contentGeneratorConfig || !contentGeneratorConfig.apiKey)) {
@@ -568025,7 +568077,12 @@ var GeminiAgent = class {
568025
568077
  }
568026
568078
  const config2 = await this.newSessionConfig(sessionId2, cwd7, mcpServers);
568027
568079
  try {
568028
- await config2.refreshAuth(selectedAuthType, this.apiKey);
568080
+ await config2.refreshAuth(
568081
+ selectedAuthType,
568082
+ this.apiKey,
568083
+ this.baseUrl,
568084
+ this.customHeaders
568085
+ );
568029
568086
  } catch (e3) {
568030
568087
  debugLogger.error(`Authentication failed: ${e3}`);
568031
568088
  throw RequestError3.authRequired();
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@google/gemini-cli-devtools",
3
- "version": "0.33.0-preview.3",
3
+ "version": "0.33.0-preview.4",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@google/gemini-cli",
3
- "version": "0.33.0-preview.3",
3
+ "version": "0.33.0-preview.4",
4
4
  "description": "Gemini CLI",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {