@google/gemini-cli 0.51.0-preview.0 → 0.52.0-nightly.20260713.gf354eebaf

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.
Files changed (69) hide show
  1. package/bundle/{chunk-YCMQYVOL.js → chunk-2T7DHFUF.js} +7 -7
  2. package/bundle/{chunk-ZLW5C5RW.js → chunk-2YX7REYH.js} +1 -1
  3. package/bundle/{chunk-KKZMWOPL.js → chunk-36XJOV7D.js} +1 -1
  4. package/bundle/{chunk-FIVDQWYP.js → chunk-3E5UN72A.js} +1 -1
  5. package/bundle/{chunk-YITANI4H.js → chunk-3QARMH4K.js} +8 -5
  6. package/bundle/{chunk-DY72VNA7.js → chunk-APFEBPRN.js} +2 -2
  7. package/bundle/{chunk-PUQ6F6LT.js → chunk-AXDCPZK4.js} +1 -1
  8. package/bundle/{chunk-FPNPAIJS.js → chunk-AZMX5CAR.js} +3 -3
  9. package/bundle/{chunk-MTJEEJK4.js → chunk-BWWM7236.js} +23 -11
  10. package/bundle/{chunk-KKH6C2EN.js → chunk-DB7X2Y2C.js} +7616 -14196
  11. package/bundle/{chunk-CCS4FZN3.js → chunk-DL66YX6H.js} +1 -1
  12. package/bundle/{chunk-JYUWXRQN.js → chunk-DZIOGU7O.js} +1 -1
  13. package/bundle/{chunk-NZPKN6HX.js → chunk-EBDB2GKX.js} +1 -1
  14. package/bundle/{chunk-4ZTDUVGF.js → chunk-ELOFTD3I.js} +3 -3
  15. package/bundle/{chunk-ZCZJ3EHG.js → chunk-EQJS4COG.js} +67 -54
  16. package/bundle/chunk-HWYSVU2Y.js +154 -0
  17. package/bundle/{chunk-Y6OKNB2O.js → chunk-JK366WXF.js} +1 -1
  18. package/bundle/{chunk-SN3AWJMJ.js → chunk-LZWVXAKV.js} +1 -1
  19. package/bundle/{chunk-G6N5TBIV.js → chunk-M2W3BJNE.js} +2 -2
  20. package/bundle/chunk-MNVSGXFA.js +17332 -0
  21. package/bundle/{chunk-IT3MCILF.js → chunk-NPBRF4SI.js} +1 -1
  22. package/bundle/{chunk-CR7DJZQQ.js → chunk-PUNBJ76K.js} +9 -8
  23. package/bundle/{chunk-4NX72DYK.js → chunk-QKLXGOQQ.js} +34 -16
  24. package/bundle/{chunk-TTSEXUPD.js → chunk-RXBKF467.js} +3 -3
  25. package/bundle/chunk-SJG3YDOW.js +102505 -0
  26. package/bundle/chunk-SWWOMF5U.js +388063 -0
  27. package/bundle/{chunk-Z6DCMYAX.js → chunk-TIH7TS2I.js} +2 -2
  28. package/bundle/chunk-XQM42LAM.js +118 -0
  29. package/bundle/chunk-Y2HXPFYB.js +1571 -0
  30. package/bundle/{chunk-DO2TG64U.js → chunk-YY7XHIP5.js} +7 -7
  31. package/bundle/chunk-Z3HRZRKL.js +398 -0
  32. package/bundle/chunk-Z6YPLHBH.js +512 -0
  33. package/bundle/{cleanup-FQDKYMP7.js → cleanup-5AQQMD23.js} +2 -2
  34. package/bundle/{cleanup-KYHKAOAV.js → cleanup-BJXMNJTU.js} +2 -2
  35. package/bundle/{cleanup-RKALUUIS.js → cleanup-BZE7CX3F.js} +2 -2
  36. package/bundle/cleanup-DPHUXC5P.js +32 -0
  37. package/bundle/{core-ZPLCY7CF.js → core-2VB5TAAN.js} +1 -1
  38. package/bundle/{devtoolsService-JKRU3MYU.js → devtoolsService-JRDPPU42.js} +2 -2
  39. package/bundle/{devtoolsService-XZY2NAWE.js → devtoolsService-LJGLJGJV.js} +4 -3
  40. package/bundle/devtoolsService-MG4V53EK.js +4359 -0
  41. package/bundle/{devtoolsService-MDNGNUVW.js → devtoolsService-SADMX7SY.js} +2 -2
  42. package/bundle/{dist-KYS2OS5Q.js → dist-CGC3DE3I.js} +1 -1
  43. package/bundle/{core-YY6I7TM7.js → dist-O7KA2L4U.js} +1 -1
  44. package/bundle/dist-V7MGOCX5.js +2152 -0
  45. package/bundle/docs/changelogs/index.md +13 -0
  46. package/bundle/docs/changelogs/latest.md +18 -49
  47. package/bundle/docs/changelogs/preview.md +44 -57
  48. package/bundle/{gemini-ZFN5ZWKT.js → gemini-24LLUGUQ.js} +14 -14
  49. package/bundle/{gemini-DFLM6FZF.js → gemini-EV7YQC7F.js} +14 -14
  50. package/bundle/{gemini-6JOWJJRI.js → gemini-UEPAA26P.js} +212 -196
  51. package/bundle/gemini-VWRUY5RU.js +29270 -0
  52. package/bundle/gemini.js +7 -7
  53. package/bundle/{interactiveCli-U33KFJYX.js → interactiveCli-CZLGBQJS.js} +52 -12
  54. package/bundle/{interactiveCli-642BSKOD.js → interactiveCli-GSUQ3DVQ.js} +359 -300
  55. package/bundle/interactiveCli-LAC2GT5E.js +34816 -0
  56. package/bundle/{interactiveCli-OIN4AGBD.js → interactiveCli-ZT2EUQKA.js} +52 -12
  57. package/bundle/{liteRtServerManager-6B6QVC3X.js → liteRtServerManager-2GSYVKDP.js} +4 -4
  58. package/bundle/{liteRtServerManager-6DL4RPYQ.js → liteRtServerManager-BWZ2W62M.js} +4 -4
  59. package/bundle/{liteRtServerManager-2KULLNCR.js → liteRtServerManager-NIEOMPFD.js} +4 -4
  60. package/bundle/liteRtServerManager-ZUHIUYXB.js +65 -0
  61. package/bundle/{oauth2-provider-7MN7TDIH.js → oauth2-provider-5VAK2NYV.js} +1 -1
  62. package/bundle/{oauth2-provider-YYHCEEAO.js → oauth2-provider-L7BJUHV4.js} +38 -72
  63. package/bundle/{oauth2-provider-XRJ2KE2Y.js → oauth2-provider-MT25IEBC.js} +1 -1
  64. package/bundle/oauth2-provider-R2QBZWOH.js +235 -0
  65. package/bundle/{start-HPGDHGIK.js → start-33JI6F6O.js} +6 -6
  66. package/bundle/{start-N7GSPBDS.js → start-HJTAEHPM.js} +6 -6
  67. package/bundle/{start-EKMJOLSQ.js → start-RCFRASLC.js} +6 -6
  68. package/bundle/start-XNCBFLHI.js +18 -0
  69. package/package.json +1 -1
@@ -157,13 +157,13 @@ import {
157
157
  widestLineFromStyledChars,
158
158
  wordBreakStyledChars,
159
159
  wrapStyledChars
160
- } from "./chunk-DO2TG64U.js";
160
+ } from "./chunk-YY7XHIP5.js";
161
161
  import {
162
162
  appEvents
163
163
  } from "./chunk-5PS3AYFU.js";
164
164
  import {
165
165
  require_source
166
- } from "./chunk-PUQ6F6LT.js";
166
+ } from "./chunk-LZWVXAKV.js";
167
167
  import {
168
168
  ACTIVE_SHELL_MAX_LINES,
169
169
  COMPACT_TOOL_SUBVIEW_MAX_LINES,
@@ -214,24 +214,24 @@ import {
214
214
  stripAnsi,
215
215
  stripUnsafeCharacters,
216
216
  toCodePoints
217
- } from "./chunk-Y6OKNB2O.js";
217
+ } from "./chunk-JK366WXF.js";
218
218
  import {
219
219
  handleAutoUpdate,
220
220
  isDevelopment,
221
221
  relaunchApp,
222
222
  setUpdateHandler
223
- } from "./chunk-DY72VNA7.js";
223
+ } from "./chunk-TIH7TS2I.js";
224
224
  import {
225
225
  isTodoList,
226
226
  mapCoreStatusToDisplayStatus,
227
227
  require_react
228
- } from "./chunk-CR7DJZQQ.js";
228
+ } from "./chunk-NPBRF4SI.js";
229
229
  import {
230
230
  registerCleanup,
231
231
  removeCleanup,
232
232
  runExitCleanup,
233
233
  setupTtyCheck
234
- } from "./chunk-CCS4FZN3.js";
234
+ } from "./chunk-DL66YX6H.js";
235
235
  import {
236
236
  ACTIVATE_SKILL_TOOL_NAME,
237
237
  AGENT_TOOL_NAME,
@@ -412,7 +412,7 @@ import {
412
412
  validatePlanContent,
413
413
  validatePlanPath,
414
414
  writeToStdout
415
- } from "./chunk-KKH6C2EN.js";
415
+ } from "./chunk-QKLXGOQQ.js";
416
416
  import "./chunk-664ZODQF.js";
417
417
  import "./chunk-TUDYL3X4.js";
418
418
  import "./chunk-IUUIT4SU.js";
@@ -15250,6 +15250,8 @@ var CloudPaidPrivacyNotice = ({
15250
15250
 
15251
15251
  // packages/cli/src/ui/hooks/usePrivacySettings.ts
15252
15252
  var import_react51 = __toESM(require_react(), 1);
15253
+ var TierUnavailableError = class extends Error {
15254
+ };
15253
15255
  var usePrivacySettings = (config) => {
15254
15256
  const [privacyState, setPrivacyState] = (0, import_react51.useState)({
15255
15257
  isLoading: true
@@ -15263,7 +15265,11 @@ var usePrivacySettings = (config) => {
15263
15265
  const server = getCodeAssistServerOrFail(config);
15264
15266
  const tier = server.userTier;
15265
15267
  if (tier === void 0) {
15266
- throw new Error("Could not determine user tier.");
15268
+ setPrivacyState({
15269
+ isLoading: false,
15270
+ isTierUnavailable: true
15271
+ });
15272
+ return;
15267
15273
  }
15268
15274
  if (tier !== UserTierId.FREE) {
15269
15275
  setPrivacyState({
@@ -15279,6 +15285,13 @@ var usePrivacySettings = (config) => {
15279
15285
  dataCollectionOptIn: optIn
15280
15286
  });
15281
15287
  } catch (e) {
15288
+ if (isTierUnavailableError(e)) {
15289
+ setPrivacyState({
15290
+ isLoading: false,
15291
+ isTierUnavailable: true
15292
+ });
15293
+ return;
15294
+ }
15282
15295
  setPrivacyState({
15283
15296
  isLoading: false,
15284
15297
  error: e instanceof Error ? e.message : String(e)
@@ -15298,6 +15311,13 @@ var usePrivacySettings = (config) => {
15298
15311
  dataCollectionOptIn: updatedOptIn
15299
15312
  });
15300
15313
  } catch (e) {
15314
+ if (isTierUnavailableError(e)) {
15315
+ setPrivacyState({
15316
+ isLoading: false,
15317
+ isTierUnavailable: true
15318
+ });
15319
+ return;
15320
+ }
15301
15321
  setPrivacyState({
15302
15322
  isLoading: false,
15303
15323
  error: e instanceof Error ? e.message : String(e)
@@ -15314,12 +15334,19 @@ var usePrivacySettings = (config) => {
15314
15334
  function getCodeAssistServerOrFail(config) {
15315
15335
  const server = getCodeAssistServer(config);
15316
15336
  if (server === void 0) {
15317
- throw new Error("Oauth not being used");
15337
+ throw new TierUnavailableError("Oauth not being used");
15318
15338
  } else if (server.projectId === void 0) {
15319
- throw new Error("CodeAssist server is missing a project ID");
15339
+ throw new TierUnavailableError("CodeAssist server is missing a project ID");
15320
15340
  }
15321
15341
  return server;
15322
15342
  }
15343
+ function isTierUnavailableError(error) {
15344
+ if (error instanceof TierUnavailableError) {
15345
+ return true;
15346
+ }
15347
+ const message = error instanceof Error ? error.message : String(error);
15348
+ return /does not have a current tier/i.test(message);
15349
+ }
15323
15350
  async function getRemoteDataCollectionOptIn(server) {
15324
15351
  try {
15325
15352
  const resp = await server.getCodeAssistGlobalUserSetting();
@@ -15361,7 +15388,7 @@ var CloudFreePrivacyNotice = ({
15361
15388
  const { privacyState, updateDataCollectionOptIn } = usePrivacySettings(config);
15362
15389
  useKeypress(
15363
15390
  (key) => {
15364
- if ((privacyState.error || privacyState.isFreeTier === false) && key.name === "escape") {
15391
+ if ((privacyState.error || privacyState.isFreeTier === false || privacyState.isTierUnavailable) && key.name === "escape") {
15365
15392
  onExit();
15366
15393
  return true;
15367
15394
  }
@@ -15381,6 +15408,19 @@ var CloudFreePrivacyNotice = ({
15381
15408
  /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Text, { color: theme.text.secondary, children: "Press Esc to exit." })
15382
15409
  ] });
15383
15410
  }
15411
+ if (privacyState.isTierUnavailable) {
15412
+ return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(Box_default, { flexDirection: "column", marginY: 1, children: [
15413
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Text, { bold: true, color: theme.text.accent, children: "Gemini Code Assist Privacy Notice" }),
15414
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Newline, {}),
15415
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Text, { color: theme.text.primary, children: "The data collection opt-in isn't available for this account because it doesn't have a Gemini Code Assist for Individuals (free) tier." }),
15416
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Newline, {}),
15417
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Text, { color: theme.text.primary, children: "If you're on a Google Workspace or enterprise account, use the Vertex AI / Google Cloud path instead by setting the GOOGLE_CLOUD_PROJECT environment variable to your Google Cloud project." }),
15418
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Newline, {}),
15419
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Text, { color: theme.text.primary, children: "Learn more: https://geminicli.com/docs/get-started/authentication/" }),
15420
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Newline, {}),
15421
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Text, { color: theme.text.secondary, children: "Press Esc to exit." })
15422
+ ] });
15423
+ }
15384
15424
  if (privacyState.isFreeTier === false) {
15385
15425
  return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(Box_default, { flexDirection: "column", marginY: 1, children: [
15386
15426
  /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Text, { bold: true, color: theme.text.accent, children: "Gemini Code Assist Privacy Notice" }),
@@ -33738,7 +33778,7 @@ ${queuedText}` : queuedText;
33738
33778
  if (keyMatchers["app.showErrorDetails" /* SHOW_ERROR_DETAILS */](key)) {
33739
33779
  if (settings.merged.general.devtools) {
33740
33780
  void (async () => {
33741
- const { toggleDevToolsPanel } = await import("./devtoolsService-MDNGNUVW.js");
33781
+ const { toggleDevToolsPanel } = await import("./devtoolsService-SADMX7SY.js");
33742
33782
  await toggleDevToolsPanel(
33743
33783
  config,
33744
33784
  showErrorDetails,
@@ -3,11 +3,11 @@ import {
3
3
  DEFAULT_PORT,
4
4
  getBinaryPath,
5
5
  isServerRunning
6
- } from "./chunk-ZLW5C5RW.js";
7
- import "./chunk-NZPKN6HX.js";
6
+ } from "./chunk-2YX7REYH.js";
7
+ import "./chunk-EBDB2GKX.js";
8
8
  import {
9
9
  debugLogger
10
- } from "./chunk-MTJEEJK4.js";
10
+ } from "./chunk-BWWM7236.js";
11
11
  import "./chunk-664ZODQF.js";
12
12
  import "./chunk-TUDYL3X4.js";
13
13
  import "./chunk-IUUIT4SU.js";
@@ -41,7 +41,7 @@ var LiteRtServerManager = class {
41
41
  `[LiteRtServerManager] Auto-starting LiteRT server on port ${port}...`
42
42
  );
43
43
  try {
44
- const { startServer } = await import("./start-HPGDHGIK.js");
44
+ const { startServer } = await import("./start-33JI6F6O.js");
45
45
  const started = await startServer(binaryPath, port);
46
46
  if (started) {
47
47
  debugLogger.log(`[LiteRtServerManager] Server started on port ${port}`);
@@ -3,11 +3,11 @@ import {
3
3
  DEFAULT_PORT,
4
4
  getBinaryPath,
5
5
  isServerRunning
6
- } from "./chunk-YITANI4H.js";
7
- import "./chunk-IT3MCILF.js";
6
+ } from "./chunk-3QARMH4K.js";
7
+ import "./chunk-Z6YPLHBH.js";
8
8
  import {
9
9
  debugLogger
10
- } from "./chunk-4NX72DYK.js";
10
+ } from "./chunk-SWWOMF5U.js";
11
11
  import "./chunk-664ZODQF.js";
12
12
  import "./chunk-TUDYL3X4.js";
13
13
  import "./chunk-IUUIT4SU.js";
@@ -41,7 +41,7 @@ var LiteRtServerManager = class {
41
41
  `[LiteRtServerManager] Auto-starting LiteRT server on port ${port}...`
42
42
  );
43
43
  try {
44
- const { startServer } = await import("./start-N7GSPBDS.js");
44
+ const { startServer } = await import("./start-HJTAEHPM.js");
45
45
  const started = await startServer(binaryPath, port);
46
46
  if (started) {
47
47
  debugLogger.log(`[LiteRtServerManager] Server started on port ${port}`);
@@ -3,11 +3,11 @@ import {
3
3
  DEFAULT_PORT,
4
4
  getBinaryPath,
5
5
  isServerRunning
6
- } from "./chunk-Y6OKNB2O.js";
7
- import "./chunk-CR7DJZQQ.js";
6
+ } from "./chunk-MNVSGXFA.js";
7
+ import "./chunk-PUNBJ76K.js";
8
8
  import {
9
9
  debugLogger
10
- } from "./chunk-KKH6C2EN.js";
10
+ } from "./chunk-DB7X2Y2C.js";
11
11
  import "./chunk-664ZODQF.js";
12
12
  import "./chunk-TUDYL3X4.js";
13
13
  import "./chunk-IUUIT4SU.js";
@@ -41,7 +41,7 @@ var LiteRtServerManager = class {
41
41
  `[LiteRtServerManager] Auto-starting LiteRT server on port ${port}...`
42
42
  );
43
43
  try {
44
- const { startServer } = await import("./start-EKMJOLSQ.js");
44
+ const { startServer } = await import("./start-XNCBFLHI.js");
45
45
  const started = await startServer(binaryPath, port);
46
46
  if (started) {
47
47
  debugLogger.log(`[LiteRtServerManager] Server started on port ${port}`);
@@ -0,0 +1,65 @@
1
+ const require = (await import('node:module')).createRequire(import.meta.url); const __chunk_filename = (await import('node:url')).fileURLToPath(import.meta.url); const __chunk_dirname = (await import('node:path')).dirname(__chunk_filename);
2
+ import {
3
+ DEFAULT_PORT,
4
+ getBinaryPath,
5
+ isServerRunning
6
+ } from "./chunk-JK366WXF.js";
7
+ import "./chunk-NPBRF4SI.js";
8
+ import {
9
+ debugLogger
10
+ } from "./chunk-QKLXGOQQ.js";
11
+ import "./chunk-664ZODQF.js";
12
+ import "./chunk-TUDYL3X4.js";
13
+ import "./chunk-IUUIT4SU.js";
14
+ import "./chunk-34MYV7JD.js";
15
+
16
+ // packages/cli/src/services/liteRtServerManager.ts
17
+ import fs from "node:fs";
18
+ var LiteRtServerManager = class {
19
+ static async ensureRunning(gemmaSettings) {
20
+ if (!gemmaSettings?.enabled) return;
21
+ if (gemmaSettings.autoStartServer === false) return;
22
+ const binaryPath = getBinaryPath();
23
+ if (!binaryPath || !fs.existsSync(binaryPath)) {
24
+ debugLogger.log(
25
+ '[LiteRtServerManager] Binary not installed, skipping auto-start. Run "gemini gemma setup".'
26
+ );
27
+ return;
28
+ }
29
+ const port = parseInt(
30
+ gemmaSettings.classifier?.host?.match(/:(\d+)/)?.[1] ?? "",
31
+ 10
32
+ ) || DEFAULT_PORT;
33
+ const running = await isServerRunning(port);
34
+ if (running) {
35
+ debugLogger.log(
36
+ `[LiteRtServerManager] Server already running on port ${port}`
37
+ );
38
+ return;
39
+ }
40
+ debugLogger.log(
41
+ `[LiteRtServerManager] Auto-starting LiteRT server on port ${port}...`
42
+ );
43
+ try {
44
+ const { startServer } = await import("./start-RCFRASLC.js");
45
+ const started = await startServer(binaryPath, port);
46
+ if (started) {
47
+ debugLogger.log(`[LiteRtServerManager] Server started on port ${port}`);
48
+ } else {
49
+ debugLogger.warn(
50
+ `[LiteRtServerManager] Server may not have started correctly on port ${port}`
51
+ );
52
+ }
53
+ } catch (error) {
54
+ debugLogger.warn("[LiteRtServerManager] Auto-start failed:", error);
55
+ }
56
+ }
57
+ };
58
+ export {
59
+ LiteRtServerManager
60
+ };
61
+ /**
62
+ * @license
63
+ * Copyright 2026 Google LLC
64
+ * SPDX-License-Identifier: Apache-2.0
65
+ */
@@ -16,7 +16,7 @@ import {
16
16
  openBrowserSecurely,
17
17
  refreshAccessToken,
18
18
  startCallbackServer
19
- } from "./chunk-MTJEEJK4.js";
19
+ } from "./chunk-DB7X2Y2C.js";
20
20
  import "./chunk-664ZODQF.js";
21
21
  import "./chunk-TUDYL3X4.js";
22
22
  import "./chunk-IUUIT4SU.js";
@@ -16,35 +16,35 @@ import {
16
16
  openBrowserSecurely,
17
17
  refreshAccessToken,
18
18
  startCallbackServer
19
- } from "./chunk-4NX72DYK.js";
19
+ } from "./chunk-SWWOMF5U.js";
20
20
  import "./chunk-664ZODQF.js";
21
21
  import "./chunk-TUDYL3X4.js";
22
22
  import "./chunk-IUUIT4SU.js";
23
23
  import "./chunk-34MYV7JD.js";
24
24
 
25
- // packages/core/src/agents/auth-provider/oauth2-provider.ts
25
+ // packages/core/dist/src/agents/auth-provider/oauth2-provider.js
26
26
  var OAuth2AuthProvider = class extends BaseA2AAuthProvider {
27
+ config;
28
+ agentName;
29
+ agentCardUrl;
30
+ type = "oauth2";
31
+ tokenStorage;
32
+ cachedToken = null;
33
+ /** Resolved OAuth URLs — may come from config or agent card. */
34
+ authorizationUrl;
35
+ tokenUrl;
36
+ scopes;
27
37
  constructor(config, agentName, agentCard, agentCardUrl) {
28
38
  super();
29
39
  this.config = config;
30
40
  this.agentName = agentName;
31
41
  this.agentCardUrl = agentCardUrl;
32
- this.tokenStorage = new MCPOAuthTokenStorage(
33
- Storage.getA2AOAuthTokensPath(),
34
- "gemini-cli-a2a"
35
- );
42
+ this.tokenStorage = new MCPOAuthTokenStorage(Storage.getA2AOAuthTokensPath(), "gemini-cli-a2a");
36
43
  this.authorizationUrl = config.authorization_url;
37
44
  this.tokenUrl = config.token_url;
38
45
  this.scopes = config.scopes;
39
46
  this.mergeAgentCardDefaults(agentCard);
40
47
  }
41
- type = "oauth2";
42
- tokenStorage;
43
- cachedToken = null;
44
- /** Resolved OAuth URLs — may come from config or agent card. */
45
- authorizationUrl;
46
- tokenUrl;
47
- scopes;
48
48
  /**
49
49
  * Initialize the provider by loading any persisted token from storage.
50
50
  * Also discovers OAuth URLs from the agent card if not yet resolved.
@@ -56,9 +56,7 @@ var OAuth2AuthProvider = class extends BaseA2AAuthProvider {
56
56
  const credentials = await this.tokenStorage.getCredentials(this.agentName);
57
57
  if (credentials && !this.tokenStorage.isTokenExpired(credentials.token)) {
58
58
  this.cachedToken = credentials.token;
59
- debugLogger.debug(
60
- `[OAuth2AuthProvider] Loaded valid cached token for "${this.agentName}"`
61
- );
59
+ debugLogger.debug(`[OAuth2AuthProvider] Loaded valid cached token for "${this.agentName}"`);
62
60
  }
63
61
  }
64
62
  /**
@@ -71,25 +69,16 @@ var OAuth2AuthProvider = class extends BaseA2AAuthProvider {
71
69
  }
72
70
  if (this.cachedToken?.refreshToken && this.tokenUrl && this.config.client_id) {
73
71
  try {
74
- const refreshed = await refreshAccessToken(
75
- {
76
- clientId: this.config.client_id,
77
- clientSecret: this.config.client_secret,
78
- scopes: this.scopes
79
- },
80
- this.cachedToken.refreshToken,
81
- this.tokenUrl
82
- );
83
- this.cachedToken = this.toOAuthToken(
84
- refreshed,
85
- this.cachedToken.refreshToken
86
- );
72
+ const refreshed = await refreshAccessToken({
73
+ clientId: this.config.client_id,
74
+ clientSecret: this.config.client_secret,
75
+ scopes: this.scopes
76
+ }, this.cachedToken.refreshToken, this.tokenUrl);
77
+ this.cachedToken = this.toOAuthToken(refreshed, this.cachedToken.refreshToken);
87
78
  await this.persistToken();
88
79
  return { Authorization: `Bearer ${this.cachedToken.accessToken}` };
89
80
  } catch (error) {
90
- debugLogger.debug(
91
- `[OAuth2AuthProvider] Refresh failed, falling back to interactive flow: ${getErrorMessage(error)}`
92
- );
81
+ debugLogger.debug(`[OAuth2AuthProvider] Refresh failed, falling back to interactive flow: ${getErrorMessage(error)}`);
93
82
  await this.tokenStorage.deleteCredentials(this.agentName);
94
83
  }
95
84
  }
@@ -108,9 +97,7 @@ var OAuth2AuthProvider = class extends BaseA2AAuthProvider {
108
97
  return void 0;
109
98
  }
110
99
  this.authRetryCount++;
111
- debugLogger.debug(
112
- "[OAuth2AuthProvider] Auth failure, clearing token and re-authenticating"
113
- );
100
+ debugLogger.debug("[OAuth2AuthProvider] Auth failure, clearing token and re-authenticating");
114
101
  this.cachedToken = null;
115
102
  await this.tokenStorage.deleteCredentials(this.agentName);
116
103
  return this.headers();
@@ -123,7 +110,8 @@ var OAuth2AuthProvider = class extends BaseA2AAuthProvider {
123
110
  * `securitySchemes` when not already provided via user config.
124
111
  */
125
112
  mergeAgentCardDefaults(agentCard) {
126
- if (!agentCard?.securitySchemes) return;
113
+ if (!agentCard?.securitySchemes)
114
+ return;
127
115
  for (const scheme of Object.values(agentCard.securitySchemes)) {
128
116
  if (scheme.type === "oauth2" && scheme.flows.authorizationCode) {
129
117
  const flow = scheme.flows.authorizationCode;
@@ -139,18 +127,15 @@ var OAuth2AuthProvider = class extends BaseA2AAuthProvider {
139
127
  * (which normalizes proto-format cards) and extract OAuth2 URLs.
140
128
  */
141
129
  async fetchAgentCardDefaults() {
142
- if (!this.agentCardUrl) return;
130
+ if (!this.agentCardUrl)
131
+ return;
143
132
  try {
144
- debugLogger.debug(
145
- `[OAuth2AuthProvider] Fetching agent card from ${this.agentCardUrl}`
146
- );
133
+ debugLogger.debug(`[OAuth2AuthProvider] Fetching agent card from ${this.agentCardUrl}`);
147
134
  const resolver = new DefaultAgentCardResolver();
148
135
  const card = await resolver.resolve(this.agentCardUrl, "");
149
136
  this.mergeAgentCardDefaults(card);
150
137
  } catch (error) {
151
- debugLogger.warn(
152
- `[OAuth2AuthProvider] Could not fetch agent card for OAuth URL discovery: ${getErrorMessage(error)}`
153
- );
138
+ debugLogger.warn(`[OAuth2AuthProvider] Could not fetch agent card for OAuth URL discovery: ${getErrorMessage(error)}`);
154
139
  }
155
140
  }
156
141
  /**
@@ -158,14 +143,10 @@ var OAuth2AuthProvider = class extends BaseA2AAuthProvider {
158
143
  */
159
144
  async authenticateInteractively() {
160
145
  if (!this.config.client_id) {
161
- throw new Error(
162
- `OAuth2 authentication for agent "${this.agentName}" requires a client_id. Add client_id to the auth config in your agent definition.`
163
- );
146
+ throw new Error(`OAuth2 authentication for agent "${this.agentName}" requires a client_id. Add client_id to the auth config in your agent definition.`);
164
147
  }
165
148
  if (!this.authorizationUrl || !this.tokenUrl) {
166
- throw new Error(
167
- `OAuth2 authentication for agent "${this.agentName}" requires authorization_url and token_url. Provide them in the auth config or ensure the agent card exposes an oauth2 security scheme.`
168
- );
149
+ throw new Error(`OAuth2 authentication for agent "${this.agentName}" requires authorization_url and token_url. Provide them in the auth config or ensure the agent card exposes an oauth2 security scheme.`);
169
150
  }
170
151
  const flowConfig = {
171
152
  clientId: this.config.client_id,
@@ -184,36 +165,25 @@ var OAuth2AuthProvider = class extends BaseA2AAuthProvider {
184
165
  redirectPort,
185
166
  /* resource= */
186
167
  void 0
187
- // No MCP resource parameter for A2A.
188
- );
189
- const consent = await getConsentForOauth(
190
- `Authentication required for A2A agent: '${this.agentName}'.`
191
168
  );
169
+ const consent = await getConsentForOauth(`Authentication required for A2A agent: '${this.agentName}'.`);
192
170
  if (!consent) {
193
171
  throw new FatalCancellationError("Authentication cancelled by user.");
194
172
  }
195
- coreEvents.emitFeedback(
196
- "info",
197
- `\u2192 Opening your browser for OAuth sign-in...
173
+ coreEvents.emitFeedback("info", `\u2192 Opening your browser for OAuth sign-in...
198
174
 
199
175
  If the browser does not open, copy and paste this URL into your browser:
200
176
  ${authUrl}
201
177
 
202
178
  \u{1F4A1} TIP: Triple-click to select the entire URL, then copy and paste it into your browser.
203
- \u26A0\uFE0F Make sure to copy the COMPLETE URL - it may wrap across multiple lines.`
204
- );
179
+ \u26A0\uFE0F Make sure to copy the COMPLETE URL - it may wrap across multiple lines.`);
205
180
  try {
206
181
  await openBrowserSecurely(authUrl);
207
182
  } catch (error) {
208
- debugLogger.warn(
209
- "Failed to open browser automatically:",
210
- getErrorMessage(error)
211
- );
183
+ debugLogger.warn("Failed to open browser automatically:", getErrorMessage(error));
212
184
  }
213
185
  const { code } = await callbackServer.response;
214
- debugLogger.debug(
215
- "\u2713 Authorization code received, exchanging for tokens..."
216
- );
186
+ debugLogger.debug("\u2713 Authorization code received, exchanging for tokens...");
217
187
  const tokenResponse = await exchangeCodeForToken(
218
188
  flowConfig,
219
189
  code,
@@ -250,13 +220,9 @@ ${authUrl}
250
220
  * Persist the current cached token to disk.
251
221
  */
252
222
  async persistToken() {
253
- if (!this.cachedToken) return;
254
- await this.tokenStorage.saveToken(
255
- this.agentName,
256
- this.cachedToken,
257
- this.config.client_id,
258
- this.tokenUrl
259
- );
223
+ if (!this.cachedToken)
224
+ return;
225
+ await this.tokenStorage.saveToken(this.agentName, this.cachedToken, this.config.client_id, this.tokenUrl);
260
226
  }
261
227
  };
262
228
  export {
@@ -16,7 +16,7 @@ import {
16
16
  openBrowserSecurely,
17
17
  refreshAccessToken,
18
18
  startCallbackServer
19
- } from "./chunk-KKH6C2EN.js";
19
+ } from "./chunk-QKLXGOQQ.js";
20
20
  import "./chunk-664ZODQF.js";
21
21
  import "./chunk-TUDYL3X4.js";
22
22
  import "./chunk-IUUIT4SU.js";