@google/gemini-cli 0.46.0-preview.2 → 0.46.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 (67) hide show
  1. package/bundle/builtin/antigravity-support/SKILL.md +58 -0
  2. package/bundle/{chunk-PIZZXDDG.js → chunk-46UNR4SE.js} +1 -1
  3. package/bundle/{chunk-E5QEVDYZ.js → chunk-6ZHP2EJW.js} +77 -12
  4. package/bundle/{chunk-PE7HOVW5.js → chunk-7EBO46BD.js} +2 -2
  5. package/bundle/{chunk-2K6L5FOH.js → chunk-BM5TFZWV.js} +1 -1
  6. package/bundle/{chunk-R4U5N4EA.js → chunk-CSKXYL76.js} +2 -2
  7. package/bundle/{chunk-RS7XVABE.js → chunk-EMVR5JTF.js} +8 -9
  8. package/bundle/{chunk-27JE2WT6.js → chunk-FC67CGD5.js} +1 -1
  9. package/bundle/{chunk-O6PTG534.js → chunk-G33JEOEV.js} +14132 -7532
  10. package/bundle/{chunk-J5LPI3LE.js → chunk-GPDO3T5B.js} +3 -3
  11. package/bundle/{chunk-7JQYEHGG.js → chunk-I4F637TN.js} +1 -1
  12. package/bundle/{chunk-LEOT5EUQ.js → chunk-IZGZZO6A.js} +1 -1
  13. package/bundle/{chunk-CRQJBWDY.js → chunk-IZZGJPR3.js} +1 -1
  14. package/bundle/{chunk-PRRK6JDC.js → chunk-JOFGDFVN.js} +3 -3
  15. package/bundle/{chunk-B5F4VQB4.js → chunk-MKQJU6N7.js} +1 -1
  16. package/bundle/{chunk-CWVF4ZTK.js → chunk-O3ZM34A3.js} +1 -1
  17. package/bundle/{chunk-EI75YPWJ.js → chunk-RCJSF5RP.js} +64 -8
  18. package/bundle/{chunk-SIKHBFAN.js → chunk-S5WKKTEF.js} +3 -3
  19. package/bundle/{chunk-QB7YVNGV.js → chunk-SCXTH56Q.js} +165 -114
  20. package/bundle/{chunk-5IDNG2OG.js → chunk-T55FPMGN.js} +212 -174
  21. package/bundle/{chunk-QW5AOX4N.js → chunk-V2OCZBTI.js} +5 -8
  22. package/bundle/{chunk-WUZJ6YCQ.js → chunk-VFPQ45DS.js} +2 -2
  23. package/bundle/{chunk-22XWYJCL.js → chunk-XWSJWBAL.js} +165 -114
  24. package/bundle/{chunk-RHCHEKOW.js → chunk-YIJWUMMP.js} +1 -1
  25. package/bundle/{chunk-7PDJUYG7.js → chunk-YIKH5LDT.js} +1 -1
  26. package/bundle/{cleanup-I5FUY2UQ.js → cleanup-HCSVNXSL.js} +2 -2
  27. package/bundle/{cleanup-OIBS4TJ5.js → cleanup-KA5YYXS3.js} +2 -2
  28. package/bundle/{cleanup-RODT76X7.js → cleanup-SBGWM3G7.js} +2 -2
  29. package/bundle/{dist-XLM4ONR2.js → core-K77SYAQL.js} +3 -1
  30. package/bundle/{core-DU2UPBEJ.js → core-LVRAYGT3.js} +3 -1
  31. package/bundle/{devtoolsService-C64GR2SQ.js → devtoolsService-ADGLR4UM.js} +2 -2
  32. package/bundle/{devtoolsService-U7Z6S7CA.js → devtoolsService-ORERBA72.js} +3 -4
  33. package/bundle/{devtoolsService-EJVCNXD4.js → devtoolsService-WRHZUKOW.js} +2 -2
  34. package/bundle/{dist-CEGGZCD6.js → dist-6R4J6OFH.js} +3 -1
  35. package/bundle/{gemini-EEFZ4W4N.js → gemini-LOO67E54.js} +196 -212
  36. package/bundle/{gemini-D5Y26G7I.js → gemini-STIONCRJ.js} +14 -14
  37. package/bundle/{gemini-3AA27X7W.js → gemini-YXO2QQ66.js} +14 -14
  38. package/bundle/gemini.js +7 -7
  39. package/bundle/{interactiveCli-B5QE2YQH.js → interactiveCli-F337IDVS.js} +30 -20
  40. package/bundle/{interactiveCli-5L4XUO4D.js → interactiveCli-NKTBHB7O.js} +30 -20
  41. package/bundle/{interactiveCli-S4W3W3HM.js → interactiveCli-OYDA765S.js} +317 -326
  42. package/bundle/{liteRtServerManager-2IHVDPV4.js → liteRtServerManager-6CQ3NBHQ.js} +4 -4
  43. package/bundle/{liteRtServerManager-7CA6UZB6.js → liteRtServerManager-N7CBKKD6.js} +4 -4
  44. package/bundle/{liteRtServerManager-P4UUE4PT.js → liteRtServerManager-YBJANX3B.js} +4 -4
  45. package/bundle/{oauth2-provider-WD62E6UF.js → oauth2-provider-AAJFAFW6.js} +1 -1
  46. package/bundle/{oauth2-provider-5IAYEVTS.js → oauth2-provider-CYIU4X4W.js} +1 -1
  47. package/bundle/{oauth2-provider-NQK2KDLL.js → oauth2-provider-YNWUFCNW.js} +72 -38
  48. package/bundle/{start-AAWVXW3L.js → start-CNBBYSNI.js} +6 -6
  49. package/bundle/{start-EHQUCJL4.js → start-DEWQ46DT.js} +6 -6
  50. package/bundle/{start-EJWSTD4L.js → start-H7TCWGQL.js} +6 -6
  51. package/package.json +1 -1
  52. package/bundle/chunk-3RBWPCUC.js +0 -154
  53. package/bundle/chunk-IPUQ7EE3.js +0 -81685
  54. package/bundle/chunk-NV6UIB5A.js +0 -1571
  55. package/bundle/chunk-R4UEOSDC.js +0 -398
  56. package/bundle/chunk-UEE43LJM.js +0 -118
  57. package/bundle/chunk-UHZJ6CQN.js +0 -17320
  58. package/bundle/chunk-USOBCNPR.js +0 -394545
  59. package/bundle/chunk-ZXFPRK6W.js +0 -512
  60. package/bundle/cleanup-WY7MMPH7.js +0 -32
  61. package/bundle/devtoolsService-LQXWZBCZ.js +0 -856
  62. package/bundle/dist-F4ZLD67R.js +0 -2140
  63. package/bundle/gemini-TPWWVYVB.js +0 -16409
  64. package/bundle/interactiveCli-CFKGEXFE.js +0 -34742
  65. package/bundle/liteRtServerManager-YN3VGMDA.js +0 -65
  66. package/bundle/oauth2-provider-WGTNZKF7.js +0 -235
  67. package/bundle/start-LAOVDDQF.js +0 -18
@@ -3,11 +3,11 @@ import {
3
3
  DEFAULT_PORT,
4
4
  getBinaryPath,
5
5
  isServerRunning
6
- } from "./chunk-UHZJ6CQN.js";
7
- import "./chunk-RS7XVABE.js";
6
+ } from "./chunk-MKQJU6N7.js";
7
+ import "./chunk-EMVR5JTF.js";
8
8
  import {
9
9
  debugLogger
10
- } from "./chunk-O6PTG534.js";
10
+ } from "./chunk-G33JEOEV.js";
11
11
  import "./chunk-6HI7VNOG.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-LAOVDDQF.js");
44
+ const { startServer } = await import("./start-DEWQ46DT.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-B5F4VQB4.js";
7
- import "./chunk-2K6L5FOH.js";
6
+ } from "./chunk-V2OCZBTI.js";
7
+ import "./chunk-BM5TFZWV.js";
8
8
  import {
9
9
  debugLogger
10
- } from "./chunk-E5QEVDYZ.js";
10
+ } from "./chunk-6ZHP2EJW.js";
11
11
  import "./chunk-6HI7VNOG.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-EHQUCJL4.js");
44
+ const { startServer } = await import("./start-H7TCWGQL.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-QW5AOX4N.js";
7
- import "./chunk-RHCHEKOW.js";
6
+ } from "./chunk-YIKH5LDT.js";
7
+ import "./chunk-YIJWUMMP.js";
8
8
  import {
9
9
  debugLogger
10
- } from "./chunk-EI75YPWJ.js";
10
+ } from "./chunk-RCJSF5RP.js";
11
11
  import "./chunk-6HI7VNOG.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-AAWVXW3L.js");
44
+ const { startServer } = await import("./start-CNBBYSNI.js");
45
45
  const started = await startServer(binaryPath, port);
46
46
  if (started) {
47
47
  debugLogger.log(`[LiteRtServerManager] Server started on port ${port}`);
@@ -16,7 +16,7 @@ import {
16
16
  openBrowserSecurely,
17
17
  refreshAccessToken,
18
18
  startCallbackServer
19
- } from "./chunk-E5QEVDYZ.js";
19
+ } from "./chunk-G33JEOEV.js";
20
20
  import "./chunk-6HI7VNOG.js";
21
21
  import "./chunk-TUDYL3X4.js";
22
22
  import "./chunk-IUUIT4SU.js";
@@ -16,7 +16,7 @@ import {
16
16
  openBrowserSecurely,
17
17
  refreshAccessToken,
18
18
  startCallbackServer
19
- } from "./chunk-O6PTG534.js";
19
+ } from "./chunk-RCJSF5RP.js";
20
20
  import "./chunk-6HI7VNOG.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-EI75YPWJ.js";
19
+ } from "./chunk-6ZHP2EJW.js";
20
20
  import "./chunk-6HI7VNOG.js";
21
21
  import "./chunk-TUDYL3X4.js";
22
22
  import "./chunk-IUUIT4SU.js";
23
23
  import "./chunk-34MYV7JD.js";
24
24
 
25
- // packages/core/dist/src/agents/auth-provider/oauth2-provider.js
25
+ // packages/core/src/agents/auth-provider/oauth2-provider.ts
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;
37
27
  constructor(config, agentName, agentCard, agentCardUrl) {
38
28
  super();
39
29
  this.config = config;
40
30
  this.agentName = agentName;
41
31
  this.agentCardUrl = agentCardUrl;
42
- this.tokenStorage = new MCPOAuthTokenStorage(Storage.getA2AOAuthTokensPath(), "gemini-cli-a2a");
32
+ this.tokenStorage = new MCPOAuthTokenStorage(
33
+ Storage.getA2AOAuthTokensPath(),
34
+ "gemini-cli-a2a"
35
+ );
43
36
  this.authorizationUrl = config.authorization_url;
44
37
  this.tokenUrl = config.token_url;
45
38
  this.scopes = config.scopes;
46
39
  this.mergeAgentCardDefaults(agentCard);
47
40
  }
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,7 +56,9 @@ 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(`[OAuth2AuthProvider] Loaded valid cached token for "${this.agentName}"`);
59
+ debugLogger.debug(
60
+ `[OAuth2AuthProvider] Loaded valid cached token for "${this.agentName}"`
61
+ );
60
62
  }
61
63
  }
62
64
  /**
@@ -69,16 +71,25 @@ var OAuth2AuthProvider = class extends BaseA2AAuthProvider {
69
71
  }
70
72
  if (this.cachedToken?.refreshToken && this.tokenUrl && this.config.client_id) {
71
73
  try {
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);
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
+ );
78
87
  await this.persistToken();
79
88
  return { Authorization: `Bearer ${this.cachedToken.accessToken}` };
80
89
  } catch (error) {
81
- debugLogger.debug(`[OAuth2AuthProvider] Refresh failed, falling back to interactive flow: ${getErrorMessage(error)}`);
90
+ debugLogger.debug(
91
+ `[OAuth2AuthProvider] Refresh failed, falling back to interactive flow: ${getErrorMessage(error)}`
92
+ );
82
93
  await this.tokenStorage.deleteCredentials(this.agentName);
83
94
  }
84
95
  }
@@ -97,7 +108,9 @@ var OAuth2AuthProvider = class extends BaseA2AAuthProvider {
97
108
  return void 0;
98
109
  }
99
110
  this.authRetryCount++;
100
- debugLogger.debug("[OAuth2AuthProvider] Auth failure, clearing token and re-authenticating");
111
+ debugLogger.debug(
112
+ "[OAuth2AuthProvider] Auth failure, clearing token and re-authenticating"
113
+ );
101
114
  this.cachedToken = null;
102
115
  await this.tokenStorage.deleteCredentials(this.agentName);
103
116
  return this.headers();
@@ -110,8 +123,7 @@ var OAuth2AuthProvider = class extends BaseA2AAuthProvider {
110
123
  * `securitySchemes` when not already provided via user config.
111
124
  */
112
125
  mergeAgentCardDefaults(agentCard) {
113
- if (!agentCard?.securitySchemes)
114
- return;
126
+ if (!agentCard?.securitySchemes) return;
115
127
  for (const scheme of Object.values(agentCard.securitySchemes)) {
116
128
  if (scheme.type === "oauth2" && scheme.flows.authorizationCode) {
117
129
  const flow = scheme.flows.authorizationCode;
@@ -127,15 +139,18 @@ var OAuth2AuthProvider = class extends BaseA2AAuthProvider {
127
139
  * (which normalizes proto-format cards) and extract OAuth2 URLs.
128
140
  */
129
141
  async fetchAgentCardDefaults() {
130
- if (!this.agentCardUrl)
131
- return;
142
+ if (!this.agentCardUrl) return;
132
143
  try {
133
- debugLogger.debug(`[OAuth2AuthProvider] Fetching agent card from ${this.agentCardUrl}`);
144
+ debugLogger.debug(
145
+ `[OAuth2AuthProvider] Fetching agent card from ${this.agentCardUrl}`
146
+ );
134
147
  const resolver = new DefaultAgentCardResolver();
135
148
  const card = await resolver.resolve(this.agentCardUrl, "");
136
149
  this.mergeAgentCardDefaults(card);
137
150
  } catch (error) {
138
- debugLogger.warn(`[OAuth2AuthProvider] Could not fetch agent card for OAuth URL discovery: ${getErrorMessage(error)}`);
151
+ debugLogger.warn(
152
+ `[OAuth2AuthProvider] Could not fetch agent card for OAuth URL discovery: ${getErrorMessage(error)}`
153
+ );
139
154
  }
140
155
  }
141
156
  /**
@@ -143,10 +158,14 @@ var OAuth2AuthProvider = class extends BaseA2AAuthProvider {
143
158
  */
144
159
  async authenticateInteractively() {
145
160
  if (!this.config.client_id) {
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.`);
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
+ );
147
164
  }
148
165
  if (!this.authorizationUrl || !this.tokenUrl) {
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.`);
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
+ );
150
169
  }
151
170
  const flowConfig = {
152
171
  clientId: this.config.client_id,
@@ -165,25 +184,36 @@ var OAuth2AuthProvider = class extends BaseA2AAuthProvider {
165
184
  redirectPort,
166
185
  /* resource= */
167
186
  void 0
187
+ // No MCP resource parameter for A2A.
188
+ );
189
+ const consent = await getConsentForOauth(
190
+ `Authentication required for A2A agent: '${this.agentName}'.`
168
191
  );
169
- const consent = await getConsentForOauth(`Authentication required for A2A agent: '${this.agentName}'.`);
170
192
  if (!consent) {
171
193
  throw new FatalCancellationError("Authentication cancelled by user.");
172
194
  }
173
- coreEvents.emitFeedback("info", `\u2192 Opening your browser for OAuth sign-in...
195
+ coreEvents.emitFeedback(
196
+ "info",
197
+ `\u2192 Opening your browser for OAuth sign-in...
174
198
 
175
199
  If the browser does not open, copy and paste this URL into your browser:
176
200
  ${authUrl}
177
201
 
178
202
  \u{1F4A1} TIP: Triple-click to select the entire URL, then copy and paste it into your browser.
179
- \u26A0\uFE0F Make sure to copy the COMPLETE URL - it may wrap across multiple lines.`);
203
+ \u26A0\uFE0F Make sure to copy the COMPLETE URL - it may wrap across multiple lines.`
204
+ );
180
205
  try {
181
206
  await openBrowserSecurely(authUrl);
182
207
  } catch (error) {
183
- debugLogger.warn("Failed to open browser automatically:", getErrorMessage(error));
208
+ debugLogger.warn(
209
+ "Failed to open browser automatically:",
210
+ getErrorMessage(error)
211
+ );
184
212
  }
185
213
  const { code } = await callbackServer.response;
186
- debugLogger.debug("\u2713 Authorization code received, exchanging for tokens...");
214
+ debugLogger.debug(
215
+ "\u2713 Authorization code received, exchanging for tokens..."
216
+ );
187
217
  const tokenResponse = await exchangeCodeForToken(
188
218
  flowConfig,
189
219
  code,
@@ -220,9 +250,13 @@ ${authUrl}
220
250
  * Persist the current cached token to disk.
221
251
  */
222
252
  async persistToken() {
223
- if (!this.cachedToken)
224
- return;
225
- await this.tokenStorage.saveToken(this.agentName, this.cachedToken, this.config.client_id, this.tokenUrl);
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
+ );
226
260
  }
227
261
  };
228
262
  export {
@@ -2,12 +2,12 @@ const require = (await import('node:module')).createRequire(import.meta.url); co
2
2
  import {
3
3
  startCommand,
4
4
  startServer
5
- } from "./chunk-PRRK6JDC.js";
6
- import "./chunk-7JQYEHGG.js";
7
- import "./chunk-QW5AOX4N.js";
8
- import "./chunk-RHCHEKOW.js";
9
- import "./chunk-27JE2WT6.js";
10
- import "./chunk-EI75YPWJ.js";
5
+ } from "./chunk-JOFGDFVN.js";
6
+ import "./chunk-O3ZM34A3.js";
7
+ import "./chunk-YIKH5LDT.js";
8
+ import "./chunk-YIJWUMMP.js";
9
+ import "./chunk-FC67CGD5.js";
10
+ import "./chunk-RCJSF5RP.js";
11
11
  import "./chunk-6HI7VNOG.js";
12
12
  import "./chunk-TUDYL3X4.js";
13
13
  import "./chunk-IUUIT4SU.js";
@@ -2,12 +2,12 @@ const require = (await import('node:module')).createRequire(import.meta.url); co
2
2
  import {
3
3
  startCommand,
4
4
  startServer
5
- } from "./chunk-UEE43LJM.js";
6
- import "./chunk-NV6UIB5A.js";
7
- import "./chunk-B5F4VQB4.js";
8
- import "./chunk-2K6L5FOH.js";
9
- import "./chunk-PIZZXDDG.js";
10
- import "./chunk-E5QEVDYZ.js";
5
+ } from "./chunk-S5WKKTEF.js";
6
+ import "./chunk-I4F637TN.js";
7
+ import "./chunk-MKQJU6N7.js";
8
+ import "./chunk-EMVR5JTF.js";
9
+ import "./chunk-IZGZZO6A.js";
10
+ import "./chunk-G33JEOEV.js";
11
11
  import "./chunk-6HI7VNOG.js";
12
12
  import "./chunk-TUDYL3X4.js";
13
13
  import "./chunk-IUUIT4SU.js";
@@ -2,12 +2,12 @@ const require = (await import('node:module')).createRequire(import.meta.url); co
2
2
  import {
3
3
  startCommand,
4
4
  startServer
5
- } from "./chunk-SIKHBFAN.js";
6
- import "./chunk-CRQJBWDY.js";
7
- import "./chunk-7PDJUYG7.js";
8
- import "./chunk-ZXFPRK6W.js";
9
- import "./chunk-3RBWPCUC.js";
10
- import "./chunk-USOBCNPR.js";
5
+ } from "./chunk-GPDO3T5B.js";
6
+ import "./chunk-IZZGJPR3.js";
7
+ import "./chunk-V2OCZBTI.js";
8
+ import "./chunk-BM5TFZWV.js";
9
+ import "./chunk-46UNR4SE.js";
10
+ import "./chunk-6ZHP2EJW.js";
11
11
  import "./chunk-6HI7VNOG.js";
12
12
  import "./chunk-TUDYL3X4.js";
13
13
  import "./chunk-IUUIT4SU.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@google/gemini-cli",
3
- "version": "0.46.0-preview.2",
3
+ "version": "0.46.0",
4
4
  "description": "Gemini CLI",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -1,154 +0,0 @@
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
- ExitCodes,
4
- Storage,
5
- isTelemetrySdkInitialized,
6
- resetBrowserSession,
7
- shutdownTelemetry
8
- } from "./chunk-USOBCNPR.js";
9
-
10
- // packages/cli/src/utils/cleanup.ts
11
- import { promises as fs } from "node:fs";
12
- import { join } from "node:path";
13
- var cleanupFunctions = [];
14
- var syncCleanupFunctions = [];
15
- var configForTelemetry = null;
16
- var isShuttingDown = false;
17
- function registerCleanup(fn) {
18
- cleanupFunctions.push(fn);
19
- }
20
- function removeCleanup(fn) {
21
- const index = cleanupFunctions.indexOf(fn);
22
- if (index !== -1) {
23
- cleanupFunctions.splice(index, 1);
24
- }
25
- }
26
- function registerSyncCleanup(fn) {
27
- syncCleanupFunctions.push(fn);
28
- }
29
- function removeSyncCleanup(fn) {
30
- const index = syncCleanupFunctions.indexOf(fn);
31
- if (index !== -1) {
32
- syncCleanupFunctions.splice(index, 1);
33
- }
34
- }
35
- function resetCleanupForTesting() {
36
- cleanupFunctions.length = 0;
37
- syncCleanupFunctions.length = 0;
38
- configForTelemetry = null;
39
- isShuttingDown = false;
40
- }
41
- function runSyncCleanup() {
42
- for (const fn of syncCleanupFunctions) {
43
- try {
44
- fn();
45
- } catch {
46
- }
47
- }
48
- syncCleanupFunctions.length = 0;
49
- }
50
- function registerTelemetryConfig(config) {
51
- configForTelemetry = config;
52
- }
53
- async function runExitCleanup() {
54
- await drainStdin();
55
- runSyncCleanup();
56
- for (const fn of cleanupFunctions) {
57
- try {
58
- await fn();
59
- } catch {
60
- }
61
- }
62
- cleanupFunctions.length = 0;
63
- try {
64
- await resetBrowserSession();
65
- } catch {
66
- }
67
- if (configForTelemetry) {
68
- try {
69
- await configForTelemetry.dispose();
70
- } catch {
71
- }
72
- }
73
- if (configForTelemetry && isTelemetrySdkInitialized()) {
74
- try {
75
- await shutdownTelemetry(configForTelemetry);
76
- } catch {
77
- }
78
- }
79
- }
80
- async function drainStdin() {
81
- if (!process.stdin?.isTTY) return;
82
- process.stdin.resume().removeAllListeners("data").on("data", () => {
83
- });
84
- await new Promise((resolve) => setTimeout(resolve, 50));
85
- }
86
- async function gracefulShutdown(_reason) {
87
- if (isShuttingDown) {
88
- return;
89
- }
90
- isShuttingDown = true;
91
- await runExitCleanup();
92
- process.exit(ExitCodes.SUCCESS);
93
- }
94
- function setupSignalHandlers() {
95
- process.on("SIGHUP", () => gracefulShutdown("SIGHUP"));
96
- process.on("SIGTERM", () => gracefulShutdown("SIGTERM"));
97
- process.on("SIGINT", () => gracefulShutdown("SIGINT"));
98
- }
99
- function setupTtyCheck() {
100
- let intervalId = null;
101
- let isCheckingTty = false;
102
- intervalId = setInterval(async () => {
103
- if (isCheckingTty || isShuttingDown) {
104
- return;
105
- }
106
- if (process.env["SANDBOX"]) {
107
- return;
108
- }
109
- if (!process.stdin.isTTY && !process.stdout.isTTY) {
110
- isCheckingTty = true;
111
- if (intervalId) {
112
- clearInterval(intervalId);
113
- intervalId = null;
114
- }
115
- await gracefulShutdown("TTY loss");
116
- }
117
- }, 5e3);
118
- intervalId.unref();
119
- return () => {
120
- if (intervalId) {
121
- clearInterval(intervalId);
122
- intervalId = null;
123
- }
124
- };
125
- }
126
- async function cleanupCheckpoints() {
127
- const storage = new Storage(process.cwd());
128
- await storage.initialize();
129
- const tempDir = storage.getProjectTempDir();
130
- const checkpointsDir = join(tempDir, "checkpoints");
131
- try {
132
- await fs.rm(checkpointsDir, { recursive: true, force: true });
133
- } catch {
134
- }
135
- }
136
-
137
- export {
138
- registerCleanup,
139
- removeCleanup,
140
- registerSyncCleanup,
141
- removeSyncCleanup,
142
- resetCleanupForTesting,
143
- runSyncCleanup,
144
- registerTelemetryConfig,
145
- runExitCleanup,
146
- setupSignalHandlers,
147
- setupTtyCheck,
148
- cleanupCheckpoints
149
- };
150
- /**
151
- * @license
152
- * Copyright 2025 Google LLC
153
- * SPDX-License-Identifier: Apache-2.0
154
- */