@google/gemini-cli 0.36.0-preview.8 → 0.36.0

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 (27) hide show
  1. package/bundle/{chunk-N22U7LIR.js → chunk-2OFO4ODK.js} +4 -4
  2. package/bundle/{chunk-QBLIM2T2.js → chunk-EAXTBDLN.js} +3 -3
  3. package/bundle/{chunk-FWCJAF6L.js → chunk-GHJNEZXJ.js} +57 -69
  4. package/bundle/{chunk-5JDHTAA3.js → chunk-QVTX2M5J.js} +4 -4
  5. package/bundle/{chunk-UUJ4JLTB.js → chunk-UNM3DGTG.js} +3 -3
  6. package/bundle/{chunk-5Y6Y7SEB.js → chunk-VB55KQW3.js} +10495 -5615
  7. package/bundle/{core-N4UNRLQA.js → core-6V2OYDRU.js} +1 -1
  8. package/bundle/{dist-QEB25IFU.js → core-BMLL5RF4.js} +2 -2
  9. package/bundle/{devtoolsService-7D3WUF33.js → devtoolsService-QTW7GHQP.js} +2 -2
  10. package/bundle/{devtoolsService-NA7MR5UO.js → devtoolsService-UL6JE436.js} +4 -5
  11. package/bundle/{devtoolsService-Y53ZUB56.js → devtoolsService-ZKU2HLK2.js} +2 -2
  12. package/bundle/{dist-HD2ZHBHJ.js → dist-PYC2JXAJ.js} +1 -1
  13. package/bundle/gemini.js +6 -6
  14. package/bundle/{interactiveCli-LFO7EWZS.js → interactiveCli-A6HZ2TDO.js} +3 -3
  15. package/bundle/{interactiveCli-A6H7VTMC.js → interactiveCli-DWMSDCKV.js} +235 -252
  16. package/bundle/{interactiveCli-2JRQPNZP.js → interactiveCli-VLQHRXHU.js} +3 -3
  17. package/bundle/node_modules/@google/gemini-cli-devtools/package.json +1 -1
  18. package/bundle/{oauth2-provider-QOWLZC44.js → oauth2-provider-5ENESIRQ.js} +1 -1
  19. package/bundle/{oauth2-provider-2WD22PTI.js → oauth2-provider-CAKFQRQV.js} +1 -1
  20. package/bundle/{oauth2-provider-34BPLPQX.js → oauth2-provider-RVED6DAZ.js} +73 -39
  21. package/package.json +1 -1
  22. package/bundle/chunk-642LNT3F.js +0 -97905
  23. package/bundle/chunk-X6CSYCBW.js +0 -354180
  24. package/bundle/devtoolsService-VU7N6PSG.js +0 -854
  25. package/bundle/dist-JYY2GAAR.js +0 -1886
  26. package/bundle/interactiveCli-R5N55BDV.js +0 -49299
  27. package/bundle/oauth2-provider-MZAUZWUS.js +0 -237
@@ -182,7 +182,7 @@ import {
182
182
  widestLineFromStyledChars,
183
183
  wordBreakStyledChars,
184
184
  wrapStyledChars
185
- } from "./chunk-642LNT3F.js";
185
+ } from "./chunk-UNM3DGTG.js";
186
186
  import {
187
187
  ApiKeyUpdatedEvent,
188
188
  AsyncFzf,
@@ -301,7 +301,7 @@ import {
301
301
  validatePlanContent,
302
302
  validatePlanPath,
303
303
  writeToStdout
304
- } from "./chunk-5Y6Y7SEB.js";
304
+ } from "./chunk-QVTX2M5J.js";
305
305
  import {
306
306
  ACTIVATE_SKILL_TOOL_NAME,
307
307
  ApprovalMode,
@@ -48369,7 +48369,7 @@ ${queuedText}` : queuedText;
48369
48369
  if (keyMatchers["app.showErrorDetails" /* SHOW_ERROR_DETAILS */](key)) {
48370
48370
  if (settings.merged.general.devtools) {
48371
48371
  void (async () => {
48372
- const { toggleDevToolsPanel } = await import("./devtoolsService-VU7N6PSG.js");
48372
+ const { toggleDevToolsPanel } = await import("./devtoolsService-ZKU2HLK2.js");
48373
48373
  await toggleDevToolsPanel(
48374
48374
  config,
48375
48375
  showErrorDetails,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@google/gemini-cli-devtools",
3
- "version": "0.36.0-preview.8",
3
+ "version": "0.36.0",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",
@@ -11,7 +11,7 @@ import {
11
11
  openBrowserSecurely,
12
12
  refreshAccessToken,
13
13
  startCallbackServer
14
- } from "./chunk-N22U7LIR.js";
14
+ } from "./chunk-2OFO4ODK.js";
15
15
  import {
16
16
  FatalCancellationError,
17
17
  Storage,
@@ -11,7 +11,7 @@ import {
11
11
  openBrowserSecurely,
12
12
  refreshAccessToken,
13
13
  startCallbackServer
14
- } from "./chunk-5JDHTAA3.js";
14
+ } from "./chunk-QVTX2M5J.js";
15
15
  import {
16
16
  FatalCancellationError,
17
17
  Storage,
@@ -11,42 +11,42 @@ import {
11
11
  openBrowserSecurely,
12
12
  refreshAccessToken,
13
13
  startCallbackServer
14
- } from "./chunk-X6CSYCBW.js";
14
+ } from "./chunk-VB55KQW3.js";
15
15
  import {
16
16
  FatalCancellationError,
17
17
  Storage,
18
18
  coreEvents,
19
19
  debugLogger,
20
20
  getErrorMessage
21
- } from "./chunk-S2IQOR7T.js";
21
+ } from "./chunk-MYI75E6G.js";
22
22
  import "./chunk-664ZODQF.js";
23
23
  import "./chunk-RJTRUG2J.js";
24
24
  import "./chunk-IUUIT4SU.js";
25
25
  import "./chunk-34MYV7JD.js";
26
26
 
27
- // packages/core/dist/src/agents/auth-provider/oauth2-provider.js
27
+ // packages/core/src/agents/auth-provider/oauth2-provider.ts
28
28
  var OAuth2AuthProvider = class extends BaseA2AAuthProvider {
29
- config;
30
- agentName;
31
- agentCardUrl;
32
- type = "oauth2";
33
- tokenStorage;
34
- cachedToken = null;
35
- /** Resolved OAuth URLs — may come from config or agent card. */
36
- authorizationUrl;
37
- tokenUrl;
38
- scopes;
39
29
  constructor(config, agentName, agentCard, agentCardUrl) {
40
30
  super();
41
31
  this.config = config;
42
32
  this.agentName = agentName;
43
33
  this.agentCardUrl = agentCardUrl;
44
- this.tokenStorage = new MCPOAuthTokenStorage(Storage.getA2AOAuthTokensPath(), "gemini-cli-a2a");
34
+ this.tokenStorage = new MCPOAuthTokenStorage(
35
+ Storage.getA2AOAuthTokensPath(),
36
+ "gemini-cli-a2a"
37
+ );
45
38
  this.authorizationUrl = config.authorization_url;
46
39
  this.tokenUrl = config.token_url;
47
40
  this.scopes = config.scopes;
48
41
  this.mergeAgentCardDefaults(agentCard);
49
42
  }
43
+ type = "oauth2";
44
+ tokenStorage;
45
+ cachedToken = null;
46
+ /** Resolved OAuth URLs — may come from config or agent card. */
47
+ authorizationUrl;
48
+ tokenUrl;
49
+ scopes;
50
50
  /**
51
51
  * Initialize the provider by loading any persisted token from storage.
52
52
  * Also discovers OAuth URLs from the agent card if not yet resolved.
@@ -58,7 +58,9 @@ var OAuth2AuthProvider = class extends BaseA2AAuthProvider {
58
58
  const credentials = await this.tokenStorage.getCredentials(this.agentName);
59
59
  if (credentials && !this.tokenStorage.isTokenExpired(credentials.token)) {
60
60
  this.cachedToken = credentials.token;
61
- debugLogger.debug(`[OAuth2AuthProvider] Loaded valid cached token for "${this.agentName}"`);
61
+ debugLogger.debug(
62
+ `[OAuth2AuthProvider] Loaded valid cached token for "${this.agentName}"`
63
+ );
62
64
  }
63
65
  }
64
66
  /**
@@ -71,16 +73,25 @@ var OAuth2AuthProvider = class extends BaseA2AAuthProvider {
71
73
  }
72
74
  if (this.cachedToken?.refreshToken && this.tokenUrl && this.config.client_id) {
73
75
  try {
74
- const refreshed = await refreshAccessToken({
75
- clientId: this.config.client_id,
76
- clientSecret: this.config.client_secret,
77
- scopes: this.scopes
78
- }, this.cachedToken.refreshToken, this.tokenUrl);
79
- this.cachedToken = this.toOAuthToken(refreshed, this.cachedToken.refreshToken);
76
+ const refreshed = await refreshAccessToken(
77
+ {
78
+ clientId: this.config.client_id,
79
+ clientSecret: this.config.client_secret,
80
+ scopes: this.scopes
81
+ },
82
+ this.cachedToken.refreshToken,
83
+ this.tokenUrl
84
+ );
85
+ this.cachedToken = this.toOAuthToken(
86
+ refreshed,
87
+ this.cachedToken.refreshToken
88
+ );
80
89
  await this.persistToken();
81
90
  return { Authorization: `Bearer ${this.cachedToken.accessToken}` };
82
91
  } catch (error) {
83
- debugLogger.debug(`[OAuth2AuthProvider] Refresh failed, falling back to interactive flow: ${getErrorMessage(error)}`);
92
+ debugLogger.debug(
93
+ `[OAuth2AuthProvider] Refresh failed, falling back to interactive flow: ${getErrorMessage(error)}`
94
+ );
84
95
  await this.tokenStorage.deleteCredentials(this.agentName);
85
96
  }
86
97
  }
@@ -99,7 +110,9 @@ var OAuth2AuthProvider = class extends BaseA2AAuthProvider {
99
110
  return void 0;
100
111
  }
101
112
  this.authRetryCount++;
102
- debugLogger.debug("[OAuth2AuthProvider] Auth failure, clearing token and re-authenticating");
113
+ debugLogger.debug(
114
+ "[OAuth2AuthProvider] Auth failure, clearing token and re-authenticating"
115
+ );
103
116
  this.cachedToken = null;
104
117
  await this.tokenStorage.deleteCredentials(this.agentName);
105
118
  return this.headers();
@@ -112,8 +125,7 @@ var OAuth2AuthProvider = class extends BaseA2AAuthProvider {
112
125
  * `securitySchemes` when not already provided via user config.
113
126
  */
114
127
  mergeAgentCardDefaults(agentCard) {
115
- if (!agentCard?.securitySchemes)
116
- return;
128
+ if (!agentCard?.securitySchemes) return;
117
129
  for (const scheme of Object.values(agentCard.securitySchemes)) {
118
130
  if (scheme.type === "oauth2" && scheme.flows.authorizationCode) {
119
131
  const flow = scheme.flows.authorizationCode;
@@ -129,15 +141,18 @@ var OAuth2AuthProvider = class extends BaseA2AAuthProvider {
129
141
  * (which normalizes proto-format cards) and extract OAuth2 URLs.
130
142
  */
131
143
  async fetchAgentCardDefaults() {
132
- if (!this.agentCardUrl)
133
- return;
144
+ if (!this.agentCardUrl) return;
134
145
  try {
135
- debugLogger.debug(`[OAuth2AuthProvider] Fetching agent card from ${this.agentCardUrl}`);
146
+ debugLogger.debug(
147
+ `[OAuth2AuthProvider] Fetching agent card from ${this.agentCardUrl}`
148
+ );
136
149
  const resolver = new DefaultAgentCardResolver();
137
150
  const card = await resolver.resolve(this.agentCardUrl, "");
138
151
  this.mergeAgentCardDefaults(card);
139
152
  } catch (error) {
140
- debugLogger.warn(`[OAuth2AuthProvider] Could not fetch agent card for OAuth URL discovery: ${getErrorMessage(error)}`);
153
+ debugLogger.warn(
154
+ `[OAuth2AuthProvider] Could not fetch agent card for OAuth URL discovery: ${getErrorMessage(error)}`
155
+ );
141
156
  }
142
157
  }
143
158
  /**
@@ -145,10 +160,14 @@ var OAuth2AuthProvider = class extends BaseA2AAuthProvider {
145
160
  */
146
161
  async authenticateInteractively() {
147
162
  if (!this.config.client_id) {
148
- throw new Error(`OAuth2 authentication for agent "${this.agentName}" requires a client_id. Add client_id to the auth config in your agent definition.`);
163
+ throw new Error(
164
+ `OAuth2 authentication for agent "${this.agentName}" requires a client_id. Add client_id to the auth config in your agent definition.`
165
+ );
149
166
  }
150
167
  if (!this.authorizationUrl || !this.tokenUrl) {
151
- 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.`);
168
+ throw new Error(
169
+ `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.`
170
+ );
152
171
  }
153
172
  const flowConfig = {
154
173
  clientId: this.config.client_id,
@@ -167,25 +186,36 @@ var OAuth2AuthProvider = class extends BaseA2AAuthProvider {
167
186
  redirectPort,
168
187
  /* resource= */
169
188
  void 0
189
+ // No MCP resource parameter for A2A.
190
+ );
191
+ const consent = await getConsentForOauth(
192
+ `Authentication required for A2A agent: '${this.agentName}'.`
170
193
  );
171
- const consent = await getConsentForOauth(`Authentication required for A2A agent: '${this.agentName}'.`);
172
194
  if (!consent) {
173
195
  throw new FatalCancellationError("Authentication cancelled by user.");
174
196
  }
175
- coreEvents.emitFeedback("info", `\u2192 Opening your browser for OAuth sign-in...
197
+ coreEvents.emitFeedback(
198
+ "info",
199
+ `\u2192 Opening your browser for OAuth sign-in...
176
200
 
177
201
  If the browser does not open, copy and paste this URL into your browser:
178
202
  ${authUrl}
179
203
 
180
204
  \u{1F4A1} TIP: Triple-click to select the entire URL, then copy and paste it into your browser.
181
- \u26A0\uFE0F Make sure to copy the COMPLETE URL - it may wrap across multiple lines.`);
205
+ \u26A0\uFE0F Make sure to copy the COMPLETE URL - it may wrap across multiple lines.`
206
+ );
182
207
  try {
183
208
  await openBrowserSecurely(authUrl);
184
209
  } catch (error) {
185
- debugLogger.warn("Failed to open browser automatically:", getErrorMessage(error));
210
+ debugLogger.warn(
211
+ "Failed to open browser automatically:",
212
+ getErrorMessage(error)
213
+ );
186
214
  }
187
215
  const { code } = await callbackServer.response;
188
- debugLogger.debug("\u2713 Authorization code received, exchanging for tokens...");
216
+ debugLogger.debug(
217
+ "\u2713 Authorization code received, exchanging for tokens..."
218
+ );
189
219
  const tokenResponse = await exchangeCodeForToken(
190
220
  flowConfig,
191
221
  code,
@@ -222,9 +252,13 @@ ${authUrl}
222
252
  * Persist the current cached token to disk.
223
253
  */
224
254
  async persistToken() {
225
- if (!this.cachedToken)
226
- return;
227
- await this.tokenStorage.saveToken(this.agentName, this.cachedToken, this.config.client_id, this.tokenUrl);
255
+ if (!this.cachedToken) return;
256
+ await this.tokenStorage.saveToken(
257
+ this.agentName,
258
+ this.cachedToken,
259
+ this.config.client_id,
260
+ this.tokenUrl
261
+ );
228
262
  }
229
263
  };
230
264
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@google/gemini-cli",
3
- "version": "0.36.0-preview.8",
3
+ "version": "0.36.0",
4
4
  "description": "Gemini CLI",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {