@google/gemini-cli 0.33.0-preview.2 → 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
@@ -113281,7 +113281,7 @@ async function initOauthClient(authType, config2) {
113281
113281
  }
113282
113282
  await triggerPostAuthCallbacks(client.credentials);
113283
113283
  } else {
113284
- if (!config2.getExperimentalZedIntegration()) {
113284
+ if (!config2.getAcpMode()) {
113285
113285
  const userConsent = await getConsentForOauth("");
113286
113286
  if (!userConsent) {
113287
113287
  throw new FatalCancellationError("Authentication cancelled by user.");
@@ -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 = "59702f913";
196297
- CLI_VERSION = "0.33.0-preview.2";
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.2";
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
  });
@@ -433404,7 +433413,7 @@ var init_config4 = __esm({
433404
433413
  }
433405
433414
  }
433406
433415
  summarizeToolOutput;
433407
- experimentalZedIntegration = false;
433416
+ acpMode = false;
433408
433417
  loadMemoryFromIncludeDirectories = false;
433409
433418
  includeDirectoryTree = true;
433410
433419
  importFormat;
@@ -433558,7 +433567,7 @@ var init_config4 = __esm({
433558
433567
  protectLatestTurn: params.toolOutputMasking?.protectLatestTurn ?? DEFAULT_PROTECT_LATEST_TURN
433559
433568
  };
433560
433569
  this.maxSessionTurns = params.maxSessionTurns ?? -1;
433561
- this.experimentalZedIntegration = params.experimentalZedIntegration ?? false;
433570
+ this.acpMode = params.acpMode ?? false;
433562
433571
  this.listSessions = params.listSessions ?? false;
433563
433572
  this.deleteSession = params.deleteSession;
433564
433573
  this.listExtensions = params.listExtensions ?? false;
@@ -433736,7 +433745,7 @@ var init_config4 = __esm({
433736
433745
  }
433737
433746
  }
433738
433747
  });
433739
- if (!this.interactive || this.experimentalZedIntegration) {
433748
+ if (!this.interactive || this.acpMode) {
433740
433749
  await this.mcpInitializationPromise;
433741
433750
  }
433742
433751
  if (this.skillsSupport) {
@@ -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);
@@ -434454,8 +434463,8 @@ var init_config4 = __esm({
434454
434463
  getUsageStatisticsEnabled() {
434455
434464
  return this.usageStatisticsEnabled;
434456
434465
  }
434457
- getExperimentalZedIntegration() {
434458
- return this.experimentalZedIntegration;
434466
+ getAcpMode() {
434467
+ return this.acpMode;
434459
434468
  }
434460
434469
  async waitForMcpInit() {
434461
434470
  if (this.mcpInitializationPromise) {
@@ -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 = "393e9a171";
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.2" ?? 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
 
@@ -563641,9 +563650,12 @@ async function parseArguments2(settings) {
563641
563650
  (p) => p.split(",").map((s4) => s4.trim()).filter(Boolean)
563642
563651
  )
563643
563652
  )
563644
- }).option("experimental-acp", {
563653
+ }).option("acp", {
563645
563654
  type: "boolean",
563646
563655
  description: "Starts the agent in ACP mode"
563656
+ }).option("experimental-acp", {
563657
+ type: "boolean",
563658
+ description: "Starts the agent in ACP mode (deprecated, use --acp instead)"
563647
563659
  }).option("allowed-mcp-server-names", {
563648
563660
  type: "array",
563649
563661
  string: true,
@@ -563951,7 +563963,7 @@ async function loadCliConfig(settings, sessionId2, argv, options = {}) {
563951
563963
  }
563952
563964
  throw err2;
563953
563965
  }
563954
- const interactive = !!argv.promptInteractive || !!argv.experimentalAcp || !isHeadlessMode({ prompt: argv.prompt, query: argv.query }) && !argv.isCommand;
563966
+ const interactive = !!argv.promptInteractive || !!argv.acp || !!argv.experimentalAcp || !isHeadlessMode({ prompt: argv.prompt, query: argv.query }) && !argv.isCommand;
563955
563967
  const allowedTools = argv.allowedTools || settings.tools?.allowed || [];
563956
563968
  const allowedToolsSet = new Set(allowedTools);
563957
563969
  const extraExcludes = [];
@@ -564036,6 +564048,7 @@ async function loadCliConfig(settings, sessionId2, argv, options = {}) {
564036
564048
  }
564037
564049
  }
564038
564050
  return new Config({
564051
+ acpMode: !!argv.acp || !!argv.experimentalAcp,
564039
564052
  sessionId: sessionId2,
564040
564053
  clientVersion: await getVersion(),
564041
564054
  embeddingModel: DEFAULT_GEMINI_EMBEDDING_MODEL,
@@ -564084,7 +564097,6 @@ async function loadCliConfig(settings, sessionId2, argv, options = {}) {
564084
564097
  bugCommand: settings.advanced?.bugCommand,
564085
564098
  model: resolvedModel,
564086
564099
  maxSessionTurns: settings.model?.maxSessionTurns,
564087
- experimentalZedIntegration: argv.experimentalAcp || false,
564088
564100
  listExtensions: argv.listExtensions || false,
564089
564101
  listSessions: argv.listSessions || false,
564090
564102
  deleteSession: argv.deleteSession,
@@ -565645,7 +565657,7 @@ async function runNonInteractive({
565645
565657
  // packages/cli/src/gemini.tsx
565646
565658
  init_dist8();
565647
565659
 
565648
- // packages/cli/src/zed-integration/zedIntegration.ts
565660
+ // packages/cli/src/acp/acpClient.ts
565649
565661
  init_dist8();
565650
565662
 
565651
565663
  // node_modules/@agentclientprotocol/sdk/dist/acp.js
@@ -567054,7 +567066,7 @@ var RequestError3 = class _RequestError extends Error {
567054
567066
  }
567055
567067
  };
567056
567068
 
567057
- // packages/cli/src/zed-integration/fileSystemService.ts
567069
+ // packages/cli/src/acp/fileSystemService.ts
567058
567070
  var AcpFileSystemService = class {
567059
567071
  constructor(connection, sessionId2, capabilities, fallback) {
567060
567072
  this.connection = connection;
@@ -567084,7 +567096,7 @@ var AcpFileSystemService = class {
567084
567096
  }
567085
567097
  };
567086
567098
 
567087
- // packages/cli/src/zed-integration/acpErrors.ts
567099
+ // packages/cli/src/acp/acpErrors.ts
567088
567100
  init_dist8();
567089
567101
  function getAcpErrorMessage(error40) {
567090
567102
  const coreMessage = getErrorMessage(error40);
@@ -567105,14 +567117,14 @@ function extractRecursiveMessage(input) {
567105
567117
  return input;
567106
567118
  }
567107
567119
 
567108
- // packages/cli/src/zed-integration/zedIntegration.ts
567120
+ // packages/cli/src/acp/acpClient.ts
567109
567121
  import { Readable as Readable7, Writable as Writable5 } from "node:stream";
567110
567122
  init_zod();
567111
567123
  import * as fs130 from "node:fs/promises";
567112
567124
  import * as path151 from "node:path";
567113
567125
  import { randomUUID as randomUUID13 } from "node:crypto";
567114
567126
 
567115
- // packages/cli/src/zed-integration/commands/commandRegistry.ts
567127
+ // packages/cli/src/acp/commands/commandRegistry.ts
567116
567128
  init_dist8();
567117
567129
  var CommandRegistry = class {
567118
567130
  commands = /* @__PURE__ */ new Map();
@@ -567134,7 +567146,7 @@ var CommandRegistry = class {
567134
567146
  }
567135
567147
  };
567136
567148
 
567137
- // packages/cli/src/zed-integration/commands/memory.ts
567149
+ // packages/cli/src/acp/commands/memory.ts
567138
567150
  init_dist8();
567139
567151
  var DEFAULT_SANITIZATION_CONFIG = {
567140
567152
  allowedEnvironmentVariables: [],
@@ -567212,7 +567224,7 @@ var AddMemoryCommand = class {
567212
567224
  }
567213
567225
  };
567214
567226
 
567215
- // packages/cli/src/zed-integration/commands/extensions.ts
567227
+ // packages/cli/src/acp/commands/extensions.ts
567216
567228
  init_dist8();
567217
567229
  import { stat as stat13 } from "node:fs/promises";
567218
567230
  var ExtensionsCommand = class {
@@ -567530,7 +567542,7 @@ var UpdateExtensionCommand = class {
567530
567542
  }
567531
567543
  };
567532
567544
 
567533
- // packages/cli/src/zed-integration/commands/init.ts
567545
+ // packages/cli/src/acp/commands/init.ts
567534
567546
  init_dist8();
567535
567547
  import * as fs128 from "node:fs";
567536
567548
  import * as path149 from "node:path";
@@ -567574,7 +567586,7 @@ ${result2.content}`
567574
567586
  }
567575
567587
  };
567576
567588
 
567577
- // packages/cli/src/zed-integration/commands/restore.ts
567589
+ // packages/cli/src/acp/commands/restore.ts
567578
567590
  init_dist8();
567579
567591
  import * as fs129 from "node:fs/promises";
567580
567592
  import * as path150 from "node:path";
@@ -567701,7 +567713,7 @@ ${formatted}`
567701
567713
  }
567702
567714
  };
567703
567715
 
567704
- // packages/cli/src/zed-integration/commandHandler.ts
567716
+ // packages/cli/src/acp/commandHandler.ts
567705
567717
  var CommandHandler = class _CommandHandler {
567706
567718
  registry;
567707
567719
  constructor() {
@@ -567786,11 +567798,11 @@ var CommandHandler = class _CommandHandler {
567786
567798
  }
567787
567799
  };
567788
567800
 
567789
- // packages/cli/src/zed-integration/zedIntegration.ts
567801
+ // packages/cli/src/acp/acpClient.ts
567790
567802
  function hasMeta(obj) {
567791
567803
  return typeof obj === "object" && obj !== null && "_meta" in obj;
567792
567804
  }
567793
- async function runZedIntegration(config2, settings, argv) {
567805
+ async function runAcpClient(config2, settings, argv) {
567794
567806
  const { stdout: workingStdout } = createWorkingStdio();
567795
567807
  const stdout = Writable5.toWeb(workingStdout);
567796
567808
  const stdin = Readable7.toWeb(process.stdin);
@@ -567811,6 +567823,8 @@ var GeminiAgent = class {
567811
567823
  sessions = /* @__PURE__ */ new Map();
567812
567824
  clientCapabilities;
567813
567825
  apiKey;
567826
+ baseUrl;
567827
+ customHeaders;
567814
567828
  async initialize(args2) {
567815
567829
  this.clientCapabilities = args2.clientCapabilities;
567816
567830
  const authMethods = [
@@ -567833,6 +567847,17 @@ var GeminiAgent = class {
567833
567847
  id: AuthType2.USE_VERTEX_AI,
567834
567848
  name: "Vertex AI",
567835
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
+ }
567836
567861
  }
567837
567862
  ];
567838
567863
  await this.config.initialize();
@@ -567872,7 +567897,32 @@ var GeminiAgent = class {
567872
567897
  if (apiKey) {
567873
567898
  this.apiKey = apiKey;
567874
567899
  }
567875
- 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
+ );
567876
567926
  } catch (e3) {
567877
567927
  throw new RequestError3(-32e3, getAcpErrorMessage(e3));
567878
567928
  }
@@ -567898,7 +567948,12 @@ var GeminiAgent = class {
567898
567948
  let isAuthenticated = false;
567899
567949
  let authErrorMessage = "";
567900
567950
  try {
567901
- await config2.refreshAuth(authType, this.apiKey);
567951
+ await config2.refreshAuth(
567952
+ authType,
567953
+ this.apiKey,
567954
+ this.baseUrl,
567955
+ this.customHeaders
567956
+ );
567902
567957
  isAuthenticated = true;
567903
567958
  const contentGeneratorConfig = config2.getContentGeneratorConfig();
567904
567959
  if (authType === AuthType2.USE_GEMINI && (!contentGeneratorConfig || !contentGeneratorConfig.apiKey)) {
@@ -568022,7 +568077,12 @@ var GeminiAgent = class {
568022
568077
  }
568023
568078
  const config2 = await this.newSessionConfig(sessionId2, cwd7, mcpServers);
568024
568079
  try {
568025
- await config2.refreshAuth(selectedAuthType, this.apiKey);
568080
+ await config2.refreshAuth(
568081
+ selectedAuthType,
568082
+ this.apiKey,
568083
+ this.baseUrl,
568084
+ this.customHeaders
568085
+ );
568026
568086
  } catch (e3) {
568027
568087
  debugLogger.error(`Authentication failed: ${e3}`);
568028
568088
  throw RequestError3.authRequired();
@@ -569631,8 +569691,8 @@ ${finalArgs[promptIndex + 1]}`;
569631
569691
  if (settings.merged.security.auth.selectedType === AuthType2.LOGIN_WITH_GOOGLE && config2.isBrowserLaunchSuppressed()) {
569632
569692
  await getOauthClient(settings.merged.security.auth.selectedType, config2);
569633
569693
  }
569634
- if (config2.getExperimentalZedIntegration()) {
569635
- return runZedIntegration(config2, settings, argv);
569694
+ if (config2.getAcpMode()) {
569695
+ return runAcpClient(config2, settings, argv);
569636
569696
  }
569637
569697
  let input = config2.getQuestion();
569638
569698
  const useAlternateBuffer2 = shouldEnterAlternateScreen(
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@google/gemini-cli-devtools",
3
- "version": "0.33.0-preview.2",
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.2",
3
+ "version": "0.33.0-preview.4",
4
4
  "description": "Gemini CLI",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {