@google/gemini-cli 0.36.0-preview.7 → 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 (28) hide show
  1. package/bundle/{chunk-NYCY3Q2B.js → chunk-2OFO4ODK.js} +5 -5
  2. package/bundle/{chunk-2RCLDWUX.js → chunk-EAXTBDLN.js} +7380 -2768
  3. package/bundle/{chunk-QTVUHTZR.js → chunk-GHJNEZXJ.js} +7435 -2835
  4. package/bundle/{chunk-VA3P26WZ.js → chunk-QVTX2M5J.js} +5 -5
  5. package/bundle/{chunk-APAYS2LE.js → chunk-UNM3DGTG.js} +7380 -2768
  6. package/bundle/{chunk-EHC7O4TG.js → chunk-VB55KQW3.js} +10496 -5616
  7. package/bundle/{core-BHH4RB6L.js → core-6V2OYDRU.js} +1 -1
  8. package/bundle/{dist-YHAAIIZP.js → core-BMLL5RF4.js} +2 -2
  9. package/bundle/{devtoolsService-STAWBGOY.js → devtoolsService-QTW7GHQP.js} +2 -2
  10. package/bundle/{devtoolsService-GJALET3B.js → devtoolsService-UL6JE436.js} +4 -5
  11. package/bundle/{devtoolsService-4QGIZO5B.js → devtoolsService-ZKU2HLK2.js} +2 -2
  12. package/bundle/{dist-SWQPYLLV.js → dist-PYC2JXAJ.js} +1 -1
  13. package/bundle/docs/reference/configuration.md +1 -1
  14. package/bundle/gemini.js +6 -6
  15. package/bundle/{interactiveCli-MEBWWWE7.js → interactiveCli-A6HZ2TDO.js} +16 -15
  16. package/bundle/{interactiveCli-HYY2W6AF.js → interactiveCli-DWMSDCKV.js} +248 -264
  17. package/bundle/{interactiveCli-B6Y3UISW.js → interactiveCli-VLQHRXHU.js} +16 -15
  18. package/bundle/node_modules/@google/gemini-cli-devtools/package.json +1 -1
  19. package/bundle/{oauth2-provider-IGY3DL3D.js → oauth2-provider-5ENESIRQ.js} +1 -1
  20. package/bundle/{oauth2-provider-DLPX23GY.js → oauth2-provider-CAKFQRQV.js} +1 -1
  21. package/bundle/{oauth2-provider-MKUXMD5I.js → oauth2-provider-RVED6DAZ.js} +73 -39
  22. package/package.json +1 -1
  23. package/bundle/chunk-GDBDMLKR.js +0 -354180
  24. package/bundle/chunk-YTGZ6CSI.js +0 -93293
  25. package/bundle/devtoolsService-Q6LGZKTJ.js +0 -854
  26. package/bundle/dist-YOBWJF52.js +0 -1886
  27. package/bundle/interactiveCli-YJFA3P4G.js +0 -49298
  28. package/bundle/oauth2-provider-TIKPJAVU.js +0 -237
@@ -55,6 +55,7 @@ import {
55
55
  SettingScope,
56
56
  SettingsContext,
57
57
  Static,
58
+ StyledLine,
58
59
  TOGGLE_TYPES,
59
60
  TOOL_STATUS,
60
61
  TOOL_SUCCESS_RATE_HIGH,
@@ -181,7 +182,7 @@ import {
181
182
  widestLineFromStyledChars,
182
183
  wordBreakStyledChars,
183
184
  wrapStyledChars
184
- } from "./chunk-YTGZ6CSI.js";
185
+ } from "./chunk-UNM3DGTG.js";
185
186
  import {
186
187
  ApiKeyUpdatedEvent,
187
188
  AsyncFzf,
@@ -300,7 +301,7 @@ import {
300
301
  validatePlanContent,
301
302
  validatePlanPath,
302
303
  writeToStdout
303
- } from "./chunk-GDBDMLKR.js";
304
+ } from "./chunk-QVTX2M5J.js";
304
305
  import {
305
306
  ACTIVATE_SKILL_TOOL_NAME,
306
307
  ApprovalMode,
@@ -19858,13 +19859,13 @@ var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1);
19858
19859
  var MIN_COLUMN_WIDTH = 5;
19859
19860
  var COLUMN_PADDING = 2;
19860
19861
  var TABLE_MARGIN = 2;
19861
- var parseMarkdownToStyledChars = (text, defaultColor) => {
19862
+ var parseMarkdownToStyledLine = (text, defaultColor) => {
19862
19863
  const ansi = parseMarkdownToANSI(text, defaultColor);
19863
19864
  return toStyledCharacters(ansi);
19864
19865
  };
19865
- var calculateWidths = (styledChars) => {
19866
- const contentWidth = styledCharsWidth(styledChars);
19867
- const words = wordBreakStyledChars(styledChars);
19866
+ var calculateWidths = (styledLine) => {
19867
+ const contentWidth = styledCharsWidth(styledLine);
19868
+ const words = wordBreakStyledChars(styledLine);
19868
19869
  const maxWordWidth = widestLineFromStyledChars(words);
19869
19870
  return { contentWidth, maxWordWidth };
19870
19871
  };
@@ -19875,7 +19876,7 @@ var TableRenderer = ({
19875
19876
  }) => {
19876
19877
  const styledHeaders = (0, import_react7.useMemo)(
19877
19878
  () => headers.map(
19878
- (header) => parseMarkdownToStyledChars(
19879
+ (header) => parseMarkdownToStyledLine(
19879
19880
  stripUnsafeCharacters(header),
19880
19881
  theme.text.link
19881
19882
  )
@@ -19885,7 +19886,7 @@ var TableRenderer = ({
19885
19886
  const styledRows = (0, import_react7.useMemo)(
19886
19887
  () => rows.map(
19887
19888
  (row) => row.map(
19888
- (cell) => parseMarkdownToStyledChars(
19889
+ (cell) => parseMarkdownToStyledLine(
19889
19890
  stripUnsafeCharacters(cell),
19890
19891
  theme.text.primary
19891
19892
  )
@@ -19900,11 +19901,11 @@ var TableRenderer = ({
19900
19901
  );
19901
19902
  const constraints = Array.from({ length: numColumns }).map(
19902
19903
  (_, colIndex) => {
19903
- const headerStyledChars = styledHeaders[colIndex] || [];
19904
- let { contentWidth: maxContentWidth, maxWordWidth } = calculateWidths(headerStyledChars);
19904
+ const headerStyledLine = styledHeaders[colIndex] || StyledLine.empty(0);
19905
+ let { contentWidth: maxContentWidth, maxWordWidth } = calculateWidths(headerStyledLine);
19905
19906
  styledRows.forEach((row) => {
19906
- const cellStyledChars = row[colIndex] || [];
19907
- const { contentWidth: cellWidth, maxWordWidth: cellWordWidth } = calculateWidths(cellStyledChars);
19907
+ const cellStyledLine = row[colIndex] || StyledLine.empty(0);
19908
+ const { contentWidth: cellWidth, maxWordWidth: cellWordWidth } = calculateWidths(cellStyledLine);
19908
19909
  maxContentWidth = Math.max(maxContentWidth, cellWidth);
19909
19910
  maxWordWidth = Math.max(maxWordWidth, cellWordWidth);
19910
19911
  });
@@ -19957,11 +19958,11 @@ var TableRenderer = ({
19957
19958
  const wrapAndProcessRow = (row) => {
19958
19959
  const rowResult = [];
19959
19960
  for (let colIndex = 0; colIndex < numColumns; colIndex++) {
19960
- const cellStyledChars = row[colIndex] || [];
19961
+ const cellStyledLine = row[colIndex] || StyledLine.empty(0);
19961
19962
  const allocatedWidth = finalContentWidths[colIndex];
19962
19963
  const contentWidth = Math.max(1, allocatedWidth);
19963
19964
  const wrappedStyledLines = wrapStyledChars(
19964
- cellStyledChars,
19965
+ cellStyledLine,
19965
19966
  contentWidth
19966
19967
  );
19967
19968
  const maxLineWidth = widestLineFromStyledChars(wrappedStyledLines);
@@ -48368,7 +48369,7 @@ ${queuedText}` : queuedText;
48368
48369
  if (keyMatchers["app.showErrorDetails" /* SHOW_ERROR_DETAILS */](key)) {
48369
48370
  if (settings.merged.general.devtools) {
48370
48371
  void (async () => {
48371
- const { toggleDevToolsPanel } = await import("./devtoolsService-Q6LGZKTJ.js");
48372
+ const { toggleDevToolsPanel } = await import("./devtoolsService-ZKU2HLK2.js");
48372
48373
  await toggleDevToolsPanel(
48373
48374
  config,
48374
48375
  showErrorDetails,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@google/gemini-cli-devtools",
3
- "version": "0.36.0-preview.7",
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-NYCY3Q2B.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-GDBDMLKR.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-VA3P26WZ.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.7",
3
+ "version": "0.36.0",
4
4
  "description": "Gemini CLI",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {