@google/gemini-cli-a2a-server 0.55.0-preview.3 → 0.55.1

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.
@@ -220988,8 +220988,8 @@ var GIT_COMMIT_INFO, CLI_VERSION;
220988
220988
  var init_git_commit = __esm({
220989
220989
  "packages/core/dist/src/generated/git-commit.js"() {
220990
220990
  "use strict";
220991
- GIT_COMMIT_INFO = "da3710eb9";
220992
- CLI_VERSION = "0.55.0-preview.3";
220991
+ GIT_COMMIT_INFO = "58ba19945";
220992
+ CLI_VERSION = "0.55.1";
220993
220993
  }
220994
220994
  });
220995
220995
 
@@ -336689,7 +336689,7 @@ function getVersion() {
336689
336689
  }
336690
336690
  versionPromise = (async () => {
336691
336691
  const pkgJson = await getPackageJson(__dirname4);
336692
- return "0.55.0-preview.3";
336692
+ return "0.55.1";
336693
336693
  })();
336694
336694
  return versionPromise;
336695
336695
  }
@@ -377987,6 +377987,29 @@ var init_oauth_token_storage = __esm({
377987
377987
  import * as http6 from "node:http";
377988
377988
  import * as crypto20 from "node:crypto";
377989
377989
  import { URL as URL8 } from "node:url";
377990
+ function getRedirectUri(config2, redirectPort) {
377991
+ if (process.env["GOOGLE_CLOUD_WORKSTATIONS"] === "true" && process.env["WEB_HOST"]) {
377992
+ if (config2.redirectUri) {
377993
+ try {
377994
+ const parsed = new URL8(config2.redirectUri);
377995
+ if (parsed.hostname === "localhost" || parsed.hostname === "127.0.0.1" || parsed.hostname === "[::1]") {
377996
+ const port = String(redirectPort);
377997
+ parsed.protocol = "https:";
377998
+ parsed.hostname = `${port}-${process.env["WEB_HOST"]}`;
377999
+ parsed.port = "";
378000
+ return parsed.toString();
378001
+ }
378002
+ } catch {
378003
+ }
378004
+ return config2.redirectUri;
378005
+ }
378006
+ return `https://${redirectPort}-${process.env["WEB_HOST"]}${REDIRECT_PATH}`;
378007
+ }
378008
+ if (config2.redirectUri) {
378009
+ return config2.redirectUri;
378010
+ }
378011
+ return `http://localhost:${redirectPort}${REDIRECT_PATH}`;
378012
+ }
377990
378013
  function generatePKCEParams() {
377991
378014
  const codeVerifier = crypto20.randomBytes(64).toString("base64url");
377992
378015
  const codeChallenge = crypto20.createHash("sha256").update(codeVerifier).digest("base64url");
@@ -378119,7 +378142,7 @@ function getPortFromUrl(urlString) {
378119
378142
  return void 0;
378120
378143
  }
378121
378144
  function buildAuthorizationUrl(config2, pkceParams, redirectPort, resource) {
378122
- const redirectUri = config2.redirectUri || `http://localhost:${redirectPort}${REDIRECT_PATH}`;
378145
+ const redirectUri = getRedirectUri(config2, redirectPort);
378123
378146
  const params = new URLSearchParams({
378124
378147
  client_id: config2.clientId,
378125
378148
  response_type: "code",
@@ -378208,7 +378231,7 @@ async function parseTokenEndpointResponse(response, operationName, defaultErrorC
378208
378231
  };
378209
378232
  }
378210
378233
  async function exchangeCodeForToken(config2, code, codeVerifier, redirectPort, resource) {
378211
- const redirectUri = config2.redirectUri || `http://localhost:${redirectPort}${REDIRECT_PATH}`;
378234
+ const redirectUri = getRedirectUri(config2, redirectPort);
378212
378235
  const params = new URLSearchParams({
378213
378236
  grant_type: "authorization_code",
378214
378237
  code,
@@ -406691,7 +406714,7 @@ var init_oauth_provider = __esm({
406691
406714
  * @returns The registered client information
406692
406715
  */
406693
406716
  async registerClient(registrationUrl, config2, redirectPort) {
406694
- const redirectUri = config2.redirectUri || `http://localhost:${redirectPort}${REDIRECT_PATH}`;
406717
+ const redirectUri = getRedirectUri(config2, redirectPort);
406695
406718
  const registrationRequest = {
406696
406719
  client_name: "Gemini CLI MCP Client",
406697
406720
  redirect_uris: [redirectUri],
@@ -406980,10 +407003,11 @@ ${authUrl}
406980
407003
  debugLogger.debug(`Returning valid token for server: ${serverName}`);
406981
407004
  return token2.accessToken;
406982
407005
  }
406983
- if (token2.refreshToken && config2.clientId && credentials3.tokenUrl) {
407006
+ const clientId = config2.clientId ?? credentials3.clientId;
407007
+ if (token2.refreshToken && clientId && credentials3.tokenUrl) {
406984
407008
  try {
406985
407009
  debugLogger.log(`Refreshing expired token for MCP server: ${serverName}`);
406986
- const newTokenResponse = await this.refreshAccessToken(config2, token2.refreshToken, credentials3.tokenUrl, credentials3.mcpServerUrl);
407010
+ const newTokenResponse = await this.refreshAccessToken({ ...config2, clientId }, token2.refreshToken, credentials3.tokenUrl, credentials3.mcpServerUrl);
406987
407011
  const newToken = {
406988
407012
  accessToken: newTokenResponse.access_token,
406989
407013
  tokenType: newTokenResponse.token_type,
@@ -406993,7 +407017,7 @@ ${authUrl}
406993
407017
  if (newTokenResponse.expires_in) {
406994
407018
  newToken.expiresAt = Date.now() + newTokenResponse.expires_in * 1e3;
406995
407019
  }
406996
- await this.tokenStorage.saveToken(serverName, newToken, config2.clientId, credentials3.tokenUrl, credentials3.mcpServerUrl);
407020
+ await this.tokenStorage.saveToken(serverName, newToken, clientId, credentials3.tokenUrl, credentials3.mcpServerUrl);
406997
407021
  return newToken.accessToken;
406998
407022
  } catch (error2) {
406999
407023
  coreEvents.emitFeedback("error", "Failed to refresh auth token.", error2);
@@ -407011,7 +407035,7 @@ ${authUrl}
407011
407035
  const clientId = config2.clientId ?? credentials3.clientId;
407012
407036
  if (current.refreshToken && clientId && credentials3.tokenUrl) {
407013
407037
  try {
407014
- const newTokenResponse = await this.refreshAccessToken(config2, current.refreshToken, credentials3.tokenUrl, credentials3.mcpServerUrl);
407038
+ const newTokenResponse = await this.refreshAccessToken({ ...config2, clientId }, current.refreshToken, credentials3.tokenUrl, credentials3.mcpServerUrl);
407015
407039
  const refreshed = {
407016
407040
  accessToken: newTokenResponse.access_token,
407017
407041
  tokenType: newTokenResponse.token_type,